[Bug 483679] [NEW] llvm-gcc fails to recognize __block keywords

Mario Schwalbe schwalbe at inf.tu-dresden.de
Mon Nov 16 16:17:35 UTC 2009


Public bug reported:

Binary package hint: llvm-gcc-4.2

the following source code:

#include <stdio.h>

int main(void)
{
    printf("Hello World!\n");

#ifdef __BLOCKS__
    int closed = 1;
    __block int open = 2;
    //int open = 2;

    void (^print)(int) = ^(int n)
    {
        printf("%d %d %d\n", closed, open, n);
    };

    closed = 3;
    open   = 4;

    print(5); // prints 1 4 5
#endif

    return 0;
}

compiled with:

/usr/lib/llvm/llvm/gcc-4.2/bin/llvm-gcc -fblocks blocks.c

causes:

blocks.c: In function 'main':
blocks.c:9: error: '__block' undeclared (first use in this function)
blocks.c:9: error: (Each undeclared identifier is reported only once
blocks.c:9: error: for each function it appears in.)
blocks.c:9: error: expected ';' before 'int'
blocks.c: In function '__main_block_invoke_1':
blocks.c:13: error: 'open' undeclared (first use in this function)
blocks.c: In function 'main':
blocks.c:17: error: 'open' undeclared (first use in this function)

after removing the __block keyword, compilation succeeds. (links and runs fine as well
after manually compiling the blocks runtime library.)

for reference:

> /usr/lib/llvm/llvm/gcc-4.2/bin/llvm-gcc --version
llvm-gcc (GCC) 4.2.1 (Based on Apple Inc. build 5649) (LLVM build)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

> apt-cache policy llvm-gcc-4.2
llvm-gcc-4.2:
  Installed: 2.6~pre1-0ubuntu1
  Candidate: 2.6~pre1-0ubuntu1
  Version table:
 *** 2.6~pre1-0ubuntu1 0
        500 http://de.archive.ubuntu.com karmic/universe Packages
        100 /var/lib/dpkg/status

** Affects: llvm-gcc-4.2 (Ubuntu)
     Importance: Undecided
         Status: New

-- 
llvm-gcc fails to recognize __block keywords
https://bugs.launchpad.net/bugs/483679
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs at lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs




More information about the universe-bugs mailing list