[LLVMbugs] [Bug 8707] New: Blocks cannot contain static variables when compiled with clang, works with LLVM-GCC 4.2

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Nov 30 07:06:19 PST 2010


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

           Summary: Blocks cannot contain static variables when compiled
                    with clang, works with LLVM-GCC 4.2
           Product: clang
           Version: unspecified
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: keith at 33software.com
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=5839)
 --> (http://llvm.org/bugs/attachment.cgi?id=5839)
Exhibits the issue described above.

Summary:

Compiled with Clang, blocks cannot contain static variables.

Attached is a source file which when compiled with clang, it exits with an
error. Compiling with LLVM-GCC 4.2 doesn't exhibit the issue.

You can pass -DFIXME to remove move the declaration outside the block, causing
it to compile successfully under Clang and LLVM-GCC 4.2.


Invocations:

$ clang MiscompiledBlockWithClang.m -framework Cocoa // exhibits issue
$ clang MiscompiledBlockWithClang.m -framework Cocoa -DFIXME // moves the
declaration, working around the issue

$ llvm-gcc-4.2 MiscompiledBlockWithClang.m -framework Cocoa // doesn't exhibit
issue


Versions:

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

@@@
$ llvm-gcc-4.2 -v
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)
@@@


Expected Results:

You shouldn't be limited in where you can place a static variable.

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