This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]