[llvm-bugs] [Bug 26999] New: After r249655, -save-temps causes -cc1as mode to crash

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Mar 19 09:25:10 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=26999

            Bug ID: 26999
           Summary: After r249655, -save-temps causes -cc1as mode to crash
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: dimitry at andric.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

In r249655, there was an overhaul of the -g flag handling in the driver.  This
seems to have caused a problem when you use -g in combination with -save-temps:

$ echo "int main(void) { return 0; }" > test.c
$ clang -g -save-temps -c test.c
Unknown version
UNREACHABLE executed at /share/dim/src/llvm/trunk/lib/MC/MCDwarf.cpp:1257!
clang-3.9: error: unable to execute command: Abort trap (core dumped)
clang-3.9: error: clang integrated assembler command failed due to signal (use
-v to see invocation)
clang version 3.9.0 (trunk 263389)
Target: i386-unknown-freebsd11.0
Thread model: posix
InstalledDir: /share/dim/llvm/263389-trunk-freebsd11-i386-ninja-rel-1/bin

Running the same command with -v shows that the cc1as stage is run as follows:

clag -cc1as -triple i386-unknown-freebsd11.0 -filetype obj -main-file-name
test.c -target-cpu i486 -mrelocation-model static -mrelax-all -o test.o test.s

Because no -g option is passed, cc1as_main.cpp sets the DwarfVersion to 0, and
this causes an assertion failure in MCDwarf.cpp's getCIEVersion() function:

  1245  static unsigned getCIEVersion(bool IsEH, unsigned DwarfVersion) {
  1246    if (IsEH)
  1247      return 1;
  1248    switch (DwarfVersion) {
  1249    case 2:
  1250      return 1;
  1251    case 3:
  1252      return 3;
  1253    case 4:
  1254    case 5:
  1255      return 4;
  1256    }
  1257    llvm_unreachable("Unknown version");
  1258  }

This function was called by FrameEmitterImpl::EmitCIE(), because the .s file
generated by the previous .c -> .s stage contains debugging directives.

Either the -cc1as stage should get a -dwarfversion flag passed by the previous
stage, or it should not set the DwarfVersion to 0 by default.  (But if not
zero, then the DwarfVersion is really dependent on the platform and target...)

-- 
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/20160319/85dae45e/attachment.html>


More information about the llvm-bugs mailing list