gcc/
2014-05-13 Florian Weimer <fweimer@redhat.com>
* fold-const.c (fold_undefer_overflow_warnings): Print inlining
information.
gcc/testsuite/
2014-05-13 Florian Weimer <fweimer@redhat.com>
* c-c++-common/Wstrict-overflow-1.c: New test.
@@ -233,7 +233,6 @@ void
fold_undefer_overflow_warnings (bool issue, const_gimple stmt, int code)
{
const char *warnmsg;
- location_t locus;
gcc_assert (fold_deferring_overflow_warnings > 0);
--fold_deferring_overflow_warnings;
@@ -264,10 +263,10 @@ fold_undefer_overflow_warnings (bool issue, const_gimple stmt, int code)
return;
if (stmt == NULL)
- locus = input_location;
+ warning_at (input_location, OPT_Wstrict_overflow, "%s", warnmsg);
else
- locus = gimple_location (stmt);
- warning_at (locus, OPT_Wstrict_overflow, "%s", warnmsg);
+ warning_at (gimple_location (stmt), OPT_Wstrict_overflow, "%K%s",
+ build_empty_stmt (gimple_location (stmt)), warnmsg);
}
/* Stop deferring overflow warnings, ignoring any deferred
new file mode 100644
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -g -Wstrict-overflow" } */
+
+int f (void);
+
+static int g (int a, int b, int c)
+{
+ if (a + b < c) /* { dg-warning "assuming signed overflow" } */
+ return -1;
+ return f ();
+}
+
+static int h (int a, int b)
+{
+ return g(a, 1, b);
+}
+
+int k (int a)
+{
+ return h(a, a);
+}
+
+/* { dg-message "inlined from.*:15:" "inlined 15" { target *-*-* } 0 } */
+/* { dg-message "inlined from.*:20:" "inlined 20" { target *-*-* } 0 } */