Skip to content

Commit 57d31d2

Browse files
john-h-kastnermattmccutchen-cci
authored andcommitted
Change test7 in functionDeclEnd.c to infer a valid bound
The purpose of this function was to test function declaration rewriting for itype array pointers declared with bounds but without an explicit itype. This is equally well tested when a correct bound is inferred for the parameter array. (Matt: Remove the XFAIL now that the test is fixed.)
1 parent 7600025 commit 57d31d2

1 file changed

Lines changed: 4 additions & 12 deletions

File tree

clang/test/3C/functionDeclEnd.c

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,6 @@
44
// RUN: 3c -base-dir=%S -addcr -alltypes %s -- | %clang -c -fcheckedc-extension -x c -o /dev/null -
55
// RUN: 3c -base-dir=%S -alltypes -output-dir=%t.checked %s --
66
// RUN: 3c -base-dir=%t.checked -alltypes %t.checked/functionDeclEnd.c -- | diff %t.checked/functionDeclEnd.c -
7-
// XFAIL: *
8-
9-
// TODO: checkedc-clang issue 1147. This test fails due to the compiler
10-
// checking that the inferred bounds for the return value of a function
11-
// imply the declared bounds for the function. The following functions in
12-
// this test file return expressions with unknown bounds, which do not imply
13-
// the function's declared bounds:
14-
// 1. test3 (in unchecked scope - no error)
15-
// 2. test7 (in checked scope - this result in a compiler error)
16-
// 3. test8 (in unchecked scope - no error)
177

188
// Tests for issue 392. When rewriting function prototypes sometimes code
199
// falling between the start of the definition and the end of the prototype
@@ -136,7 +126,7 @@ void test6(int *a)
136126
int *test7(int *a)
137127
: count(10)
138128
//CHECK_NOALL: int *test7(int *a : itype(_Ptr<int>)) : count(10)
139-
//CHECK_ALL: _Array_ptr<int> test7(_Array_ptr<int> a) : count(10)
129+
//CHECK_ALL: _Array_ptr<int> test7(_Array_ptr<int> a : count(10)) : count(10)
140130
#else
141131
int *test7(int *a)
142132
: count(10)
@@ -149,8 +139,10 @@ int *test7(int *a)
149139
//CHECK: ;
150140

151141
int *test7(int *a) : count(10) {
152-
//CHECK_ALL: _Array_ptr<int> test7(_Array_ptr<int> a) : count(10) _Checked {
142+
//CHECK_ALL: _Array_ptr<int> test7(_Array_ptr<int> a : count(10)) : count(10) _Checked {
153143
//CHECK_NOALL: int *test7(int *a : itype(_Ptr<int>)) : count(10) {
144+
for (int i = 0; i < 10; i++)
145+
a[i];
154146
return a;
155147
}
156148

0 commit comments

Comments
 (0)