Skip to content

Commit

Permalink
[clang][Interp][NFC] Add a broken test case
Browse files Browse the repository at this point in the history
The LHS of the subtraction returns 16 right now, but should
return 0.
  • Loading branch information
tbaederr committed Feb 2, 2024
1 parent 65ac8c1 commit a8b5994
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions clang/test/AST/Interp/c.c
Original file line number Diff line number Diff line change
Expand Up @@ -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}}

5 comments on commit a8b5994

@antmox
Copy link
Contributor

@antmox antmox commented on a8b5994 Feb 2, 2024

Choose a reason for hiding this comment

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

Hi @tbaederr,
Looks like this broke a bot : https://lab.llvm.org/buildbot/#/builders/245/builds/20020
Could you please look at this ?

@tbaederr
Copy link
Contributor Author

Choose a reason for hiding this comment

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

That should be fixed by 73e5466 already

@antmox
Copy link
Contributor

@antmox antmox commented on a8b5994 Feb 2, 2024

Choose a reason for hiding this comment

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

looks like it is still broken aven after the fix : https://lab.llvm.org/buildbot/#/builders/245/builds/20024

@tbaederr
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Dang, sorry about that. Another try: 1f4a5d8

@antmox
Copy link
Contributor

@antmox antmox commented on a8b5994 Feb 2, 2024

Choose a reason for hiding this comment

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

Still running but looks OK, thanks : )
https://lab.llvm.org/buildbot/#/builders/245/builds/20040
PASS: Clang :: AST/Interp/c.c (1 of 77008)

Please sign in to comment.