https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90020
Martin Liška <marxin at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |wrong-code CC| |rguenth at gcc dot gnu.org Summary|[8 regression] -O2 -Os |[7/8/9 regression] -O2 -Os |x86-64 wrong code generated |x86-64 wrong code generated |for GNU Emacs |for GNU Emacs Known to fail| |7.4.0, 8.3.0, 9.0 --- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> --- I can confirm that even though the code is not so nice :) I have 2 versions of the reduced test-case: 1) $ gcc emacs0.c -Os -fno-strict-aliasing -g && valgrind ./a.out ==20746== Memcheck, a memory error detector ==20746== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. ==20746== Using Valgrind-3.14.0 and LibVEX; rerun with -h for copyright info ==20746== Command: ./a.out ==20746== ==20746== Invalid read of size 8 ==20746== at 0x4011CF: select_window (emacs0.c:116) ==20746== by 0x40105A: main (emacs0.c:126) ==20746== Address 0xa is not stack'd, malloc'd or (recently) free'd fails for 4.8.0+ except 4.9.x releases. 2) $ gcc emacs.c -Os -fno-strict-aliasing && ./a.out started failing with r238242 The problematic transformation: <bb 2> [local count: 1073741824]: _1 = PSEUDOVECTORP (window_6(D)); pretmp_9 = MEM[(struct window *)window_6(D)].contents; if (_1 != 0) goto <bb 3>; [50.00%] else goto <bb 4>; [50.00%] happens in PRE. Richi can you please take a look?