public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/111887] New: GCC: 14: A potential miscompilation with __builtin_inf
@ 2023-10-20 3:15 141242068 at smail dot nju.edu.cn
2023-10-20 3:17 ` [Bug c/111887] " pinskia at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: 141242068 at smail dot nju.edu.cn @ 2023-10-20 3:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111887
Bug ID: 111887
Summary: GCC: 14: A potential miscompilation with __builtin_inf
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: 141242068 at smail dot nju.edu.cn
Target Milestone: ---
I am uncertain whether this program contains undefined behavior, the testcase
is:
```
extern void abort (void);
void test(double f, double i)
{
if (i != __builtin_inf())
abort ();
}
int main()
{
test (34.0, __builtin_inf());
return 0;
}
```
When compile it with -O0, -O1, -O2, the program normally exits, but when
compile it with -Ofast, the program abort.
Here is the verification link: https://gcc.godbolt.org/z/7YKbvha84
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/111887] GCC: 14: A potential miscompilation with __builtin_inf
2023-10-20 3:15 [Bug c/111887] New: GCC: 14: A potential miscompilation with __builtin_inf 141242068 at smail dot nju.edu.cn
@ 2023-10-20 3:17 ` pinskia at gcc dot gnu.org
2023-10-20 3:18 ` 141242068 at smail dot nju.edu.cn
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-20 3:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111887
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |INVALID
Status|UNCONFIRMED |RESOLVED
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
-Ofast enables -ffinite-math-only which means infinite will not show up and
compares against it will not work.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/111887] GCC: 14: A potential miscompilation with __builtin_inf
2023-10-20 3:15 [Bug c/111887] New: GCC: 14: A potential miscompilation with __builtin_inf 141242068 at smail dot nju.edu.cn
2023-10-20 3:17 ` [Bug c/111887] " pinskia at gcc dot gnu.org
@ 2023-10-20 3:18 ` 141242068 at smail dot nju.edu.cn
2023-10-20 6:45 ` xry111 at gcc dot gnu.org
2023-10-20 9:23 ` schwab@linux-m68k.org
3 siblings, 0 replies; 5+ messages in thread
From: 141242068 at smail dot nju.edu.cn @ 2023-10-20 3:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111887
--- Comment #2 from wierton <141242068 at smail dot nju.edu.cn> ---
Thanks for you reply, I got it!
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/111887] GCC: 14: A potential miscompilation with __builtin_inf
2023-10-20 3:15 [Bug c/111887] New: GCC: 14: A potential miscompilation with __builtin_inf 141242068 at smail dot nju.edu.cn
2023-10-20 3:17 ` [Bug c/111887] " pinskia at gcc dot gnu.org
2023-10-20 3:18 ` 141242068 at smail dot nju.edu.cn
@ 2023-10-20 6:45 ` xry111 at gcc dot gnu.org
2023-10-20 9:23 ` schwab@linux-m68k.org
3 siblings, 0 replies; 5+ messages in thread
From: xry111 at gcc dot gnu.org @ 2023-10-20 6:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111887
Xi Ruoyao <xry111 at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |xry111 at gcc dot gnu.org
--- Comment #3 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
Should we reject or warn about __builtin_inf() with -ffinite-math-only?
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/111887] GCC: 14: A potential miscompilation with __builtin_inf
2023-10-20 3:15 [Bug c/111887] New: GCC: 14: A potential miscompilation with __builtin_inf 141242068 at smail dot nju.edu.cn
` (2 preceding siblings ...)
2023-10-20 6:45 ` xry111 at gcc dot gnu.org
@ 2023-10-20 9:23 ` schwab@linux-m68k.org
3 siblings, 0 replies; 5+ messages in thread
From: schwab@linux-m68k.org @ 2023-10-20 9:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111887
--- Comment #4 from Andreas Schwab <schwab@linux-m68k.org> ---
Would that break (__FINITE_MATH_ONLY__ ? huge : __builtin_inf())?
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-10-20 9:23 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-20 3:15 [Bug c/111887] New: GCC: 14: A potential miscompilation with __builtin_inf 141242068 at smail dot nju.edu.cn
2023-10-20 3:17 ` [Bug c/111887] " pinskia at gcc dot gnu.org
2023-10-20 3:18 ` 141242068 at smail dot nju.edu.cn
2023-10-20 6:45 ` xry111 at gcc dot gnu.org
2023-10-20 9:23 ` schwab@linux-m68k.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).