public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/108540] [13 Regression] Frange miscompilation of ruby since r13-3261 Date: Wed, 25 Jan 2023 15:52:36 +0000 [thread overview] Message-ID: <bug-108540-4-cNEgkG228s@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-108540-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108540 Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2023-01-25 CC| |aldyh at gcc dot gnu.org, | |amacleod at redhat dot com Target Milestone|--- |13.0 Ever confirmed|0 |1 Priority|P3 |P1 --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- stdarg.h isn't needed, so: __attribute__((noipa)) void bar (const char *cp, unsigned long size, char sign, int dsgn) { if (__builtin_strcmp (cp, "ZERO") != 0 || size != 4 || sign != '-' || dsgn != 1) __builtin_abort (); } __attribute__((noipa)) void foo (int x, int ch, double d) { const char *cp = ""; unsigned long size = 0; char sign = '\0'; switch (x) { case 42: if (__builtin_isinf (d)) { if (d < 0) sign = '-'; cp = "Inf"; size = 3; break; } if (__builtin_isnan (d)) { cp = "NaN"; size = 3; break; } if (d < 0) { d = -d; sign = '-'; } else if (d == 0.0 && __builtin_signbit (d)) sign = '-'; else sign = '\0'; if (ch == 'a' || ch == 'A') { union U { long long l; double d; } u; int dsgn; u.d = d; if (u.l < 0) { dsgn = 1; u.l &= 0x7fffffffffffffffLL; } else dsgn = 0; if (__builtin_isinf (d)) { cp = "INF"; size = 3; } else if (__builtin_isnan (d)) { cp = "NAN"; size = 3; } else if (d == 0) { cp = "ZERO"; size = 4; } else { cp = "WRONG"; size = 5; } bar (cp, size, sign, dsgn); } } } int main () { foo (42, 'a', -0.0); return 0; } The testcase is hand-written from what I see in https://github.com/ruby/ruby/blob/a528908271c678360d2d8ca232c178e7cdd340b4/vsnprintf.c#L529 https://github.com/ruby/ruby/blob/a528908271c678360d2d8ca232c178e7cdd340b4/vsnprintf.c#L1229 https://github.com/ruby/ruby/blob/a528908271c678360d2d8ca232c178e7cdd340b4/missing/dtoa.c#L3387 where hdtoa is inlined into cvt which is inlined into vfprintf. This reduced testcase reproduces on x86_64-linux too.
next prev parent reply other threads:[~2023-01-25 15:52 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-01-25 15:48 [Bug tree-optimization/108540] New: " jakub at gcc dot gnu.org 2023-01-25 15:52 ` jakub at gcc dot gnu.org [this message] 2023-01-26 11:27 ` [Bug tree-optimization/108540] " jakub at gcc dot gnu.org 2023-01-26 11:41 ` jakub at gcc dot gnu.org 2023-01-26 12:16 ` jakub at gcc dot gnu.org 2023-01-26 12:37 ` jakub at gcc dot gnu.org 2023-01-26 13:08 ` jakub at gcc dot gnu.org 2023-01-26 13:29 ` aldyh at gcc dot gnu.org 2023-01-26 16:28 ` cvs-commit at gcc dot gnu.org 2023-01-27 20:39 ` jakub at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-108540-4-cNEgkG228s@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).