File tree 2 files changed +11
-2
lines changed
2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -2023,8 +2023,8 @@ LogicalResult
2023
2023
cir::GetGlobalOp::verifySymbolUses (SymbolTableCollection &symbolTable) {
2024
2024
// Verify that the result type underlying pointer type matches the type of
2025
2025
// the referenced cir.global or cir.func op.
2026
- auto op = symbolTable.lookupNearestSymbolFrom (*this , getNameAttr ());
2027
- if (!(isa<GlobalOp>(op) || isa<FuncOp>(op)))
2026
+ auto * op = symbolTable.lookupNearestSymbolFrom (*this , getNameAttr ());
2027
+ if (op == nullptr || !(isa<GlobalOp>(op) || isa<FuncOp>(op)))
2028
2028
return emitOpError (" '" )
2029
2029
<< getName ()
2030
2030
<< " ' does not reference a valid cir.global or cir.func" ;
Original file line number Diff line number Diff line change @@ -1104,6 +1104,15 @@ module {
1104
1104
1105
1105
// -----
1106
1106
1107
+ !s8i = !cir.int<s, 8>
1108
+ cir.func @no_reference_global() {
1109
+ // expected-error @below {{'cir.get_global' op 'str' does not reference a valid cir.global or cir.func}}
1110
+ %0 = cir.get_global @str : !cir.ptr<!s8i>
1111
+ cir.return
1112
+ }
1113
+
1114
+ // -----
1115
+
1107
1116
// expected-error@+1 {{invalid underlying type for long double}}
1108
1117
cir.func @bad_long_double(%arg0 : !cir.long_double<!cir.float>) -> () {
1109
1118
cir.return
You can’t perform that action at this time.
0 commit comments