Closed
Description
Test cases:
void statements() {
throw 0;
123 + 456;
}
void paren_expr() {
(throw 0, 123 + 456);
}
Both fail during verification because CIRGenItaniumCXXABI::emitThrow
emits a cir.unreachable
after a cir.throw
and we expect cir.unreachable
to be the last operation within a block.
This is unlike __builtin_unreachable()
which inserts a new block:
void statements() {
__builtin_unreachable();
123 + 456;
}
void paren_expr() {
(__builtin_unreachable(), 123 + 456);
}
cir.func @_Z10statementsv() extra(#fn_attr) {
cir.unreachable loc(#loc3)
^bb1: // no predecessors
%0 = cir.const #cir.int<123> : !s32i loc(#loc4)
%1 = cir.const #cir.int<456> : !s32i loc(#loc5)
%2 = cir.binop(add, %0, %1) nsw : !s32i loc(#loc4)
cir.return loc(#loc2)
} loc(#loc11)
cir.func @_Z10paren_exprv() extra(#fn_attr) {
cir.unreachable loc(#loc8)
^bb1: // no predecessors
%0 = cir.const #cir.int<123> : !s32i loc(#loc9)
%1 = cir.const #cir.int<456> : !s32i loc(#loc10)
%2 = cir.binop(add, %0, %1) nsw : !s32i loc(#loc9)
cir.return loc(#loc7)
} loc(#loc12)
Metadata
Metadata
Assignees
Labels
No labels