This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Why does GCC convert short operation to short unsigned?
- From: "Bingfeng Mei" <bmei at broadcom dot com>
- To: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Fri, 17 Jun 2011 02:14:48 -0700
- Subject: Why does GCC convert short operation to short unsigned?
Hi,
I noticed that GCC converts short arithmetic to unsigned short.
short foo2 (short a, short b)
{
return a - b;
}
In .gimple file:
foo2 (short int a, short int b)
{
short int D.3347;
short unsigned int a.0;
short unsigned int b.1;
short unsigned int D.3350;
a.0 = (short unsigned int) a;
b.1 = (short unsigned int) b;
D.3350 = a.0 - b.1;
D.3347 = (short int) D.3350;
return D.3347;
}
Is this for some C standard conformance, or optimization purpose?
This doesn't happen with int type.
Thanks,
Bingfeng Mei