On some VxWorks targets, stderr is #defined to a function call, and
this confuses the analyzer in test_1, so we skip the warning.  That
appears to reveal a bug in the analyzer, but it doesn't seem to be
what the test was meant to test, so I'm dropping this unintended
feature from this testcase and filing PR124672 with a testcase to
reproduce it elsewhere.

Regstrapped on x86_64-linux-gnu.  Also tested with ppc-vx7r2,
ppc64-vx7r2, arm-vx7r2, aarch64-vx7r2, x86_64-vx7r2, and x86-vx7r2.  Ok
to install?


for  gcc/testsuite/ChangeLog

        * c-c++-common/analyzer/deref-before-check-2.c (test_1):
        Drop stderr.
---
 .../c-c++-common/analyzer/deref-before-check-2.c   |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/testsuite/c-c++-common/analyzer/deref-before-check-2.c 
b/gcc/testsuite/c-c++-common/analyzer/deref-before-check-2.c
index c0409c42d8982..981635af72799 100644
--- a/gcc/testsuite/c-c++-common/analyzer/deref-before-check-2.c
+++ b/gcc/testsuite/c-c++-common/analyzer/deref-before-check-2.c
@@ -8,7 +8,7 @@ struct st
 
 int test_1 (struct st *p)
 {
-  fprintf (stderr, "str: %s\n", p->str); /* { dg-message "pointer 'p' is 
dereferenced here" } */
+  printf ("str: %s\n", p->str); /* { dg-message "pointer 'p' is dereferenced 
here" } */
   if (!p) /* { dg-warning "check of 'p' for NULL after already dereferencing 
it" } */
     return -1;
   return p->i;  


-- 
Alexandre Oliva, happy hacker            https://blog.lx.oliva.nom.br/
Free Software Activist     FSFLA co-founder     GNU Toolchain Engineer
More tolerance and less prejudice are key for inclusion and diversity.
Excluding neuro-others for not behaving ""normal"" is *not* inclusive!

Reply via email to