Skip to content
Merged
Show file tree
Hide file tree
Changes from 66 commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
58a610b
Update GetRValueVariable comment
Apr 11, 2020
fb5f2b6
Fix ReplaceVariableHelper::TransformImplicitCastExpr to preserve impl…
Apr 11, 2020
2e54863
Clear G before checking a top-level CFG statement
Apr 11, 2020
62df1c7
Account for value-preserving casts when getting the original variable…
Apr 11, 2020
f87e9e2
Replace GetEqualExprSetContainingVariable with GetEqualExprSetContain…
Apr 11, 2020
c6b7527
Add RecordEqualityWithTarget method
Apr 12, 2020
729bc4b
Add target to G in RecordEqualityWithTarget
Apr 12, 2020
ed05ad9
Add initial EqualExprsContainsAllVars method
Apr 13, 2020
c62d669
Add GetRValueVariable call to EqualExprsContainsAllVars
Apr 13, 2020
4a08f34
Don't record equality with NullToPointer casts
Apr 17, 2020
a2eca86
Add value-preserving cast tests
Apr 17, 2020
2dba020
Allow equality with NullToPointer casts and add type compatibility ch…
Apr 25, 2020
2bc7be0
Revert "Allow equality with NullToPointer casts and add type compatib…
Apr 27, 2020
74f922f
Merge branch 'master' of https://github.com/Microsoft/checkedc-clang …
Apr 27, 2020
a21de03
Add type compatibility check (while not allowing NullToPointer casts …
Apr 28, 2020
dc8a382
Account for value-preserving operations in type compatibility check
May 1, 2020
b0eaf9f
Allow NullToPointer casts to be included in UEQ
May 1, 2020
554fd9b
Add test for type compatibility check in original value
May 1, 2020
e6b7e78
Merge branch 'master' of https://github.com/microsoft/checkedc-clang …
May 6, 2020
227ef68
Use the observed bounds as the rvalue bounds of an array pointer cast
May 7, 2020
3e95dc6
Update ObservedBounds in UpdateAfterAssignment
May 7, 2020
fb5fdd0
Set observed bounds for a variable to the updated source bounds
May 8, 2020
f935961
Merge branch 'master' of https://github.com/microsoft/checkedc-clang …
May 12, 2020
aaa2d67
Add test for assignment to a variable used in the RHS bounds
May 12, 2020
33ece55
Add tests for multiple assignments
May 13, 2020
87bc8d0
Merge branch 'master' of https://github.com/microsoft/checkedc-clang …
May 13, 2020
8e79c9a
Account for value-preserving operations in GetLValueVariable
May 13, 2020
882eab2
Account for nested assignment equality facts in assignments and initi…
May 14, 2020
4fe16e8
Return updated source bounds from UpdateAfterAssignment
May 14, 2020
4055cff
Use updated source bounds in CheckBinaryOperator
May 14, 2020
2743c63
Use updated result bounds for inc/dec operators
May 14, 2020
b802a39
Add tests for using updated result bounds
May 14, 2020
c2cea3e
Create an integer literal for inc/dec operators on non-integer pointers
May 15, 2020
23fa801
Check bounds at increment/decrement operators on variables
May 15, 2020
c2ed1c5
Merge branch 'master' of https://github.com/microsoft/checkedc-clang …
May 15, 2020
b3c1411
Pass Src to UpdateAfterAssignment instead of OriginalValue and Origin…
May 15, 2020
7b1ffc8
Fix VariableDecl declaration
May 15, 2020
ae1b9a4
Pass State.EquivExprs to CheckBoundsDeclAtCallArg
May 15, 2020
7291cc8
Merge branch 'master' of https://github.com/microsoft/checkedc-clang …
May 29, 2020
b2d9293
Shorten CheckBoundsDeclAtInitializer comment
Jun 3, 2020
e89867c
Call GetLValueVariable from GetRValueVariable
Jun 3, 2020
217750c
Fix test comments
Jun 3, 2020
3838939
Return target-dependent integer for pointers from CreateIntegerLiteral
Jun 3, 2020
19b045f
Add LostVariables, UnknownSrcBounds, and WidenedVariables to Checking…
Jun 10, 2020
7f862ef
Modify ResetKilledBounds and UpdateCtxWithWidenedBounds to update Che…
Jun 10, 2020
095f1d5
Add Reset method to CheckingState
Jun 10, 2020
73c674e
Update LostVariables and UnknownSrcBounds in UpdateAfterAssignment
Jun 10, 2020
77ab627
Update diagnostic messages to be used to validate bounds
Jun 10, 2020
635f4cd
Add ValidateBoundsContext, DiagnoseUnknownObservedBounds, and CheckOb…
Jun 10, 2020
64dca20
Only check bounds in CheckBinaryOperator for assignments to non-varia…
Jun 11, 2020
122e03b
Add CheckBounds parameter to CheckVarDecl for top-level VarDecls
Jun 11, 2020
6bb4c23
Remove CheckBoundsDeclAtIncrementDecrement
Jun 11, 2020
b62c7af
Modify tests to reflect new and updated diagnostic messages
Jun 11, 2020
66d7776
Modify tests to reflect errors caused by not recording target-source …
Jun 11, 2020
a1a03b0
Merge branch 'bounds-context-assignments' of https://github.com/micro…
Jun 11, 2020
a89125a
Add missing braces
Jun 12, 2020
cfc98a0
Merge branch 'master' of https://github.com/microsoft/checkedc-clang …
Jun 12, 2020
048117a
Merge branch 'master' of https://github.com/microsoft/checkedc-clang …
Jun 12, 2020
2998505
Merge branch 'bounds-context-assignments' of https://github.com/micro…
Jun 12, 2020
1308612
Merge branch 'master' of https://github.com/microsoft/checkedc-clang …
Jun 16, 2020
74e50ed
Merge branch 'bounds-context-assignments' of https://github.com/micro…
Jun 16, 2020
9108beb
Use Sema::NormalizeBounds to get declared bounds in ValidateBoundscon…
Jun 16, 2020
e7402a5
Record equality between target and source (#857)
kkjeer Jun 25, 2020
42cbbf5
Use equivalent expression sets to check memory accesses (#856)
kkjeer Jun 26, 2020
5dda1a6
Merge branch 'master' of https://github.com/microsoft/checkedc-clang …
Jun 30, 2020
821cee2
Add TODO comment with widened bounds issue 867
Jul 2, 2020
373cfc5
Update comments
Jul 7, 2020
29a8658
Add TODOs
Jul 7, 2020
8beae62
Move logic for non-variable assignments to one block
Jul 7, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions clang/include/clang/Basic/DiagnosticSemaKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -10164,17 +10164,20 @@ def err_bounds_type_annotation_lost_checking : Error<

def warn_bounds_declaration_invalid : Warning<
"cannot prove declared bounds for %1 are valid after "
"%select{assignment|initialization}0">,
"%select{assignment|initialization|statement}0">,
InGroup<CheckBoundsDeclsUnchecked>;

def warn_checked_scope_bounds_declaration_invalid : Warning<
"cannot prove declared bounds for %1 are valid after "
"%select{assignment|initialization}0">,
"%select{assignment|initialization|statement}0">,
InGroup<CheckBoundsDeclsChecked>;

def error_bounds_declaration_invalid : Error<
"declared bounds for %1 are invalid after "
"%select{assignment|initialization}0">;
"%select{assignment|initialization|statement}0">;

def err_unknown_inferred_bounds : Error<
"inferred bounds for %0 are unknown after statement">;

def note_declared_bounds : Note<
"(expanded) declared bounds are '%0'">;
Expand All @@ -10188,6 +10191,13 @@ def err_bounds_type_annotation_lost_checking : Error<
def note_required_bounds : Note<
"(expanded) required bounds are '%0'">;

def note_lost_variable : Note<
"lost the value of the variable '%0' "
"which is used in the (expanded) inferred bounds '%1' of %2">;

def note_unknown_source_bounds : Note<
"assigned expression '%0' with unknown bounds to %1">;

def err_modifying_expr_not_supported : Error<
"argument must be a non-modifying expression because %ordinal0 parameter "
"is used in a bounds expression">;
Expand Down
3 changes: 2 additions & 1 deletion clang/include/clang/Sema/Sema.h
Original file line number Diff line number Diff line change
Expand Up @@ -5186,7 +5186,8 @@ class Sema {

enum BoundsDeclarationCheck {
BDC_Assignment,
BDC_Initialization
BDC_Initialization,
BDC_Statement
};

/// \brief Check that address=of operation is not taking the
Expand Down
365 changes: 291 additions & 74 deletions clang/lib/Sema/SemaBounds.cpp

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions clang/test/CheckedC/inferred-bounds/basic.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ void f5(void) {
// CHECK: NullaryBoundsExpr {{0x[0-9a-f]+}} 'NULL TYPE' Any

void f6(_Array_ptr<int> a : bounds(a, a + 5)) {
a = (_Array_ptr<int>) 5; // expected-error {{expression has unknown bounds}}
a = (_Array_ptr<int>) 5; // expected-error {{inferred bounds for 'a' are unknown after statement}}
}

// CHECK: BinaryOperator {{0x[0-9a-f]+}} '_Array_ptr<int>' '='
Expand All @@ -150,7 +150,7 @@ void f6(_Array_ptr<int> a : bounds(a, a + 5)) {
// CHECK: NullaryBoundsExpr {{0x[0-9a-f]+}} 'NULL TYPE' Invalid

void f7(void) {
_Array_ptr<int> d : count(5) = (_Array_ptr<int>) 5; // expected-error {{expression has unknown bounds}}
_Array_ptr<int> d : count(5) = (_Array_ptr<int>) 5; // expected-error {{inferred bounds for 'd' are unknown after statement}}
}

// CHECK: VarDecl {{0x[0-9a-f]+}} {{.*}} d '_Array_ptr<int>' cinit
Expand Down Expand Up @@ -190,7 +190,7 @@ void f8(_Array_ptr<int> a, _Array_ptr<int> b : count(5)) {
// CHECK: `-IntegerLiteral {{0x[0-9a-f]+}} 'int' 5

void f9(int a) {
_Array_ptr<int> b : count(5) = (_Array_ptr<int>) !a; // expected-error {{expression has unknown bounds}}
_Array_ptr<int> b : count(5) = (_Array_ptr<int>) !a; // expected-error {{inferred bounds for 'b' are unknown after statement}}
}

// CHECK: VarDecl {{0x[0-9a-f]+}} {{.*}} b '_Array_ptr<int>' cinit
Expand All @@ -207,7 +207,7 @@ void f9(int a) {
// CHECK: NullaryBoundsExpr {{0x[0-9a-f]+}} 'NULL TYPE' Invalid

void f10(float a) {
_Array_ptr<int> b : count(5) = (_Array_ptr<int>)((int)a); // expected-error {{expression has unknown bounds}}
_Array_ptr<int> b : count(5) = (_Array_ptr<int>)((int)a); // expected-error {{inferred bounds for 'b' are unknown after statement}}
}

// CHECK: VarDecl {{0x[0-9a-f]+}} {{.*}} b '_Array_ptr<int>' cinit
Expand Down Expand Up @@ -260,7 +260,7 @@ void f20(_Array_ptr<int> a : count(len),

void f21(_Array_ptr<int> a : count(5),
_Array_ptr<int> b) {
a = b; // expected-error {{expression has unknown bounds}}
a = b; // expected-error {{inferred bounds for 'a' are unknown after statement}}
}

// CHECK: BinaryOperator {{0x[0-9a-f]+}} '_Array_ptr<int>' '='
Expand All @@ -280,7 +280,7 @@ void f21(_Array_ptr<int> a : count(5),

// Only test declarations for the negative case (where an error is expected}
void f22(_Array_ptr<int> b) {
_Array_ptr<int> a : count(5) = b; // expected-error {{expression has unknown bounds}}
_Array_ptr<int> a : count(5) = b; // expected-error {{inferred bounds for 'a' are unknown after statement}}
}

// CHECK: VarDecl {{0x[0-9a-f]+}} {{.*}} a '_Array_ptr<int>' cinit
Expand Down
364 changes: 175 additions & 189 deletions clang/test/CheckedC/inferred-bounds/bounds-context.c

Large diffs are not rendered by default.

18 changes: 12 additions & 6 deletions clang/test/CheckedC/inferred-bounds/calls.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ void f10(_Array_ptr<int> a, _Array_ptr<int> b) {
void f11(_Array_ptr<int> a, _Array_ptr<int> b) {
_Array_ptr<int> c : bounds(a, a+1) = f_bounds(b++, a); // \
// expected-error {{expression not allowed in argument for parameter used in function return bounds}} \
// expected-error {{initializer expected to have bounds}}
// expected-error {{inferred bounds for 'c' are unknown after statement}} \
// expected-note {{(expanded) declared bounds are 'bounds(a, a + 1)'}}
}

// CHECK: VarDecl {{0x[0-9a-f]+}} {{.*}} c '_Array_ptr<int>' cinit
Expand Down Expand Up @@ -230,7 +231,8 @@ void f12(int i, int j) {
void f13(int i, int j) {
_Array_ptr<int> b : count(i) = f_count(j++, i); // \
// expected-error {{expression not allowed in argument for parameter used in function return bounds}} \
// expected-error {{initializer expected to have bounds}}
// expected-error {{inferred bounds for 'b' are unknown after statement}} \
// expected-note {{(expanded) declared bounds are 'bounds(b, b + i)'}}
}

// CHECK: VarDecl {{0x[0-9a-f]+}} {{.*}} b '_Array_ptr<int>' cinit
Expand Down Expand Up @@ -284,7 +286,8 @@ void f14(int i, int j) {
void f15(int i, int j) {
_Array_ptr<int> b : byte_count(i) = f_byte(j++, i); // \
// expected-error {{expression not allowed in argument for parameter used in function return bounds}} \
// expected-error {{initializer expected to have bounds}}
// expected-error {{inferred bounds for 'b' are unknown after statement}} \
// expected-note {{(expanded) declared bounds are 'bounds((_Array_ptr<char>)b, (_Array_ptr<char>)b + i)'}}
}

// CHECK: VarDecl {{0x[0-9a-f]+}} {{.*}} b '_Array_ptr<int>' cinit
Expand Down Expand Up @@ -347,7 +350,8 @@ void f20(int* a, int* b) {
void f21(int* a, int* b) {
_Array_ptr<int> c : bounds(a, a+1) = f_boundsi(b++, a); // \
// expected-error {{expression not allowed in argument for parameter used in function return bounds}} \
// expected-error {{initializer expected to have bounds}}
// expected-error {{inferred bounds for 'c' are unknown after statement}} \
// expected-note {{(expanded) declared bounds are 'bounds(a, a + 1)'}}
}

// CHECK: VarDecl {{0x[0-9a-f]+}} {{.*}} c '_Array_ptr<int>' cinit
Expand Down Expand Up @@ -409,7 +413,8 @@ void f22(int i, int j) {
void f23(int i, int j) {
_Array_ptr<int> b : count(i) = f_counti(j++, i); // \
// expected-error {{expression not allowed in argument for parameter used in function return bounds}} \
// expected-error {{initializer expected to have bounds}}
// expected-error {{inferred bounds for 'b' are unknown after statement}} \
// expected-note {{(expanded) declared bounds are 'bounds(b, b + i)'}}
}

// CHECK: VarDecl {{0x[0-9a-f]+}} {{.*}} b '_Array_ptr<int>' cinit
Expand Down Expand Up @@ -465,7 +470,8 @@ void f24(int i, int j) {
void f25(int i, int j) {
_Array_ptr<int> b : byte_count(i) = f_bytei(j++, i); // \
// expected-error {{expression not allowed in argument for parameter used in function return bounds}} \
// expected-error {{initializer expected to have bounds}}
// expected-error {{inferred bounds for 'b' are unknown after statement}} \
// expected-note {{(expanded) declared bounds are 'bounds((_Array_ptr<char>)b, (_Array_ptr<char>)b + i)'}}
}

// CHECK: VarDecl {{0x[0-9a-f]+}} {{.*}} b '_Array_ptr<int>' cinit
Expand Down
2 changes: 1 addition & 1 deletion clang/test/CheckedC/inferred-bounds/widened-bounds-check.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ void f1() {
{}

if (*p) {
p++; // expected-error {{declared bounds for p are invalid after assignment}}
p++; // expected-error {{declared bounds for 'p' are invalid after statement}}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you file an issue about this? This is an existing issue that is unrelated to your PR.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create issue #872 to track this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the statement p++, p no longer has widened bounds (the modification of p kills the widened bounds of p).

p has the original value p - 1. At the end of the statement p++, the updated observed bounds of p are bounds(p - 1, p - 1). These bounds do not imply the declared bounds (p, p).

if (*(p + 1)) // expected-error {{out-of-bounds memory access}}
{}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Tests for bounds widening for K&R string related functions.
//
// RUN: %clang_cc1 -fdump-widened-bounds -verify -verify-ignore-unexpected=note -verify-ignore-unexpected=warning %s 2>&1 | FileCheck %s

// expected-no-diagnostics
// RUN: %clang_cc1 -fdump-widened-bounds -verify -verify-ignore-unexpected=note -verify-ignore-unexpected=warning %s | FileCheck %s

// Return length of p (adapted from p. 39, K&R 2nd Edition).
// p implicitly has count(0).
Expand All @@ -14,7 +12,7 @@ int my_strlen(_Nt_array_ptr<char> p) {
// s[i] implies that the count can increase
// by 1.
while (s[i])
++i;
++i; // expected-error {{inferred bounds for 's' are unknown after statement}}
return i;

// CHECK: In function: my_strlen
Expand All @@ -30,7 +28,8 @@ void squeeze(_Nt_array_ptr<char> p, char c) {
// Create a temporary whose count of elements can
// change.
_Nt_array_ptr<char> s : count(i) = p;
for ( ; s[i]; i++) {
for ( ; s[i]; i++) { // expected-error {{inferred bounds for 's' are unknown after statement}} \
// expected-error {{inferred bounds for 'tmp' are unknown after statement}}
// We will widen the bounds of s so that we
// can assign to s[j] when j == i.
_Nt_array_ptr<char> tmp : count(i + 1) = s;
Expand Down Expand Up @@ -63,7 +62,7 @@ void reverse(_Nt_array_ptr<char> p) {
int len = 0;
// Calculate the length of the string.
_Nt_array_ptr<char> s : count(len) = p;
for (; s[len]; len++);
for (; s[len]; len++); // expected-error {{inferred bounds for 's' are unknown after statement}}

// Now that we know the length, use s just like we would use an array_ptr.
for (int i = 0, j = len - 1; i < j; i++, j--) {
Expand Down
12 changes: 6 additions & 6 deletions clang/test/CheckedC/inferred-bounds/widened-bounds.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Tests for datafow analysis for bounds widening of _Nt_array_ptr's.
//
// RUN: %clang_cc1 -fdump-widened-bounds -verify -verify-ignore-unexpected=note -verify-ignore-unexpected=warning %s 2>&1 | FileCheck %s
// RUN: %clang_cc1 -fdump-widened-bounds -verify -verify-ignore-unexpected=note -verify-ignore-unexpected=warning %s | FileCheck %s

#include <limits.h>
#include <stdint.h>
Expand Down Expand Up @@ -105,7 +105,7 @@ void f6(int i) {
char p _Nt_checked[] : bounds(p + i, p) = "abc";

if (p[0]) {
i = 0;
i = 0; // expected-error {{inferred bounds for 'p' are unknown after statement}}
if (p[1]) {}
}

Expand Down Expand Up @@ -212,7 +212,7 @@ void f11(int i, int j) {
_Nt_array_ptr<char> p : bounds(p + i, p + j) = "a";

if (*(p + j)) {
i = 0;
i = 0; // expected-error {{inferred bounds for 'p' are unknown after statement}}
if (*(p + j + 1)) {}
}

Expand All @@ -227,7 +227,7 @@ void f11(int i, int j) {
// CHECK-NOT: upper_bound(p)

if (*(p + j)) {
j = 0;
j = 0; // expected-error {{inferred bounds for 'p' are unknown after statement}}
if (*(p + j + 1)) {}
}

Expand Down Expand Up @@ -470,7 +470,7 @@ void f19() {

void f20() {
// Declared bounds and deref offset are both INT_MAX. Valid widening.
_Nt_array_ptr<char> p : count(INT_MAX) = ""; // expected-error {{declared bounds for 'p' are invalid after initialization}}
_Nt_array_ptr<char> p : count(INT_MAX) = ""; // expected-error {{declared bounds for 'p' are invalid after statement}}
if (*(p + INT_MAX))
{}

Expand Down Expand Up @@ -526,7 +526,7 @@ void f20() {
// CHECK: upper_bound(t) = 1

// Declared bounds and deref offset are both (INT_MIN + -1). Integer underflow. No widening.
_Nt_array_ptr<char> u : count(INT_MIN + -1) = ""; // expected-error {{declared bounds for 'u' are invalid after initialization}}
_Nt_array_ptr<char> u : count(INT_MIN + -1) = ""; // expected-error {{declared bounds for 'u' are invalid after statement}}
if (*(u + INT_MIN + -1))
{}

Expand Down
6 changes: 3 additions & 3 deletions clang/test/CheckedC/static-checking/bounds-decl-challenges.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ extern void check_assign(int val, int p[10], int q[], int r _Checked[10], int s
int s2d _Checked[10][10], int v _Nt_checked[10], int w _Nt_checked[],
int w2d _Checked[10]_Nt_checked[10]) {
int x2d _Checked[10]_Nt_checked[10];
_Nt_array_ptr<int> t13b = w2d[0]; // expected-warning {{cannot prove declared bounds for 't13b' are valid after initialization}}
_Nt_array_ptr<int> t15b = x2d[0]; // expected-warning {{cannot prove declared bounds for 't15b' are valid after initialization}}
_Nt_array_ptr<int> t13b = w2d[0]; // expected-warning {{cannot prove declared bounds for 't13b' are valid after statement}}
_Nt_array_ptr<int> t15b = x2d[0]; // expected-warning {{cannot prove declared bounds for 't15b' are valid after statement}}
}

// Creating a pointer with count bounds into an existing array.
void passing_test_1(void) {
int a _Checked[10] = { 9, 8, 7, 6, 5, 4, 3, 2, 1};
_Array_ptr<int> b : count(5) = &a[2]; // expected-warning {{cannot prove declared bounds for 'b' are valid after initialization}}
_Array_ptr<int> b : count(5) = &a[2]; // expected-warning {{cannot prove declared bounds for 'b' are valid after statement}}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ _Array_ptr<int> f11(unsigned num) {
}

_Array_ptr<int> f12(unsigned num1, unsigned num2){
_Array_ptr<int> p : count(num1) = test_f10(num2); // expected-warning {{cannot prove declared bounds for 'p' are valid after initialization}} \
_Array_ptr<int> p : count(num1) = test_f10(num2); // expected-warning {{cannot prove declared bounds for 'p' are valid after statement}} \
// expected-note {{(expanded) declared bounds are 'bounds(p, p + num1)'}} \
// expected-note {{(expanded) inferred bounds are 'bounds(value of test_f10(num2), value of test_f10(num2) + num2)'}}
return p;
Expand All @@ -64,7 +64,7 @@ _Array_ptr<int> f14(unsigned num) {
}

_Array_ptr<int> f15(unsigned num1, unsigned num2){
_Array_ptr<int> p : byte_count(num1) = test_f13(num2); // expected-warning {{cannot prove declared bounds for 'p' are valid after initialization}} \
_Array_ptr<int> p : byte_count(num1) = test_f13(num2); // expected-warning {{cannot prove declared bounds for 'p' are valid after statement}} \
// expected-note {{(expanded) declared bounds are 'bounds((_Array_ptr<char>)p, (_Array_ptr<char>)p + num1)'}} \
// expected-note {{inferred bounds are 'bounds((_Array_ptr<char>)value of test_f13(num2), (_Array_ptr<char>)value of test_f13(num2) + num2)'}}
return p;
Expand All @@ -78,7 +78,7 @@ _Array_ptr<int> f17(unsigned num) {
}

_Array_ptr<int> f18(unsigned num) {
_Array_ptr<int> p : count(2) = test_f16(num); // expected-error {{declared bounds for 'p' are invalid after initialization}} \
_Array_ptr<int> p : count(2) = test_f16(num); // expected-error {{declared bounds for 'p' are invalid after statement}} \
// expected-note {{destination bounds are wider than the source bounds}} \
// expected-note {{destination upper bound is above source upper bound}} \
// expected-note {{(expanded) declared bounds are 'bounds(p, p + 2)'}} \
Expand Down
Loading