crash-invalid-array.c 916 B

12345678910111213141516171819202122
  1. // RUN: %clang_cc1 -triple=x86_64-apple-darwin -fsyntax-only -verify %s
  2. // PR6913
  3. int main()
  4. {
  5. int x[10][10];
  6. int (*p)[] = x;
  7. int i;
  8. for(i = 0; i < 10; ++i)
  9. {
  10. p[i][i] = i; // expected-error {{subscript of pointer to incomplete type 'int []'}}
  11. }
  12. }
  13. // rdar://13705391
  14. void foo(int a[*][2]) {(void)a[0][1]; } // expected-error {{variable length array must be bound in function definition}}
  15. void foo1(int a[2][*]) {(void)a[0][1]; } // expected-error {{variable length array must be bound in function definition}}
  16. void foo2(int a[*][*]) {(void)a[0][1]; } // expected-error {{variable length array must be bound in function definition}}
  17. void foo3(int a[2][*][2]) {(void)a[0][1][1]; } // expected-error {{variable length array must be bound in function definition}}
  18. void foo4(int a[2][*][*]) {(void)a[0][1][1]; } // expected-error {{variable length array must be bound in function definition}}