[LLVMbugs] [Bug 2878] New: Calling makeLLVMModuleContents twice gives memory errors

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Fri Oct 10 04:19:39 PDT 2008


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

           Summary: Calling makeLLVMModuleContents twice gives memory errors
           Product: tools
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: llc
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: nicolas.geoffray at lip6.fr
                CC: llvmbugs at cs.uiuc.edu


When calling two times the makeLLVMModuleContents function generated by the cpp
backend with -cppgen=contents, I get a memory corruption.

You can find the .ll file to compile using:
llvm-as -f essai.ll -o - | llc -march=cpp -cppgen=contents -f -o generated.cpp

And then compile essai.cpp with the appropriate llvm libraries.

The error is probably due to the use of opaque types in the
makeLLVMModuleContents function.

The error message is:
*** glibc detected *** ./a.out: malloc(): memory corruption (fast): 0x087dabe8
***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6[0xb7d54962]
/lib/tls/i686/cmov/libc.so.6(__libc_malloc+0x8d)[0xb7d55cad]
/usr/lib/libstdc++.so.6(_Znwj+0x27)[0xb7f20447]
./a.out(_ZNSt6vectorIPKN4llvm4TypeESaIS3_EEC1ERKS5_+0x4e)[0x85ff81e]

The trace with the core dump.

#0  0xb7f8b410 in __kernel_vsyscall ()
#1  0xb7d13085 in raise () from /lib/tls/i686/cmov/libc.so.6
#2  0xb7d14a01 in abort () from /lib/tls/i686/cmov/libc.so.6
#3  0xb7d4bb7c in ?? () from /lib/tls/i686/cmov/libc.so.6
#4  0xb7d54962 in ?? () from /lib/tls/i686/cmov/libc.so.6
#5  0xb7d55cad in malloc () from /lib/tls/i686/cmov/libc.so.6
#6  0xb7f20447 in operator new () from /usr/lib/libstdc++.so.6
#7  0x085ff81e in std::vector<llvm::Type const*, std::allocator<llvm::Type
const*> >::vector ()
#8  0x085fc3fc in llvm::FunctionType::get ()
#9  0x0865b455 in makeLLVMModuleContents (mod=0x87da320) at generated.cpp:26
#10 0x0865b737 in main () at essai.cpp:19


-- 
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