gcc/analyzer/ChangeLog:
PR analyzer/98628
* store.cc (binding_cluster::make_unknown_relative_to): Don't mark
dereferenced unknown pointers as having escaped.
gcc/testsuite/ChangeLog:
PR analyzer/98628
* gcc.dg/analyzer/pr98628.c: New test.
{
const region *base_reg
= region_sval->get_pointee ()->get_base_region ();
- binding_cluster *c = out_store->get_or_create_cluster (base_reg);
- c->mark_as_escaped ();
+ if (!base_reg->symbolic_for_unknown_ptr_p ())
+ {
+ binding_cluster *c = out_store->get_or_create_cluster (base_reg);
+ c->mark_as_escaped ();
+ }
}
}
}
--- /dev/null
+/* { dg-additional-options "-O1" } */
+
+void foo(void *);
+struct chanset_t help_subst_chan;
+struct chanset_t *help_subst_chan_0_0;
+struct chanset_t {
+ struct chanset_t *next;
+ char dname[];
+};
+void help_subst() {
+ char *writeidx;
+ for (;; help_subst_chan = *help_subst_chan_0_0) {
+ foo(help_subst_chan.next->dname);
+ if (help_subst_chan_0_0) {
+ writeidx++;
+ *writeidx++ = ' ';
+ }
+ }
+}