[Bug c/20238] signed/unsigned multiplication + sign extension broken 32->64 bit sign promotion?

ch at dot-heine dot de gcc-bugzilla@gcc.gnu.org
Mon Feb 28 09:04:00 GMT 2005


------- Additional Comments From ch at dot-heine dot de  2005-02-27 22:05 -------
Subject: Re:  signed/unsigned multiplication + sign extension
 broken 32->64 bit sign promotion?



pinskia at gcc dot gnu dot org wrote:
> ------- Additional Comments From pinskia at gcc dot gnu dot org  2005-02-27 21:10 -------
> This is invalid.
> (unsigned int)(signed_char) is still signed extened.
> if you don't want a sign extension do:
> (unsigned int)(unsigned char)(signed_char).

I'll getter get myself a copy of the ANSI standard. However, this is still funny. This 
means that I have sign extension when I skip an integer size in between, so

(unsigned long)(signed short) will be promoted sign extended to 64 bits

but

(unsigned long)(signed int) will not.

Ok. But then there is a bug in h8300.c in h8300_emit_stack_adjustment() where such a 
construct is passed to GEN_INT() which will not do the sign extension; later on that 
integer is compared with the result of trunc_int_for_mode() which _does_ sign extension.

I'll submit a corresponding bug report later.

Thx for the quick reply

Claus


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20238



More information about the Gcc-bugs mailing list