This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/81741] Misoptimisation : replacing a constant field read access by a function call
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 07 Aug 2017 07:09:40 +0000
- Subject: [Bug tree-optimization/81741] Misoptimisation : replacing a constant field read access by a function call
- Auto-submitted: auto-generated
- References: <bug-81741-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81741
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org,
| |law at gcc dot gnu.org
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I see the same behavior with 4.9, as well as older (e.g. 4.8 or 4.4).
The thing is that __builtin_constant_p is (at -O1 and above) a check whether
some expression is constant after optimizations, and here FRE or DOM passes
figure out (due to jump threading?) that it is constant.
Abusing __builtin_constant_p this way is always going to be risky.