diff options
author | Sam James <sam@gentoo.org> | 2024-12-13 04:42:29 +0000 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2025-01-03 16:49:44 +0000 |
commit | 26ca00eeedb01f9d5102586b76ae2a6e787111af (patch) | |
tree | 3a9e79fc7cfa7c4704a5ccc61c8322eb4802638f /gcc | |
parent | c7754a2fb2e60987524947fe189f3ffac035ea1d (diff) | |
download | gcc-26ca00eeedb01f9d5102586b76ae2a6e787111af.zip gcc-26ca00eeedb01f9d5102586b76ae2a6e787111af.tar.gz gcc-26ca00eeedb01f9d5102586b76ae2a6e787111af.tar.bz2 |
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] https://github.com/llvm/llvm-project/issues/119646
gcc/testsuite/ChangeLog:
* gcc.dg/torture/dse-trivial-auto-var-init.c: New test.
Co-authored-by: Andrew Pinski <pinskia@gmail.com>
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/dse-trivial-auto-var-init.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/torture/dse-trivial-auto-var-init.c b/gcc/testsuite/gcc.dg/torture/dse-trivial-auto-var-init.c new file mode 100644 index 0000000..5a3d4c4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/dse-trivial-auto-var-init.c @@ -0,0 +1,17 @@ +/* Testcase for LLVM bug: https://github.com/llvm/llvm-project/issues/119646 */ +/* { dg-do run } */ +/* { dg-additional-options "-ftrivial-auto-var-init=zero" } */ + +int b = 208; +[[gnu::noinline]] +void f(int *e, int a) { + *e = !!b; + if (a) + __builtin_trap(); +} +int main(void) { + b = 0; + f(&b, 0); + if (b != 0) + __builtin_trap(); +} |