[cfe-commits] r46691 - in /cfe/trunk: AST/ASTContext.cpp AST/Type.cpp AST/TypeSerialization.cpp CodeGen/CGDecl.cpp CodeGen/CodeGenModule.cpp CodeGen/CodeGenTypes.cpp Sema/Sema.h Sema/SemaDecl.cpp include/clang/AST/ASTContext.h include/clang/AST/T

Christopher Lamb christopher.lamb at gmail.com
Sun Feb 3 23:19:31 PST 2008


On Feb 3, 2008, at 8:56 PM, Eli Friedman wrote:

> Looks like an interesting change.  sema probably needs some work to
> properly check for implicit casts between incompatible pointers (i.e.
> int __attribute((address_space(1)))* to int*).

Interestingly the legality of these casts is target dependent and  
based on the particular target's aliasing rules for those address  
spaces. On all the currently supported platforms address spaces are  
probably not even legal.

> FoldBitCast in
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ 
> ConstantFold.cpp?view=markup
> is broken because it discards casts between pointers types with
> different address spaces; this means codegen with conversions between
> address spaces crashes :(

That would definitely be part of the experimental nature of this  
support. =)

> re:
> +  // TODO: Should we convert contained types of address space
> +  // qualified types here or or where they directly participate in  
> conversions
> +  // (i.e. elsewhere)
>
> Elsewhere; the type of "struct a mystuff
> __attribute__((address_space(1)));" has to be a qualified version of
> struct a; otherwise, you'd be required to have two distinct instances
> of the same type, which wouldn't work.

Ok, good to know.

> clang doesn't handle those sorts of issues well at the moment, though;
> clang currently allows the following:
> struct a {int a;};
> void a(const struct a * t) {t->a = 10;}

Ouch.

--
Christopher Lamb



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20080203/00207d5f/attachment.html>


More information about the cfe-commits mailing list