This is the mail archive of the gcc-bugs@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]

[Bug other/49942] Wrong code generated for -O2 with target s390 on Linux


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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-08-02 12:42:56 UTC ---
Can't reproduce on:
struct oper { char *digits; char sign; };
struct oper oper0 = {"900000000", '+'};
struct oper oper1 = {"400000000", '+'};

static int
comp (struct oper *op0, struct oper *op1)
{
  int i;
  __builtin_printf ("%s vs %s ", op0->digits, op1->digits);
  for (i = 0; 9 > i; i++)
    {
      int diff = (0xff & op0->digits[i]) - (0xff & op1->digits[i]);
      if (diff) return '-' == op0->sign ? (0 < diff ? -1 : 1) : (0 > diff ? -1
: 1);
    }
  return 0;
}

int
main ()
{
  __builtin_printf (" is %d\n", comp (&oper0, &oper1));
  __builtin_printf (" is %d\n", comp (&oper1, &oper0));
  return 0;
}

With current 4.6 branch as well as trunk, compiling with with -m31 -O{0,1,2}
on x86_64-linux -> s390x-linux cross, then running on s390 always results in:
900000000 vs 400000000  is 1
400000000 vs 900000000  is -1


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