GCC4.1.2 on a Intel Xeon CPU
The test program is test.c:

extern int bar(short);

int foo(short arg1, short arg2)
{
  short res;
  res = arg1 + arg2;
  return bar(res);
}

Compiled with : gcc -fdump-tree-all -S test.c
The resulting test.c.t02.original is :
;; Function foo (foo)
;; enabled by -tree-original

{
  short int res;

    short int res;
  res = (short int) ((short unsigned int) arg1 + (short unsigned int) arg2);
  return bar ((int) res);
}

So, my question is : why gcc casted "short" to "short unsigned int"
before addition and casted back after?
--
                                       此致
敬礼!

                                    梁��

Reply via email to