https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87546
--- Comment #3 from graham.stott77 at gmail dot com --- 'b' is never assigned a value, so surely it's undefined -------- Original message -------- From: helloqirun at gmail dot com <gcc-bugzi...@gcc.gnu.org> Date: 08/10/2018 04:51 (GMT+00:00) To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/87546] New: Gcc miscompiles at -O3 on valid code https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87546 Bug ID: 87546 Summary: Gcc miscompiles at -O3 on valid code Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: helloqirun at gmail dot com Target Milestone: --- It should be a very recent regression. $ gcc-trunk -v Using built-in specs. COLLECT_GCC=gcc-trunk COLLECT_LTO_WRAPPER=/home/absozero/trunk/root-gcc/libexec/gcc/x86_64-pc-linux-gnu/9.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc/configure --prefix=/home/absozero/trunk/root-gcc --enable-languages=c,c++ --disable-werror --enable-multilib Thread model: posix gcc version 9.0.0 20181007 (experimental) [trunk revision 264906] (GCC) $ gcc-trunk abc.c ; ./a.out -37 $ gcc-trunk -O3 abc.c ; ./a.out 219 $ cat abc.c int printf(const char *, ...); int a; long b, f; char c, g; short d = 219; int e[7]; int main() { for (; c <= 6; c++) { g = d < 0 ? d : d >> a; f = g + b; e[c] = f; } printf("%d\n", e[1]); }