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

Douglas Gregor dgregor at apple.com
Mon Jul 26 07:28:18 PDT 2010

On Jul 23, 2010, at 9:04 AM, Helge Rhodin wrote:

> 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.
That's definitely a bug. Please file a bug at llvm.org, or (better yet!) provide a patch.
> I have additional problems with classes. In which cases are none zero address spaces supported, is there a documentation around?
Not much. Address spaces are described in the Embedded C TR; the draft of that TR (which has since been published) is available at http://www.open-std.org/jtc1/sc22/wg14/www/projects.

	- Doug

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100726/e19620d9/attachment.html>

More information about the cfe-dev mailing list