[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

Eli Friedman eli.friedman at gmail.com
Sun Feb 3 20:56:23 PST 2008


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*).  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 :(

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.
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;}

-Eli



More information about the cfe-commits mailing list