From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0687F3858D28; Wed, 25 Jan 2023 15:48:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0687F3858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1674661729; bh=tP4hojldJZYB5EjO4D+0H0GgWFvmucRFKatPI9Nv/cM=; h=From:To:Subject:Date:From; b=EitE99L7og8BipofdwBNJtNpg4RYnvNCh2BtE2+L5ioNZfz+PqmpzNASeEvlLgEbH wBUE0ThgdBXKhT6B5yAWdRFx1S4lUWeqUUcC1MEqDWGaZ9zeds2w+ql64nGXLd6kVc DvXUJlmUB+IxB3ULLFnWX2Qp33sq6hR165gs4948= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/108540] New: [13 Regression] Frange miscompilation of ruby since r13-3261 Date: Wed, 25 Jan 2023 15:48:48 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: 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 target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108540 Bug ID: 108540 Summary: [13 Regression] Frange miscompilation of ruby since r13-3261 Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: jakub at gcc dot gnu.org Target Milestone: --- Since r13-3261-ga0c1a059101a3067d96211cbc4fae5905796d1db ruby is miscompiled with LTO on powerpc64le-linux. I've hand reduced it to: #include __attribute__((noipa)) void bar (const char *cp, unsigned long size, char sign, int dsgn) { if (__builtin_strcmp (cp, "ZERO") !=3D 0 || size !=3D 4 || sign !=3D '-' = || dsgn !=3D 1) __builtin_abort (); } __attribute__((noipa)) void foo (int x, int ch, ...) { va_list ap; const char *cp =3D ""; unsigned long size =3D 0; char sign =3D '\0'; double d; va_start (ap, ch); switch (x) { case 42: d =3D va_arg (ap, double); if (__builtin_isinf (d)) { if (d < 0) sign =3D '-'; cp =3D "Inf"; size =3D 3; break; } if (__builtin_isnan (d)) { cp =3D "NaN"; size =3D 3; break; } if (d < 0) { d =3D -d; sign =3D '-'; } else if (d =3D=3D 0.0 && __builtin_signbit (d)) sign =3D '-'; else sign =3D '\0'; if (ch =3D=3D 'a' || ch =3D=3D 'A') { union U { long long l; double d; } u; int dsgn; u.d =3D d; if (u.l < 0) { dsgn =3D 1; u.l &=3D 0x7fffffffffffffffLL; } else dsgn =3D 0; if (__builtin_isinf (d)) { cp =3D "INF"; size =3D 3; } else if (__builtin_isnan (d)) { cp =3D "NAN"; size =3D 3; } else if (d =3D=3D 0) { cp =3D "ZERO"; size =3D 4; } else { cp =3D "WRONG"; size =3D 5; } bar (cp, size, sign, dsgn); } } va_end (ap); } int main () { foo (42, 'a', -0.0); return 0; }=