@@ -125,11 +125,21 @@ public:
return label_text::borrow ("opened here");
if (change.m_old_state == m_sm.m_unchecked
&& change.m_new_state == m_sm.m_nonnull)
- return change.formatted_print ("assuming %qE is non-NULL",
- change.m_expr);
+ {
+ if (change.m_expr)
+ return change.formatted_print ("assuming %qE is non-NULL",
+ change.m_expr);
+ else
+ return change.formatted_print ("assuming FILE * is non-NULL");
+ }
if (change.m_new_state == m_sm.m_null)
- return change.formatted_print ("assuming %qE is NULL",
- change.m_expr);
+ {
+ if (change.m_expr)
+ return change.formatted_print ("assuming %qE is NULL",
+ change.m_expr);
+ else
+ return change.formatted_print ("assuming FILE * is NULL");
+ }
return label_text ();
}
new file mode 100644
@@ -0,0 +1,16 @@
+char *
+fopen (const char *restrict, const char *restrict);
+
+void
+err (void);
+
+void
+k2 (void)
+{
+ char *setfiles[1];
+ int i;
+
+ setfiles[i] = fopen("", ""); /* { dg-warning "use of uninitialized value 'i'" } */
+ if (!setfiles[i]) /* { dg-warning "use of uninitialized value 'i'" } */
+ err ();
+} /* { dg-warning "leak of FILE" } */