File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -1320,7 +1320,11 @@ GetGlobalOp::verifySymbolUses(SymbolTableCollection &symbolTable) {
13201320
13211321 // global has non-array type
13221322 auto lvalueType = dyn_cast<LValueType>(resultType);
1323- if (!lvalueType || lvalueType.getValueType () != globalType)
1323+ if (!lvalueType)
1324+ return emitOpError (" on non-array type expects result type to be an "
1325+ " lvalue type for the global @" )
1326+ << getName ();
1327+ if (lvalueType.getValueType () != globalType)
13241328 return emitOpError (" on non-array type expects result inner type " )
13251329 << lvalueType.getValueType () << " to match type " << globalType
13261330 << " of the global @" << getName ();
Original file line number Diff line number Diff line change @@ -532,6 +532,16 @@ func.func @use_global() {
532532
533533// -----
534534
535+ emitc.global @myglobal_value : f32
536+
537+ func.func @use_global () {
538+ // expected-error @+1 {{'emitc.get_global' op on non-array type expects result type to be an lvalue type for the global @myglobal_value}}
539+ %0 = emitc.get_global @myglobal_value : !emitc.array <2 xf32 >
540+ return
541+ }
542+
543+ // -----
544+
535545func.func @member (%arg0: !emitc.lvalue <i32 >) {
536546 // expected-error @+1 {{'emitc.member' op operand #0 must be emitc.lvalue of EmitC opaque type values, but got '!emitc.lvalue<i32>'}}
537547 %0 = " emitc.member" (%arg0 ) {member = " a" } : (!emitc.lvalue <i32 >) -> !emitc.lvalue <i32 >
You can’t perform that action at this time.
0 commit comments