Author: Timm Bäder Date: 2024-02-02T09:10:03+01:00 New Revision: a8b5994b337cf1d461202a65204a4ee6c5eae341
URL: https://github.com/llvm/llvm-project/commit/a8b5994b337cf1d461202a65204a4ee6c5eae341 DIFF: https://github.com/llvm/llvm-project/commit/a8b5994b337cf1d461202a65204a4ee6c5eae341.diff LOG: [clang][Interp][NFC] Add a broken test case The LHS of the subtraction returns 16 right now, but should return 0. Added: Modified: clang/test/AST/Interp/c.c Removed: ################################################################################ diff --git a/clang/test/AST/Interp/c.c b/clang/test/AST/Interp/c.c index bf5394b701587..0b673253c6c70 100644 --- a/clang/test/AST/Interp/c.c +++ b/clang/test/AST/Interp/c.c @@ -110,3 +110,23 @@ int somefunc(int i) { // pedantic-ref-warning {{overflow in expression; result is 131073}} } + +/// FIXME: The following test is incorrect in the new interpreter. +/// The null pointer returns 16 from its getIntegerRepresentation(). +struct ArrayStruct { + char n[1]; +}; +struct AA { + char name2[(int)&((struct ArrayStruct*)0)->n - 1]; // expected-warning {{cast to smaller integer type}} \ + // expected-warning {{folded to constant array}} \ + // pedantic-expected-warning {{cast to smaller integer type}} \ + // pedantic-expected-warning {{folded to constant array}} \ + // ref-error {{array size is negative}} \ + // ref-warning {{cast to smaller integer type}} \ + // pedantic-ref-error {{array size is negative}} \ + // pedantic-ref-warning {{cast to smaller integer type}} +}; +_Static_assert(sizeof(struct AA) == 15, ""); // ref-error {{failed}} \ + // ref-note {{1 == 15}} \ + // pedantic-ref-error {{failed}} \ + // pedantic-ref-note {{1 == 15}} _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits