[cfe-dev] problem: address space attribute C/C++

Helge Rhodin helge.rhodin at alice-dsl.net
Fri Jul 23 09:04:49 PDT 2010


Hi,

I have a problem with clang and the address space attribute. I don't know if it is intended or a bug. The following code compiles fine as a .c file but fails as .cpp:

C-Code:
int __attribute__((address_space(1))) globalint = 10;

bitcode:
@globalint = addrspace(1) global i32 10, align 4  ; <i32 addrspace(1)*> [#uses=0]

Error in clangtest.cpp:
clangtest.cpp:2:39: error: cannot initialize a variable of type 'int
      __attribute__((address_space(1)))' with an rvalue of type 'int'
int __attribute__((address_space(1))) globalint = 10;
                                      ^           ~~
1 error generated.

I have additional problems with classes. In which cases are none zero address spaces supported, is there a documentation around?

thanks in advance,
Helge
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100723/2adefd4a/attachment.html>


More information about the cfe-dev mailing list