This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/20238] signed/unsigned multiplication + sign extension broken 32->64 bit sign promotion?
- From: "ch at dot-heine dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 27 Feb 2005 22:05:07 -0000
- Subject: [Bug c/20238] signed/unsigned multiplication + sign extension broken 32->64 bit sign promotion?
- References: <20050227210344.20238.ch@dot-heine.de>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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