Skip to content

Reproducible Clang crash + strongly suspected invalid code generation #35403

@llvmbot

Description

@llvmbot
Bugzilla Link 36055
Resolution FIXED
Resolved on Feb 26, 2018 15:08
Version unspecified
OS MacOS X
Blocks #35152
Attachments run script, preprocessed source
Reporter LLVM Bugzilla Contributor
CC @DimitryAndric,@zmodem,@nlewycky,@zygoloid

Extended Description

--- 1. Command-line which caused the crash and output:

gcc -DITHARE_OBF_SEED=0xbcef7cc0201ec100 -DITHARE_OBF_SEED2=0x0ec20b00a6b0f5ee -DITHARE_OBF_INIT -DITHARE_OBF_CONSISTENT_XPLATFORM_IMPLICIT_SEEDS -DITHARE_OBF_DBG_RUNTIME_CHECKS -o obftemp -std=c++1z -lstdc++ -Werror -g ../official.cpp
clang: error: unable to execute command: Killed: 9
clang: error: clang frontend command failed due to signal (use -v to see invocation)
Apple LLVM version 9.0.0 (clang-900.0.39.2)
Target: x86_64-apple-darwin17.3.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
clang: note: diagnostic msg: PLEASE submit a bug report to http://developer.apple.com/bugreporter/ and include the crash backtrace, preprocessed source, and associated run script.
clang: note: diagnostic msg:


PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /var/folders/28/484cmxmd5g7dzh3jd2fkhvfw0000gn/T/official-cc1d9a.cpp
clang: note: diagnostic msg: /var/folders/28/484cmxmd5g7dzh3jd2fkhvfw0000gn/T/official-cc1d9a.sh
clang: note: diagnostic msg: Crash backtrace is located in
clang: note: diagnostic msg: /Users/nemo/Library/Logs/DiagnosticReports/clang__.crash
clang: note: diagnostic msg: (choose the .crash file that corresponds to your crash)
clang: note: diagnostic msg:


NOTES:

  • .cpp and .sh are attached
  • no crash backtrace was created
  • #defines in command-line are of CRITICAL importance; in general, ANY change to the parameters will lead to VERY different results.
  • don't ask why the source is written like this - there are other reasons to write it, but apparently it happens to be a very good open-source tool to torture compiler :-).

--- 2. IF changing command line above, keeping it almost-the-same but removing '-g' option, the code will compile, but resulting Mac OS X executable will crash with segfault (only with these #defines, with ~10'000 other random #defines it was ok). There is a strong suspicion that this is a manifestation of a code generation bug in Clang (there are very few pointers in the whole program - except for occasional type punning, and it is very difficult to get a segfault there); of course, technically speaking, there is always a chance that there is some UB which manifests like this - but combined with the Clang crashing with almost-exactly the same command line - chances are that it is a manifestation of the same bug in Clang.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillaclang:codegenIR generation bugs: mangling, exceptions, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions