[LLVMbugs] [Bug 8736] New: LLVM-GCC-4.2 recursive global blocks are nil at runtime

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Dec 4 11:44:59 PST 2010


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

           Summary: LLVM-GCC-4.2 recursive global blocks are nil at
                    runtime
           Product: new-bugs
           Version: unspecified
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: keith at 33software.com
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=5869)
 --> (http://llvm.org/bugs/attachment.cgi?id=5869)
Demonstrates issue.

Summary:

When compiling a global block variable that calls itself, using LLVM GCC 4.2,
the block isn't created - but compilation succeeds and the symbol is still
exported.

This is also filed as rdar://problem/8639147


Steps to Reproduce:

Compile and run the attached test case using:

@@@
llvm-gcc-4.2 RecursiveGlobalBlocks.m -framework Foundation
./a.out
@@@

This will exit with EXIT_FAILURE.

The output of `llvm-gcc-4.2 -v` is:

@@@
Using built-in specs.
Target: i686-apple-darwin10
Configured with: /var/tmp/llvmgcc42/llvmgcc42-2333.4~7/src/configure
--disable-checking --enable-werror --prefix=/Developer/usr/llvm-gcc-4.2
--mandir=/share/man --enable-languages=c,objc,c++,obj-c++
--program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/
--with-slibdir=/usr/lib --build=i686-apple-darwin10
--enable-llvm=/var/tmp/llvmgcc42/llvmgcc42-2333.4~7/dst-llvmCore/Developer/usr/local
--program-prefix=i686-apple-darwin10- --host=x86_64-apple-darwin10
--target=i686-apple-darwin10 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2333.4)
@@@


Recompile and run the test case using:

@@@
clang RecursiveGlobalBlocks.m -framework Foundation
./a.out
@@@

Compiled with clang the program will output 120  (5!) and exit with
EXIT_SUCCESS

The output of `clang -v` is:

@@@
Apple clang version 1.6 (tags/Apple/clang-70)
Target: x86_64-apple-darwin10
Thread model: posix
@@@


Expected Results:

Fail to compile, or ensure global blocks can call themselves.


Actual Results:

Global block variables which call themselves, compiled with llvm-gcc-4.2, are
nil at runtime. Invoking them results in a crash when de-referencing to
retrieve the function pointer.

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