-
Notifications
You must be signed in to change notification settings - Fork 179
Closed
Description
Some parts of CIRGenExprConst.cpp assumes that attributes generated for RHS of assignments are TypedAttr's e.g.
auto typedC = llvm::dyn_cast<mlir::TypedAttr>(C);
if (!typedC)
llvm_unreachable("this should always be typed");
return typedC;
But in some cases SymbolRefAttr could be generated as well e.g. in
$ cat tmp.c
typedef struct {
char *name;
} A;
A foo = {"1"};
$ /home/huawei/src/clangir/build/bin/clang -fclangir-enable -S tmp.c
this should always be typed
UNREACHABLE executed at /home/huawei/src/clangir/clang/lib/CIR/CodeGen/CIRGenExprConst.cpp:1428!
...
#13 0x00007fa8faecf572 cir::ConstantEmitter::tryEmitPrivate(clang::Expr const*, clang::QualType) /home/huawei/src/clangir/clang/lib/CIR/CodeGen/CIRGenExprConst.cpp:1429:10
Perhaps GlobalViewAttr should be used instead of SymbolRefAttr in such cases?
Metadata
Metadata
Assignees
Labels
No labels