[LLVMbugs] [Bug 19594] New: clang crashes on valid code at -Os and above on x86_64-linux-gnu in 32-bit mode

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Apr 28 16:57:17 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=19594

            Bug ID: 19594
           Summary: clang crashes on valid code at -Os and above on
                    x86_64-linux-gnu in 32-bit mode
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: su at cs.ucdavis.edu
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The current clang trunk crashes when compiling the following testcase at -Os
and above on x86_64-linux-gnu in 32-bit (but not 64-bit) mode. 

This is a regression from clang 3.4.


$ clang-trunk -v
clang version 3.5.0 (trunk 207415)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.8.1
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.1
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
$ 
$ clang-trunk -m32 -O1 small.c; a.out
$ clang-trunk -m64 -Os small.c; a.out
$ clang-3.4 -m32 -Os small.c; a.out
$ 
$ clang-trunk -m32 -Os small.c
clang: /tmp/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:1701: virtual
void {anonymous}::RegReductionPQBase::remove(llvm::SUnit*): Assertion
`SU->NodeQueueId != 0 && "Not in queue!"' failed.
0  clang           0x0000000002761f92 llvm::sys::PrintStackTrace(_IO_FILE*) +
34
1  clang           0x0000000002761b79
2  libpthread.so.0 0x00007f5d4f20dcb0
3  libc.so.6       0x00007f5d4e233425 gsignal + 53
4  libc.so.6       0x00007f5d4e236b8b abort + 379
5  libc.so.6       0x00007f5d4e22c0ee
6  libc.so.6       0x00007f5d4e22c192
7  clang           0x0000000001fae9f8
8  clang           0x0000000001fbce7a
9  clang           0x0000000001f3cec2
llvm::SelectionDAGISel::CodeGenAndEmitDAG() + 1506
10 clang           0x0000000001f4116c
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) + 1628
11 clang           0x0000000001f42d55
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) + 981
12 clang           0x00000000026f177f
llvm::FPPassManager::runOnFunction(llvm::Function&) + 639
13 clang           0x00000000026f17cb
llvm::FPPassManager::runOnModule(llvm::Module&) + 43
14 clang           0x00000000026f2dff
llvm::legacy::PassManagerImpl::run(llvm::Module&) + 863
15 clang           0x00000000008d8306
clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions
const&, clang::TargetOptions const&, clang::LangOptions const&,
llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::raw_ostream*) +
3046
16 clang           0x00000000008d2fae
17 clang           0x0000000000aa1ad2 clang::ParseAST(clang::Sema&, bool, bool)
+ 514
18 clang           0x00000000008d4da1 clang::CodeGenAction::ExecuteAction() +
97
19 clang           0x00000000007126c6 clang::FrontendAction::Execute() + 182
20 clang           0x00000000006f00ed
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 349
21 clang           0x00000000006d4e3d
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1277
22 clang           0x00000000006ccd48 cc1_main(char const**, char const**, char
const*, void*) + 1240
23 clang           0x00000000006d2f9d main + 797
24 libc.so.6       0x00007f5d4e21e76d __libc_start_main + 237
25 clang           0x00000000006cbaf9
Stack dump:
0.    Program arguments: /usr/local/clang-trunk/bin/clang -cc1 -triple
i386-unknown-linux-gnu -emit-obj -disable-free -main-file-name small.c
-mrelocation-model static -fmath-errno -masm-verbose -mconstructor-aliases
-fuse-init-array -target-cpu pentium4 -target-linker-version 2.22
-momit-leaf-frame-pointer -resource-dir
/usr/local/clang-trunk/bin/../lib/clang/3.5.0 -internal-isystem
/usr/local/include -internal-isystem
/usr/local/clang-trunk/bin/../lib/clang/3.5.0/include -internal-externc-isystem
/include -internal-externc-isystem /usr/include -Os -fdebug-compilation-dir
/data2/c-hunter-results/C/trans-bugs/REDUCED/20140423-clang-m32-O2-O3-build-test68217
-ferror-limit 19 -fmessage-length 123 -mstackrealign -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp
-o /tmp/small-1ddcd6.o -x c small.c 
1.    <eof> parser at end of file
2.    Code generation
3.    Running pass 'Function Pass Manager' on module 'small.c'.
4.    Running pass 'X86 DAG->DAG Instruction Selection' on function '@main'
clang: error: unable to execute command: Aborted (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.5.0 (trunk 207415)
Target: i386-unknown-linux-gnu
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ 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: /tmp/small-f40b07.c
clang: note: diagnostic msg: /tmp/small-f40b07.sh
clang: note: diagnostic msg: 

********************
$ 


-----------------------------------


int a[1], b;

void
foo (int p)
{
  b = a[b] ^ p;
}

#pragma pack(1)
struct
{
  int:19;
  int:28;
  int:14;
  int:2;
  int f1:9;
  int:28;
  int f2:10;
  int f3:23;
  int f4;
} c;

int
main ()
{
  if (c.f4)
    c.f3 = 0;
  foo (c.f1 >> 24 & 1);
  foo (c.f2 >> 24 & 1);
  foo (c.f3 >> 16 & 1);
  foo (c.f3 >> 24 & 1);
  return 0;
}

-- 
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/20140428/f224cc13/attachment.html>


More information about the llvm-bugs mailing list