[gnu.gcc.bug] gcc fails `cmp' test with new `loop.c'

derek@UUNET.UU.NET (Derek Clegg) (05/10/89)

Richard Stallman:

	Recently I sent a bug report concerning spurious warning messages
in gcc version 1.35.  The program was

	static inline int bar(int a, int b, int c) { return (a + b + c); }
	void foo(unsigned char *x, char *y, int w) {
	    while (--w >= 0) *y++ = bar(*x, 0, 0);
	}
and the warning was "... `a' may be used uninitialized in this function."

You courteously responded with a replacement for `loop.c'.  Recompiling
`gcc' with this file results in different object code produced by stage1/gcc
and stage2/gcc.  An example is reproduced below.

`gcc' was compiled with `config.gcc sun3-os4'.  I am using a Sun 3/60 with
UNIX 4.2 (Sun release 4.0.1).

		Derek B Clegg ({uunet,ucbcad,sun}!island!derek)

[gcc-1.35-1] cmp jump.o stage2/jump.o
jump.o stage2/jump.o differ: char 8, line 1

[gcc-1.35-2] stage1/gcc -Bstage1/ -v -S -O -g -I./config jump.c -o jump-1.s
gcc version 1.35
 stage1/cpp -v -I./config -undef -D__GNUC__ -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -D__OPTIMIZE__ -D__HAVE_68881__ -Dmc68020 jump.c /tmp/cca27777.cpp
GNU CPP version 1.35
 stage1/cc1 /tmp/cca27777.cpp -quiet -dumpbase jump.c -g -O -version -o jump-1.s
GNU C version 1.35 (68k, MIT syntax) compiled by CC.

[gcc-1.35-3] stage2/gcc -Bstage2/ -v -S -O -g -I./config jump.c -o jump-2.s
gcc version 1.35
 stage2/cpp -v -I./config -undef -D__GNUC__ -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -D__OPTIMIZE__ -D__HAVE_68881__ -Dmc68020 jump.c /tmp/cca27780.cpp
GNU CPP version 1.35
 stage2/cc1 /tmp/cca27780.cpp -quiet -dumpbase jump.c -g -O -version -o jump-2.s
GNU C version 1.35 (68k, MIT syntax) compiled by GNU C version 1.35.

[gcc-1.35-4] diff -c2 jump-1.s jump-2.s
*** jump-1.s	Tue May  9 13:45:07 1989
--- jump-2.s	Tue May  9 13:45:39 1989
***************
*** 2921,2936 ****
  	.stabd 68,0,1529
  	moveb a2@(a5:l),d0
! 	cmpb #101,d0
  	jeq L419
! 	jgt L431
! 	cmpb #48,d0
  	jeq L413
! 	cmpb #69,d0
  	jeq L422
  	jra L429
  L431:
! 	cmpb #105,d0
  	jeq L415
! 	cmpb #115,d0
  	jeq L417
  	jra L429
--- 2921,2944 ----
  	.stabd 68,0,1529
  	moveb a2@(a5:l),d0
! 	extbl d0
! 	moveq #101,d3
! 	cmpl d0,d3
  	jeq L419
! 	moveq #101,d3
! 	cmpl d0,d3
! 	jlt L431
! 	moveq #48,d3
! 	cmpl d0,d3
  	jeq L413
! 	moveq #69,d3
! 	cmpl d0,d3
  	jeq L422
  	jra L429
  L431:
! 	moveq #105,d3
! 	cmpl d0,d3
  	jeq L415
! 	moveq #115,d3
! 	cmpl d0,d3
  	jeq L417
  	jra L429