llvm-project/clang/test/Sema/array-bounds-zero-length-elem-gh64564.c
dingfei 0f73a2406a [clang][Sema] Skip access check on arrays of zero-length element
Bound check on array of zero-sized element isn't meaningful.

Fixes https://github.com/llvm/llvm-project/issues/64564

Reviewed By: jacquesguan

Differential Revision: https://reviews.llvm.org/D157584
2023-08-11 22:05:04 +08:00

13 lines
359 B
C

// RUN: %clang_cc1 -triple i686-apple-darwin -verify %s
int a[][0]; // expected-warning {{tentative array definition assumed to have one element}}
void gh64564_1(void) {
int b = a[0x100000000][0];
}
typedef struct {} S;
S s[]; // expected-warning {{tentative array definition assumed to have one element}}
void gh64564_2(void) {
S t = s[0x100000000];
}