This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/86673] [8/9 regression] inline asm sometimes ignores 'register asm("reg")' declarations
- From: "amonakov at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 25 Jul 2018 14:47:09 +0000
- Subject: [Bug target/86673] [8/9 regression] inline asm sometimes ignores 'register asm("reg")' declarations
- Auto-submitted: auto-generated
- References: <bug-86673-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86673
Alexander Monakov <amonakov at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |amonakov at gcc dot gnu.org
--- Comment #10 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
See PR 85745 where Jakub said,
The reason this happens is that the register variable is marked const. Don't
do that. If it is const, the compiler optimizes it more aggressively - it will
happily fold uses of the variable to the constant ininitializer, so the inline
asm becomes "r" (110) instead of "r" (__r2) and thus it can use any register.
This is how C++ behaved for years and how C in GCC behaves since the folding
improvements.