{
/* This is somewhat equivalent to how the SSA case handles
def-stmts. */
- if (fully_overwrites_p (point.get_stmt (), m_decl, model))
+ if (fully_overwrites_p (point.get_stmt (), m_decl, model)
+ /* ...but we mustn't be at a point that also consumes the
+ current value of the decl when it's generating the new
+ value, for cases such as
+ struct st s;
+ s = foo ();
+ s = bar (s);
+ where we want to make sure that we don't stop at the:
+ s = bar (s);
+ since otherwise we would erroneously purge the state of "s"
+ after:
+ s = foo ();
+ */
+ && !m_points_needing_decl.contains (point))
{
if (logger)
logger->log ("stmt fully overwrites %qE; terminating", m_decl);
--- /dev/null
+typedef struct st
+{
+ char buf[16];
+} st;
+
+extern st foo (st);
+extern st bar (st *);
+extern char baz (st);
+
+void test_1 (st a)
+{
+ st b, c, d, e;
+
+ b = a;
+ c = foo(a);
+ d = bar(&a);
+ c = foo(e); /* { dg-warning "use of uninitialized value 'e'" } */
+}
+
+void test_2 (st a)
+{
+ a = a;
+}
+
+st test_2a (void)
+{
+ st a;
+ a = a; /* { dg-warning "use of uninitialized value 'a'" } */
+ return a;
+}
+
+void test_3 (st a)
+{
+ a = foo (a);
+}
+
+st test_3a (void)
+{
+ st a;
+ a = foo (a); /* { dg-warning "use of uninitialized value 'a'" } */
+ return a;
+}
+
+void test_3b (st a, st b)
+{
+ a = foo (a);
+ foo (b);
+ a = foo (a);
+ foo (b);
+ a = foo (a);
+ foo (b);
+}
+
+void test_4 (st a)
+{
+ a = bar (&a);
+}
+
+st test_4a (void)
+{
+ st a;
+ a = bar (&a);
+ return a;
+}
+
+void test_5 (st a)
+{
+ st b;
+ a = bar (&a);
+ b = b; /* { dg-warning "use of uninitialized value 'b'" } */
+}
+
+st test_6 (st a)
+{
+ st b;
+ a = bar (&b);
+ b = b;
+ return b;
+}
+
+void test_6a (st a)
+{
+ st b;
+ a = bar (&b);
+ b = b;
+}
+
+st test_7 (st a)
+{
+ st b;
+ b = bar (&a);
+ return b;
+}
+
+void test_7a (st a)
+{
+ st b;
+ b = bar (&a);
+}
+
+st test_8 (void)
+{
+ st b;
+ b = bar (&b);
+ return b;
+}
+
+void test_8a (void)
+{
+ st b;
+ b = bar (&b);
+}
+
+char test_9 (st a)
+{
+ char c;
+ c = baz (a);
+ return c;
+}
+
+char test_10 (st a)
+{
+ char c;
+ a = foo (a);
+ c = baz (a);
+ return c;
+}
--- /dev/null
+typedef unsigned short int __uint16_t;
+typedef unsigned int __uint32_t;
+typedef unsigned long int __uint64_t;
+typedef __uint16_t uint16_t;
+typedef __uint32_t uint32_t;
+typedef __uint64_t uint64_t;
+
+typedef uint32_t float32;
+typedef struct
+{
+ uint64_t low;
+ uint16_t high;
+} floatx80;
+
+extern floatx80
+float32_to_floatx80(float32);
+
+extern floatx80
+floatx80_add(floatx80, floatx80);
+
+floatx80
+test (floatx80 a)
+{
+ floatx80 fp0;
+
+ fp0 = a;
+ fp0 = floatx80_add(fp0, float32_to_floatx80((0x3F800000))); /* { dg-bogus "use of uninitialized value 'fp0'" } */
+ return fp0;
+}