i386: asm("%z0" :: "g" ((char)0)) aborts...

gcc@horizon.com gcc@horizon.com
Tue Sep 11 05:21:00 GMT 2001


It seems that someone forgot the "case 1:" in the relevant switch() in
print_operand (i386.c:3458 on my snapshot)

To quote the codesourcery snapshot compiler,

void foo() { asm("%z0" :: "g" ((char)0)); }

produced:

/usr/tmp/@10639.7.c: In function `foo':
/usr/tmp/@10639.7.c:1: Internal compiler error in print_operand, at config/i386/i386.c:3495
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.

To give a more useful version, try the ones-complement checksum routine

asm("add%z0 %2,%0; adc%z0 %3,%0" : "=r" (sum) :
	"r" (sum), "g" (c), "g" ((typeof sum)0));

Isn't this the correct way to put an operand-size suffix on an asm
instruction?

Also exists in 2.95.



More information about the Gcc-bugs mailing list