[Bug rtl-optimization/115056] [14/15 regression] Miscompilation (also triggering -Wstringop-overflow and -Warray-bounds warning) when -O2 or higher
weilercdale at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon May 13 01:51:39 GMT 2024
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115056
--- Comment #10 from Dale Weiler <weilercdale at gmail dot com> ---
New test case without UB still exhibits the behavior
#include <string.h>
#include <stdio.h>
typedef union {
unsigned char as_bytes[64];
unsigned long long as_chunks[64 / sizeof(unsigned long long)];
} Block;
int main(int argc, char **argv) {
Block block;
int i = strlen(argv[0]), j = 0;
for (; j < i; j++) block.as_bytes[j] = argv[0][j];
block.as_bytes[j] = 0x01;
while (++j & 7) block.as_bytes[j] = 0;
if (j > 56) while (j < 64) block.as_bytes[j++] = 0;
while (j < 56) block.as_bytes[j++] = 0;
while (j < 64) block.as_bytes[j++] = 0x01;
for (j = 0; j < 8; j++) printf("%d\n", (int)block.as_chunks[j]);
}
More information about the Gcc-bugs
mailing list