[Bug c/126552] const-qualified local register variable used as an asm operand is silently discarded

bernie at codewiz dot org via Gcc-bugs <[email protected]> Mon, 03 Aug 2026 16:40:15 +0000
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D126552

--- Comment #12 from Bernie Innocenti <bernie at codewiz dot org> ---
Would a diagnostic or a warning for code like this be possible?

  const PLANEPTR v2 =3D 0L;
  register const PLANEPTR n2 __asm("a0") =3D v2;

Tracking down the silent argument corruption took a long time, since in most
cases a0 randomly happened to contain 0.=