From 7b20477f326878c82265424794d5c56db4aceecb Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Fri, 22 May 2020 13:53:53 -0400 Subject: [PATCH 178/315] FIXME: add (failing) symbolic-5.c --- gcc/testsuite/gcc.dg/analyzer/symbolic-5.c | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/analyzer/symbolic-5.c diff --git a/gcc/testsuite/gcc.dg/analyzer/symbolic-5.c b/gcc/testsuite/gcc.dg/analyzer/symbolic-5.c new file mode 100644 index 00000000000..9bfe7a602f9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/symbolic-5.c @@ -0,0 +1,29 @@ +#include "analyzer-decls.h" + +int a[1024]; +int b[1024]; + +extern void escape (void *ptr); + +void test_1 (int *p) +{ + int c, d; + escape (&c); + a[16] = 42; + b[16] = 17; + c = 33; + d = 44; + __analyzer_eval (a[16] == 42); /* { dg-warning "TRUE" } */ + __analyzer_eval (b[16] == 17); /* { dg-warning "TRUE" } */ + __analyzer_eval (c == 33); /* { dg-warning "TRUE" } */ + __analyzer_eval (d == 44); /* { dg-warning "TRUE" } */ + + /* Write through an externally-provided pointer. */ + *p = 100; + /* It could clobber our writes to the global arrays and escaped locals... */ + __analyzer_eval (a[16] == 42); /* { dg-warning "UNKNOWN" } */ + __analyzer_eval (b[16] == 17); /* { dg-warning "UNKNOWN" } */ + __analyzer_eval (c == 33); /* { dg-warning "UNKNOWN" } */ + /* ...but can't clobber locals that haven't escaped. */ + __analyzer_eval (d == 44); /* { dg-warning "TRUE" } */ +} -- 2.26.2