diff options
author | Jerry DeLisle <jvdelisle@gcc.gnu.org> | 2025-09-02 15:58:26 -0700 |
---|---|---|
committer | Jerry DeLisle <jvdelisle@gcc.gnu.org> | 2025-09-02 15:58:26 -0700 |
commit | 071b4126c613881f4cb25b4e5c39032964827f88 (patch) | |
tree | 7ed805786566918630d1d617b1ed8f7310f5fd8e /gcc/testsuite/gcc.dg/pr109071_6.c | |
parent | 845d23f3ea08ba873197c275a8857eee7edad996 (diff) | |
parent | caa1c2f42691d68af4d894a5c3e700ecd2dba080 (diff) | |
download | gcc-devel/gfortran-test.zip gcc-devel/gfortran-test.tar.gz gcc-devel/gfortran-test.tar.bz2 |
Merge branch 'master' into gfortran-testdevel/gfortran-test
Diffstat (limited to 'gcc/testsuite/gcc.dg/pr109071_6.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/pr109071_6.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/pr109071_6.c b/gcc/testsuite/gcc.dg/pr109071_6.c new file mode 100644 index 0000000..eddf15b --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr109071_6.c @@ -0,0 +1,49 @@ +/* PR tree-optimization/109071 need more context for -Warray-bounds warnings + due to code duplication from jump threading. + test case is from PR117179, which is a duplication of PR109071. */ +/* { dg-options "-O2 -Warray-bounds -fdiagnostics-show-context=1" } */ +/* { dg-additional-options "-fdiagnostics-show-line-numbers -fdiagnostics-path-format=inline-events -fdiagnostics-show-caret" } */ +/* { dg-enable-nn-line-numbers "" } */ +const char* commands[] = {"a", "b"}; + +int setval_internal(int comind) +{ + if (comind > sizeof(commands)/sizeof(commands[0])) { + return 0; + } + + return 1; +} + +_Bool setval_internal_tilde(int comind, const char *com, + const char *val) +{ + int ret = setval_internal(comind); + if (commands[comind] == "b" && /* { dg-warning "is outside array bounds of" } */ + + ret) + return 1; + return 0; +} +/* { dg-begin-multiline-output "" } + NN | if (commands[comind] == "b" && + | ~~~~~~~~^~~~~~~~ + 'setval_internal_tilde': events 1-2 + NN | if (comind > sizeof(commands)/sizeof(commands[0])) { + | ^ + | | + | (1) when the condition is evaluated to true +...... + { dg-end-multiline-output "" } */ + +/* { dg-begin-multiline-output "" } + NN | if (commands[comind] == "b" && + | ~~~~~~~~~~~~~~~~ + | | + | (2) warning happens here + { dg-end-multiline-output "" } */ + +/* { dg-begin-multiline-output "" } + NN | const char* commands[] = {"a", "b"}; + | ^~~~~~~~ + { dg-end-multiline-output "" } */ |