public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/60181] New: constant folding of complex number incorrect
@ 2014-02-13 16:19 krebbel at gcc dot gnu.org
  2014-02-13 18:09 ` [Bug target/60181] " joseph at codesourcery dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: krebbel at gcc dot gnu.org @ 2014-02-13 16:19 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 60181
           Summary: constant folding of complex number incorrect
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: krebbel at gcc dot gnu.org

The following testcase fails on s390x and Power.  Constant folding and runtime
execution of a division of complex numbers produce different results.

The testcase works fine on x86 so it looks like S/390 and Power do something
different here.

It looks somewhat like:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30789

#include <complex.h>
#include <stdio.h>
#include <stdlib.h>

_Complex float __attribute__ ((noinline))
calc (_Complex float a, _Complex float b)
{
  return a / b;
}

int
main (int argc, char **argv)
{
  _Complex float a = calc (10 + 6 * I, 5 + 12 * I);
  _Complex float b = (10 + 6 * I) / (5 + 12 * I);

  printf ("%ap + %ap * i\n", creal (a), cimag (a));
  printf ("%ap + %ap * i\n", creal (b), cimag (b));

  if (a != b)
    abort ();

  return 0;
}

gcc -O0 t.c -o f

./f
0x1.719c08p-1p + -0x1.10a9a8p-1p * i
0x1.719c06p-1p + -0x1.10a9a8p-1p * i
Aborted


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-10-02 16:10 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-13 16:19 [Bug target/60181] New: constant folding of complex number incorrect krebbel at gcc dot gnu.org
2014-02-13 18:09 ` [Bug target/60181] " joseph at codesourcery dot com
2014-02-14  9:37 ` rguenth at gcc dot gnu.org
2014-02-14 11:59 ` krebbel at gcc dot gnu.org
2014-02-14 15:34 ` pinskia at gcc dot gnu.org
2014-10-02 14:52 ` boger at us dot ibm.com
2014-10-02 15:38 ` boger at us dot ibm.com
2014-10-02 15:47 ` dje at gcc dot gnu.org
2014-10-02 16:10 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).