[Bug rtl-optimization/94873] [8/9/10 Regression] wrong code with -O -fno-merge-constants -fno-split-wide-types -fno-tree-fre
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Apr 30 12:42:57 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94873
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2020-04-30
Target Milestone|--- |8.5
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Testcase without printf:
__attribute__((noipa)) void
foo (const char *p, int q)
{
if (p[0] != '%' || p[1] != '0' || p[2] != '2' || p[3] != 'x' || p[4] != '\0'
|| (unsigned char) q != 0x95)
__builtin_abort ();
}
int
main ()
{
char x = ((union { __int128 a; char b[16]; }){ .a =
0xF4409395252B9560}).b[1];
for (unsigned i = 0; i < sizeof (x); i++)
foo ("%02x", i[(volatile unsigned char *) &x]);
return 0;
}
The difference (before that commit and with that) is:
--- pr94873.s1 2020-04-30 14:31:25.834578823 +0200
+++ pr94873.s2 2020-04-30 14:32:46.452456073 +0200
@@ -19,8 +19,11 @@ main:
ret
.size main, .-main
.section .rodata
- .align 3
+ .align 4
.set .LANCHOR0,. + 0
+.LC0:
+ .xword -846514461162629792
+ .xword 0
.LC1:
.string "%02x"
.ident "GCC: (GNU) 8.0.1 20180315 (experimental)"
i.e. the unused constant somehow made it into the .rodata section.
More information about the Gcc-bugs
mailing list