ham@Neon.Stanford.EDU (Peter R. Ham) (12/15/89)
as should restrict immediate constants to being within the range of -32768..32767. The 1.31 version of as0 fails to do this and lets some positive constants greater than 32767 slip by. Instead of complaining, as0 treats them as negative constants which can create bugs. Give the following assembly, as0 should complain about 5 of the lines, but instead only complains about 3. 32768 and 40072 should be rejected. The results of assembling this are also included. addiu $0,$0, 32767 addiu $0,$0, -32768 addiu $0,$0, 32768 addiu $0,$0, -32769 addiu $0,$0, 40072 addiu $0,$0, 0xfffffff addiu $0,$0, -0xffffff as -v -V immed.s as (as) Mips Computer Systems 1.31 /usr/ucb/what /usr/lib/cpp1.31 /usr/lib/cpp1.31 cpp.c 4.5 ULTRIX 11/2/88 yylex.c 1.3 7/1/83 yaccpar 4.1 (Berkeley) 2/11/83 data.c 4.1 (ULTRIX) 11/23/87 fopen.c 4.1 ULTRIX 11/23/87 sprintf.c 4.2 (ULTRIX) 7/12/88 malloc.c 4.2 (ULTRIX) 7/15/88 fprintf.c 4.2 (ULTRIX) 7/12/88 flsbuf.c 4.1 (ULTRIX) 11/23/87 strlen.c 4.1 (ULTRIX) 7/12/88 calloc.c 4.1 (ULTRIX) 11/23/87 fclose.c 4.1 (ULTRIX) 11/23/87 errlst.c 4.1 ULTRIX 11/23/87 doopen.c 4.1 ULTRIX 11/23/87 findiop.c 4.1 ULTRIX 11/23/87 doprnt.c 4.2 (ULTRIX) 9/19/88 getstdiobuf.c 4.1 (ULTRIX) 11/23/87 ctype.c 4.1 ULTRIX 2/15/88 _locale.c 4.1 ULTRIX 2/15/88 0.0u 0.0s 0:00 28% 15+17k 4+0io 0pf+0w /usr/ucb/what /usr/lib/ccom1.31 /usr/lib/ccom1.31 yaccpar 4.1 (Berkeley) 2/11/83 sprintf.c 4.2 (ULTRIX) 7/12/88 data.c 4.1 (ULTRIX) 11/23/87 freopen.c 4.1 ULTRIX 11/23/87 signal.c 4.2 ULTRIX 1/20/88 ctype.c 4.1 ULTRIX 2/15/88 malloc.c 4.2 (ULTRIX) 7/15/88 fprintf.c 4.2 (ULTRIX) 7/12/88 strlen.c 4.1 (ULTRIX) 7/12/88 printf.c 4.2 (ULTRIX) 7/12/88 strncpy.c 4.1 (ULTRIX) 7/15/88 calloc.c 4.1 (ULTRIX) 11/23/87 fputs.c 4.1 (ULTRIX) 11/23/87 atof.c 4.1 (ULTRIX) 7/12/88 flsbuf.c 4.1 (ULTRIX) 11/23/87 ftell.c 4.1 (ULTRIX) 11/23/87 fseek.c 4.1 (ULTRIX) 11/23/87 fread.c 4.1 (ULTRIX) 11/23/87 fwrite.c 4.1 (ULTRIX) 11/23/87 doprnt.c 4.2 (ULTRIX) 9/19/88 fclose.c 4.1 (ULTRIX) 11/23/87 doopen.c 4.1 ULTRIX 11/23/87 filbuf.c 4.1 ULTRIX 11/23/87 fdopen.c 4.1 ULTRIX 11/23/87 getstdiobuf.c 4.1 (ULTRIX) 11/23/87 _locale.c 4.1 ULTRIX 2/15/88 findiop.c 4.1 ULTRIX 11/23/87 0.3u 0.2s 0:01 33% 10+17k 36+0io 0pf+0w /usr/ucb/what /usr/lib/ujoin1.31 /usr/lib/ujoin1.31 data.c 4.1 (ULTRIX) 11/23/87 fprintf.c 4.2 (ULTRIX) 7/12/88 time.c 4.1 (ULTRIX) 11/23/87 fclose.c 4.1 (ULTRIX) 11/23/87 errlst.c 4.1 ULTRIX 11/23/87 strlen.c 4.1 (ULTRIX) 7/12/88 calloc.c 4.1 (ULTRIX) 11/23/87 malloc.c 4.2 (ULTRIX) 7/15/88 doprnt.c 4.2 (ULTRIX) 9/19/88 fdopen.c 4.1 ULTRIX 11/23/87 fwrite.c 4.1 (ULTRIX) 11/23/87 fseek.c 4.1 (ULTRIX) 11/23/87 ctype.c 4.1 ULTRIX 2/15/88 _locale.c 4.1 ULTRIX 2/15/88 flsbuf.c 4.1 (ULTRIX) 11/23/87 findiop.c 4.1 ULTRIX 11/23/87 filbuf.c 4.1 ULTRIX 11/23/87 getstdiobuf.c 4.1 (ULTRIX) 11/23/87 0.0u 0.0s 0:00 25% 12+17k 11+0io 0pf+0w /usr/ucb/what /usr/bin/uld1.31 /usr/bin/uld1.31 ld.c 4.4 ULTRIX 11/18/88 signal.c 4.2 ULTRIX 1/20/88 sprintf.c 4.2 (ULTRIX) 7/12/88 ctype.c 4.1 ULTRIX 2/15/88 malloc.c 4.2 (ULTRIX) 7/15/88 fprintf.c 4.2 (ULTRIX) 7/12/88 strncmp.c 4.1 (ULTRIX) 7/15/88 strlen.c 4.1 (ULTRIX) 7/12/88 printf.c 4.2 (ULTRIX) 7/12/88 calloc.c 4.1 (ULTRIX) 11/23/87 strncpy.c 4.1 (ULTRIX) 7/15/88 fwrite.c 4.1 (ULTRIX) 11/23/87 errlst.c 4.1 ULTRIX 11/23/87 fopen.c 4.1 ULTRIX 11/23/87 time.c 4.1 (ULTRIX) 11/23/87 filbuf.c 4.1 ULTRIX 11/23/87 fclose.c 4.1 (ULTRIX) 11/23/87 flsbuf.c 4.1 (ULTRIX) 11/23/87 ecvt.c 4.1 (ULTRIX) 7/12/88 doprnt.c 4.2 (ULTRIX) 9/19/88 doopen.c 4.1 ULTRIX 11/23/87 getstdiobuf.c 4.1 (ULTRIX) 11/23/87 _locale.c 4.1 ULTRIX 2/15/88 0.2u 0.1s 0:01 30% 11+17k 28+0io 0pf+0w /usr/ucb/what /usr/lib/usplit1.31 /usr/lib/usplit1.31 data.c 4.1 (ULTRIX) 11/23/87 fprintf.c 4.2 (ULTRIX) 7/12/88 errlst.c 4.1 ULTRIX 11/23/87 strlen.c 4.1 (ULTRIX) 7/12/88 fclose.c 4.1 (ULTRIX) 11/23/87 calloc.c 4.1 (ULTRIX) 11/23/87 malloc.c 4.2 (ULTRIX) 7/15/88 doprnt.c 4.2 (ULTRIX) 9/19/88 fdopen.c 4.1 ULTRIX 11/23/87 fwrite.c 4.1 (ULTRIX) 11/23/87 fseek.c 4.1 (ULTRIX) 11/23/87 ctype.c 4.1 ULTRIX 2/15/88 _locale.c 4.1 ULTRIX 2/15/88 flsbuf.c 4.1 (ULTRIX) 11/23/87 findiop.c 4.1 ULTRIX 11/23/87 filbuf.c 4.1 ULTRIX 11/23/87 getstdiobuf.c 4.1 (ULTRIX) 11/23/87 0.0u 0.0s 0:00 28% 12+16k 9+0io 0pf+0w /usr/ucb/what /usr/lib/umerge1.31 /usr/lib/umerge1.31 fclose.c 4.1 (ULTRIX) 11/23/87 malloc.c 4.2 (ULTRIX) 7/15/88 fopen.c 4.1 ULTRIX 11/23/87 errlst.c 4.1 ULTRIX 11/23/87 fprintf.c 4.2 (ULTRIX) 7/12/88 doprnt.c 4.2 (ULTRIX) 9/19/88 flsbuf.c 4.1 (ULTRIX) 11/23/87 atof.c 4.1 (ULTRIX) 7/12/88 strlen.c 4.1 (ULTRIX) 7/12/88 sprintf.c 4.2 (ULTRIX) 7/12/88 ecvt.c 4.1 (ULTRIX) 7/12/88 calloc.c 4.1 (ULTRIX) 11/23/87 doopen.c 4.1 ULTRIX 11/23/87 filbuf.c 4.1 ULTRIX 11/23/87 ctype.c 4.1 ULTRIX 2/15/88 _locale.c 4.1 ULTRIX 2/15/88 getstdiobuf.c 4.1 (ULTRIX) 11/23/87 fdopen.c 4.1 ULTRIX 11/23/87 fwrite.c 4.1 (ULTRIX) 11/23/87 fseek.c 4.1 (ULTRIX) 11/23/87 0.1u 0.0s 0:00 31% 12+17k 16+0io 0pf+0w /usr/ucb/what /usr/lib/uopt1.31 /usr/lib/uopt1.31 fclose.c 4.1 (ULTRIX) 11/23/87 fprintf.c 4.2 (ULTRIX) 7/12/88 sprintf.c 4.2 (ULTRIX) 7/12/88 flsbuf.c 4.1 (ULTRIX) 11/23/87 strlen.c 4.1 (ULTRIX) 7/12/88 ecvt.c 4.1 (ULTRIX) 7/12/88 filbuf.c 4.1 ULTRIX 11/23/87 fopen.c 4.1 ULTRIX 11/23/87 freopen.c 4.1 ULTRIX 11/23/87 setbuffer.c 4.1 (ULTRIX) 11/23/87 setlinebuf.c 4.1 (ULTRIX) 11/23/87 malloc.c 4.2 (ULTRIX) 7/15/88 sibuf.c 4.1 (ULTRIX) 11/23/87 fseek.c 4.1 (ULTRIX) 11/23/87 calloc.c 4.1 (ULTRIX) 11/23/87 errlst.c 4.1 ULTRIX 11/23/87 doprnt.c 4.2 (ULTRIX) 9/19/88 getstdiobuf.c 4.1 (ULTRIX) 11/23/87 doopen.c 4.1 ULTRIX 11/23/87 setvbuf.c 4.1 (ULTRIX) 11/23/87 sobuf.c 4.1 (ULTRIX) 11/23/87 ctype.c 4.1 ULTRIX 2/15/88 _locale.c 4.1 ULTRIX 2/15/88 0.5u 0.1s 0:02 29% 10+17k 57+0io 0pf+0w /usr/ucb/what /usr/lib/ugen1.31 /usr/lib/ugen1.31 fclose.c 4.1 (ULTRIX) 11/23/87 malloc.c 4.2 (ULTRIX) 7/15/88 atof.c 4.1 (ULTRIX) 7/12/88 mktemp.c 4.2 (ULTRIX) 1/20/88 fopen.c 4.1 ULTRIX 11/23/87 errlst.c 4.1 ULTRIX 11/23/87 fprintf.c 4.2 (ULTRIX) 7/12/88 fwrite.c 4.1 (ULTRIX) 11/23/87 sprintf.c 4.2 (ULTRIX) 7/12/88 flsbuf.c 4.1 (ULTRIX) 11/23/87 strlen.c 4.1 (ULTRIX) 7/12/88 ecvt.c 4.1 (ULTRIX) 7/12/88 filbuf.c 4.1 ULTRIX 11/23/87 freopen.c 4.1 ULTRIX 11/23/87 setbuffer.c 4.1 (ULTRIX) 11/23/87 setlinebuf.c 4.1 (ULTRIX) 11/23/87 sibuf.c 4.1 (ULTRIX) 11/23/87 fseek.c 4.1 (ULTRIX) 11/23/87 calloc.c 4.1 (ULTRIX) 11/23/87 ctype.c 4.1 ULTRIX 2/15/88 fdopen.c 4.1 ULTRIX 11/23/87 doopen.c 4.1 ULTRIX 11/23/87 doprnt.c 4.2 (ULTRIX) 9/19/88 getstdiobuf.c 4.1 (ULTRIX) 11/23/87 setvbuf.c 4.1 (ULTRIX) 11/23/87 sobuf.c 4.1 (ULTRIX) 11/23/87 _locale.c 4.1 ULTRIX 2/15/88 0.3u 0.1s 0:01 28% 10+17k 42+0io 0pf+0w /usr/ucb/what /usr/lib/as01.31 /usr/lib/as01.31 fclose.c 4.1 (ULTRIX) 11/23/87 strlen.c 4.1 (ULTRIX) 7/12/88 malloc.c 4.2 (ULTRIX) 7/15/88 sprintf.c 4.2 (ULTRIX) 7/12/88 fprintf.c 4.2 (ULTRIX) 7/12/88 flsbuf.c 4.1 (ULTRIX) 11/23/87 filbuf.c 4.1 ULTRIX 11/23/87 fopen.c 4.1 ULTRIX 11/23/87 freopen.c 4.1 ULTRIX 11/23/87 setbuffer.c 4.1 (ULTRIX) 11/23/87 setlinebuf.c 4.1 (ULTRIX) 11/23/87 sibuf.c 4.1 (ULTRIX) 11/23/87 fseek.c 4.1 (ULTRIX) 11/23/87 ecvt.c 4.1 (ULTRIX) 7/12/88 calloc.c 4.1 (ULTRIX) 11/23/87 errlst.c 4.1 ULTRIX 11/23/87 fdopen.c 4.1 ULTRIX 11/23/87 fwrite.c 4.1 (ULTRIX) 11/23/87 doprnt.c 4.2 (ULTRIX) 9/19/88 getstdiobuf.c 4.1 (ULTRIX) 11/23/87 doopen.c 4.1 ULTRIX 11/23/87 setvbuf.c 4.1 (ULTRIX) 11/23/87 sobuf.c 4.1 (ULTRIX) 11/23/87 ctype.c 4.1 ULTRIX 2/15/88 _locale.c 4.1 ULTRIX 2/15/88 0.2u 0.1s 0:01 29% 11+17k 24+0io 0pf+0w /usr/ucb/what /usr/lib/as11.31 /usr/lib/as11.31 fclose.c 4.1 (ULTRIX) 11/23/87 strlen.c 4.1 (ULTRIX) 7/12/88 atof.c 4.1 (ULTRIX) 7/12/88 time.c 4.1 (ULTRIX) 11/23/87 malloc.c 4.2 (ULTRIX) 7/15/88 errlst.c 4.1 ULTRIX 11/23/87 fprintf.c 4.2 (ULTRIX) 7/12/88 printf.c 4.2 (ULTRIX) 7/12/88 sprintf.c 4.2 (ULTRIX) 7/12/88 filbuf.c 4.1 ULTRIX 11/23/87 fopen.c 4.1 ULTRIX 11/23/87 freopen.c 4.1 ULTRIX 11/23/87 setbuffer.c 4.1 (ULTRIX) 11/23/87 setlinebuf.c 4.1 (ULTRIX) 11/23/87 sibuf.c 4.1 (ULTRIX) 11/23/87 fseek.c 4.1 (ULTRIX) 11/23/87 flsbuf.c 4.1 (ULTRIX) 11/23/87 ecvt.c 4.1 (ULTRIX) 7/12/88 calloc.c 4.1 (ULTRIX) 11/23/87 fdopen.c 4.1 ULTRIX 11/23/87 fwrite.c 4.1 (ULTRIX) 11/23/87 ctype.c 4.1 ULTRIX 2/15/88 doprnt.c 4.2 (ULTRIX) 9/19/88 getstdiobuf.c 4.1 (ULTRIX) 11/23/87 doopen.c 4.1 ULTRIX 11/23/87 setvbuf.c 4.1 (ULTRIX) 11/23/87 sobuf.c 4.1 (ULTRIX) 11/23/87 _locale.c 4.1 ULTRIX 2/15/88 0.3u 0.1s 0:01 27% 10+17k 42+0io 0pf+0w /usr/lib/cpp1.31 -v immed.s -DLANGUAGE_ASSEMBLY -DMIPSEL -I/usr/include1.31 > /tmp/ctmpa00570 0.0u 0.1s 0:00 14% 21+20k 8+1io 0pf+0w /usr/lib/as01.31 -v -G 8 -EL -g0 -O1 /tmp/ctmpa00570 -o /tmp/ctmaa00570 -t /tmp/ctmsta00570 as0: as0: Error: immed.s, line 5: immed operand not -32768..32767 addiu $0,$0, -32769 as0: Error: immed.s, line 7: immed operand not -32768..32767 addiu $0,$0, 0xfffffff as0: Error: immed.s, line 8: immed operand not -32768..32767 addiu $0,$0, -0xffffff 0.0u 0.1s 0:00 27% 47+49k 1+1io 4pf+0w -- Peter Ham PO Box 3430 (h)(415) 322-4390 MS Computer Science Student Stanford, CA ham@cs.stanford.edu Stanford University 94309 (o)(415) 723-2067
chan@mips.COM (Sun C. Chan) (12/16/89)
In article <HAM.89Dec14155738@Neon.Stanford.EDU> ham@Neon.Stanford.EDU (Peter R. Ham) writes: >as should restrict immediate constants to >being within the range of -32768..32767. > >The 1.31 version of as0 fails to do this and lets some positive >constants greater than 32767 slip by. Instead of complaining, >as0 treats them as negative constants which can create bugs. >Give the following assembly, as0 should complain about 5 of >the lines, but instead only complains about 3. 32768 and >40072 should be rejected. The results of assembling this >are also included. > > >addiu $0,$0, 32767 >addiu $0,$0, -32768 >addiu $0,$0, 32768 >addiu $0,$0, -32769 >addiu $0,$0, 40072 >addiu $0,$0, 0xfffffff >addiu $0,$0, -0xffffff > This is indeed a bug in the as0, it has been fixed and will be in the 2.10 release of the compiler. Thanks for pointing this bug out.