Skip to content

Commit 26ca00e

Browse files
thesamesampinskia
andcommitted
testsuite: torture: add LLVM testcase for DSE vs. -ftrivial-auto-var-init=
This testcase came up in a recent LLVM bug report [0] for DSE vs -ftrivial-auto-var-init=. Add it to our testsuite given that area could do with better coverage. [0] llvm/llvm-project#119646 gcc/testsuite/ChangeLog: * gcc.dg/torture/dse-trivial-auto-var-init.c: New test. Co-authored-by: Andrew Pinski <[email protected]>
1 parent c7754a2 commit 26ca00e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/* Testcase for LLVM bug: https://github.com/llvm/llvm-project/issues/119646 */
2+
/* { dg-do run } */
3+
/* { dg-additional-options "-ftrivial-auto-var-init=zero" } */
4+
5+
int b = 208;
6+
[[gnu::noinline]]
7+
void f(int *e, int a) {
8+
*e = !!b;
9+
if (a)
10+
__builtin_trap();
11+
}
12+
int main(void) {
13+
b = 0;
14+
f(&b, 0);
15+
if (b != 0)
16+
__builtin_trap();
17+
}

0 commit comments

Comments
 (0)