https://bugs.llvm.org/show_bug.cgi?id=48085
Bug ID: 48085
Summary: Compiling infinite goto loop with -O2 takes clang into
an infinite loop
Product: new-bugs
Version: 9.0
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: new bugs
Assignee: unassignedb...@nondot.org
Reporter: david.cortes.riv...@gmail.com
CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org
Created attachment 24137
--> https://bugs.llvm.org/attachment.cgi?id=24137&action=edit
Source code that produces the bug
I’ve come across an issue in which, when some C code contains an infinite loop
in the form of a ‘goto’ with the exit condition blocked by another goto,
compiling it with clang will take clang into an infinite loop during
compilation, making it get stuck until eventually running out of memory.
Attached is a screenshot of the source code that gave the problem (the original
file is this:
https://github.com/david-cortes/cmfrec/blob/master/src/collective.c).
I’m additionally attaching a very small reproducible example in which the issue
is reproducible, but only with -O2 and higher.
Steps to reproduce:
- Download the attached source code file
- Compile it with -O2 - e.g.:
clang -O2 infinite_loop.c
Expected behavior: Should compile the source code into an executable,
regardless of whether it has an infinite loop or not. Ideally should warn about
the infinite loop.
Actual behavior: Compiler gets stuck into an infinite loop trying to optimize
that code, until eventually running out of memory.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs