File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -745,7 +745,7 @@ void CodeGenFunction::EmitAttributedStmt(const AttributedStmt &S) {
745
745
} break ;
746
746
case attr::CXXAssume: {
747
747
const Expr *Assumption = cast<CXXAssumeAttr>(A)->getAssumption ();
748
- if (getLangOpts ().CXXAssumptions &&
748
+ if (getLangOpts ().CXXAssumptions && Builder. GetInsertBlock () &&
749
749
!Assumption->HasSideEffects (getContext ())) {
750
750
llvm::Value *AssumptionVal = EvaluateExprAsBool (Assumption);
751
751
Builder.CreateAssumption (AssumptionVal);
Original file line number Diff line number Diff line change @@ -158,3 +158,12 @@ foo (int x, int y)
158
158
return x + y;
159
159
}
160
160
}
161
+
162
+ // Do not crash when assumptions are unreachable.
163
+ namespace gh106898 {
164
+ int foo () {
165
+ while (1 );
166
+ int a = 0 , b = 1 ;
167
+ __attribute__ ((assume (a < b)));
168
+ }
169
+ }
You can’t perform that action at this time.
0 commit comments