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 @@ -1103,6 +1103,15 @@ module {
1103
1103
1104
1104
// -----
1105
1105
1106
+ !s8i = !cir.int<s, 8>
1107
+ cir.func @no_reference_global() {
1108
+ // expected-error @below {{'cir.get_global' op 'str' does not reference a valid cir.global or cir.func}}
1109
+ %0 = cir.get_global @str : !cir.ptr<!s8i>
1110
+ cir.return
1111
+ }
1112
+
1113
+ // -----
1114
+
1106
1115
// expected-error@+1 {{invalid underlying type for long double}}
1107
1116
cir.func @bad_long_double(%arg0 : !cir.long_double<!cir.float>) -> () {
1108
1117
cir.return
You can’t perform that action at this time.
0 commit comments