[Bug target/93934] Unnecessary fld of uninitialized float stack variable results in ub of valid C++ code

2021-10-14 Thread ubizjak at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93934 --- Comment #25 from Uroš Bizjak --- (In reply to jos...@codesourcery.com from comment #24) > This is a fundamentally different test, because it involves (in the > abstract machine) lvalue-to-rvalue conversion of a sNaN representation. > That

[Bug target/93934] Unnecessary fld of uninitialized float stack variable results in ub of valid C++ code

2021-10-14 Thread joseph at codesourcery dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93934 --- Comment #24 from joseph at codesourcery dot com --- On Thu, 14 Oct 2021, ubizjak at gmail dot com via Gcc-bugs wrote: > The situation is hopeless from the beginning. Please consider this testcase: > > --cut here-- > #include > #include >

[Bug target/93934] Unnecessary fld of uninitialized float stack variable results in ub of valid C++ code

2021-10-14 Thread vajdaz at protonmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93934 --- Comment #23 from Zoltan Vajda --- (In reply to Uroš Bizjak from comment #20) > (In reply to jos...@codesourcery.com from comment #16) > > I don't think this bug is anything to do with -fsignaling-nans, for the > > same reason as applies to

[Bug target/93934] Unnecessary fld of uninitialized float stack variable results in ub of valid C++ code

2021-10-14 Thread rguenther at suse dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93934 --- Comment #22 from rguenther at suse dot de --- On Thu, 14 Oct 2021, ubizjak at gmail dot com wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93934 > > --- Comment #20 from Uroš Bizjak --- > (In reply to jos...@codesourcery.com from

[Bug target/93934] Unnecessary fld of uninitialized float stack variable results in ub of valid C++ code

2021-10-14 Thread ubizjak at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93934 --- Comment #21 from Uroš Bizjak --- (In reply to Zoltan Vajda from comment #19) > The problem does not only apply for conditional moves! I can turn on sse, > for example. > > https://gcc.godbolt.org/z/jP3Kne8T5 > > Then the problematic code

[Bug target/93934] Unnecessary fld of uninitialized float stack variable results in ub of valid C++ code

2021-10-14 Thread ubizjak at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93934 --- Comment #20 from Uroš Bizjak --- (In reply to jos...@codesourcery.com from comment #16) > I don't think this bug is anything to do with -fsignaling-nans, for the > same reason as applies to bug 58416 and bug 71460. The situation is

[Bug target/93934] Unnecessary fld of uninitialized float stack variable results in ub of valid C++ code

2021-10-14 Thread vajdaz at protonmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93934 --- Comment #19 from Zoltan Vajda --- (In reply to Uroš Bizjak from comment #18) > The following patch fixes the PR, see the comment inline: > > --cut here-- > diff --git a/gcc/config/i386/i386-expand.c b/gcc/config/i386/i386-expand.c > index

[Bug target/93934] Unnecessary fld of uninitialized float stack variable results in ub of valid C++ code

2021-10-14 Thread ubizjak at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93934 --- Comment #18 from Uroš Bizjak --- The following patch fixes the PR, see the comment inline: --cut here-- diff --git a/gcc/config/i386/i386-expand.c b/gcc/config/i386/i386-expand.c index 6e2b7920d2b..b87490fe544 100644 ---

[Bug target/93934] Unnecessary fld of uninitialized float stack variable results in ub of valid C++ code

2021-10-14 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93934 --- Comment #17 from Richard Biener --- It might help to provide a option or tunable to disable the use of fcmov which should reduce the attack surface a bit. I don't see any way to avoid using fld for loading x87 float or double values (well,

[Bug target/93934] Unnecessary fld of uninitialized float stack variable results in ub of valid C++ code

2021-10-13 Thread joseph at codesourcery dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93934 --- Comment #16 from joseph at codesourcery dot com --- I don't think this bug is anything to do with -fsignaling-nans, for the same reason as applies to bug 58416 and bug 71460. The option -fsignaling-nans is only about correctly handling

[Bug target/93934] Unnecessary fld of uninitialized float stack variable results in ub of valid C++ code

2021-10-13 Thread vajdaz at protonmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93934 --- Comment #15 from Zoltan Vajda --- In my special case, I have an embedded realtime application with a lot of FP atithmetic on Intel 32 bit architecture (huge and complex legacy codebase). FPU exceptions are enabled, so loading an SNaN results

[Bug target/93934] Unnecessary fld of uninitialized float stack variable results in ub of valid C++ code

2021-10-13 Thread amonakov at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93934 --- Comment #14 from Alexander Monakov --- Zoltan, excuse me, could you please clarify what specifically you are worried about? Your bug title says "results in UB" and the opening comment said "the behavior [..] is unpredictable", but as far as

[Bug target/93934] Unnecessary fld of uninitialized float stack variable results in ub of valid C++ code

2021-10-13 Thread ubizjak at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93934 --- Comment #13 from Uroš Bizjak --- (In reply to Zoltan Vajda from comment #12) > Using -mfpmath=sse here does not help on a 32 bit platfrom. > https://gcc.godbolt.org/z/hs1Ef6aj4 > At line 31 the assembly code performs the speculative load.

[Bug target/93934] Unnecessary fld of uninitialized float stack variable results in ub of valid C++ code

2021-10-13 Thread vajdaz at protonmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93934 --- Comment #12 from Zoltan Vajda --- Using -mfpmath=sse here does not help on a 32 bit platfrom. https://gcc.godbolt.org/z/hs1Ef6aj4 At line 31 the assembly code performs the speculative load.

[Bug target/93934] Unnecessary fld of uninitialized float stack variable results in ub of valid C++ code

2021-10-13 Thread ubizjak at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93934 --- Comment #11 from Uroš Bizjak --- (In reply to Zoltan Vajda from comment #9) > As I understand it, it is acknowledged, that this is a bug. However, the > issue is in state NEW for a quite long time. The issue is still present in > GCC 11.2.

[Bug target/93934] Unnecessary fld of uninitialized float stack variable results in ub of valid C++ code

2021-10-13 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93934 Richard Biener changed: What|Removed |Added CC||uros at gcc dot gnu.org --- Comment

[Bug target/93934] Unnecessary fld of uninitialized float stack variable results in ub of valid C++ code

2021-10-13 Thread vajdaz at protonmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93934 --- Comment #9 from Zoltan Vajda --- As I understand it, it is acknowledged, that this is a bug. However, the issue is in state NEW for a quite long time. The issue is still present in GCC 11.2. Do you see any chances for some progress in this

[Bug target/93934] Unnecessary fld of uninitialized float stack variable results in ub of valid C++ code

2020-02-26 Thread amonakov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93934 --- Comment #8 from Alexander Monakov --- I think regstack is fine as x87 only supports computations in its native 80-bit format and conversions to/from ieee float/double happen only on memory loads/stores. > I suppose a fldt followed by

[Bug target/93934] Unnecessary fld of uninitialized float stack variable results in ub of valid C++ code

2020-02-26 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93934 --- Comment #7 from Richard Biener --- Or the issue is in regstack handling all stack vars as 80bit and thus introducing the conversion step in the first place.

[Bug target/93934] Unnecessary fld of uninitialized float stack variable results in ub of valid C++ code

2020-02-26 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93934 Richard Biener changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed|

[Bug target/93934] Unnecessary fld of uninitialized float stack variable results in ub of valid C++ code

2020-02-26 Thread amonakov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93934 --- Comment #5 from Alexander Monakov --- Ah, indeed. fld won't raise FE_INVALID for 80-bit long double, but here 'result' is stored on the stack in 64-bit format. So: fcmov and 80-bit fldt don't trap, 32-bit flds and 64-bit fldl do. Somehow

[Bug target/93934] Unnecessary fld of uninitialized float stack variable results in ub of valid C++ code

2020-02-26 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93934 Richard Biener changed: What|Removed |Added Keywords|missed-optimization |wrong-code --- Comment #4 from Richard

[Bug target/93934] Unnecessary fld of uninitialized float stack variable results in ub of valid C++ code

2020-02-26 Thread vajdaz at protonmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93934 Zoltan Vajda changed: What|Removed |Added Status|RESOLVED|UNCONFIRMED Resolution|INVALID

[Bug target/93934] Unnecessary fld of uninitialized float stack variable results in ub of valid C++ code

2020-02-26 Thread amonakov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93934 Alexander Monakov changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED CC|

[Bug target/93934] Unnecessary fld of uninitialized float stack variable results in ub of valid C++ code

2020-02-25 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93934 Andrew Pinski changed: What|Removed |Added Keywords||missed-optimization Target|