From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6801 invoked by alias); 13 Feb 2014 16:19:32 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 6448 invoked by uid 48); 13 Feb 2014 16:19:27 -0000 From: "krebbel at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/60181] New: constant folding of complex number incorrect Date: Thu, 13 Feb 2014 16:19:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: krebbel at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-02/txt/msg01245.txt.bz2 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 #include #include _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