From 02b3c4f719d2df912ce583abc539fcf43b071d53 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Fri, 15 May 2020 09:33:30 -0400 Subject: [PATCH 135/315] FIXME: another cast case --- gcc/testsuite/gcc.dg/analyzer/casts-1.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/gcc/testsuite/gcc.dg/analyzer/casts-1.c b/gcc/testsuite/gcc.dg/analyzer/casts-1.c index 39a0bb1fd06..fbcb7a84b64 100644 --- a/gcc/testsuite/gcc.dg/analyzer/casts-1.c +++ b/gcc/testsuite/gcc.dg/analyzer/casts-1.c @@ -37,4 +37,18 @@ void test_2 () __analyzer_eval (x.arr[1] == 'B'); /* { dg-warning "TRUE" } */ __analyzer_eval (x.arr[2] == 'C'); /* { dg-warning "TRUE" } */ __analyzer_eval (x.arr[3] == 'D'); /* { dg-warning "TRUE" } */ + struct s1 *p = (struct s1 *)&x; + __analyzer_eval (p->a == 'A'); /* { dg-warning "TRUE" } */ + __analyzer_eval (p->b == 'B'); /* { dg-warning "TRUE" } */ + __analyzer_eval (p->c == 'C'); /* { dg-warning "TRUE" } */ + __analyzer_eval (p->d == 'D'); /* { dg-warning "TRUE" } */ + /* FIXME: the above fails ("UNKNOWN"); get_store_value gets STRING_CST + from the default binding for x and makes a sub_svalue2 for the field + access, but the child_region is: + field_region2(offset_region2(decl_region2(frame_region2(‘test_2’, index: 0, depth: 1), + ‘struct s2’, ‘x’), + ‘struct s1’, + constant_svalue2(‘struct s1 *’, 0B)), + ‘char’, ‘a’) + which we don't handle. */ } -- 2.26.2