|| from_macro_expansion_at (loc))
return;
+ bool w;
if (code == EQ_EXPR)
- warning_at (loc, OPT_Waddress,
- "the comparison will always evaluate as %<false%> "
- "for the address of %qE will never be NULL",
- op);
+ w = warning_at (loc, OPT_Waddress,
+ "the comparison will always evaluate as %<false%> "
+ "for the address of %qE will never be NULL",
+ op);
else
- warning_at (loc, OPT_Waddress,
- "the comparison will always evaluate as %<true%> "
- "for the address of %qE will never be NULL",
- op);
+ w = warning_at (loc, OPT_Waddress,
+ "the comparison will always evaluate as %<true%> "
+ "for the address of %qE will never be NULL",
+ op);
- if (DECL_P (op))
+ if (w && DECL_P (op))
inform (DECL_SOURCE_LOCATION (op), "%qD declared here", op);
}
--- /dev/null
+/* PR c/106947 */
+/* { dg-do compile } */
+/* { dg-options "-Waddress" } */
+
+#ifndef __cplusplus
+# define bool _Bool
+#endif
+
+#pragma GCC diagnostic ignored "-Waddress"
+int s; /* { dg-bogus "declared" } */
+bool e = &s;
+int
+main ()
+{
+ int error = 0;
+ {
+ bool e1 = &s;
+ if (!e1)
+ error = 1;
+ }
+ return error;
+}