File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -242,9 +242,8 @@ ABounds *AvarBoundsInference::getPreferredBound(BoundsKey BK) {
242
242
if (NeedsBasePointer && BI->LowerBounds .find (BK) != BI->LowerBounds .end ())
243
243
BaseVar = BI->LowerBounds [BK];
244
244
245
- if (NeedsBasePointer && BaseVar == 0 )
246
- llvm::errs () << " Lower bound pointer required for " << BK
247
- << " but not available.\n " ;
245
+ assert (" Lower bound required but not available." &&
246
+ (!NeedsBasePointer || BaseVar != 0 ));
248
247
249
248
const auto &BKindMap = CurrIterInferBounds[BK];
250
249
// Utility to check if the map contains a non-empty set of bounds for a
Original file line number Diff line number Diff line change @@ -187,3 +187,17 @@ void foo_caller(unsigned long l) {
187
187
// expected-note@-2 {{}}
188
188
// expected-note@-3 {{}}
189
189
}
190
+
191
+
192
+ // Lower bound inference for `b` fails because `a` is out of scope. If `a` were
193
+ // in scope, it would be used as a lower bound.
194
+ void bar (int * b ) {
195
+ // CHECK_ALL: void bar(_Array_ptr<int> __3c_tmp_b : count(0 + 1)) _Checked {
196
+ // CHECK_ALL: _Array_ptr<int> b : bounds(__3c_tmp_b, __3c_tmp_b + 0 + 1) = __3c_tmp_b;
197
+ int * a ;
198
+ // CHECK_ALL: _Array_ptr<int> a : count(0 + 1) = ((void *)0);
199
+ b = a ;
200
+ // CHECK_ALL: __3c_tmp_b = a, b = __3c_tmp_b;
201
+ b ++ ;
202
+ b [0 ];
203
+ }
You can’t perform that action at this time.
0 commit comments