[LLVMbugs] [Bug 10277] New: After r134372, segfault in InlineSpiller::analyzeSiblingValues()

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jul 5 02:32:21 PDT 2011


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

           Summary: After r134372, segfault in
                    InlineSpiller::analyzeSiblingValues()
           Product: new-bugs
           Version: trunk
          Platform: PC
        OS/Version: FreeBSD
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: dimitry at andric.com
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=6829)
 --> (http://llvm.org/bugs/attachment.cgi?id=6829)
Crashes InlineSpiller::analyzeSiblingValues() if compiled with -O2

After r134372, I started getting segfaults in MipsFrameLowering.cpp,
while self-hosting on FreeBSD/i386:

gmake[3]: Entering directory `/home/dim/obj/llvm-2/lib/Target/Mips'
llvm[3]: Compiling MipsFrameLowering.cpp for Release+Asserts build
if  /home/dim/llvm/134372M-gcc-rel-1/bin/clang++ -I/home/dim/obj/llvm-2/include
-I/home/dim/obj/llvm-2/lib/Target/Mips -I/home/dim/src/llvm/trunk/include
-I/home/dim/src/llvm/trunk/lib/Target/Mips  -D_DEBUG -D_GNU_SOURCE
-D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -O2  -fno-exceptions -fno-rtti
-fPIC -Woverloaded-virtual -Wcast-qual    -pedantic -Wno-long-long -Wall -W
-Wno-unused-parameter -Wwrite-strings  -c -MMD -MP -MF
"/home/dim/obj/llvm-2/lib/Target/Mips/Release+Asserts/MipsFrameLowering.d.tmp"
-MT "/home/dim/obj/llvm-2/lib/Target/Mips/Release+Asserts/MipsFrameLowering.o"
-MT "/home/dim/obj/llvm-2/lib/Target/Mips/Release+Asserts/MipsFrameLowering.d"
/home/dim/src/llvm/trunk/lib/Target/Mips/MipsFrameLowering.cpp -o
/home/dim/obj/llvm-2/lib/Target/Mips/Release+Asserts/MipsFrameLowering.o ; \
        then /bin/mv -f
"/home/dim/obj/llvm-2/lib/Target/Mips/Release+Asserts/MipsFrameLowering.d.tmp"
"/home/dim/obj/llvm-2/lib/Target/Mips/Release+Asserts/MipsFrameLowering.d";
else /bin/rm
"/home/dim/obj/llvm-2/lib/Target/Mips/Release+Asserts/MipsFrameLowering.d.tmp";
exit 1; fi
Stack dump:
0.      Program arguments: /home/dim/llvm/134372M-gcc-rel-1/bin/clang -cc1
-triple i386-unknown-freebsd9.0 -emit-obj -disable-free -main-file-name
MipsFrameLowering.cpp -pic-level 2 -mdisable-fp-elim -masm-verbose
-mconstructor-aliases -target-cpu i486 -target-linker-version 2.17.50
-momit-leaf-frame-pointer -coverage-file
/home/dim/obj/llvm-2/lib/Target/Mips/Release+Asserts/MipsFrameLowering.o
-resource-dir /home/dim/llvm/134372M-gcc-rel-1/bin/../lib/clang/3.0
-dependency-file
/home/dim/obj/llvm-2/lib/Target/Mips/Release+Asserts/MipsFrameLowering.d.tmp
-MP -MT
/home/dim/obj/llvm-2/lib/Target/Mips/Release+Asserts/MipsFrameLowering.o -MT
/home/dim/obj/llvm-2/lib/Target/Mips/Release+Asserts/MipsFrameLowering.d -D
_DEBUG -D _GNU_SOURCE -D __STDC_LIMIT_MACROS -D __STDC_CONSTANT_MACROS -I
/home/dim/obj/llvm-2/include -I /home/dim/obj/llvm-2/lib/Target/Mips -I
/home/dim/src/llvm/trunk/include -I /home/dim/src/llvm/trunk/lib/Target/Mips
-O2 -Woverloaded-virtual -Wcast-qual -Wno-long-long -Wall -W
-Wno-unused-parameter -Wwrite-strings -pedantic -fconst-strings
-fdeprecated-macro -ferror-limit 19 -fmessage-length 237 -fno-rtti
-fgnu-runtime -fdiagnostics-show-option -fcolor-diagnostics -o
/home/dim/obj/llvm-2/lib/Target/Mips/Release+Asserts/MipsFrameLowering.o -x c++
/home/dim/src/llvm/trunk/lib/Target/Mips/MipsFrameLowering.cpp
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module
'/home/dim/src/llvm/trunk/lib/Target/Mips/MipsFrameLowering.cpp'.
4.      Running pass 'Greedy Register Allocator' on function
'@_ZNK4llvm17MipsFrameLowering12emitPrologueERNS_15MachineFunctionE'
clang: error: unable to execute command: Segmentation fault: 11 (core dumped)
clang: error: clang frontend command failed due to signal 2 (use -v to see
invocation)

Running this in gdb gives the following backtrace:

#0  0x0967a0d3 in (anonymous namespace)::InlineSpiller::analyzeSiblingValues ()
#1  0x0967fcf7 in (anonymous namespace)::InlineSpiller::spill ()
#2  0x095a7a48 in (anonymous namespace)::RAGreedy::selectOrSplit ()
#3  0x096c8600 in llvm::RegAllocBase::allocatePhysRegs ()
#4  0x095a13d5 in (anonymous namespace)::RAGreedy::runOnMachineFunction ()
#5  0x0954f471 in llvm::MachineFunctionPass::runOnFunction ()
#6  0x09a68054 in llvm::FPPassManager::runOnFunction ()
#7  0x09a68117 in llvm::FPPassManager::runOnModule ()
#8  0x09a67bef in llvm::MPPassManager::runOnModule ()
#9  0x09a67d2b in llvm::PassManagerImpl::run ()
#10 0x09a67dd7 in llvm::PassManager::run ()
#11 0x0848f533 in clang::EmitBackendOutput ()

Adding a few debug printfs to InlineSpiller::analyzeSiblingValues()
reveals that in this function, OrigLI.getVNInfoAt(VNI->def) returns NULL
sometimes, leading to the segfault in the next if() statement:

void InlineSpiller::analyzeSiblingValues() {
...
      if (VNI->isPHIDef() || VNI->getCopy()) {
        VNInfo *OrigVNI = OrigLI.getVNInfoAt(VNI->def);
        fprintf(stderr, "DBG: OrigVNI=%p, VNI=%p\n", OrigVNI, VNI);
        if (OrigVNI->def != VNI->def) {

I have attached the reduced testcase I generated from
MipsFrameLowering.cpp.  Compile this with "clang -O2" to reproduce the
segfault.  Note, for some reason, the segfault only occurs on i386,
*not* on x86_64...

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list