https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65367
Bug ID: 65367 Summary: indefinite loop occurs with sanitize enabled and certain optimization options Product: gcc Version: 5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: mike at cchtml dot com Created attachment 34997 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34997&action=edit makedep.pp When attempting to debug a gcc5/wine issue I ran across an infinite loop when certain optimization flags are set. The "tools/makedep.c" program during wine's autotools configure process is where the issue is occurring. Compile the attached pre-processed code with the following: gcc -x cpp-output ./makedep.pp -mtune=generic -march=x86-64 -O1 -fsanitize=undefined -fno-tree-ccp -fno-tree-copy-prop -fno-tree-dominator-opts -fno-tree-fre -o makedep.o The loop only occurs when -O1 is specified (doesn't happen with -O2+) and all four tree optimizations are disabled simultaneously. If any are enabled it does not loop. If sanitize is disabled it does not loop. GCC 4.9 compiles the code without looping. $ gcc --version gcc (GCC) 5.0.0 20150226 (Red Hat 5.0.0-0.18)