[LLVMbugs] [Bug 21302] New: llvm 3.5 optimizer miscompile regression with zdoom
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Oct 16 13:11:29 PDT 2014
http://llvm.org/bugs/show_bug.cgi?id=21302
Bug ID: 21302
Summary: llvm 3.5 optimizer miscompile regression with zdoom
Product: new-bugs
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: ed0.88.prez at gmail.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Hello, I have a problem with a big open source program called ZDoom.
The problem is that with the release of clang 3.5, the llvm optimizer
miscompiles a portion of the code so that the program crashes with suitable
input. To reproduce it, follow the instructions:
Download the source with git:
git clone https://github.com/rheit/zdoom.git path/to/zdoom
Before compiling the program, open src/p_acs.cpp and remove this workaround:
// [EP] Clang 3.5.0 optimizer miscompiles this function and causes random
// crashes in the program. I hope that Clang 3.5.x will fix this.
#if defined(__clang__) && __clang_major__ == 3 && __clang_minor__ >= 5
asm("" : "+g" (NumScripts));
#endif
which prevents the problems.
Then follow the instructions in http://zdoom.org/wiki/Compile_ZDoom_on_Linux
inside the new folder before the section:
http://zdoom.org/wiki/Compile_ZDoom_on_Linux#Compile
After that, do this:
create a folder where to run cmake (release_clang_3.5, whatever you want), then
inside the folder, run:
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_C_COMPILER=path/to/clang-3.5 \
-DCMAKE_CXX_COMPILER=path/to/clang++-3.5 \
-DNO_ASM=1 \
-DVALGRIND=1 \
-DCMAKE_CXX_FLAGS=-std=c++11 ..
if anything goes fine, run:
make -j4
In order to reproduce the problem, you need to download two files:
freedoom.wad , extracted from the archive file, downloadable at:
https://github.com/freedoom/freedoom/releases/download/v0.9/freedoom-0.9.zip
ZDoomEditDemo_v1_2.pk3, extracted from the archive file, downloadable at:
http://www.mediafire.com/download/w95mcmc83b5z18r/ZDoom_Editing_Demo_v1.2.zip
Save the two files in $HOME/.zdoom .
You have everything, just run (with valgrind too):
./zdoom -iwad freedoom.wad -file ZDoomEditDemo_v1_2.pk3
You should be able get a crash which is not catched by the program and closes
suddenly, if you compiled the program with clang 3.5.
Sometimes the crash happens in other places, and sometimes the crash happens
when closing the program (esc to open the menu -> quit game -> confirm).
you run it with valgrind, you'll get an error which is not present with
clang 3.4 (should be the first one in the error list), then the program works
fine.
If you want to check with address sanitizer, you have to disable asan-globals
because for some reason asan does not like data sorting into custom sections.
I can't help you with the debugging other than seeing that the problem happens
in that portion of the code where there's the workaround.
Sincerely,
Edward-san
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20141016/f046edc9/attachment.html>
More information about the llvm-bugs
mailing list