public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][RFC] Instrument function exit with __builtin_unreachable in C++.
@ 2017-10-05 10:32 Martin Liška
  2017-10-05 11:04 ` Jakub Jelinek
  2017-10-05 15:08 ` Jason Merrill
  0 siblings, 2 replies; 64+ messages in thread
From: Martin Liška @ 2017-10-05 10:32 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jakub Jelinek, Jonathan Wakely

[-- Attachment #1: Type: text/plain, Size: 5965 bytes --]

Hello.

As discussed 2 days ago on IRC with Jakub and Jonathan, C++ standard says that having a non-return
function with missing return statement is undefined behavior. We've got -fsanitize=return check for
that and we can in such case instrument __builtin_unreachable(). This patch does that. It produces quite
some fallout in test-suite.

And there's still some fallout:

FAIL: g++.dg/cpp0x/constexpr-diag3.C  -std=c++11  (test for errors, line 7)
FAIL: g++.dg/cpp0x/constexpr-neg3.C  -std=c++11  (test for errors, line 12)
FAIL: g++.dg/cpp1y/constexpr-return2.C  -std=c++14  (test for errors, line 7)
FAIL: g++.dg/cpp1y/constexpr-return2.C  -std=c++14 (test for excess errors)
FAIL: g++.dg/cpp1y/pr63996.C  -std=c++14  (test for errors, line 9)
FAIL: g++.dg/cpp1y/pr63996.C  -std=c++14 (test for excess errors)

1) there are causing:

./xg++ -B. /home/marxin/Programming/gcc/gcc/testsuite/g++.dg/cpp1y/pr63996.C
/home/marxin/Programming/gcc/gcc/testsuite/g++.dg/cpp1y/pr63996.C:9:23:   in constexpr expansion of ‘foo(1)’
/home/marxin/Programming/gcc/gcc/testsuite/g++.dg/cpp1y/pr63996.C:4:1: error: ‘__builtin_unreachable()’ is not a constant expression
 foo (int i)
 ^~~

Where we probably should not emit the built-in call. Am I right?

FAIL: g++.dg/torture/pr34850.C   -O1   (test for warnings, line 15)
FAIL: g++.dg/torture/pr34850.C   -O2   (test for warnings, line 15)
FAIL: g++.dg/torture/pr34850.C   -O2 -flto -fno-use-linker-plugin -flto-partition=none   (test for warnings, line 15)
FAIL: g++.dg/torture/pr34850.C   -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects   (test for warnings, line 15)
FAIL: g++.dg/torture/pr34850.C   -O3 -g   (test for warnings, line 15)
FAIL: g++.dg/torture/pr34850.C   -Os   (test for warnings, line 15)

2) this test is somehow hard to fix as it requires some unreachability.

Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.

Thoughts?
Martin

gcc/cp/ChangeLog:

2017-10-05  Martin Liska  <mliska@suse.cz>

	PR middle-end/82404
	* cp-gimplify.c (cp_ubsan_maybe_instrument_return): Remove as
	renamed to ...
	(cp_maybe_instrument_return): ... this.
	(cp_genericize): Update call of the function.

gcc/testsuite/ChangeLog:

2017-10-05  Martin Liska  <mliska@suse.cz>

	PR middle-end/82404
	* c-c++-common/dfp/call-by-value.c (foo32): Change return value
	to void.
	(foo64): Likewise.
	(foo128): Likewise.
	* g++.dg/bprob/g++-bprob-1.C: Likewise.
	* g++.dg/cpp0x/lambda/lambda-template.C (f): Likewise.
	* g++.dg/cpp0x/range-for6.C (foo): Return a value.
	* g++.dg/cpp0x/udlit-template.C: Change return value
	to void.
	* g++.dg/cpp1z/eval-order3.C (struct A): Return a value.
	(operator>>): Likewise.
	* g++.dg/expr/cond12.C (struct X): Return a value.
	(X::operator=): Likewise.
	* g++.dg/gcov/gcov-1.C: Change return value
	to void.
	* g++.dg/gcov/gcov-threads-1.C (ContentionNoDeadlock_thread):
	Return a value.
	* g++.dg/ipa/devirt-21.C: Likewise.
	* g++.dg/ipa/devirt-23.C: Likewise.
	* g++.dg/ipa/devirt-34.C (t): Likewise.
	* g++.dg/opt/20050511-1.C (bar): Likewise.
	* g++.dg/opt/const3.C (A::foo1): Likewise.
	(A::foo2): Likewise.
	* g++.dg/opt/pr23299.C (E::c): Likewise.
	* g++.dg/other/copy2.C (A::operator=): Likewise.
	* g++.dg/overload/addr1.C: Likewise.
	* g++.dg/pr48484.C: Likewise.
	* g++.dg/tls/thread_local3.C (thread_main): Likewise.
	* g++.dg/tls/thread_local3g.C (thread_main): Likewise.
	* g++.dg/tls/thread_local5.C (thread_main): Likewise.
	* g++.dg/tls/thread_local5g.C (thread_main): Likewise.
	* g++.dg/tls/thread_local6.C (thread_main): Likewise.
	* g++.dg/tls/thread_local6g.C (thread_main): Likewise.
	* g++.dg/torture/pr34850.C (OctetString::operator^=): Likewise.
	* g++.dg/tree-prof/pr79259.C (fn2): Likewise.
	* g++.dg/tree-ssa/pr33604.C (struct Value): Likewise.
	* g++.dg/tree-ssa/pr81408.C (struct p): Likewise.
	(av): Likewise.
	* g++.dg/warn/string1.C (test): Likewise.
---
 gcc/cp/cp-gimplify.c                                | 18 ++++++++++++------
 gcc/testsuite/c-c++-common/dfp/call-by-value.c      |  6 +++---
 gcc/testsuite/g++.dg/bprob/g++-bprob-1.C            |  2 +-
 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template.C |  2 +-
 gcc/testsuite/g++.dg/cpp0x/range-for6.C             |  2 ++
 gcc/testsuite/g++.dg/cpp0x/udlit-template.C         |  2 +-
 gcc/testsuite/g++.dg/cpp1z/eval-order3.C            |  4 ++--
 gcc/testsuite/g++.dg/expr/cond12.C                  |  8 +++++++-
 gcc/testsuite/g++.dg/gcov/gcov-1.C                  |  2 +-
 gcc/testsuite/g++.dg/gcov/gcov-threads-1.C          |  2 ++
 gcc/testsuite/g++.dg/ipa/devirt-21.C                |  2 +-
 gcc/testsuite/g++.dg/ipa/devirt-23.C                |  2 +-
 gcc/testsuite/g++.dg/ipa/devirt-34.C                |  2 ++
 gcc/testsuite/g++.dg/missing-return.C               |  8 ++++++++
 gcc/testsuite/g++.dg/opt/20050511-1.C               |  2 ++
 gcc/testsuite/g++.dg/opt/const3.C                   |  4 ++--
 gcc/testsuite/g++.dg/opt/pr23299.C                  |  2 ++
 gcc/testsuite/g++.dg/other/copy2.C                  | 10 +++++++---
 gcc/testsuite/g++.dg/overload/addr1.C               |  2 +-
 gcc/testsuite/g++.dg/pr48484.C                      |  3 +++
 gcc/testsuite/g++.dg/tls/thread_local3.C            |  1 +
 gcc/testsuite/g++.dg/tls/thread_local3g.C           |  1 +
 gcc/testsuite/g++.dg/tls/thread_local5.C            |  1 +
 gcc/testsuite/g++.dg/tls/thread_local5g.C           |  1 +
 gcc/testsuite/g++.dg/tls/thread_local6.C            |  1 +
 gcc/testsuite/g++.dg/tls/thread_local6g.C           |  1 +
 gcc/testsuite/g++.dg/torture/pr34850.C              |  6 ++++++
 gcc/testsuite/g++.dg/tree-prof/pr79259.C            |  2 ++
 gcc/testsuite/g++.dg/tree-ssa/pr33604.C             |  2 +-
 gcc/testsuite/g++.dg/tree-ssa/pr81408.C             | 12 ++++++------
 gcc/testsuite/g++.dg/warn/string1.C                 |  2 ++
 31 files changed, 84 insertions(+), 31 deletions(-)
 create mode 100644 gcc/testsuite/g++.dg/missing-return.C



[-- Attachment #2: 0001-Instrument-function-exit-with-__builtin_unreachable-.patch --]
[-- Type: text/x-patch, Size: 15123 bytes --]

diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c
index 262485a5c1f..0bf8f567d5b 100644
--- a/gcc/cp/cp-gimplify.c
+++ b/gcc/cp/cp-gimplify.c
@@ -1556,10 +1556,11 @@ cp_genericize_tree (tree* t_p, bool handle_invisiref_parm_p)
 
 /* If a function that should end with a return in non-void
    function doesn't obviously end with return, add ubsan
-   instrumentation code to verify it at runtime.  */
+   instrumentation code to verify it at runtime.  If -fsanitize=return
+   is not enabled, instrument __builtin_unreachable.  */
 
 static void
-cp_ubsan_maybe_instrument_return (tree fndecl)
+cp_maybe_instrument_return (tree fndecl)
 {
   if (VOID_TYPE_P (TREE_TYPE (TREE_TYPE (fndecl)))
       || DECL_CONSTRUCTOR_P (fndecl)
@@ -1600,7 +1601,14 @@ cp_ubsan_maybe_instrument_return (tree fndecl)
   tree *p = &DECL_SAVED_TREE (fndecl);
   if (TREE_CODE (*p) == BIND_EXPR)
     p = &BIND_EXPR_BODY (*p);
-  t = ubsan_instrument_return (DECL_SOURCE_LOCATION (fndecl));
+
+  location_t loc = DECL_SOURCE_LOCATION (fndecl);
+  if (sanitize_flags_p (SANITIZE_RETURN, fndecl))
+    t = ubsan_instrument_return (loc);
+  else
+    t = build_call_expr_loc (loc, builtin_decl_explicit (BUILT_IN_UNREACHABLE),
+			     0);
+
   append_to_statement_list (t, p);
 }
 
@@ -1674,9 +1682,7 @@ cp_genericize (tree fndecl)
      walk_tree's hash functionality.  */
   cp_genericize_tree (&DECL_SAVED_TREE (fndecl), true);
 
-  if (sanitize_flags_p (SANITIZE_RETURN)
-      && current_function_decl != NULL_TREE)
-    cp_ubsan_maybe_instrument_return (fndecl);
+  cp_maybe_instrument_return (fndecl);
 
   /* Do everything else.  */
   c_genericize (fndecl);
diff --git a/gcc/testsuite/c-c++-common/dfp/call-by-value.c b/gcc/testsuite/c-c++-common/dfp/call-by-value.c
index 74aec53aefb..e7aea3076cf 100644
--- a/gcc/testsuite/c-c++-common/dfp/call-by-value.c
+++ b/gcc/testsuite/c-c++-common/dfp/call-by-value.c
@@ -5,17 +5,17 @@
 
 #include "dfp-dbg.h"
 
-int foo32 (_Decimal32 z)
+void foo32 (_Decimal32 z)
 {
   z = z + 1.0df;
 }
 
-int foo64 (_Decimal64 z)
+void foo64 (_Decimal64 z)
 {
   z = z + 1.0dd;
 }
 
-int foo128 (_Decimal128 z)
+void foo128 (_Decimal128 z)
 {
   z = z + 1.0dl;
 }
diff --git a/gcc/testsuite/g++.dg/bprob/g++-bprob-1.C b/gcc/testsuite/g++.dg/bprob/g++-bprob-1.C
index b1a1de77e98..3aafc06d51d 100644
--- a/gcc/testsuite/g++.dg/bprob/g++-bprob-1.C
+++ b/gcc/testsuite/g++.dg/bprob/g++-bprob-1.C
@@ -35,7 +35,7 @@ test_for2 (int m, int n, int o)
   return for_temp;			/* count(6) */
 }
 
-int
+void
 call_for ()
 {
   for_val1 += test_for1 (0);
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template.C
index 66cc7a4e1df..17c6a6e5b52 100644
--- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template.C
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template.C
@@ -9,7 +9,7 @@ auto apply (T t) -> decltype (t())
 }
 
 template <class T>
-T f(T t)
+void f(T t)
 {
   T t2 = t;
   if (t != [=]()->T { return t; }())
diff --git a/gcc/testsuite/g++.dg/cpp0x/range-for6.C b/gcc/testsuite/g++.dg/cpp0x/range-for6.C
index 366499a34d8..b4d9dd720ee 100644
--- a/gcc/testsuite/g++.dg/cpp0x/range-for6.C
+++ b/gcc/testsuite/g++.dg/cpp0x/range-for6.C
@@ -14,6 +14,8 @@ template<typename T> T foo()
         sum += x;
     if (sum != T(10))
         abort();
+
+    return sum;
 }
 
 int main()
diff --git a/gcc/testsuite/g++.dg/cpp0x/udlit-template.C b/gcc/testsuite/g++.dg/cpp0x/udlit-template.C
index de21b66028f..15583199297 100644
--- a/gcc/testsuite/g++.dg/cpp0x/udlit-template.C
+++ b/gcc/testsuite/g++.dg/cpp0x/udlit-template.C
@@ -23,7 +23,7 @@ template<>
   operator"" _abc<'6','6','6'>()
   { return 21; }
 
-int
+void
 test1()
 {
   int i = operator"" _abc<'1','2','3'>();
diff --git a/gcc/testsuite/g++.dg/cpp1z/eval-order3.C b/gcc/testsuite/g++.dg/cpp1z/eval-order3.C
index 966ac0a6523..b53e96a9f8f 100644
--- a/gcc/testsuite/g++.dg/cpp1z/eval-order3.C
+++ b/gcc/testsuite/g++.dg/cpp1z/eval-order3.C
@@ -26,7 +26,7 @@ struct A
   int _i;
   A(int i): _i(f(i)) { }
   A& memfn(int i, int j) { f(j); return *this; }
-  int operator<<(int i) { }
+  int operator<<(int i) { return 0; }
   A& operator=(const A&) { return *this; }
   A& operator+=(int i) { return *this; }
 };
@@ -38,7 +38,7 @@ struct B
   B(int i): _i(f(i)) { }
 };
 
-int operator>>(A&, int i) { }
+int operator>>(A&, int i) { return 0; }
 
 A a(0);
 A* afn(int i)
diff --git a/gcc/testsuite/g++.dg/expr/cond12.C b/gcc/testsuite/g++.dg/expr/cond12.C
index 9134f81668f..90d77dbd708 100644
--- a/gcc/testsuite/g++.dg/expr/cond12.C
+++ b/gcc/testsuite/g++.dg/expr/cond12.C
@@ -2,10 +2,16 @@
 // { dg-do run }
 
 struct X {
-    X& operator=(const X&){}
+    X& operator=(const X&);
     X& operator=(X&){__builtin_abort();}
 };
 
+X g;
+X& X::operator=(const X&)
+{
+  return g;
+}
+
 int main(int argv,char**) {
   X a, b;
   ((argv > 2) ? a : b) = X();
diff --git a/gcc/testsuite/g++.dg/gcov/gcov-1.C b/gcc/testsuite/g++.dg/gcov/gcov-1.C
index c279b1452fc..9018b9a3a73 100644
--- a/gcc/testsuite/g++.dg/gcov/gcov-1.C
+++ b/gcc/testsuite/g++.dg/gcov/gcov-1.C
@@ -74,7 +74,7 @@ test_for2 (int m, int n, int o)
   return for_temp;			/* count(6) */
 }
 
-int
+void
 call_for ()
 {
   for_val1 += test_for1 (0);
diff --git a/gcc/testsuite/g++.dg/gcov/gcov-threads-1.C b/gcc/testsuite/g++.dg/gcov/gcov-threads-1.C
index cc9266ab8ea..eb558614c18 100644
--- a/gcc/testsuite/g++.dg/gcov/gcov-threads-1.C
+++ b/gcc/testsuite/g++.dg/gcov/gcov-threads-1.C
@@ -19,6 +19,8 @@ static void *ContentionNoDeadlock_thread(void *start)
       for (int32_t i = NR - 1; i >= starti; --i)
 	pthread_mutex_unlock (&cndMs[i]);
   }
+
+  return 0;
 }
 int main(int argc, char **argv) {
   for (unsigned i = 0; i < NR; i++)
diff --git a/gcc/testsuite/g++.dg/ipa/devirt-21.C b/gcc/testsuite/g++.dg/ipa/devirt-21.C
index a33be4eca04..440570c8ddb 100644
--- a/gcc/testsuite/g++.dg/ipa/devirt-21.C
+++ b/gcc/testsuite/g++.dg/ipa/devirt-21.C
@@ -12,7 +12,7 @@ class MultiTermDocs : public virtual B {
 protected:
   A readerTermDocs;
   A subReaders;
-  virtual B *m_fn1(int *) {}
+  virtual B *m_fn1(int *) { return NULL; }
   virtual inline  ~MultiTermDocs();
   void wrap(void)
   {
diff --git a/gcc/testsuite/g++.dg/ipa/devirt-23.C b/gcc/testsuite/g++.dg/ipa/devirt-23.C
index 665e953cae7..76fc3fde42b 100644
--- a/gcc/testsuite/g++.dg/ipa/devirt-23.C
+++ b/gcc/testsuite/g++.dg/ipa/devirt-23.C
@@ -12,7 +12,7 @@ class MultiTermDocs : public virtual B {
 protected:
   A readerTermDocs;
   A subReaders;
-  virtual B *m_fn1(int *) {}
+  virtual B *m_fn1(int *) { return NULL; }
   virtual inline  ~MultiTermDocs();
   inline void wrap(void)
   {
diff --git a/gcc/testsuite/g++.dg/ipa/devirt-34.C b/gcc/testsuite/g++.dg/ipa/devirt-34.C
index 030e08bba8a..083c305665f 100644
--- a/gcc/testsuite/g++.dg/ipa/devirt-34.C
+++ b/gcc/testsuite/g++.dg/ipa/devirt-34.C
@@ -10,6 +10,8 @@ t(struct B *b)
 {
   struct A *a=b;
   a->t();
+
+  return 0;
 }
 
 /* We should guess that the pointer of type B probably points to an instance
diff --git a/gcc/testsuite/g++.dg/missing-return.C b/gcc/testsuite/g++.dg/missing-return.C
new file mode 100644
index 00000000000..f7fcfebb2b4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/missing-return.C
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-Wreturn-type -fdump-tree-optimized" } */
+
+int foo(int a)
+{
+} /* { dg-warning "no return statement" } */
+
+/* { dg-final { scan-tree-dump "__builtin_unreachable" "optimized" } } */
diff --git a/gcc/testsuite/g++.dg/opt/20050511-1.C b/gcc/testsuite/g++.dg/opt/20050511-1.C
index a8929030af4..a840fb0db8e 100644
--- a/gcc/testsuite/g++.dg/opt/20050511-1.C
+++ b/gcc/testsuite/g++.dg/opt/20050511-1.C
@@ -53,6 +53,8 @@ UINT32 bar (const C * sPtr)
 
   if (a.xy[0] != ((SINT16) 0xffff << 2))
 	abort ();
+
+  return 0;
 }
 
 int main()
diff --git a/gcc/testsuite/g++.dg/opt/const3.C b/gcc/testsuite/g++.dg/opt/const3.C
index c7c0a1645de..969df91e6e1 100644
--- a/gcc/testsuite/g++.dg/opt/const3.C
+++ b/gcc/testsuite/g++.dg/opt/const3.C
@@ -30,8 +30,8 @@ struct A
 
 int i;
 
-int A::foo1(void *ios, const char *str) { }
-int A::foo2(int v, const Type t) { i=0; }
+int A::foo1(void *ios, const char *str) { return 0; }
+int A::foo2(int v, const Type t) { i=0; return 0; }
 
 int main()
 {
diff --git a/gcc/testsuite/g++.dg/opt/pr23299.C b/gcc/testsuite/g++.dg/opt/pr23299.C
index 94a414aa5f7..b791bf954e8 100644
--- a/gcc/testsuite/g++.dg/opt/pr23299.C
+++ b/gcc/testsuite/g++.dg/opt/pr23299.C
@@ -50,6 +50,8 @@ E::c ()
   if (x > 10)
     throw 1;
   x |= 2;
+
+  return x;
 }
 
 int
diff --git a/gcc/testsuite/g++.dg/other/copy2.C b/gcc/testsuite/g++.dg/other/copy2.C
index 335cab8d19f..df480f06ecc 100644
--- a/gcc/testsuite/g++.dg/other/copy2.C
+++ b/gcc/testsuite/g++.dg/other/copy2.C
@@ -10,11 +10,15 @@ class A
 {
 public:
   int i;
-  A &operator =(const A &i)
-  {
+  A &operator =(const A &i);
+};
+
+A a;
+
+A& A::operator=(const A &i)  {
     status = 0;
+    return a;
   }
-};
 
 class B
 {
diff --git a/gcc/testsuite/g++.dg/overload/addr1.C b/gcc/testsuite/g++.dg/overload/addr1.C
index 25856a20fc6..4eb9e2f31ca 100644
--- a/gcc/testsuite/g++.dg/overload/addr1.C
+++ b/gcc/testsuite/g++.dg/overload/addr1.C
@@ -11,7 +11,7 @@ static int flag = 0;
 
 template <typename> struct A
 {
-  A &active ()  { flag++;}
+  A &active () { flag++; static A a; return a; }
   
   static void foo() {}
 
diff --git a/gcc/testsuite/g++.dg/pr48484.C b/gcc/testsuite/g++.dg/pr48484.C
index 1380c452fa4..19e9b9a8d0a 100644
--- a/gcc/testsuite/g++.dg/pr48484.C
+++ b/gcc/testsuite/g++.dg/pr48484.C
@@ -65,6 +65,8 @@ bool
 	jump = 0;
       }
     }
+
+  return false;
 }
 
 bool
@@ -102,4 +104,5 @@ bool
 	}
     }
 
+  return true;
 }
diff --git a/gcc/testsuite/g++.dg/tls/thread_local3.C b/gcc/testsuite/g++.dg/tls/thread_local3.C
index e05a0b95306..d29bda1a000 100644
--- a/gcc/testsuite/g++.dg/tls/thread_local3.C
+++ b/gcc/testsuite/g++.dg/tls/thread_local3.C
@@ -21,6 +21,7 @@ void f()
 void *thread_main(void *)
 {
   f(); f(); f();
+  return 0;
 }
 
 #include <pthread.h>
diff --git a/gcc/testsuite/g++.dg/tls/thread_local3g.C b/gcc/testsuite/g++.dg/tls/thread_local3g.C
index a3c9ebcc2c5..2f9fdee1a73 100644
--- a/gcc/testsuite/g++.dg/tls/thread_local3g.C
+++ b/gcc/testsuite/g++.dg/tls/thread_local3g.C
@@ -19,6 +19,7 @@ thread_local A a;
 void *thread_main(void *)
 {
   A* ap = &a;
+  return 0;
 }
 
 #include <pthread.h>
diff --git a/gcc/testsuite/g++.dg/tls/thread_local5.C b/gcc/testsuite/g++.dg/tls/thread_local5.C
index c4d5ff01bf5..61fea722dc2 100644
--- a/gcc/testsuite/g++.dg/tls/thread_local5.C
+++ b/gcc/testsuite/g++.dg/tls/thread_local5.C
@@ -30,6 +30,7 @@ void f()
 void *thread_main(void *)
 {
   f(); f(); f();
+  return 0;
 }
 
 int main()
diff --git a/gcc/testsuite/g++.dg/tls/thread_local5g.C b/gcc/testsuite/g++.dg/tls/thread_local5g.C
index 5ced551fb57..596bbbe542f 100644
--- a/gcc/testsuite/g++.dg/tls/thread_local5g.C
+++ b/gcc/testsuite/g++.dg/tls/thread_local5g.C
@@ -28,6 +28,7 @@ thread_local A a;
 void *thread_main(void *)
 {
   A* ap = &a;
+  return 0;
 }
 
 int main()
diff --git a/gcc/testsuite/g++.dg/tls/thread_local6.C b/gcc/testsuite/g++.dg/tls/thread_local6.C
index 2810efaea93..0009726626b 100644
--- a/gcc/testsuite/g++.dg/tls/thread_local6.C
+++ b/gcc/testsuite/g++.dg/tls/thread_local6.C
@@ -22,6 +22,7 @@ void f()
 void *thread_main(void *)
 {
   f(); f(); f();
+  return 0;
 }
 
 int main()
diff --git a/gcc/testsuite/g++.dg/tls/thread_local6g.C b/gcc/testsuite/g++.dg/tls/thread_local6g.C
index b8f9cdf1dea..d357ca4fa1f 100644
--- a/gcc/testsuite/g++.dg/tls/thread_local6g.C
+++ b/gcc/testsuite/g++.dg/tls/thread_local6g.C
@@ -20,6 +20,7 @@ thread_local A a;
 void *thread_main(void *)
 {
   A* ap = &a;
+  return 0;
 }
 
 int main()
diff --git a/gcc/testsuite/g++.dg/torture/pr34850.C b/gcc/testsuite/g++.dg/torture/pr34850.C
index c33dbfb5c93..c2538288964 100644
--- a/gcc/testsuite/g++.dg/torture/pr34850.C
+++ b/gcc/testsuite/g++.dg/torture/pr34850.C
@@ -13,6 +13,8 @@ extern "C" {
     void * memset (void *__dest, int __ch, size_t __len) throw () {
 	if (__builtin_constant_p (__len) && __len == 0)
 	    __warn_memset_zero_len (); /* { dg-warning "declared with attribute warning" } */
+
+	return __dest;
     }
 }
 inline void clear_mem(void* ptr, u32bit n)    {
@@ -50,11 +52,13 @@ template<typename T> class SecureVector : public MemoryRegion<T>    {
 public:
     SecureVector<T>& operator=(const MemoryRegion<T>& in)          {
 	if(this != &in) this->set(in);
+	return *this;
     }
 };
 class OctetString    {
 public:
     SecureVector<byte> bits_of() const {
+	return SecureVector<byte> ();
     }
     OctetString& operator^=(const OctetString&);
     void change(const MemoryRegion<byte>& in) {
@@ -69,6 +73,8 @@ OctetString& OctetString::operator^=(const OctetString& k)    {
     if(&k == this) {
 	bits.clear();
     }
+
+    return *this;
 }
 bool __attribute__((flatten))
 operator==(const OctetString& s1, const OctetString& s2)    {
diff --git a/gcc/testsuite/g++.dg/tree-prof/pr79259.C b/gcc/testsuite/g++.dg/tree-prof/pr79259.C
index a55172b62d2..6125a179bdc 100644
--- a/gcc/testsuite/g++.dg/tree-prof/pr79259.C
+++ b/gcc/testsuite/g++.dg/tree-prof/pr79259.C
@@ -11,6 +11,8 @@ fn2 ()
 {
   if (a (c == 0))
     return 0;
+
+  return 0;
 }
 
 int main()
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr33604.C b/gcc/testsuite/g++.dg/tree-ssa/pr33604.C
index 1c0f550bfdf..668db49d146 100644
--- a/gcc/testsuite/g++.dg/tree-ssa/pr33604.C
+++ b/gcc/testsuite/g++.dg/tree-ssa/pr33604.C
@@ -6,7 +6,7 @@ struct Value
   double value;
   Value(double value_) : value (value_) {}
   operator double() const { return value; }
-  Value& operator=(double other) { value = other; }
+  Value& operator=(double other) { value = other; return *this; }
 };
 
 struct Ref
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr81408.C b/gcc/testsuite/g++.dg/tree-ssa/pr81408.C
index f94544b9e2d..60e6e5277d7 100644
--- a/gcc/testsuite/g++.dg/tree-ssa/pr81408.C
+++ b/gcc/testsuite/g++.dg/tree-ssa/pr81408.C
@@ -1,5 +1,9 @@
 /* { dg-do compile } */
 /* { dg-options "-O2 -std=gnu++11 -fopt-info-loop-missed -Wunsafe-loop-optimizations" } */
+struct p
+{
+  char *ay;
+};
 
 namespace a {
 void b () __attribute__ ((__noreturn__));
@@ -19,7 +23,7 @@ template <typename j, typename> class k
   j l;
 
 public:
-  typename d<j>::f operator* () {}
+  typename d<j>::f operator* () { return p(); }
   void operator++ () { ++l; }
   j
   aa ()
@@ -33,7 +37,6 @@ operator!= (k<m, ab> o, k<n, ab> p2)
 {
   return o.aa () != p2.aa ();
 }
-struct p;
 namespace a {
 struct F
 {
@@ -75,13 +78,10 @@ at
 av (au o)
 {
   o.aq ('\n');
+  return at();
 }
 u ax;
 }
-struct p
-{
-  char *ay;
-};
 a::H t;
 void
 ShowHelpListCommands ()
diff --git a/gcc/testsuite/g++.dg/warn/string1.C b/gcc/testsuite/g++.dg/warn/string1.C
index 2670f63d931..8f24a78f709 100644
--- a/gcc/testsuite/g++.dg/warn/string1.C
+++ b/gcc/testsuite/g++.dg/warn/string1.C
@@ -15,4 +15,6 @@ int test() {
   //
   std::string s = "";
   s += 'x' + "y";	      // { dg-warning "bounds of constant string" }
+
+  return 0;
 }


^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH][RFC] Instrument function exit with __builtin_unreachable in C++.
  2017-10-05 10:32 [PATCH][RFC] Instrument function exit with __builtin_unreachable in C++ Martin Liška
@ 2017-10-05 11:04 ` Jakub Jelinek
  2017-10-05 15:08 ` Jason Merrill
  1 sibling, 0 replies; 64+ messages in thread
From: Jakub Jelinek @ 2017-10-05 11:04 UTC (permalink / raw)
  To: Martin Liška; +Cc: gcc-patches, Jonathan Wakely

On Thu, Oct 05, 2017 at 12:31:23PM +0200, Martin Liška wrote:
> As discussed 2 days ago on IRC with Jakub and Jonathan, C++ standard says that having a non-return
> function with missing return statement is undefined behavior. We've got -fsanitize=return check for
> that and we can in such case instrument __builtin_unreachable(). This patch does that. It produces quite
> some fallout in test-suite.
> 
> And there's still some fallout:
> 
> FAIL: g++.dg/cpp0x/constexpr-diag3.C  -std=c++11  (test for errors, line 7)
> FAIL: g++.dg/cpp0x/constexpr-neg3.C  -std=c++11  (test for errors, line 12)
> FAIL: g++.dg/cpp1y/constexpr-return2.C  -std=c++14  (test for errors, line 7)
> FAIL: g++.dg/cpp1y/constexpr-return2.C  -std=c++14 (test for excess errors)
> FAIL: g++.dg/cpp1y/pr63996.C  -std=c++14  (test for errors, line 9)
> FAIL: g++.dg/cpp1y/pr63996.C  -std=c++14 (test for excess errors)
> 
> 1) there are causing:
> 
> ./xg++ -B. /home/marxin/Programming/gcc/gcc/testsuite/g++.dg/cpp1y/pr63996.C
> /home/marxin/Programming/gcc/gcc/testsuite/g++.dg/cpp1y/pr63996.C:9:23:   in constexpr expansion of ‘foo(1)’
> /home/marxin/Programming/gcc/gcc/testsuite/g++.dg/cpp1y/pr63996.C:4:1: error: ‘__builtin_unreachable()’ is not a constant expression
>  foo (int i)
>  ^~~
> 
> Where we probably should not emit the built-in call. Am I right?

The problem is that I think we save the constexpr function bodies after
folding and genericization.  We shouldn't be doing that, if we save it
before, in addition to fixing quite a few bugs it would fix this as well.

If looking for a hack instead of proper fix here, allowing
__builtin_unreachable () in constant expressions would be probably
undesirable, because then people adding it themselves in their source code
would get it accepted.  So, either we need some way how to differentiate
between user written __builtin_unreachable and one we've added ourselves
(doesn't -fsanitize=return fail the similar way though?), either as
internal-fn instead, or just by using UNKNOWN_LOCATION or BUILTINS_LOCATION
or something similar to find out it is artificial; and of course if we
reach it during constexpr evaluation error some way.

	Jakub

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH][RFC] Instrument function exit with __builtin_unreachable in C++.
  2017-10-05 10:32 [PATCH][RFC] Instrument function exit with __builtin_unreachable in C++ Martin Liška
  2017-10-05 11:04 ` Jakub Jelinek
@ 2017-10-05 15:08 ` Jason Merrill
  2017-10-05 16:53   ` Martin Liška
  1 sibling, 1 reply; 64+ messages in thread
From: Jason Merrill @ 2017-10-05 15:08 UTC (permalink / raw)
  To: Martin Liška; +Cc: gcc-patches List, Jakub Jelinek, Jonathan Wakely

On Thu, Oct 5, 2017 at 6:31 AM, Martin Liška <mliska@suse.cz> wrote:
> As discussed 2 days ago on IRC with Jakub and Jonathan, C++ standard says that having a non-return
> function with missing return statement is undefined behavior. We've got -fsanitize=return check for
> that and we can in such case instrument __builtin_unreachable(). This patch does that.

Great.

> And there's still some fallout:
>
> FAIL: g++.dg/cpp0x/constexpr-diag3.C  -std=c++11  (test for errors, line 7)
> FAIL: g++.dg/cpp0x/constexpr-neg3.C  -std=c++11  (test for errors, line 12)
> FAIL: g++.dg/cpp1y/constexpr-return2.C  -std=c++14  (test for errors, line 7)
> FAIL: g++.dg/cpp1y/constexpr-return2.C  -std=c++14 (test for excess errors)
> FAIL: g++.dg/cpp1y/pr63996.C  -std=c++14  (test for errors, line 9)
> FAIL: g++.dg/cpp1y/pr63996.C  -std=c++14 (test for excess errors)
>
> 1) there are causing:
>
> ./xg++ -B. /home/marxin/Programming/gcc/gcc/testsuite/g++.dg/cpp1y/pr63996.C
> /home/marxin/Programming/gcc/gcc/testsuite/g++.dg/cpp1y/pr63996.C:9:23:   in constexpr expansion of ‘foo(1)’
> /home/marxin/Programming/gcc/gcc/testsuite/g++.dg/cpp1y/pr63996.C:4:1: error: ‘__builtin_unreachable()’ is not a constant expression
>  foo (int i)
>  ^~~
>
> Where we probably should not emit the built-in call. Am I right?

Or constexpr.c could give a more friendly diagnostic for
__builtin_unreachable.  It's correct to give a diagnostic here for
this testcase.

> FAIL: g++.dg/torture/pr34850.C   -O1   (test for warnings, line 15)
> FAIL: g++.dg/torture/pr34850.C   -O2   (test for warnings, line 15)
> FAIL: g++.dg/torture/pr34850.C   -O2 -flto -fno-use-linker-plugin -flto-partition=none   (test for warnings, line 15)
> FAIL: g++.dg/torture/pr34850.C   -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects   (test for warnings, line 15)
> FAIL: g++.dg/torture/pr34850.C   -O3 -g   (test for warnings, line 15)
> FAIL: g++.dg/torture/pr34850.C   -Os   (test for warnings, line 15)
>
> 2) this test is somehow hard to fix as it requires some unreachability.

Can't we add a return statement to memset?

Also, this testcase seems to indicate a danger from this patch, like
we've seen before with bounds checking: if we have a checking path
that complains about invalid arguments and then has undefined
behavior, we optimize away the diagnostic.  Can we warn in such cases?
 We probably want to provide a way to turn off this behavior.

If we're going to enable this by default, we probably also want
-Wreturn-type on by default.

Jason

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH][RFC] Instrument function exit with __builtin_unreachable in C++.
  2017-10-05 15:08 ` Jason Merrill
@ 2017-10-05 16:53   ` Martin Liška
  2017-10-11 14:04     ` Martin Liška
  2017-10-11 15:31     ` Jason Merrill
  0 siblings, 2 replies; 64+ messages in thread
From: Martin Liška @ 2017-10-05 16:53 UTC (permalink / raw)
  To: Jason Merrill; +Cc: gcc-patches List, Jakub Jelinek, Jonathan Wakely

On 10/05/2017 05:07 PM, Jason Merrill wrote:
> On Thu, Oct 5, 2017 at 6:31 AM, Martin Liška <mliska@suse.cz> wrote:
>> As discussed 2 days ago on IRC with Jakub and Jonathan, C++ standard says that having a non-return
>> function with missing return statement is undefined behavior. We've got -fsanitize=return check for
>> that and we can in such case instrument __builtin_unreachable(). This patch does that.
> 
> Great.
> 
>> And there's still some fallout:
>>
>> FAIL: g++.dg/cpp0x/constexpr-diag3.C  -std=c++11  (test for errors, line 7)
>> FAIL: g++.dg/cpp0x/constexpr-neg3.C  -std=c++11  (test for errors, line 12)
>> FAIL: g++.dg/cpp1y/constexpr-return2.C  -std=c++14  (test for errors, line 7)
>> FAIL: g++.dg/cpp1y/constexpr-return2.C  -std=c++14 (test for excess errors)
>> FAIL: g++.dg/cpp1y/pr63996.C  -std=c++14  (test for errors, line 9)
>> FAIL: g++.dg/cpp1y/pr63996.C  -std=c++14 (test for excess errors)
>>
>> 1) there are causing:
>>
>> ./xg++ -B. /home/marxin/Programming/gcc/gcc/testsuite/g++.dg/cpp1y/pr63996.C
>> /home/marxin/Programming/gcc/gcc/testsuite/g++.dg/cpp1y/pr63996.C:9:23:   in constexpr expansion of ‘foo(1)’
>> /home/marxin/Programming/gcc/gcc/testsuite/g++.dg/cpp1y/pr63996.C:4:1: error: ‘__builtin_unreachable()’ is not a constant expression
>>   foo (int i)
>>   ^~~
>>
>> Where we probably should not emit the built-in call. Am I right?
> 
> Or constexpr.c could give a more friendly diagnostic for
> __builtin_unreachable.  It's correct to give a diagnostic here for
> this testcase.

Hi.

That's good idea, any suggestion different from:

./xg++ -B. /home/marxin/Programming/gcc2/gcc/testsuite/g++.dg/cpp1y/pr63996.C
/home/marxin/Programming/gcc2/gcc/testsuite/g++.dg/cpp1y/pr63996.C:9:23:   in constexpr expansion of ‘foo(1)’
<built-in>: error: constexpr can't contain call of a non-return function ‘__builtin_unreachable’

which is probably misleading as it points to a function call that is actually missing in source code.
Should we distinguish between implicit and explicit __builtin_unreachable?

> 
>> FAIL: g++.dg/torture/pr34850.C   -O1   (test for warnings, line 15)
>> FAIL: g++.dg/torture/pr34850.C   -O2   (test for warnings, line 15)
>> FAIL: g++.dg/torture/pr34850.C   -O2 -flto -fno-use-linker-plugin -flto-partition=none   (test for warnings, line 15)
>> FAIL: g++.dg/torture/pr34850.C   -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects   (test for warnings, line 15)
>> FAIL: g++.dg/torture/pr34850.C   -O3 -g   (test for warnings, line 15)
>> FAIL: g++.dg/torture/pr34850.C   -Os   (test for warnings, line 15)
>>
>> 2) this test is somehow hard to fix as it requires some unreachability.
> 
> Can't we add a return statement to memset?

Does not help :)

> 
> Also, this testcase seems to indicate a danger from this patch, like
> we've seen before with bounds checking: if we have a checking path
> that complains about invalid arguments and then has undefined
> behavior, we optimize away the diagnostic.  Can we warn in such cases?

Good question, can you please provide more info how that happens? Do we have an example for that?

>   We probably want to provide a way to turn off this behavior.
> 
> If we're going to enable this by default, we probably also want
> -Wreturn-type on by default.

Agree.

Thanks,
Martin

> 
> Jason
> 

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH][RFC] Instrument function exit with __builtin_unreachable in C++.
  2017-10-05 16:53   ` Martin Liška
@ 2017-10-11 14:04     ` Martin Liška
  2017-10-11 15:31     ` Jason Merrill
  1 sibling, 0 replies; 64+ messages in thread
From: Martin Liška @ 2017-10-11 14:04 UTC (permalink / raw)
  To: Jason Merrill; +Cc: gcc-patches List, Jakub Jelinek, Jonathan Wakely

[-- Attachment #1: Type: text/plain, Size: 407 bytes --]

On 10/05/2017 06:53 PM, Martin Liška wrote:
>>  We probably want to provide a way to turn off this behavior.
>>
>> If we're going to enable this by default, we probably also want
>> -Wreturn-type on by default.
> 
> Agree.

Hi.

So turning on the warning by default for c++, we get about 500 failing test-cases. Uf :/

Martin

[-- Attachment #2: wreturn-type-fallout.txt --]
[-- Type: text/plain, Size: 13487 bytes --]

c-c++-common/asan/pr63638.c
c-c++-common/goacc/parallel-1.c
c-c++-common/gomp/sink-1.c
c-c++-common/missing-symbol.c
c-c++-common/pr36513-2.c
c-c++-common/pr36513.c
c-c++-common/pr49706-2.c
c-c++-common/pr65120.c
c-c++-common/tm/volatile-1.c
c-c++-common/tsan/race_on_mutex.c
c-c++-common/ubsan/pr71512-1.c
c-c++-common/vector-1.c
c-c++-common/vector-2.c
c-c++-common/Wimplicit-fallthrough-8.c
g++.dg/abi/abi-tag14.C
g++.dg/abi/abi-tag18a.C
g++.dg/abi/abi-tag18.C
g++.dg/abi/covariant2.C
g++.dg/abi/covariant3.C
g++.dg/abi/mangle7.C
g++.dg/asan/pr81340.C
g++.dg/concepts/fn8.C
g++.dg/concepts/pr65575.C
g++.dg/concepts/template-parm11.C
g++.dg/conversion/op6.C
g++.dg/cpp0x/access01.C
g++.dg/cpp0x/alignas3.C
g++.dg/cpp0x/auto2.C
g++.dg/cpp0x/constexpr-array17.C
g++.dg/cpp0x/constexpr-defarg2.C
g++.dg/cpp0x/constexpr-diag3.C
g++.dg/cpp0x/constexpr-memfn1.C
g++.dg/cpp0x/constexpr-neg3.C
g++.dg/cpp0x/dc1.C
g++.dg/cpp0x/dc3.C
g++.dg/cpp0x/decltype12.C
g++.dg/cpp0x/decltype17.C
g++.dg/cpp0x/decltype3.C
g++.dg/cpp0x/decltype41.C
g++.dg/cpp0x/defaulted28.C
g++.dg/cpp0x/enum_base3.C
g++.dg/cpp0x/gen-attrs-4.C
g++.dg/cpp0x/initlist96.C
g++.dg/cpp0x/lambda/lambda-58566.C
g++.dg/cpp0x/lambda/lambda-conv10.C
g++.dg/cpp0x/lambda/lambda-conv12.C
g++.dg/cpp0x/lambda/lambda-defarg3.C
g++.dg/cpp0x/lambda/lambda-ice3.C
g++.dg/cpp0x/lambda/lambda-ice5.C
g++.dg/cpp0x/lambda/lambda-nested2.C
g++.dg/cpp0x/lambda/lambda-template12.C
g++.dg/cpp0x/lambda/lambda-template2.C
g++.dg/cpp0x/lambda/lambda-this12.C
g++.dg/cpp0x/nolinkage1.C
g++.dg/cpp0x/nsdmi-template5.C
g++.dg/cpp0x/parse1.C
g++.dg/cpp0x/pr34054.C
g++.dg/cpp0x/pr47416.C
g++.dg/cpp0x/pr58781.C
g++.dg/cpp0x/pr70538.C
g++.dg/cpp0x/pr81325.C
g++.dg/cpp0x/range-for13.C
g++.dg/cpp0x/range-for14.C
g++.dg/cpp0x/rv2n.C
g++.dg/cpp0x/rv3n.C
g++.dg/cpp0x/static_assert10.C
g++.dg/cpp0x/static_assert11.C
g++.dg/cpp0x/static_assert12.C
g++.dg/cpp0x/static_assert13.C
g++.dg/cpp0x/trailing1.C
g++.dg/cpp0x/trailing5.C
g++.dg/cpp0x/variadic114.C
g++.dg/cpp0x/variadic57.C
g++.dg/cpp0x/variadic65.C
g++.dg/cpp0x/variadic66.C
g++.dg/cpp0x/variadic97.C
g++.dg/cpp0x/variadic98.C
g++.dg/cpp0x/Wunused-variable-1.C
g++.dg/cpp1y/auto-fn11.C
g++.dg/cpp1y/auto-fn29.C
g++.dg/cpp1y/auto-fn38.C
g++.dg/cpp1y/constexpr-return2.C
g++.dg/cpp1y/lambda-init7.C
g++.dg/cpp1y/pr63996.C
g++.dg/cpp1y/pr65202.C
g++.dg/cpp1y/pr66443-cxx14.C
g++.dg/cpp1y/pr79253.C
g++.dg/cpp1y/static_assert1.C
g++.dg/cpp1y/static_assert2.C
g++.dg/cpp1y/var-templ44.C
g++.dg/cpp1z/fold6.C
g++.dg/cpp1z/inline-var2.C
g++.dg/cpp1z/lambda-this1.C
g++.dg/cpp1z/static_assert-nomsg.C
g++.dg/debug/dwarf2/dwarf4-typedef.C
g++.dg/debug/dwarf2/icf.C
g++.dg/debug/dwarf2/pr61433.C
g++.dg/debug/dwarf-eh-personality-1.C
g++.dg/debug/nullptr01.C
g++.dg/debug/pr16792.C
g++.dg/debug/pr46241.C
g++.dg/debug/pr46338.C
g++.dg/debug/pr47106.C
g++.dg/debug/pr71057.C
g++.dg/debug/pr71432.C
g++.dg/debug/pr80461.C
g++.dg/dfp/44473-1.C
g++.dg/dfp/44473-2.C
g++.dg/eh/builtin1.C
g++.dg/eh/builtin2.C
g++.dg/eh/builtin3.C
g++.dg/eh/pr45569.C
g++.dg/eh/unwind2.C
g++.dg/expr/bitfield11.C
g++.dg/expr/static_cast7.C
g++.dg/ext/altivec-14.C
g++.dg/ext/asm13.C
g++.dg/ext/builtin-object-size3.C
g++.dg/ext/has_nothrow_assign_odr.C
g++.dg/ext/label7.C
g++.dg/ext/label8.C
g++.dg/ext/tmplattr7.C
g++.dg/ext/vector8.C
g++.dg/ext/visibility/anon1.C
g++.dg/ext/visibility/anon2.C
g++.dg/ext/visibility/namespace1.C
g++.dg/ext/vla16.C
g++.dg/goacc/reference.C
g++.dg/gomp/pr37189.C
g++.dg/gomp/pr39495-1.C
g++.dg/gomp/pr39495-2.C
g++.dg/gomp/pr41429.C
g++.dg/gomp/pr82054.C
g++.dg/inherit/covariant10.C
g++.dg/inherit/covariant11.C
g++.dg/inherit/protected1.C
g++.dg/init/inline1.C
g++.dg/init/new18.C
g++.dg/init/reference2.C
g++.dg/init/reference3.C
g++.dg/init/switch1.C
g++.dg/ipa/devirt-10.C
g++.dg/ipa/devirt-13.C
g++.dg/ipa/devirt-14.C
g++.dg/ipa/devirt-15.C
g++.dg/ipa/devirt-16.C
g++.dg/ipa/devirt-17.C
g++.dg/ipa/devirt-18.C
g++.dg/ipa/devirt-19.C
g++.dg/ipa/devirt-21.C
g++.dg/ipa/devirt-23.C
g++.dg/ipa/devirt-38.C
g++.dg/ipa/devirt-40.C
g++.dg/ipa/devirt-41.C
g++.dg/ipa/devirt-42.C
g++.dg/ipa/devirt-44.C
g++.dg/ipa/devirt-45.C
g++.dg/ipa/devirt-48.C
g++.dg/ipa/devirt-52.C
g++.dg/ipa/nothrow-1.C
g++.dg/ipa/pr43812.C
g++.dg/ipa/pr44372.C
g++.dg/ipa/pr45572-1.C
g++.dg/ipa/pr58371.C
g++.dg/ipa/pr59176.C
g++.dg/ipa/pr60640-1.C
g++.dg/ipa/pr61540.C
g++.dg/ipa/pr63470.C
g++.dg/ipa/pr63587-1.C
g++.dg/ipa/pr63587-2.C
g++.dg/ipa/pr63838.C
g++.dg/ipa/pr63894.C
g++.dg/ipa/pr64068.C
g++.dg/ipa/pr64896.C
g++.dg/ipa/pr65002.C
g++.dg/ipa/pr65008.C
g++.dg/ipa/pr65465.C
g++.dg/ipa/pr66896.C
g++.dg/ipa/pr68851.C
g++.dg/ipa/pr78211.C
g++.dg/ipa/pr79931.C
g++.dg/ipa/pure-const-1.C
g++.dg/ipa/pure-const-2.C
g++.dg/ipa/pure-const-3.C
g++.dg/ipa/remref-1.C
g++.dg/ipa/remref-2.C
g++.dg/lookup/builtin2.C
g++.dg/lookup/crash3.C
g++.dg/lookup/friend20.C
g++.dg/lookup/pr80891-5.C
g++.dg/lookup/struct2.C
g++.dg/lto/20080709
g++.dg/lto/20080907
g++.dg/lto/20080915
g++.dg/lto/20080916
g++.dg/lto/20081022
g++.dg/lto/20081023
g++.dg/lto/20081118
g++.dg/lto/20081120-1
g++.dg/lto/20081127
g++.dg/lto/20081217-2
g++.dg/lto/20090303
g++.dg/lto/20090311-1
g++.dg/lto/20090312
g++.dg/lto/20090315
g++.dg/lto/20091002-1
g++.dg/lto/20091002-2
g++.dg/lto/20091002-3
g++.dg/lto/20091004-1
g++.dg/lto/20091004-2
g++.dg/lto/20091004-3
g++.dg/lto/20100721-1
g++.dg/lto/20101010-1
g++.dg/lto/20101010-2
g++.dg/lto/pr45679-1
g++.dg/lto/pr45679-2
g++.dg/lto/pr48042
g++.dg/lto/pr51650-1
g++.dg/lto/pr51650-3
g++.dg/lto/pr63270
g++.dg/lto/pr65193
g++.dg/lto/pr65302
g++.dg/lto/pr65316
g++.dg/lto/pr65475c
g++.dg/lto/pr65549
g++.dg/lto/pr69077
g++.dg/lto/pr69589
g++.dg/opt/combine.C
g++.dg/opt/complex3.C
g++.dg/opt/covariant1.C
g++.dg/opt/declone3.C
g++.dg/opt/dump1.C
g++.dg/opt/inline15.C
g++.dg/opt/local1.C
g++.dg/opt/memcpy1.C
g++.dg/opt/new1.C
g++.dg/opt/nrv8.C
g++.dg/opt/pr23299.C
g++.dg/opt/pr27826.C
g++.dg/opt/pr44919.C
g++.dg/opt/pr47615.C
g++.dg/opt/pr55329.C
g++.dg/opt/pr61456.C
g++.dg/opt/pr65003.C
g++.dg/opt/pr65554.C
g++.dg/opt/pr69432.C
g++.dg/opt/pr78373.C
g++.dg/opt/pr79267.C
g++.dg/other/array3.C
g++.dg/other/crash-5.C
g++.dg/other/crash-8.C
g++.dg/other/error34.C
g++.dg/other/pr22003.C
g++.dg/other/pr24623.C
g++.dg/other/pr29610.C
g++.dg/other/pr42645-1.C
g++.dg/other/pr42645-2.C
g++.dg/other/pr52048.C
g++.dg/other/typedef3.C
g++.dg/overload/defarg4.C
g++.dg/overload/operator5.C
g++.dg/overload/ref-conv1.C
g++.dg/overload/template5.C
g++.dg/parse/crash40.C
g++.dg/parse/crash61.C
g++.dg/parse/crash67.C
g++.dg/parse/ctor5.C
g++.dg/parse/defarg4.C
g++.dg/parse/defarg6.C
g++.dg/parse/error5.C
g++.dg/parse/expr2.C
g++.dg/parse/friend7.C
g++.dg/parse/namespace1.C
g++.dg/parse/namespace9.C
g++.dg/parse/ret-type2.C
g++.dg/parse/typedef8.C
g++.dg/pch/static-1.C
g++.dg/plugin/diagnostic-test-expressions-1.C
g++.dg/plugin/dumb-plugin-test-1.C
g++.dg/plugin/self-assign-test-1.C
g++.dg/plugin/self-assign-test-2.C
g++.dg/plugin/self-assign-test-3.C
g++.dg/pr55513.C
g++.dg/pr55604.C
g++.dg/pr57662.C
g++.dg/pr58389.C
g++.dg/pr59510.C
g++.dg/pr67989.C
g++.dg/pr70590-2.C
g++.dg/pr70590.C
g++.dg/pr70965.C
g++.dg/pr77550.C
g++.dg/pr80287.C
g++.dg/pr80707.C
g++.dg/pr81194.C
g++.dg/spellcheck-identifiers.C
g++.dg/tc1/dr152.C
g++.dg/template/aggr-init1.C
g++.dg/template/anon1.C
g++.dg/template/array29.C
g++.dg/template/array7.C
g++.dg/template/canon-type-8.C
g++.dg/template/conv1.C
g++.dg/template/crash107.C
g++.dg/template/crash23.C
g++.dg/template/crash8.C
g++.dg/template/defarg4.C
g++.dg/template/dependent-expr9.C
g++.dg/template/error10.C
g++.dg/template/friend32.C
g++.dg/template/init6.C
g++.dg/template/memfriend7.C
g++.dg/template/new10.C
g++.dg/template/nontype12.C
g++.dg/template/overload12.C
g++.dg/template/overload5.C
g++.dg/template/overload8.C
g++.dg/template/partial10.C
g++.dg/template/partial9.C
g++.dg/template/qual1.C
g++.dg/template/show-template-tree-3.C
g++.dg/template/sizeof8.C
g++.dg/template/sizeof9.C
g++.dg/template/spec6.C
g++.dg/template/spec7.C
g++.dg/template/typedef8.C
g++.dg/template/using20.C
g++.dg/template/vla1.C
g++.dg/tm/cgraph_edge.C
g++.dg/tm/pr46646.C
g++.dg/tm/pr47554.C
g++.dg/tm/pr47573.C
g++.dg/tm/unsafe1.C
g++.dg/tm/unsafe2.C
g++.dg/torture/20070621-1.C
g++.dg/torture/20090329-1.C
g++.dg/torture/20141013.C
g++.dg/torture/pr33134.C
g++.dg/torture/pr33340.C
g++.dg/torture/pr33627.C
g++.dg/torture/pr34222.C
g++.dg/torture/pr34241.C
g++.dg/torture/pr34641.C
g++.dg/torture/pr34850.C
g++.dg/torture/pr35164-1.C
g++.dg/torture/pr36745.C
g++.dg/torture/pr38705.C
g++.dg/torture/pr38811.C
g++.dg/torture/pr39362.C
g++.dg/torture/pr39732.C
g++.dg/torture/pr40991.C
g++.dg/torture/pr41775.C
g++.dg/torture/pr42183.C
g++.dg/torture/pr42450.C
g++.dg/torture/pr42704.C
g++.dg/torture/pr42760.C
g++.dg/torture/pr42773.C
g++.dg/torture/pr42883.C
g++.dg/torture/pr43905.C
g++.dg/torture/pr44148.C
g++.dg/torture/pr44295.C
g++.dg/torture/pr44357.C
g++.dg/torture/pr44813.C
g++.dg/torture/pr45580.C
g++.dg/torture/pr45874.C
g++.dg/torture/pr45877.C
g++.dg/torture/pr46383.C
g++.dg/torture/pr46469.C
g++.dg/torture/pr47313.C
g++.dg/torture/pr48271.C
g++.dg/torture/pr49615.C
g++.dg/torture/pr49770.C
g++.dg/torture/pr49938.C
g++.dg/torture/pr51436.C
g++.dg/torture/pr51482.C
g++.dg/torture/pr51737.C
g++.dg/torture/pr51959.C
g++.dg/torture/pr52772.C
g++.dg/torture/pr52918-2.C
g++.dg/torture/pr53011.C
g++.dg/torture/pr53602.C
g++.dg/torture/pr53752.C
g++.dg/torture/pr54838.C
g++.dg/torture/pr54902.C
g++.dg/torture/pr56029.C
g++.dg/torture/pr56768.C
g++.dg/torture/pr57107.C
g++.dg/torture/pr57140.C
g++.dg/torture/pr57235.C
g++.dg/torture/pr58252.C
g++.dg/torture/pr58555.C
g++.dg/torture/pr59208.C
g++.dg/torture/pr60438-1.C
g++.dg/torture/pr60438-2.C
g++.dg/torture/pr60746.C
g++.dg/torture/pr61554.C
g++.dg/torture/pr63419.C
g++.dg/torture/pr63476.C
g++.dg/torture/pr63512.C
g++.dg/torture/pr64282.C
g++.dg/torture/pr64378.C
g++.dg/torture/pr64565.C
g++.dg/torture/pr64568-2.C
g++.dg/torture/pr64669.C
g++.dg/torture/pr64686.C
g++.dg/torture/pr64978.C
g++.dg/torture/pr64995.C
g++.dg/torture/pr65655.C
g++.dg/torture/pr65851.C
g++.dg/torture/pr67055.C
g++.dg/torture/pr67191.C
g++.dg/torture/pr68852.C
g++.dg/torture/pr69264.C
g++.dg/torture/pr77674.C
g++.dg/torture/pr77947.C
g++.dg/torture/pr78268.C
g++.dg/torture/pr78507.C
g++.dg/torture/pr78692.C
g++.dg/torture/pr80171.C
g++.dg/torture/pr82154.C
g++.dg/tree-ssa/copyprop.C
g++.dg/tree-ssa/pr22444.C
g++.dg/tree-ssa/pr23948.C
g++.dg/tree-ssa/pr24172.C
g++.dg/tree-ssa/pr24351-3.C
g++.dg/tree-ssa/pr27283.C
g++.dg/tree-ssa/pr27291.C
g++.dg/tree-ssa/pr27548.C
g++.dg/tree-ssa/pr34355.C
g++.dg/tree-ssa/pr42337.C
g++.dg/tree-ssa/pred-1.C
g++.dg/ubsan/pr63956.C
g++.dg/ubsan/pr65019.C
g++.dg/ubsan/pr65583.C
g++.dg/vect/pr60836.cc
g++.dg/vect/pr68145.cc
g++.dg/vect/pr70729.cc
g++.dg/vect/pr70729-nest.cc
g++.dg/warn/pmf1.C
g++.dg/warn/Waddress-3.C
g++.dg/warn/Wconversion-null-2.C
g++.dg/warn/Wnull-conversion-2.C
g++.dg/warn/Wparentheses-10.C
g++.dg/warn/Wparentheses-11.C
g++.dg/warn/Wparentheses-12.C
g++.dg/warn/Wparentheses-25.C
g++.dg/warn/Wparentheses-6.C
g++.dg/warn/Wparentheses-7.C
g++.dg/warn/Wparentheses-8.C
g++.dg/warn/Wparentheses-9.C
g++.dg/warn/Wshadow-5.C
g++.dg/warn/Wtype-limits.C
g++.dg/warn/Wtype-limits-no.C
g++.dg/warn/Wtype-limits-Wextra.C
g++.dg/warn/Wunused-local-typedefs.C
g++.dg/warn/Wzero-as-null-pointer-constant-5.C
g++.old-deja/g++.benjamin/p13417.C
g++.old-deja/g++.brendan/crash24.C
g++.old-deja/g++.ext/constructor.C
g++.old-deja/g++.ext/namedret1.C
g++.old-deja/g++.ext/namedret3.C
g++.old-deja/g++.ext/return1.C
g++.old-deja/g++.jason/anon4.C
g++.old-deja/g++.jason/enum6.C
g++.old-deja/g++.jason/lineno2.C
g++.old-deja/g++.jason/lineno3.C
g++.old-deja/g++.jason/lineno4.C
g++.old-deja/g++.jason/new2.C
g++.old-deja/g++.jason/new4.C
g++.old-deja/g++.jason/shadow1.C
g++.old-deja/g++.jason/tempcons.C
g++.old-deja/g++.jason/thunk2.C
g++.old-deja/g++.law/builtin1.C
g++.old-deja/g++.law/enum9.C
g++.old-deja/g++.law/except3.C
g++.old-deja/g++.law/init6.C
g++.old-deja/g++.law/profile1.C
g++.old-deja/g++.law/shadow2.C
g++.old-deja/g++.law/temps4.C
g++.old-deja/g++.mike/bool2.C
g++.old-deja/g++.mike/eh10.C
g++.old-deja/g++.mike/eh13.C
g++.old-deja/g++.mike/eh16.C
g++.old-deja/g++.mike/eh17.C
g++.old-deja/g++.mike/eh1.C
g++.old-deja/g++.mike/eh23.C
g++.old-deja/g++.mike/eh24.C
g++.old-deja/g++.mike/eh25.C
g++.old-deja/g++.mike/eh26.C
g++.old-deja/g++.mike/eh27.C
g++.old-deja/g++.mike/eh28.C
g++.old-deja/g++.mike/eh29.C
g++.old-deja/g++.mike/eh2.C
g++.old-deja/g++.mike/eh30.C
g++.old-deja/g++.mike/eh31.C
g++.old-deja/g++.mike/eh35.C
g++.old-deja/g++.mike/eh36.C
g++.old-deja/g++.mike/eh37.C
g++.old-deja/g++.mike/eh38.C
g++.old-deja/g++.mike/eh39.C
g++.old-deja/g++.mike/eh40.C
g++.old-deja/g++.mike/eh47.C
g++.old-deja/g++.mike/eh50.C
g++.old-deja/g++.mike/eh51.C
g++.old-deja/g++.mike/eh7.C
g++.old-deja/g++.mike/eh8.C
g++.old-deja/g++.mike/eh9.C
g++.old-deja/g++.mike/mangle1.C
g++.old-deja/g++.mike/p5958.C
g++.old-deja/g++.mike/p6004.C
g++.old-deja/g++.mike/p700.C
g++.old-deja/g++.mike/p7912.C
g++.old-deja/g++.mike/p811.C
g++.old-deja/g++.mike/virt4.C
g++.old-deja/g++.oliva/nameret1.C
g++.old-deja/g++.oliva/nameret2.C
g++.old-deja/g++.other/decl1.C
g++.old-deja/g++.other/expr1.C
g++.old-deja/g++.other/inline8.C
g++.old-deja/g++.other/loop1.C
g++.old-deja/g++.other/syntax1.C
g++.old-deja/g++.pt/repo3.C
g++.old-deja/g++.robertl/eb27.C
g++.old-deja/g++.robertl/eb83.C
obj-c++.dg/comp-types-8.mm
obj-c++.dg/demangle-3.mm
obj-c++.dg/super-class-1.mm

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH][RFC] Instrument function exit with __builtin_unreachable in C++.
  2017-10-05 16:53   ` Martin Liška
  2017-10-11 14:04     ` Martin Liška
@ 2017-10-11 15:31     ` Jason Merrill
  2017-10-12  8:48       ` Martin Liška
  1 sibling, 1 reply; 64+ messages in thread
From: Jason Merrill @ 2017-10-11 15:31 UTC (permalink / raw)
  To: Martin Liška; +Cc: gcc-patches List, Jakub Jelinek, Jonathan Wakely

On Thu, Oct 5, 2017 at 12:53 PM, Martin Liška <mliska@suse.cz> wrote:
> On 10/05/2017 05:07 PM, Jason Merrill wrote:
>> On Thu, Oct 5, 2017 at 6:31 AM, Martin Liška <mliska@suse.cz> wrote:
>>> As discussed 2 days ago on IRC with Jakub and Jonathan, C++ standard says
>>> that having a non-return
>>> function with missing return statement is undefined behavior. We've got
>>> -fsanitize=return check for
>>> that and we can in such case instrument __builtin_unreachable(). This
>>> patch does that.
>>
>>
>> Great.
>>
>>> And there's still some fallout:
>>>
>>> FAIL: g++.dg/cpp0x/constexpr-diag3.C  -std=c++11  (test for errors, line
>>> 7)
>>> FAIL: g++.dg/cpp0x/constexpr-neg3.C  -std=c++11  (test for errors, line
>>> 12)
>>> FAIL: g++.dg/cpp1y/constexpr-return2.C  -std=c++14  (test for errors,
>>> line 7)
>>> FAIL: g++.dg/cpp1y/constexpr-return2.C  -std=c++14 (test for excess
>>> errors)
>>> FAIL: g++.dg/cpp1y/pr63996.C  -std=c++14  (test for errors, line 9)
>>> FAIL: g++.dg/cpp1y/pr63996.C  -std=c++14 (test for excess errors)
>>>
>>> 1) there are causing:
>>>
>>> ./xg++ -B.
>>> /home/marxin/Programming/gcc/gcc/testsuite/g++.dg/cpp1y/pr63996.C
>>> /home/marxin/Programming/gcc/gcc/testsuite/g++.dg/cpp1y/pr63996.C:9:23:
>>> in constexpr expansion of ‘foo(1)’
>>> /home/marxin/Programming/gcc/gcc/testsuite/g++.dg/cpp1y/pr63996.C:4:1:
>>> error: ‘__builtin_unreachable()’ is not a constant expression
>>>   foo (int i)
>>>   ^~~
>>>
>>> Where we probably should not emit the built-in call. Am I right?
>>
>>
>> Or constexpr.c could give a more friendly diagnostic for
>> __builtin_unreachable.  It's correct to give a diagnostic here for
>> this testcase.
>
>
> Hi.
>
> That's good idea, any suggestion different from:
>
> ./xg++ -B.
> /home/marxin/Programming/gcc2/gcc/testsuite/g++.dg/cpp1y/pr63996.C
> /home/marxin/Programming/gcc2/gcc/testsuite/g++.dg/cpp1y/pr63996.C:9:23:
> in constexpr expansion of ‘foo(1)’
> <built-in>: error: constexpr can't contain call of a non-return function
> ‘__builtin_unreachable’
>
> which is probably misleading as it points to a function call that is
> actually missing in source code.
> Should we distinguish between implicit and explicit __builtin_unreachable?

Probably without your change the constexpr code already diagnoses the
missing return as "constexpr call flows off the end of the function";
that same message seems appropriate.

> So turning on the warning by default for c++, we get about 500 failing test-cases. Uf :/

Yes, we've been sloppy about this in the testsuite.  :(

Jason

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH][RFC] Instrument function exit with __builtin_unreachable in C++.
  2017-10-11 15:31     ` Jason Merrill
@ 2017-10-12  8:48       ` Martin Liška
  2017-10-12  9:36         ` Jakub Jelinek
  2017-10-12 12:57         ` [PATCH][RFC] Instrument function exit with __builtin_unreachable in C++ Jason Merrill
  0 siblings, 2 replies; 64+ messages in thread
From: Martin Liška @ 2017-10-12  8:48 UTC (permalink / raw)
  To: Jason Merrill; +Cc: gcc-patches List, Jakub Jelinek, Jonathan Wakely

[-- Attachment #1: Type: text/plain, Size: 3169 bytes --]

On 10/11/2017 04:59 PM, Jason Merrill wrote:
> On Thu, Oct 5, 2017 at 12:53 PM, Martin Liška <mliska@suse.cz> wrote:
>> On 10/05/2017 05:07 PM, Jason Merrill wrote:
>>> On Thu, Oct 5, 2017 at 6:31 AM, Martin Liška <mliska@suse.cz> wrote:
>>>> As discussed 2 days ago on IRC with Jakub and Jonathan, C++ standard says
>>>> that having a non-return
>>>> function with missing return statement is undefined behavior. We've got
>>>> -fsanitize=return check for
>>>> that and we can in such case instrument __builtin_unreachable(). This
>>>> patch does that.
>>>
>>>
>>> Great.
>>>
>>>> And there's still some fallout:
>>>>
>>>> FAIL: g++.dg/cpp0x/constexpr-diag3.C  -std=c++11  (test for errors, line
>>>> 7)
>>>> FAIL: g++.dg/cpp0x/constexpr-neg3.C  -std=c++11  (test for errors, line
>>>> 12)
>>>> FAIL: g++.dg/cpp1y/constexpr-return2.C  -std=c++14  (test for errors,
>>>> line 7)
>>>> FAIL: g++.dg/cpp1y/constexpr-return2.C  -std=c++14 (test for excess
>>>> errors)
>>>> FAIL: g++.dg/cpp1y/pr63996.C  -std=c++14  (test for errors, line 9)
>>>> FAIL: g++.dg/cpp1y/pr63996.C  -std=c++14 (test for excess errors)
>>>>
>>>> 1) there are causing:
>>>>
>>>> ./xg++ -B.
>>>> /home/marxin/Programming/gcc/gcc/testsuite/g++.dg/cpp1y/pr63996.C
>>>> /home/marxin/Programming/gcc/gcc/testsuite/g++.dg/cpp1y/pr63996.C:9:23:
>>>> in constexpr expansion of ‘foo(1)’
>>>> /home/marxin/Programming/gcc/gcc/testsuite/g++.dg/cpp1y/pr63996.C:4:1:
>>>> error: ‘__builtin_unreachable()’ is not a constant expression
>>>>   foo (int i)
>>>>   ^~~
>>>>
>>>> Where we probably should not emit the built-in call. Am I right?
>>>
>>>
>>> Or constexpr.c could give a more friendly diagnostic for
>>> __builtin_unreachable.  It's correct to give a diagnostic here for
>>> this testcase.
>>
>>
>> Hi.
>>
>> That's good idea, any suggestion different from:
>>
>> ./xg++ -B.
>> /home/marxin/Programming/gcc2/gcc/testsuite/g++.dg/cpp1y/pr63996.C
>> /home/marxin/Programming/gcc2/gcc/testsuite/g++.dg/cpp1y/pr63996.C:9:23:
>> in constexpr expansion of ‘foo(1)’
>> <built-in>: error: constexpr can't contain call of a non-return function
>> ‘__builtin_unreachable’
>>
>> which is probably misleading as it points to a function call that is
>> actually missing in source code.
>> Should we distinguish between implicit and explicit __builtin_unreachable?
> 
> Probably without your change the constexpr code already diagnoses the
> missing return as "constexpr call flows off the end of the function";
> that same message seems appropriate.

Hello.

Ok, I've done that. Sending patch candidate.

> 
>> So turning on the warning by default for c++, we get about 500 failing test-cases. Uf :/
> 
> Yes, we've been sloppy about this in the testsuite.  :(

I'll fix it. For being sure, I'm sending first part where I demonstrate how I plan to change
tests, with following preference:

1) change function to void type if possible
2) return a default value for functions not returning a value (for complex return value of a type A:
   I do { static A a; return a; } is it appropriate?

Thanks for feedback. If it's fine, then I'll carry on.


Martin

> 
> Jason
> 


[-- Attachment #2: 0001-Instrument-function-exit-with-__builtin_unreachable-.patch --]
[-- Type: text/x-patch, Size: 5050 bytes --]

From 56c6520d86cba32d04cdbd8873243a7ab801975f Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Thu, 12 Oct 2017 10:14:59 +0200
Subject: [PATCH] Instrument function exit with __builtin_unreachable in C++

gcc/c-family/ChangeLog:

2017-10-12  Martin Liska  <mliska@suse.cz>

	PR middle-end/82404
	* c-opts.c (c_common_post_options): Set -Wreturn-type for C++
	FE.
	* c.opt: Set default value of warn_return_type.

gcc/cp/ChangeLog:

2017-10-12  Martin Liska  <mliska@suse.cz>

	PR middle-end/82404
	* constexpr.c (cxx_eval_builtin_function_call): Handle
	__builtin_unreachable call.
	* cp-gimplify.c (cp_ubsan_maybe_instrument_return): Rename to
	...
	(cp_maybe_instrument_return): ... this.
	(cp_genericize): Call the function unconditionally.

gcc/fortran/ChangeLog:

2017-10-12  Martin Liska  <mliska@suse.cz>

	PR middle-end/82404
	* options.c (gfc_post_options): Set default value of
	-Wreturn-type to false.
---
 gcc/c-family/c-opts.c |  3 +++
 gcc/c-family/c.opt    |  2 +-
 gcc/cp/constexpr.c    |  7 ++++++-
 gcc/cp/cp-gimplify.c  | 18 ++++++++++++------
 gcc/fortran/options.c |  3 +++
 5 files changed, 25 insertions(+), 8 deletions(-)

diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
index 3662aa37be6..afea6a3dca3 100644
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -978,6 +978,9 @@ c_common_post_options (const char **pfilename)
 	flag_extern_tls_init = 1;
     }
 
+  if (warn_return_type == -1)
+    warn_return_type = c_dialect_cxx () ? 1 : 0;
+
   if (num_in_fnames > 1)
     error ("too many filenames given.  Type %s --help for usage",
 	   progname);
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index 13d2a59b8a5..e26fba734c0 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -960,7 +960,7 @@ C++ ObjC++ Var(warn_reorder) Warning LangEnabledBy(C++ ObjC++,Wall)
 Warn when the compiler reorders code.
 
 Wreturn-type
-C ObjC C++ ObjC++ Var(warn_return_type) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
+C ObjC C++ ObjC++ Var(warn_return_type) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall) Init(-1)
 Warn whenever a function's return type defaults to \"int\" (C), or about inconsistent return types (C++).
 
 Wscalar-storage-order
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index 8a5be2079d8..cf935902216 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -1175,7 +1175,12 @@ cxx_eval_builtin_function_call (const constexpr_ctx *ctx, tree t, tree fun,
 	{
 	  new_call = build_call_array_loc (EXPR_LOCATION (t), TREE_TYPE (t),
 					   CALL_EXPR_FN (t), nargs, args);
-	  error ("%q+E is not a constant expression", new_call);
+
+	  /* Do not allow__builtin_unreachable in constexpr function.  */
+	  if (DECL_FUNCTION_CODE (fun) == BUILT_IN_UNREACHABLE)
+	    error ("constexpr call flows off the end of the function");
+	  else
+	    error ("%q+E is not a constant expression", new_call);
 	}
       *non_constant_p = true;
       return t;
diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c
index 262485a5c1f..0bf8f567d5b 100644
--- a/gcc/cp/cp-gimplify.c
+++ b/gcc/cp/cp-gimplify.c
@@ -1556,10 +1556,11 @@ cp_genericize_tree (tree* t_p, bool handle_invisiref_parm_p)
 
 /* If a function that should end with a return in non-void
    function doesn't obviously end with return, add ubsan
-   instrumentation code to verify it at runtime.  */
+   instrumentation code to verify it at runtime.  If -fsanitize=return
+   is not enabled, instrument __builtin_unreachable.  */
 
 static void
-cp_ubsan_maybe_instrument_return (tree fndecl)
+cp_maybe_instrument_return (tree fndecl)
 {
   if (VOID_TYPE_P (TREE_TYPE (TREE_TYPE (fndecl)))
       || DECL_CONSTRUCTOR_P (fndecl)
@@ -1600,7 +1601,14 @@ cp_ubsan_maybe_instrument_return (tree fndecl)
   tree *p = &DECL_SAVED_TREE (fndecl);
   if (TREE_CODE (*p) == BIND_EXPR)
     p = &BIND_EXPR_BODY (*p);
-  t = ubsan_instrument_return (DECL_SOURCE_LOCATION (fndecl));
+
+  location_t loc = DECL_SOURCE_LOCATION (fndecl);
+  if (sanitize_flags_p (SANITIZE_RETURN, fndecl))
+    t = ubsan_instrument_return (loc);
+  else
+    t = build_call_expr_loc (loc, builtin_decl_explicit (BUILT_IN_UNREACHABLE),
+			     0);
+
   append_to_statement_list (t, p);
 }
 
@@ -1674,9 +1682,7 @@ cp_genericize (tree fndecl)
      walk_tree's hash functionality.  */
   cp_genericize_tree (&DECL_SAVED_TREE (fndecl), true);
 
-  if (sanitize_flags_p (SANITIZE_RETURN)
-      && current_function_decl != NULL_TREE)
-    cp_ubsan_maybe_instrument_return (fndecl);
+  cp_maybe_instrument_return (fndecl);
 
   /* Do everything else.  */
   c_genericize (fndecl);
diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c
index f7bbd7f2cde..59e7f028b09 100644
--- a/gcc/fortran/options.c
+++ b/gcc/fortran/options.c
@@ -430,6 +430,9 @@ gfc_post_options (const char **pfilename)
     gfc_fatal_error ("Maximum subrecord length cannot exceed %d",
 		     MAX_SUBRECORD_LENGTH);
 
+  if (warn_return_type == -1)
+    warn_return_type = 0;
+
   gfc_cpp_post_options ();
 
   if (gfc_option.allow_std & GFC_STD_F2008)
-- 
2.14.2


[-- Attachment #3: 0001-Fix-test-suite-fallout.patch --]
[-- Type: text/x-patch, Size: 32927 bytes --]

From 50906b825d6b694ca64edf8ec8f0b3a619045708 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Thu, 12 Oct 2017 10:10:51 +0200
Subject: [PATCH] Fix test-suite fallout.

---
 gcc/testsuite/c-c++-common/Wimplicit-fallthrough-8.c  | 12 ++++++------
 gcc/testsuite/c-c++-common/asan/pr63638.c             |  2 +-
 gcc/testsuite/c-c++-common/goacc/parallel-1.c         |  2 ++
 gcc/testsuite/c-c++-common/gomp/sink-1.c              |  2 ++
 gcc/testsuite/c-c++-common/missing-symbol.c           |  3 ++-
 gcc/testsuite/c-c++-common/pr36513.c                  |  2 ++
 gcc/testsuite/c-c++-common/pr49706-2.c                |  2 +-
 gcc/testsuite/c-c++-common/pr65120.c                  |  4 ++--
 gcc/testsuite/c-c++-common/tm/volatile-1.c            |  2 +-
 gcc/testsuite/c-c++-common/vector-1.c                 |  2 +-
 gcc/testsuite/c-c++-common/vector-2.c                 |  2 +-
 gcc/testsuite/g++.dg/abi/abi-tag14.C                  |  8 ++++----
 gcc/testsuite/g++.dg/abi/abi-tag18.C                  |  4 ++++
 gcc/testsuite/g++.dg/abi/abi-tag18a.C                 |  4 ++++
 gcc/testsuite/g++.dg/abi/covariant2.C                 |  4 ++--
 gcc/testsuite/g++.dg/abi/covariant3.C                 |  2 +-
 gcc/testsuite/g++.dg/abi/mangle7.C                    |  2 +-
 gcc/testsuite/g++.dg/asan/pr81340.C                   |  4 ++--
 gcc/testsuite/g++.dg/concepts/fn8.C                   |  2 +-
 gcc/testsuite/g++.dg/concepts/pr65575.C               |  2 +-
 gcc/testsuite/g++.dg/concepts/template-parm11.C       |  2 +-
 gcc/testsuite/g++.dg/conversion/op6.C                 |  6 +++---
 gcc/testsuite/g++.dg/cpp0x/access01.C                 |  2 +-
 gcc/testsuite/g++.dg/cpp0x/alignas3.C                 |  2 +-
 gcc/testsuite/g++.dg/cpp0x/constexpr-array17.C        |  2 ++
 gcc/testsuite/g++.dg/cpp0x/constexpr-defarg2.C        |  5 +++++
 gcc/testsuite/g++.dg/cpp0x/constexpr-memfn1.C         |  4 ++--
 gcc/testsuite/g++.dg/cpp0x/dc1.C                      |  2 +-
 gcc/testsuite/g++.dg/cpp0x/dc3.C                      |  2 +-
 gcc/testsuite/g++.dg/cpp0x/decltype3.C                |  2 +-
 gcc/testsuite/g++.dg/cpp0x/decltype41.C               |  8 ++++----
 gcc/testsuite/g++.dg/cpp0x/defaulted28.C              |  2 +-
 gcc/testsuite/g++.dg/cpp0x/enum_base3.C               |  2 +-
 gcc/testsuite/g++.dg/cpp0x/gen-attrs-4.C              |  2 +-
 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-58566.C      |  1 +
 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv10.C     |  2 +-
 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv12.C     |  2 +-
 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg3.C    |  2 +-
 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice3.C       |  2 ++
 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice5.C       |  1 +
 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested2.C    |  2 +-
 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template12.C |  1 +
 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template2.C  |  2 +-
 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this12.C     |  2 +-
 gcc/testsuite/g++.dg/cpp0x/nsdmi-template5.C          |  6 +++---
 gcc/testsuite/g++.dg/cpp0x/parse1.C                   |  2 +-
 gcc/testsuite/g++.dg/cpp0x/pr34054.C                  |  2 +-
 gcc/testsuite/g++.dg/cpp0x/pr70538.C                  |  2 +-
 gcc/testsuite/g++.dg/cpp0x/pr81325.C                  |  2 +-
 gcc/testsuite/g++.dg/cpp0x/range-for13.C              |  2 ++
 gcc/testsuite/g++.dg/cpp0x/range-for14.C              |  2 ++
 gcc/testsuite/g++.dg/cpp0x/rv2n.C                     |  4 ++++
 gcc/testsuite/g++.dg/cpp0x/rv3n.C                     |  1 +
 gcc/testsuite/g++.dg/cpp0x/static_assert10.C          |  1 +
 gcc/testsuite/g++.dg/cpp0x/static_assert11.C          |  1 +
 gcc/testsuite/g++.dg/cpp0x/static_assert12.C          |  2 +-
 gcc/testsuite/g++.dg/cpp0x/static_assert13.C          |  2 +-
 gcc/testsuite/g++.dg/cpp0x/trailing1.C                |  4 ++--
 gcc/testsuite/g++.dg/cpp0x/trailing5.C                |  4 ++--
 gcc/testsuite/gcc.dg/pr44545.c                        |  2 +-
 60 files changed, 102 insertions(+), 64 deletions(-)

diff --git a/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-8.c b/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-8.c
index 0ed7928fd79..d146c788b74 100644
--- a/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-8.c
+++ b/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-8.c
@@ -4,7 +4,7 @@
 
 extern void grace (int);
 
-int
+void
 fn1 (int i)
 {
   switch (i)
@@ -16,7 +16,7 @@ fn1 (int i)
 done:;
 }
 
-int
+void
 fn2 (int i)
 {
   switch (i)
@@ -32,7 +32,7 @@ fn2 (int i)
 done:;
 }
 
-int
+void
 fn3 (int i)
 {
   switch (i)
@@ -46,7 +46,7 @@ fn3 (int i)
 done:;
 }
 
-int
+void
 fn4 (int i)
 {
   switch (i)
@@ -64,7 +64,7 @@ fn4 (int i)
 done:;
 }
 
-int
+void
 fn5 (int i)
 {
   switch (i)
@@ -83,7 +83,7 @@ fn5 (int i)
 done:;
 }
 
-int
+void
 fn6 (int i)
 {
   switch (i)
diff --git a/gcc/testsuite/c-c++-common/asan/pr63638.c b/gcc/testsuite/c-c++-common/asan/pr63638.c
index a8bafc5aad7..619a2b6142a 100644
--- a/gcc/testsuite/c-c++-common/asan/pr63638.c
+++ b/gcc/testsuite/c-c++-common/asan/pr63638.c
@@ -12,7 +12,7 @@ struct S{
 
 struct S s[6];
 
-int f(struct S *p)
+void f(struct S *p)
 {
   memcpy(p, &s[2], sizeof(*p));
   memcpy(p, &s[1], sizeof(*p));
diff --git a/gcc/testsuite/c-c++-common/goacc/parallel-1.c b/gcc/testsuite/c-c++-common/goacc/parallel-1.c
index 6c6cc88ecad..0afc53adaa8 100644
--- a/gcc/testsuite/c-c++-common/goacc/parallel-1.c
+++ b/gcc/testsuite/c-c++-common/goacc/parallel-1.c
@@ -35,4 +35,6 @@ parallel_clauses (void)
 
 #pragma acc parallel firstprivate (a, b)
   ;
+
+  return 0;
 }
diff --git a/gcc/testsuite/c-c++-common/gomp/sink-1.c b/gcc/testsuite/c-c++-common/gomp/sink-1.c
index 4872a072315..5ee562bfbf7 100644
--- a/gcc/testsuite/c-c++-common/gomp/sink-1.c
+++ b/gcc/testsuite/c-c++-common/gomp/sink-1.c
@@ -93,4 +93,6 @@ baz ()
 	bar (i, j, 0);
 #pragma omp ordered depend(source)
       }
+
+  return 0;
 }
diff --git a/gcc/testsuite/c-c++-common/missing-symbol.c b/gcc/testsuite/c-c++-common/missing-symbol.c
index 33a501b9988..cbcde1f1cae 100644
--- a/gcc/testsuite/c-c++-common/missing-symbol.c
+++ b/gcc/testsuite/c-c++-common/missing-symbol.c
@@ -1,4 +1,4 @@
-/* { dg-options "-fdiagnostics-show-caret" } */
+/* { dg-options "-fdiagnostics-show-caret -Wno-return-type" } */
 
 extern int foo (void);
 extern int bar (void);
@@ -21,6 +21,7 @@ int missing_close_paren_in_switch (int i)
     default:
       return i;
     }
+
 } /* { dg-error "1: expected" } */
   /* { dg-begin-multiline-output "" }
  }
diff --git a/gcc/testsuite/c-c++-common/pr36513.c b/gcc/testsuite/c-c++-common/pr36513.c
index 026325410a1..b8b2d6d8060 100644
--- a/gcc/testsuite/c-c++-common/pr36513.c
+++ b/gcc/testsuite/c-c++-common/pr36513.c
@@ -11,5 +11,7 @@ int main1 ()
 		  && (t) == '\0' 
 		  ? (char *) __rawmemchr (s, t) 
 		  : __builtin_strchr (s, t)));
+
+  return 0;
 }
 
diff --git a/gcc/testsuite/c-c++-common/pr49706-2.c b/gcc/testsuite/c-c++-common/pr49706-2.c
index 09cc9eb1407..30a46c286e0 100644
--- a/gcc/testsuite/c-c++-common/pr49706-2.c
+++ b/gcc/testsuite/c-c++-common/pr49706-2.c
@@ -10,7 +10,7 @@
 
 bool r;
 
-int
+void
 same (int a, int b)
 {
   r = !a == !b;
diff --git a/gcc/testsuite/c-c++-common/pr65120.c b/gcc/testsuite/c-c++-common/pr65120.c
index c9c1f5f7e65..c8762e057d5 100644
--- a/gcc/testsuite/c-c++-common/pr65120.c
+++ b/gcc/testsuite/c-c++-common/pr65120.c
@@ -9,7 +9,7 @@
 
 bool r;
 
-int
+void
 f1 (int a)
 {
   r = !a == 0;
@@ -18,7 +18,7 @@ f1 (int a)
   r = !a != 1;	/* { dg-warning "logical not is only applied to the left hand side of comparison" } */
 }
 
-int
+void
 f2 (int a)
 {
   r = !a > 0;	/* { dg-warning "logical not is only applied to the left hand side of comparison" } */
diff --git a/gcc/testsuite/c-c++-common/tm/volatile-1.c b/gcc/testsuite/c-c++-common/tm/volatile-1.c
index eb3799dd972..40b41803555 100644
--- a/gcc/testsuite/c-c++-common/tm/volatile-1.c
+++ b/gcc/testsuite/c-c++-common/tm/volatile-1.c
@@ -3,7 +3,7 @@
 
 volatile int * p = 0;
 __attribute ((transaction_safe))
-int f() {
+void f() {
   int x = 0;	     // ok: not volatile
   p = &x;	     // ok: the pointer is not volatile
   int i = *p;	     // { dg-error "volatile" "read through volatile glvalue" }
diff --git a/gcc/testsuite/c-c++-common/vector-1.c b/gcc/testsuite/c-c++-common/vector-1.c
index 288dd1e924c..027d1777943 100644
--- a/gcc/testsuite/c-c++-common/vector-1.c
+++ b/gcc/testsuite/c-c++-common/vector-1.c
@@ -8,7 +8,7 @@
 vector float a;
 vector int a1;
 
-int f(void)
+void f(void)
 {
  a =  ~a; /* { dg-error "" } */
  a1 =  ~a1;
diff --git a/gcc/testsuite/c-c++-common/vector-2.c b/gcc/testsuite/c-c++-common/vector-2.c
index e9f40a35892..9db53a88c5f 100644
--- a/gcc/testsuite/c-c++-common/vector-2.c
+++ b/gcc/testsuite/c-c++-common/vector-2.c
@@ -9,7 +9,7 @@ vector int a1;
 vector float b;
 vector int b1;
 
-int f(void)
+void f(void)
 {
  a =  a | b; /* { dg-error "" } */
  a =  a & b; /* { dg-error "" } */
diff --git a/gcc/testsuite/g++.dg/abi/abi-tag14.C b/gcc/testsuite/g++.dg/abi/abi-tag14.C
index a66e6552cba..3017f492cda 100644
--- a/gcc/testsuite/g++.dg/abi/abi-tag14.C
+++ b/gcc/testsuite/g++.dg/abi/abi-tag14.C
@@ -8,20 +8,20 @@ inline namespace __cxx11 __attribute ((abi_tag ("cxx11"))) {
 A a;				// { dg-warning "\"cxx11\"" }
 
 // { dg-final { scan-assembler "_Z1fB5cxx11v" } }
-A f() {}			// { dg-warning "\"cxx11\"" }
+A f() { return a; }		// { dg-warning "\"cxx11\"" }
 
 namespace {
   A a2;
-  A f2() {}
+  A f2() { return a2; }
   struct B: A {};
 }
 
 // { dg-final { scan-assembler "_Z1fPN7__cxx111AE" } }
-A f(A*) {}
+A f(A*) { return a; }
 
 // { dg-final { scan-assembler "_Z1gIN7__cxx111AEET_v" } }
 template <class T> T g() { }
-template <> A g<A>() { }
+template <> A g<A>() { return a; }
 
 // { dg-final { scan-assembler "_Z1vIN7__cxx111AEE" { target c++14 } } }
 #if __cplusplus >= 201402L
diff --git a/gcc/testsuite/g++.dg/abi/abi-tag18.C b/gcc/testsuite/g++.dg/abi/abi-tag18.C
index 89ee737bf57..7963b0c91ba 100644
--- a/gcc/testsuite/g++.dg/abi/abi-tag18.C
+++ b/gcc/testsuite/g++.dg/abi/abi-tag18.C
@@ -11,9 +11,13 @@ inline A1 f() {
   struct T {
     A2 g() {			// { dg-warning "mangled name" }
       static X x;		// { dg-warning "mangled name" }
+      static A2 a2;
+      return a2;
     }
   };
   T().g();
+  static A1 a;
+  return a;
 }
 int main() {
   f();
diff --git a/gcc/testsuite/g++.dg/abi/abi-tag18a.C b/gcc/testsuite/g++.dg/abi/abi-tag18a.C
index f65f629bd94..a0f191e096e 100644
--- a/gcc/testsuite/g++.dg/abi/abi-tag18a.C
+++ b/gcc/testsuite/g++.dg/abi/abi-tag18a.C
@@ -11,9 +11,13 @@ inline A1 f() {
   struct T {
     A2 g() {
       static X x;
+      static A2 a2;
+      return a2;
     }
   };
   T().g();
+  static A1 a;
+  return a;
 }
 int main() {
   f();
diff --git a/gcc/testsuite/g++.dg/abi/covariant2.C b/gcc/testsuite/g++.dg/abi/covariant2.C
index 3231cc4c84c..6c55ad6bb67 100644
--- a/gcc/testsuite/g++.dg/abi/covariant2.C
+++ b/gcc/testsuite/g++.dg/abi/covariant2.C
@@ -10,7 +10,7 @@ struct c1 {};
 
 struct c3 : virtual c1
 {
-    virtual c1* f6() {}
+    virtual c1* f6() { return 0; }
     int i;
 };
 
@@ -18,7 +18,7 @@ struct c6 : virtual c3 { };
 
 struct c7 : c3
 {
-    virtual c3* f6() {}
+    virtual c3* f6() { return 0; }
 };
 
 struct c24 : virtual c7
diff --git a/gcc/testsuite/g++.dg/abi/covariant3.C b/gcc/testsuite/g++.dg/abi/covariant3.C
index 178157c58b2..09b9912524d 100644
--- a/gcc/testsuite/g++.dg/abi/covariant3.C
+++ b/gcc/testsuite/g++.dg/abi/covariant3.C
@@ -34,7 +34,7 @@ struct c28 : virtual c0, virtual c11 {
     virtual c18* f6();
 };
 
-c0 *c1::f6 () {}
+c0 *c1::f6 () { return 0; }
 void c5::foo () {}
 void c10::foo () {}
 void c18::bar () {}
diff --git a/gcc/testsuite/g++.dg/abi/mangle7.C b/gcc/testsuite/g++.dg/abi/mangle7.C
index af178d3e599..14c65a24da8 100644
--- a/gcc/testsuite/g++.dg/abi/mangle7.C
+++ b/gcc/testsuite/g++.dg/abi/mangle7.C
@@ -1,6 +1,6 @@
 /* { dg-do compile } */
 
 typedef void *const t1[2];
-float const f1(t1 (&)[79], ...) {}
+float const f1(t1 (&)[79], ...) { return 0.0f; }
 
 /* { dg-final { scan-assembler _Z2f1RA79_A2_KPvz } } */
diff --git a/gcc/testsuite/g++.dg/asan/pr81340.C b/gcc/testsuite/g++.dg/asan/pr81340.C
index 76ac08a9a56..9db5bb46ce7 100644
--- a/gcc/testsuite/g++.dg/asan/pr81340.C
+++ b/gcc/testsuite/g++.dg/asan/pr81340.C
@@ -10,13 +10,13 @@ public:
   a(char *) : c(0, d) {}
 };
 class e {
-  int f(const int &, const int &, const int &, bool, bool, bool, int, bool);
+  void f(const int &, const int &, const int &, bool, bool, bool, int, bool);
 };
 class g {
 public:
   static g *h();
   void i(a, void *);
 };
-int e::f(const int &, const int &, const int &, bool j, bool, bool, int, bool) {
+void e::f(const int &, const int &, const int &, bool j, bool, bool, int, bool) {
   g::h()->i("", &j);
 }
diff --git a/gcc/testsuite/g++.dg/concepts/fn8.C b/gcc/testsuite/g++.dg/concepts/fn8.C
index 5c796c7e3b2..b91f1ae9511 100644
--- a/gcc/testsuite/g++.dg/concepts/fn8.C
+++ b/gcc/testsuite/g++.dg/concepts/fn8.C
@@ -12,7 +12,7 @@ void (*p2)(int) = &f<int>; // { dg-error "no matches" }
 void (*p3)(int) = &f; // { dg-error "no matches" }
 
 struct S {
-  template<Class T> int f(T) { }
+  template<Class T> int f(T) { return 0; }
 };
 
 auto p4 = &S::template f<int>; // { dg-error "no matches" }
diff --git a/gcc/testsuite/g++.dg/concepts/pr65575.C b/gcc/testsuite/g++.dg/concepts/pr65575.C
index e027dccf7d8..6745b843d31 100644
--- a/gcc/testsuite/g++.dg/concepts/pr65575.C
+++ b/gcc/testsuite/g++.dg/concepts/pr65575.C
@@ -14,7 +14,7 @@ int (*p)() requires true; // { dg-error "" }
 int (&p)() requires true; // { dg-error "" }
 int g(int (*)() requires true); // { dg-error "" }
 
-int f() { }
+int f() { return 0; }
 
 int
 main()
diff --git a/gcc/testsuite/g++.dg/concepts/template-parm11.C b/gcc/testsuite/g++.dg/concepts/template-parm11.C
index 73f38815fb7..352acc2271d 100644
--- a/gcc/testsuite/g++.dg/concepts/template-parm11.C
+++ b/gcc/testsuite/g++.dg/concepts/template-parm11.C
@@ -12,7 +12,7 @@ template<NameProvider... ColSpec>
 void getTable(const ColSpec&...)
 {}
 
-int f()
+void f()
 {
   getTable(7, 'a'); // { dg-error "cannot call" }
 };
diff --git a/gcc/testsuite/g++.dg/conversion/op6.C b/gcc/testsuite/g++.dg/conversion/op6.C
index 9aec9f0a808..8a5efc4023a 100644
--- a/gcc/testsuite/g++.dg/conversion/op6.C
+++ b/gcc/testsuite/g++.dg/conversion/op6.C
@@ -3,9 +3,9 @@
 
 template<class T> class smart_pointer {
 public:
-    operator T* () const { }
-    operator bool () const { }
-    operator bool () { }
+    operator T* () const { return 0; }
+    operator bool () const { return true; }
+    operator bool () { return true; }
 };
 class Context { };
 typedef smart_pointer<Context> ContextP;
diff --git a/gcc/testsuite/g++.dg/cpp0x/access01.C b/gcc/testsuite/g++.dg/cpp0x/access01.C
index 55c951f97d6..3a7cee4156a 100644
--- a/gcc/testsuite/g++.dg/cpp0x/access01.C
+++ b/gcc/testsuite/g++.dg/cpp0x/access01.C
@@ -6,7 +6,7 @@ class A
 {
   T p;
 public:
-  template <class U> auto f() -> decltype(+p) { }
+  template <class U> auto f() -> decltype(+p) { return p; }
 };
 
 int main()
diff --git a/gcc/testsuite/g++.dg/cpp0x/alignas3.C b/gcc/testsuite/g++.dg/cpp0x/alignas3.C
index aa62e5afb2d..af3f171bb3f 100644
--- a/gcc/testsuite/g++.dg/cpp0x/alignas3.C
+++ b/gcc/testsuite/g++.dg/cpp0x/alignas3.C
@@ -16,5 +16,5 @@ template <class, class Y> typename F<Y>::ret_type cast(Y &);
 class CompoundStmt;
 class alignas(8) Stmt {
   Stmt *Children[1];
-  CompoundStmt *getBlock() const { cast<CompoundStmt>(Children[0]); }
+  CompoundStmt *getBlock() const { cast<CompoundStmt>(Children[0]); return 0; }
 };
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-array17.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-array17.C
index c6afa507f02..a43d1df463f 100644
--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-array17.C
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-array17.C
@@ -18,6 +18,8 @@ struct D {
   template <typename _ForwardIterator, typename _Size>
   static _ForwardIterator __uninit_default_n(_ForwardIterator p1, _Size) {
     _Construct(p1);
+    static _ForwardIterator a;
+    return a;
   }
 };
 template <typename _ForwardIterator, typename _Size>
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-defarg2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-defarg2.C
index f1ca05fe9ec..f6e0710b4d2 100644
--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-defarg2.C
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-defarg2.C
@@ -25,6 +25,8 @@ struct A : D
 
 A baz (const char *, A = C ());
 
+A a;
+
 A
 B::foo ()
 {
@@ -35,10 +37,13 @@ B::foo ()
   catch (...)
     {
     }
+
+  return a;
 }
 
 A
 B::bar ()
 {
   baz ("bar");
+  return a;
 }
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-memfn1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-memfn1.C
index d59f465715d..d58e2ec6b15 100644
--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-memfn1.C
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-memfn1.C
@@ -13,6 +13,6 @@ constexpr X X::g(X x) { return x; }
 struct Y
 {
   Y() { }
-  constexpr Y f(Y y) {}		// { dg-error "constexpr" }
-  static constexpr Y g(Y y) {}	// { dg-error "constexpr" }
+  constexpr Y f(Y y) { return y; }  // { dg-error "constexpr" }
+  static constexpr Y g(Y y) { return y; } // { dg-error "constexpr" }
 };
diff --git a/gcc/testsuite/g++.dg/cpp0x/dc1.C b/gcc/testsuite/g++.dg/cpp0x/dc1.C
index e7ccb64a3b3..5ce50764b5f 100644
--- a/gcc/testsuite/g++.dg/cpp0x/dc1.C
+++ b/gcc/testsuite/g++.dg/cpp0x/dc1.C
@@ -27,7 +27,7 @@ struct D : public C {
 	D (int _i) : C(), i(_i) { }
 	D () : D(-1) { }
 	virtual ~D() { }
-	virtual int f () { }
+	virtual int f () { return 0; }
 };
 
 void f_D () { C* c = new D(); }
diff --git a/gcc/testsuite/g++.dg/cpp0x/dc3.C b/gcc/testsuite/g++.dg/cpp0x/dc3.C
index 9c6fd56564c..9c1fd53e4fe 100644
--- a/gcc/testsuite/g++.dg/cpp0x/dc3.C
+++ b/gcc/testsuite/g++.dg/cpp0x/dc3.C
@@ -43,7 +43,7 @@ struct D<X> : public C {
 	D (int _i) : C(), i(_i) { }
 	D () : D(-1) { }
 	virtual ~D() { }
-	virtual int f () { }
+	virtual int f () { return 0; }
 };
 
 void f_D () { D<X>* d = new D<X>(); }
diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype3.C b/gcc/testsuite/g++.dg/cpp0x/decltype3.C
index b2e66243cc7..b921dd6d899 100644
--- a/gcc/testsuite/g++.dg/cpp0x/decltype3.C
+++ b/gcc/testsuite/g++.dg/cpp0x/decltype3.C
@@ -49,7 +49,7 @@ public:
   int a;
   enum B_enum { b }; 
   decltype(a) c;
-  decltype(a) foo() { }
+  decltype(a) foo() { return 0; }
   decltype(b) enums_are_in_scope() { return b; } // ok 
 }; 
 
diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype41.C b/gcc/testsuite/g++.dg/cpp0x/decltype41.C
index 1439e15c0d4..65f75b1e4fa 100644
--- a/gcc/testsuite/g++.dg/cpp0x/decltype41.C
+++ b/gcc/testsuite/g++.dg/cpp0x/decltype41.C
@@ -23,15 +23,15 @@ class B
 template <class T>
 struct C
 {
-  template <class U> decltype (a.i) f() { } // #1
-  template <class U> decltype (b.i) f() { } // #2
+  template <class U> decltype (a.i) f() { return 0; } // #1
+  template <class U> decltype (b.i) f() { return 1; } // #2
 };
 
 template <class T>
 struct D
 {
-  template <class U> decltype (A::j) f() { } // #1
-  template <class U> decltype (B::j) f() { } // #2
+  template <class U> decltype (A::j) f() { return 2; } // #1
+  template <class U> decltype (B::j) f() { return 3; } // #2
 };
 
 int main()
diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted28.C b/gcc/testsuite/g++.dg/cpp0x/defaulted28.C
index 451a1b4198f..0e04dbfb8d7 100644
--- a/gcc/testsuite/g++.dg/cpp0x/defaulted28.C
+++ b/gcc/testsuite/g++.dg/cpp0x/defaulted28.C
@@ -9,7 +9,7 @@ private:
   A(A const&) = default;	// { dg-message "private" }
 };
 
-int f(...) { }
+int f(...) { return 0; }
 int main() {
   A a;
   f(a); 			// { dg-error "this context" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/enum_base3.C b/gcc/testsuite/g++.dg/cpp0x/enum_base3.C
index 3cb2d6d8186..1437f5fbcf1 100644
--- a/gcc/testsuite/g++.dg/cpp0x/enum_base3.C
+++ b/gcc/testsuite/g++.dg/cpp0x/enum_base3.C
@@ -17,7 +17,7 @@ struct C
 };
 struct D : C
 {
-  B foo () const { B a; a.foo (d); }
+  B foo () const { B a; a.foo (d); static B b; return b; }
   H d;
 };
 struct F : C
diff --git a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-4.C b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-4.C
index eb585a89be4..023d8396777 100644
--- a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-4.C
+++ b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-4.C
@@ -22,7 +22,7 @@ void two [[gnu::unused]] (void) {}
 int
 five(void)
 [[noreturn]] // { dg-warning "ignored" }
-{}
+{ return 0; }
 
 [[noreturn]]
 void
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-58566.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-58566.C
index 3101d0a895c..7bcfe3ae70b 100644
--- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-58566.C
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-58566.C
@@ -6,5 +6,6 @@ struct A
   int foo()
   {
     [this]{ return foo; }; // { dg-error "invalid use of member function|cannot convert" }
+    return 0;
   }
 };
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv10.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv10.C
index 8e806c849ae..5edfedf72eb 100644
--- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv10.C
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv10.C
@@ -3,7 +3,7 @@
 
 template <typename F> struct Tag {
   static void fp() { f()(0); }
-  static F f() {}
+  static F f() { static F a; return a; }
 };
 
 struct Dispatch {
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv12.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv12.C
index 16adee6b9c3..e5655cec9c7 100644
--- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv12.C
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv12.C
@@ -10,7 +10,7 @@ template <typename F> struct B<F> { using type = F; };
 struct {
   template <typename... F,
             typename Overload = typename B<typename A<F>::type...>::type>
-  Overload operator()(F...){}
+  Overload operator()(F...){ Overload a; return a; }
 } a;
 int main() {
   auto f = a([](int) {}, [](float) {});
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg3.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg3.C
index 1c593930133..d85d358b7e4 100644
--- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg3.C
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg3.C
@@ -10,7 +10,7 @@ struct function
 
 template<typename T> struct C
 {
-  static T test(function f = [](int i){return i;}) { }
+  static T test(function f = [](int i){return i;}) { static T a; return a; }
 };
 
 int main()
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice3.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice3.C
index fa8a6e63a93..371d03f941f 100644
--- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice3.C
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice3.C
@@ -14,6 +14,8 @@ bool Klass::dostuff()
     if (local & 1) { return true; } // { dg-error "not captured|non-static" }
     return false;
   };
+
+  return true;
 }
 
 int main()
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice5.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice5.C
index 914e0f71e00..50a340dbb22 100644
--- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice5.C
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice5.C
@@ -4,6 +4,7 @@
 template<int> int foo()
 {
   [] (void i) { return 0; } (0); // { dg-error "incomplete|invalid|no match" }
+  return 0;
 }
 
 void bar()
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested2.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested2.C
index 9e509513ad9..27954f9408c 100644
--- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested2.C
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested2.C
@@ -13,7 +13,7 @@ void f1(int i) {
   };
   struct s1 {
     int f;
-    int work(int n) {
+    void work(int n) {
       int m = n*n;
       int j = 40;
       auto m3 = [this,m]{
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template12.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template12.C
index 635af97d763..5dfd6ede19c 100644
--- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template12.C
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template12.C
@@ -14,6 +14,7 @@ class X
         [&a]{
             typename remove_reference < decltype (a) >::type t;
         };
+	return true;
     }
 };
 template class X< int >;
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template2.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template2.C
index 29f63afe0df..8fbb821a4d3 100644
--- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template2.C
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template2.C
@@ -10,7 +10,7 @@ struct T
   foo (S<N> *p)
   {
     S<N> u;
-    [&u] ()->bool {} ();
+    [&u] ()->bool { return true; } ();
   }
 };
 
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this12.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this12.C
index ef573b19e02..41e4edd8a0f 100644
--- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this12.C
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this12.C
@@ -3,7 +3,7 @@
 
 struct A
 {
-  int f() {}
+  int f() { return 0; }
   int i;
 
   void foo()
diff --git a/gcc/testsuite/g++.dg/cpp0x/nsdmi-template5.C b/gcc/testsuite/g++.dg/cpp0x/nsdmi-template5.C
index fdaf4611ee2..5f23d463003 100644
--- a/gcc/testsuite/g++.dg/cpp0x/nsdmi-template5.C
+++ b/gcc/testsuite/g++.dg/cpp0x/nsdmi-template5.C
@@ -7,7 +7,7 @@ template<> struct A1<0>
 {
   template<typename, typename...> struct B1
   {
-    template<typename> int foo1() {}
+    template<typename> int foo1() { return 0; }
 
     int i1 = foo1<int>();
   };
@@ -19,7 +19,7 @@ template<> struct A2<0>
 {
   template<typename, typename> struct B2
   {
-    template<typename> int foo2() {}
+    template<typename> int foo2() { return 1; }
 
     int i2 = foo2<int>();
   };
@@ -31,7 +31,7 @@ template<> struct A3<0>
 {
   template<typename> struct B3
   {
-    template<typename> int foo3() {}
+    template<typename> int foo3() { return 2; }
 
     int i3 = foo3<int>();
   };
diff --git a/gcc/testsuite/g++.dg/cpp0x/parse1.C b/gcc/testsuite/g++.dg/cpp0x/parse1.C
index 5a11b7337a4..9a2698435b6 100644
--- a/gcc/testsuite/g++.dg/cpp0x/parse1.C
+++ b/gcc/testsuite/g++.dg/cpp0x/parse1.C
@@ -2,4 +2,4 @@
 // { dg-do compile { target c++11 } }
 
 typedef int B;			// { dg-message "" }
-B::B() {}			// { dg-error "" }
+B::B() { return 0; }		// { dg-error "" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr34054.C b/gcc/testsuite/g++.dg/cpp0x/pr34054.C
index 8043f9660ed..dbb14e02cda 100644
--- a/gcc/testsuite/g++.dg/cpp0x/pr34054.C
+++ b/gcc/testsuite/g++.dg/cpp0x/pr34054.C
@@ -1,4 +1,4 @@
 // PR c++/34054
 // { dg-do compile { target c++11 } }
 
-template<typename... T> T foo() {} // { dg-error "not expanded|T" }
+template<typename... T> T foo() { static T a; return a; } // { dg-error "not expanded|T" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr70538.C b/gcc/testsuite/g++.dg/cpp0x/pr70538.C
index 0347c856c55..5f4d8585f76 100644
--- a/gcc/testsuite/g++.dg/cpp0x/pr70538.C
+++ b/gcc/testsuite/g++.dg/cpp0x/pr70538.C
@@ -11,5 +11,5 @@ class B {
 template <typename> class C : B {
   using base_type = B;
   base_type::base_type;  // { dg-warning "access declarations" }
-  PathComponentPiece m_fn1() {}
+  PathComponentPiece m_fn1() { static PathComponentPiece a; return a; }
 };
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr81325.C b/gcc/testsuite/g++.dg/cpp0x/pr81325.C
index 11f0900caa2..d6015776968 100644
--- a/gcc/testsuite/g++.dg/cpp0x/pr81325.C
+++ b/gcc/testsuite/g++.dg/cpp0x/pr81325.C
@@ -35,7 +35,7 @@ struct I {
 };
 template <typename ResultT, typename ArgT> struct J {
   void operator()();
-  ResultT operator()(ArgT) {}
+  ResultT operator()(ArgT) { static ResultT a; return a; }
 };
 struct K {
   int AllowBind;
diff --git a/gcc/testsuite/g++.dg/cpp0x/range-for13.C b/gcc/testsuite/g++.dg/cpp0x/range-for13.C
index 100f531f760..9ed0458adcc 100644
--- a/gcc/testsuite/g++.dg/cpp0x/range-for13.C
+++ b/gcc/testsuite/g++.dg/cpp0x/range-for13.C
@@ -7,10 +7,12 @@
 template<typename T> int *begin(T &t)
 {
     T::fail;
+    return 0;
 }
 template<typename T> int *end(T &t)
 {
     T::fail;
+    return 0;
 }
 
 struct container1
diff --git a/gcc/testsuite/g++.dg/cpp0x/range-for14.C b/gcc/testsuite/g++.dg/cpp0x/range-for14.C
index f43e1abcde7..4e0333cf927 100644
--- a/gcc/testsuite/g++.dg/cpp0x/range-for14.C
+++ b/gcc/testsuite/g++.dg/cpp0x/range-for14.C
@@ -7,10 +7,12 @@
 template<typename T> int *begin(T &t)
 {
     T::fail;
+    return 0;
 }
 template<typename T> int *end(T &t)
 {
     T::fail;
+    return 0;
 }
 
 //Test for defaults
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv2n.C b/gcc/testsuite/g++.dg/cpp0x/rv2n.C
index 663a66b6d90..55979c85508 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv2n.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv2n.C
@@ -144,6 +144,7 @@ int test2_18()
     sink_2_18(ca);		// { dg-error "" }
     sink_2_18(va);		// { dg-error "" }
     sink_2_18(cva);		// { dg-error "" }
+    return 0;
 }
 
 two   sink_2_23(const          A&);
@@ -250,6 +251,7 @@ int test2_28()
     const volatile A cva = a; // { dg-error "deleted" }
     sink_2_28(va);		// { dg-error "" }
     sink_2_28(cva);		// { dg-error "" }
+    return 0;
 }
 
 three sink_2_35(volatile       A&);
@@ -439,6 +441,7 @@ int test2_68()
     sink_2_68(ca);		// { dg-error "" }
     sink_2_68(va);		// { dg-error "" }
     sink_2_68(cva);		// { dg-error "" }
+    return 0;
 }
 
 seven sink_2_78(volatile       A&&);
@@ -454,6 +457,7 @@ int test2_78()
     sink_2_78(ca);		// { dg-error "" }
     sink_2_78(va);		// { dg-error "" }
     sink_2_78(cva);		// { dg-error "" }
+    return 0;
 }
 
 int main()
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv3n.C b/gcc/testsuite/g++.dg/cpp0x/rv3n.C
index b7c1d7a2343..4549438f8ef 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv3n.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv3n.C
@@ -124,6 +124,7 @@ int test3_128()
 
     sink_3_128(va);		// { dg-error "" }
     sink_3_128(cva);		// { dg-error "" }
+    return 0;
 }
 
 one   sink_3_134(               A&);
diff --git a/gcc/testsuite/g++.dg/cpp0x/static_assert10.C b/gcc/testsuite/g++.dg/cpp0x/static_assert10.C
index e7f728e3f4f..ffbf3c047eb 100644
--- a/gcc/testsuite/g++.dg/cpp0x/static_assert10.C
+++ b/gcc/testsuite/g++.dg/cpp0x/static_assert10.C
@@ -5,4 +5,5 @@ template<typename T> bool foo(T)
 {
   int i;
   static_assert(foo(i), "Error"); // { dg-error "non-constant condition|not usable|non-constexpr" }
+  return true;
 }
diff --git a/gcc/testsuite/g++.dg/cpp0x/static_assert11.C b/gcc/testsuite/g++.dg/cpp0x/static_assert11.C
index 8a7362d5f56..36bf458e25f 100644
--- a/gcc/testsuite/g++.dg/cpp0x/static_assert11.C
+++ b/gcc/testsuite/g++.dg/cpp0x/static_assert11.C
@@ -6,5 +6,6 @@ struct A
   template<typename T> bool foo(T)
   {
     static_assert(foo(0), "Error"); // { dg-error "non-constant condition|constant expression" }
+    return true;
   }
 };
diff --git a/gcc/testsuite/g++.dg/cpp0x/static_assert12.C b/gcc/testsuite/g++.dg/cpp0x/static_assert12.C
index ff6f40d918f..5d59e540910 100644
--- a/gcc/testsuite/g++.dg/cpp0x/static_assert12.C
+++ b/gcc/testsuite/g++.dg/cpp0x/static_assert12.C
@@ -14,7 +14,7 @@ template<>
   };
 
 template<typename T>
-  T
+  void
   float_thing(T __x)
   {
     static_assert(is_float<T>::value, ""); // { dg-error "static assertion failed" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/static_assert13.C b/gcc/testsuite/g++.dg/cpp0x/static_assert13.C
index 86b0b0360d9..7332ff91882 100644
--- a/gcc/testsuite/g++.dg/cpp0x/static_assert13.C
+++ b/gcc/testsuite/g++.dg/cpp0x/static_assert13.C
@@ -14,7 +14,7 @@ template<>
   };
 
 template<typename T>
-  T
+  void
   float_thing(T __x)
   {
     static_assert(is_float<T>::value, ""); // { dg-error "static assertion failed" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/trailing1.C b/gcc/testsuite/g++.dg/cpp0x/trailing1.C
index 7d9a906d4f3..6f18c1e47bd 100644
--- a/gcc/testsuite/g++.dg/cpp0x/trailing1.C
+++ b/gcc/testsuite/g++.dg/cpp0x/trailing1.C
@@ -40,9 +40,9 @@ decltype(*(T*)0+*(U*)0) add4(T t, U u)
 template <class T>
 struct A
 {
-  T f() {}
+  T f() { static T a; return a; }
   template <class U>
-  T g() {}
+  T g() { static T a; return a; }
   template <class V>
   struct B
   {
diff --git a/gcc/testsuite/g++.dg/cpp0x/trailing5.C b/gcc/testsuite/g++.dg/cpp0x/trailing5.C
index 48f31452e5b..31a5350e687 100644
--- a/gcc/testsuite/g++.dg/cpp0x/trailing5.C
+++ b/gcc/testsuite/g++.dg/cpp0x/trailing5.C
@@ -2,9 +2,9 @@
 // { dg-do compile { target c++11 } }
 
 struct A {};
-auto foo() -> struct A {}
+auto foo() -> struct A { static A a; return a; }
 
 enum B {};
-auto bar() -> enum B {}
+auto bar() -> enum B { static B b; return b; }
 
 auto baz() -> struct C {} {}	// { dg-error "" }
diff --git a/gcc/testsuite/gcc.dg/pr44545.c b/gcc/testsuite/gcc.dg/pr44545.c
index 51983ef76b9..8058261f850 100644
--- a/gcc/testsuite/gcc.dg/pr44545.c
+++ b/gcc/testsuite/gcc.dg/pr44545.c
@@ -1,6 +1,6 @@
 /* { dg-do compile } */
 /* { dg-options "-O2 -fnon-call-exceptions -ftrapv -fexceptions" } */
-int
+void
 DrawChunk(int *tabSize, int x) 
 {
   const int numEnds = 10;
-- 
2.14.2


^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH][RFC] Instrument function exit with __builtin_unreachable in C++.
  2017-10-12  8:48       ` Martin Liška
@ 2017-10-12  9:36         ` Jakub Jelinek
  2017-10-18 12:47           ` Martin Liška
                             ` (2 more replies)
  2017-10-12 12:57         ` [PATCH][RFC] Instrument function exit with __builtin_unreachable in C++ Jason Merrill
  1 sibling, 3 replies; 64+ messages in thread
From: Jakub Jelinek @ 2017-10-12  9:36 UTC (permalink / raw)
  To: Martin Liška; +Cc: Jason Merrill, gcc-patches List, Jonathan Wakely

On Thu, Oct 12, 2017 at 10:40:42AM +0200, Martin Liška wrote:
> --- a/gcc/cp/constexpr.c
> +++ b/gcc/cp/constexpr.c
> @@ -1175,7 +1175,12 @@ cxx_eval_builtin_function_call (const constexpr_ctx *ctx, tree t, tree fun,
>  	{
>  	  new_call = build_call_array_loc (EXPR_LOCATION (t), TREE_TYPE (t),
>  					   CALL_EXPR_FN (t), nargs, args);
> -	  error ("%q+E is not a constant expression", new_call);
> +
> +	  /* Do not allow__builtin_unreachable in constexpr function.  */
> +	  if (DECL_FUNCTION_CODE (fun) == BUILT_IN_UNREACHABLE)

As I said earlier, I think it would be better to differentiate between
explicit __builtin_unreachable and the implicitly added one from the patch.
So this could be done as
if (DECL_FUNCTION_CODE (fun) == BUILT_IN_UNREACHABLE
    && EXPR_LOCATION (t) == BUILTINS_LOCATION)

> +  location_t loc = DECL_SOURCE_LOCATION (fndecl);
> +  if (sanitize_flags_p (SANITIZE_RETURN, fndecl))
> +    t = ubsan_instrument_return (loc);
> +  else
> +    t = build_call_expr_loc (loc, builtin_decl_explicit (BUILT_IN_UNREACHABLE),

and here use BUILTINS_LOCATION instead of loc.
The code might be more readable by doing:
    {
      tree fndecl = builtin_decl_explicit (BUILT_IN_UNREACHABLE);
      t = build_call_expr_loc (BUILTINS_LOCATION, fndecl, 0);
    }

> +			     0);
> +

	Jakub

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH][RFC] Instrument function exit with __builtin_unreachable in C++.
  2017-10-12  8:48       ` Martin Liška
  2017-10-12  9:36         ` Jakub Jelinek
@ 2017-10-12 12:57         ` Jason Merrill
  1 sibling, 0 replies; 64+ messages in thread
From: Jason Merrill @ 2017-10-12 12:57 UTC (permalink / raw)
  To: Martin Liška; +Cc: gcc-patches List, Jakub Jelinek, Jonathan Wakely

On Thu, Oct 12, 2017 at 4:40 AM, Martin Liška <mliska@suse.cz> wrote:
> On 10/11/2017 04:59 PM, Jason Merrill wrote:
>> On Thu, Oct 5, 2017 at 12:53 PM, Martin Liška <mliska@suse.cz> wrote:
>>> On 10/05/2017 05:07 PM, Jason Merrill wrote:
>>>> On Thu, Oct 5, 2017 at 6:31 AM, Martin Liška <mliska@suse.cz> wrote:
>>>>> As discussed 2 days ago on IRC with Jakub and Jonathan, C++ standard says
>>>>> that having a non-return
>>>>> function with missing return statement is undefined behavior. We've got
>>>>> -fsanitize=return check for
>>>>> that and we can in such case instrument __builtin_unreachable(). This
>>>>> patch does that.
>>>>
>>>>
>>>> Great.
>>>>
>>>>> And there's still some fallout:
>>>>>
>>>>> FAIL: g++.dg/cpp0x/constexpr-diag3.C  -std=c++11  (test for errors, line
>>>>> 7)
>>>>> FAIL: g++.dg/cpp0x/constexpr-neg3.C  -std=c++11  (test for errors, line
>>>>> 12)
>>>>> FAIL: g++.dg/cpp1y/constexpr-return2.C  -std=c++14  (test for errors,
>>>>> line 7)
>>>>> FAIL: g++.dg/cpp1y/constexpr-return2.C  -std=c++14 (test for excess
>>>>> errors)
>>>>> FAIL: g++.dg/cpp1y/pr63996.C  -std=c++14  (test for errors, line 9)
>>>>> FAIL: g++.dg/cpp1y/pr63996.C  -std=c++14 (test for excess errors)
>>>>>
>>>>> 1) there are causing:
>>>>>
>>>>> ./xg++ -B.
>>>>> /home/marxin/Programming/gcc/gcc/testsuite/g++.dg/cpp1y/pr63996.C
>>>>> /home/marxin/Programming/gcc/gcc/testsuite/g++.dg/cpp1y/pr63996.C:9:23:
>>>>> in constexpr expansion of ‘foo(1)’
>>>>> /home/marxin/Programming/gcc/gcc/testsuite/g++.dg/cpp1y/pr63996.C:4:1:
>>>>> error: ‘__builtin_unreachable()’ is not a constant expression
>>>>>   foo (int i)
>>>>>   ^~~
>>>>>
>>>>> Where we probably should not emit the built-in call. Am I right?
>>>>
>>>>
>>>> Or constexpr.c could give a more friendly diagnostic for
>>>> __builtin_unreachable.  It's correct to give a diagnostic here for
>>>> this testcase.
>>>
>>>
>>> Hi.
>>>
>>> That's good idea, any suggestion different from:
>>>
>>> ./xg++ -B.
>>> /home/marxin/Programming/gcc2/gcc/testsuite/g++.dg/cpp1y/pr63996.C
>>> /home/marxin/Programming/gcc2/gcc/testsuite/g++.dg/cpp1y/pr63996.C:9:23:
>>> in constexpr expansion of ‘foo(1)’
>>> <built-in>: error: constexpr can't contain call of a non-return function
>>> ‘__builtin_unreachable’
>>>
>>> which is probably misleading as it points to a function call that is
>>> actually missing in source code.
>>> Should we distinguish between implicit and explicit __builtin_unreachable?
>>
>> Probably without your change the constexpr code already diagnoses the
>> missing return as "constexpr call flows off the end of the function";
>> that same message seems appropriate.
>
> Hello.
>
> Ok, I've done that. Sending patch candidate.
>
>>
>>> So turning on the warning by default for c++, we get about 500 failing test-cases. Uf :/
>>
>> Yes, we've been sloppy about this in the testsuite.  :(
>
> I'll fix it. For being sure, I'm sending first part where I demonstrate how I plan to change
> tests, with following preference:
>
> 1) change function to void type if possible
> 2) return a default value for functions not returning a value (for complex return value of a type A:
>    I do { static A a; return a; } is it appropriate?

How about "return A();" ?

Jason

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH][RFC] Instrument function exit with __builtin_unreachable in C++.
  2017-10-12  9:36         ` Jakub Jelinek
@ 2017-10-18 12:47           ` Martin Liška
  2017-10-18 13:04             ` Marek Polacek
  2017-10-18 12:48           ` [PATCH] Fix all tests that fail with -sanitize=return Martin Liška
  2017-10-18 12:53           ` [PATCH] Fix test-suite fallout of default -Wreturn-type Martin Liška
  2 siblings, 1 reply; 64+ messages in thread
From: Martin Liška @ 2017-10-18 12:47 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Jason Merrill, gcc-patches List, Jonathan Wakely

[-- Attachment #1: Type: text/plain, Size: 1589 bytes --]

On 10/12/2017 10:48 AM, Jakub Jelinek wrote:
> On Thu, Oct 12, 2017 at 10:40:42AM +0200, Martin Liška wrote:
>> --- a/gcc/cp/constexpr.c
>> +++ b/gcc/cp/constexpr.c
>> @@ -1175,7 +1175,12 @@ cxx_eval_builtin_function_call (const constexpr_ctx *ctx, tree t, tree fun,
>>  	{
>>  	  new_call = build_call_array_loc (EXPR_LOCATION (t), TREE_TYPE (t),
>>  					   CALL_EXPR_FN (t), nargs, args);
>> -	  error ("%q+E is not a constant expression", new_call);
>> +
>> +	  /* Do not allow__builtin_unreachable in constexpr function.  */
>> +	  if (DECL_FUNCTION_CODE (fun) == BUILT_IN_UNREACHABLE)
> 
> As I said earlier, I think it would be better to differentiate between
> explicit __builtin_unreachable and the implicitly added one from the patch.
> So this could be done as
> if (DECL_FUNCTION_CODE (fun) == BUILT_IN_UNREACHABLE
>     && EXPR_LOCATION (t) == BUILTINS_LOCATION)
> 
>> +  location_t loc = DECL_SOURCE_LOCATION (fndecl);
>> +  if (sanitize_flags_p (SANITIZE_RETURN, fndecl))
>> +    t = ubsan_instrument_return (loc);
>> +  else
>> +    t = build_call_expr_loc (loc, builtin_decl_explicit (BUILT_IN_UNREACHABLE),
> 
> and here use BUILTINS_LOCATION instead of loc.
> The code might be more readable by doing:
>     {
>       tree fndecl = builtin_decl_explicit (BUILT_IN_UNREACHABLE);
>       t = build_call_expr_loc (BUILTINS_LOCATION, fndecl, 0);
>     }
> 
>> +			     0);
>> +
> 
> 	Jakub
> 

Hi.

I'm sending updated version of the patch that should address it.

Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.

Ready to be installed?
Martin

[-- Attachment #2: 0001-Instrument-function-exit-with-__builtin_unreachable-.patch --]
[-- Type: text/x-patch, Size: 5158 bytes --]

From 36f3f45d9fa42344261faf60bb3cfbe22ed262ac Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Thu, 12 Oct 2017 10:14:59 +0200
Subject: [PATCH 1/3] Instrument function exit with __builtin_unreachable in
 C++

gcc/c-family/ChangeLog:

2017-10-12  Martin Liska  <mliska@suse.cz>

	PR middle-end/82404
	* c-opts.c (c_common_post_options): Set -Wreturn-type for C++
	FE.
	* c.opt: Set default value of warn_return_type.

gcc/cp/ChangeLog:

2017-10-12  Martin Liska  <mliska@suse.cz>

	PR middle-end/82404
	* constexpr.c (cxx_eval_builtin_function_call): Handle
	__builtin_unreachable call.
	* cp-gimplify.c (cp_ubsan_maybe_instrument_return): Rename to
	...
	(cp_maybe_instrument_return): ... this.
	(cp_genericize): Call the function unconditionally.

gcc/fortran/ChangeLog:

2017-10-12  Martin Liska  <mliska@suse.cz>

	PR middle-end/82404
	* options.c (gfc_post_options): Set default value of
	-Wreturn-type to false.
---
 gcc/c-family/c-opts.c |  3 +++
 gcc/c-family/c.opt    |  2 +-
 gcc/cp/constexpr.c    |  8 +++++++-
 gcc/cp/cp-gimplify.c  | 20 ++++++++++++++------
 gcc/fortran/options.c |  3 +++
 5 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
index 6bd535532d3..682d7a83ec5 100644
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -978,6 +978,9 @@ c_common_post_options (const char **pfilename)
 	flag_extern_tls_init = 1;
     }
 
+  if (warn_return_type == -1)
+    warn_return_type = c_dialect_cxx () ? 1 : 0;
+
   if (num_in_fnames > 1)
     error ("too many filenames given.  Type %s --help for usage",
 	   progname);
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index 13d2a59b8a5..e26fba734c0 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -960,7 +960,7 @@ C++ ObjC++ Var(warn_reorder) Warning LangEnabledBy(C++ ObjC++,Wall)
 Warn when the compiler reorders code.
 
 Wreturn-type
-C ObjC C++ ObjC++ Var(warn_return_type) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
+C ObjC C++ ObjC++ Var(warn_return_type) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall) Init(-1)
 Warn whenever a function's return type defaults to \"int\" (C), or about inconsistent return types (C++).
 
 Wscalar-storage-order
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index 59192829d71..15253ffad9d 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -1182,7 +1182,13 @@ cxx_eval_builtin_function_call (const constexpr_ctx *ctx, tree t, tree fun,
 	{
 	  new_call = build_call_array_loc (EXPR_LOCATION (t), TREE_TYPE (t),
 					   CALL_EXPR_FN (t), nargs, args);
-	  error ("%q+E is not a constant expression", new_call);
+
+	  /* Do not allow__builtin_unreachable in constexpr function.  */
+	  if (DECL_FUNCTION_CODE (fun) == BUILT_IN_UNREACHABLE
+	      && EXPR_LOCATION (t) == BUILTINS_LOCATION)
+	    error ("constexpr call flows off the end of the function");
+	  else
+	    error ("%q+E is not a constant expression", new_call);
 	}
       *non_constant_p = true;
       return t;
diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c
index 262485a5c1f..014c1ee7231 100644
--- a/gcc/cp/cp-gimplify.c
+++ b/gcc/cp/cp-gimplify.c
@@ -1556,10 +1556,11 @@ cp_genericize_tree (tree* t_p, bool handle_invisiref_parm_p)
 
 /* If a function that should end with a return in non-void
    function doesn't obviously end with return, add ubsan
-   instrumentation code to verify it at runtime.  */
+   instrumentation code to verify it at runtime.  If -fsanitize=return
+   is not enabled, instrument __builtin_unreachable.  */
 
 static void
-cp_ubsan_maybe_instrument_return (tree fndecl)
+cp_maybe_instrument_return (tree fndecl)
 {
   if (VOID_TYPE_P (TREE_TYPE (TREE_TYPE (fndecl)))
       || DECL_CONSTRUCTOR_P (fndecl)
@@ -1600,7 +1601,16 @@ cp_ubsan_maybe_instrument_return (tree fndecl)
   tree *p = &DECL_SAVED_TREE (fndecl);
   if (TREE_CODE (*p) == BIND_EXPR)
     p = &BIND_EXPR_BODY (*p);
-  t = ubsan_instrument_return (DECL_SOURCE_LOCATION (fndecl));
+
+  location_t loc = DECL_SOURCE_LOCATION (fndecl);
+  if (sanitize_flags_p (SANITIZE_RETURN, fndecl))
+    t = ubsan_instrument_return (loc);
+  else
+    {
+      tree fndecl = builtin_decl_explicit (BUILT_IN_UNREACHABLE);
+      t = build_call_expr_loc (BUILTINS_LOCATION, fndecl, 0);
+    }
+
   append_to_statement_list (t, p);
 }
 
@@ -1674,9 +1684,7 @@ cp_genericize (tree fndecl)
      walk_tree's hash functionality.  */
   cp_genericize_tree (&DECL_SAVED_TREE (fndecl), true);
 
-  if (sanitize_flags_p (SANITIZE_RETURN)
-      && current_function_decl != NULL_TREE)
-    cp_ubsan_maybe_instrument_return (fndecl);
+  cp_maybe_instrument_return (fndecl);
 
   /* Do everything else.  */
   c_genericize (fndecl);
diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c
index f7bbd7f2cde..59e7f028b09 100644
--- a/gcc/fortran/options.c
+++ b/gcc/fortran/options.c
@@ -430,6 +430,9 @@ gfc_post_options (const char **pfilename)
     gfc_fatal_error ("Maximum subrecord length cannot exceed %d",
 		     MAX_SUBRECORD_LENGTH);
 
+  if (warn_return_type == -1)
+    warn_return_type = 0;
+
   gfc_cpp_post_options ();
 
   if (gfc_option.allow_std & GFC_STD_F2008)
-- 
2.14.2


^ permalink raw reply	[flat|nested] 64+ messages in thread

* [PATCH] Fix all tests that fail with -sanitize=return.
  2017-10-12  9:36         ` Jakub Jelinek
  2017-10-18 12:47           ` Martin Liška
@ 2017-10-18 12:48           ` Martin Liška
  2017-10-24 14:39             ` Jason Merrill
  2017-10-18 12:53           ` [PATCH] Fix test-suite fallout of default -Wreturn-type Martin Liška
  2 siblings, 1 reply; 64+ messages in thread
From: Martin Liška @ 2017-10-18 12:48 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Jason Merrill, gcc-patches List, Jonathan Wakely

[-- Attachment #1: Type: text/plain, Size: 203 bytes --]

Hello.

This is first patch that addresses test-suite fallout. All these tests fail in runtime.

Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.

Ready to be installed?
Martin

[-- Attachment #2: 0002-Fix-all-tests-that-fail-with-sanitize-return.patch --]
[-- Type: text/x-patch, Size: 17374 bytes --]

From f945460bccf6d54e790bf7c4cacac7cb5b915a28 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Tue, 3 Oct 2017 17:28:43 +0200
Subject: [PATCH 2/3] Fix all tests that fail with -sanitize=return.

gcc/testsuite/ChangeLog:

2017-10-18  Martin Liska  <mliska@suse.cz>

	* c-c++-common/dfp/call-by-value.c (foo32): Return a default
	value of change return type to void.
	(foo64): Likewise.
	(foo128): Likewise.
	* g++.dg/bprob/g++-bprob-1.C: Likewise.
	* g++.dg/cpp0x/lambda/lambda-template.C (f): Likewise.
	* g++.dg/cpp0x/range-for6.C (foo): Likewise.
	* g++.dg/cpp0x/udlit-template.C: Likewise.
	* g++.dg/cpp1z/eval-order3.C (struct A): Likewise.
	(operator>>): Likewise.
	* g++.dg/expr/cond12.C (struct X): Likewise.
	(X::operator=): Likewise.
	* g++.dg/gcov/gcov-1.C: Likewise.
	* g++.dg/gcov/gcov-threads-1.C (ContentionNoDeadlock_thread): Likewise.
	* g++.dg/ipa/devirt-21.C: Likewise.
	* g++.dg/ipa/devirt-23.C: Likewise.
	* g++.dg/ipa/devirt-34.C (t): Likewise.
	* g++.dg/missing-return.C: New test. Likewise.
	* g++.dg/opt/20050511-1.C (bar): Likewise.
	* g++.dg/opt/const3.C (A::foo1): Likewise.
	(A::foo2): Likewise.
	* g++.dg/opt/pr23299.C (E::c): Likewise.
	* g++.dg/other/copy2.C (A::operator=): Likewise.
	* g++.dg/overload/addr1.C: Likewise.
	* g++.dg/pr48484.C: Likewise.
	* g++.dg/tls/thread_local3.C (thread_main): Likewise.
	* g++.dg/tls/thread_local3g.C (thread_main): Likewise.
	* g++.dg/tls/thread_local5.C (thread_main): Likewise.
	* g++.dg/tls/thread_local5g.C (thread_main): Likewise.
	* g++.dg/tls/thread_local6.C (thread_main): Likewise.
	* g++.dg/tls/thread_local6g.C (thread_main): Likewise.
	* g++.dg/torture/pr34850.C (OctetString::operator^=): Likewise.
	* g++.dg/tree-prof/pr79259.C (fn2): Likewise.
	* g++.dg/tree-ssa/pr33604.C (struct Value): Likewise.
	* g++.dg/tree-ssa/pr81408.C (struct p): Likewise.
	(av): Likewise.
	* g++.dg/warn/string1.C (test): Likewise.
---
 gcc/testsuite/c-c++-common/dfp/call-by-value.c      |  6 +++---
 gcc/testsuite/g++.dg/bprob/g++-bprob-1.C            |  2 +-
 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template.C |  2 +-
 gcc/testsuite/g++.dg/cpp0x/range-for6.C             |  2 ++
 gcc/testsuite/g++.dg/cpp0x/udlit-template.C         |  2 +-
 gcc/testsuite/g++.dg/cpp1z/eval-order3.C            |  4 ++--
 gcc/testsuite/g++.dg/expr/cond12.C                  |  8 +++++++-
 gcc/testsuite/g++.dg/gcov/gcov-1.C                  |  2 +-
 gcc/testsuite/g++.dg/gcov/gcov-threads-1.C          |  2 ++
 gcc/testsuite/g++.dg/ipa/devirt-21.C                |  2 +-
 gcc/testsuite/g++.dg/ipa/devirt-23.C                |  2 +-
 gcc/testsuite/g++.dg/ipa/devirt-34.C                |  2 ++
 gcc/testsuite/g++.dg/missing-return.C               |  8 ++++++++
 gcc/testsuite/g++.dg/opt/20050511-1.C               |  2 ++
 gcc/testsuite/g++.dg/opt/const3.C                   |  4 ++--
 gcc/testsuite/g++.dg/opt/pr23299.C                  |  2 ++
 gcc/testsuite/g++.dg/other/copy2.C                  | 10 +++++++---
 gcc/testsuite/g++.dg/overload/addr1.C               |  2 +-
 gcc/testsuite/g++.dg/pr48484.C                      |  3 +++
 gcc/testsuite/g++.dg/tls/thread_local3.C            |  1 +
 gcc/testsuite/g++.dg/tls/thread_local3g.C           |  1 +
 gcc/testsuite/g++.dg/tls/thread_local5.C            |  1 +
 gcc/testsuite/g++.dg/tls/thread_local5g.C           |  1 +
 gcc/testsuite/g++.dg/tls/thread_local6.C            |  1 +
 gcc/testsuite/g++.dg/tls/thread_local6g.C           |  1 +
 gcc/testsuite/g++.dg/torture/pr34850.C              |  6 ++++++
 gcc/testsuite/g++.dg/tree-prof/pr79259.C            |  2 ++
 gcc/testsuite/g++.dg/tree-ssa/pr33604.C             |  2 +-
 gcc/testsuite/g++.dg/tree-ssa/pr81408.C             | 12 ++++++------
 gcc/testsuite/g++.dg/warn/string1.C                 |  2 ++
 30 files changed, 72 insertions(+), 25 deletions(-)
 create mode 100644 gcc/testsuite/g++.dg/missing-return.C

diff --git a/gcc/testsuite/c-c++-common/dfp/call-by-value.c b/gcc/testsuite/c-c++-common/dfp/call-by-value.c
index 74aec53aefb..e7aea3076cf 100644
--- a/gcc/testsuite/c-c++-common/dfp/call-by-value.c
+++ b/gcc/testsuite/c-c++-common/dfp/call-by-value.c
@@ -5,17 +5,17 @@
 
 #include "dfp-dbg.h"
 
-int foo32 (_Decimal32 z)
+void foo32 (_Decimal32 z)
 {
   z = z + 1.0df;
 }
 
-int foo64 (_Decimal64 z)
+void foo64 (_Decimal64 z)
 {
   z = z + 1.0dd;
 }
 
-int foo128 (_Decimal128 z)
+void foo128 (_Decimal128 z)
 {
   z = z + 1.0dl;
 }
diff --git a/gcc/testsuite/g++.dg/bprob/g++-bprob-1.C b/gcc/testsuite/g++.dg/bprob/g++-bprob-1.C
index b1a1de77e98..3aafc06d51d 100644
--- a/gcc/testsuite/g++.dg/bprob/g++-bprob-1.C
+++ b/gcc/testsuite/g++.dg/bprob/g++-bprob-1.C
@@ -35,7 +35,7 @@ test_for2 (int m, int n, int o)
   return for_temp;			/* count(6) */
 }
 
-int
+void
 call_for ()
 {
   for_val1 += test_for1 (0);
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template.C
index 66cc7a4e1df..17c6a6e5b52 100644
--- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template.C
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template.C
@@ -9,7 +9,7 @@ auto apply (T t) -> decltype (t())
 }
 
 template <class T>
-T f(T t)
+void f(T t)
 {
   T t2 = t;
   if (t != [=]()->T { return t; }())
diff --git a/gcc/testsuite/g++.dg/cpp0x/range-for6.C b/gcc/testsuite/g++.dg/cpp0x/range-for6.C
index 366499a34d8..b4d9dd720ee 100644
--- a/gcc/testsuite/g++.dg/cpp0x/range-for6.C
+++ b/gcc/testsuite/g++.dg/cpp0x/range-for6.C
@@ -14,6 +14,8 @@ template<typename T> T foo()
         sum += x;
     if (sum != T(10))
         abort();
+
+    return sum;
 }
 
 int main()
diff --git a/gcc/testsuite/g++.dg/cpp0x/udlit-template.C b/gcc/testsuite/g++.dg/cpp0x/udlit-template.C
index de21b66028f..15583199297 100644
--- a/gcc/testsuite/g++.dg/cpp0x/udlit-template.C
+++ b/gcc/testsuite/g++.dg/cpp0x/udlit-template.C
@@ -23,7 +23,7 @@ template<>
   operator"" _abc<'6','6','6'>()
   { return 21; }
 
-int
+void
 test1()
 {
   int i = operator"" _abc<'1','2','3'>();
diff --git a/gcc/testsuite/g++.dg/cpp1z/eval-order3.C b/gcc/testsuite/g++.dg/cpp1z/eval-order3.C
index 966ac0a6523..b53e96a9f8f 100644
--- a/gcc/testsuite/g++.dg/cpp1z/eval-order3.C
+++ b/gcc/testsuite/g++.dg/cpp1z/eval-order3.C
@@ -26,7 +26,7 @@ struct A
   int _i;
   A(int i): _i(f(i)) { }
   A& memfn(int i, int j) { f(j); return *this; }
-  int operator<<(int i) { }
+  int operator<<(int i) { return 0; }
   A& operator=(const A&) { return *this; }
   A& operator+=(int i) { return *this; }
 };
@@ -38,7 +38,7 @@ struct B
   B(int i): _i(f(i)) { }
 };
 
-int operator>>(A&, int i) { }
+int operator>>(A&, int i) { return 0; }
 
 A a(0);
 A* afn(int i)
diff --git a/gcc/testsuite/g++.dg/expr/cond12.C b/gcc/testsuite/g++.dg/expr/cond12.C
index 9134f81668f..90d77dbd708 100644
--- a/gcc/testsuite/g++.dg/expr/cond12.C
+++ b/gcc/testsuite/g++.dg/expr/cond12.C
@@ -2,10 +2,16 @@
 // { dg-do run }
 
 struct X {
-    X& operator=(const X&){}
+    X& operator=(const X&);
     X& operator=(X&){__builtin_abort();}
 };
 
+X g;
+X& X::operator=(const X&)
+{
+  return g;
+}
+
 int main(int argv,char**) {
   X a, b;
   ((argv > 2) ? a : b) = X();
diff --git a/gcc/testsuite/g++.dg/gcov/gcov-1.C b/gcc/testsuite/g++.dg/gcov/gcov-1.C
index c279b1452fc..9018b9a3a73 100644
--- a/gcc/testsuite/g++.dg/gcov/gcov-1.C
+++ b/gcc/testsuite/g++.dg/gcov/gcov-1.C
@@ -74,7 +74,7 @@ test_for2 (int m, int n, int o)
   return for_temp;			/* count(6) */
 }
 
-int
+void
 call_for ()
 {
   for_val1 += test_for1 (0);
diff --git a/gcc/testsuite/g++.dg/gcov/gcov-threads-1.C b/gcc/testsuite/g++.dg/gcov/gcov-threads-1.C
index cc9266ab8ea..eb558614c18 100644
--- a/gcc/testsuite/g++.dg/gcov/gcov-threads-1.C
+++ b/gcc/testsuite/g++.dg/gcov/gcov-threads-1.C
@@ -19,6 +19,8 @@ static void *ContentionNoDeadlock_thread(void *start)
       for (int32_t i = NR - 1; i >= starti; --i)
 	pthread_mutex_unlock (&cndMs[i]);
   }
+
+  return 0;
 }
 int main(int argc, char **argv) {
   for (unsigned i = 0; i < NR; i++)
diff --git a/gcc/testsuite/g++.dg/ipa/devirt-21.C b/gcc/testsuite/g++.dg/ipa/devirt-21.C
index a33be4eca04..440570c8ddb 100644
--- a/gcc/testsuite/g++.dg/ipa/devirt-21.C
+++ b/gcc/testsuite/g++.dg/ipa/devirt-21.C
@@ -12,7 +12,7 @@ class MultiTermDocs : public virtual B {
 protected:
   A readerTermDocs;
   A subReaders;
-  virtual B *m_fn1(int *) {}
+  virtual B *m_fn1(int *) { return NULL; }
   virtual inline  ~MultiTermDocs();
   void wrap(void)
   {
diff --git a/gcc/testsuite/g++.dg/ipa/devirt-23.C b/gcc/testsuite/g++.dg/ipa/devirt-23.C
index 665e953cae7..76fc3fde42b 100644
--- a/gcc/testsuite/g++.dg/ipa/devirt-23.C
+++ b/gcc/testsuite/g++.dg/ipa/devirt-23.C
@@ -12,7 +12,7 @@ class MultiTermDocs : public virtual B {
 protected:
   A readerTermDocs;
   A subReaders;
-  virtual B *m_fn1(int *) {}
+  virtual B *m_fn1(int *) { return NULL; }
   virtual inline  ~MultiTermDocs();
   inline void wrap(void)
   {
diff --git a/gcc/testsuite/g++.dg/ipa/devirt-34.C b/gcc/testsuite/g++.dg/ipa/devirt-34.C
index 030e08bba8a..083c305665f 100644
--- a/gcc/testsuite/g++.dg/ipa/devirt-34.C
+++ b/gcc/testsuite/g++.dg/ipa/devirt-34.C
@@ -10,6 +10,8 @@ t(struct B *b)
 {
   struct A *a=b;
   a->t();
+
+  return 0;
 }
 
 /* We should guess that the pointer of type B probably points to an instance
diff --git a/gcc/testsuite/g++.dg/missing-return.C b/gcc/testsuite/g++.dg/missing-return.C
new file mode 100644
index 00000000000..f7fcfebb2b4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/missing-return.C
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-Wreturn-type -fdump-tree-optimized" } */
+
+int foo(int a)
+{
+} /* { dg-warning "no return statement" } */
+
+/* { dg-final { scan-tree-dump "__builtin_unreachable" "optimized" } } */
diff --git a/gcc/testsuite/g++.dg/opt/20050511-1.C b/gcc/testsuite/g++.dg/opt/20050511-1.C
index a8929030af4..a840fb0db8e 100644
--- a/gcc/testsuite/g++.dg/opt/20050511-1.C
+++ b/gcc/testsuite/g++.dg/opt/20050511-1.C
@@ -53,6 +53,8 @@ UINT32 bar (const C * sPtr)
 
   if (a.xy[0] != ((SINT16) 0xffff << 2))
 	abort ();
+
+  return 0;
 }
 
 int main()
diff --git a/gcc/testsuite/g++.dg/opt/const3.C b/gcc/testsuite/g++.dg/opt/const3.C
index c7c0a1645de..969df91e6e1 100644
--- a/gcc/testsuite/g++.dg/opt/const3.C
+++ b/gcc/testsuite/g++.dg/opt/const3.C
@@ -30,8 +30,8 @@ struct A
 
 int i;
 
-int A::foo1(void *ios, const char *str) { }
-int A::foo2(int v, const Type t) { i=0; }
+int A::foo1(void *ios, const char *str) { return 0; }
+int A::foo2(int v, const Type t) { i=0; return 0; }
 
 int main()
 {
diff --git a/gcc/testsuite/g++.dg/opt/pr23299.C b/gcc/testsuite/g++.dg/opt/pr23299.C
index 94a414aa5f7..b791bf954e8 100644
--- a/gcc/testsuite/g++.dg/opt/pr23299.C
+++ b/gcc/testsuite/g++.dg/opt/pr23299.C
@@ -50,6 +50,8 @@ E::c ()
   if (x > 10)
     throw 1;
   x |= 2;
+
+  return x;
 }
 
 int
diff --git a/gcc/testsuite/g++.dg/other/copy2.C b/gcc/testsuite/g++.dg/other/copy2.C
index 335cab8d19f..df480f06ecc 100644
--- a/gcc/testsuite/g++.dg/other/copy2.C
+++ b/gcc/testsuite/g++.dg/other/copy2.C
@@ -10,11 +10,15 @@ class A
 {
 public:
   int i;
-  A &operator =(const A &i)
-  {
+  A &operator =(const A &i);
+};
+
+A a;
+
+A& A::operator=(const A &i)  {
     status = 0;
+    return a;
   }
-};
 
 class B
 {
diff --git a/gcc/testsuite/g++.dg/overload/addr1.C b/gcc/testsuite/g++.dg/overload/addr1.C
index 25856a20fc6..4eb9e2f31ca 100644
--- a/gcc/testsuite/g++.dg/overload/addr1.C
+++ b/gcc/testsuite/g++.dg/overload/addr1.C
@@ -11,7 +11,7 @@ static int flag = 0;
 
 template <typename> struct A
 {
-  A &active ()  { flag++;}
+  A &active () { flag++; static A a; return a; }
   
   static void foo() {}
 
diff --git a/gcc/testsuite/g++.dg/pr48484.C b/gcc/testsuite/g++.dg/pr48484.C
index 1380c452fa4..19e9b9a8d0a 100644
--- a/gcc/testsuite/g++.dg/pr48484.C
+++ b/gcc/testsuite/g++.dg/pr48484.C
@@ -65,6 +65,8 @@ bool
 	jump = 0;
       }
     }
+
+  return false;
 }
 
 bool
@@ -102,4 +104,5 @@ bool
 	}
     }
 
+  return true;
 }
diff --git a/gcc/testsuite/g++.dg/tls/thread_local3.C b/gcc/testsuite/g++.dg/tls/thread_local3.C
index e05a0b95306..d29bda1a000 100644
--- a/gcc/testsuite/g++.dg/tls/thread_local3.C
+++ b/gcc/testsuite/g++.dg/tls/thread_local3.C
@@ -21,6 +21,7 @@ void f()
 void *thread_main(void *)
 {
   f(); f(); f();
+  return 0;
 }
 
 #include <pthread.h>
diff --git a/gcc/testsuite/g++.dg/tls/thread_local3g.C b/gcc/testsuite/g++.dg/tls/thread_local3g.C
index a3c9ebcc2c5..2f9fdee1a73 100644
--- a/gcc/testsuite/g++.dg/tls/thread_local3g.C
+++ b/gcc/testsuite/g++.dg/tls/thread_local3g.C
@@ -19,6 +19,7 @@ thread_local A a;
 void *thread_main(void *)
 {
   A* ap = &a;
+  return 0;
 }
 
 #include <pthread.h>
diff --git a/gcc/testsuite/g++.dg/tls/thread_local5.C b/gcc/testsuite/g++.dg/tls/thread_local5.C
index c4d5ff01bf5..61fea722dc2 100644
--- a/gcc/testsuite/g++.dg/tls/thread_local5.C
+++ b/gcc/testsuite/g++.dg/tls/thread_local5.C
@@ -30,6 +30,7 @@ void f()
 void *thread_main(void *)
 {
   f(); f(); f();
+  return 0;
 }
 
 int main()
diff --git a/gcc/testsuite/g++.dg/tls/thread_local5g.C b/gcc/testsuite/g++.dg/tls/thread_local5g.C
index 5ced551fb57..596bbbe542f 100644
--- a/gcc/testsuite/g++.dg/tls/thread_local5g.C
+++ b/gcc/testsuite/g++.dg/tls/thread_local5g.C
@@ -28,6 +28,7 @@ thread_local A a;
 void *thread_main(void *)
 {
   A* ap = &a;
+  return 0;
 }
 
 int main()
diff --git a/gcc/testsuite/g++.dg/tls/thread_local6.C b/gcc/testsuite/g++.dg/tls/thread_local6.C
index 2810efaea93..0009726626b 100644
--- a/gcc/testsuite/g++.dg/tls/thread_local6.C
+++ b/gcc/testsuite/g++.dg/tls/thread_local6.C
@@ -22,6 +22,7 @@ void f()
 void *thread_main(void *)
 {
   f(); f(); f();
+  return 0;
 }
 
 int main()
diff --git a/gcc/testsuite/g++.dg/tls/thread_local6g.C b/gcc/testsuite/g++.dg/tls/thread_local6g.C
index b8f9cdf1dea..d357ca4fa1f 100644
--- a/gcc/testsuite/g++.dg/tls/thread_local6g.C
+++ b/gcc/testsuite/g++.dg/tls/thread_local6g.C
@@ -20,6 +20,7 @@ thread_local A a;
 void *thread_main(void *)
 {
   A* ap = &a;
+  return 0;
 }
 
 int main()
diff --git a/gcc/testsuite/g++.dg/torture/pr34850.C b/gcc/testsuite/g++.dg/torture/pr34850.C
index c33dbfb5c93..c2538288964 100644
--- a/gcc/testsuite/g++.dg/torture/pr34850.C
+++ b/gcc/testsuite/g++.dg/torture/pr34850.C
@@ -13,6 +13,8 @@ extern "C" {
     void * memset (void *__dest, int __ch, size_t __len) throw () {
 	if (__builtin_constant_p (__len) && __len == 0)
 	    __warn_memset_zero_len (); /* { dg-warning "declared with attribute warning" } */
+
+	return __dest;
     }
 }
 inline void clear_mem(void* ptr, u32bit n)    {
@@ -50,11 +52,13 @@ template<typename T> class SecureVector : public MemoryRegion<T>    {
 public:
     SecureVector<T>& operator=(const MemoryRegion<T>& in)          {
 	if(this != &in) this->set(in);
+	return *this;
     }
 };
 class OctetString    {
 public:
     SecureVector<byte> bits_of() const {
+	return SecureVector<byte> ();
     }
     OctetString& operator^=(const OctetString&);
     void change(const MemoryRegion<byte>& in) {
@@ -69,6 +73,8 @@ OctetString& OctetString::operator^=(const OctetString& k)    {
     if(&k == this) {
 	bits.clear();
     }
+
+    return *this;
 }
 bool __attribute__((flatten))
 operator==(const OctetString& s1, const OctetString& s2)    {
diff --git a/gcc/testsuite/g++.dg/tree-prof/pr79259.C b/gcc/testsuite/g++.dg/tree-prof/pr79259.C
index a55172b62d2..6125a179bdc 100644
--- a/gcc/testsuite/g++.dg/tree-prof/pr79259.C
+++ b/gcc/testsuite/g++.dg/tree-prof/pr79259.C
@@ -11,6 +11,8 @@ fn2 ()
 {
   if (a (c == 0))
     return 0;
+
+  return 0;
 }
 
 int main()
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr33604.C b/gcc/testsuite/g++.dg/tree-ssa/pr33604.C
index 1c0f550bfdf..668db49d146 100644
--- a/gcc/testsuite/g++.dg/tree-ssa/pr33604.C
+++ b/gcc/testsuite/g++.dg/tree-ssa/pr33604.C
@@ -6,7 +6,7 @@ struct Value
   double value;
   Value(double value_) : value (value_) {}
   operator double() const { return value; }
-  Value& operator=(double other) { value = other; }
+  Value& operator=(double other) { value = other; return *this; }
 };
 
 struct Ref
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr81408.C b/gcc/testsuite/g++.dg/tree-ssa/pr81408.C
index f94544b9e2d..60e6e5277d7 100644
--- a/gcc/testsuite/g++.dg/tree-ssa/pr81408.C
+++ b/gcc/testsuite/g++.dg/tree-ssa/pr81408.C
@@ -1,5 +1,9 @@
 /* { dg-do compile } */
 /* { dg-options "-O2 -std=gnu++11 -fopt-info-loop-missed -Wunsafe-loop-optimizations" } */
+struct p
+{
+  char *ay;
+};
 
 namespace a {
 void b () __attribute__ ((__noreturn__));
@@ -19,7 +23,7 @@ template <typename j, typename> class k
   j l;
 
 public:
-  typename d<j>::f operator* () {}
+  typename d<j>::f operator* () { return p(); }
   void operator++ () { ++l; }
   j
   aa ()
@@ -33,7 +37,6 @@ operator!= (k<m, ab> o, k<n, ab> p2)
 {
   return o.aa () != p2.aa ();
 }
-struct p;
 namespace a {
 struct F
 {
@@ -75,13 +78,10 @@ at
 av (au o)
 {
   o.aq ('\n');
+  return at();
 }
 u ax;
 }
-struct p
-{
-  char *ay;
-};
 a::H t;
 void
 ShowHelpListCommands ()
diff --git a/gcc/testsuite/g++.dg/warn/string1.C b/gcc/testsuite/g++.dg/warn/string1.C
index 2670f63d931..8f24a78f709 100644
--- a/gcc/testsuite/g++.dg/warn/string1.C
+++ b/gcc/testsuite/g++.dg/warn/string1.C
@@ -15,4 +15,6 @@ int test() {
   //
   std::string s = "";
   s += 'x' + "y";	      // { dg-warning "bounds of constant string" }
+
+  return 0;
 }
-- 
2.14.2


^ permalink raw reply	[flat|nested] 64+ messages in thread

* [PATCH] Fix test-suite fallout of default -Wreturn-type.
  2017-10-12  9:36         ` Jakub Jelinek
  2017-10-18 12:47           ` Martin Liška
  2017-10-18 12:48           ` [PATCH] Fix all tests that fail with -sanitize=return Martin Liška
@ 2017-10-18 12:53           ` Martin Liška
  2017-10-24 14:40             ` Jason Merrill
                               ` (2 more replies)
  2 siblings, 3 replies; 64+ messages in thread
From: Martin Liška @ 2017-10-18 12:53 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Jason Merrill, gcc-patches List, Jonathan Wakely

[-- Attachment #1: Type: text/plain, Size: 236 bytes --]

Hello.

This is second patch that addresses test-suite fallout. All these tests fail because -Wreturn-type is
now on by default.

Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.

Ready to be installed?
Martin

[-- Attachment #2: 0003-Fix-test-suite-fallout-of-default-Wreturn-type.patch --]
[-- Type: text/x-patch, Size: 297500 bytes --]

From 0bedb7990a1313a3eec7aa2c9566b74644d40716 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Thu, 12 Oct 2017 10:10:51 +0200
Subject: [PATCH 3/3] Fix test-suite fallout of default -Wreturn-type.

gcc/testsuite/ChangeLog:

2017-10-18  Martin Liska  <mliska@suse.cz>

	* c-c++-common/Wimplicit-fallthrough-8.c: Return a value for
	functions with non-void return type, or change type to void, or
	add -Wno-return-type for test.
	* c-c++-common/asan/pr63638.c (f): Likewise.
	* c-c++-common/goacc/parallel-1.c (firstprivate): Likewise.
	* c-c++-common/gomp/sink-1.c (depend): Likewise.
	* c-c++-common/missing-symbol.c: Likewise.
	* c-c++-common/pr36513-2.c (main2): Likewise.
	* c-c++-common/pr36513.c (main1): Likewise.
	* c-c++-common/pr49706-2.c: Likewise.
	* c-c++-common/pr65120.c: Likewise.
	* c-c++-common/tm/volatile-1.c (f): Likewise.
	* c-c++-common/vector-1.c (f): Likewise.
	* c-c++-common/vector-2.c (f): Likewise.
	* g++.dg/abi/abi-tag14.C (f): Likewise.
	(g): Likewise.
	* g++.dg/abi/abi-tag18.C (f): Likewise.
	* g++.dg/abi/abi-tag18a.C (f): Likewise.
	* g++.dg/abi/covariant2.C (struct c3): Likewise.
	(struct c7): Likewise.
	* g++.dg/abi/covariant3.C (c1::f6): Likewise.
	* g++.dg/abi/mangle7.C (f1): Likewise.
	* g++.dg/asan/pr81340.C (class e): Likewise.
	(e::f): Likewise.
	* g++.dg/concepts/fn8.C (struct S): Likewise.
	* g++.dg/concepts/pr65575.C (f): Likewise.
	* g++.dg/concepts/template-parm11.C (f): Likewise.
	* g++.dg/conversion/op6.C: Likewise.
	* g++.dg/cpp0x/Wunused-variable-1.C (foo): Likewise.
	* g++.dg/cpp0x/access01.C: Likewise.
	* g++.dg/cpp0x/alignas3.C (class alignas): Likewise.
	* g++.dg/cpp0x/auto2.C (f): Likewise.
	(struct A): Likewise.
	(main): Likewise.
	* g++.dg/cpp0x/constexpr-array17.C (struct D): Likewise.
	* g++.dg/cpp0x/constexpr-defarg2.C (a): Likewise.
	(B::foo): Likewise.
	(B::bar): Likewise.
	* g++.dg/cpp0x/constexpr-diag3.C (g): Likewise.
	* g++.dg/cpp0x/constexpr-memfn1.C (struct Y): Likewise.
	* g++.dg/cpp0x/constexpr-neg3.C: Likewise.
	* g++.dg/cpp0x/dc1.C (struct D): Likewise.
	* g++.dg/cpp0x/dc3.C (struct D): Likewise.
	* g++.dg/cpp0x/decltype12.C: Likewise.
	* g++.dg/cpp0x/decltype17.C (main): Likewise.
	* g++.dg/cpp0x/decltype3.C: Likewise.
	* g++.dg/cpp0x/decltype41.C (struct C): Likewise.
	(struct D): Likewise.
	* g++.dg/cpp0x/defaulted28.C (f): Likewise.
	* g++.dg/cpp0x/enum_base3.C (struct D): Likewise.
	* g++.dg/cpp0x/gen-attrs-4.C (five): Likewise.
	* g++.dg/cpp0x/initlist96.C: Likewise.
	* g++.dg/cpp0x/lambda/lambda-58566.C (struct A): Likewise.
	* g++.dg/cpp0x/lambda/lambda-conv10.C: Likewise.
	* g++.dg/cpp0x/lambda/lambda-conv12.C: Likewise.
	* g++.dg/cpp0x/lambda/lambda-defarg3.C: Likewise.
	* g++.dg/cpp0x/lambda/lambda-ice3.C (Klass::dostuff): Likewise.
	* g++.dg/cpp0x/lambda/lambda-ice5.C (foo): Likewise.
	* g++.dg/cpp0x/lambda/lambda-nested2.C (f1): Likewise.
	* g++.dg/cpp0x/lambda/lambda-template12.C (class X): Likewise.
	* g++.dg/cpp0x/lambda/lambda-template2.C (struct T): Likewise.
	* g++.dg/cpp0x/lambda/lambda-this12.C (struct A): Likewise.
	* g++.dg/cpp0x/nolinkage1.C (main): Likewise.
	* g++.dg/cpp0x/nolinkage1a.cc (dummy): Likewise.
	* g++.dg/cpp0x/nsdmi-template5.C: Likewise.
	* g++.dg/cpp0x/parse1.C (B::B): Likewise.
	* g++.dg/cpp0x/pr34054.C (foo): Likewise.
	* g++.dg/cpp0x/pr47416.C: Likewise.
	* g++.dg/cpp0x/pr58781.C: Likewise.
	* g++.dg/cpp0x/pr70538.C: Likewise.
	* g++.dg/cpp0x/pr81325.C: Likewise.
	* g++.dg/cpp0x/range-for13.C (begin): Likewise.
	(end): Likewise.
	* g++.dg/cpp0x/range-for14.C (begin): Likewise.
	(end): Likewise.
	* g++.dg/cpp0x/rv2n.C (test2_18): Likewise.
	(test2_28): Likewise.
	(test2_38): Likewise.
	(test2_58): Likewise.
	(test2_68): Likewise.
	(test2_78): Likewise.
	* g++.dg/cpp0x/rv3n.C (test3_128): Likewise.
	* g++.dg/cpp0x/static_assert10.C (foo): Likewise.
	* g++.dg/cpp0x/static_assert11.C (struct A): Likewise.
	* g++.dg/cpp0x/static_assert12.C: Likewise.
	* g++.dg/cpp0x/static_assert13.C: Likewise.
	* g++.dg/cpp0x/trailing1.C (struct A): Likewise.
	* g++.dg/cpp0x/trailing5.C (foo): Likewise.
	(bar): Likewise.
	* g++.dg/cpp0x/variadic114.C: Likewise.
	* g++.dg/cpp0x/variadic57.C (Dims...>::foo): Likewise.
	(bar): Likewise.
	* g++.dg/cpp0x/variadic65.C: Likewise.
	* g++.dg/cpp0x/variadic66.C (bind): Likewise.
	* g++.dg/cpp0x/variadic97.C: Likewise.
	* g++.dg/cpp0x/variadic98.C (__attribute__): Likewise.
	* g++.dg/cpp1y/auto-fn11.C: Likewise.
	* g++.dg/cpp1y/auto-fn29.C: Likewise.
	* g++.dg/cpp1y/auto-fn38.C: Likewise.
	* g++.dg/cpp1y/constexpr-return2.C: Likewise.
	* g++.dg/cpp1y/lambda-init7.C (foo): Likewise.
	* g++.dg/cpp1y/pr63996.C: Likewise.
	* g++.dg/cpp1y/pr65202.C: Likewise.
	* g++.dg/cpp1y/pr66443-cxx14.C (Ok): Likewise.
	* g++.dg/cpp1y/pr79253.C (struct D): Likewise.
	* g++.dg/cpp1y/static_assert1.C: Likewise.
	* g++.dg/cpp1y/static_assert2.C: Likewise.
	* g++.dg/cpp1y/var-templ44.C: Likewise.
	* g++.dg/cpp1z/fold6.C (f): Likewise.
	* g++.dg/cpp1z/inline-var2.C (foo): Likewise.
	* g++.dg/cpp1z/lambda-this1.C (struct B): Likewise.
	* g++.dg/cpp1z/static_assert-nomsg.C: Likewise.
	* g++.dg/debug/dwarf-eh-personality-1.C (foobar): Likewise.
	* g++.dg/debug/dwarf2/dwarf4-typedef.C (struct B): Likewise.
	* g++.dg/debug/dwarf2/icf.C: Likewise.
	* g++.dg/debug/dwarf2/pr61433.C (main): Likewise.
	* g++.dg/debug/nullptr01.C (g): Likewise.
	* g++.dg/debug/pr16792.C (foo): Likewise.
	* g++.dg/debug/pr46241.C (class btCollisionWorld): Likewise.
	* g++.dg/debug/pr46338.C (struct S): Likewise.
	* g++.dg/debug/pr47106.C (baz): Likewise.
	(bar): Likewise.
	(foo): Likewise.
	* g++.dg/debug/pr71057.C (fn1): Likewise.
	* g++.dg/debug/pr71432.C (class CLIParameterType): Likewise.
	(CLIParameterType::checkSwitched): Likewise.
	* g++.dg/debug/pr80461.C (struct B): Likewise.
	* g++.dg/dfp/44473-1.C (bar): Likewise.
	* g++.dg/dfp/44473-2.C (bar): Likewise.
	(foo): Likewise.
	* g++.dg/eh/builtin1.C: Likewise.
	* g++.dg/eh/builtin2.C: Likewise.
	* g++.dg/eh/builtin3.C: Likewise.
	* g++.dg/eh/pr45569.C (j): Likewise.
	* g++.dg/eh/unwind2.C: Likewise.
	* g++.dg/expr/bitfield11.C: Likewise.
	* g++.dg/expr/static_cast7.C (f): Likewise.
	* g++.dg/ext/altivec-14.C: Likewise.
	* g++.dg/ext/asm13.C (fn1): Likewise.
	* g++.dg/ext/builtin-object-size3.C: Likewise.
	* g++.dg/ext/has_nothrow_assign_odr.C (main): Likewise.
	(S::operator=): Likewise.
	* g++.dg/ext/label7.C (f): Likewise.
	* g++.dg/ext/label8.C (f): Likewise.
	* g++.dg/ext/tmplattr7.C (test): Likewise.
	* g++.dg/ext/vector8.C (f): Likewise.
	* g++.dg/ext/visibility/anon1.C: Likewise.
	* g++.dg/ext/visibility/anon2.C (f): Likewise.
	* g++.dg/ext/visibility/namespace1.C (__attribute): Likewise.
	* g++.dg/ext/vla16.C (fn1): Likewise.
	* g++.dg/goacc/reference.C: Likewise.
	* g++.dg/gomp/pr37189.C: Likewise.
	* g++.dg/gomp/pr39495-1.C: Likewise.
	* g++.dg/gomp/pr39495-2.C: Likewise.
	* g++.dg/gomp/pr82054.C: Likewise.
	* g++.dg/inherit/covariant10.C (struct c6): Likewise.
	(struct c17): Likewise.
	* g++.dg/inherit/covariant11.C (struct c1): Likewise.
	(struct c3): Likewise.
	(struct c11): Likewise.
	(struct c15): Likewise.
	* g++.dg/inherit/protected1.C (A::operator==): Likewise.
	* g++.dg/init/inline1.C (struct A): Likewise.
	* g++.dg/init/new18.C: Likewise.
	* g++.dg/init/reference2.C (f): Likewise.
	* g++.dg/init/reference3.C: Likewise.
	* g++.dg/init/switch1.C (f): Likewise.
	* g++.dg/ipa/devirt-10.C (struct wxDCBase): Likewise.
	* g++.dg/ipa/devirt-13.C (main): Likewise.
	* g++.dg/ipa/devirt-14.C (main): Likewise.
	* g++.dg/ipa/devirt-15.C (main): Likewise.
	* g++.dg/ipa/devirt-16.C (main): Likewise.
	* g++.dg/ipa/devirt-17.C (main): Likewise.
	* g++.dg/ipa/devirt-18.C (main): Likewise.
	* g++.dg/ipa/devirt-19.C: Likewise.
	* g++.dg/ipa/devirt-21.C (main): Likewise.
	* g++.dg/ipa/devirt-23.C (main): Likewise.
	* g++.dg/ipa/devirt-38.C: Likewise.
	* g++.dg/ipa/devirt-40.C (A::m_fn1): Likewise.
	* g++.dg/ipa/devirt-41.C (main): Likewise.
	* g++.dg/ipa/devirt-42.C (main): Likewise.
	* g++.dg/ipa/devirt-44.C (struct A): Likewise.
	(main): Likewise.
	* g++.dg/ipa/devirt-45.C (struct A): Likewise.
	(main): Likewise.
	* g++.dg/ipa/devirt-48.C (struct B): Likewise.
	(struct D): Likewise.
	* g++.dg/ipa/devirt-52.C: Likewise.
	* g++.dg/ipa/nothrow-1.C (main): Likewise.
	* g++.dg/ipa/pr43812.C (LocalSurface::bbox): Likewise.
	* g++.dg/ipa/pr44372.C: Likewise.
	* g++.dg/ipa/pr45572-1.C (fgetc_unlocked): Likewise.
	(putc_unlocked): Likewise.
	(getline): Likewise.
	(ferror_unlocked): Likewise.
	* g++.dg/ipa/pr58371.C: Likewise.
	* g++.dg/ipa/pr59176.C: Likewise.
	* g++.dg/ipa/pr60640-1.C (class G): Likewise.
	* g++.dg/ipa/pr61540.C (struct top): Likewise.
	* g++.dg/ipa/pr63470.C (class FTjackSupport): Likewise.
	* g++.dg/ipa/pr63587-1.C: Likewise.
	* g++.dg/ipa/pr63587-2.C: Likewise.
	* g++.dg/ipa/pr63838.C (__attribute__): Likewise.
	* g++.dg/ipa/pr63894.C (J::m_fn3): Likewise.
	* g++.dg/ipa/pr64068.C (class A): Likewise.
	(A::m_fn2): Likewise.
	(class C): Likewise.
	* g++.dg/ipa/pr64896.C (struct D): Likewise.
	* g++.dg/ipa/pr65002.C: Likewise.
	* g++.dg/ipa/pr65008.C (__attribute__): Likewise.
	* g++.dg/ipa/pr65465.C (struct D): Likewise.
	* g++.dg/ipa/pr66896.C (struct A): Likewise.
	* g++.dg/ipa/pr68851.C (class G): Likewise.
	(C::checkPseudoClass): Likewise.
	* g++.dg/ipa/pr78211.C: Likewise.
	* g++.dg/ipa/pr79931.C (AttrImpl::insertBefore): Likewise.
	* g++.dg/ipa/pure-const-1.C (main): Likewise.
	* g++.dg/ipa/pure-const-2.C (main): Likewise.
	* g++.dg/ipa/pure-const-3.C (main): Likewise.
	* g++.dg/ipa/remref-1.C (main): Likewise.
	* g++.dg/ipa/remref-2.C (main): Likewise.
	* g++.dg/lookup/builtin2.C (f): Likewise.
	* g++.dg/lookup/crash3.C (struct A): Likewise.
	(struct B): Likewise.
	(crash): Likewise.
	* g++.dg/lookup/friend20.C: Likewise.
	* g++.dg/lookup/pr80891-5.C (vf2_subgraph_iso): Likewise.
	* g++.dg/lookup/struct2.C (A::c): Likewise.
	* g++.dg/lto/20080709_0.C (f): Likewise.
	* g++.dg/lto/20080907_0.C: Likewise.
	* g++.dg/lto/20080915_0.C (struct Baz): Likewise.
	* g++.dg/lto/20080916_0.C (g): Likewise.
	* g++.dg/lto/20081022_0.C (main): Likewise.
	* g++.dg/lto/20081023_0.C (main): Likewise.
	* g++.dg/lto/20081118_0.C (foo::method): Likewise.
	* g++.dg/lto/20081118_1.C (bar::method): Likewise.
	* g++.dg/lto/20081120-1_0.C: Likewise.
	* g++.dg/lto/20081120-1_1.C: Likewise.
	* g++.dg/lto/20081127_1.C (main): Likewise.
	* g++.dg/lto/20081217-2_0.C (struct A): Likewise.
	* g++.dg/lto/20090303_0.C: Likewise.
	* g++.dg/lto/20090311-1_0.C: Likewise.
	* g++.dg/lto/20090312_0.C: Likewise.
	* g++.dg/lto/20090315_0.C (main): Likewise.
	* g++.dg/lto/20091002-1_0.C: Likewise.
	* g++.dg/lto/20091002-2_0.C (class DataArray): Likewise.
	* g++.dg/lto/20091002-3_0.C (class DataArray): Likewise.
	* g++.dg/lto/20091004-1_0.C: Likewise.
	* g++.dg/lto/20091004-2_0.C: Likewise.
	* g++.dg/lto/20091004-3_1.C (All_Torus_Intersections): Likewise.
	* g++.dg/lto/20100721-1_0.C (__gthread_active_p): Likewise.
	* g++.dg/lto/20101010-1_0.C: Likewise.
	* g++.dg/lto/20101010-2_0.C: Likewise.
	* g++.dg/lto/pr45679-1_0.C: Likewise.
	* g++.dg/lto/pr45679-1_1.C: Likewise.
	* g++.dg/lto/pr45679-2_0.C: Likewise.
	* g++.dg/lto/pr48042_0.C (B::x): Likewise.
	* g++.dg/lto/pr51650-1_0.C (fn): Likewise.
	(main): Likewise.
	* g++.dg/lto/pr51650-3_0.C (fn): Likewise.
	(main): Likewise.
	* g++.dg/lto/pr63270_1.C: Likewise.
	* g++.dg/lto/pr65193_0.C: Likewise.
	* g++.dg/lto/pr65302_0.C: Likewise.
	* g++.dg/lto/pr65316_0.C: Likewise.
	* g++.dg/lto/pr65475c_0.C: Likewise.
	* g++.dg/lto/pr65549_0.C (main): Likewise.
	* g++.dg/lto/pr69077_0.C (cWeightedStdDev::netPack): Likewise.
	* g++.dg/lto/pr69589_0.C: Likewise.
	* g++.dg/opt/combine.C (qvariant_cast): Likewise.
	(QScriptDebuggerBackendPrivate::trace): Likewise.
	* g++.dg/opt/complex3.C (j): Likewise.
	* g++.dg/opt/covariant1.C (struct T): Likewise.
	* g++.dg/opt/declone3.C (Item::m_fn1): Likewise.
	* g++.dg/opt/dump1.C (__attribute__): Likewise.
	* g++.dg/opt/inline15.C (struct C): Likewise.
	(fn2): Likewise.
	* g++.dg/opt/local1.C (h): Likewise.
	* g++.dg/opt/memcpy1.C (csBoxClipper::Clip): Likewise.
	* g++.dg/opt/new1.C: Likewise.
	* g++.dg/opt/nrv8.C (main): Likewise.
	* g++.dg/opt/pr23299.C (struct A): Likewise.
	(struct B): Likewise.
	(struct C): Likewise.
	* g++.dg/opt/pr27826.C (struct Geometry): Likewise.
	* g++.dg/opt/pr44919.C (back_inserter): Likewise.
	* g++.dg/opt/pr47615.C (main): Likewise.
	* g++.dg/opt/pr55329.C (struct A): Likewise.
	* g++.dg/opt/pr61456.C (Set): Likewise.
	* g++.dg/opt/pr65003.C (D::foo): Likewise.
	(F::foo): Likewise.
	* g++.dg/opt/pr65554.C: Likewise.
	* g++.dg/opt/pr69432.C (struct C): Likewise.
	* g++.dg/opt/pr78373.C (struct D): Likewise.
	(Traits>::m_fn4): Likewise.
	* g++.dg/opt/pr79267.C (struct F): Likewise.
	* g++.dg/opt/pr82159-2.C: Likewise.
	* g++.dg/other/array3.C (reserve): Likewise.
	* g++.dg/other/crash-5.C (f): Likewise.
	* g++.dg/other/crash-8.C: Likewise.
	* g++.dg/other/error34.C (S): Likewise.
	* g++.dg/other/pr22003.C (c3::func): Likewise.
	* g++.dg/other/pr24623.C (RefCountPointer): Likewise.
	* g++.dg/other/pr29610.C (struct __normal_iterator): Likewise.
	(Painter::for_each): Likewise.
	(Painter::redraw_window): Likewise.
	* g++.dg/other/pr42645-1.C (struct S): Likewise.
	* g++.dg/other/pr42645-2.C (foo): Likewise.
	(f3): Likewise.
	* g++.dg/other/pr52048.C: Likewise.
	* g++.dg/other/typedef3.C (XalanCProcessor::getParseOption): Likewise.
	* g++.dg/overload/defarg4.C (class foo): Likewise.
	(bar::Initialize): Likewise.
	* g++.dg/overload/operator5.C (equalIgnoringCase): Likewise.
	* g++.dg/overload/ref-conv1.C: Likewise.
	* g++.dg/overload/template5.C (test): Likewise.
	* g++.dg/parse/crash40.C (class AAA): Likewise.
	* g++.dg/parse/crash61.C: Likewise.
	* g++.dg/parse/crash67.C: Likewise.
	* g++.dg/parse/ctor5.C: Likewise.
	* g++.dg/parse/defarg4.C (Foo): Likewise.
	* g++.dg/parse/defarg6.C: Likewise.
	* g++.dg/parse/error5.C (class Foo): Likewise.
	* g++.dg/parse/expr2.C (foo): Likewise.
	* g++.dg/parse/friend7.C: Likewise.
	* g++.dg/parse/namespace1.C (bar): Likewise.
	* g++.dg/parse/namespace9.C (g): Likewise.
	* g++.dg/parse/ret-type2.C: Likewise.
	* g++.dg/parse/typedef8.C (foo): Likewise.
	* g++.dg/pch/static-1.C (LocalStaticTest): Likewise.
	(main): Likewise.
	* g++.dg/plugin/diagnostic-test-expressions-1.C (test_structure_references): Likewise.
	(test_postfix_incdec): Likewise.
	(test_sizeof): Likewise.
	(test_alignof): Likewise.
	(test_prefix_incdec): Likewise.
	* g++.dg/plugin/dumb-plugin-test-1.C (func): Likewise.
	* g++.dg/plugin/self-assign-test-1.C (func): Likewise.
	* g++.dg/plugin/self-assign-test-2.C (func): Likewise.
	* g++.dg/plugin/self-assign-test-3.C (func): Likewise.
	* g++.dg/pr55513.C (main): Likewise.
	* g++.dg/pr55604.C (main): Likewise.
	* g++.dg/pr57662.C: Likewise.
	* g++.dg/pr58389.C (F::m_fn1): Likewise.
	* g++.dg/pr59510.C: Likewise.
	* g++.dg/pr67989.C: Likewise.
	* g++.dg/pr70590-2.C: Likewise.
	* g++.dg/pr70590.C: Likewise.
	* g++.dg/pr70965.C (foo): Likewise.
	* g++.dg/pr77550.C: Likewise.
	* g++.dg/pr80287.C (struct A): Likewise.
	* g++.dg/pr80707.C (A::m_fn1): Likewise.
	* g++.dg/pr81194.C: Likewise.
	* g++.dg/spellcheck-identifiers.C: Likewise.
	* g++.dg/tc1/dr152.C: Likewise.
	* g++.dg/template/aggr-init1.C (CreateA): Likewise.
	* g++.dg/template/anon1.C (struct x): Likewise.
	(struct vector): Likewise.
	* g++.dg/template/array29.C: Likewise.
	* g++.dg/template/array7.C (bar): Likewise.
	* g++.dg/template/canon-type-8.C: Likewise.
	* g++.dg/template/conv1.C (First::Foo): Likewise.
	* g++.dg/template/crash107.C: Likewise.
	* g++.dg/template/crash23.C (f): Likewise.
	* g++.dg/template/crash8.C (struct bar): Likewise.
	* g++.dg/template/defarg4.C (struct A): Likewise.
	* g++.dg/template/dependent-expr9.C: Likewise.
	* g++.dg/template/error10.C (Btest): Likewise.
	* g++.dg/template/friend32.C (f): Likewise.
	* g++.dg/template/init6.C (Graph::Inner::get): Likewise.
	(main): Likewise.
	* g++.dg/template/memfriend7.C (A::h): Likewise.
	* g++.dg/template/new10.C (Analyzer::ReadDictionary): Likewise.
	* g++.dg/template/nontype12.C (baz): Likewise.
	* g++.dg/template/overload12.C (foo2): Likewise.
	* g++.dg/template/overload5.C (foo::f): Likewise.
	* g++.dg/template/overload8.C (struct A): Likewise.
	* g++.dg/template/partial10.C (fn): Likewise.
	(main): Likewise.
	* g++.dg/template/partial9.C (f): Likewise.
	* g++.dg/template/qual1.C (shift_compare): Likewise.
	* g++.dg/template/show-template-tree-3.C: Likewise.
	* g++.dg/template/sizeof8.C (S<sizeof): Likewise.
	* g++.dg/template/sizeof9.C (d): Likewise.
	* g++.dg/template/spec6.C: Likewise.
	* g++.dg/template/spec7.C (h): Likewise.
	* g++.dg/template/typedef8.C: Likewise.
	* g++.dg/template/using20.C (f): Likewise.
	* g++.dg/template/vla1.C (label): Likewise.
	* g++.dg/tm/cgraph_edge.C: Likewise.
	* g++.dg/tm/pr46646.C: Likewise.
	* g++.dg/tm/pr47554.C (class list): Likewise.
	* g++.dg/tm/pr47573.C (getStringHeight): Likewise.
	* g++.dg/tm/unsafe1.C (f): Likewise.
	* g++.dg/tm/unsafe2.C (g): Likewise.
	* g++.dg/torture/20070621-1.C: Likewise.
	* g++.dg/torture/20090329-1.C: Likewise.
	* g++.dg/torture/20141013.C: Likewise.
	* g++.dg/torture/pr33134.C (fxsaveGIF): Likewise.
	* g++.dg/torture/pr33340.C (new): Likewise.
	* g++.dg/torture/pr33627.C (class pf_Frag): Likewise.
	* g++.dg/torture/pr34222.C (readFloat): Likewise.
	* g++.dg/torture/pr34241.C (test): Likewise.
	* g++.dg/torture/pr34641.C: Likewise.
	* g++.dg/torture/pr34850.C (OctetString::operator^=): Likewise.
	* g++.dg/torture/pr35164-1.C: Likewise.
	* g++.dg/torture/pr36745.C: Likewise.
	* g++.dg/torture/pr38705.C (S::bar): Likewise.
	* g++.dg/torture/pr38811.C (AbcAbcdTracer::TestIsoAbcde): Likewise.
	* g++.dg/torture/pr39362.C: Likewise.
	* g++.dg/torture/pr39732.C (f): Likewise.
	* g++.dg/torture/pr40991.C: Likewise.
	* g++.dg/torture/pr41775.C: Likewise.
	* g++.dg/torture/pr42183.C: Likewise.
	* g++.dg/torture/pr42450.C: Likewise.
	* g++.dg/torture/pr42704.C: Likewise.
	* g++.dg/torture/pr42760.C (baz): Likewise.
	(bar): Likewise.
	* g++.dg/torture/pr42773.C (Cell::obscuringCells): Likewise.
	* g++.dg/torture/pr42883.C: Likewise.
	* g++.dg/torture/pr43905.C (struct Matrix): Likewise.
	* g++.dg/torture/pr44148.C: Likewise.
	* g++.dg/torture/pr44295.C: Likewise.
	* g++.dg/torture/pr44357.C: Likewise.
	* g++.dg/torture/pr44813.C: Likewise.
	* g++.dg/torture/pr45580.C: Likewise.
	* g++.dg/torture/pr45874.C (Mpeg2FrameConstructor::ParsePictureHeader): Likewise.
	* g++.dg/torture/pr45877.C: Likewise.
	* g++.dg/torture/pr46383.C: Likewise.
	* g++.dg/torture/pr46469.C (__attribute__): Likewise.
	(identifierByPthreadHandle): Likewise.
	* g++.dg/torture/pr47313.C: Likewise.
	* g++.dg/torture/pr48271.C: Likewise.
	* g++.dg/torture/pr49615.C (Dispatch): Likewise.
	(C::f): Likewise.
	* g++.dg/torture/pr49770.C (main): Likewise.
	* g++.dg/torture/pr49938.C: Likewise.
	* g++.dg/torture/pr51436.C: Likewise.
	* g++.dg/torture/pr51482.C (anim_track_bez_wvect::tangent): Likewise.
	* g++.dg/torture/pr51737.C (id_state::start_file): Likewise.
	* g++.dg/torture/pr51959.C: Likewise.
	* g++.dg/torture/pr52772.C (class c6): Likewise.
	* g++.dg/torture/pr52918-2.C (__cxa_allocate_exception): Likewise.
	* g++.dg/torture/pr53011.C: Likewise.
	* g++.dg/torture/pr53602.C: Likewise.
	* g++.dg/torture/pr53752.C: Likewise.
	* g++.dg/torture/pr54838.C: Likewise.
	* g++.dg/torture/pr54902.C: Likewise.
	* g++.dg/torture/pr56029.C: Likewise.
	* g++.dg/torture/pr56768.C (operator!=): Likewise.
	* g++.dg/torture/pr57107.C: Likewise.
	* g++.dg/torture/pr57140.C: Likewise.
	* g++.dg/torture/pr57235.C: Likewise.
	* g++.dg/torture/pr58252.C: Likewise.
	* g++.dg/torture/pr58555.C: Likewise.
	* g++.dg/torture/pr59208.C (get_dbx_doc): Likewise.
	* g++.dg/torture/pr60438-1.C (foo): Likewise.
	* g++.dg/torture/pr60746.C (Two::run): Likewise.
	* g++.dg/torture/pr61554.C: Likewise.
	* g++.dg/torture/pr63419.C: Likewise.
	* g++.dg/torture/pr63476.C: Likewise.
	* g++.dg/torture/pr63512.C (C::m_fn3): Likewise.
	* g++.dg/torture/pr64282.C (class H): Likewise.
	* g++.dg/torture/pr64378.C (struct top): Likewise.
	* g++.dg/torture/pr64565.C: Likewise.
	* g++.dg/torture/pr64568-2.C: Likewise.
	* g++.dg/torture/pr64669.C (Lex::advance_one_char): Likewise.
	* g++.dg/torture/pr64686.C (B::m_fn1): Likewise.
	* g++.dg/torture/pr64978.C (B::m_fn2): Likewise.
	* g++.dg/torture/pr64995.C (A::m_fn2): Likewise.
	* g++.dg/torture/pr65655.C: Likewise.
	* g++.dg/torture/pr65851.C: Likewise.
	* g++.dg/torture/pr67055.C: Likewise.
	* g++.dg/torture/pr67191.C: Likewise.
	* g++.dg/torture/pr68852.C: Likewise.
	* g++.dg/torture/pr69264.C: Likewise.
	* g++.dg/torture/pr77674.C: Likewise.
	* g++.dg/torture/pr77947.C (B::m_fn2): Likewise.
	* g++.dg/torture/pr78268.C: Likewise.
	* g++.dg/torture/pr78507.C: Likewise.
	* g++.dg/torture/pr78692.C (F::g): Likewise.
	* g++.dg/torture/pr80171.C: Likewise.
	* g++.dg/torture/pr82154.C (class f): Likewise.
	(f::k): Likewise.
	* g++.dg/tree-ssa/copyprop.C: Likewise.
	* g++.dg/tree-ssa/pr22444.C: Likewise.
	* g++.dg/tree-ssa/pr23948.C (make_scheduler_request): Likewise.
	* g++.dg/tree-ssa/pr24172.C (dummy): Likewise.
	* g++.dg/tree-ssa/pr24351-3.C: Likewise.
	* g++.dg/tree-ssa/pr27283.C: Likewise.
	* g++.dg/tree-ssa/pr27291.C: Likewise.
	* g++.dg/tree-ssa/pr27548.C: Likewise.
	* g++.dg/tree-ssa/pr34355.C (Parse_Float): Likewise.
	* g++.dg/tree-ssa/pr42337.C: Likewise.
	* g++.dg/tree-ssa/pred-1.C (main): Likewise.
	* g++.dg/ubsan/pr65019.C (C::foo): Likewise.
	* g++.dg/ubsan/pr65583.C: Likewise.
	* g++.dg/vect/pr60836.cc (norm_): Likewise.
	* g++.dg/vect/pr68145.cc: Likewise.
	* g++.dg/vect/pr70729-nest.cc (my_alloc): Likewise.
	* g++.dg/vect/pr70729.cc (my_alloc): Likewise.
	* g++.dg/warn/Waddress-3.C: Likewise.
	* g++.dg/warn/Wconversion-null-2.C (warn_for___null): Likewise.
	* g++.dg/warn/Wnull-conversion-2.C (main): Likewise.
	* g++.dg/warn/Wparentheses-10.C: Likewise.
	* g++.dg/warn/Wparentheses-11.C: Likewise.
	* g++.dg/warn/Wparentheses-12.C: Likewise.
	* g++.dg/warn/Wparentheses-25.C: Likewise.
	* g++.dg/warn/Wparentheses-6.C: Likewise.
	* g++.dg/warn/Wparentheses-7.C: Likewise.
	* g++.dg/warn/Wparentheses-8.C: Likewise.
	* g++.dg/warn/Wparentheses-9.C: Likewise.
	* g++.dg/warn/Wshadow-5.C: Likewise.
	* g++.dg/warn/Wtype-limits-Wextra.C (ff): Likewise.
	(gg): Likewise.
	* g++.dg/warn/Wtype-limits-no.C (ff): Likewise.
	(gg): Likewise.
	* g++.dg/warn/Wtype-limits.C (ff): Likewise.
	(gg): Likewise.
	* g++.dg/warn/Wunused-local-typedefs.C: Likewise.
	* g++.dg/warn/Wzero-as-null-pointer-constant-5.C: Likewise.
	* g++.dg/warn/pmf1.C (a::f): Likewise.
	* g++.old-deja/g++.benjamin/p13417.C: Likewise.
	* g++.old-deja/g++.brendan/crash24.C (main): Likewise.
	* g++.old-deja/g++.ext/constructor.C: Likewise.
	* g++.old-deja/g++.ext/namedret1.C (f): Likewise.
	* g++.old-deja/g++.ext/namedret3.C: Likewise.
	* g++.old-deja/g++.ext/return1.C: Likewise.
	* g++.old-deja/g++.jason/anon4.C (main): Likewise.
	* g++.old-deja/g++.jason/enum6.C: Likewise.
	* g++.old-deja/g++.jason/lineno2.C (main): Likewise.
	* g++.old-deja/g++.jason/lineno3.C: Likewise.
	* g++.old-deja/g++.jason/lineno4.C: Likewise.
	* g++.old-deja/g++.jason/new2.C (main): Likewise.
	* g++.old-deja/g++.jason/new4.C (main): Likewise.
	* g++.old-deja/g++.jason/shadow1.C (main): Likewise.
	* g++.old-deja/g++.jason/tempcons.C (struct A): Likewise.
	* g++.old-deja/g++.jason/thunk2.C (main): Likewise.
	* g++.old-deja/g++.law/builtin1.C (main): Likewise.
	* g++.old-deja/g++.law/enum9.C: Likewise.
	* g++.old-deja/g++.law/except3.C: Likewise.
	* g++.old-deja/g++.law/init6.C: Likewise.
	* g++.old-deja/g++.law/profile1.C (main): Likewise.
	* g++.old-deja/g++.law/shadow2.C (main): Likewise.
	* g++.old-deja/g++.law/temps4.C (main): Likewise.
	* g++.old-deja/g++.mike/bool2.C (main): Likewise.
	* g++.old-deja/g++.mike/eh1.C: Likewise.
	* g++.old-deja/g++.mike/eh10.C: Likewise.
	* g++.old-deja/g++.mike/eh13.C (main): Likewise.
	* g++.old-deja/g++.mike/eh16.C: Likewise.
	* g++.old-deja/g++.mike/eh17.C: Likewise.
	* g++.old-deja/g++.mike/eh2.C: Likewise.
	* g++.old-deja/g++.mike/eh23.C: Likewise.
	* g++.old-deja/g++.mike/eh24.C: Likewise.
	* g++.old-deja/g++.mike/eh25.C: Likewise.
	* g++.old-deja/g++.mike/eh26.C: Likewise.
	* g++.old-deja/g++.mike/eh27.C: Likewise.
	* g++.old-deja/g++.mike/eh28.C: Likewise.
	* g++.old-deja/g++.mike/eh29.C: Likewise.
	* g++.old-deja/g++.mike/eh30.C: Likewise.
	* g++.old-deja/g++.mike/eh31.C: Likewise.
	* g++.old-deja/g++.mike/eh35.C: Likewise.
	* g++.old-deja/g++.mike/eh36.C: Likewise.
	* g++.old-deja/g++.mike/eh37.C: Likewise.
	* g++.old-deja/g++.mike/eh38.C: Likewise.
	* g++.old-deja/g++.mike/eh39.C: Likewise.
	* g++.old-deja/g++.mike/eh40.C: Likewise.
	* g++.old-deja/g++.mike/eh47.C: Likewise.
	* g++.old-deja/g++.mike/eh50.C: Likewise.
	* g++.old-deja/g++.mike/eh51.C: Likewise.
	* g++.old-deja/g++.mike/eh7.C: Likewise.
	* g++.old-deja/g++.mike/eh8.C: Likewise.
	* g++.old-deja/g++.mike/eh9.C: Likewise.
	* g++.old-deja/g++.mike/mangle1.C: Likewise.
	* g++.old-deja/g++.mike/p5958.C: Likewise.
	* g++.old-deja/g++.mike/p6004.C: Likewise.
	* g++.old-deja/g++.mike/p700.C: Likewise.
	* g++.old-deja/g++.mike/p7912.C: Likewise.
	* g++.old-deja/g++.mike/p811.C (main): Likewise.
	* g++.old-deja/g++.mike/virt4.C (main): Likewise.
	* g++.old-deja/g++.oliva/nameret1.C: Likewise.
	* g++.old-deja/g++.oliva/nameret2.C: Likewise.
	* g++.old-deja/g++.other/decl1.C (bar): Likewise.
	* g++.old-deja/g++.other/expr1.C (struct T): Likewise.
	(main): Likewise.
	* g++.old-deja/g++.other/inline8.C (main): Likewise.
	* g++.old-deja/g++.other/loop1.C: Likewise.
	* g++.old-deja/g++.other/syntax1.C (main): Likewise.
	* g++.old-deja/g++.pt/repo3.C (main): Likewise.
	* g++.old-deja/g++.robertl/eb27.C (main): Likewise.
	* g++.old-deja/g++.robertl/eb83.C (main): Likewise.
	* gcc.dg/pr44545.c: Likewise.
	* obj-c++.dg/comp-types-8.mm: Likewise.
	* obj-c++.dg/demangle-3.mm: Likewise.
	* obj-c++.dg/super-class-1.mm: Likewise.
---
 gcc/testsuite/c-c++-common/Wimplicit-fallthrough-8.c        | 12 ++++++------
 gcc/testsuite/c-c++-common/asan/pr63638.c                   |  2 +-
 gcc/testsuite/c-c++-common/goacc/parallel-1.c               |  2 ++
 gcc/testsuite/c-c++-common/gomp/sink-1.c                    |  2 ++
 gcc/testsuite/c-c++-common/missing-symbol.c                 |  2 +-
 gcc/testsuite/c-c++-common/pr36513-2.c                      |  1 +
 gcc/testsuite/c-c++-common/pr36513.c                        |  2 ++
 gcc/testsuite/c-c++-common/pr49706-2.c                      |  2 +-
 gcc/testsuite/c-c++-common/pr65120.c                        |  4 ++--
 gcc/testsuite/c-c++-common/tm/volatile-1.c                  |  2 +-
 gcc/testsuite/c-c++-common/vector-1.c                       |  2 +-
 gcc/testsuite/c-c++-common/vector-2.c                       |  2 +-
 gcc/testsuite/g++.dg/abi/abi-tag14.C                        |  8 ++++----
 gcc/testsuite/g++.dg/abi/abi-tag18.C                        |  2 ++
 gcc/testsuite/g++.dg/abi/abi-tag18a.C                       |  2 ++
 gcc/testsuite/g++.dg/abi/covariant2.C                       |  4 ++--
 gcc/testsuite/g++.dg/abi/covariant3.C                       |  2 +-
 gcc/testsuite/g++.dg/abi/mangle7.C                          |  2 +-
 gcc/testsuite/g++.dg/asan/pr81340.C                         |  4 ++--
 gcc/testsuite/g++.dg/concepts/fn8.C                         |  2 +-
 gcc/testsuite/g++.dg/concepts/pr65575.C                     |  2 +-
 gcc/testsuite/g++.dg/concepts/template-parm11.C             |  2 +-
 gcc/testsuite/g++.dg/conversion/op6.C                       |  6 +++---
 gcc/testsuite/g++.dg/cpp0x/Wunused-variable-1.C             |  1 +
 gcc/testsuite/g++.dg/cpp0x/access01.C                       |  2 +-
 gcc/testsuite/g++.dg/cpp0x/alignas3.C                       |  2 +-
 gcc/testsuite/g++.dg/cpp0x/auto2.C                          |  5 +++--
 gcc/testsuite/g++.dg/cpp0x/constexpr-array17.C              |  1 +
 gcc/testsuite/g++.dg/cpp0x/constexpr-defarg2.C              |  6 ++++++
 gcc/testsuite/g++.dg/cpp0x/constexpr-diag3.C                |  2 +-
 gcc/testsuite/g++.dg/cpp0x/constexpr-memfn1.C               |  4 ++--
 gcc/testsuite/g++.dg/cpp0x/constexpr-neg3.C                 |  2 +-
 gcc/testsuite/g++.dg/cpp0x/dc1.C                            |  2 +-
 gcc/testsuite/g++.dg/cpp0x/dc3.C                            |  2 +-
 gcc/testsuite/g++.dg/cpp0x/decltype12.C                     |  2 ++
 gcc/testsuite/g++.dg/cpp0x/decltype17.C                     |  3 +++
 gcc/testsuite/g++.dg/cpp0x/decltype3.C                      |  2 +-
 gcc/testsuite/g++.dg/cpp0x/decltype41.C                     |  8 ++++----
 gcc/testsuite/g++.dg/cpp0x/defaulted28.C                    |  2 +-
 gcc/testsuite/g++.dg/cpp0x/enum_base3.C                     |  2 +-
 gcc/testsuite/g++.dg/cpp0x/gen-attrs-4.C                    |  2 +-
 gcc/testsuite/g++.dg/cpp0x/initlist96.C                     |  1 +
 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-58566.C            |  1 +
 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv10.C           |  1 +
 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv12.C           |  1 +
 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg3.C          |  2 +-
 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice3.C             |  2 ++
 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice5.C             |  1 +
 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested2.C          |  2 +-
 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template12.C       |  1 +
 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template2.C        |  2 +-
 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this12.C           |  2 +-
 gcc/testsuite/g++.dg/cpp0x/nolinkage1.C                     |  2 +-
 gcc/testsuite/g++.dg/cpp0x/nolinkage1a.cc                   |  2 +-
 gcc/testsuite/g++.dg/cpp0x/nsdmi-template5.C                |  6 +++---
 gcc/testsuite/g++.dg/cpp0x/parse1.C                         |  2 +-
 gcc/testsuite/g++.dg/cpp0x/pr34054.C                        |  2 +-
 gcc/testsuite/g++.dg/cpp0x/pr47416.C                        |  1 +
 gcc/testsuite/g++.dg/cpp0x/pr58781.C                        |  2 +-
 gcc/testsuite/g++.dg/cpp0x/pr70538.C                        |  2 +-
 gcc/testsuite/g++.dg/cpp0x/pr81325.C                        |  2 +-
 gcc/testsuite/g++.dg/cpp0x/range-for13.C                    |  2 ++
 gcc/testsuite/g++.dg/cpp0x/range-for14.C                    |  2 ++
 gcc/testsuite/g++.dg/cpp0x/rv2n.C                           |  8 ++++++--
 gcc/testsuite/g++.dg/cpp0x/rv3n.C                           |  1 +
 gcc/testsuite/g++.dg/cpp0x/static_assert10.C                |  1 +
 gcc/testsuite/g++.dg/cpp0x/static_assert11.C                |  1 +
 gcc/testsuite/g++.dg/cpp0x/static_assert12.C                |  2 +-
 gcc/testsuite/g++.dg/cpp0x/static_assert13.C                |  2 +-
 gcc/testsuite/g++.dg/cpp0x/trailing1.C                      |  4 ++--
 gcc/testsuite/g++.dg/cpp0x/trailing5.C                      |  4 ++--
 gcc/testsuite/g++.dg/cpp0x/variadic114.C                    |  1 +
 gcc/testsuite/g++.dg/cpp0x/variadic57.C                     |  4 ++--
 gcc/testsuite/g++.dg/cpp0x/variadic65.C                     |  2 ++
 gcc/testsuite/g++.dg/cpp0x/variadic66.C                     |  2 +-
 gcc/testsuite/g++.dg/cpp0x/variadic97.C                     |  2 +-
 gcc/testsuite/g++.dg/cpp0x/variadic98.C                     |  2 ++
 gcc/testsuite/g++.dg/cpp1y/auto-fn11.C                      |  1 +
 gcc/testsuite/g++.dg/cpp1y/auto-fn29.C                      |  1 +
 gcc/testsuite/g++.dg/cpp1y/auto-fn38.C                      |  1 +
 gcc/testsuite/g++.dg/cpp1y/constexpr-return2.C              |  1 +
 gcc/testsuite/g++.dg/cpp1y/lambda-init7.C                   |  2 +-
 gcc/testsuite/g++.dg/cpp1y/pr63996.C                        |  1 +
 gcc/testsuite/g++.dg/cpp1y/pr65202.C                        |  1 +
 gcc/testsuite/g++.dg/cpp1y/pr66443-cxx14.C                  |  1 +
 gcc/testsuite/g++.dg/cpp1y/pr79253.C                        |  2 +-
 gcc/testsuite/g++.dg/cpp1y/static_assert1.C                 |  1 +
 gcc/testsuite/g++.dg/cpp1y/static_assert2.C                 |  1 +
 gcc/testsuite/g++.dg/cpp1y/var-templ44.C                    |  1 +
 gcc/testsuite/g++.dg/cpp1z/fold6.C                          |  2 +-
 gcc/testsuite/g++.dg/cpp1z/inline-var2.C                    |  1 +
 gcc/testsuite/g++.dg/cpp1z/lambda-this1.C                   |  2 +-
 gcc/testsuite/g++.dg/cpp1z/static_assert-nomsg.C            |  2 +-
 gcc/testsuite/g++.dg/debug/dwarf-eh-personality-1.C         |  2 +-
 gcc/testsuite/g++.dg/debug/dwarf2/dwarf4-typedef.C          |  2 +-
 gcc/testsuite/g++.dg/debug/dwarf2/icf.C                     |  4 ++--
 gcc/testsuite/g++.dg/debug/dwarf2/pr61433.C                 |  2 ++
 gcc/testsuite/g++.dg/debug/nullptr01.C                      |  1 +
 gcc/testsuite/g++.dg/debug/pr16792.C                        |  2 +-
 gcc/testsuite/g++.dg/debug/pr46241.C                        |  2 +-
 gcc/testsuite/g++.dg/debug/pr46338.C                        |  1 +
 gcc/testsuite/g++.dg/debug/pr47106.C                        |  6 ++++--
 gcc/testsuite/g++.dg/debug/pr71057.C                        |  2 +-
 gcc/testsuite/g++.dg/debug/pr71432.C                        | 13 +++++++++++--
 gcc/testsuite/g++.dg/debug/pr80461.C                        |  2 +-
 gcc/testsuite/g++.dg/dfp/44473-1.C                          |  2 ++
 gcc/testsuite/g++.dg/dfp/44473-2.C                          |  4 ++--
 gcc/testsuite/g++.dg/eh/builtin1.C                          |  4 ++--
 gcc/testsuite/g++.dg/eh/builtin2.C                          |  4 ++--
 gcc/testsuite/g++.dg/eh/builtin3.C                          |  2 +-
 gcc/testsuite/g++.dg/eh/pr45569.C                           |  2 +-
 gcc/testsuite/g++.dg/eh/unwind2.C                           |  2 +-
 gcc/testsuite/g++.dg/expr/bitfield11.C                      |  2 +-
 gcc/testsuite/g++.dg/expr/static_cast7.C                    |  2 +-
 gcc/testsuite/g++.dg/ext/altivec-14.C                       |  2 +-
 gcc/testsuite/g++.dg/ext/asm13.C                            |  2 +-
 gcc/testsuite/g++.dg/ext/builtin-object-size3.C             |  4 ++--
 gcc/testsuite/g++.dg/ext/has_nothrow_assign_odr.C           |  5 ++++-
 gcc/testsuite/g++.dg/ext/label7.C                           |  2 +-
 gcc/testsuite/g++.dg/ext/label8.C                           |  2 +-
 gcc/testsuite/g++.dg/ext/tmplattr7.C                        |  2 +-
 gcc/testsuite/g++.dg/ext/vector8.C                          |  2 +-
 gcc/testsuite/g++.dg/ext/visibility/anon1.C                 |  2 +-
 gcc/testsuite/g++.dg/ext/visibility/anon2.C                 |  2 +-
 gcc/testsuite/g++.dg/ext/visibility/namespace1.C            |  2 +-
 gcc/testsuite/g++.dg/ext/vla16.C                            |  2 ++
 gcc/testsuite/g++.dg/goacc/reference.C                      |  4 ++--
 gcc/testsuite/g++.dg/gomp/pr37189.C                         |  2 +-
 gcc/testsuite/g++.dg/gomp/pr39495-1.C                       |  4 ++--
 gcc/testsuite/g++.dg/gomp/pr39495-2.C                       |  2 +-
 gcc/testsuite/g++.dg/gomp/pr82054.C                         |  2 ++
 gcc/testsuite/g++.dg/inherit/covariant10.C                  |  4 ++--
 gcc/testsuite/g++.dg/inherit/covariant11.C                  |  8 ++++----
 gcc/testsuite/g++.dg/inherit/protected1.C                   |  2 ++
 gcc/testsuite/g++.dg/init/inline1.C                         |  2 +-
 gcc/testsuite/g++.dg/init/new18.C                           |  1 +
 gcc/testsuite/g++.dg/init/reference2.C                      |  2 +-
 gcc/testsuite/g++.dg/init/reference3.C                      |  1 +
 gcc/testsuite/g++.dg/init/switch1.C                         |  2 +-
 gcc/testsuite/g++.dg/ipa/devirt-10.C                        |  2 +-
 gcc/testsuite/g++.dg/ipa/devirt-13.C                        |  3 ++-
 gcc/testsuite/g++.dg/ipa/devirt-14.C                        |  3 ++-
 gcc/testsuite/g++.dg/ipa/devirt-15.C                        |  2 +-
 gcc/testsuite/g++.dg/ipa/devirt-16.C                        |  2 +-
 gcc/testsuite/g++.dg/ipa/devirt-17.C                        |  2 +-
 gcc/testsuite/g++.dg/ipa/devirt-18.C                        |  2 +-
 gcc/testsuite/g++.dg/ipa/devirt-19.C                        |  2 ++
 gcc/testsuite/g++.dg/ipa/devirt-21.C                        |  2 +-
 gcc/testsuite/g++.dg/ipa/devirt-23.C                        |  2 +-
 gcc/testsuite/g++.dg/ipa/devirt-38.C                        |  2 +-
 gcc/testsuite/g++.dg/ipa/devirt-40.C                        |  4 ++++
 gcc/testsuite/g++.dg/ipa/devirt-41.C                        |  2 +-
 gcc/testsuite/g++.dg/ipa/devirt-42.C                        |  2 +-
 gcc/testsuite/g++.dg/ipa/devirt-44.C                        |  4 ++--
 gcc/testsuite/g++.dg/ipa/devirt-45.C                        |  4 ++--
 gcc/testsuite/g++.dg/ipa/devirt-48.C                        |  4 ++--
 gcc/testsuite/g++.dg/ipa/devirt-52.C                        |  1 +
 gcc/testsuite/g++.dg/ipa/nothrow-1.C                        |  2 +-
 gcc/testsuite/g++.dg/ipa/pr43812.C                          |  2 +-
 gcc/testsuite/g++.dg/ipa/pr44372.C                          |  1 +
 gcc/testsuite/g++.dg/ipa/pr45572-1.C                        |  4 ++++
 gcc/testsuite/g++.dg/ipa/pr58371.C                          |  1 +
 gcc/testsuite/g++.dg/ipa/pr59176.C                          |  2 ++
 gcc/testsuite/g++.dg/ipa/pr60640-1.C                        |  2 +-
 gcc/testsuite/g++.dg/ipa/pr61540.C                          |  2 +-
 gcc/testsuite/g++.dg/ipa/pr63470.C                          |  1 +
 gcc/testsuite/g++.dg/ipa/pr63587-1.C                        |  3 +++
 gcc/testsuite/g++.dg/ipa/pr63587-2.C                        |  2 ++
 gcc/testsuite/g++.dg/ipa/pr63838.C                          |  2 +-
 gcc/testsuite/g++.dg/ipa/pr63894.C                          |  1 +
 gcc/testsuite/g++.dg/ipa/pr64068.C                          |  6 +++---
 gcc/testsuite/g++.dg/ipa/pr64896.C                          |  4 ++--
 gcc/testsuite/g++.dg/ipa/pr65002.C                          |  4 ++--
 gcc/testsuite/g++.dg/ipa/pr65008.C                          |  2 +-
 gcc/testsuite/g++.dg/ipa/pr65465.C                          |  2 +-
 gcc/testsuite/g++.dg/ipa/pr66896.C                          |  2 +-
 gcc/testsuite/g++.dg/ipa/pr68851.C                          |  6 +++---
 gcc/testsuite/g++.dg/ipa/pr78211.C                          |  3 ++-
 gcc/testsuite/g++.dg/ipa/pr79931.C                          |  1 +
 gcc/testsuite/g++.dg/ipa/pure-const-1.C                     |  2 +-
 gcc/testsuite/g++.dg/ipa/pure-const-2.C                     |  2 +-
 gcc/testsuite/g++.dg/ipa/pure-const-3.C                     |  2 +-
 gcc/testsuite/g++.dg/ipa/remref-1.C                         |  2 +-
 gcc/testsuite/g++.dg/ipa/remref-2.C                         |  2 +-
 gcc/testsuite/g++.dg/lookup/builtin2.C                      |  2 +-
 gcc/testsuite/g++.dg/lookup/crash3.C                        |  6 +++---
 gcc/testsuite/g++.dg/lookup/friend20.C                      |  1 +
 gcc/testsuite/g++.dg/lookup/pr80891-5.C                     |  1 +
 gcc/testsuite/g++.dg/lookup/struct2.C                       |  2 +-
 gcc/testsuite/g++.dg/lto/20080709_0.C                       |  1 +
 gcc/testsuite/g++.dg/lto/20080907_0.C                       |  2 ++
 gcc/testsuite/g++.dg/lto/20080915_0.C                       |  4 +++-
 gcc/testsuite/g++.dg/lto/20080916_0.C                       |  2 ++
 gcc/testsuite/g++.dg/lto/20081022_0.C                       |  2 ++
 gcc/testsuite/g++.dg/lto/20081023_0.C                       |  2 ++
 gcc/testsuite/g++.dg/lto/20081118_0.C                       |  1 +
 gcc/testsuite/g++.dg/lto/20081118_1.C                       |  1 +
 gcc/testsuite/g++.dg/lto/20081120-1_0.C                     |  1 +
 gcc/testsuite/g++.dg/lto/20081120-1_1.C                     |  1 +
 gcc/testsuite/g++.dg/lto/20081127_1.C                       |  2 +-
 gcc/testsuite/g++.dg/lto/20081217-2_0.C                     |  3 ++-
 gcc/testsuite/g++.dg/lto/20090303_0.C                       |  2 ++
 gcc/testsuite/g++.dg/lto/20090311-1_0.C                     |  2 ++
 gcc/testsuite/g++.dg/lto/20090312_0.C                       |  1 +
 gcc/testsuite/g++.dg/lto/20090315_0.C                       |  2 +-
 gcc/testsuite/g++.dg/lto/20091002-1_0.C                     |  2 +-
 gcc/testsuite/g++.dg/lto/20091002-2_0.C                     |  2 +-
 gcc/testsuite/g++.dg/lto/20091002-3_0.C                     |  2 +-
 gcc/testsuite/g++.dg/lto/20091004-1_0.C                     |  2 +-
 gcc/testsuite/g++.dg/lto/20091004-2_0.C                     |  2 +-
 gcc/testsuite/g++.dg/lto/20091004-3_1.C                     |  1 +
 gcc/testsuite/g++.dg/lto/20100721-1_0.C                     |  2 +-
 gcc/testsuite/g++.dg/lto/20101010-1_0.C                     |  1 +
 gcc/testsuite/g++.dg/lto/20101010-2_0.C                     |  1 +
 gcc/testsuite/g++.dg/lto/pr45679-1_0.C                      |  2 +-
 gcc/testsuite/g++.dg/lto/pr45679-1_1.C                      |  2 +-
 gcc/testsuite/g++.dg/lto/pr45679-2_0.C                      |  3 ++-
 gcc/testsuite/g++.dg/lto/pr48042_0.C                        |  2 +-
 gcc/testsuite/g++.dg/lto/pr51650-1_0.C                      |  3 ++-
 gcc/testsuite/g++.dg/lto/pr51650-3_0.C                      |  3 ++-
 gcc/testsuite/g++.dg/lto/pr63270_1.C                        |  1 +
 gcc/testsuite/g++.dg/lto/pr65193_0.C                        |  2 +-
 gcc/testsuite/g++.dg/lto/pr65302_0.C                        |  2 +-
 gcc/testsuite/g++.dg/lto/pr65316_0.C                        |  3 ++-
 gcc/testsuite/g++.dg/lto/pr65475c_0.C                       |  3 ++-
 gcc/testsuite/g++.dg/lto/pr65549_0.C                        |  6 ++++--
 gcc/testsuite/g++.dg/lto/pr69077_0.C                        |  2 +-
 gcc/testsuite/g++.dg/lto/pr69589_0.C                        |  2 +-
 gcc/testsuite/g++.dg/opt/combine.C                          |  2 ++
 gcc/testsuite/g++.dg/opt/complex3.C                         |  2 +-
 gcc/testsuite/g++.dg/opt/covariant1.C                       |  2 +-
 gcc/testsuite/g++.dg/opt/declone3.C                         |  2 +-
 gcc/testsuite/g++.dg/opt/dump1.C                            |  3 ++-
 gcc/testsuite/g++.dg/opt/inline15.C                         |  3 ++-
 gcc/testsuite/g++.dg/opt/local1.C                           |  2 +-
 gcc/testsuite/g++.dg/opt/memcpy1.C                          |  2 ++
 gcc/testsuite/g++.dg/opt/new1.C                             |  4 ++--
 gcc/testsuite/g++.dg/opt/nrv8.C                             |  2 +-
 gcc/testsuite/g++.dg/opt/pr23299.C                          |  6 +++---
 gcc/testsuite/g++.dg/opt/pr27826.C                          |  2 +-
 gcc/testsuite/g++.dg/opt/pr44919.C                          |  4 +++-
 gcc/testsuite/g++.dg/opt/pr47615.C                          |  5 +++--
 gcc/testsuite/g++.dg/opt/pr55329.C                          |  4 ++--
 gcc/testsuite/g++.dg/opt/pr61456.C                          |  1 +
 gcc/testsuite/g++.dg/opt/pr65003.C                          |  4 ++--
 gcc/testsuite/g++.dg/opt/pr65554.C                          |  2 ++
 gcc/testsuite/g++.dg/opt/pr69432.C                          |  2 +-
 gcc/testsuite/g++.dg/opt/pr78373.C                          |  2 ++
 gcc/testsuite/g++.dg/opt/pr79267.C                          |  4 ++--
 gcc/testsuite/g++.dg/opt/pr82159-2.C                        |  1 +
 gcc/testsuite/g++.dg/other/array3.C                         |  1 +
 gcc/testsuite/g++.dg/other/crash-5.C                        |  2 +-
 gcc/testsuite/g++.dg/other/crash-8.C                        |  2 ++
 gcc/testsuite/g++.dg/other/error34.C                        |  2 +-
 gcc/testsuite/g++.dg/other/pr22003.C                        |  1 +
 gcc/testsuite/g++.dg/other/pr24623.C                        |  2 ++
 gcc/testsuite/g++.dg/other/pr29610.C                        |  5 +++--
 gcc/testsuite/g++.dg/other/pr42645-1.C                      |  2 +-
 gcc/testsuite/g++.dg/other/pr42645-2.C                      |  3 ++-
 gcc/testsuite/g++.dg/other/pr52048.C                        |  1 +
 gcc/testsuite/g++.dg/other/typedef3.C                       |  2 +-
 gcc/testsuite/g++.dg/overload/defarg4.C                     |  5 +++--
 gcc/testsuite/g++.dg/overload/operator5.C                   |  2 +-
 gcc/testsuite/g++.dg/overload/ref-conv1.C                   |  1 +
 gcc/testsuite/g++.dg/overload/template5.C                   |  2 +-
 gcc/testsuite/g++.dg/parse/crash40.C                        |  4 ++--
 gcc/testsuite/g++.dg/parse/crash61.C                        |  1 +
 gcc/testsuite/g++.dg/parse/crash67.C                        |  1 +
 gcc/testsuite/g++.dg/parse/ctor5.C                          |  1 +
 gcc/testsuite/g++.dg/parse/defarg4.C                        |  2 ++
 gcc/testsuite/g++.dg/parse/defarg6.C                        |  2 +-
 gcc/testsuite/g++.dg/parse/error5.C                         | 12 ++++++------
 gcc/testsuite/g++.dg/parse/expr2.C                          |  2 +-
 gcc/testsuite/g++.dg/parse/friend7.C                        |  1 +
 gcc/testsuite/g++.dg/parse/namespace1.C                     |  2 +-
 gcc/testsuite/g++.dg/parse/namespace9.C                     |  2 +-
 gcc/testsuite/g++.dg/parse/ret-type2.C                      |  2 ++
 gcc/testsuite/g++.dg/parse/typedef8.C                       |  2 +-
 gcc/testsuite/g++.dg/pch/static-1.C                         |  2 ++
 gcc/testsuite/g++.dg/plugin/diagnostic-test-expressions-1.C | 10 +++++-----
 gcc/testsuite/g++.dg/plugin/dumb-plugin-test-1.C            |  2 +-
 gcc/testsuite/g++.dg/plugin/self-assign-test-1.C            |  2 +-
 gcc/testsuite/g++.dg/plugin/self-assign-test-2.C            |  2 +-
 gcc/testsuite/g++.dg/plugin/self-assign-test-3.C            |  2 +-
 gcc/testsuite/g++.dg/pr55513.C                              |  2 ++
 gcc/testsuite/g++.dg/pr55604.C                              |  2 ++
 gcc/testsuite/g++.dg/pr57662.C                              |  1 +
 gcc/testsuite/g++.dg/pr58389.C                              |  2 +-
 gcc/testsuite/g++.dg/pr59510.C                              |  1 +
 gcc/testsuite/g++.dg/pr67989.C                              |  1 +
 gcc/testsuite/g++.dg/pr70590-2.C                            |  4 ++--
 gcc/testsuite/g++.dg/pr70590.C                              |  4 ++--
 gcc/testsuite/g++.dg/pr70965.C                              |  2 +-
 gcc/testsuite/g++.dg/pr77550.C                              |  2 +-
 gcc/testsuite/g++.dg/pr80287.C                              |  2 +-
 gcc/testsuite/g++.dg/pr80707.C                              |  2 ++
 gcc/testsuite/g++.dg/pr81194.C                              |  1 +
 gcc/testsuite/g++.dg/spellcheck-identifiers.C               |  2 +-
 gcc/testsuite/g++.dg/tc1/dr152.C                            |  2 ++
 gcc/testsuite/g++.dg/template/aggr-init1.C                  |  2 +-
 gcc/testsuite/g++.dg/template/anon1.C                       |  4 ++--
 gcc/testsuite/g++.dg/template/array29.C                     |  1 +
 gcc/testsuite/g++.dg/template/array7.C                      |  1 +
 gcc/testsuite/g++.dg/template/canon-type-8.C                |  1 +
 gcc/testsuite/g++.dg/template/conv1.C                       |  4 ++--
 gcc/testsuite/g++.dg/template/crash107.C                    |  1 +
 gcc/testsuite/g++.dg/template/crash23.C                     |  2 +-
 gcc/testsuite/g++.dg/template/crash8.C                      |  2 +-
 gcc/testsuite/g++.dg/template/defarg4.C                     |  2 +-
 gcc/testsuite/g++.dg/template/dependent-expr9.C             |  2 +-
 gcc/testsuite/g++.dg/template/error10.C                     |  1 +
 gcc/testsuite/g++.dg/template/friend32.C                    |  1 +
 gcc/testsuite/g++.dg/template/init6.C                       |  2 ++
 gcc/testsuite/g++.dg/template/memfriend7.C                  |  2 ++
 gcc/testsuite/g++.dg/template/new10.C                       |  1 +
 gcc/testsuite/g++.dg/template/nontype12.C                   |  2 +-
 gcc/testsuite/g++.dg/template/overload12.C                  |  2 +-
 gcc/testsuite/g++.dg/template/overload5.C                   |  1 +
 gcc/testsuite/g++.dg/template/overload8.C                   |  2 +-
 gcc/testsuite/g++.dg/template/partial10.C                   |  3 ++-
 gcc/testsuite/g++.dg/template/partial9.C                    |  2 +-
 gcc/testsuite/g++.dg/template/qual1.C                       |  2 +-
 gcc/testsuite/g++.dg/template/show-template-tree-3.C        |  1 +
 gcc/testsuite/g++.dg/template/sizeof8.C                     |  2 +-
 gcc/testsuite/g++.dg/template/sizeof9.C                     |  2 +-
 gcc/testsuite/g++.dg/template/spec6.C                       |  2 ++
 gcc/testsuite/g++.dg/template/spec7.C                       |  2 +-
 gcc/testsuite/g++.dg/template/typedef8.C                    |  1 +
 gcc/testsuite/g++.dg/template/using20.C                     |  1 +
 gcc/testsuite/g++.dg/template/vla1.C                        |  1 +
 gcc/testsuite/g++.dg/tm/cgraph_edge.C                       |  1 +
 gcc/testsuite/g++.dg/tm/pr46646.C                           |  1 +
 gcc/testsuite/g++.dg/tm/pr47554.C                           |  2 ++
 gcc/testsuite/g++.dg/tm/pr47573.C                           |  1 +
 gcc/testsuite/g++.dg/tm/unsafe1.C                           |  2 +-
 gcc/testsuite/g++.dg/tm/unsafe2.C                           |  2 +-
 gcc/testsuite/g++.dg/torture/20070621-1.C                   |  1 +
 gcc/testsuite/g++.dg/torture/20090329-1.C                   |  1 +
 gcc/testsuite/g++.dg/torture/20141013.C                     |  1 +
 gcc/testsuite/g++.dg/torture/pr33134.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr33340.C                      |  4 +++-
 gcc/testsuite/g++.dg/torture/pr33627.C                      |  6 +++---
 gcc/testsuite/g++.dg/torture/pr34222.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr34241.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr34641.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr34850.C                      |  9 ++-------
 gcc/testsuite/g++.dg/torture/pr35164-1.C                    |  2 ++
 gcc/testsuite/g++.dg/torture/pr36745.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr38705.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr38811.C                      |  4 +++-
 gcc/testsuite/g++.dg/torture/pr39362.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr39732.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr40991.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr41775.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr42183.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr42450.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr42704.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr42760.C                      |  2 ++
 gcc/testsuite/g++.dg/torture/pr42773.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr42883.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr43905.C                      |  2 ++
 gcc/testsuite/g++.dg/torture/pr44148.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr44295.C                      |  2 ++
 gcc/testsuite/g++.dg/torture/pr44357.C                      |  2 ++
 gcc/testsuite/g++.dg/torture/pr44813.C                      |  2 ++
 gcc/testsuite/g++.dg/torture/pr45580.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr45874.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr45877.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr46383.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr46469.C                      |  2 ++
 gcc/testsuite/g++.dg/torture/pr47313.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr48271.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr49615.C                      |  3 +++
 gcc/testsuite/g++.dg/torture/pr49770.C                      |  2 ++
 gcc/testsuite/g++.dg/torture/pr49938.C                      |  2 ++
 gcc/testsuite/g++.dg/torture/pr51436.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr51482.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr51737.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr51959.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr52772.C                      |  2 +-
 gcc/testsuite/g++.dg/torture/pr52918-2.C                    |  1 +
 gcc/testsuite/g++.dg/torture/pr53011.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr53602.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr53752.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr54838.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr54902.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr56029.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr56768.C                      |  2 +-
 gcc/testsuite/g++.dg/torture/pr57107.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr57140.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr57235.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr58252.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr58555.C                      |  2 ++
 gcc/testsuite/g++.dg/torture/pr59208.C                      |  2 +-
 gcc/testsuite/g++.dg/torture/pr60438-1.C                    |  2 ++
 gcc/testsuite/g++.dg/torture/pr60746.C                      |  2 ++
 gcc/testsuite/g++.dg/torture/pr61554.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr63419.C                      |  2 +-
 gcc/testsuite/g++.dg/torture/pr63476.C                      |  2 +-
 gcc/testsuite/g++.dg/torture/pr63512.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr64282.C                      |  4 ++--
 gcc/testsuite/g++.dg/torture/pr64378.C                      |  2 +-
 gcc/testsuite/g++.dg/torture/pr64565.C                      |  2 ++
 gcc/testsuite/g++.dg/torture/pr64568-2.C                    |  1 +
 gcc/testsuite/g++.dg/torture/pr64669.C                      |  2 ++
 gcc/testsuite/g++.dg/torture/pr64686.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr64978.C                      |  2 +-
 gcc/testsuite/g++.dg/torture/pr64995.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr65655.C                      |  2 +-
 gcc/testsuite/g++.dg/torture/pr65851.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr67055.C                      |  2 ++
 gcc/testsuite/g++.dg/torture/pr67191.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr68852.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr69264.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr77674.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr77947.C                      |  3 +++
 gcc/testsuite/g++.dg/torture/pr78268.C                      |  2 ++
 gcc/testsuite/g++.dg/torture/pr78507.C                      |  2 ++
 gcc/testsuite/g++.dg/torture/pr78692.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr80171.C                      |  1 +
 gcc/testsuite/g++.dg/torture/pr82154.C                      |  2 ++
 gcc/testsuite/g++.dg/tree-ssa/copyprop.C                    |  2 +-
 gcc/testsuite/g++.dg/tree-ssa/pr22444.C                     |  1 +
 gcc/testsuite/g++.dg/tree-ssa/pr23948.C                     |  2 +-
 gcc/testsuite/g++.dg/tree-ssa/pr24172.C                     |  2 +-
 gcc/testsuite/g++.dg/tree-ssa/pr24351-3.C                   |  1 +
 gcc/testsuite/g++.dg/tree-ssa/pr27283.C                     |  1 +
 gcc/testsuite/g++.dg/tree-ssa/pr27291.C                     |  1 +
 gcc/testsuite/g++.dg/tree-ssa/pr27548.C                     |  1 +
 gcc/testsuite/g++.dg/tree-ssa/pr34355.C                     |  1 +
 gcc/testsuite/g++.dg/tree-ssa/pr42337.C                     |  1 +
 gcc/testsuite/g++.dg/tree-ssa/pred-1.C                      |  4 ++++
 gcc/testsuite/g++.dg/ubsan/pr65019.C                        |  2 ++
 gcc/testsuite/g++.dg/ubsan/pr65583.C                        |  1 +
 gcc/testsuite/g++.dg/vect/pr60836.cc                        |  2 ++
 gcc/testsuite/g++.dg/vect/pr68145.cc                        |  1 +
 gcc/testsuite/g++.dg/vect/pr70729-nest.cc                   |  2 +-
 gcc/testsuite/g++.dg/vect/pr70729.cc                        |  2 +-
 gcc/testsuite/g++.dg/warn/Waddress-3.C                      |  2 +-
 gcc/testsuite/g++.dg/warn/Wconversion-null-2.C              |  2 +-
 gcc/testsuite/g++.dg/warn/Wnull-conversion-2.C              |  3 +++
 gcc/testsuite/g++.dg/warn/Wparentheses-10.C                 |  2 +-
 gcc/testsuite/g++.dg/warn/Wparentheses-11.C                 |  2 +-
 gcc/testsuite/g++.dg/warn/Wparentheses-12.C                 |  2 +-
 gcc/testsuite/g++.dg/warn/Wparentheses-25.C                 |  4 ++--
 gcc/testsuite/g++.dg/warn/Wparentheses-6.C                  |  2 +-
 gcc/testsuite/g++.dg/warn/Wparentheses-7.C                  |  2 +-
 gcc/testsuite/g++.dg/warn/Wparentheses-8.C                  |  2 +-
 gcc/testsuite/g++.dg/warn/Wparentheses-9.C                  |  2 +-
 gcc/testsuite/g++.dg/warn/Wshadow-5.C                       |  2 +-
 gcc/testsuite/g++.dg/warn/Wtype-limits-Wextra.C             |  4 ++--
 gcc/testsuite/g++.dg/warn/Wtype-limits-no.C                 |  4 ++--
 gcc/testsuite/g++.dg/warn/Wtype-limits.C                    |  4 ++--
 gcc/testsuite/g++.dg/warn/Wunused-local-typedefs.C          |  2 +-
 .../g++.dg/warn/Wzero-as-null-pointer-constant-5.C          |  2 +-
 gcc/testsuite/g++.dg/warn/pmf1.C                            |  1 +
 gcc/testsuite/g++.old-deja/g++.benjamin/p13417.C            |  2 +-
 gcc/testsuite/g++.old-deja/g++.brendan/crash24.C            |  3 +++
 gcc/testsuite/g++.old-deja/g++.ext/constructor.C            |  1 +
 gcc/testsuite/g++.old-deja/g++.ext/namedret1.C              |  2 +-
 gcc/testsuite/g++.old-deja/g++.ext/namedret3.C              |  2 +-
 gcc/testsuite/g++.old-deja/g++.ext/return1.C                |  2 +-
 gcc/testsuite/g++.old-deja/g++.jason/anon4.C                |  2 ++
 gcc/testsuite/g++.old-deja/g++.jason/enum6.C                |  1 +
 gcc/testsuite/g++.old-deja/g++.jason/lineno2.C              |  4 +++-
 gcc/testsuite/g++.old-deja/g++.jason/lineno3.C              |  2 +-
 gcc/testsuite/g++.old-deja/g++.jason/lineno4.C              |  2 +-
 gcc/testsuite/g++.old-deja/g++.jason/new2.C                 |  2 ++
 gcc/testsuite/g++.old-deja/g++.jason/new4.C                 |  3 +++
 gcc/testsuite/g++.old-deja/g++.jason/shadow1.C              |  2 ++
 gcc/testsuite/g++.old-deja/g++.jason/tempcons.C             |  2 +-
 gcc/testsuite/g++.old-deja/g++.jason/thunk2.C               |  3 +++
 gcc/testsuite/g++.old-deja/g++.law/builtin1.C               |  4 +++-
 gcc/testsuite/g++.old-deja/g++.law/enum9.C                  |  1 +
 gcc/testsuite/g++.old-deja/g++.law/except3.C                |  1 +
 gcc/testsuite/g++.old-deja/g++.law/init6.C                  |  1 +
 gcc/testsuite/g++.old-deja/g++.law/profile1.C               |  3 +++
 gcc/testsuite/g++.old-deja/g++.law/shadow2.C                |  2 ++
 gcc/testsuite/g++.old-deja/g++.law/temps4.C                 |  3 +++
 gcc/testsuite/g++.old-deja/g++.mike/bool2.C                 |  4 ++++
 gcc/testsuite/g++.old-deja/g++.mike/eh1.C                   |  1 +
 gcc/testsuite/g++.old-deja/g++.mike/eh10.C                  |  1 +
 gcc/testsuite/g++.old-deja/g++.mike/eh13.C                  |  2 +-
 gcc/testsuite/g++.old-deja/g++.mike/eh16.C                  |  1 +
 gcc/testsuite/g++.old-deja/g++.mike/eh17.C                  |  1 +
 gcc/testsuite/g++.old-deja/g++.mike/eh2.C                   |  4 +---
 gcc/testsuite/g++.old-deja/g++.mike/eh23.C                  |  1 +
 gcc/testsuite/g++.old-deja/g++.mike/eh24.C                  |  1 +
 gcc/testsuite/g++.old-deja/g++.mike/eh25.C                  |  1 +
 gcc/testsuite/g++.old-deja/g++.mike/eh26.C                  |  1 +
 gcc/testsuite/g++.old-deja/g++.mike/eh27.C                  |  1 +
 gcc/testsuite/g++.old-deja/g++.mike/eh28.C                  |  1 +
 gcc/testsuite/g++.old-deja/g++.mike/eh29.C                  |  1 +
 gcc/testsuite/g++.old-deja/g++.mike/eh30.C                  |  1 +
 gcc/testsuite/g++.old-deja/g++.mike/eh31.C                  |  1 +
 gcc/testsuite/g++.old-deja/g++.mike/eh35.C                  |  1 +
 gcc/testsuite/g++.old-deja/g++.mike/eh36.C                  |  1 +
 gcc/testsuite/g++.old-deja/g++.mike/eh37.C                  |  1 +
 gcc/testsuite/g++.old-deja/g++.mike/eh38.C                  |  1 +
 gcc/testsuite/g++.old-deja/g++.mike/eh39.C                  |  1 +
 gcc/testsuite/g++.old-deja/g++.mike/eh40.C                  |  1 +
 gcc/testsuite/g++.old-deja/g++.mike/eh47.C                  |  1 +
 gcc/testsuite/g++.old-deja/g++.mike/eh50.C                  |  1 +
 gcc/testsuite/g++.old-deja/g++.mike/eh51.C                  |  1 +
 gcc/testsuite/g++.old-deja/g++.mike/eh7.C                   |  1 +
 gcc/testsuite/g++.old-deja/g++.mike/eh8.C                   |  1 +
 gcc/testsuite/g++.old-deja/g++.mike/eh9.C                   |  1 +
 gcc/testsuite/g++.old-deja/g++.mike/mangle1.C               |  1 +
 gcc/testsuite/g++.old-deja/g++.mike/p5958.C                 |  1 +
 gcc/testsuite/g++.old-deja/g++.mike/p6004.C                 |  1 +
 gcc/testsuite/g++.old-deja/g++.mike/p700.C                  |  3 ++-
 gcc/testsuite/g++.old-deja/g++.mike/p7912.C                 |  1 +
 gcc/testsuite/g++.old-deja/g++.mike/p811.C                  |  3 +++
 gcc/testsuite/g++.old-deja/g++.mike/virt4.C                 |  2 ++
 gcc/testsuite/g++.old-deja/g++.oliva/nameret1.C             |  2 +-
 gcc/testsuite/g++.old-deja/g++.oliva/nameret2.C             |  2 +-
 gcc/testsuite/g++.old-deja/g++.other/decl1.C                |  1 +
 gcc/testsuite/g++.old-deja/g++.other/expr1.C                |  3 ++-
 gcc/testsuite/g++.old-deja/g++.other/inline8.C              |  4 +++-
 gcc/testsuite/g++.old-deja/g++.other/loop1.C                |  1 +
 gcc/testsuite/g++.old-deja/g++.other/syntax1.C              |  2 ++
 gcc/testsuite/g++.old-deja/g++.pt/repo3.C                   |  2 ++
 gcc/testsuite/g++.old-deja/g++.robertl/eb27.C               |  2 ++
 gcc/testsuite/g++.old-deja/g++.robertl/eb83.C               |  2 ++
 gcc/testsuite/gcc.dg/pr44545.c                              |  2 +-
 gcc/testsuite/obj-c++.dg/comp-types-8.mm                    |  1 +
 gcc/testsuite/obj-c++.dg/demangle-3.mm                      |  1 +
 gcc/testsuite/obj-c++.dg/super-class-1.mm                   |  1 +
 528 files changed, 771 insertions(+), 351 deletions(-)

diff --git a/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-8.c b/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-8.c
index 0ed7928fd79..d146c788b74 100644
--- a/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-8.c
+++ b/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-8.c
@@ -4,7 +4,7 @@
 
 extern void grace (int);
 
-int
+void
 fn1 (int i)
 {
   switch (i)
@@ -16,7 +16,7 @@ fn1 (int i)
 done:;
 }
 
-int
+void
 fn2 (int i)
 {
   switch (i)
@@ -32,7 +32,7 @@ fn2 (int i)
 done:;
 }
 
-int
+void
 fn3 (int i)
 {
   switch (i)
@@ -46,7 +46,7 @@ fn3 (int i)
 done:;
 }
 
-int
+void
 fn4 (int i)
 {
   switch (i)
@@ -64,7 +64,7 @@ fn4 (int i)
 done:;
 }
 
-int
+void
 fn5 (int i)
 {
   switch (i)
@@ -83,7 +83,7 @@ fn5 (int i)
 done:;
 }
 
-int
+void
 fn6 (int i)
 {
   switch (i)
diff --git a/gcc/testsuite/c-c++-common/asan/pr63638.c b/gcc/testsuite/c-c++-common/asan/pr63638.c
index a8bafc5aad7..619a2b6142a 100644
--- a/gcc/testsuite/c-c++-common/asan/pr63638.c
+++ b/gcc/testsuite/c-c++-common/asan/pr63638.c
@@ -12,7 +12,7 @@ struct S{
 
 struct S s[6];
 
-int f(struct S *p)
+void f(struct S *p)
 {
   memcpy(p, &s[2], sizeof(*p));
   memcpy(p, &s[1], sizeof(*p));
diff --git a/gcc/testsuite/c-c++-common/goacc/parallel-1.c b/gcc/testsuite/c-c++-common/goacc/parallel-1.c
index 6c6cc88ecad..0afc53adaa8 100644
--- a/gcc/testsuite/c-c++-common/goacc/parallel-1.c
+++ b/gcc/testsuite/c-c++-common/goacc/parallel-1.c
@@ -35,4 +35,6 @@ parallel_clauses (void)
 
 #pragma acc parallel firstprivate (a, b)
   ;
+
+  return 0;
 }
diff --git a/gcc/testsuite/c-c++-common/gomp/sink-1.c b/gcc/testsuite/c-c++-common/gomp/sink-1.c
index 4872a072315..5ee562bfbf7 100644
--- a/gcc/testsuite/c-c++-common/gomp/sink-1.c
+++ b/gcc/testsuite/c-c++-common/gomp/sink-1.c
@@ -93,4 +93,6 @@ baz ()
 	bar (i, j, 0);
 #pragma omp ordered depend(source)
       }
+
+  return 0;
 }
diff --git a/gcc/testsuite/c-c++-common/missing-symbol.c b/gcc/testsuite/c-c++-common/missing-symbol.c
index 326b9faad7a..ed319d82e54 100644
--- a/gcc/testsuite/c-c++-common/missing-symbol.c
+++ b/gcc/testsuite/c-c++-common/missing-symbol.c
@@ -1,4 +1,4 @@
-/* { dg-options "-fdiagnostics-show-caret" } */
+/* { dg-options "-fdiagnostics-show-caret -Wno-return-type" } */
 
 extern int foo (void);
 extern int bar (void);
diff --git a/gcc/testsuite/c-c++-common/pr36513-2.c b/gcc/testsuite/c-c++-common/pr36513-2.c
index 3c12e1ae89e..d81c81dd4da 100644
--- a/gcc/testsuite/c-c++-common/pr36513-2.c
+++ b/gcc/testsuite/c-c++-common/pr36513-2.c
@@ -10,4 +10,5 @@ int main2 ()
 {
   char *s, t;
   strchr (s, t);
+  return 0;
 }
diff --git a/gcc/testsuite/c-c++-common/pr36513.c b/gcc/testsuite/c-c++-common/pr36513.c
index 026325410a1..b8b2d6d8060 100644
--- a/gcc/testsuite/c-c++-common/pr36513.c
+++ b/gcc/testsuite/c-c++-common/pr36513.c
@@ -11,5 +11,7 @@ int main1 ()
 		  && (t) == '\0' 
 		  ? (char *) __rawmemchr (s, t) 
 		  : __builtin_strchr (s, t)));
+
+  return 0;
 }
 
diff --git a/gcc/testsuite/c-c++-common/pr49706-2.c b/gcc/testsuite/c-c++-common/pr49706-2.c
index 09cc9eb1407..30a46c286e0 100644
--- a/gcc/testsuite/c-c++-common/pr49706-2.c
+++ b/gcc/testsuite/c-c++-common/pr49706-2.c
@@ -10,7 +10,7 @@
 
 bool r;
 
-int
+void
 same (int a, int b)
 {
   r = !a == !b;
diff --git a/gcc/testsuite/c-c++-common/pr65120.c b/gcc/testsuite/c-c++-common/pr65120.c
index c9c1f5f7e65..c8762e057d5 100644
--- a/gcc/testsuite/c-c++-common/pr65120.c
+++ b/gcc/testsuite/c-c++-common/pr65120.c
@@ -9,7 +9,7 @@
 
 bool r;
 
-int
+void
 f1 (int a)
 {
   r = !a == 0;
@@ -18,7 +18,7 @@ f1 (int a)
   r = !a != 1;	/* { dg-warning "logical not is only applied to the left hand side of comparison" } */
 }
 
-int
+void
 f2 (int a)
 {
   r = !a > 0;	/* { dg-warning "logical not is only applied to the left hand side of comparison" } */
diff --git a/gcc/testsuite/c-c++-common/tm/volatile-1.c b/gcc/testsuite/c-c++-common/tm/volatile-1.c
index eb3799dd972..40b41803555 100644
--- a/gcc/testsuite/c-c++-common/tm/volatile-1.c
+++ b/gcc/testsuite/c-c++-common/tm/volatile-1.c
@@ -3,7 +3,7 @@
 
 volatile int * p = 0;
 __attribute ((transaction_safe))
-int f() {
+void f() {
   int x = 0;	     // ok: not volatile
   p = &x;	     // ok: the pointer is not volatile
   int i = *p;	     // { dg-error "volatile" "read through volatile glvalue" }
diff --git a/gcc/testsuite/c-c++-common/vector-1.c b/gcc/testsuite/c-c++-common/vector-1.c
index 288dd1e924c..027d1777943 100644
--- a/gcc/testsuite/c-c++-common/vector-1.c
+++ b/gcc/testsuite/c-c++-common/vector-1.c
@@ -8,7 +8,7 @@
 vector float a;
 vector int a1;
 
-int f(void)
+void f(void)
 {
  a =  ~a; /* { dg-error "" } */
  a1 =  ~a1;
diff --git a/gcc/testsuite/c-c++-common/vector-2.c b/gcc/testsuite/c-c++-common/vector-2.c
index e9f40a35892..9db53a88c5f 100644
--- a/gcc/testsuite/c-c++-common/vector-2.c
+++ b/gcc/testsuite/c-c++-common/vector-2.c
@@ -9,7 +9,7 @@ vector int a1;
 vector float b;
 vector int b1;
 
-int f(void)
+void f(void)
 {
  a =  a | b; /* { dg-error "" } */
  a =  a & b; /* { dg-error "" } */
diff --git a/gcc/testsuite/g++.dg/abi/abi-tag14.C b/gcc/testsuite/g++.dg/abi/abi-tag14.C
index a66e6552cba..3017f492cda 100644
--- a/gcc/testsuite/g++.dg/abi/abi-tag14.C
+++ b/gcc/testsuite/g++.dg/abi/abi-tag14.C
@@ -8,20 +8,20 @@ inline namespace __cxx11 __attribute ((abi_tag ("cxx11"))) {
 A a;				// { dg-warning "\"cxx11\"" }
 
 // { dg-final { scan-assembler "_Z1fB5cxx11v" } }
-A f() {}			// { dg-warning "\"cxx11\"" }
+A f() { return a; }		// { dg-warning "\"cxx11\"" }
 
 namespace {
   A a2;
-  A f2() {}
+  A f2() { return a2; }
   struct B: A {};
 }
 
 // { dg-final { scan-assembler "_Z1fPN7__cxx111AE" } }
-A f(A*) {}
+A f(A*) { return a; }
 
 // { dg-final { scan-assembler "_Z1gIN7__cxx111AEET_v" } }
 template <class T> T g() { }
-template <> A g<A>() { }
+template <> A g<A>() { return a; }
 
 // { dg-final { scan-assembler "_Z1vIN7__cxx111AEE" { target c++14 } } }
 #if __cplusplus >= 201402L
diff --git a/gcc/testsuite/g++.dg/abi/abi-tag18.C b/gcc/testsuite/g++.dg/abi/abi-tag18.C
index 89ee737bf57..ad8e16e692b 100644
--- a/gcc/testsuite/g++.dg/abi/abi-tag18.C
+++ b/gcc/testsuite/g++.dg/abi/abi-tag18.C
@@ -11,9 +11,11 @@ inline A1 f() {
   struct T {
     A2 g() {			// { dg-warning "mangled name" }
       static X x;		// { dg-warning "mangled name" }
+      return A2();
     }
   };
   T().g();
+  return A1();
 }
 int main() {
   f();
diff --git a/gcc/testsuite/g++.dg/abi/abi-tag18a.C b/gcc/testsuite/g++.dg/abi/abi-tag18a.C
index f65f629bd94..6c569502338 100644
--- a/gcc/testsuite/g++.dg/abi/abi-tag18a.C
+++ b/gcc/testsuite/g++.dg/abi/abi-tag18a.C
@@ -11,9 +11,11 @@ inline A1 f() {
   struct T {
     A2 g() {
       static X x;
+      return A2();
     }
   };
   T().g();
+  return A1();
 }
 int main() {
   f();
diff --git a/gcc/testsuite/g++.dg/abi/covariant2.C b/gcc/testsuite/g++.dg/abi/covariant2.C
index 3231cc4c84c..6c55ad6bb67 100644
--- a/gcc/testsuite/g++.dg/abi/covariant2.C
+++ b/gcc/testsuite/g++.dg/abi/covariant2.C
@@ -10,7 +10,7 @@ struct c1 {};
 
 struct c3 : virtual c1
 {
-    virtual c1* f6() {}
+    virtual c1* f6() { return 0; }
     int i;
 };
 
@@ -18,7 +18,7 @@ struct c6 : virtual c3 { };
 
 struct c7 : c3
 {
-    virtual c3* f6() {}
+    virtual c3* f6() { return 0; }
 };
 
 struct c24 : virtual c7
diff --git a/gcc/testsuite/g++.dg/abi/covariant3.C b/gcc/testsuite/g++.dg/abi/covariant3.C
index 178157c58b2..09b9912524d 100644
--- a/gcc/testsuite/g++.dg/abi/covariant3.C
+++ b/gcc/testsuite/g++.dg/abi/covariant3.C
@@ -34,7 +34,7 @@ struct c28 : virtual c0, virtual c11 {
     virtual c18* f6();
 };
 
-c0 *c1::f6 () {}
+c0 *c1::f6 () { return 0; }
 void c5::foo () {}
 void c10::foo () {}
 void c18::bar () {}
diff --git a/gcc/testsuite/g++.dg/abi/mangle7.C b/gcc/testsuite/g++.dg/abi/mangle7.C
index af178d3e599..14c65a24da8 100644
--- a/gcc/testsuite/g++.dg/abi/mangle7.C
+++ b/gcc/testsuite/g++.dg/abi/mangle7.C
@@ -1,6 +1,6 @@
 /* { dg-do compile } */
 
 typedef void *const t1[2];
-float const f1(t1 (&)[79], ...) {}
+float const f1(t1 (&)[79], ...) { return 0.0f; }
 
 /* { dg-final { scan-assembler _Z2f1RA79_A2_KPvz } } */
diff --git a/gcc/testsuite/g++.dg/asan/pr81340.C b/gcc/testsuite/g++.dg/asan/pr81340.C
index 76ac08a9a56..9db5bb46ce7 100644
--- a/gcc/testsuite/g++.dg/asan/pr81340.C
+++ b/gcc/testsuite/g++.dg/asan/pr81340.C
@@ -10,13 +10,13 @@ public:
   a(char *) : c(0, d) {}
 };
 class e {
-  int f(const int &, const int &, const int &, bool, bool, bool, int, bool);
+  void f(const int &, const int &, const int &, bool, bool, bool, int, bool);
 };
 class g {
 public:
   static g *h();
   void i(a, void *);
 };
-int e::f(const int &, const int &, const int &, bool j, bool, bool, int, bool) {
+void e::f(const int &, const int &, const int &, bool j, bool, bool, int, bool) {
   g::h()->i("", &j);
 }
diff --git a/gcc/testsuite/g++.dg/concepts/fn8.C b/gcc/testsuite/g++.dg/concepts/fn8.C
index 5c796c7e3b2..b91f1ae9511 100644
--- a/gcc/testsuite/g++.dg/concepts/fn8.C
+++ b/gcc/testsuite/g++.dg/concepts/fn8.C
@@ -12,7 +12,7 @@ void (*p2)(int) = &f<int>; // { dg-error "no matches" }
 void (*p3)(int) = &f; // { dg-error "no matches" }
 
 struct S {
-  template<Class T> int f(T) { }
+  template<Class T> int f(T) { return 0; }
 };
 
 auto p4 = &S::template f<int>; // { dg-error "no matches" }
diff --git a/gcc/testsuite/g++.dg/concepts/pr65575.C b/gcc/testsuite/g++.dg/concepts/pr65575.C
index e027dccf7d8..6745b843d31 100644
--- a/gcc/testsuite/g++.dg/concepts/pr65575.C
+++ b/gcc/testsuite/g++.dg/concepts/pr65575.C
@@ -14,7 +14,7 @@ int (*p)() requires true; // { dg-error "" }
 int (&p)() requires true; // { dg-error "" }
 int g(int (*)() requires true); // { dg-error "" }
 
-int f() { }
+int f() { return 0; }
 
 int
 main()
diff --git a/gcc/testsuite/g++.dg/concepts/template-parm11.C b/gcc/testsuite/g++.dg/concepts/template-parm11.C
index 73f38815fb7..352acc2271d 100644
--- a/gcc/testsuite/g++.dg/concepts/template-parm11.C
+++ b/gcc/testsuite/g++.dg/concepts/template-parm11.C
@@ -12,7 +12,7 @@ template<NameProvider... ColSpec>
 void getTable(const ColSpec&...)
 {}
 
-int f()
+void f()
 {
   getTable(7, 'a'); // { dg-error "cannot call" }
 };
diff --git a/gcc/testsuite/g++.dg/conversion/op6.C b/gcc/testsuite/g++.dg/conversion/op6.C
index 9aec9f0a808..8a5efc4023a 100644
--- a/gcc/testsuite/g++.dg/conversion/op6.C
+++ b/gcc/testsuite/g++.dg/conversion/op6.C
@@ -3,9 +3,9 @@
 
 template<class T> class smart_pointer {
 public:
-    operator T* () const { }
-    operator bool () const { }
-    operator bool () { }
+    operator T* () const { return 0; }
+    operator bool () const { return true; }
+    operator bool () { return true; }
 };
 class Context { };
 typedef smart_pointer<Context> ContextP;
diff --git a/gcc/testsuite/g++.dg/cpp0x/Wunused-variable-1.C b/gcc/testsuite/g++.dg/cpp0x/Wunused-variable-1.C
index 39592b26a58..dd316d1ace5 100644
--- a/gcc/testsuite/g++.dg/cpp0x/Wunused-variable-1.C
+++ b/gcc/testsuite/g++.dg/cpp0x/Wunused-variable-1.C
@@ -15,6 +15,7 @@ int
 foo ()
 {
   C {} (1, 1L, 1LL, 1.0);
+  return 0;
 }
 
 template<int N>
diff --git a/gcc/testsuite/g++.dg/cpp0x/access01.C b/gcc/testsuite/g++.dg/cpp0x/access01.C
index 55c951f97d6..3a7cee4156a 100644
--- a/gcc/testsuite/g++.dg/cpp0x/access01.C
+++ b/gcc/testsuite/g++.dg/cpp0x/access01.C
@@ -6,7 +6,7 @@ class A
 {
   T p;
 public:
-  template <class U> auto f() -> decltype(+p) { }
+  template <class U> auto f() -> decltype(+p) { return p; }
 };
 
 int main()
diff --git a/gcc/testsuite/g++.dg/cpp0x/alignas3.C b/gcc/testsuite/g++.dg/cpp0x/alignas3.C
index aa62e5afb2d..af3f171bb3f 100644
--- a/gcc/testsuite/g++.dg/cpp0x/alignas3.C
+++ b/gcc/testsuite/g++.dg/cpp0x/alignas3.C
@@ -16,5 +16,5 @@ template <class, class Y> typename F<Y>::ret_type cast(Y &);
 class CompoundStmt;
 class alignas(8) Stmt {
   Stmt *Children[1];
-  CompoundStmt *getBlock() const { cast<CompoundStmt>(Children[0]); }
+  CompoundStmt *getBlock() const { cast<CompoundStmt>(Children[0]); return 0; }
 };
diff --git a/gcc/testsuite/g++.dg/cpp0x/auto2.C b/gcc/testsuite/g++.dg/cpp0x/auto2.C
index cff36d212af..e967b9423a5 100644
--- a/gcc/testsuite/g++.dg/cpp0x/auto2.C
+++ b/gcc/testsuite/g++.dg/cpp0x/auto2.C
@@ -4,12 +4,12 @@
 #include <typeinfo>
 extern "C" void abort();
 
-int f() {}
+int f() { return 0; }
 
 struct A
 {
   int i;
-  int f() {}
+  int f() { return 0; }
   A operator+(A a) { return a; }
 };
 
@@ -70,4 +70,5 @@ int main()
     }
 
   auto j = 42, k = 24;
+  return 0;
 }
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-array17.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-array17.C
index c6afa507f02..f722b25ec3d 100644
--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-array17.C
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-array17.C
@@ -18,6 +18,7 @@ struct D {
   template <typename _ForwardIterator, typename _Size>
   static _ForwardIterator __uninit_default_n(_ForwardIterator p1, _Size) {
     _Construct(p1);
+    return _ForwardIterator();
   }
 };
 template <typename _ForwardIterator, typename _Size>
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-defarg2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-defarg2.C
index f1ca05fe9ec..515576e1f62 100644
--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-defarg2.C
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-defarg2.C
@@ -25,6 +25,9 @@ struct A : D
 
 A baz (const char *, A = C ());
 
+C c;
+A a (c);
+
 A
 B::foo ()
 {
@@ -35,10 +38,13 @@ B::foo ()
   catch (...)
     {
     }
+
+  return a;
 }
 
 A
 B::bar ()
 {
   baz ("bar");
+  return a;
 }
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-diag3.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-diag3.C
index 27aad93e6c3..858457fa8b9 100644
--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-diag3.C
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-diag3.C
@@ -4,7 +4,7 @@
 int f(int);
 
 template <class T>
-constexpr T g(T t) { return f(t); } // { dg-error "f.int" }
+constexpr T g(T t) { return f(t); } // { dg-error "f.int" "" { target c++14_only } }
 
 int main()
 {
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-memfn1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-memfn1.C
index d59f465715d..d58e2ec6b15 100644
--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-memfn1.C
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-memfn1.C
@@ -13,6 +13,6 @@ constexpr X X::g(X x) { return x; }
 struct Y
 {
   Y() { }
-  constexpr Y f(Y y) {}		// { dg-error "constexpr" }
-  static constexpr Y g(Y y) {}	// { dg-error "constexpr" }
+  constexpr Y f(Y y) { return y; }  // { dg-error "constexpr" }
+  static constexpr Y g(Y y) { return y; } // { dg-error "constexpr" }
 };
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-neg3.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-neg3.C
index 55bb838a2bf..a5d7d084cfd 100644
--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-neg3.C
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-neg3.C
@@ -9,7 +9,7 @@ struct A
 template<typename> struct B
 {
   A a;
-  constexpr int bar() { return a.foo(); } // { dg-error "foo" }
+  constexpr int bar() { return a.foo(); } // { dg-error "foo" "" { target c++14_only } }
 };
 
 constexpr int i = B<void>().bar(); // { dg-error "bar" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/dc1.C b/gcc/testsuite/g++.dg/cpp0x/dc1.C
index e7ccb64a3b3..5ce50764b5f 100644
--- a/gcc/testsuite/g++.dg/cpp0x/dc1.C
+++ b/gcc/testsuite/g++.dg/cpp0x/dc1.C
@@ -27,7 +27,7 @@ struct D : public C {
 	D (int _i) : C(), i(_i) { }
 	D () : D(-1) { }
 	virtual ~D() { }
-	virtual int f () { }
+	virtual int f () { return 0; }
 };
 
 void f_D () { C* c = new D(); }
diff --git a/gcc/testsuite/g++.dg/cpp0x/dc3.C b/gcc/testsuite/g++.dg/cpp0x/dc3.C
index 9c6fd56564c..9c1fd53e4fe 100644
--- a/gcc/testsuite/g++.dg/cpp0x/dc3.C
+++ b/gcc/testsuite/g++.dg/cpp0x/dc3.C
@@ -43,7 +43,7 @@ struct D<X> : public C {
 	D (int _i) : C(), i(_i) { }
 	D () : D(-1) { }
 	virtual ~D() { }
-	virtual int f () { }
+	virtual int f () { return 0; }
 };
 
 void f_D () { D<X>* d = new D<X>(); }
diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype12.C b/gcc/testsuite/g++.dg/cpp0x/decltype12.C
index eae318db2df..58fd415eea5 100644
--- a/gcc/testsuite/g++.dg/cpp0x/decltype12.C
+++ b/gcc/testsuite/g++.dg/cpp0x/decltype12.C
@@ -1,4 +1,6 @@
 // { dg-do compile { target c++11 } }
+// { dg-additional-options "-Wno-return-type" }
+
 template<typename T, typename U>
 struct is_same
 {
diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype17.C b/gcc/testsuite/g++.dg/cpp0x/decltype17.C
index 6e5854db6c9..47b70ecd89c 100644
--- a/gcc/testsuite/g++.dg/cpp0x/decltype17.C
+++ b/gcc/testsuite/g++.dg/cpp0x/decltype17.C
@@ -1,5 +1,6 @@
 // PR c++/36628
 // { dg-do run { target c++11 } }
+// { dg-additional-options "-Wno-return-type" }
 
 #include <typeinfo>
 #include <string.h>
@@ -25,4 +26,6 @@ int main()
     return 2;
   if (strcmp (typeid(h).name(), "FOivE") != 0)
     return 3;
+
+  return 0;
 }
diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype3.C b/gcc/testsuite/g++.dg/cpp0x/decltype3.C
index b2e66243cc7..b921dd6d899 100644
--- a/gcc/testsuite/g++.dg/cpp0x/decltype3.C
+++ b/gcc/testsuite/g++.dg/cpp0x/decltype3.C
@@ -49,7 +49,7 @@ public:
   int a;
   enum B_enum { b }; 
   decltype(a) c;
-  decltype(a) foo() { }
+  decltype(a) foo() { return 0; }
   decltype(b) enums_are_in_scope() { return b; } // ok 
 }; 
 
diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype41.C b/gcc/testsuite/g++.dg/cpp0x/decltype41.C
index 1439e15c0d4..65f75b1e4fa 100644
--- a/gcc/testsuite/g++.dg/cpp0x/decltype41.C
+++ b/gcc/testsuite/g++.dg/cpp0x/decltype41.C
@@ -23,15 +23,15 @@ class B
 template <class T>
 struct C
 {
-  template <class U> decltype (a.i) f() { } // #1
-  template <class U> decltype (b.i) f() { } // #2
+  template <class U> decltype (a.i) f() { return 0; } // #1
+  template <class U> decltype (b.i) f() { return 1; } // #2
 };
 
 template <class T>
 struct D
 {
-  template <class U> decltype (A::j) f() { } // #1
-  template <class U> decltype (B::j) f() { } // #2
+  template <class U> decltype (A::j) f() { return 2; } // #1
+  template <class U> decltype (B::j) f() { return 3; } // #2
 };
 
 int main()
diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted28.C b/gcc/testsuite/g++.dg/cpp0x/defaulted28.C
index 451a1b4198f..0e04dbfb8d7 100644
--- a/gcc/testsuite/g++.dg/cpp0x/defaulted28.C
+++ b/gcc/testsuite/g++.dg/cpp0x/defaulted28.C
@@ -9,7 +9,7 @@ private:
   A(A const&) = default;	// { dg-message "private" }
 };
 
-int f(...) { }
+int f(...) { return 0; }
 int main() {
   A a;
   f(a); 			// { dg-error "this context" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/enum_base3.C b/gcc/testsuite/g++.dg/cpp0x/enum_base3.C
index 3cb2d6d8186..5f7e83e1419 100644
--- a/gcc/testsuite/g++.dg/cpp0x/enum_base3.C
+++ b/gcc/testsuite/g++.dg/cpp0x/enum_base3.C
@@ -17,7 +17,7 @@ struct C
 };
 struct D : C
 {
-  B foo () const { B a; a.foo (d); }
+  B foo () const { B a; a.foo (d); return B(); }
   H d;
 };
 struct F : C
diff --git a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-4.C b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-4.C
index eb585a89be4..023d8396777 100644
--- a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-4.C
+++ b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-4.C
@@ -22,7 +22,7 @@ void two [[gnu::unused]] (void) {}
 int
 five(void)
 [[noreturn]] // { dg-warning "ignored" }
-{}
+{ return 0; }
 
 [[noreturn]]
 void
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist96.C b/gcc/testsuite/g++.dg/cpp0x/initlist96.C
index 45fd128ba83..94e9c0eb148 100644
--- a/gcc/testsuite/g++.dg/cpp0x/initlist96.C
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist96.C
@@ -1,5 +1,6 @@
 // PR c++/66515
 // { dg-do compile { target c++11 } }
+// { dg-additional-options "-Wno-return-type" }
 
 #include <initializer_list>
 
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-58566.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-58566.C
index 3101d0a895c..7bcfe3ae70b 100644
--- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-58566.C
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-58566.C
@@ -6,5 +6,6 @@ struct A
   int foo()
   {
     [this]{ return foo; }; // { dg-error "invalid use of member function|cannot convert" }
+    return 0;
   }
 };
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv10.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv10.C
index 8e806c849ae..c2a60900b35 100644
--- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv10.C
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv10.C
@@ -1,5 +1,6 @@
 // PR c++/69889
 // { dg-do compile { target c++11 } }
+// { dg-additional-options "-Wno-return-type" }
 
 template <typename F> struct Tag {
   static void fp() { f()(0); }
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv12.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv12.C
index 16adee6b9c3..e1bd38a7bf7 100644
--- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv12.C
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv12.C
@@ -1,5 +1,6 @@
 // PR c++/80767
 // { dg-do compile { target c++11 } }
+// { dg-additional-options "-Wno-return-type" }
 
 template <typename T, typename U = T> struct A { using type = U; };
 template <typename F, typename... G> struct B : B<F>::type, B<G...>::type {
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg3.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg3.C
index 1c593930133..27aac578c07 100644
--- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg3.C
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg3.C
@@ -10,7 +10,7 @@ struct function
 
 template<typename T> struct C
 {
-  static T test(function f = [](int i){return i;}) { }
+  static T test(function f = [](int i){return i;}) { return T(); }
 };
 
 int main()
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice3.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice3.C
index fa8a6e63a93..371d03f941f 100644
--- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice3.C
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice3.C
@@ -14,6 +14,8 @@ bool Klass::dostuff()
     if (local & 1) { return true; } // { dg-error "not captured|non-static" }
     return false;
   };
+
+  return true;
 }
 
 int main()
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice5.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice5.C
index 914e0f71e00..50a340dbb22 100644
--- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice5.C
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice5.C
@@ -4,6 +4,7 @@
 template<int> int foo()
 {
   [] (void i) { return 0; } (0); // { dg-error "incomplete|invalid|no match" }
+  return 0;
 }
 
 void bar()
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested2.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested2.C
index 9e509513ad9..27954f9408c 100644
--- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested2.C
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested2.C
@@ -13,7 +13,7 @@ void f1(int i) {
   };
   struct s1 {
     int f;
-    int work(int n) {
+    void work(int n) {
       int m = n*n;
       int j = 40;
       auto m3 = [this,m]{
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template12.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template12.C
index 635af97d763..5dfd6ede19c 100644
--- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template12.C
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template12.C
@@ -14,6 +14,7 @@ class X
         [&a]{
             typename remove_reference < decltype (a) >::type t;
         };
+	return true;
     }
 };
 template class X< int >;
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template2.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template2.C
index 29f63afe0df..8fbb821a4d3 100644
--- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template2.C
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template2.C
@@ -10,7 +10,7 @@ struct T
   foo (S<N> *p)
   {
     S<N> u;
-    [&u] ()->bool {} ();
+    [&u] ()->bool { return true; } ();
   }
 };
 
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this12.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this12.C
index ef573b19e02..41e4edd8a0f 100644
--- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this12.C
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this12.C
@@ -3,7 +3,7 @@
 
 struct A
 {
-  int f() {}
+  int f() { return 0; }
   int i;
 
   void foo()
diff --git a/gcc/testsuite/g++.dg/cpp0x/nolinkage1.C b/gcc/testsuite/g++.dg/cpp0x/nolinkage1.C
index d38028c4b43..474727c135c 100644
--- a/gcc/testsuite/g++.dg/cpp0x/nolinkage1.C
+++ b/gcc/testsuite/g++.dg/cpp0x/nolinkage1.C
@@ -18,4 +18,4 @@ static void g()
   A<B> a;
 }
 
-int main() { g(); f(0); }
+int main() { g(); f(0); return 0; }
diff --git a/gcc/testsuite/g++.dg/cpp0x/nolinkage1a.cc b/gcc/testsuite/g++.dg/cpp0x/nolinkage1a.cc
index f8528f3e650..6672323fdd4 100644
--- a/gcc/testsuite/g++.dg/cpp0x/nolinkage1a.cc
+++ b/gcc/testsuite/g++.dg/cpp0x/nolinkage1a.cc
@@ -12,4 +12,4 @@ static void g()
   A<B> a;
 }
 
-int dummy() { g(); f(0); }
+int dummy() { g(); f(0); return 0; }
diff --git a/gcc/testsuite/g++.dg/cpp0x/nsdmi-template5.C b/gcc/testsuite/g++.dg/cpp0x/nsdmi-template5.C
index fdaf4611ee2..5f23d463003 100644
--- a/gcc/testsuite/g++.dg/cpp0x/nsdmi-template5.C
+++ b/gcc/testsuite/g++.dg/cpp0x/nsdmi-template5.C
@@ -7,7 +7,7 @@ template<> struct A1<0>
 {
   template<typename, typename...> struct B1
   {
-    template<typename> int foo1() {}
+    template<typename> int foo1() { return 0; }
 
     int i1 = foo1<int>();
   };
@@ -19,7 +19,7 @@ template<> struct A2<0>
 {
   template<typename, typename> struct B2
   {
-    template<typename> int foo2() {}
+    template<typename> int foo2() { return 1; }
 
     int i2 = foo2<int>();
   };
@@ -31,7 +31,7 @@ template<> struct A3<0>
 {
   template<typename> struct B3
   {
-    template<typename> int foo3() {}
+    template<typename> int foo3() { return 2; }
 
     int i3 = foo3<int>();
   };
diff --git a/gcc/testsuite/g++.dg/cpp0x/parse1.C b/gcc/testsuite/g++.dg/cpp0x/parse1.C
index 5a11b7337a4..9a2698435b6 100644
--- a/gcc/testsuite/g++.dg/cpp0x/parse1.C
+++ b/gcc/testsuite/g++.dg/cpp0x/parse1.C
@@ -2,4 +2,4 @@
 // { dg-do compile { target c++11 } }
 
 typedef int B;			// { dg-message "" }
-B::B() {}			// { dg-error "" }
+B::B() { return 0; }		// { dg-error "" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr34054.C b/gcc/testsuite/g++.dg/cpp0x/pr34054.C
index 8043f9660ed..7a8b3249701 100644
--- a/gcc/testsuite/g++.dg/cpp0x/pr34054.C
+++ b/gcc/testsuite/g++.dg/cpp0x/pr34054.C
@@ -1,4 +1,4 @@
 // PR c++/34054
 // { dg-do compile { target c++11 } }
 
-template<typename... T> T foo() {} // { dg-error "not expanded|T" }
+template<typename... T> T foo() { return T(); } // { dg-error "not expanded|T" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr47416.C b/gcc/testsuite/g++.dg/cpp0x/pr47416.C
index e4eb317e771..cbe2ed09ff8 100644
--- a/gcc/testsuite/g++.dg/cpp0x/pr47416.C
+++ b/gcc/testsuite/g++.dg/cpp0x/pr47416.C
@@ -1,5 +1,6 @@
 // PR c++/47416
 // { dg-do compile { target c++11 } }
+// { dg-additional-options "-Wno-return-type" }
 
 namespace std
 {
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr58781.C b/gcc/testsuite/g++.dg/cpp0x/pr58781.C
index 58c972f90f3..069fcd5f6dc 100644
--- a/gcc/testsuite/g++.dg/cpp0x/pr58781.C
+++ b/gcc/testsuite/g++.dg/cpp0x/pr58781.C
@@ -9,7 +9,7 @@ operator""_s(const char32_t *a, size_t b)
   return 0;
 }
 
-int
+void
 f()
 {
   using a = decltype(U"\x1181"_s);
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr70538.C b/gcc/testsuite/g++.dg/cpp0x/pr70538.C
index 0347c856c55..05665d6b935 100644
--- a/gcc/testsuite/g++.dg/cpp0x/pr70538.C
+++ b/gcc/testsuite/g++.dg/cpp0x/pr70538.C
@@ -11,5 +11,5 @@ class B {
 template <typename> class C : B {
   using base_type = B;
   base_type::base_type;  // { dg-warning "access declarations" }
-  PathComponentPiece m_fn1() {}
+  PathComponentPiece m_fn1() { return PathComponentPiece(); }
 };
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr81325.C b/gcc/testsuite/g++.dg/cpp0x/pr81325.C
index 11f0900caa2..47f32134477 100644
--- a/gcc/testsuite/g++.dg/cpp0x/pr81325.C
+++ b/gcc/testsuite/g++.dg/cpp0x/pr81325.C
@@ -35,7 +35,7 @@ struct I {
 };
 template <typename ResultT, typename ArgT> struct J {
   void operator()();
-  ResultT operator()(ArgT) {}
+  ResultT operator()(ArgT) { return ResultT(); }
 };
 struct K {
   int AllowBind;
diff --git a/gcc/testsuite/g++.dg/cpp0x/range-for13.C b/gcc/testsuite/g++.dg/cpp0x/range-for13.C
index 100f531f760..9ed0458adcc 100644
--- a/gcc/testsuite/g++.dg/cpp0x/range-for13.C
+++ b/gcc/testsuite/g++.dg/cpp0x/range-for13.C
@@ -7,10 +7,12 @@
 template<typename T> int *begin(T &t)
 {
     T::fail;
+    return 0;
 }
 template<typename T> int *end(T &t)
 {
     T::fail;
+    return 0;
 }
 
 struct container1
diff --git a/gcc/testsuite/g++.dg/cpp0x/range-for14.C b/gcc/testsuite/g++.dg/cpp0x/range-for14.C
index f43e1abcde7..4e0333cf927 100644
--- a/gcc/testsuite/g++.dg/cpp0x/range-for14.C
+++ b/gcc/testsuite/g++.dg/cpp0x/range-for14.C
@@ -7,10 +7,12 @@
 template<typename T> int *begin(T &t)
 {
     T::fail;
+    return 0;
 }
 template<typename T> int *end(T &t)
 {
     T::fail;
+    return 0;
 }
 
 //Test for defaults
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv2n.C b/gcc/testsuite/g++.dg/cpp0x/rv2n.C
index 663a66b6d90..65eda80fba0 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv2n.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv2n.C
@@ -144,6 +144,7 @@ int test2_18()
     sink_2_18(ca);		// { dg-error "" }
     sink_2_18(va);		// { dg-error "" }
     sink_2_18(cva);		// { dg-error "" }
+    return 0;
 }
 
 two   sink_2_23(const          A&);
@@ -250,6 +251,7 @@ int test2_28()
     const volatile A cva = a; // { dg-error "deleted" }
     sink_2_28(va);		// { dg-error "" }
     sink_2_28(cva);		// { dg-error "" }
+    return 0;
 }
 
 three sink_2_35(volatile       A&);
@@ -304,7 +306,7 @@ int test2_37()
 three sink_2_38(volatile       A&);
 eight sink_2_38(const volatile A&&);
 
-int test2_38()
+void test2_38()
 {
                    A a;
     const          A ca = a; // { dg-error "deleted" }
@@ -396,7 +398,7 @@ int test2_57()
 five  sink_2_58(               A&&);
 eight sink_2_58(const volatile A&&);
 
-int test2_58()
+void test2_58()
 {
                    A a;
     const          A ca = a; // { dg-error "deleted" }
@@ -439,6 +441,7 @@ int test2_68()
     sink_2_68(ca);		// { dg-error "" }
     sink_2_68(va);		// { dg-error "" }
     sink_2_68(cva);		// { dg-error "" }
+    return 0;
 }
 
 seven sink_2_78(volatile       A&&);
@@ -454,6 +457,7 @@ int test2_78()
     sink_2_78(ca);		// { dg-error "" }
     sink_2_78(va);		// { dg-error "" }
     sink_2_78(cva);		// { dg-error "" }
+    return 0;
 }
 
 int main()
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv3n.C b/gcc/testsuite/g++.dg/cpp0x/rv3n.C
index b7c1d7a2343..4549438f8ef 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv3n.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv3n.C
@@ -124,6 +124,7 @@ int test3_128()
 
     sink_3_128(va);		// { dg-error "" }
     sink_3_128(cva);		// { dg-error "" }
+    return 0;
 }
 
 one   sink_3_134(               A&);
diff --git a/gcc/testsuite/g++.dg/cpp0x/static_assert10.C b/gcc/testsuite/g++.dg/cpp0x/static_assert10.C
index e7f728e3f4f..ffbf3c047eb 100644
--- a/gcc/testsuite/g++.dg/cpp0x/static_assert10.C
+++ b/gcc/testsuite/g++.dg/cpp0x/static_assert10.C
@@ -5,4 +5,5 @@ template<typename T> bool foo(T)
 {
   int i;
   static_assert(foo(i), "Error"); // { dg-error "non-constant condition|not usable|non-constexpr" }
+  return true;
 }
diff --git a/gcc/testsuite/g++.dg/cpp0x/static_assert11.C b/gcc/testsuite/g++.dg/cpp0x/static_assert11.C
index 8a7362d5f56..36bf458e25f 100644
--- a/gcc/testsuite/g++.dg/cpp0x/static_assert11.C
+++ b/gcc/testsuite/g++.dg/cpp0x/static_assert11.C
@@ -6,5 +6,6 @@ struct A
   template<typename T> bool foo(T)
   {
     static_assert(foo(0), "Error"); // { dg-error "non-constant condition|constant expression" }
+    return true;
   }
 };
diff --git a/gcc/testsuite/g++.dg/cpp0x/static_assert12.C b/gcc/testsuite/g++.dg/cpp0x/static_assert12.C
index ff6f40d918f..5d59e540910 100644
--- a/gcc/testsuite/g++.dg/cpp0x/static_assert12.C
+++ b/gcc/testsuite/g++.dg/cpp0x/static_assert12.C
@@ -14,7 +14,7 @@ template<>
   };
 
 template<typename T>
-  T
+  void
   float_thing(T __x)
   {
     static_assert(is_float<T>::value, ""); // { dg-error "static assertion failed" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/static_assert13.C b/gcc/testsuite/g++.dg/cpp0x/static_assert13.C
index 86b0b0360d9..7332ff91882 100644
--- a/gcc/testsuite/g++.dg/cpp0x/static_assert13.C
+++ b/gcc/testsuite/g++.dg/cpp0x/static_assert13.C
@@ -14,7 +14,7 @@ template<>
   };
 
 template<typename T>
-  T
+  void
   float_thing(T __x)
   {
     static_assert(is_float<T>::value, ""); // { dg-error "static assertion failed" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/trailing1.C b/gcc/testsuite/g++.dg/cpp0x/trailing1.C
index 7d9a906d4f3..ecf092bda0d 100644
--- a/gcc/testsuite/g++.dg/cpp0x/trailing1.C
+++ b/gcc/testsuite/g++.dg/cpp0x/trailing1.C
@@ -40,9 +40,9 @@ decltype(*(T*)0+*(U*)0) add4(T t, U u)
 template <class T>
 struct A
 {
-  T f() {}
+  T f() { return T(); }
   template <class U>
-  T g() {}
+  T g() { return T(); }
   template <class V>
   struct B
   {
diff --git a/gcc/testsuite/g++.dg/cpp0x/trailing5.C b/gcc/testsuite/g++.dg/cpp0x/trailing5.C
index 48f31452e5b..32390d60897 100644
--- a/gcc/testsuite/g++.dg/cpp0x/trailing5.C
+++ b/gcc/testsuite/g++.dg/cpp0x/trailing5.C
@@ -2,9 +2,9 @@
 // { dg-do compile { target c++11 } }
 
 struct A {};
-auto foo() -> struct A {}
+auto foo() -> struct A { return A(); }
 
 enum B {};
-auto bar() -> enum B {}
+auto bar() -> enum B { return B(); }
 
 auto baz() -> struct C {} {}	// { dg-error "" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic114.C b/gcc/testsuite/g++.dg/cpp0x/variadic114.C
index 82ffe83c7c5..183cb2b5631 100644
--- a/gcc/testsuite/g++.dg/cpp0x/variadic114.C
+++ b/gcc/testsuite/g++.dg/cpp0x/variadic114.C
@@ -1,5 +1,6 @@
 // PR c++/49785
 // { dg-do compile { target c++11 } }
+// { dg-additional-options "-Wno-return-type" }
 
 template <typename, typename ...> struct B { };
 template <typename> class A;
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic57.C b/gcc/testsuite/g++.dg/cpp0x/variadic57.C
index a3d2bf1c5df..4bf014b54da 100644
--- a/gcc/testsuite/g++.dg/cpp0x/variadic57.C
+++ b/gcc/testsuite/g++.dg/cpp0x/variadic57.C
@@ -10,7 +10,7 @@ struct array<T, 0> {
 };
 
 template<typename T, int... Dims>
-int array<T, Dims...>::foo() { }
+int array<T, Dims...>::foo() { return 0; }
 
 template<typename T>
-int array<T, 0>::bar() { }
+int array<T, 0>::bar() { return 0; }
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic65.C b/gcc/testsuite/g++.dg/cpp0x/variadic65.C
index 0eef2a5ed25..9223235174f 100644
--- a/gcc/testsuite/g++.dg/cpp0x/variadic65.C
+++ b/gcc/testsuite/g++.dg/cpp0x/variadic65.C
@@ -1,4 +1,6 @@
 // { dg-do compile { target c++11 } }
+// { dg-additional-options "-Wno-return-type" }
+
 struct unused;
 template<typename T1 = unused, typename T2 = unused, typename T3 = unused,
          typename T4 = unused, typename T5 = unused, typename T6 = unused>
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic66.C b/gcc/testsuite/g++.dg/cpp0x/variadic66.C
index ac922215198..bf86deee8fd 100644
--- a/gcc/testsuite/g++.dg/cpp0x/variadic66.C
+++ b/gcc/testsuite/g++.dg/cpp0x/variadic66.C
@@ -1,7 +1,7 @@
 // { dg-do compile { target c++11 } }
 
 template<typename Result, typename Functor, typename... ArgTypes>
-Result bind(Functor, ArgTypes...) { }
+Result bind(Functor, ArgTypes...) { return Result(); }
 
 void f()
 {
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic97.C b/gcc/testsuite/g++.dg/cpp0x/variadic97.C
index b251cc3da38..12d05c56237 100644
--- a/gcc/testsuite/g++.dg/cpp0x/variadic97.C
+++ b/gcc/testsuite/g++.dg/cpp0x/variadic97.C
@@ -21,7 +21,7 @@ template<typename _Functor, typename... _Bound_args>
 
 template<typename _Functor, typename _Arg>
   _Bind<_Functor(_Arg)>
-  bind(_Functor, _Arg) { }
+  bind(_Functor, _Arg) { return _Bind<_Functor(_Arg)>(); }
 
 struct State
 {
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic98.C b/gcc/testsuite/g++.dg/cpp0x/variadic98.C
index c463cac17e7..6f1d9b40676 100644
--- a/gcc/testsuite/g++.dg/cpp0x/variadic98.C
+++ b/gcc/testsuite/g++.dg/cpp0x/variadic98.C
@@ -1,5 +1,6 @@
 // PR c++/42358
 // { dg-do assemble { target c++11 } }
+// { dg-additional-options "-Wno-return-type" }
 
 typedef __PTRDIFF_TYPE__ ptrdiff_t;
 typedef __SIZE_TYPE__ size_t;
@@ -177,6 +178,7 @@ namespace std __attribute__ ((__visibility__ ("default"))) {
     };
     template<typename _Tp>     struct less : public binary_function<_Tp, _Tp, bool>     {
 	bool       operator()(const _Tp& __x, const _Tp& __y) const       {
+	    return true;
 	}
     };
     template<typename _Pair>     struct _Select1st : public unary_function<_Pair,            typename _Pair::first_type>     {
diff --git a/gcc/testsuite/g++.dg/cpp1y/auto-fn11.C b/gcc/testsuite/g++.dg/cpp1y/auto-fn11.C
index b6a4b324b7c..9d79fb61e96 100644
--- a/gcc/testsuite/g++.dg/cpp1y/auto-fn11.C
+++ b/gcc/testsuite/g++.dg/cpp1y/auto-fn11.C
@@ -1,4 +1,5 @@
 // { dg-do compile { target c++14 } }
+// { dg-additional-options "-Wno-return-type" }
 
 auto f() { return; } 		// OK, return type is void
 auto* g() { return; }		// { dg-error "no value" }
diff --git a/gcc/testsuite/g++.dg/cpp1y/auto-fn29.C b/gcc/testsuite/g++.dg/cpp1y/auto-fn29.C
index f9260e0ec30..12f13a08906 100644
--- a/gcc/testsuite/g++.dg/cpp1y/auto-fn29.C
+++ b/gcc/testsuite/g++.dg/cpp1y/auto-fn29.C
@@ -24,6 +24,7 @@ namespace Baboon {
    template <typename T>
    bool f4(T const& v){
        f2(v);
+       return true;
    }
 }
 
diff --git a/gcc/testsuite/g++.dg/cpp1y/auto-fn38.C b/gcc/testsuite/g++.dg/cpp1y/auto-fn38.C
index ec3cffb2505..4e541625eec 100644
--- a/gcc/testsuite/g++.dg/cpp1y/auto-fn38.C
+++ b/gcc/testsuite/g++.dg/cpp1y/auto-fn38.C
@@ -1,5 +1,6 @@
 // PR c++/80145
 // { dg-do compile { target c++14 } }
+// { dg-additional-options "-Wno-return-type" }
 
 auto* foo() { }  // { dg-error "no return statements" }
 auto* foo();
diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-return2.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-return2.C
index ae2628d800c..d330ccfed3e 100644
--- a/gcc/testsuite/g++.dg/cpp1y/constexpr-return2.C
+++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-return2.C
@@ -1,4 +1,5 @@
 // { dg-do compile { target c++14 } }
+// { dg-additional-options "-Wno-return-type" }
 
 constexpr int f (int i)
 {
diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-init7.C b/gcc/testsuite/g++.dg/cpp1y/lambda-init7.C
index c943c48dfb0..d0b2dd3f256 100644
--- a/gcc/testsuite/g++.dg/cpp1y/lambda-init7.C
+++ b/gcc/testsuite/g++.dg/cpp1y/lambda-init7.C
@@ -1,6 +1,6 @@
 // PR c++/59349
 // { dg-do compile { target c++14 } }
 
-int foo () {
+void foo () {
   [bar()]{};			// { dg-error "empty initializer" }
 }
diff --git a/gcc/testsuite/g++.dg/cpp1y/pr63996.C b/gcc/testsuite/g++.dg/cpp1y/pr63996.C
index 8f66cdc3893..da1e0764a10 100644
--- a/gcc/testsuite/g++.dg/cpp1y/pr63996.C
+++ b/gcc/testsuite/g++.dg/cpp1y/pr63996.C
@@ -1,4 +1,5 @@
 // { dg-do compile { target c++14 } }
+// { dg-additional-options "-Wno-return-type" }
 
 constexpr int
 foo (int i)
diff --git a/gcc/testsuite/g++.dg/cpp1y/pr65202.C b/gcc/testsuite/g++.dg/cpp1y/pr65202.C
index 7ce4895a134..43eb01f1fcb 100644
--- a/gcc/testsuite/g++.dg/cpp1y/pr65202.C
+++ b/gcc/testsuite/g++.dg/cpp1y/pr65202.C
@@ -1,5 +1,6 @@
 // // PR c++/65202
 // { dg-do compile { target c++14 } }
+// { dg-additional-options "-Wno-return-type" }
 
 template <typename T> struct is_move_constructible;
 template <typename T> struct is_move_assignable;
diff --git a/gcc/testsuite/g++.dg/cpp1y/pr66443-cxx14.C b/gcc/testsuite/g++.dg/cpp1y/pr66443-cxx14.C
index 58348082952..ae76f7faa31 100644
--- a/gcc/testsuite/g++.dg/cpp1y/pr66443-cxx14.C
+++ b/gcc/testsuite/g++.dg/cpp1y/pr66443-cxx14.C
@@ -37,6 +37,7 @@ C::C ()
 
 bool Ok (C &c)
 {
+  return true;
 }
 
 int main ()
diff --git a/gcc/testsuite/g++.dg/cpp1y/pr79253.C b/gcc/testsuite/g++.dg/cpp1y/pr79253.C
index b15efe8873f..181702acc5b 100644
--- a/gcc/testsuite/g++.dg/cpp1y/pr79253.C
+++ b/gcc/testsuite/g++.dg/cpp1y/pr79253.C
@@ -28,6 +28,6 @@ struct D
   baz () { bar<F, B<>>; }
   template <bool, bool, bool> struct F
   {
-    static B<> baz () { foo<E<0, 0, 0>> (0, 0); }
+    static B<> baz () { foo<E<0, 0, 0>> (0, 0); return B<>(); }
   };
 };
diff --git a/gcc/testsuite/g++.dg/cpp1y/static_assert1.C b/gcc/testsuite/g++.dg/cpp1y/static_assert1.C
index 513e347d7e5..ef655f49097 100644
--- a/gcc/testsuite/g++.dg/cpp1y/static_assert1.C
+++ b/gcc/testsuite/g++.dg/cpp1y/static_assert1.C
@@ -19,6 +19,7 @@ template<typename T>
   {
     static_assert(is_float<T>::value, ""); // { dg-error "static assertion failed" }
     static_assert(is_float<T>::value); // { dg-error "static assertion failed" }
+    return T();
   }
 
 int
diff --git a/gcc/testsuite/g++.dg/cpp1y/static_assert2.C b/gcc/testsuite/g++.dg/cpp1y/static_assert2.C
index d862282cda8..d602b1e04ce 100644
--- a/gcc/testsuite/g++.dg/cpp1y/static_assert2.C
+++ b/gcc/testsuite/g++.dg/cpp1y/static_assert2.C
@@ -19,6 +19,7 @@ template<typename T>
   {
     static_assert(is_float<T>::value, ""); // { dg-error "static assertion failed" }
     static_assert(is_float<T>::value); // { dg-error "static assertion failed" }
+    return T();
   }
 
 int
diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ44.C b/gcc/testsuite/g++.dg/cpp1y/var-templ44.C
index 2fc21a50631..2ef01cf7480 100644
--- a/gcc/testsuite/g++.dg/cpp1y/var-templ44.C
+++ b/gcc/testsuite/g++.dg/cpp1y/var-templ44.C
@@ -1,5 +1,6 @@
 // PR c++/67161
 // { dg-do compile { target c++14 } }
+// { dg-additional-options "-Wno-return-type" }
 
 template <typename _Tp> struct integral_constant {
   static constexpr _Tp value = 0;
diff --git a/gcc/testsuite/g++.dg/cpp1z/fold6.C b/gcc/testsuite/g++.dg/cpp1z/fold6.C
index 48394366692..29a20480e77 100644
--- a/gcc/testsuite/g++.dg/cpp1z/fold6.C
+++ b/gcc/testsuite/g++.dg/cpp1z/fold6.C
@@ -6,7 +6,7 @@
 int i;
 
 template <int... Is>
-int f()
+void f()
 {
   (i ? i : Is + ...);		// { dg-error "" }
   (i + Is + ...);		// { dg-error "" }
diff --git a/gcc/testsuite/g++.dg/cpp1z/inline-var2.C b/gcc/testsuite/g++.dg/cpp1z/inline-var2.C
index 1696cb0f240..852531ad258 100644
--- a/gcc/testsuite/g++.dg/cpp1z/inline-var2.C
+++ b/gcc/testsuite/g++.dg/cpp1z/inline-var2.C
@@ -69,6 +69,7 @@ foo (inline int var31)				// { dg-error "'var31' declared as an 'inline' paramet
 {
   inline int var32;				// { dg-error "'inline' specifier invalid for variable 'var32' declared at block scope" }
   static inline int var33;			// { dg-error "'inline' specifier invalid for variable 'var33' declared at block scope" }
+  return 0;
 }
 template <typename A, typename B, typename C>
 struct Y
diff --git a/gcc/testsuite/g++.dg/cpp1z/lambda-this1.C b/gcc/testsuite/g++.dg/cpp1z/lambda-this1.C
index a15438019b9..2c49dd9bf73 100644
--- a/gcc/testsuite/g++.dg/cpp1z/lambda-this1.C
+++ b/gcc/testsuite/g++.dg/cpp1z/lambda-this1.C
@@ -50,7 +50,7 @@ struct B {
   double foo () {
     return [this]{ return [*this] { return b; }; }()();	// { dg-error "'*this' capture only available with" "" { target c++14_down } }
   }
-  double bar () {
+  void bar () {
     auto c = []{ return [*this] { return b; }; };	// { dg-error "'this' was not captured for this lambda function" }
   }							// { dg-error "invalid use of non-static data member 'B::b'" "" { target *-*-* } .-1 }
 };							// { dg-error "'*this' capture only available with" "" { target c++14_down } .-2 }
diff --git a/gcc/testsuite/g++.dg/cpp1z/static_assert-nomsg.C b/gcc/testsuite/g++.dg/cpp1z/static_assert-nomsg.C
index 4b265b6716e..6f787cde958 100644
--- a/gcc/testsuite/g++.dg/cpp1z/static_assert-nomsg.C
+++ b/gcc/testsuite/g++.dg/cpp1z/static_assert-nomsg.C
@@ -13,7 +13,7 @@ template<>
   };
 
 template<typename T>
-  T
+  void
   float_thing(T __x)
   {
     static_assert(is_float<T>::value, ""); // { dg-error "static assertion failed" }
diff --git a/gcc/testsuite/g++.dg/debug/dwarf-eh-personality-1.C b/gcc/testsuite/g++.dg/debug/dwarf-eh-personality-1.C
index 5c72588e513..8f62edc1cf0 100644
--- a/gcc/testsuite/g++.dg/debug/dwarf-eh-personality-1.C
+++ b/gcc/testsuite/g++.dg/debug/dwarf-eh-personality-1.C
@@ -11,7 +11,7 @@ int foo (void)
   return 0;
 }
 
-int foobar (void)
+void foobar (void)
 {
 }
 
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/dwarf4-typedef.C b/gcc/testsuite/g++.dg/debug/dwarf2/dwarf4-typedef.C
index cd1a0afe868..a514472b397 100644
--- a/gcc/testsuite/g++.dg/debug/dwarf2/dwarf4-typedef.C
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/dwarf4-typedef.C
@@ -11,7 +11,7 @@ struct A {
 
 struct B : public A {
   template <typename A>
-  bool foo(A x[2]) { }
+  bool foo(A x[2]) { return true; }
 };
 
 template <typename T>
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/icf.C b/gcc/testsuite/g++.dg/debug/dwarf2/icf.C
index ca73ab72479..74a11bf25c5 100644
--- a/gcc/testsuite/g++.dg/debug/dwarf2/icf.C
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/icf.C
@@ -21,13 +21,13 @@ class B
   int j;
 };
 
-int
+void
 test1(A* a)
 {
   a->work();
 }
 
-int
+void
 test2(A* a)
 {
   if (a->p())
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/pr61433.C b/gcc/testsuite/g++.dg/debug/dwarf2/pr61433.C
index a217d960205..ef2479f0cd9 100644
--- a/gcc/testsuite/g++.dg/debug/dwarf2/pr61433.C
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/pr61433.C
@@ -2,6 +2,7 @@
 // { dg-do compile { target c++11 } }
 // { dg-xfail-if "" { powerpc-ibm-aix* } }
 // { dg-options "-O -fcompare-debug -fno-inline -fno-ipa-pure-const -fipa-sra" }
+// { dg-additional-options "-Wno-return-type" }
 
 template <class T>
 struct A
@@ -21,4 +22,5 @@ auto k(T t, U u, V v) -> decltype (t.U::template B<V>::MEM)
 int main()
 {
   k( C(), A<int>(), D() );
+  return 0;
 }
diff --git a/gcc/testsuite/g++.dg/debug/nullptr01.C b/gcc/testsuite/g++.dg/debug/nullptr01.C
index 63c16ac8f0e..a6514f1ff70 100644
--- a/gcc/testsuite/g++.dg/debug/nullptr01.C
+++ b/gcc/testsuite/g++.dg/debug/nullptr01.C
@@ -10,6 +10,7 @@ template <class T> nullptr_t g(T t);
 template <> nullptr_t g(A<nullptr_t>)
 {
   nullptr_t local;
+  return nullptr;
 }
 // { dg-final { scan-assembler "_Z1fDn" } }
 // { dg-final { scan-assembler "_Z1gI1AIDnEEDnT_" } }
diff --git a/gcc/testsuite/g++.dg/debug/pr16792.C b/gcc/testsuite/g++.dg/debug/pr16792.C
index 39003cbe299..0efcbfa74eb 100644
--- a/gcc/testsuite/g++.dg/debug/pr16792.C
+++ b/gcc/testsuite/g++.dg/debug/pr16792.C
@@ -1,7 +1,7 @@
 // { dg-do compile }
 
 struct S { S(); };
-int foo (S b, double j) { };
+int foo (S b, double j) { return 0; };
 
 int main ()
 {
diff --git a/gcc/testsuite/g++.dg/debug/pr46241.C b/gcc/testsuite/g++.dg/debug/pr46241.C
index 95c814d4f0a..6ac9116a3d7 100644
--- a/gcc/testsuite/g++.dg/debug/pr46241.C
+++ b/gcc/testsuite/g++.dg/debug/pr46241.C
@@ -1,6 +1,6 @@
 class btIDebugDraw;
 class btCollisionWorld {
-    virtual btIDebugDraw* getDebugDrawer()  { };
+    virtual btIDebugDraw* getDebugDrawer()  { return 0; };
     static void rayTestSingle();
 };
 class btTriangleCallback {
diff --git a/gcc/testsuite/g++.dg/debug/pr46338.C b/gcc/testsuite/g++.dg/debug/pr46338.C
index caf71170f2c..7e242b9bc3d 100644
--- a/gcc/testsuite/g++.dg/debug/pr46338.C
+++ b/gcc/testsuite/g++.dg/debug/pr46338.C
@@ -9,6 +9,7 @@ struct S
 {
   int f ()
   {
+    return 0;
   }
 };
 
diff --git a/gcc/testsuite/g++.dg/debug/pr47106.C b/gcc/testsuite/g++.dg/debug/pr47106.C
index d8d414dd4a5..84c6e3f87be 100644
--- a/gcc/testsuite/g++.dg/debug/pr47106.C
+++ b/gcc/testsuite/g++.dg/debug/pr47106.C
@@ -22,12 +22,14 @@ inline bool
 baz (S s1, S)
 {
   while (f (&s1));
+
+  return true;
 }
 
 inline bool
 bar (S s1, S s2, S)
 {
-  baz (s1, s2);
+  return baz (s1, s2);
 }
 
 S getS ();
@@ -35,5 +37,5 @@ S getS ();
 bool
 foo ()
 {
-  bar (getS (), getS (), getS ());
+  return bar (getS (), getS (), getS ());
 }
diff --git a/gcc/testsuite/g++.dg/debug/pr71057.C b/gcc/testsuite/g++.dg/debug/pr71057.C
index 2ed1eed988e..0bd546a74e8 100644
--- a/gcc/testsuite/g++.dg/debug/pr71057.C
+++ b/gcc/testsuite/g++.dg/debug/pr71057.C
@@ -9,4 +9,4 @@ template <typename> struct C {
 };
 template <typename> struct D {};
 C<int> a;
-D<B<int>> fn1() { fn1, a; }
+D<B<int>> fn1() { fn1, a; return D<B<int>>(); }
diff --git a/gcc/testsuite/g++.dg/debug/pr71432.C b/gcc/testsuite/g++.dg/debug/pr71432.C
index 1682f126f12..e9bc88ca863 100644
--- a/gcc/testsuite/g++.dg/debug/pr71432.C
+++ b/gcc/testsuite/g++.dg/debug/pr71432.C
@@ -105,9 +105,11 @@ namespace std
     public:
       size_type size ()const noexcept
       {
+	return 0;
       }
       const _CharT *data () const noexcept
       {
+	return 0;
       }
     };
   }
@@ -127,9 +129,14 @@ class CLIParameterType
 {
   const std::string & getSwitchOption (unsigned int i) const
   {
-  } unsigned int getSwitchOptionCount () const
+    static std::string a;
+    return a;
+  }
+  unsigned int getSwitchOptionCount () const
   {
-  } int checkSwitched (const std::string & value) const;
+    return 0;
+  }
+  int checkSwitched (const std::string & value) const;
 };
 
 int
@@ -138,4 +145,6 @@ CLIParameterType::checkSwitched (const std::string & value) const
   int contains = false;
   for (unsigned int i = 0; !contains && i < getSwitchOptionCount () ;)
     contains = getSwitchOption (i) == value;
+
+  return 0;
 }
diff --git a/gcc/testsuite/g++.dg/debug/pr80461.C b/gcc/testsuite/g++.dg/debug/pr80461.C
index df7b4229ddf..b472e62c803 100644
--- a/gcc/testsuite/g++.dg/debug/pr80461.C
+++ b/gcc/testsuite/g++.dg/debug/pr80461.C
@@ -6,7 +6,7 @@ template <typename> class A;
 struct B
 {
   template <typename T, typename U>
-  static bool foo (U T::*) {}
+  static bool foo (U T::*) { return true; }
 };
 template <typename, typename> class J;
 template <typename T, typename U, typename V, typename... W>
diff --git a/gcc/testsuite/g++.dg/dfp/44473-1.C b/gcc/testsuite/g++.dg/dfp/44473-1.C
index 38689fa165d..940638f4e9b 100644
--- a/gcc/testsuite/g++.dg/dfp/44473-1.C
+++ b/gcc/testsuite/g++.dg/dfp/44473-1.C
@@ -1,4 +1,5 @@
 /* { dg-do assemble } */
+/* { dg-additional-options "-Wno-return-type" } */
 
 /* Minimized from the testcase in PR c++/44473; mangling of decimal types
    did not include CV qualifiers. */
@@ -119,4 +120,5 @@ bool
 bar ()
 {
   vec.push_back (std::decimal::decimal32 (0));
+  return true;
 }
diff --git a/gcc/testsuite/g++.dg/dfp/44473-2.C b/gcc/testsuite/g++.dg/dfp/44473-2.C
index 311f62299b3..60fc1ebca9c 100644
--- a/gcc/testsuite/g++.dg/dfp/44473-2.C
+++ b/gcc/testsuite/g++.dg/dfp/44473-2.C
@@ -14,12 +14,12 @@ namespace std {
   }
 }
 
-int bar (const std::decimal::decimal64 & x) { }
+int bar (const std::decimal::decimal64 & x) { return 0; }
 
 int foo ()
 {
   std::decimal::decimal64 x(0);
-  bar (x);
+  return bar (x);
 }
 
 // { dg-final { scan-assembler "_Z3barRKDd:" } }
diff --git a/gcc/testsuite/g++.dg/eh/builtin1.C b/gcc/testsuite/g++.dg/eh/builtin1.C
index 4aa70dacd3b..2d04d9c08e8 100644
--- a/gcc/testsuite/g++.dg/eh/builtin1.C
+++ b/gcc/testsuite/g++.dg/eh/builtin1.C
@@ -8,7 +8,7 @@ extern "C" int printf (const char *, ...);
 
 extern void callme (void) throw();
 
-int
+void
 foo (int i)
 {
   try {
@@ -18,7 +18,7 @@ foo (int i)
   }
 }
 
-int
+void
 bar (int i)
 {
   try {
diff --git a/gcc/testsuite/g++.dg/eh/builtin2.C b/gcc/testsuite/g++.dg/eh/builtin2.C
index a92477455e1..0c0bfe6a679 100644
--- a/gcc/testsuite/g++.dg/eh/builtin2.C
+++ b/gcc/testsuite/g++.dg/eh/builtin2.C
@@ -7,7 +7,7 @@ extern "C" int printf (const char *, ...) throw();
 
 extern void callme (void) throw();
 
-int
+void
 foo (int i)
 {
   try {
@@ -17,7 +17,7 @@ foo (int i)
   }
 }
 
-int
+void
 bar (int i)
 {
   try {
diff --git a/gcc/testsuite/g++.dg/eh/builtin3.C b/gcc/testsuite/g++.dg/eh/builtin3.C
index b4a06726305..5b8c62b4b63 100644
--- a/gcc/testsuite/g++.dg/eh/builtin3.C
+++ b/gcc/testsuite/g++.dg/eh/builtin3.C
@@ -5,7 +5,7 @@
 
 extern void callme (void) throw();
 
-int
+void
 bar (int i)
 {
   try {
diff --git a/gcc/testsuite/g++.dg/eh/pr45569.C b/gcc/testsuite/g++.dg/eh/pr45569.C
index 2c100d2b9bf..4f67770b4a7 100644
--- a/gcc/testsuite/g++.dg/eh/pr45569.C
+++ b/gcc/testsuite/g++.dg/eh/pr45569.C
@@ -7,7 +7,7 @@ _Complex float g ();
 void
 i (_Complex float);
 
-float j ()
+void j ()
 {
   _Complex float x = 0;
   try
diff --git a/gcc/testsuite/g++.dg/eh/unwind2.C b/gcc/testsuite/g++.dg/eh/unwind2.C
index d6181c8c04b..8d98d3fd3d3 100644
--- a/gcc/testsuite/g++.dg/eh/unwind2.C
+++ b/gcc/testsuite/g++.dg/eh/unwind2.C
@@ -46,7 +46,7 @@ namespace
     typedef _CharT char_type;
     char_type * _M_in_beg;
     char_type *eback () { return _M_in_beg; }
-    char_type *gptr () {}
+    char_type *gptr () { return 0; }
   };
 }
 namespace std
diff --git a/gcc/testsuite/g++.dg/expr/bitfield11.C b/gcc/testsuite/g++.dg/expr/bitfield11.C
index bab303ef36c..ddf48cb373a 100644
--- a/gcc/testsuite/g++.dg/expr/bitfield11.C
+++ b/gcc/testsuite/g++.dg/expr/bitfield11.C
@@ -6,7 +6,7 @@ struct A
   unsigned int a : 1;
 };
 
-bool
+void
 foo (A *x, A *y)
 {
   x->a = y ? y->a : true;
diff --git a/gcc/testsuite/g++.dg/expr/static_cast7.C b/gcc/testsuite/g++.dg/expr/static_cast7.C
index bced805bcdb..2398bedf1b4 100644
--- a/gcc/testsuite/g++.dg/expr/static_cast7.C
+++ b/gcc/testsuite/g++.dg/expr/static_cast7.C
@@ -1,7 +1,7 @@
 // Regression test for bug 39415 (and its duplicate 44916).
 struct S {};
 struct T : S {};
-int f(const T*) {}
+int f(const T*) { return 0; }
 void f(T*);
 int main() {
   S* s(0);
diff --git a/gcc/testsuite/g++.dg/ext/altivec-14.C b/gcc/testsuite/g++.dg/ext/altivec-14.C
index e5dd81c7553..02e8a23258d 100644
--- a/gcc/testsuite/g++.dg/ext/altivec-14.C
+++ b/gcc/testsuite/g++.dg/ext/altivec-14.C
@@ -5,7 +5,7 @@
 void f (__attribute__((altivec (vector__))) signed int * a,
 	__attribute__((altivec (vector__))) signed int * const b);
 
-int
+void
 foo (void)
 {
   __attribute__((altivec (vector__))) signed int a[1], b[1];
diff --git a/gcc/testsuite/g++.dg/ext/asm13.C b/gcc/testsuite/g++.dg/ext/asm13.C
index eece05e0fb3..3e1fd4bbe48 100644
--- a/gcc/testsuite/g++.dg/ext/asm13.C
+++ b/gcc/testsuite/g++.dg/ext/asm13.C
@@ -1,6 +1,6 @@
 // PR c++/69257
 
-int fn1() {
+void fn1() {
   struct S *x;
   __asm ( "": :"" (*x));	// { dg-error "incomplete" }
 }
diff --git a/gcc/testsuite/g++.dg/ext/builtin-object-size3.C b/gcc/testsuite/g++.dg/ext/builtin-object-size3.C
index b2a9170fc30..1e158cd6d01 100644
--- a/gcc/testsuite/g++.dg/ext/builtin-object-size3.C
+++ b/gcc/testsuite/g++.dg/ext/builtin-object-size3.C
@@ -5,7 +5,7 @@ void baz (int *, int *);
 
 #define MEMCPY(d,s,l) __builtin___memcpy_chk (d, s, l, __builtin_object_size (d, 0)) // { dg-warning "writing" }
 
-int
+void
 foo ()
 {
   int *p = new int;
@@ -15,7 +15,7 @@ foo ()
   baz (p, q);
 }
 
-int
+void
 bar ()
 {
   int *p = new int;
diff --git a/gcc/testsuite/g++.dg/ext/has_nothrow_assign_odr.C b/gcc/testsuite/g++.dg/ext/has_nothrow_assign_odr.C
index c2e99ef5444..594d3a98672 100644
--- a/gcc/testsuite/g++.dg/ext/has_nothrow_assign_odr.C
+++ b/gcc/testsuite/g++.dg/ext/has_nothrow_assign_odr.C
@@ -1,5 +1,7 @@
 // PR c++/36870
 // { dg-do run }
+
+
 #include <cassert>
 
 struct S { const S& operator= (const S&); };
@@ -9,8 +11,9 @@ bool f ();
 int main ()
 {
   assert (__has_nothrow_assign (S) == f ());
+  return 0;
 }
 
-const S& S::operator= (const S&) { }
+const S& S::operator= (const S&a) { return a; }
 
 bool f () { return __has_nothrow_assign (S); }
diff --git a/gcc/testsuite/g++.dg/ext/label7.C b/gcc/testsuite/g++.dg/ext/label7.C
index e92dccf5df5..d74a66aa224 100644
--- a/gcc/testsuite/g++.dg/ext/label7.C
+++ b/gcc/testsuite/g++.dg/ext/label7.C
@@ -1,7 +1,7 @@
 // PR c++/32121
 // { dg-do compile }
 
-int f (void)
+void f (void)
 {
   a:;
   __label__ a;	// { dg-error "not at the beginning" }
diff --git a/gcc/testsuite/g++.dg/ext/label8.C b/gcc/testsuite/g++.dg/ext/label8.C
index 1f6175df3a7..edffe35a6c6 100644
--- a/gcc/testsuite/g++.dg/ext/label8.C
+++ b/gcc/testsuite/g++.dg/ext/label8.C
@@ -1,7 +1,7 @@
 // PR c++/32121
 // { dg-do compile }
 
-int f (void)
+void f (void)
 {
   __label__ a, b;
   __label__ c;
diff --git a/gcc/testsuite/g++.dg/ext/tmplattr7.C b/gcc/testsuite/g++.dg/ext/tmplattr7.C
index ee6c4184768..545e089f1bb 100644
--- a/gcc/testsuite/g++.dg/ext/tmplattr7.C
+++ b/gcc/testsuite/g++.dg/ext/tmplattr7.C
@@ -8,4 +8,4 @@ bool test(const List<int> &);
 
 int i = bar(List<int>());
 
-bool test(const List<int> &) {}
+bool test(const List<int> &) { return true; }
diff --git a/gcc/testsuite/g++.dg/ext/vector8.C b/gcc/testsuite/g++.dg/ext/vector8.C
index 5f9f9561d7f..49bdc5a5611 100644
--- a/gcc/testsuite/g++.dg/ext/vector8.C
+++ b/gcc/testsuite/g++.dg/ext/vector8.C
@@ -9,7 +9,7 @@ vector int a1;
 vector float b;
 vector int b1;
 
-int f(void)
+void f(void)
 {
  a =  a | b; /* { dg-error "" } */
  a =  a & b; /* { dg-error "" } */
diff --git a/gcc/testsuite/g++.dg/ext/visibility/anon1.C b/gcc/testsuite/g++.dg/ext/visibility/anon1.C
index 0135f931a6f..60a34db6ede 100644
--- a/gcc/testsuite/g++.dg/ext/visibility/anon1.C
+++ b/gcc/testsuite/g++.dg/ext/visibility/anon1.C
@@ -7,5 +7,5 @@
 
 namespace
 {
-  int f() { }
+  int f() { return 0; }
 }
diff --git a/gcc/testsuite/g++.dg/ext/visibility/anon2.C b/gcc/testsuite/g++.dg/ext/visibility/anon2.C
index dcf0e64fa23..7abdd050518 100644
--- a/gcc/testsuite/g++.dg/ext/visibility/anon2.C
+++ b/gcc/testsuite/g++.dg/ext/visibility/anon2.C
@@ -9,4 +9,4 @@ namespace
   struct A { };
 }
 
-A f () { }
+A f () { return A(); }
diff --git a/gcc/testsuite/g++.dg/ext/visibility/namespace1.C b/gcc/testsuite/g++.dg/ext/visibility/namespace1.C
index b7773dc9d61..1da1c14d254 100644
--- a/gcc/testsuite/g++.dg/ext/visibility/namespace1.C
+++ b/gcc/testsuite/g++.dg/ext/visibility/namespace1.C
@@ -10,7 +10,7 @@
 
 namespace foo __attribute ((visibility ("hidden")))
 {
-  int f() { }
+  int f() { return 0; }
   void g();
   template <typename T> void t() { }
   class A
diff --git a/gcc/testsuite/g++.dg/ext/vla16.C b/gcc/testsuite/g++.dg/ext/vla16.C
index c3e6ea1caba..fa51feed8f3 100644
--- a/gcc/testsuite/g++.dg/ext/vla16.C
+++ b/gcc/testsuite/g++.dg/ext/vla16.C
@@ -5,4 +5,6 @@ long fn1() {
   const int a = fn1();
   int b[a];
   int c = *(&b[0] + sizeof(0));
+
+  return 0;
 }
diff --git a/gcc/testsuite/g++.dg/goacc/reference.C b/gcc/testsuite/g++.dg/goacc/reference.C
index b000668b1aa..07e6bd42239 100644
--- a/gcc/testsuite/g++.dg/goacc/reference.C
+++ b/gcc/testsuite/g++.dg/goacc/reference.C
@@ -1,4 +1,4 @@
-int
+void
 test1 (int &ref)
 {
 #pragma acc kernels copy (ref)
@@ -7,7 +7,7 @@ test1 (int &ref)
   }
 }
 
-int
+void
 test2 (int &ref)
 {
   int b;
diff --git a/gcc/testsuite/g++.dg/gomp/pr37189.C b/gcc/testsuite/g++.dg/gomp/pr37189.C
index 31d95f2d2df..a83957ea2a3 100644
--- a/gcc/testsuite/g++.dg/gomp/pr37189.C
+++ b/gcc/testsuite/g++.dg/gomp/pr37189.C
@@ -18,7 +18,7 @@ bar (T &)
 {
 }
 
-int
+void
 foo ()
 {
   T t;
diff --git a/gcc/testsuite/g++.dg/gomp/pr39495-1.C b/gcc/testsuite/g++.dg/gomp/pr39495-1.C
index 8563e684fff..dfa7db66d2c 100644
--- a/gcc/testsuite/g++.dg/gomp/pr39495-1.C
+++ b/gcc/testsuite/g++.dg/gomp/pr39495-1.C
@@ -6,7 +6,7 @@
 #define INT_MAX __INT_MAX__
 #define UINT_MAX (2U * __INT_MAX__ + 1)
 
-int
+void
 foo (void)
 {
   int i;
@@ -50,7 +50,7 @@ foo (void)
     ;
 }
 
-int
+void
 bar (void)
 {
   int i;
diff --git a/gcc/testsuite/g++.dg/gomp/pr39495-2.C b/gcc/testsuite/g++.dg/gomp/pr39495-2.C
index c0b4d5dbdee..f8b0f23183c 100644
--- a/gcc/testsuite/g++.dg/gomp/pr39495-2.C
+++ b/gcc/testsuite/g++.dg/gomp/pr39495-2.C
@@ -6,7 +6,7 @@
 #define INT_MAX __INT_MAX__
 #define UINT_MAX (2U * __INT_MAX__ + 1)
 
-int
+void
 foo (void)
 {
   int i;
diff --git a/gcc/testsuite/g++.dg/gomp/pr82054.C b/gcc/testsuite/g++.dg/gomp/pr82054.C
index 3c6aa27c7f4..706dd836968 100644
--- a/gcc/testsuite/g++.dg/gomp/pr82054.C
+++ b/gcc/testsuite/g++.dg/gomp/pr82054.C
@@ -10,4 +10,6 @@ a::b ()
 {
 #pragma omp parallel
   ;
+
+  return true;
 }
diff --git a/gcc/testsuite/g++.dg/inherit/covariant10.C b/gcc/testsuite/g++.dg/inherit/covariant10.C
index fe5d03c27d3..6c31aaff03d 100644
--- a/gcc/testsuite/g++.dg/inherit/covariant10.C
+++ b/gcc/testsuite/g++.dg/inherit/covariant10.C
@@ -11,12 +11,12 @@ struct c1 {
 struct c5 {};
 
 struct c6 : virtual c1 {
-  virtual c5* f33() const {}
+  virtual c5* f33() const { return 0; }
 };
 
 struct c13 : virtual c5 { };
 
 struct c17 : virtual c6
 {
-  virtual c13* f33() const {}
+  virtual c13* f33() const { return 0; }
 };
diff --git a/gcc/testsuite/g++.dg/inherit/covariant11.C b/gcc/testsuite/g++.dg/inherit/covariant11.C
index acba965f3af..97b8d13cfa5 100644
--- a/gcc/testsuite/g++.dg/inherit/covariant11.C
+++ b/gcc/testsuite/g++.dg/inherit/covariant11.C
@@ -7,19 +7,19 @@
 struct c2 { int i; };
 
 struct c1 {
-  virtual c2& f8() {}
+  virtual c2& f8() { static c2 a; return a; }
 };
 
 struct c3 : c1, c2 {
-  virtual c2& f8() {}
+  virtual c2& f8() { static c2 a; return a; }
 };
 
 struct c11 : public c1 {
-  virtual c3& f8() {}
+  virtual c3& f8() { static c3 a; return a; }
 };
 
 struct c15 : virtual c3 {
-  virtual c2& f8() {}
+  virtual c2& f8() { static c3 a; return a; }
 };
 
 struct c18 : virtual c11 {
diff --git a/gcc/testsuite/g++.dg/inherit/protected1.C b/gcc/testsuite/g++.dg/inherit/protected1.C
index c71be53331f..130b14ad863 100644
--- a/gcc/testsuite/g++.dg/inherit/protected1.C
+++ b/gcc/testsuite/g++.dg/inherit/protected1.C
@@ -9,6 +9,7 @@ template <class X> struct B<A<X> >
   {
     A<X> a;
     a.m_class->m_object;
+    return 0;
   }
 };
 template <class T> class A
@@ -23,6 +24,7 @@ bool
 A<T>::operator== (const X &) const
 {
   B<X>::check;
+  return true;
 }
 class C
 {
diff --git a/gcc/testsuite/g++.dg/init/inline1.C b/gcc/testsuite/g++.dg/init/inline1.C
index f3e323427d3..18d735fd87b 100644
--- a/gcc/testsuite/g++.dg/init/inline1.C
+++ b/gcc/testsuite/g++.dg/init/inline1.C
@@ -3,7 +3,7 @@
 
 struct A {
   ~A();
-  A f(A) { }
+  A f(A) { return A(); }
 };
 
 
diff --git a/gcc/testsuite/g++.dg/init/new18.C b/gcc/testsuite/g++.dg/init/new18.C
index 45f6e7a095d..5f07aaa40d0 100644
--- a/gcc/testsuite/g++.dg/init/new18.C
+++ b/gcc/testsuite/g++.dg/init/new18.C
@@ -1,5 +1,6 @@
 // { dg-do compile }
 // { dg-options "-O2 -fstrict-aliasing" }
+// { dg-additional-options "-Wno-return-type" }
 
 // This caused an ICE during placement new.
 
diff --git a/gcc/testsuite/g++.dg/init/reference2.C b/gcc/testsuite/g++.dg/init/reference2.C
index 42f53742685..903c06496d5 100644
--- a/gcc/testsuite/g++.dg/init/reference2.C
+++ b/gcc/testsuite/g++.dg/init/reference2.C
@@ -5,7 +5,7 @@
 
 // We should we able to diagnostic this without instantiating the template
 template <int a1>
-int f()
+void f()
 {
   typedef int& T;
   T a = T();  // { dg-error "value-initialization of reference" }
diff --git a/gcc/testsuite/g++.dg/init/reference3.C b/gcc/testsuite/g++.dg/init/reference3.C
index 8cc5afd6f4c..52ae935ca79 100644
--- a/gcc/testsuite/g++.dg/init/reference3.C
+++ b/gcc/testsuite/g++.dg/init/reference3.C
@@ -1,4 +1,5 @@
 // { dg-do compile }
+// { dg-additional-options "-Wno-return-type" }
 // This code used to be accepted but it is invalid as there is no
 // value initialization of a reference type.
 // PR c++/36695
diff --git a/gcc/testsuite/g++.dg/init/switch1.C b/gcc/testsuite/g++.dg/init/switch1.C
index b0b06b748f8..a964a29df58 100644
--- a/gcc/testsuite/g++.dg/init/switch1.C
+++ b/gcc/testsuite/g++.dg/init/switch1.C
@@ -1,4 +1,4 @@
-int f(int c)
+void f(int c)
 {
   switch (c)
   {
diff --git a/gcc/testsuite/g++.dg/ipa/devirt-10.C b/gcc/testsuite/g++.dg/ipa/devirt-10.C
index faab5121695..84120e791f9 100644
--- a/gcc/testsuite/g++.dg/ipa/devirt-10.C
+++ b/gcc/testsuite/g++.dg/ipa/devirt-10.C
@@ -4,7 +4,7 @@ class wxPaintEvent {  };
 struct wxDCBase
 { 
   wxDCBase ();
-  virtual int GetLayoutDirection() const{}
+  virtual int GetLayoutDirection() const{ return 0; }
   virtual void SetLayoutDirection(int){}
 };
 struct wxWindowDC  : public wxDCBase {};
diff --git a/gcc/testsuite/g++.dg/ipa/devirt-13.C b/gcc/testsuite/g++.dg/ipa/devirt-13.C
index fecbbfc93eb..923c98e92eb 100644
--- a/gcc/testsuite/g++.dg/ipa/devirt-13.C
+++ b/gcc/testsuite/g++.dg/ipa/devirt-13.C
@@ -11,7 +11,8 @@ public:
 };
 }
 class A a, *b=&a;
-main()
+
+int main()
 {
   return b->foo();
 }
diff --git a/gcc/testsuite/g++.dg/ipa/devirt-14.C b/gcc/testsuite/g++.dg/ipa/devirt-14.C
index 1437e7e472b..5efbe68bf03 100644
--- a/gcc/testsuite/g++.dg/ipa/devirt-14.C
+++ b/gcc/testsuite/g++.dg/ipa/devirt-14.C
@@ -20,7 +20,8 @@ public:
 };
 }
 class B a, *b=&a;
-main()
+
+int main()
 {
   if (0)
     {
diff --git a/gcc/testsuite/g++.dg/ipa/devirt-15.C b/gcc/testsuite/g++.dg/ipa/devirt-15.C
index bf9f2985a34..4a899d4178a 100644
--- a/gcc/testsuite/g++.dg/ipa/devirt-15.C
+++ b/gcc/testsuite/g++.dg/ipa/devirt-15.C
@@ -30,7 +30,7 @@ m(void)
 {
   b->foo();
 }
-main()
+int main()
 {
   m();
 }
diff --git a/gcc/testsuite/g++.dg/ipa/devirt-16.C b/gcc/testsuite/g++.dg/ipa/devirt-16.C
index 698e3e8ff35..762ecb29fde 100644
--- a/gcc/testsuite/g++.dg/ipa/devirt-16.C
+++ b/gcc/testsuite/g++.dg/ipa/devirt-16.C
@@ -19,7 +19,7 @@ public:
 };
 }
 class B *b;
-main()
+int main()
 {
   int c;
   if (c)
diff --git a/gcc/testsuite/g++.dg/ipa/devirt-17.C b/gcc/testsuite/g++.dg/ipa/devirt-17.C
index bbbd23c0bad..9edc205ce52 100644
--- a/gcc/testsuite/g++.dg/ipa/devirt-17.C
+++ b/gcc/testsuite/g++.dg/ipa/devirt-17.C
@@ -20,7 +20,7 @@ public:
 }
 class B *b;
 void get_me_lost (void *);
-main()
+int main()
 {
   int c;
   if (c)
diff --git a/gcc/testsuite/g++.dg/ipa/devirt-18.C b/gcc/testsuite/g++.dg/ipa/devirt-18.C
index 066b775e00c..769e0bbc888 100644
--- a/gcc/testsuite/g++.dg/ipa/devirt-18.C
+++ b/gcc/testsuite/g++.dg/ipa/devirt-18.C
@@ -19,7 +19,7 @@ public:
 };
 }
 class B *b;
-main()
+int main()
 {
   if (0)
     {
diff --git a/gcc/testsuite/g++.dg/ipa/devirt-19.C b/gcc/testsuite/g++.dg/ipa/devirt-19.C
index fd167b6f373..8277deaabdd 100644
--- a/gcc/testsuite/g++.dg/ipa/devirt-19.C
+++ b/gcc/testsuite/g++.dg/ipa/devirt-19.C
@@ -3,6 +3,8 @@
    a type change.  */
 /* { dg-do compile } */
 /* { dg-options "-O2 -fdump-ipa-cp"  } */
+/* { dg-additional-options "-Wno-return-type"  } */
+
 struct A {
   void operator==(const A &);
 };
diff --git a/gcc/testsuite/g++.dg/ipa/devirt-21.C b/gcc/testsuite/g++.dg/ipa/devirt-21.C
index 440570c8ddb..aa0488df92d 100644
--- a/gcc/testsuite/g++.dg/ipa/devirt-21.C
+++ b/gcc/testsuite/g++.dg/ipa/devirt-21.C
@@ -33,7 +33,7 @@ MultiTermDocs::~MultiTermDocs() {
 
 B *C::m_fn1(int *) { abort (); }
 
-main()
+int main()
 {
   class C c;
 }
diff --git a/gcc/testsuite/g++.dg/ipa/devirt-23.C b/gcc/testsuite/g++.dg/ipa/devirt-23.C
index 76fc3fde42b..15e65b579f7 100644
--- a/gcc/testsuite/g++.dg/ipa/devirt-23.C
+++ b/gcc/testsuite/g++.dg/ipa/devirt-23.C
@@ -41,7 +41,7 @@ MultiTermDocs::~MultiTermDocs() {
 
 B *C::m_fn1(int *) { abort (); }
 
-main()
+int main()
 {
   class C c;
 }
diff --git a/gcc/testsuite/g++.dg/ipa/devirt-38.C b/gcc/testsuite/g++.dg/ipa/devirt-38.C
index 40deb039e7a..fdb5c623533 100644
--- a/gcc/testsuite/g++.dg/ipa/devirt-38.C
+++ b/gcc/testsuite/g++.dg/ipa/devirt-38.C
@@ -12,7 +12,7 @@ class A : public SnmpSyntax
 {
 public:
   A (int);
-  SnmpSyntax *m_fn1 () const {}
+  SnmpSyntax *m_fn1 () const { return 0; } 
   SnmpSyntax &operator=(const SnmpSyntax &);
 };
 int a;
diff --git a/gcc/testsuite/g++.dg/ipa/devirt-40.C b/gcc/testsuite/g++.dg/ipa/devirt-40.C
index 5107c290c63..32e0d22c0e7 100644
--- a/gcc/testsuite/g++.dg/ipa/devirt-40.C
+++ b/gcc/testsuite/g++.dg/ipa/devirt-40.C
@@ -13,10 +13,14 @@ class A
   UnicodeString &m_fn1 (UnicodeString &, int &p2, UErrorCode &) const;
 };
 UnicodeString::UnicodeString () {}
+
+UnicodeString g;
+
 UnicodeString &
 A::m_fn1 (UnicodeString &, int &p2, UErrorCode &) const
 {
   UnicodeString a[2];
+  return g;
 }
 
 /* { dg-final { scan-tree-dump-not "\\n  OBJ_TYPE_REF" "fre3"  } } */
diff --git a/gcc/testsuite/g++.dg/ipa/devirt-41.C b/gcc/testsuite/g++.dg/ipa/devirt-41.C
index d8182baae6e..149da911b25 100644
--- a/gcc/testsuite/g++.dg/ipa/devirt-41.C
+++ b/gcc/testsuite/g++.dg/ipa/devirt-41.C
@@ -13,7 +13,7 @@ test (struct A *a)
     __builtin_abort ();
 }
 
-main()
+int main()
 {
   struct B a;
   dostuff (&a);
diff --git a/gcc/testsuite/g++.dg/ipa/devirt-42.C b/gcc/testsuite/g++.dg/ipa/devirt-42.C
index 6fecfe73bec..152b9689dc4 100644
--- a/gcc/testsuite/g++.dg/ipa/devirt-42.C
+++ b/gcc/testsuite/g++.dg/ipa/devirt-42.C
@@ -16,7 +16,7 @@ A::barbar()
   return static_cast<B*>(this)->barbar();
 }
 
-main()
+int main()
 {
   struct B b;
   struct A *a = &b;
diff --git a/gcc/testsuite/g++.dg/ipa/devirt-44.C b/gcc/testsuite/g++.dg/ipa/devirt-44.C
index f69e1aa08ac..5de761412d0 100644
--- a/gcc/testsuite/g++.dg/ipa/devirt-44.C
+++ b/gcc/testsuite/g++.dg/ipa/devirt-44.C
@@ -2,7 +2,7 @@
 /* { dg-options "-O3 -fno-ipa-cp -fdump-ipa-inline-details -fno-early-inlining" } */
 struct A {
   virtual int foo () {return 1;}
-  int wrapfoo () {foo();}
+  void wrapfoo () {foo();}
   A() {wrapfoo();}
 };
 struct B:A {virtual int foo () {return 2;}};
@@ -17,7 +17,7 @@ test (struct A *a)
     __builtin_abort ();
 }
 
-main()
+int main()
 {
   struct B a;
   dostuff (&a);
diff --git a/gcc/testsuite/g++.dg/ipa/devirt-45.C b/gcc/testsuite/g++.dg/ipa/devirt-45.C
index 57449b702d3..ce415e7c003 100644
--- a/gcc/testsuite/g++.dg/ipa/devirt-45.C
+++ b/gcc/testsuite/g++.dg/ipa/devirt-45.C
@@ -2,7 +2,7 @@
 /* { dg-options "-O3 -fno-ipa-cp -fdump-ipa-inline-details -fno-early-inlining" } */
 struct A {
   virtual int foo () {return 1;}
-  int wrapfoo () {foo();}
+  void wrapfoo () {foo();}
   A() {wrapfoo();}
 };
 inline void* operator new(__SIZE_TYPE__ s, void* buf) throw() {
@@ -29,7 +29,7 @@ test (struct A *a)
   test2(a);
 }
 
-main()
+int main()
 {
   struct B a;
   dostuff (&a);
diff --git a/gcc/testsuite/g++.dg/ipa/devirt-48.C b/gcc/testsuite/g++.dg/ipa/devirt-48.C
index eae93ece71c..1aed85f8642 100644
--- a/gcc/testsuite/g++.dg/ipa/devirt-48.C
+++ b/gcc/testsuite/g++.dg/ipa/devirt-48.C
@@ -5,14 +5,14 @@ struct A {
 };
 struct B:A {
    virtual int foo(){return 2;}
-   int callfoo(){foo();}
+   void callfoo(){foo();}
 };
 struct C:A {
    virtual int foo(){return 3;}
 };
 struct D:B {
    virtual int foo(){return 4;}
-   int callfoo(){foo();}
+   void callfoo(){foo();}
 };
 static void
 test (struct A *a)
diff --git a/gcc/testsuite/g++.dg/ipa/devirt-52.C b/gcc/testsuite/g++.dg/ipa/devirt-52.C
index be0ab4c3621..5c736c4037a 100644
--- a/gcc/testsuite/g++.dg/ipa/devirt-52.C
+++ b/gcc/testsuite/g++.dg/ipa/devirt-52.C
@@ -1,6 +1,7 @@
 // PR middle-end/77259
 // { dg-do compile { target c++11 } }
 // { dg-options "-O2" }
+// { dg-additional-options "-Wno-return-type" }
 
 template <typename, typename = int> class A;
 template <typename, typename> struct A
diff --git a/gcc/testsuite/g++.dg/ipa/nothrow-1.C b/gcc/testsuite/g++.dg/ipa/nothrow-1.C
index df2fbae2acc..b30b0215924 100644
--- a/gcc/testsuite/g++.dg/ipa/nothrow-1.C
+++ b/gcc/testsuite/g++.dg/ipa/nothrow-1.C
@@ -11,7 +11,7 @@ int a(void)
 {
   return *ptr == *ptr;
 }
-main()
+int main()
 {
   int aa;
   ptr = &barvar;
diff --git a/gcc/testsuite/g++.dg/ipa/pr43812.C b/gcc/testsuite/g++.dg/ipa/pr43812.C
index cc46eed6501..32d997b927d 100644
--- a/gcc/testsuite/g++.dg/ipa/pr43812.C
+++ b/gcc/testsuite/g++.dg/ipa/pr43812.C
@@ -35,4 +35,4 @@ public:
 class LocalSurface : public Surface {
     virtual BBox bbox () const;
 };
-BBox LocalSurface::bbox () const { }
+BBox LocalSurface::bbox () const { return BBox(); }
diff --git a/gcc/testsuite/g++.dg/ipa/pr44372.C b/gcc/testsuite/g++.dg/ipa/pr44372.C
index 22aa747e435..dbdd865cfb6 100644
--- a/gcc/testsuite/g++.dg/ipa/pr44372.C
+++ b/gcc/testsuite/g++.dg/ipa/pr44372.C
@@ -1,5 +1,6 @@
 /* { dg-do compile } */
 /* { dg-options "-O -fipa-cp -fipa-cp-clone" } */
+/* { dg-additional-options "-Wno-return-type" } */
 
 template < typename > class S3;
 
diff --git a/gcc/testsuite/g++.dg/ipa/pr45572-1.C b/gcc/testsuite/g++.dg/ipa/pr45572-1.C
index 82f347052d5..03a299ff422 100644
--- a/gcc/testsuite/g++.dg/ipa/pr45572-1.C
+++ b/gcc/testsuite/g++.dg/ipa/pr45572-1.C
@@ -11,18 +11,22 @@ typedef struct
 extern __inline __attribute__ ((__gnu_inline__)) int
 fgetc_unlocked (FILE *__fp)
 {
+  return 0;
 }
 extern __inline __attribute__ ((__gnu_inline__)) int
 putc_unlocked (int __c, FILE *__stream)
 {
+  return 0;
 }
 extern __inline __attribute__ ((__gnu_inline__)) __ssize_t
 getline (char **__lineptr, size_t *__n, FILE *__stream)
 {
+  return 0;
 }
 extern __inline __attribute__ ((__gnu_inline__)) int
 ferror_unlocked (FILE *__stream) throw ()
 {
+  return 0;
 }
 }
 typedef struct
diff --git a/gcc/testsuite/g++.dg/ipa/pr58371.C b/gcc/testsuite/g++.dg/ipa/pr58371.C
index 00cfbb831fc..cfcf677e3d0 100644
--- a/gcc/testsuite/g++.dg/ipa/pr58371.C
+++ b/gcc/testsuite/g++.dg/ipa/pr58371.C
@@ -1,5 +1,6 @@
 /* { dg-do compile } */
 /* { dg-options "-O2" } */
+/* { dg-additional-options "-Wno-return-type" } */
 
 
 typedef int size_t;
diff --git a/gcc/testsuite/g++.dg/ipa/pr59176.C b/gcc/testsuite/g++.dg/ipa/pr59176.C
index d576bc3ba5a..379719708ac 100644
--- a/gcc/testsuite/g++.dg/ipa/pr59176.C
+++ b/gcc/testsuite/g++.dg/ipa/pr59176.C
@@ -33,9 +33,11 @@ class C {
 unsigned long C::m_fn1() {
 CellHierarchy:
   m_fn2().m_fn1();
+  return 0;
 }
 
 unsigned long C::m_fn3() {
 CellHierarchy:
   m_fn2().m_fn1();
+  return 0;
 }
diff --git a/gcc/testsuite/g++.dg/ipa/pr60640-1.C b/gcc/testsuite/g++.dg/ipa/pr60640-1.C
index 7a0b91893f8..2e626126d07 100644
--- a/gcc/testsuite/g++.dg/ipa/pr60640-1.C
+++ b/gcc/testsuite/g++.dg/ipa/pr60640-1.C
@@ -25,7 +25,7 @@ class D : ASN1Object, public B
 };
 class G : public D
 {
-  unsigned m_fn1 (bool) const {}
+  unsigned m_fn1 (bool) const { return 0; }
 };
 class F : A
 {
diff --git a/gcc/testsuite/g++.dg/ipa/pr61540.C b/gcc/testsuite/g++.dg/ipa/pr61540.C
index e7dee7262c1..e297fe360dc 100644
--- a/gcc/testsuite/g++.dg/ipa/pr61540.C
+++ b/gcc/testsuite/g++.dg/ipa/pr61540.C
@@ -6,7 +6,7 @@ struct data {
 };
 
 struct top {
-  virtual int topf() {}
+  virtual int topf() { return 0; }
 };
 
 struct intermediate: top {
diff --git a/gcc/testsuite/g++.dg/ipa/pr63470.C b/gcc/testsuite/g++.dg/ipa/pr63470.C
index e6fa73bcd4c..ffef0a284de 100644
--- a/gcc/testsuite/g++.dg/ipa/pr63470.C
+++ b/gcc/testsuite/g++.dg/ipa/pr63470.C
@@ -17,6 +17,7 @@ class FTjackSupport : A
   const char **
   m_fn2 (int)
   {
+    return 0;
   }
   int _inited;
   int *_jackClient;
diff --git a/gcc/testsuite/g++.dg/ipa/pr63587-1.C b/gcc/testsuite/g++.dg/ipa/pr63587-1.C
index cbf872e2969..a727b9e9e4c 100644
--- a/gcc/testsuite/g++.dg/ipa/pr63587-1.C
+++ b/gcc/testsuite/g++.dg/ipa/pr63587-1.C
@@ -61,6 +61,7 @@ I<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_get_insert_unique_pos (
   const key_type &p1)
 {
   _M_impl._M_key_compare (p1, 0);
+  return A<int>();
 }
 template <typename _Key, typename _Val, typename _KeyOfValue,
 	  typename _Compare, typename _Alloc>
@@ -69,6 +70,7 @@ I<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_get_insert_hint_unique_pos (
   H &)
 {
   _M_get_insert_unique_pos (0);
+  return A<int>();
 }
 template <typename _Key, typename _Val, typename _KeyOfValue,
 	  typename _Compare, typename _Alloc>
@@ -78,6 +80,7 @@ I<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_emplace_hint_unique (
   H p1, _Args &&...)
 {
   _M_get_insert_hint_unique_pos (p1);
+  return 0;
 }
 namespace {
 struct L;
diff --git a/gcc/testsuite/g++.dg/ipa/pr63587-2.C b/gcc/testsuite/g++.dg/ipa/pr63587-2.C
index a15f17e7ca3..7a9b2454507 100644
--- a/gcc/testsuite/g++.dg/ipa/pr63587-2.C
+++ b/gcc/testsuite/g++.dg/ipa/pr63587-2.C
@@ -1,6 +1,7 @@
 // PR ipa/63587
 // { dg-do compile { target c++11 } }
 // { dg-options "-O2" }
+// { dg-additional-options "-Wno-return-type" }
 
 namespace boost {
 class basic_cstring
@@ -22,6 +23,7 @@ template <typename FunctionObj> struct function_obj_invoker0
   {
     FunctionObj f;
     f ();
+    return 0;
   }
 };
 template <typename FunctionObj> struct get_function_obj_invoker0
diff --git a/gcc/testsuite/g++.dg/ipa/pr63838.C b/gcc/testsuite/g++.dg/ipa/pr63838.C
index fb68c9f1ac8..d23b3133748 100644
--- a/gcc/testsuite/g++.dg/ipa/pr63838.C
+++ b/gcc/testsuite/g++.dg/ipa/pr63838.C
@@ -27,7 +27,7 @@ bar (int x)
     fn ();
 }
 
-__attribute__((noinline, noclone)) int
+__attribute__((noinline, noclone)) void
 baz (int x)
 {
   S s;
diff --git a/gcc/testsuite/g++.dg/ipa/pr63894.C b/gcc/testsuite/g++.dg/ipa/pr63894.C
index 54409752758..fad02c36acc 100644
--- a/gcc/testsuite/g++.dg/ipa/pr63894.C
+++ b/gcc/testsuite/g++.dg/ipa/pr63894.C
@@ -43,4 +43,5 @@ J::m_fn3 (G *p1)
   p1->m_fn1 (0, D (0, D::BOX, 0));
   K *d = new (0) K (0, m_fn2 (0));
   m_fn3 (d);
+  return true;
 }
diff --git a/gcc/testsuite/g++.dg/ipa/pr64068.C b/gcc/testsuite/g++.dg/ipa/pr64068.C
index 95288836c36..008fab1e1e6 100644
--- a/gcc/testsuite/g++.dg/ipa/pr64068.C
+++ b/gcc/testsuite/g++.dg/ipa/pr64068.C
@@ -3,12 +3,12 @@
 
 typedef int PROV_ENUMALGS_EX, PCCRYPT_OID_INFO;
 class A {
-  int m_fn2();
+  void m_fn2();
   virtual bool m_fn1(PCCRYPT_OID_INFO);
 };
 int fn1();
 void fn2();
-int A::m_fn2() { m_fn1(0); }
+void A::m_fn2() { m_fn1(0); }
 
 bool fn3() {
   for (;;) {
@@ -27,7 +27,7 @@ public:
   B() { fn3(); }
 };
 class C : A {
-  bool m_fn1(PCCRYPT_OID_INFO) { m_fn3(); }
+  bool m_fn1(PCCRYPT_OID_INFO) { m_fn3(); return true; }
   int isSupportedByProvider_algId;
   PROV_ENUMALGS_EX isSupportedByProvider_outEnumAlgs;
   PROV_ENUMALGS_EX isSupportedByProvider_enumAlgs;
diff --git a/gcc/testsuite/g++.dg/ipa/pr64896.C b/gcc/testsuite/g++.dg/ipa/pr64896.C
index 0a78220be8a..7064cd05f9d 100644
--- a/gcc/testsuite/g++.dg/ipa/pr64896.C
+++ b/gcc/testsuite/g++.dg/ipa/pr64896.C
@@ -5,9 +5,9 @@
 struct A { int a, b; };
 struct B { A c; int d; };
 struct C { virtual B fn1 () const; };
-struct D { B fn2 () const; int fn3 () const; C *fn4 () const; };
+struct D { B fn2 () const; void fn3 () const; C *fn4 () const; };
 
-int
+void
 D::fn3 () const
 {
   fn4 ()->fn1 ();
diff --git a/gcc/testsuite/g++.dg/ipa/pr65002.C b/gcc/testsuite/g++.dg/ipa/pr65002.C
index ac7c66bd19a..b505ac82c54 100644
--- a/gcc/testsuite/g++.dg/ipa/pr65002.C
+++ b/gcc/testsuite/g++.dg/ipa/pr65002.C
@@ -10,12 +10,12 @@ using fastmath::floor;
 class A {
 public:
   A(int, int);
-  virtual int m_fn1(float) const;
+  virtual void m_fn1(float) const;
 };
 class B : A {
 public:
   B(int, int p2) : A(entity, p2) {}
-  int m_fn1(float p1) const { long b(floor(p1)); }
+  void m_fn1(float p1) const { long b(floor(p1)); }
   int entity;
 };
 
diff --git a/gcc/testsuite/g++.dg/ipa/pr65008.C b/gcc/testsuite/g++.dg/ipa/pr65008.C
index 29b3a2f161f..84f10bb276c 100644
--- a/gcc/testsuite/g++.dg/ipa/pr65008.C
+++ b/gcc/testsuite/g++.dg/ipa/pr65008.C
@@ -8,7 +8,7 @@ struct A
   virtual void foo () {}
 };
 
-static inline int __attribute__ ((always_inline)) call_foo (A *a)
+static inline void __attribute__ ((always_inline)) call_foo (A *a)
 {
   a->foo ();
 }
diff --git a/gcc/testsuite/g++.dg/ipa/pr65465.C b/gcc/testsuite/g++.dg/ipa/pr65465.C
index 436d88f743f..9c7d026b14a 100644
--- a/gcc/testsuite/g++.dg/ipa/pr65465.C
+++ b/gcc/testsuite/g++.dg/ipa/pr65465.C
@@ -4,7 +4,7 @@
 struct A {};
 struct B { virtual A foo () const; };
 struct C { A foo () const; };
-struct D : virtual B { A foo () const {} };
+struct D : virtual B { A foo () const { return A(); } };
 struct F : D { virtual int bar () const; };
 int F::bar () const { return 0; }
 A C::foo () const { return A (); }
diff --git a/gcc/testsuite/g++.dg/ipa/pr66896.C b/gcc/testsuite/g++.dg/ipa/pr66896.C
index 236537a5ea0..841515c846f 100644
--- a/gcc/testsuite/g++.dg/ipa/pr66896.C
+++ b/gcc/testsuite/g++.dg/ipa/pr66896.C
@@ -9,7 +9,7 @@ struct A
   int *a;
   A ();
   ~A () { a3 (); }
-  int a1 (int * p) { if (!p) f3 (); f2 (p); }
+  void a1 (int * p) { if (!p) f3 (); f2 (p); }
   void a3 () { if (*a) a1 (a); }
 };
 
diff --git a/gcc/testsuite/g++.dg/ipa/pr68851.C b/gcc/testsuite/g++.dg/ipa/pr68851.C
index 659e4cdcc4a..73096969eb6 100644
--- a/gcc/testsuite/g++.dg/ipa/pr68851.C
+++ b/gcc/testsuite/g++.dg/ipa/pr68851.C
@@ -8,7 +8,7 @@ public:
 };
 class A {
 public:
-  virtual bool isFormControlElement() const {}
+  virtual bool isFormControlElement() const { return false; }
 };
 class C {
   struct D {
@@ -20,10 +20,10 @@ class F {
   virtual bool isFormControlElement() const;
 };
 class G : A, F {
-  bool isFormControlElement() const {}
+  bool isFormControlElement() const { return true; }
 };
 bool C::checkPseudoClass(const D &p1, int &) const {
   A &a = *p1.element;
   a.isFormControlElement();
-  a.isFormControlElement() || a.isFormControlElement();
+  return a.isFormControlElement() || a.isFormControlElement();
 }
diff --git a/gcc/testsuite/g++.dg/ipa/pr78211.C b/gcc/testsuite/g++.dg/ipa/pr78211.C
index 8207a6bf7fb..510fca573de 100644
--- a/gcc/testsuite/g++.dg/ipa/pr78211.C
+++ b/gcc/testsuite/g++.dg/ipa/pr78211.C
@@ -1,6 +1,7 @@
 // PR lto/78211
 // { dg-do compile { target { lto && c++11 } } }
 // { dg-options "-fcompare-debug -fno-printf-return-value -flto -fno-use-linker-plugin -O3" }
+// { dg-additional-options "-Wno-return-type" }
 
 namespace std {
   typedef __SIZE_TYPE__ size_t;
@@ -37,7 +38,7 @@ namespace __gnu_cxx {
     reference operator*() const noexcept { }
   };
   template<typename _IteratorL, typename _IteratorR, typename _Container>
-  inline bool operator!=(const __normal_iterator<_IteratorL, _Container>& __lhs, const __normal_iterator<_IteratorR, _Container>& __rhs) noexcept { }
+  inline bool operator!=(const __normal_iterator<_IteratorL, _Container>& __lhs, const __normal_iterator<_IteratorR, _Container>& __rhs) noexcept { return true; }
 }
 namespace std {
   template<typename _CharT> struct char_traits;
diff --git a/gcc/testsuite/g++.dg/ipa/pr79931.C b/gcc/testsuite/g++.dg/ipa/pr79931.C
index 78f6e03c458..c5f6816a70f 100644
--- a/gcc/testsuite/g++.dg/ipa/pr79931.C
+++ b/gcc/testsuite/g++.dg/ipa/pr79931.C
@@ -21,4 +21,5 @@ NodeImpl *AttrImpl::insertBefore(NodeImpl *newChild, NodeImpl *refChild) {
   NodeImpl *oldparent = newChild->getParentNode();
   oldparent->removeChild(newChild);
   this->getOwnerDocument()->getRanges();
+  return 0;
 }
diff --git a/gcc/testsuite/g++.dg/ipa/pure-const-1.C b/gcc/testsuite/g++.dg/ipa/pure-const-1.C
index a219c713077..61940c670e7 100644
--- a/gcc/testsuite/g++.dg/ipa/pure-const-1.C
+++ b/gcc/testsuite/g++.dg/ipa/pure-const-1.C
@@ -11,7 +11,7 @@ int a(void)
 {
   return *ptr == *ptr;
 }
-main()
+int main()
 {
   int aa;
   ptr = &barvar;
diff --git a/gcc/testsuite/g++.dg/ipa/pure-const-2.C b/gcc/testsuite/g++.dg/ipa/pure-const-2.C
index 9788b8acdd8..6e739de4ade 100644
--- a/gcc/testsuite/g++.dg/ipa/pure-const-2.C
+++ b/gcc/testsuite/g++.dg/ipa/pure-const-2.C
@@ -15,7 +15,7 @@ static int b(void)
 {
   return a();
 }
-main()
+int main()
 {
   int aa;
   ptr = &barvar;
diff --git a/gcc/testsuite/g++.dg/ipa/pure-const-3.C b/gcc/testsuite/g++.dg/ipa/pure-const-3.C
index ff7fe53f335..4cf9a6a9306 100644
--- a/gcc/testsuite/g++.dg/ipa/pure-const-3.C
+++ b/gcc/testsuite/g++.dg/ipa/pure-const-3.C
@@ -21,7 +21,7 @@ static int b(int p)
     return a(p+1);
   return 1;
 }
-main()
+int main()
 {
   int aa;
   ptr = &barvar;
diff --git a/gcc/testsuite/g++.dg/ipa/remref-1.C b/gcc/testsuite/g++.dg/ipa/remref-1.C
index c25c425e9b7..a2c316aa9a9 100644
--- a/gcc/testsuite/g++.dg/ipa/remref-1.C
+++ b/gcc/testsuite/g++.dg/ipa/remref-1.C
@@ -28,7 +28,7 @@ allocate_a ()
   a = new A();
 }
 
-main()
+int main()
 {
   allocate_a();
   for (int i=0; i<10000;i++)
diff --git a/gcc/testsuite/g++.dg/ipa/remref-2.C b/gcc/testsuite/g++.dg/ipa/remref-2.C
index 06bc71a5b00..1cece6541c9 100644
--- a/gcc/testsuite/g++.dg/ipa/remref-2.C
+++ b/gcc/testsuite/g++.dg/ipa/remref-2.C
@@ -29,7 +29,7 @@ allocate_a ()
   a = new A();
 }
 
-main()
+int main()
 {
   allocate_a();
   for (int i=0; i<10000;i++)
diff --git a/gcc/testsuite/g++.dg/lookup/builtin2.C b/gcc/testsuite/g++.dg/lookup/builtin2.C
index be0a6f65d6c..4649737c3d0 100644
--- a/gcc/testsuite/g++.dg/lookup/builtin2.C
+++ b/gcc/testsuite/g++.dg/lookup/builtin2.C
@@ -14,6 +14,6 @@ namespace std
   using ::toupper;
 }
 
-int f () {
+void f () {
   std::toupper((signed int)'a');
 }
diff --git a/gcc/testsuite/g++.dg/lookup/crash3.C b/gcc/testsuite/g++.dg/lookup/crash3.C
index 5b58e8ed559..1b78dd607f3 100644
--- a/gcc/testsuite/g++.dg/lookup/crash3.C
+++ b/gcc/testsuite/g++.dg/lookup/crash3.C
@@ -4,12 +4,12 @@
 
 typedef __SIZE_TYPE__ size_t; 
 
-struct A { void *operator new(size_t s){} };  // { dg-message "operator new" }
-struct B { void *operator new(size_t s){} };  // { dg-message "operator new" }
+struct A { void *operator new(size_t s){ return 0; } };  // { dg-message "operator new" }
+struct B { void *operator new(size_t s){ return 0; } };  // { dg-message "operator new" }
 
 struct C : A,B {}; 
 
-int crash() 
+void crash() 
 {
   C *c=new C();   // { dg-error "ambiguous" }
 }
diff --git a/gcc/testsuite/g++.dg/lookup/friend20.C b/gcc/testsuite/g++.dg/lookup/friend20.C
index ecdc763ca06..8ef23a67179 100644
--- a/gcc/testsuite/g++.dg/lookup/friend20.C
+++ b/gcc/testsuite/g++.dg/lookup/friend20.C
@@ -12,5 +12,6 @@ template <int = 3> class a
   a<>
   d ()
   {
+    return a<>();
   }
 };
diff --git a/gcc/testsuite/g++.dg/lookup/pr80891-5.C b/gcc/testsuite/g++.dg/lookup/pr80891-5.C
index ebf64f8758e..e018922d68b 100644
--- a/gcc/testsuite/g++.dg/lookup/pr80891-5.C
+++ b/gcc/testsuite/g++.dg/lookup/pr80891-5.C
@@ -51,6 +51,7 @@ int vf2_subgraph_iso(GraphSmall, GraphLarge, SubGraphIsoMapCallback p3,
                      IndexMapSmall, IndexMapLarge, VertexOrderSmall,
                      EdgeEquivalencePredicate, VertexEquivalencePredicate) {
   vf2_subgraph_morphism<subgraph_iso>(0, 0, p3, 0, 0, 0, 0, 0);
+  return 0;
 }
 }
 using namespace boost;
diff --git a/gcc/testsuite/g++.dg/lookup/struct2.C b/gcc/testsuite/g++.dg/lookup/struct2.C
index a66f403c291..a63e03dffdc 100644
--- a/gcc/testsuite/g++.dg/lookup/struct2.C
+++ b/gcc/testsuite/g++.dg/lookup/struct2.C
@@ -4,4 +4,4 @@ struct c {};
 namespace A {
   int c(struct c*req);
 }
-int A::c(struct c*req) {}
+int A::c(struct c*req) { return 0; }
diff --git a/gcc/testsuite/g++.dg/lto/20080709_0.C b/gcc/testsuite/g++.dg/lto/20080709_0.C
index 55ae8c9ec2c..c9e81b44e2c 100644
--- a/gcc/testsuite/g++.dg/lto/20080709_0.C
+++ b/gcc/testsuite/g++.dg/lto/20080709_0.C
@@ -4,6 +4,7 @@ class Init     {
 };
 
 int f(Init *a) {
+    return 0;
 }
 
 int main(void){
diff --git a/gcc/testsuite/g++.dg/lto/20080907_0.C b/gcc/testsuite/g++.dg/lto/20080907_0.C
index 9a4552310d9..a423196e7db 100644
--- a/gcc/testsuite/g++.dg/lto/20080907_0.C
+++ b/gcc/testsuite/g++.dg/lto/20080907_0.C
@@ -1,3 +1,5 @@
 // { dg-lto-do assemble }
+// { dg-lto-options "-Wno-return-type" }
+
 struct Foo { void func (); }; Foo & bar () { } struct Baz { Baz (Baz &); };
 Baz dummy() { bar().func(); }
diff --git a/gcc/testsuite/g++.dg/lto/20080915_0.C b/gcc/testsuite/g++.dg/lto/20080915_0.C
index 3789765a964..40c50422857 100644
--- a/gcc/testsuite/g++.dg/lto/20080915_0.C
+++ b/gcc/testsuite/g++.dg/lto/20080915_0.C
@@ -1,4 +1,6 @@
 // { dg-lto-do assemble }
+// { dg-lto-options "-Wno-return-type" }
+
 struct Foo {
  static const int dummy;
 
@@ -16,7 +18,7 @@ int func(const Bar& b) {
 }
 
 struct Baz {
- Bar& operator*() {}
+ Bar& operator*() { static Bar a; return a; }
 };
 
 void func1(Baz baz, int i, Bar bar) {
diff --git a/gcc/testsuite/g++.dg/lto/20080916_0.C b/gcc/testsuite/g++.dg/lto/20080916_0.C
index 3c900cd43b5..77494ef689c 100644
--- a/gcc/testsuite/g++.dg/lto/20080916_0.C
+++ b/gcc/testsuite/g++.dg/lto/20080916_0.C
@@ -9,4 +9,6 @@ class ios_base   {
 };
 
 ios_base& g() {
+    static ios_base a;
+    return a;
 }
diff --git a/gcc/testsuite/g++.dg/lto/20081022_0.C b/gcc/testsuite/g++.dg/lto/20081022_0.C
index 219f92d6a96..92d463b1cde 100644
--- a/gcc/testsuite/g++.dg/lto/20081022_0.C
+++ b/gcc/testsuite/g++.dg/lto/20081022_0.C
@@ -6,6 +6,8 @@ f (foo * a)
   return a->bar ();
 }
 
+int
 main()
 {
+  return 0;
 }
diff --git a/gcc/testsuite/g++.dg/lto/20081023_0.C b/gcc/testsuite/g++.dg/lto/20081023_0.C
index ab3fc36f386..d40ac279b77 100644
--- a/gcc/testsuite/g++.dg/lto/20081023_0.C
+++ b/gcc/testsuite/g++.dg/lto/20081023_0.C
@@ -9,6 +9,8 @@ f (void)
   func ();
 }
 
+int
 main()
 {
+  return 0;
 }
diff --git a/gcc/testsuite/g++.dg/lto/20081118_0.C b/gcc/testsuite/g++.dg/lto/20081118_0.C
index 7be32b6e2a7..c1f9dfc97a4 100644
--- a/gcc/testsuite/g++.dg/lto/20081118_0.C
+++ b/gcc/testsuite/g++.dg/lto/20081118_0.C
@@ -18,4 +18,5 @@ class foo : public object
 int
 foo::method(void)
 {
+  return 0;
 }
diff --git a/gcc/testsuite/g++.dg/lto/20081118_1.C b/gcc/testsuite/g++.dg/lto/20081118_1.C
index a1bf08186df..ee870a2eb75 100644
--- a/gcc/testsuite/g++.dg/lto/20081118_1.C
+++ b/gcc/testsuite/g++.dg/lto/20081118_1.C
@@ -18,4 +18,5 @@ bar*
 bar::method (void)
 {
  quxx::method();
+ return 0;
 }
diff --git a/gcc/testsuite/g++.dg/lto/20081120-1_0.C b/gcc/testsuite/g++.dg/lto/20081120-1_0.C
index 6827337787c..03a9740c091 100644
--- a/gcc/testsuite/g++.dg/lto/20081120-1_0.C
+++ b/gcc/testsuite/g++.dg/lto/20081120-1_0.C
@@ -4,6 +4,7 @@ extern "C"
 {
  extern __inline __attribute__((__gnu_inline__)) int pthread_equal(int, int)
  {
+    return 0;
  }
 }
 static __typeof(pthread_equal)
diff --git a/gcc/testsuite/g++.dg/lto/20081120-1_1.C b/gcc/testsuite/g++.dg/lto/20081120-1_1.C
index e7e24a58b76..9c5d9bd6f4c 100644
--- a/gcc/testsuite/g++.dg/lto/20081120-1_1.C
+++ b/gcc/testsuite/g++.dg/lto/20081120-1_1.C
@@ -2,6 +2,7 @@ extern "C"
 {
  extern __inline __attribute__((__gnu_inline__)) int pthread_equal(int, int)
  {
+    return 0;
  }
 }
 static __typeof(pthread_equal)
diff --git a/gcc/testsuite/g++.dg/lto/20081127_1.C b/gcc/testsuite/g++.dg/lto/20081127_1.C
index 6488ac8d797..63ae50c31ec 100644
--- a/gcc/testsuite/g++.dg/lto/20081127_1.C
+++ b/gcc/testsuite/g++.dg/lto/20081127_1.C
@@ -1,3 +1,3 @@
 struct Foo { Foo(); };
 Foo::Foo() { }
-main() { return 0; }
+int main() { return 0; }
diff --git a/gcc/testsuite/g++.dg/lto/20081217-2_0.C b/gcc/testsuite/g++.dg/lto/20081217-2_0.C
index a47b0b5781b..3bc6ba997a5 100644
--- a/gcc/testsuite/g++.dg/lto/20081217-2_0.C
+++ b/gcc/testsuite/g++.dg/lto/20081217-2_0.C
@@ -1,5 +1,5 @@
 struct A {
-  virtual int foo() {}
+  virtual int foo() { return 0; }
 };
 struct B {
   virtual int f() {return 1; }
@@ -13,6 +13,7 @@ C::C()
 {
 }
 
+int
 main()
 {
   C c;
diff --git a/gcc/testsuite/g++.dg/lto/20090303_0.C b/gcc/testsuite/g++.dg/lto/20090303_0.C
index 88bd6ad9beb..d9ec5a35fed 100644
--- a/gcc/testsuite/g++.dg/lto/20090303_0.C
+++ b/gcc/testsuite/g++.dg/lto/20090303_0.C
@@ -16,6 +16,8 @@ void Test() {
  int int_set_;
  foobar (&int_set_, &test_ints[j]);
 }
+
+int
 main()
 {
   Test();
diff --git a/gcc/testsuite/g++.dg/lto/20090311-1_0.C b/gcc/testsuite/g++.dg/lto/20090311-1_0.C
index 6d403272428..60c002fbfba 100644
--- a/gcc/testsuite/g++.dg/lto/20090311-1_0.C
+++ b/gcc/testsuite/g++.dg/lto/20090311-1_0.C
@@ -26,6 +26,8 @@ struct A {
 A a;
 
 extern int foo();
+
+int
 main()
 {
   a.x = 4 + c.x;
diff --git a/gcc/testsuite/g++.dg/lto/20090312_0.C b/gcc/testsuite/g++.dg/lto/20090312_0.C
index b2222c2aa20..579b60e939e 100644
--- a/gcc/testsuite/g++.dg/lto/20090312_0.C
+++ b/gcc/testsuite/g++.dg/lto/20090312_0.C
@@ -5,6 +5,7 @@ extern "C" {
     extern JSErrorCallback p;
 };
 
+int
 main()
 {
   if ( x == ONE && p == 0)
diff --git a/gcc/testsuite/g++.dg/lto/20090315_0.C b/gcc/testsuite/g++.dg/lto/20090315_0.C
index 930fb16e5cf..1cae572eeb8 100644
--- a/gcc/testsuite/g++.dg/lto/20090315_0.C
+++ b/gcc/testsuite/g++.dg/lto/20090315_0.C
@@ -6,4 +6,4 @@ struct Foo {
   static Foo *foo_;
 };
 Foo *Foo::foo_;
-main() { return 0; }
+int main() { return 0; }
diff --git a/gcc/testsuite/g++.dg/lto/20091002-1_0.C b/gcc/testsuite/g++.dg/lto/20091002-1_0.C
index c63b079d77b..a59a0cb9505 100644
--- a/gcc/testsuite/g++.dg/lto/20091002-1_0.C
+++ b/gcc/testsuite/g++.dg/lto/20091002-1_0.C
@@ -1,6 +1,6 @@
 // { dg-lto-do link }
 // { dg-require-effective-target fpic }
-// { dg-lto-options {{-fPIC -flto}} }
+// { dg-lto-options {{-fPIC -flto -Wno-return-type}} }
 // { dg-extra-ld-options "-fPIC -r -nostdlib" }
 
 namespace std __attribute__ ((__visibility__ ("default")))
diff --git a/gcc/testsuite/g++.dg/lto/20091002-2_0.C b/gcc/testsuite/g++.dg/lto/20091002-2_0.C
index bf936bf53a3..12a1596b3e2 100644
--- a/gcc/testsuite/g++.dg/lto/20091002-2_0.C
+++ b/gcc/testsuite/g++.dg/lto/20091002-2_0.C
@@ -4,7 +4,7 @@
 // { dg-extra-ld-options "-fPIC -r -nostdlib" }
 
 class DataArray {
-    int max() const    { }
+    int max() const    { return 0; }
 };
 template < class HashItem > 
 class DataHashTable {
diff --git a/gcc/testsuite/g++.dg/lto/20091002-3_0.C b/gcc/testsuite/g++.dg/lto/20091002-3_0.C
index 4bff78b4937..0d9afc44c28 100644
--- a/gcc/testsuite/g++.dg/lto/20091002-3_0.C
+++ b/gcc/testsuite/g++.dg/lto/20091002-3_0.C
@@ -5,7 +5,7 @@
 
 template < class T > 
 class DataArray {
-    int max() const { }
+    int max() const { return 0; }
 };
 class Name { };
 class DataHashTable {
diff --git a/gcc/testsuite/g++.dg/lto/20091004-1_0.C b/gcc/testsuite/g++.dg/lto/20091004-1_0.C
index 649e35cb80d..536ae46dadf 100644
--- a/gcc/testsuite/g++.dg/lto/20091004-1_0.C
+++ b/gcc/testsuite/g++.dg/lto/20091004-1_0.C
@@ -1,6 +1,6 @@
 // { dg-lto-do link }
 // { dg-require-effective-target fpic }
-// { dg-lto-options {{-fPIC -O -flto}} }
+// { dg-lto-options {{-fPIC -O -flto -Wno-return-type}} }
 
 typedef double Real;
 class Vector {
diff --git a/gcc/testsuite/g++.dg/lto/20091004-2_0.C b/gcc/testsuite/g++.dg/lto/20091004-2_0.C
index cc1204e6f7e..40ef136514b 100644
--- a/gcc/testsuite/g++.dg/lto/20091004-2_0.C
+++ b/gcc/testsuite/g++.dg/lto/20091004-2_0.C
@@ -1,6 +1,6 @@
 // { dg-lto-do link }
 // { dg-require-effective-target fpic }
-// { dg-lto-options {{-fPIC -O -flto}} }
+// { dg-lto-options {{-fPIC -O -flto -Wno-return-type}} }
 
 typedef double Real;
 class Vector {
diff --git a/gcc/testsuite/g++.dg/lto/20091004-3_1.C b/gcc/testsuite/g++.dg/lto/20091004-3_1.C
index 641c7495b4f..f46b8fc6c11 100644
--- a/gcc/testsuite/g++.dg/lto/20091004-3_1.C
+++ b/gcc/testsuite/g++.dg/lto/20091004-3_1.C
@@ -12,5 +12,6 @@ All_Torus_Intersections(void)
   VECTOR D;
   VLength(len, D);
   VLength(len, D);
+  return 0;
 }
 
diff --git a/gcc/testsuite/g++.dg/lto/20100721-1_0.C b/gcc/testsuite/g++.dg/lto/20100721-1_0.C
index 09132e5992b..e39184b76d1 100644
--- a/gcc/testsuite/g++.dg/lto/20100721-1_0.C
+++ b/gcc/testsuite/g++.dg/lto/20100721-1_0.C
@@ -1,6 +1,6 @@
 /* { dg-lto-do assemble } */
 
-static inline int __gthread_active_p (void) { }
+static inline int __gthread_active_p (void) { return 0; }
 template <int rank, int dim> class Tensor;
 template <int dimension> struct G;
 template <int dim> class T {
diff --git a/gcc/testsuite/g++.dg/lto/20101010-1_0.C b/gcc/testsuite/g++.dg/lto/20101010-1_0.C
index 6eb40efc868..8f694c78aa7 100644
--- a/gcc/testsuite/g++.dg/lto/20101010-1_0.C
+++ b/gcc/testsuite/g++.dg/lto/20101010-1_0.C
@@ -1,4 +1,5 @@
 // { dg-lto-do link }
+// { dg-lto-options "-Wno-return-type" }
 
 typedef long size_t;
 template < class, class > struct pair
diff --git a/gcc/testsuite/g++.dg/lto/20101010-2_0.C b/gcc/testsuite/g++.dg/lto/20101010-2_0.C
index c68bcd63238..a26956f7fc7 100644
--- a/gcc/testsuite/g++.dg/lto/20101010-2_0.C
+++ b/gcc/testsuite/g++.dg/lto/20101010-2_0.C
@@ -1,4 +1,5 @@
 // { dg-lto-do link }
+// { dg-lto-options "-Wno-return-type" }
 
 typedef int size_t;
 template < size_t _Nw > struct _Base_bitset
diff --git a/gcc/testsuite/g++.dg/lto/pr45679-1_0.C b/gcc/testsuite/g++.dg/lto/pr45679-1_0.C
index 349f5c2c1ef..0dc5fd0dcb5 100644
--- a/gcc/testsuite/g++.dg/lto/pr45679-1_0.C
+++ b/gcc/testsuite/g++.dg/lto/pr45679-1_0.C
@@ -1,5 +1,5 @@
 // { dg-lto-do link }
-// { dg-lto-options {{-O3 -Wno-multichar}} } 
+// { dg-lto-options {{-O3 -Wno-multichar -Wno-return-type }} } 
 // { dg-extra-ld-options "-flto -flto-partition=1to1 -r -nostdlib" }
 
      extern "C" {
diff --git a/gcc/testsuite/g++.dg/lto/pr45679-1_1.C b/gcc/testsuite/g++.dg/lto/pr45679-1_1.C
index c5e2db061fb..9aa92fa540e 100644
--- a/gcc/testsuite/g++.dg/lto/pr45679-1_1.C
+++ b/gcc/testsuite/g++.dg/lto/pr45679-1_1.C
@@ -1,4 +1,4 @@
-    extern "C" {
+  extern "C" {
     typedef struct _IO_FILE FILE;
     extern struct _IO_FILE *stderr;
     extern int fprintf (FILE *__restrict __stream,       __const char *__restrict __format, ...);
diff --git a/gcc/testsuite/g++.dg/lto/pr45679-2_0.C b/gcc/testsuite/g++.dg/lto/pr45679-2_0.C
index 549741902ba..b88ad92f539 100644
--- a/gcc/testsuite/g++.dg/lto/pr45679-2_0.C
+++ b/gcc/testsuite/g++.dg/lto/pr45679-2_0.C
@@ -1,6 +1,7 @@
 // { dg-lto-do link }
-// { dg-lto-options {{-O3 -Wno-multichar}} } 
+// { dg-lto-options {{-O3 -Wno-multichar -Wno-return-type}} } 
 // { dg-extra-ld-options "-flto -flto-partition=1to1 -r -nostdlib" }
+
     extern "C" {
   typedef struct {
     union   {
diff --git a/gcc/testsuite/g++.dg/lto/pr48042_0.C b/gcc/testsuite/g++.dg/lto/pr48042_0.C
index 00b3428e9f1..4ca1a0cebfe 100644
--- a/gcc/testsuite/g++.dg/lto/pr48042_0.C
+++ b/gcc/testsuite/g++.dg/lto/pr48042_0.C
@@ -10,5 +10,5 @@ class B:public A {
 };
 
 int B::x() {
+    return 0;
 }
-
diff --git a/gcc/testsuite/g++.dg/lto/pr51650-1_0.C b/gcc/testsuite/g++.dg/lto/pr51650-1_0.C
index 4c9ef3c8c48..1c37e629e1d 100644
--- a/gcc/testsuite/g++.dg/lto/pr51650-1_0.C
+++ b/gcc/testsuite/g++.dg/lto/pr51650-1_0.C
@@ -15,5 +15,6 @@ int
 fn ()
 {
   C::m ();
+  return 0;
 }
-int main() {}
+int main() { return 0; }
diff --git a/gcc/testsuite/g++.dg/lto/pr51650-3_0.C b/gcc/testsuite/g++.dg/lto/pr51650-3_0.C
index e84d555a0fb..ff55e4aab4c 100644
--- a/gcc/testsuite/g++.dg/lto/pr51650-3_0.C
+++ b/gcc/testsuite/g++.dg/lto/pr51650-3_0.C
@@ -16,5 +16,6 @@ int
 fn ()
 {
   C::m ();
+  return 0;
 }
-int main() {}
+int main() { return 0; }
diff --git a/gcc/testsuite/g++.dg/lto/pr63270_1.C b/gcc/testsuite/g++.dg/lto/pr63270_1.C
index a842e5cfcc6..b5aab3508cf 100644
--- a/gcc/testsuite/g++.dg/lto/pr63270_1.C
+++ b/gcc/testsuite/g++.dg/lto/pr63270_1.C
@@ -48,6 +48,7 @@ namespace v8
     };
     int PreParser::ParseMemberWithNewPrefixesExpression ( bool * )
     {
+      return 0;
     }
   }
 }
diff --git a/gcc/testsuite/g++.dg/lto/pr65193_0.C b/gcc/testsuite/g++.dg/lto/pr65193_0.C
index d778fcabb7f..ceebe51069d 100644
--- a/gcc/testsuite/g++.dg/lto/pr65193_0.C
+++ b/gcc/testsuite/g++.dg/lto/pr65193_0.C
@@ -1,6 +1,6 @@
 /* { dg-lto-do link } */
 /* { dg-require-effective-target fpic } */
-/* { dg-lto-options {{-fPIC -r -nostdlib -flto -O2 -g}} } */
+/* { dg-lto-options {{-fPIC -r -nostdlib -flto -O2 -g -Wno-return-type}} } */
 
 void frexp (int, int *);
 namespace std
diff --git a/gcc/testsuite/g++.dg/lto/pr65302_0.C b/gcc/testsuite/g++.dg/lto/pr65302_0.C
index 2298afd9d96..83e1194fb10 100644
--- a/gcc/testsuite/g++.dg/lto/pr65302_0.C
+++ b/gcc/testsuite/g++.dg/lto/pr65302_0.C
@@ -1,5 +1,5 @@
 // { dg-lto-do link }
-// { dg-lto-options { { -flto -O2 } } }
+// { dg-lto-options { { -flto -O2 -Wno-return-type } } }
 // { dg-extra-ld-options "-r -nostdlib -O0" }
 
 class CstringStorageReference {
diff --git a/gcc/testsuite/g++.dg/lto/pr65316_0.C b/gcc/testsuite/g++.dg/lto/pr65316_0.C
index cccd0db7d8e..2b9360e29fe 100644
--- a/gcc/testsuite/g++.dg/lto/pr65316_0.C
+++ b/gcc/testsuite/g++.dg/lto/pr65316_0.C
@@ -1,6 +1,7 @@
 // { dg-lto-do link }
-// { dg-lto-options { { -flto -std=c++11 -g2 -fno-lto-odr-type-merging -O2 } } }
+// { dg-lto-options { { -flto -std=c++11 -g2 -fno-lto-odr-type-merging -O2 -Wno-return-type } } }
 // { dg-extra-ld-options "-r -nostdlib -O2 -fno-lto-odr-type-merging" }
+
 namespace std
 {
   typedef long unsigned int size_t;
diff --git a/gcc/testsuite/g++.dg/lto/pr65475c_0.C b/gcc/testsuite/g++.dg/lto/pr65475c_0.C
index 8e1d8bcc83d..73686918c2c 100644
--- a/gcc/testsuite/g++.dg/lto/pr65475c_0.C
+++ b/gcc/testsuite/g++.dg/lto/pr65475c_0.C
@@ -1,6 +1,7 @@
 /* { dg-lto-do link } */
-/* { dg-lto-options "-O2  -w" } */
 /* { dg-extra-ld-options { -O2 -Wno-odr -r -nostdlib } } */
+/* { dg-lto-options { "-O2 -w -Wno-return-type" } } */
+
 namespace std
 {
 template < class > struct char_traits;
diff --git a/gcc/testsuite/g++.dg/lto/pr65549_0.C b/gcc/testsuite/g++.dg/lto/pr65549_0.C
index 889cc994a58..d3ed1dca158 100644
--- a/gcc/testsuite/g++.dg/lto/pr65549_0.C
+++ b/gcc/testsuite/g++.dg/lto/pr65549_0.C
@@ -1,5 +1,5 @@
 // { dg-lto-do link }
-// { dg-lto-options { { -std=gnu++14 -flto -g } { -std=gnu++14 -flto -g -O2 -fno-inline -flto-partition=max } } }
+// { dg-lto-options { { -std=gnu++14 -flto -g -Wno-return-type } { -std=gnu++14 -flto -g -O2 -fno-inline -flto-partition=max -Wno-return-type } } }
 // { dg-extra-ld-options "-r -nostdlib" }
 
 namespace std {
@@ -135,10 +135,12 @@ public:
     then(0, [] {});
   }
 } clients;
-main() {
+int main() {
   B app;
   app.run(0, 0, [&] {
     auto config = app.configuration()[0].as<std::string>();
     clients.then([] {});
   });
+
+  return 0;
 }
diff --git a/gcc/testsuite/g++.dg/lto/pr69077_0.C b/gcc/testsuite/g++.dg/lto/pr69077_0.C
index 6a81d0e3a5c..10cb05917b9 100644
--- a/gcc/testsuite/g++.dg/lto/pr69077_0.C
+++ b/gcc/testsuite/g++.dg/lto/pr69077_0.C
@@ -11,4 +11,4 @@ struct cStdDev
 struct cWeightedStdDev : public cStdDev {
     virtual int netPack();
 };
-int cWeightedStdDev::netPack() { }
+int cWeightedStdDev::netPack() { return 0; }
diff --git a/gcc/testsuite/g++.dg/lto/pr69589_0.C b/gcc/testsuite/g++.dg/lto/pr69589_0.C
index 599d5d44960..c6f72c4090b 100644
--- a/gcc/testsuite/g++.dg/lto/pr69589_0.C
+++ b/gcc/testsuite/g++.dg/lto/pr69589_0.C
@@ -1,5 +1,5 @@
 // { dg-lto-do link }
-// { dg-lto-options "-O2 -rdynamic" }
+// { dg-lto-options { "-O2 -rdynamic -Wno-return-type" } }
 // { dg-extra-ld-options "-r -nostdlib" }
 // { dg-require-effective-target rdynamic }
 
diff --git a/gcc/testsuite/g++.dg/opt/combine.C b/gcc/testsuite/g++.dg/opt/combine.C
index d01ae78a4bc..a1325a0dca9 100644
--- a/gcc/testsuite/g++.dg/opt/combine.C
+++ b/gcc/testsuite/g++.dg/opt/combine.C
@@ -36,6 +36,7 @@ class QVariant { };
 template<typename T> inline T qvariant_cast (const QVariant &v)
 {
   const int vid = qMetaTypeId<T> ((0)) ;
+  return T();
 };
 class QScriptContext
 {
@@ -70,4 +71,5 @@ QScriptValue QScriptDebuggerBackendPrivate::trace (QScriptContext *context)
 {
   QScriptValue data = context->callee () ;
   QScriptDebuggerBackendPrivate *self = qscriptvalue_cast<QScriptDebuggerBackendPrivate*> (data) ;
+  return QScriptValue();
 }
diff --git a/gcc/testsuite/g++.dg/opt/complex3.C b/gcc/testsuite/g++.dg/opt/complex3.C
index 9a3fdf3f0d2..ee1b616e403 100644
--- a/gcc/testsuite/g++.dg/opt/complex3.C
+++ b/gcc/testsuite/g++.dg/opt/complex3.C
@@ -7,7 +7,7 @@ _Complex float g();
 _Complex float h()throw();
 void i(float)throw();
 
-float j(void)
+void j(void)
 {
   _Complex float x = h();
   try
diff --git a/gcc/testsuite/g++.dg/opt/covariant1.C b/gcc/testsuite/g++.dg/opt/covariant1.C
index e57cf4c6be0..b8a93177946 100644
--- a/gcc/testsuite/g++.dg/opt/covariant1.C
+++ b/gcc/testsuite/g++.dg/opt/covariant1.C
@@ -9,7 +9,7 @@ bar (int x)
 }
 
 struct S { S () {}; virtual ~S () {}; };
-struct T { virtual T *foo (int) {}; };
+struct T { virtual T *foo (int) { return 0; }; };
 struct V : virtual S, virtual T {};
 struct V v;
 struct U : public S, public T
diff --git a/gcc/testsuite/g++.dg/opt/declone3.C b/gcc/testsuite/g++.dg/opt/declone3.C
index 26f3b5214c9..3dd939a961c 100644
--- a/gcc/testsuite/g++.dg/opt/declone3.C
+++ b/gcc/testsuite/g++.dg/opt/declone3.C
@@ -14,4 +14,4 @@ struct Item : Object, virtual A {
   }
   bool m_fn1();
 };
-bool Item::m_fn1() {}
+bool Item::m_fn1() { return true; }
diff --git a/gcc/testsuite/g++.dg/opt/dump1.C b/gcc/testsuite/g++.dg/opt/dump1.C
index f74d0247832..f813044456c 100644
--- a/gcc/testsuite/g++.dg/opt/dump1.C
+++ b/gcc/testsuite/g++.dg/opt/dump1.C
@@ -2,6 +2,7 @@
 // { dg-options "-O2 -fno-inline -fdump-final-insns" }
 // { dg-do compile { target c++11 } }
 // { dg-final cleanup-final-insns-dump }
+// { dg-additional-options "-Wno-return-type" }
 
 namespace std
 {
@@ -348,7 +349,7 @@ namespace std __attribute__ ((__visibility__ ("default")))
   template<typename _Tp>
     inline reference_wrapper<_Tp>
     ref(_Tp& __t) noexcept
-    {}
+    { return reference_wrapper<_Tp>(); }
   template<typename _Tp>
     struct _Maybe_wrap_member_pointer
     {
diff --git a/gcc/testsuite/g++.dg/opt/inline15.C b/gcc/testsuite/g++.dg/opt/inline15.C
index 5da3a610519..9aa1b73c863 100644
--- a/gcc/testsuite/g++.dg/opt/inline15.C
+++ b/gcc/testsuite/g++.dg/opt/inline15.C
@@ -16,7 +16,7 @@ struct A
 };
 struct C : public A
 {
-  virtual int bar () { }
+  virtual int bar () { return 0; }
 };
 struct D : public C
 {
@@ -33,6 +33,7 @@ struct E
 static unsigned *
 fn2 ()
 {
+  return 0;
 }
 
 void
diff --git a/gcc/testsuite/g++.dg/opt/local1.C b/gcc/testsuite/g++.dg/opt/local1.C
index 9cecaee6f2a..a63afc24f16 100644
--- a/gcc/testsuite/g++.dg/opt/local1.C
+++ b/gcc/testsuite/g++.dg/opt/local1.C
@@ -8,7 +8,7 @@ struct Outer {
 inline void h(const Outer &o)
 {
   struct Local : public Outer::Inner {
-    virtual bool f() {};
+    virtual bool f() { return true; };
   };
   Local l;
   o.g(l);
diff --git a/gcc/testsuite/g++.dg/opt/memcpy1.C b/gcc/testsuite/g++.dg/opt/memcpy1.C
index e2b1dd2cdf0..66411cdda39 100644
--- a/gcc/testsuite/g++.dg/opt/memcpy1.C
+++ b/gcc/testsuite/g++.dg/opt/memcpy1.C
@@ -63,6 +63,7 @@ namespace CS
       // the multiplication below to produce a very large number
       // in excess of the maximum possible object size (SIZE_MAX/2).
       __builtin_memcpy (this->OutP, InP, OutV * sizeof (csVector2));   // { dg-warning "specified size \[0-9\]+ exceeds maximum object size" }
+      return 0;
     }
   };
 }
@@ -79,4 +80,5 @@ csBoxClipper::Clip (csVector2 * InPolygon, size_t InCount,
                                                            InPolygon, InCount,
                                                            OutPolygon);
   uint8 Clipped = boxClip.Clip ();
+  return 0;
 }
diff --git a/gcc/testsuite/g++.dg/opt/new1.C b/gcc/testsuite/g++.dg/opt/new1.C
index dbcc0f8517a..d0f7d95b655 100644
--- a/gcc/testsuite/g++.dg/opt/new1.C
+++ b/gcc/testsuite/g++.dg/opt/new1.C
@@ -15,8 +15,8 @@ namespace QScript {
     namespace Ecma {
         class Core {
         public:
-            inline QScriptEnginePrivate *engine() const     { }
-            inline QScriptClassInfo *classInfo() const     { }
+            inline QScriptEnginePrivate *engine() const     { return 0; }
+            inline QScriptClassInfo *classInfo() const     { return 0; }
             QScriptValueImpl publicPrototype;
         };
         class Boolean: public Core {
diff --git a/gcc/testsuite/g++.dg/opt/nrv8.C b/gcc/testsuite/g++.dg/opt/nrv8.C
index 19999a18824..ca39e7e0f32 100644
--- a/gcc/testsuite/g++.dg/opt/nrv8.C
+++ b/gcc/testsuite/g++.dg/opt/nrv8.C
@@ -20,7 +20,7 @@ A bar()
   return l;
 }
 
-main()
+int main()
 {
   A a = bar ();
 
diff --git a/gcc/testsuite/g++.dg/opt/pr23299.C b/gcc/testsuite/g++.dg/opt/pr23299.C
index b791bf954e8..f14750eb306 100644
--- a/gcc/testsuite/g++.dg/opt/pr23299.C
+++ b/gcc/testsuite/g++.dg/opt/pr23299.C
@@ -6,15 +6,15 @@ extern "C" void abort ();
 
 struct A
 {
-  virtual int a () {}
+  virtual int a () { return 0; }
 };
 struct B : public A
 {
-  virtual int b () {}
+  virtual int b () { return 1; }
 };
 struct C : public A
 {
-  virtual int c () {}
+  virtual int c () { return 2; }
 };
 struct D
 {
diff --git a/gcc/testsuite/g++.dg/opt/pr27826.C b/gcc/testsuite/g++.dg/opt/pr27826.C
index 5e40f1746f9..7de08e08133 100644
--- a/gcc/testsuite/g++.dg/opt/pr27826.C
+++ b/gcc/testsuite/g++.dg/opt/pr27826.C
@@ -5,7 +5,7 @@ struct Geometry
 {
         int type:16;
 };
-struct Geometry get() {};
+struct Geometry get() { return Geometry(); };
 int f()
 {
         struct Geometry test;
diff --git a/gcc/testsuite/g++.dg/opt/pr44919.C b/gcc/testsuite/g++.dg/opt/pr44919.C
index a4aeec822bc..1916a2b359d 100644
--- a/gcc/testsuite/g++.dg/opt/pr44919.C
+++ b/gcc/testsuite/g++.dg/opt/pr44919.C
@@ -1,5 +1,6 @@
 // { dg-do compile { target powerpc*-*-* ia64-*-* i?86-*-* x86_64-*-* } }
 // { dg-options "-O3 -fselective-scheduling2" }
+// { dg-additional-options "-Wno-return-type" }
 
 namespace std {
 
@@ -9,7 +10,7 @@ template<typename _Tp> class new_allocator { public: typedef size_t size_type; t
 template<typename _Tp> class allocator: public new_allocator<_Tp> { public: typedef size_t size_type; template<typename _Tp1> struct rebind { typedef allocator<_Tp1> other; }; };
 
 class back_insert_iterator { };
-template<typename _Container> back_insert_iterator back_inserter(_Container& __x) { };
+template<typename _Container> back_insert_iterator back_inserter(_Container& __x) { return back_insert_iterator(); };
 
 class vector { };
 
@@ -99,6 +100,7 @@ namespace internal {
   };
   template <class K> Object intersection( const typename K::Segment_2 &seg, const typename K::Iso_rectangle_2 &iso, const K&) {
     typedef Segment_2_Iso_rectangle_2_pair<K> is_t; is_t ispair(&seg, &iso); switch (ispair.intersection_type()) { }
+    return Object();
   }
   template <class K> typename Segment_2_Iso_rectangle_2_pair<K>::Intersection_results Segment_2_Iso_rectangle_2_pair<K>::intersection_type() const {
     typedef typename K::RT RT;
diff --git a/gcc/testsuite/g++.dg/opt/pr47615.C b/gcc/testsuite/g++.dg/opt/pr47615.C
index f8dbcf7e824..bc467b0c883 100644
--- a/gcc/testsuite/g++.dg/opt/pr47615.C
+++ b/gcc/testsuite/g++.dg/opt/pr47615.C
@@ -1,5 +1,6 @@
 // { dg-do compile }
 // { dg-options "-O -fstrict-aliasing -ftree-pre -fno-tree-fre -fno-tree-sra" }
+// { dg-additional-options "-Wno-return-type" }
 
 typedef __SIZE_TYPE__ size_t;
 namespace std 
@@ -434,7 +435,7 @@ template < typename Const_Node_Iterator, typename Node_Iterator, typename, typen
 	return ((m_p_nd->m_p_right));
       }
       bool operator == (bin_search_tree_const_node_it_)
-      {}
+      { return true; }
       node_pointer m_p_nd;
     };
     template
@@ -704,7 +705,7 @@ typedef
   int,
   null_mapped_type,
   less < int >, rb_tree_tag, tree_order_statistics_node_update > set_t;
-main ()
+int main ()
 {
   set_t s;
   s.insert (12);
diff --git a/gcc/testsuite/g++.dg/opt/pr55329.C b/gcc/testsuite/g++.dg/opt/pr55329.C
index 3646785d12e..28a8a4d72fa 100644
--- a/gcc/testsuite/g++.dg/opt/pr55329.C
+++ b/gcc/testsuite/g++.dg/opt/pr55329.C
@@ -19,10 +19,10 @@ struct A
   int *a;
   A ();
   ~A () { a3 (); }
-  int a1 (int * p) { if (!p) f3 (); f2 (p); }
+  int a1 (int * p) { if (!p) f3 (); f2 (p); return 0; }
   int *a2 ();
   void a3 () { if (*a) a1 (a); }
-  int a4 (int x) { if (*a) f4 (); *a2 () += x; }
+  int a4 (int x) { if (*a) f4 (); *a2 () += x; return 0; }
 };
 
 struct B : A
diff --git a/gcc/testsuite/g++.dg/opt/pr61456.C b/gcc/testsuite/g++.dg/opt/pr61456.C
index 14a118b5720..51a1e618cb3 100644
--- a/gcc/testsuite/g++.dg/opt/pr61456.C
+++ b/gcc/testsuite/g++.dg/opt/pr61456.C
@@ -14,6 +14,7 @@ typedef decltype (&Funcs::f1) pfunc;
 static int Set (Funcs * f, const pfunc & fp)
 {
   (f->*fp) ();
+  return 0;
 }
 
 void
diff --git a/gcc/testsuite/g++.dg/opt/pr65003.C b/gcc/testsuite/g++.dg/opt/pr65003.C
index 5d131afaedb..333cdbcc477 100644
--- a/gcc/testsuite/g++.dg/opt/pr65003.C
+++ b/gcc/testsuite/g++.dg/opt/pr65003.C
@@ -26,6 +26,6 @@ struct F : D
   F (int &, const int &, const A &);
   bool foo (int &, bool) const;
 };
-bool D::foo (int &, bool) const {}
+bool D::foo (int &, bool) const { return true; }
 F::F (int &, const int &, const A &) {}
-bool F::foo (int &, bool) const {}
+bool F::foo (int &, bool) const { return false; }
diff --git a/gcc/testsuite/g++.dg/opt/pr65554.C b/gcc/testsuite/g++.dg/opt/pr65554.C
index 1519964d1fe..cae2beafe02 100644
--- a/gcc/testsuite/g++.dg/opt/pr65554.C
+++ b/gcc/testsuite/g++.dg/opt/pr65554.C
@@ -24,6 +24,7 @@ namespace std
     {
       int _Num = p2 - p1;
       __builtin_memmove (0, p1, sizeof (_Tp) * _Num);
+      return 0;
     }
   };
   template <int, typename _II, typename _OI> void __copy_move_a (_II p1, _II p2, _OI p3)
@@ -68,6 +69,7 @@ namespace std
     template <typename _InputIterator, typename _ForwardIterator> static _ForwardIterator __uninit_copy (_InputIterator p1, _InputIterator p2, _ForwardIterator p3)
     {
       copy (p1, p2, p3);
+      return _ForwardIterator();
     }
   };
   template <typename _InputIterator, typename _ForwardIterator> void
diff --git a/gcc/testsuite/g++.dg/opt/pr69432.C b/gcc/testsuite/g++.dg/opt/pr69432.C
index 1f23f2cedd6..d024ece4cba 100644
--- a/gcc/testsuite/g++.dg/opt/pr69432.C
+++ b/gcc/testsuite/g++.dg/opt/pr69432.C
@@ -26,7 +26,7 @@ void f4 (S, U);
 struct C
 {
   template <typename S, typename T, typename U>
-  static S f5 (S x, T y, U z) { f2 (x, y, z); }
+  static S f5 (S x, T y, U z) { f2 (x, y, z); return S(); }
 };
 
 template <typename S, typename T, typename U>
diff --git a/gcc/testsuite/g++.dg/opt/pr78373.C b/gcc/testsuite/g++.dg/opt/pr78373.C
index 9ceef1cc732..b332691ec0b 100644
--- a/gcc/testsuite/g++.dg/opt/pr78373.C
+++ b/gcc/testsuite/g++.dg/opt/pr78373.C
@@ -12,11 +12,13 @@ struct D : B {
   static int m_fn3(int, int, int, A) {
     D &self = singleton;
     self.m_fn2();
+    return 0;
   }
   static D singleton;
 };
 template <typename, typename> struct C { bool m_fn4() const; };
 template <typename Base, typename Traits> bool C<Base, Traits>::m_fn4() const {
   Traits::m_fn3(0, 0, 0, Base::singleton);
+  return true;
 }
 template struct C<A, D>;
diff --git a/gcc/testsuite/g++.dg/opt/pr79267.C b/gcc/testsuite/g++.dg/opt/pr79267.C
index 177eee6c6f7..69dc6cb0251 100644
--- a/gcc/testsuite/g++.dg/opt/pr79267.C
+++ b/gcc/testsuite/g++.dg/opt/pr79267.C
@@ -45,12 +45,12 @@ D bar ();
 template <typename T> struct L
 {
   struct K { K (int); void operator() (int *) { bar ().q (); } };
-  static J<T> bp () { bq (0); }
+  static J<T> bp () { bq (0); return J<T>(); }
   template <typename br> static void bq (br) { J<T> (0, K (0)); }
 };
 struct F
 {
-  virtual J<int> x (int) { foo (0, 0, 0); J<bs<> > (L<bs<> >::bp ()); }
+  virtual J<int> x (int) { foo (0, 0, 0); J<bs<> > (L<bs<> >::bp ()); return J<int>(); }
 };
 
 void
diff --git a/gcc/testsuite/g++.dg/opt/pr82159-2.C b/gcc/testsuite/g++.dg/opt/pr82159-2.C
index f153c29ddac..c9797105562 100644
--- a/gcc/testsuite/g++.dg/opt/pr82159-2.C
+++ b/gcc/testsuite/g++.dg/opt/pr82159-2.C
@@ -1,6 +1,7 @@
 // PR c++/82159
 // { dg-do compile }
 // { dg-options "" }
+// { dg-additional-options "-Wno-return-type" }
 
 template <typename T> struct D { T e; };
 struct F : D<int[0]> {
diff --git a/gcc/testsuite/g++.dg/other/array3.C b/gcc/testsuite/g++.dg/other/array3.C
index ce3641e8ccd..3e6f7d1ad07 100644
--- a/gcc/testsuite/g++.dg/other/array3.C
+++ b/gcc/testsuite/g++.dg/other/array3.C
@@ -10,5 +10,6 @@ extern unsigned char xvalue_store[];
 bool reserve (int want)
 {
   new unsigned char[want];
+  return true;
 }
 unsigned char xvalue_store[257];
diff --git a/gcc/testsuite/g++.dg/other/crash-5.C b/gcc/testsuite/g++.dg/other/crash-5.C
index 25a70b7df36..81e5bac8a25 100644
--- a/gcc/testsuite/g++.dg/other/crash-5.C
+++ b/gcc/testsuite/g++.dg/other/crash-5.C
@@ -9,7 +9,7 @@ struct int_less_than {};
 
 void assert_fail (const char*);
 
-int f(const set<int, int_less_than>&)
+void f(const set<int, int_less_than>&)
 {
     assert_fail (__PRETTY_FUNCTION__);
 
diff --git a/gcc/testsuite/g++.dg/other/crash-8.C b/gcc/testsuite/g++.dg/other/crash-8.C
index dcae7da76c7..b7f56fc9bd7 100644
--- a/gcc/testsuite/g++.dg/other/crash-8.C
+++ b/gcc/testsuite/g++.dg/other/crash-8.C
@@ -97,6 +97,8 @@ public:
 
     mapped_type&       operator[](const key_type& __k)       {
         insert(value_type(__k, mapped_type()));
+	static mapped_type a;
+	return a;
     }
 
 };
diff --git a/gcc/testsuite/g++.dg/other/error34.C b/gcc/testsuite/g++.dg/other/error34.C
index f5ced1adfdc..f6b44888f48 100644
--- a/gcc/testsuite/g++.dg/other/error34.C
+++ b/gcc/testsuite/g++.dg/other/error34.C
@@ -2,5 +2,5 @@
 // { dg-do compile }
 // { dg-options "" }
 
-S () : str(__PRETTY_FUNCTION__) {}	// { dg-error "forbids declaration" "decl" }
+S () : str(__PRETTY_FUNCTION__) { return S(); }	// { dg-error "forbids declaration" "decl" }
 // { dg-error "only constructors" "constructor" { target *-*-* } .-1 }
diff --git a/gcc/testsuite/g++.dg/other/pr22003.C b/gcc/testsuite/g++.dg/other/pr22003.C
index 222ccac7beb..521e3f9b305 100644
--- a/gcc/testsuite/g++.dg/other/pr22003.C
+++ b/gcc/testsuite/g++.dg/other/pr22003.C
@@ -21,5 +21,6 @@ struct c3 : c1, c2
 
 c4* c3::func()
 {
+  return 0;
 }
 
diff --git a/gcc/testsuite/g++.dg/other/pr24623.C b/gcc/testsuite/g++.dg/other/pr24623.C
index 480bb39b63a..2a337756c2a 100644
--- a/gcc/testsuite/g++.dg/other/pr24623.C
+++ b/gcc/testsuite/g++.dg/other/pr24623.C
@@ -34,6 +34,8 @@ RefCountPointer (T * p = 0):_p (p)
 	if (_p != 0)
 	  _p->decrementRefCount ();
       }
+    static RefCountPointer a;
+    return a;
   }
   ~RefCountPointer ()
   {
diff --git a/gcc/testsuite/g++.dg/other/pr29610.C b/gcc/testsuite/g++.dg/other/pr29610.C
index 6566fb9a204..d68f4a15a07 100644
--- a/gcc/testsuite/g++.dg/other/pr29610.C
+++ b/gcc/testsuite/g++.dg/other/pr29610.C
@@ -6,7 +6,7 @@ struct __normal_iterator
   typedef int*const *_Iterator;
   int*const * _M_current;
   __normal_iterator(const _Iterator& __i) : _M_current(__i){}
-  const _Iterator& base() const {}
+  const _Iterator& base() const { static _Iterator a; return a; }
 };
 struct string { ~string(){} };
 struct vector 
@@ -26,9 +26,10 @@ inline int Painter::for_each(vector &layout, SliceWindowFunc func)
 {
     for (unsigned int window = 0; window < layout.size();++window)
         (this->*func)();
+    return 0;
 }
 int t;
-int Painter::redraw_window(void) {t = 1;}
+int Painter::redraw_window(void) {t = 1; return 0; }
 string t2(int);
 vector *g(const string&);
 void Painter::tcl_command(void)
diff --git a/gcc/testsuite/g++.dg/other/pr42645-1.C b/gcc/testsuite/g++.dg/other/pr42645-1.C
index 5dc76f9efd9..df93645721e 100644
--- a/gcc/testsuite/g++.dg/other/pr42645-1.C
+++ b/gcc/testsuite/g++.dg/other/pr42645-1.C
@@ -13,7 +13,7 @@ struct S
     T *t3;
   } t;
   int m1 () const { return t.t3[0].t1; }
-  char *m2 () { foo (); }
+  char *m2 () { foo (); return 0; }
   void m3 (int x) { char *m = m2 (); if (m1 () > 0 && x > 0); }
   void m4 () { if (m1 () > 0) for (int i = 0; i < 4; i++) t.t2[i] = 0; }
 };
diff --git a/gcc/testsuite/g++.dg/other/pr42645-2.C b/gcc/testsuite/g++.dg/other/pr42645-2.C
index 67632e51d91..20cce80f217 100644
--- a/gcc/testsuite/g++.dg/other/pr42645-2.C
+++ b/gcc/testsuite/g++.dg/other/pr42645-2.C
@@ -8,7 +8,7 @@ struct C
   C ();
 };
 
-static inline C *foo () {}
+static inline C *foo () { return 0; }
 
 extern void f4 ();
 
@@ -16,6 +16,7 @@ static inline int
 f3 ()
 {
   f4 ();
+  return 0;
 }
 
 static inline void
diff --git a/gcc/testsuite/g++.dg/other/pr52048.C b/gcc/testsuite/g++.dg/other/pr52048.C
index 6bf51f1e288..cf388a5a045 100644
--- a/gcc/testsuite/g++.dg/other/pr52048.C
+++ b/gcc/testsuite/g++.dg/other/pr52048.C
@@ -1,6 +1,7 @@
 // PR debug/52048
 // { dg-do compile }
 // { dg-options "-fcompare-debug -fnon-call-exceptions -fno-tree-dominator-opts -O2" }
+// { dg-additional-options "-Wno-return-type" }
 
 template <typename T> struct A;
 template <typename T>
diff --git a/gcc/testsuite/g++.dg/other/typedef3.C b/gcc/testsuite/g++.dg/other/typedef3.C
index 8ead5b84520..ed9aca2cf53 100644
--- a/gcc/testsuite/g++.dg/other/typedef3.C
+++ b/gcc/testsuite/g++.dg/other/typedef3.C
@@ -8,5 +8,5 @@ struct XalanCProcessor
           ParseOptionType getParseOption(void);
 };
 typedef XalanCProcessor::ParseOptionType ParseOptionType;
-ParseOptionType XalanCProcessor::getParseOption(void) {}
+ParseOptionType XalanCProcessor::getParseOption(void) { return ParseOptionType(); }
 
diff --git a/gcc/testsuite/g++.dg/overload/defarg4.C b/gcc/testsuite/g++.dg/overload/defarg4.C
index 3fa0751b7c0..65ad5821aa3 100644
--- a/gcc/testsuite/g++.dg/overload/defarg4.C
+++ b/gcc/testsuite/g++.dg/overload/defarg4.C
@@ -6,11 +6,11 @@ class foo
 {
  template<typename U>
  static bool func(const U& x)
- {}
+ { return true; }
 public:
  template<typename U>
  unsigned int Find(const U& x, bool (*pFunc) (const U&) = func) const
- {}
+ { return 0; }
 };
 
 class bar {
@@ -22,5 +22,6 @@ protected:
 bool bar::Initialize()
 {
         b.Find(b);
+	return false;
 }
 
diff --git a/gcc/testsuite/g++.dg/overload/operator5.C b/gcc/testsuite/g++.dg/overload/operator5.C
index 329775aa872..b90b0fd912e 100644
--- a/gcc/testsuite/g++.dg/overload/operator5.C
+++ b/gcc/testsuite/g++.dg/overload/operator5.C
@@ -8,7 +8,7 @@ class String {
    operator UnspecifiedBoolTypeA() const;
    operator UnspecifiedBoolTypeB() const;
 };
-inline bool equalIgnoringCase(const String& a, const String& b) { }
+inline bool equalIgnoringCase(const String& a, const String& b) { return true; }
 inline bool equalPossiblyIgnoringCase(const String& a, 
                                       const String& b,
                                       bool ignoreCase) {
diff --git a/gcc/testsuite/g++.dg/overload/ref-conv1.C b/gcc/testsuite/g++.dg/overload/ref-conv1.C
index 7e141141264..1c525fbc782 100644
--- a/gcc/testsuite/g++.dg/overload/ref-conv1.C
+++ b/gcc/testsuite/g++.dg/overload/ref-conv1.C
@@ -1,4 +1,5 @@
 // PR c++/50442
+// { dg-additional-options "-Wno-return-type" }
 
 template <typename T> struct MoveRef { operator T& () {} };
 template <typename T> MoveRef <T> Move(T&) {}
diff --git a/gcc/testsuite/g++.dg/overload/template5.C b/gcc/testsuite/g++.dg/overload/template5.C
index 8ff1b3d657c..902684059a8 100644
--- a/gcc/testsuite/g++.dg/overload/template5.C
+++ b/gcc/testsuite/g++.dg/overload/template5.C
@@ -6,7 +6,7 @@ int low(T a, T b, T c) { return a + b + c; } // { dg-message "template" }
 template<typename T>
 int high(T a, T b, T c) { return a + b + c; } // { dg-message "template" }
 
-int test (void)
+void test (void)
 {
   low (5, 6);			// { dg-error "no matching function" }
   // { dg-message "(candidate|3 arguments, 2 provided)" "" { target *-*-* } .-1 }
diff --git a/gcc/testsuite/g++.dg/parse/crash40.C b/gcc/testsuite/g++.dg/parse/crash40.C
index 537cdb78ef1..67322f3eb11 100644
--- a/gcc/testsuite/g++.dg/parse/crash40.C
+++ b/gcc/testsuite/g++.dg/parse/crash40.C
@@ -15,12 +15,12 @@ class AA
 struct BB : AA {};
 
 class AAA {
-  int get() const {}
+  int get() const { return 0; }
 };
 struct BBB {
   static BBB *foo();
 private:
-  int get() const {} /* { dg-message "private" } */
+  int get() const { return 1; } /* { dg-message "private" } */
 };
 template<bool> struct S {
   S(unsigned int = BBB::foo()->AAA::get()); /* { dg-error "is not a base of" } */
diff --git a/gcc/testsuite/g++.dg/parse/crash61.C b/gcc/testsuite/g++.dg/parse/crash61.C
index 790df0e4bc4..b2004b85173 100644
--- a/gcc/testsuite/g++.dg/parse/crash61.C
+++ b/gcc/testsuite/g++.dg/parse/crash61.C
@@ -1,5 +1,6 @@
 // PR c++/56241
 // { dg-do compile }
+// { dg-additional-options "-Wno-return-type" }
 
 struct pair { constexpr pair (const) : }; // { dg-error "" }
 template <0> make_pair () {}		  // { dg-error "" }
diff --git a/gcc/testsuite/g++.dg/parse/crash67.C b/gcc/testsuite/g++.dg/parse/crash67.C
index 51773ccef53..0befc9e2457 100644
--- a/gcc/testsuite/g++.dg/parse/crash67.C
+++ b/gcc/testsuite/g++.dg/parse/crash67.C
@@ -1,4 +1,5 @@
 // PR c++/79414
+// { dg-additional-options "-Wno-return-type" }
 
 class x0;
 template <x1> x2() {  // { dg-error "declared|type" }
diff --git a/gcc/testsuite/g++.dg/parse/ctor5.C b/gcc/testsuite/g++.dg/parse/ctor5.C
index f980b4a184f..917bfb06c34 100644
--- a/gcc/testsuite/g++.dg/parse/ctor5.C
+++ b/gcc/testsuite/g++.dg/parse/ctor5.C
@@ -1,4 +1,5 @@
 // PR c++/27309
+// { dg-additional-options "-Wno-return-type" }
 
 struct A
 {
diff --git a/gcc/testsuite/g++.dg/parse/defarg4.C b/gcc/testsuite/g++.dg/parse/defarg4.C
index bafdadb9429..151f6c5f668 100644
--- a/gcc/testsuite/g++.dg/parse/defarg4.C
+++ b/gcc/testsuite/g++.dg/parse/defarg4.C
@@ -19,6 +19,7 @@ struct R
 int Foo ()
 {
   R s (1);
+  return 0;
 }
 
 template <typename T> struct Q
@@ -29,4 +30,5 @@ template <typename T> struct Q
 int Foo (Q<int> *s)
 {
   s->Foo (1);
+  return 1;
 }
diff --git a/gcc/testsuite/g++.dg/parse/defarg6.C b/gcc/testsuite/g++.dg/parse/defarg6.C
index 827b605b77e..f73c2746cec 100644
--- a/gcc/testsuite/g++.dg/parse/defarg6.C
+++ b/gcc/testsuite/g++.dg/parse/defarg6.C
@@ -6,6 +6,6 @@
 
 namespace sc_dt {
     class sc_length_param {
-	friend int compare_unsigned(int if_v_signed = 0) {}
+	friend int compare_unsigned(int if_v_signed = 0) { return 0; }
     };
 }
diff --git a/gcc/testsuite/g++.dg/parse/error5.C b/gcc/testsuite/g++.dg/parse/error5.C
index d14a47664b8..576ae9fd09b 100644
--- a/gcc/testsuite/g++.dg/parse/error5.C
+++ b/gcc/testsuite/g++.dg/parse/error5.C
@@ -1,19 +1,19 @@
 // PR c++/13269
 // { dg-options "-fshow-column" }
+// { dg-additional-options "-Wno-return-type" }
 
 class Foo { int foo() return 0; } };
 
-// { dg-error "30:expected identifier before numeric constant" "identifier" { target *-*-* } 4 }
+// { dg-error "30:expected identifier before numeric constant" "identifier" { target *-*-* } 5 }
 
-// { dg-error "23:named return values are no longer supported" "named return" { target *-*-* } 4 }
+// { dg-error "23:named return values are no longer supported" "named return" { target *-*-* } 5 }
 
 // the column number info of this error output is still wrong because the error
 // message has been generated by cp_parser_error() which does not
 // necessarily allow accurate column number display. At some point, we will
 // need make cp_parser_error() report more accurate column numbers.
-// { dg-error "30:expected '\{' at end of input" "brace" { target *-*-* } 4 }
+// { dg-error "30:expected '\{' at end of input" "brace" { target *-*-* } 5 }
 
-// { dg-error "34:expected ';' after class definition" "semicolon" {target *-*-* } 4 }
-
-// { dg-error "35:expected declaration before '\}' token" "declaration" {target *-*-* } 4 }
+// { dg-error "34:expected ';' after class definition" "semicolon" {target *-*-* } 5 }
 
+// { dg-error "35:expected declaration before '\}' token" "declaration" {target *-*-* } 5 }
diff --git a/gcc/testsuite/g++.dg/parse/expr2.C b/gcc/testsuite/g++.dg/parse/expr2.C
index 32800e4f9cd..fb572e9408a 100644
--- a/gcc/testsuite/g++.dg/parse/expr2.C
+++ b/gcc/testsuite/g++.dg/parse/expr2.C
@@ -2,7 +2,7 @@ struct X {
   X(double *data, double d0, double d1);
 };
 
-int foo(double d0) {
+void foo(double d0) {
   double * data;
   X(data,d0,d0);
 }
diff --git a/gcc/testsuite/g++.dg/parse/friend7.C b/gcc/testsuite/g++.dg/parse/friend7.C
index 72ab430ef1b..7fc480f3ea0 100644
--- a/gcc/testsuite/g++.dg/parse/friend7.C
+++ b/gcc/testsuite/g++.dg/parse/friend7.C
@@ -1,5 +1,6 @@
 // PR c++/34488
 // { dg-do compile }
+// { dg-additional-options "-Wno-return-type" }
 
 struct A
 {
diff --git a/gcc/testsuite/g++.dg/parse/namespace1.C b/gcc/testsuite/g++.dg/parse/namespace1.C
index 7740bce2dc4..56697419253 100644
--- a/gcc/testsuite/g++.dg/parse/namespace1.C
+++ b/gcc/testsuite/g++.dg/parse/namespace1.C
@@ -2,6 +2,6 @@ namespace foo {
 void baz(int);
 }
 
-int bar(int foo) {
+void bar(int foo) {
   foo::baz (3);
 }
diff --git a/gcc/testsuite/g++.dg/parse/namespace9.C b/gcc/testsuite/g++.dg/parse/namespace9.C
index 7ff0267bff3..d5da5446a65 100644
--- a/gcc/testsuite/g++.dg/parse/namespace9.C
+++ b/gcc/testsuite/g++.dg/parse/namespace9.C
@@ -1,7 +1,7 @@
 namespace A {
   void f();
 }
-int g()
+void g()
 {
   struct f { };
   using A::f;
diff --git a/gcc/testsuite/g++.dg/parse/ret-type2.C b/gcc/testsuite/g++.dg/parse/ret-type2.C
index 4b7a0457edd..913c8fe0002 100644
--- a/gcc/testsuite/g++.dg/parse/ret-type2.C
+++ b/gcc/testsuite/g++.dg/parse/ret-type2.C
@@ -1,3 +1,5 @@
+// { dg-additional-options "-Wno-return-type" }
+
 struct S {} f(); // { dg-error "return" "err" }
 // { dg-message "note" "note" { target *-*-* } .-1 }
 struct T {} *g(); // { dg-error "return" }
diff --git a/gcc/testsuite/g++.dg/parse/typedef8.C b/gcc/testsuite/g++.dg/parse/typedef8.C
index 4c1823e87b9..60b8f39ee5e 100644
--- a/gcc/testsuite/g++.dg/parse/typedef8.C
+++ b/gcc/testsuite/g++.dg/parse/typedef8.C
@@ -5,7 +5,7 @@ typedef register int b; // { dg-error "conflicting" }
 typedef extern int c;   // { dg-error "conflicting" }
 static typedef int a;   // { dg-error "conflicting" }
 
-int foo()
+void foo()
 {
   typedef auto int bar; // { dg-error "conflicting|two or more data types" }
 }
diff --git a/gcc/testsuite/g++.dg/pch/static-1.C b/gcc/testsuite/g++.dg/pch/static-1.C
index 21e77898298..cd6d4111cc5 100644
--- a/gcc/testsuite/g++.dg/pch/static-1.C
+++ b/gcc/testsuite/g++.dg/pch/static-1.C
@@ -2,9 +2,11 @@
 int LocalStaticTest()
 {
         static A sa;
+	return 0;
 }
 
 int main(int argc, char **argv)
 {
         A::StaticTest();
+	return 0;
 }
diff --git a/gcc/testsuite/g++.dg/plugin/diagnostic-test-expressions-1.C b/gcc/testsuite/g++.dg/plugin/diagnostic-test-expressions-1.C
index a145dfea28c..8b6afeb052a 100644
--- a/gcc/testsuite/g++.dg/plugin/diagnostic-test-expressions-1.C
+++ b/gcc/testsuite/g++.dg/plugin/diagnostic-test-expressions-1.C
@@ -66,7 +66,7 @@ struct test_struct
   int field;
 };
 
-int test_structure_references (struct test_struct *ptr)
+void test_structure_references (struct test_struct *ptr)
 {
   struct test_struct local;
   local.field = 42;
@@ -84,7 +84,7 @@ int test_structure_references (struct test_struct *ptr)
    { dg-end-multiline-output "" } */
 }
 
-int test_postfix_incdec (int i)
+void test_postfix_incdec (int i)
 {
   __emit_expression_range (0, i++ ); /* { dg-warning "range" } */
 /* { dg-begin-multiline-output "" }
@@ -101,7 +101,7 @@ int test_postfix_incdec (int i)
 
 /* Unary operators.  ****************************************************/
 
-int test_sizeof (int i)
+void test_sizeof (int i)
 {
   __emit_expression_range (0, sizeof(int) + i); /* { dg-warning "range" } */
 /* { dg-begin-multiline-output "" }
@@ -128,7 +128,7 @@ int test_sizeof (int i)
    { dg-end-multiline-output "" } */
 }
 
-int test_alignof (int i)
+void test_alignof (int i)
 {
   __emit_expression_range (0, alignof(int) + i); /* { dg-warning "range" } */
 /* { dg-begin-multiline-output "" }
@@ -167,7 +167,7 @@ int test_alignof (int i)
    { dg-end-multiline-output "" } */
 }
 
-int test_prefix_incdec (int i)
+void test_prefix_incdec (int i)
 {
   __emit_expression_range (0, ++i ); /* { dg-warning "range" } */
 /* { dg-begin-multiline-output "" }
diff --git a/gcc/testsuite/g++.dg/plugin/dumb-plugin-test-1.C b/gcc/testsuite/g++.dg/plugin/dumb-plugin-test-1.C
index 70101c86826..404cd2124c0 100644
--- a/gcc/testsuite/g++.dg/plugin/dumb-plugin-test-1.C
+++ b/gcc/testsuite/g++.dg/plugin/dumb-plugin-test-1.C
@@ -26,7 +26,7 @@ struct Bar {
 int g = g;
 Foo foo = foo;
 
-int func()
+void func()
 {
   Bar *bar1, bar2;
   Foo local_foo;
diff --git a/gcc/testsuite/g++.dg/plugin/self-assign-test-1.C b/gcc/testsuite/g++.dg/plugin/self-assign-test-1.C
index 95d39dd0ce6..08bee09f0d5 100644
--- a/gcc/testsuite/g++.dg/plugin/self-assign-test-1.C
+++ b/gcc/testsuite/g++.dg/plugin/self-assign-test-1.C
@@ -26,7 +26,7 @@ struct Bar {
 int g = g; // { dg-warning "assigned to itself" }
 Foo foo = foo; // { dg-warning "assigned to itself" }
 
-int func()
+void func()
 {
   Bar *bar1, bar2;
   Foo local_foo;
diff --git a/gcc/testsuite/g++.dg/plugin/self-assign-test-2.C b/gcc/testsuite/g++.dg/plugin/self-assign-test-2.C
index da963c42db2..2c9d8cb7d0e 100644
--- a/gcc/testsuite/g++.dg/plugin/self-assign-test-2.C
+++ b/gcc/testsuite/g++.dg/plugin/self-assign-test-2.C
@@ -26,7 +26,7 @@ struct Bar {
 int g = g; // { dg-warning "assigned to itself" }
 Foo foo = foo; // { dg-warning "assigned to itself" }
 
-int func()
+void func()
 {
   Bar *bar1, bar2;
   Foo local_foo;
diff --git a/gcc/testsuite/g++.dg/plugin/self-assign-test-3.C b/gcc/testsuite/g++.dg/plugin/self-assign-test-3.C
index e5b354baff2..48a1aa4139c 100644
--- a/gcc/testsuite/g++.dg/plugin/self-assign-test-3.C
+++ b/gcc/testsuite/g++.dg/plugin/self-assign-test-3.C
@@ -26,7 +26,7 @@ struct Bar {
 int g = g; // { dg-bogus "assigned to itself" }
 Foo foo = foo; // { dg-bogus "assigned to itself" }
 
-int func()
+void func()
 {
   Bar *bar1, bar2;
   Foo local_foo;
diff --git a/gcc/testsuite/g++.dg/pr55513.C b/gcc/testsuite/g++.dg/pr55513.C
index 35c728d30a3..1c119e40ebd 100644
--- a/gcc/testsuite/g++.dg/pr55513.C
+++ b/gcc/testsuite/g++.dg/pr55513.C
@@ -1,11 +1,13 @@
 // { dg-do compile }
 // { dg-options "-O0 -fdump-tree-gimple" }
 
+int
 main ()
 {
   char s[10];
   const int t = (__builtin_memcpy (s, "Hello", 6), 777);
   __builtin_printf ("%d %s\n", t, s);
+  return 0;
 }
 
 // { dg-final { scan-tree-dump-times "memcpy" 1 "gimple" } }
diff --git a/gcc/testsuite/g++.dg/pr55604.C b/gcc/testsuite/g++.dg/pr55604.C
index f6fa3c0f42c..f67a1b4ef14 100644
--- a/gcc/testsuite/g++.dg/pr55604.C
+++ b/gcc/testsuite/g++.dg/pr55604.C
@@ -1,10 +1,12 @@
 /* { dg-do compile } */
 /* { dg-options "-O -fdump-rtl-reload" } */
 
+int
 main ()
 {
   char s[10];
   const int t = (__builtin_memcpy (s, "Hello", 6), 5);
   __builtin_printf ("%d %s\n", t, s);
+  return 0;
 }
 
diff --git a/gcc/testsuite/g++.dg/pr57662.C b/gcc/testsuite/g++.dg/pr57662.C
index bd5793dcaea..1592433d0d7 100644
--- a/gcc/testsuite/g++.dg/pr57662.C
+++ b/gcc/testsuite/g++.dg/pr57662.C
@@ -1,5 +1,6 @@
 /* { dg-do compile { target powerpc*-*-* ia64-*-* i?86-*-* x86_64-*-* } } */
 /* { dg-options "-O2 -fselective-scheduling2 -fsel-sched-pipelining" } */
+/* { dg-additional-options "-Wno-return-type" } */
 
 extern "C" {
 	typedef struct _IO_FILE FILE;
diff --git a/gcc/testsuite/g++.dg/pr58389.C b/gcc/testsuite/g++.dg/pr58389.C
index 648c145459b..8c98b67076b 100644
--- a/gcc/testsuite/g++.dg/pr58389.C
+++ b/gcc/testsuite/g++.dg/pr58389.C
@@ -51,4 +51,4 @@ inline void C::m_fn1() {
     sort(c, b, qt_notclosestLeaf);
   }
 }
-A F::m_fn1() const { const_cast<F *>(this)->d_ptr->m_fn1(); }
+A F::m_fn1() const { const_cast<F *>(this)->d_ptr->m_fn1(); return A(); }
diff --git a/gcc/testsuite/g++.dg/pr59510.C b/gcc/testsuite/g++.dg/pr59510.C
index dcdf860dcf7..4ac5becfd26 100644
--- a/gcc/testsuite/g++.dg/pr59510.C
+++ b/gcc/testsuite/g++.dg/pr59510.C
@@ -1,6 +1,7 @@
 // PR debug/59510
 // { dg-do compile }
 // { dg-options "-O2 -g --param=large-stack-frame-growth=1" }
+// { dg-additional-options "-Wno-return-type" }
 
 template <typename _Iterator>
 struct _Iter_base
diff --git a/gcc/testsuite/g++.dg/pr67989.C b/gcc/testsuite/g++.dg/pr67989.C
index c3023557d31..26748997fdd 100644
--- a/gcc/testsuite/g++.dg/pr67989.C
+++ b/gcc/testsuite/g++.dg/pr67989.C
@@ -1,5 +1,6 @@
 /* { dg-do compile } */
 /* { dg-options "-std=c++11 -O2" } */
+/* { dg-additional-options "-Wno-return-type" } */
 
 __extension__ typedef unsigned long long int uint64_t;
 namespace std __attribute__ ((__visibility__ ("default")))
diff --git a/gcc/testsuite/g++.dg/pr70590-2.C b/gcc/testsuite/g++.dg/pr70590-2.C
index 409c86eccd1..fd79dbfc883 100644
--- a/gcc/testsuite/g++.dg/pr70590-2.C
+++ b/gcc/testsuite/g++.dg/pr70590-2.C
@@ -8,13 +8,13 @@ constexpr int *foo = &a;
 
 void blah (int *);
 
-int
+void
 bar ()
 {
   blah (foo);
 }
 
-int
+void
 baz ()
 {
   blah (foo);
diff --git a/gcc/testsuite/g++.dg/pr70590.C b/gcc/testsuite/g++.dg/pr70590.C
index 488620065ee..28c455ab530 100644
--- a/gcc/testsuite/g++.dg/pr70590.C
+++ b/gcc/testsuite/g++.dg/pr70590.C
@@ -12,13 +12,13 @@ foo ()
 
 void blah (int *);
 
-int
+void
 bar ()
 {
   blah (foo ());
 }
 
-int
+void
 baz ()
 {
   blah (foo ());
diff --git a/gcc/testsuite/g++.dg/pr70965.C b/gcc/testsuite/g++.dg/pr70965.C
index d8a2c35e532..4b45789845f 100644
--- a/gcc/testsuite/g++.dg/pr70965.C
+++ b/gcc/testsuite/g++.dg/pr70965.C
@@ -14,7 +14,7 @@ template <typename> struct D
 extern template class D<char>;
 enum L { M };
 struct F { virtual char *foo (); };
-template <class> struct I : B { static int foo (int) {} };
+template <class> struct I : B { static int foo (int) { return 0; } };
 struct G { typedef I<int> t; };
 void foo (int) { G::t::foo (0); }
 void bar (const D<char> &, const D<int> &, int, L);
diff --git a/gcc/testsuite/g++.dg/pr77550.C b/gcc/testsuite/g++.dg/pr77550.C
index a1064737a67..9b31defd09c 100644
--- a/gcc/testsuite/g++.dg/pr77550.C
+++ b/gcc/testsuite/g++.dg/pr77550.C
@@ -235,7 +235,7 @@ template <typename, typename, typename> struct basic_string {
   basic_string() : _M_dataplus(0) {}
   basic_string(const basic_string &) : _M_dataplus(0) {}
   size_type size() { return _M_string_length; }
-  char *data() const {}
+  char *data() const { return 0; }
 };
 //template<> basic_string<char, std::char_traits<char>, std::allocator<char>>::
 //_Alloc_hider::_Alloc_hider(char*, std::allocator<char>&&) {}
diff --git a/gcc/testsuite/g++.dg/pr80287.C b/gcc/testsuite/g++.dg/pr80287.C
index da8d3fab150..d01e73371de 100644
--- a/gcc/testsuite/g++.dg/pr80287.C
+++ b/gcc/testsuite/g++.dg/pr80287.C
@@ -3,7 +3,7 @@
 // { dg-options "-g" }
 
 struct A {
-  operator long() {}
+  operator long() { return 0; }
 } __attribute__((__may_alias__));
 
 struct {
diff --git a/gcc/testsuite/g++.dg/pr80707.C b/gcc/testsuite/g++.dg/pr80707.C
index 4fe89335e31..b3848b0eb5f 100644
--- a/gcc/testsuite/g++.dg/pr80707.C
+++ b/gcc/testsuite/g++.dg/pr80707.C
@@ -26,4 +26,6 @@ int A::m_fn1(int &p1) const {
       p1 = 0;
     b--;
   }
+
+  return 0;
 }
diff --git a/gcc/testsuite/g++.dg/pr81194.C b/gcc/testsuite/g++.dg/pr81194.C
index 249fcf3b7c7..5f949389ec6 100644
--- a/gcc/testsuite/g++.dg/pr81194.C
+++ b/gcc/testsuite/g++.dg/pr81194.C
@@ -1,5 +1,6 @@
 // { dg-do compile }
 // { dg-options "-O2 -std=c++17 -fno-exceptions" }
+// { dg-additional-options "-Wno-return-type" }
 
 template <class a> struct b { typedef a *c; };
 class e {};
diff --git a/gcc/testsuite/g++.dg/spellcheck-identifiers.C b/gcc/testsuite/g++.dg/spellcheck-identifiers.C
index 08434399e6f..e4a606e2052 100644
--- a/gcc/testsuite/g++.dg/spellcheck-identifiers.C
+++ b/gcc/testsuite/g++.dg/spellcheck-identifiers.C
@@ -136,7 +136,7 @@ enum foo {
   FOO_SECOND
 };
 
-int
+void
 test_6 (enum foo f)
 {
   switch (f)
diff --git a/gcc/testsuite/g++.dg/tc1/dr152.C b/gcc/testsuite/g++.dg/tc1/dr152.C
index e787f8bcbfb..7d84d6afc1a 100644
--- a/gcc/testsuite/g++.dg/tc1/dr152.C
+++ b/gcc/testsuite/g++.dg/tc1/dr152.C
@@ -12,6 +12,7 @@ namespace N1 {
   { 
     X x; 
     f(x);     // { dg-error "matching" "matching" }
+    return 0;
   }
 }
 
@@ -30,6 +31,7 @@ namespace N2 {
   { 
     X<T> x; 
     N2::f(x);   // { dg-error "matching" "matching" }
+    return 0;
   }
 
   template int foo<float>();  // { dg-message "required from here" }
diff --git a/gcc/testsuite/g++.dg/template/aggr-init1.C b/gcc/testsuite/g++.dg/template/aggr-init1.C
index a09c7a79264..a7fe7c0441b 100644
--- a/gcc/testsuite/g++.dg/template/aggr-init1.C
+++ b/gcc/testsuite/g++.dg/template/aggr-init1.C
@@ -4,5 +4,5 @@ struct A {};
 struct B {
 	void *(*a)();
 };
-template <typename T> void *CreateA() {}
+template <typename T> void *CreateA() { return 0; }
 B b = {CreateA<A>};
diff --git a/gcc/testsuite/g++.dg/template/anon1.C b/gcc/testsuite/g++.dg/template/anon1.C
index ef73df6b39e..ff5c9ea1553 100644
--- a/gcc/testsuite/g++.dg/template/anon1.C
+++ b/gcc/testsuite/g++.dg/template/anon1.C
@@ -1,10 +1,10 @@
 struct x {
-    int foo () {}
+    int foo () { return 0; }
 };
 
 template <class T>
 struct vector {
-    T& bar () {}
+    T& bar () { static T a; return a; }
 };
 
 template <class T>
diff --git a/gcc/testsuite/g++.dg/template/array29.C b/gcc/testsuite/g++.dg/template/array29.C
index e43cb9d965a..f3eb95dc0aa 100644
--- a/gcc/testsuite/g++.dg/template/array29.C
+++ b/gcc/testsuite/g++.dg/template/array29.C
@@ -30,6 +30,7 @@ template <typename BaseT> struct D
          typename BaseT::callback_type p3)
   {
     p3.on_extended_iso_date ();
+    return char_type();
   }
 };
 struct F
diff --git a/gcc/testsuite/g++.dg/template/array7.C b/gcc/testsuite/g++.dg/template/array7.C
index 1fb130f9961..59364be33cf 100644
--- a/gcc/testsuite/g++.dg/template/array7.C
+++ b/gcc/testsuite/g++.dg/template/array7.C
@@ -6,6 +6,7 @@ template <unsigned N, unsigned M>
 int bar( const char(&val)[M] ) 
 { 
   foo (N,M); 
+  return 0;
 } 
  
 int i = bar<10>("1234"); 
diff --git a/gcc/testsuite/g++.dg/template/canon-type-8.C b/gcc/testsuite/g++.dg/template/canon-type-8.C
index fd1fe3ce362..b72bd0fb770 100644
--- a/gcc/testsuite/g++.dg/template/canon-type-8.C
+++ b/gcc/testsuite/g++.dg/template/canon-type-8.C
@@ -2,6 +2,7 @@
 // We were getting different canonical types for matching types because
 // TYPE_ALIGN wasn't propagated to all the variants fast enough.
 // { dg-options "" }
+// { dg-additional-options "-Wno-return-type" }
 
 typedef __SIZE_TYPE__ size_t;
 enum { chunk_size = 16 };
diff --git a/gcc/testsuite/g++.dg/template/conv1.C b/gcc/testsuite/g++.dg/template/conv1.C
index e0c7492034c..80c7becd665 100644
--- a/gcc/testsuite/g++.dg/template/conv1.C
+++ b/gcc/testsuite/g++.dg/template/conv1.C
@@ -16,8 +16,8 @@ template<class T> struct First
 };
 
 template <class T> int First<T>::Foo ()
-{} // This is here to make sure we didn't smash Foo's decl in the
-   // method vector
+{ return 0; } // This is here to make sure we didn't smash Foo's decl in the
+	      // method vector
 
 struct B { };
 struct D { };
diff --git a/gcc/testsuite/g++.dg/template/crash107.C b/gcc/testsuite/g++.dg/template/crash107.C
index d92ee3394e2..cecf9013244 100644
--- a/gcc/testsuite/g++.dg/template/crash107.C
+++ b/gcc/testsuite/g++.dg/template/crash107.C
@@ -1,6 +1,7 @@
 // PR c++/44625
 // { dg-do compile }
 // { dg-options "" }
+// { dg-additional-options "-Wno-return-type" }
 
 template<typename FP_> struct Vec { // { dg-message "note" }
     Vec& operator^=(Vec& rhs)     {
diff --git a/gcc/testsuite/g++.dg/template/crash23.C b/gcc/testsuite/g++.dg/template/crash23.C
index 0c3eac1acbf..b8dea99b4b1 100644
--- a/gcc/testsuite/g++.dg/template/crash23.C
+++ b/gcc/testsuite/g++.dg/template/crash23.C
@@ -1,7 +1,7 @@
 // PR c++/17642
 
 template<int dim>
-int f(const int* const lsh, const int* const bbox, const int* const nghostzones, int d)
+void f(const int* const lsh, const int* const bbox, const int* const nghostzones, int d)
 {
   for (int d=0; d<dim; ++d)
     lsh[d] - (bbox[2*d+1] ? 0 : nghostzones[d]);
diff --git a/gcc/testsuite/g++.dg/template/crash8.C b/gcc/testsuite/g++.dg/template/crash8.C
index a6f26b30679..b68cfcb4440 100644
--- a/gcc/testsuite/g++.dg/template/crash8.C
+++ b/gcc/testsuite/g++.dg/template/crash8.C
@@ -13,7 +13,7 @@ struct bar
   };
 
   template <typename U>
-  int wom(U c)
+  void wom(U c)
   {
     struct foo b;
   }
diff --git a/gcc/testsuite/g++.dg/template/defarg4.C b/gcc/testsuite/g++.dg/template/defarg4.C
index 293538adbd1..30711c22c0b 100644
--- a/gcc/testsuite/g++.dg/template/defarg4.C
+++ b/gcc/testsuite/g++.dg/template/defarg4.C
@@ -1,7 +1,7 @@
 // PR c++/14763
 
 struct A { 
-  int get() const {} 
+  int get() const { return 0; } 
   static A *foo(); 
 }; 
  
diff --git a/gcc/testsuite/g++.dg/template/dependent-expr9.C b/gcc/testsuite/g++.dg/template/dependent-expr9.C
index 7da060d4bb6..e5abc2525d3 100644
--- a/gcc/testsuite/g++.dg/template/dependent-expr9.C
+++ b/gcc/testsuite/g++.dg/template/dependent-expr9.C
@@ -6,5 +6,5 @@ public:
 };
 A *fn1(int *);
 template <typename> class B : A {
-  static int *m_fn2() { fn1(m_fn2())->m_fn1<A>(); }
+  static int *m_fn2() { fn1(m_fn2())->m_fn1<A>(); return 0; }
 };
diff --git a/gcc/testsuite/g++.dg/template/error10.C b/gcc/testsuite/g++.dg/template/error10.C
index 02ea64b7912..a61d22f1916 100644
--- a/gcc/testsuite/g++.dg/template/error10.C
+++ b/gcc/testsuite/g++.dg/template/error10.C
@@ -24,6 +24,7 @@ void B(void) {}
 int Btest()
 {
   B<256 >> 4>();
+  return 0;
 }
 
 template <int N = 123>>4>
diff --git a/gcc/testsuite/g++.dg/template/friend32.C b/gcc/testsuite/g++.dg/template/friend32.C
index 94bff37776f..278b4960602 100644
--- a/gcc/testsuite/g++.dg/template/friend32.C
+++ b/gcc/testsuite/g++.dg/template/friend32.C
@@ -18,4 +18,5 @@ template<class T> class B
 int f ()
 {
   B<int> b;			// { dg-message "required" }
+  return 0;
 }
diff --git a/gcc/testsuite/g++.dg/template/init6.C b/gcc/testsuite/g++.dg/template/init6.C
index 143746642fc..d5467023b5b 100644
--- a/gcc/testsuite/g++.dg/template/init6.C
+++ b/gcc/testsuite/g++.dg/template/init6.C
@@ -24,8 +24,10 @@ template<class T>
 Iter<typename Graph<T>::Node*> *Graph<T>::Inner::get() {
   SubIter<typename Graph<T>::Node*> *iter;
   iter->insert(0);
+  return 0;
 }
 
 int main() {
   Iter<Graph<int>::Node*> *n2_iter = new SubIter<Graph<int>::Node*>();
+  return 0;
 }
diff --git a/gcc/testsuite/g++.dg/template/memfriend7.C b/gcc/testsuite/g++.dg/template/memfriend7.C
index 2659a1a2191..e6bf12f9654 100644
--- a/gcc/testsuite/g++.dg/template/memfriend7.C
+++ b/gcc/testsuite/g++.dg/template/memfriend7.C
@@ -49,6 +49,7 @@ template <class T> int A<T*>::h()
 {
   C c;
   c.ii = 0;				// { dg-error "context" }
+  return 0;
 }
 
 template <class T> void A<T*>::i(char)
@@ -93,6 +94,7 @@ int A<char>::h()
 {
   C c;
   c.ii = 0;				// { dg-error "context" }
+  return 0;
 }
 
 void A<char>::i(char)
diff --git a/gcc/testsuite/g++.dg/template/new10.C b/gcc/testsuite/g++.dg/template/new10.C
index 98293ba5bd4..1a0c044c005 100644
--- a/gcc/testsuite/g++.dg/template/new10.C
+++ b/gcc/testsuite/g++.dg/template/new10.C
@@ -20,4 +20,5 @@ bool Analyzer::ReadDictionary( READER &reader )
     = ( number_of_composite_sequences + SequenceMapIndex( 1 ) )
     * ( number_of_composite_sequences + 1 );
   map_from_2_hints_to_composite_sequence.reset(new SequenceIndex[ntt]());
+  return true;
 }
diff --git a/gcc/testsuite/g++.dg/template/nontype12.C b/gcc/testsuite/g++.dg/template/nontype12.C
index b4bb41d109b..4ec22ef94e3 100644
--- a/gcc/testsuite/g++.dg/template/nontype12.C
+++ b/gcc/testsuite/g++.dg/template/nontype12.C
@@ -27,7 +27,7 @@ template<typename T> struct C
   template<T> int foo();                        // { dg-error "double" }
 };
 
-template<typename T> int baz(T) { C<T> c; }     // { dg-message "required" }
+template<typename T> int baz(T) { C<T> c; return 0;}  // { dg-message "required" }
 
 void foobar()
 {
diff --git a/gcc/testsuite/g++.dg/template/overload12.C b/gcc/testsuite/g++.dg/template/overload12.C
index 3251474bd6a..43898efebde 100644
--- a/gcc/testsuite/g++.dg/template/overload12.C
+++ b/gcc/testsuite/g++.dg/template/overload12.C
@@ -8,7 +8,7 @@ int foo(T a, T2& b, T2 c) {return a + b;}  // { dg-message "template" }
 int foo(char*, S&); // { dg-message "foo" }
 // { dg-message "candidate expects 2 arguments, 3 provided" "arity" { target *-*-* } .-1 }
 
-int foo2(int x)
+void foo2(int x)
 {
   S s={1,2};
   char c;
diff --git a/gcc/testsuite/g++.dg/template/overload5.C b/gcc/testsuite/g++.dg/template/overload5.C
index 8e520e92907..06075eca78f 100644
--- a/gcc/testsuite/g++.dg/template/overload5.C
+++ b/gcc/testsuite/g++.dg/template/overload5.C
@@ -24,5 +24,6 @@ int foo::f()
 
   f_obj<&foo::g> c;   // OK
   f_obj<foo::g>  d;   // OK
+  return 0;
 }
 
diff --git a/gcc/testsuite/g++.dg/template/overload8.C b/gcc/testsuite/g++.dg/template/overload8.C
index cc6a05b7041..4775db18d87 100644
--- a/gcc/testsuite/g++.dg/template/overload8.C
+++ b/gcc/testsuite/g++.dg/template/overload8.C
@@ -3,5 +3,5 @@
 struct A
 {
   template<int> void foo() {}
-  template<int> int foo() {}
+  template<int> int foo() { return 0; }
 };
diff --git a/gcc/testsuite/g++.dg/template/partial10.C b/gcc/testsuite/g++.dg/template/partial10.C
index 53a48fbac82..673baae2023 100644
--- a/gcc/testsuite/g++.dg/template/partial10.C
+++ b/gcc/testsuite/g++.dg/template/partial10.C
@@ -10,9 +10,10 @@
 template <class Fn> void def(Fn fn) {}
 
 template <class T1, class T2> T2 fn(T1, T2);
-template <class T1> int fn(T1) { }
+template <class T1> int fn(T1) { return 0; }
 
 int main()
 {
   def(fn<int>);
+  return 0;
 }
diff --git a/gcc/testsuite/g++.dg/template/partial9.C b/gcc/testsuite/g++.dg/template/partial9.C
index 4c340fc935d..8307c70883e 100644
--- a/gcc/testsuite/g++.dg/template/partial9.C
+++ b/gcc/testsuite/g++.dg/template/partial9.C
@@ -1,6 +1,6 @@
 // PR c++/36435
 
 template <class T> T f();
-template <class T> T* f() { }
+template <class T> T* f() { return 0; }
 
 template int* f();
diff --git a/gcc/testsuite/g++.dg/template/qual1.C b/gcc/testsuite/g++.dg/template/qual1.C
index 8fa79b3d2e7..7b20265eb9a 100644
--- a/gcc/testsuite/g++.dg/template/qual1.C
+++ b/gcc/testsuite/g++.dg/template/qual1.C
@@ -7,7 +7,7 @@ public:
   void sort (int (*compare) (T *const&,T *const&));
 };
 
-int shift_compare (int *const &, int *const &) {}
+int shift_compare (int *const &, int *const &) { return 0; }
 
 template<class T> void
 Link_array<T>::sort (int (*compare) (T *const&,T *const&)) 
diff --git a/gcc/testsuite/g++.dg/template/show-template-tree-3.C b/gcc/testsuite/g++.dg/template/show-template-tree-3.C
index 0eda40bcf77..7bb93ba4f60 100644
--- a/gcc/testsuite/g++.dg/template/show-template-tree-3.C
+++ b/gcc/testsuite/g++.dg/template/show-template-tree-3.C
@@ -9,6 +9,7 @@
    for that in this case).  */
 
 // { dg-options "-fdiagnostics-show-template-tree" }
+// { dg-additional-options "-Wno-return-type" }
 
 #include <map>
 #include <vector>
diff --git a/gcc/testsuite/g++.dg/template/sizeof8.C b/gcc/testsuite/g++.dg/template/sizeof8.C
index 861febc161c..bed68f9d16e 100644
--- a/gcc/testsuite/g++.dg/template/sizeof8.C
+++ b/gcc/testsuite/g++.dg/template/sizeof8.C
@@ -4,6 +4,6 @@
 
 template <int> struct S{};
 
-template <int N> S<sizeof(new double[N])> f() {}
+template <int N> S<sizeof(new double[N])> f() { return S<sizeof(new double[N])>(); }
 
 template S<sizeof(void*)> f<2>();
diff --git a/gcc/testsuite/g++.dg/template/sizeof9.C b/gcc/testsuite/g++.dg/template/sizeof9.C
index 8d9ec95ae1f..84400d3a364 100644
--- a/gcc/testsuite/g++.dg/template/sizeof9.C
+++ b/gcc/testsuite/g++.dg/template/sizeof9.C
@@ -2,5 +2,5 @@
 
 template<int N> struct X { char x[N]; };
 template<typename T> X<1 + sizeof(T) - sizeof(T)> F(T const &);
-template<int N> struct S { int d() { F(1); } };
+template<int N> struct S { int d() { F(1); return S(); } };
 
diff --git a/gcc/testsuite/g++.dg/template/spec6.C b/gcc/testsuite/g++.dg/template/spec6.C
index 915b8331252..fd41d7417c2 100644
--- a/gcc/testsuite/g++.dg/template/spec6.C
+++ b/gcc/testsuite/g++.dg/template/spec6.C
@@ -1,3 +1,5 @@
+// { dg-additional-options "-Wno-return-type" }
+
 template <bool, int> struct X {};
 
 template <bool C>    struct X<C,1> {
diff --git a/gcc/testsuite/g++.dg/template/spec7.C b/gcc/testsuite/g++.dg/template/spec7.C
index 18d3c90c45e..caf6b91d151 100644
--- a/gcc/testsuite/g++.dg/template/spec7.C
+++ b/gcc/testsuite/g++.dg/template/spec7.C
@@ -20,7 +20,7 @@ template<> template<> template <class V> void A<int>::B<char>::g(V)
 
 A<int>::B<char> b;
 
-int h()
+void h()
 {
   b.f();
   b.g(0);
diff --git a/gcc/testsuite/g++.dg/template/typedef8.C b/gcc/testsuite/g++.dg/template/typedef8.C
index f132606889b..b3178842172 100644
--- a/gcc/testsuite/g++.dg/template/typedef8.C
+++ b/gcc/testsuite/g++.dg/template/typedef8.C
@@ -1,4 +1,5 @@
 // PR c++/34206
+// { dg-additional-options "-Wno-return-type" }
 
 template<class _T1, class _T2> struct pair { };
 template <class T0, class T1> struct tuple {
diff --git a/gcc/testsuite/g++.dg/template/using20.C b/gcc/testsuite/g++.dg/template/using20.C
index 1df9549cd6c..cf180d21fe9 100644
--- a/gcc/testsuite/g++.dg/template/using20.C
+++ b/gcc/testsuite/g++.dg/template/using20.C
@@ -15,4 +15,5 @@ int f(void)
 {
   G<int> a;
   a.f();
+  return 0;
 }
diff --git a/gcc/testsuite/g++.dg/template/vla1.C b/gcc/testsuite/g++.dg/template/vla1.C
index fe93440f1f2..d873f2b0b06 100644
--- a/gcc/testsuite/g++.dg/template/vla1.C
+++ b/gcc/testsuite/g++.dg/template/vla1.C
@@ -5,5 +5,6 @@ template <bool>
 static int label (int w)
 {
   sizeof(int[w]);
+  return 0;
 }
 int a = label<false>(1);
diff --git a/gcc/testsuite/g++.dg/tm/cgraph_edge.C b/gcc/testsuite/g++.dg/tm/cgraph_edge.C
index d4c8f77fe89..b2649e8f521 100644
--- a/gcc/testsuite/g++.dg/tm/cgraph_edge.C
+++ b/gcc/testsuite/g++.dg/tm/cgraph_edge.C
@@ -1,5 +1,6 @@
 // { dg-do compile }
 // { dg-options "-fgnu-tm -O3" }
+// { dg-additional-options "-Wno-return-type" }
 
 template<typename _InputIterator, typename _Distance>  inline void advance(_InputIterator& __i, _Distance __n)
   {
diff --git a/gcc/testsuite/g++.dg/tm/pr46646.C b/gcc/testsuite/g++.dg/tm/pr46646.C
index 9431615b0fb..be378b0bd5c 100644
--- a/gcc/testsuite/g++.dg/tm/pr46646.C
+++ b/gcc/testsuite/g++.dg/tm/pr46646.C
@@ -1,5 +1,6 @@
 // { dg-do compile }
 // { dg-options "-fgnu-tm -O0"}
+// { dg-additional-options "-Wno-return-type" }
 
 namespace std __attribute__ ((__visibility__ ("default"))) {
   template<class _T1, class _T2>
diff --git a/gcc/testsuite/g++.dg/tm/pr47554.C b/gcc/testsuite/g++.dg/tm/pr47554.C
index 28841bb15ad..41222dcc47f 100644
--- a/gcc/testsuite/g++.dg/tm/pr47554.C
+++ b/gcc/testsuite/g++.dg/tm/pr47554.C
@@ -11,6 +11,8 @@ class list
 	}
 	const list&       _M_get_Node_allocator() const
 	{
+	  static list l;
+	  return l;
 	}
 	list       _M_get_Tp_allocator() const
 	{
diff --git a/gcc/testsuite/g++.dg/tm/pr47573.C b/gcc/testsuite/g++.dg/tm/pr47573.C
index 1fd26896c5d..7410533a5f5 100644
--- a/gcc/testsuite/g++.dg/tm/pr47573.C
+++ b/gcc/testsuite/g++.dg/tm/pr47573.C
@@ -25,4 +25,5 @@ template<typename _Alloc = allocator<char> > class basic_string
 int getStringHeight()
 {
 	basic_string<> tmp;
+	return 0;
 }
diff --git a/gcc/testsuite/g++.dg/tm/unsafe1.C b/gcc/testsuite/g++.dg/tm/unsafe1.C
index 91dd7b110ec..49dd564894a 100644
--- a/gcc/testsuite/g++.dg/tm/unsafe1.C
+++ b/gcc/testsuite/g++.dg/tm/unsafe1.C
@@ -4,7 +4,7 @@
 struct S {
   virtual ~S();
 };
-int f() transaction_safe {
+void f() transaction_safe {
   S s;		     // { dg-error "unsafe" "invocation of unsafe destructor" }
 }
 
diff --git a/gcc/testsuite/g++.dg/tm/unsafe2.C b/gcc/testsuite/g++.dg/tm/unsafe2.C
index 1b81b310057..b0425ac6cee 100644
--- a/gcc/testsuite/g++.dg/tm/unsafe2.C
+++ b/gcc/testsuite/g++.dg/tm/unsafe2.C
@@ -6,7 +6,7 @@ void f(T) transaction_safe;
 template<>
 void f(bool); // not transaction-safe
 
-int g() transaction_safe
+void g() transaction_safe
 {
   f(42);			// OK
   f(true);			// { dg-error "unsafe" }
diff --git a/gcc/testsuite/g++.dg/torture/20070621-1.C b/gcc/testsuite/g++.dg/torture/20070621-1.C
index 9bd8cc38c44..d8a6a76b6b0 100644
--- a/gcc/testsuite/g++.dg/torture/20070621-1.C
+++ b/gcc/testsuite/g++.dg/torture/20070621-1.C
@@ -1,4 +1,5 @@
 // { dg-do compile }
+// { dg-additional-options "-Wno-return-type" }
 /* Reduced from libstdc++-v3/testsuite/25_algorithms/equal/1.cc
 
 1.2.ii: In function 'void test1()':
diff --git a/gcc/testsuite/g++.dg/torture/20090329-1.C b/gcc/testsuite/g++.dg/torture/20090329-1.C
index 0274a1944e5..6839931a247 100644
--- a/gcc/testsuite/g++.dg/torture/20090329-1.C
+++ b/gcc/testsuite/g++.dg/torture/20090329-1.C
@@ -1,4 +1,5 @@
 /* { dg-do compile } */
+/* { dg-additional-options "-Wno-return-type" } */
 
 struct input_iterator_tag { };
 template<typename _Category, typename _Tp, typename _Distance = long, typename _Pointer = _Tp*, typename _Reference = _Tp&>
diff --git a/gcc/testsuite/g++.dg/torture/20141013.C b/gcc/testsuite/g++.dg/torture/20141013.C
index 82aacd6317e..e6c83ffab21 100644
--- a/gcc/testsuite/g++.dg/torture/20141013.C
+++ b/gcc/testsuite/g++.dg/torture/20141013.C
@@ -1,4 +1,5 @@
 /* { dg-options "-fno-short-enums" } */
+/* { dg-additional-options "-Wno-return-type" } */
 enum
 {
   _sch_isdigit = 0x0004,
diff --git a/gcc/testsuite/g++.dg/torture/pr33134.C b/gcc/testsuite/g++.dg/torture/pr33134.C
index 43482c7fc04..64e678c6a98 100644
--- a/gcc/testsuite/g++.dg/torture/pr33134.C
+++ b/gcc/testsuite/g++.dg/torture/pr33134.C
@@ -18,4 +18,5 @@ bool fxsaveGIF (FXStream &store)
   c1 = 0x80;
   c1 |= (bitsperpixel - 1) << 4;
   store << c1;
+  return true;
 }
diff --git a/gcc/testsuite/g++.dg/torture/pr33340.C b/gcc/testsuite/g++.dg/torture/pr33340.C
index bac882156b5..44d3c8e0d0f 100644
--- a/gcc/testsuite/g++.dg/torture/pr33340.C
+++ b/gcc/testsuite/g++.dg/torture/pr33340.C
@@ -1,4 +1,6 @@
-void* operator new(__SIZE_TYPE__, void* __p) { }
+// { dg-additional-options "-Wno-return-type" }
+
+void* operator new(__SIZE_TYPE__, void* __p) {}
 
 struct auto_ptr {
         int* p;
diff --git a/gcc/testsuite/g++.dg/torture/pr33627.C b/gcc/testsuite/g++.dg/torture/pr33627.C
index a14e345517f..9265bd95f05 100644
--- a/gcc/testsuite/g++.dg/torture/pr33627.C
+++ b/gcc/testsuite/g++.dg/torture/pr33627.C
@@ -10,9 +10,9 @@ class PX_ChangeRecord;
 class pf_Frag {
   public:
    typedef enum _PFType { PFT_Object } PFType;
-   inline PFType getType(void) const { }
-   inline pf_Frag * getNext(void) const { }
-   PT_DocPosition getPos(void) const { }
+   inline PFType getType(void) const { return PFType(); }
+   inline pf_Frag * getNext(void) const { return 0; }
+   PT_DocPosition getPos(void) const { return PT_DocPosition(); }
 };
 class pf_Fragments {
   public:
diff --git a/gcc/testsuite/g++.dg/torture/pr34222.C b/gcc/testsuite/g++.dg/torture/pr34222.C
index 130896dc9da..dfcb5d7a952 100644
--- a/gcc/testsuite/g++.dg/torture/pr34222.C
+++ b/gcc/testsuite/g++.dg/torture/pr34222.C
@@ -47,6 +47,7 @@ using namespace std;
 static float readFloat(ifstream& in) {
       float f;
       in.read((char*) &f, sizeof(float));
+      return f;
   }
 Mat4f readMeshMatrix(ifstream& in, int nBytes) {
       float m00 = readFloat(in);
diff --git a/gcc/testsuite/g++.dg/torture/pr34241.C b/gcc/testsuite/g++.dg/torture/pr34241.C
index 70f186c5b9f..0ea9cfc1a0c 100644
--- a/gcc/testsuite/g++.dg/torture/pr34241.C
+++ b/gcc/testsuite/g++.dg/torture/pr34241.C
@@ -15,4 +15,5 @@ struct A
 A test ()
 {
   const A a (42, true);
+  return a;
 }
diff --git a/gcc/testsuite/g++.dg/torture/pr34641.C b/gcc/testsuite/g++.dg/torture/pr34641.C
index 0cf50776281..72a98ad8f46 100644
--- a/gcc/testsuite/g++.dg/torture/pr34641.C
+++ b/gcc/testsuite/g++.dg/torture/pr34641.C
@@ -2,6 +2,7 @@
 // { dg-require-effective-target fpic }
 // { dg-require-visibility "" }
 // { dg-options "-fPIC" }
+/* { dg-additional-options "-Wno-return-type" } */
 
 
 typedef __SIZE_TYPE__ size_t;
diff --git a/gcc/testsuite/g++.dg/torture/pr34850.C b/gcc/testsuite/g++.dg/torture/pr34850.C
index c2538288964..e41620b739d 100644
--- a/gcc/testsuite/g++.dg/torture/pr34850.C
+++ b/gcc/testsuite/g++.dg/torture/pr34850.C
@@ -1,6 +1,7 @@
 /* { dg-do compile } */
 /* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
 /* { dg-options "-ffat-lto-objects" } */
+/* { dg-additional-options "-Wno-return-type" } */
 
 typedef unsigned char uint8_t;
 typedef unsigned int uint32_t;
@@ -12,9 +13,7 @@ extern "C" {
     extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__gnu_inline__, __artificial__))
     void * memset (void *__dest, int __ch, size_t __len) throw () {
 	if (__builtin_constant_p (__len) && __len == 0)
-	    __warn_memset_zero_len (); /* { dg-warning "declared with attribute warning" } */
-
-	return __dest;
+	    __warn_memset_zero_len ();
     }
 }
 inline void clear_mem(void* ptr, u32bit n)    {
@@ -52,13 +51,11 @@ template<typename T> class SecureVector : public MemoryRegion<T>    {
 public:
     SecureVector<T>& operator=(const MemoryRegion<T>& in)          {
 	if(this != &in) this->set(in);
-	return *this;
     }
 };
 class OctetString    {
 public:
     SecureVector<byte> bits_of() const {
-	return SecureVector<byte> ();
     }
     OctetString& operator^=(const OctetString&);
     void change(const MemoryRegion<byte>& in) {
@@ -73,8 +70,6 @@ OctetString& OctetString::operator^=(const OctetString& k)    {
     if(&k == this) {
 	bits.clear();
     }
-
-    return *this;
 }
 bool __attribute__((flatten))
 operator==(const OctetString& s1, const OctetString& s2)    {
diff --git a/gcc/testsuite/g++.dg/torture/pr35164-1.C b/gcc/testsuite/g++.dg/torture/pr35164-1.C
index 1704c222656..faa829f5f6f 100644
--- a/gcc/testsuite/g++.dg/torture/pr35164-1.C
+++ b/gcc/testsuite/g++.dg/torture/pr35164-1.C
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-Wno-return-type" } */
+
 typedef __SIZE_TYPE__ size_t;
 template<typename _Iterator, typename _Container> class __normal_iterator {
 public:
diff --git a/gcc/testsuite/g++.dg/torture/pr36745.C b/gcc/testsuite/g++.dg/torture/pr36745.C
index 53845aaa78e..56fa9d8028d 100644
--- a/gcc/testsuite/g++.dg/torture/pr36745.C
+++ b/gcc/testsuite/g++.dg/torture/pr36745.C
@@ -1,6 +1,7 @@
 /* PR target/36745 */
 /* { dg-do compile } */
 /* { dg-options "-O2 -fPIC" } */
+/* { dg-additional-options "-Wno-return-type" } */
 /* { dg-require-effective-target fpic } */
 
 typedef __SIZE_TYPE__ size_t;
diff --git a/gcc/testsuite/g++.dg/torture/pr38705.C b/gcc/testsuite/g++.dg/torture/pr38705.C
index 8058d3a3979..07dec5594ca 100644
--- a/gcc/testsuite/g++.dg/torture/pr38705.C
+++ b/gcc/testsuite/g++.dg/torture/pr38705.C
@@ -24,4 +24,5 @@ S::bar () const
 {
   foo (u);
   foo (t);
+  return 0;
 }
diff --git a/gcc/testsuite/g++.dg/torture/pr38811.C b/gcc/testsuite/g++.dg/torture/pr38811.C
index e9b304da6e5..5ced0781497 100644
--- a/gcc/testsuite/g++.dg/torture/pr38811.C
+++ b/gcc/testsuite/g++.dg/torture/pr38811.C
@@ -17,7 +17,7 @@ public:
     AbcExtent2d(const AbcA2d & rMin, const AbcA2d & rMax);
     AbcA2d ClampPoint2d(const AbcA2d & rPoint) const;
     AbcA2d GetMax() const { return m_vMax; }
-    AbcA2d GetMin() const { }
+    AbcA2d GetMin() const { return AbcA2d(); }
     AbcA2d Evaluate(double dNormalizedX, double dNormalizedY) const;
 };
 inline AbcExtent2d::AbcExtent2d(const AbcA2d & rMin, const AbcA2d & rMax)
@@ -69,5 +69,7 @@ long AbcAbcdTracer::TestIsoAbcde(AbcZyParamType eZyParam, double dParam,
         if (!DoesPointLieOnAbcde(sUV,0))
           ;
       }
+
+    return 0;
 }
 
diff --git a/gcc/testsuite/g++.dg/torture/pr39362.C b/gcc/testsuite/g++.dg/torture/pr39362.C
index 554f9d06bac..6599fdd70c0 100644
--- a/gcc/testsuite/g++.dg/torture/pr39362.C
+++ b/gcc/testsuite/g++.dg/torture/pr39362.C
@@ -1,4 +1,5 @@
 /* { dg-do compile } */
+/* { dg-additional-options "-Wno-return-type" } */
 
 void *fastMalloc (int n);
 void fastFree (void *p);
diff --git a/gcc/testsuite/g++.dg/torture/pr39732.C b/gcc/testsuite/g++.dg/torture/pr39732.C
index 4b3975b8db9..44edbf5ba90 100644
--- a/gcc/testsuite/g++.dg/torture/pr39732.C
+++ b/gcc/testsuite/g++.dg/torture/pr39732.C
@@ -27,4 +27,5 @@ int f(void)
 {
   basic_ostream<char, char_traits<char> > os;
   copy(ostream_iterator<const int>(os, ","));
+  return 0;
 }
diff --git a/gcc/testsuite/g++.dg/torture/pr40991.C b/gcc/testsuite/g++.dg/torture/pr40991.C
index c08124024a7..bce5f7e6893 100644
--- a/gcc/testsuite/g++.dg/torture/pr40991.C
+++ b/gcc/testsuite/g++.dg/torture/pr40991.C
@@ -1,4 +1,5 @@
 /* { dg-options "-std=gnu++0x" } */
+/* { dg-additional-options "-Wno-return-type" } */
 
 typedef __SIZE_TYPE__ size_t;
 namespace std __attribute__ ((__visibility__ ("default"))) {
diff --git a/gcc/testsuite/g++.dg/torture/pr41775.C b/gcc/testsuite/g++.dg/torture/pr41775.C
index 3d8548e3fb0..ca24abd0229 100644
--- a/gcc/testsuite/g++.dg/torture/pr41775.C
+++ b/gcc/testsuite/g++.dg/torture/pr41775.C
@@ -1,4 +1,5 @@
 /* { dg-do compile } */
+/* { dg-additional-options "-Wno-return-type" } */
 /* { dg-require-visibility "" } */
 
 typedef unsigned int size_t;
diff --git a/gcc/testsuite/g++.dg/torture/pr42183.C b/gcc/testsuite/g++.dg/torture/pr42183.C
index 375b37f0c66..2ae415f0b5a 100644
--- a/gcc/testsuite/g++.dg/torture/pr42183.C
+++ b/gcc/testsuite/g++.dg/torture/pr42183.C
@@ -1,4 +1,5 @@
 // { dg-do compile }
+// { dg-additional-options "-Wno-return-type" }
 
 class IntSize {
 public:
diff --git a/gcc/testsuite/g++.dg/torture/pr42450.C b/gcc/testsuite/g++.dg/torture/pr42450.C
index f630fa2b7e2..5813acb5cb4 100644
--- a/gcc/testsuite/g++.dg/torture/pr42450.C
+++ b/gcc/testsuite/g++.dg/torture/pr42450.C
@@ -1,4 +1,5 @@
 /* { dg-do compile } */
+// { dg-additional-options "-Wno-return-type" }
 
 template < typename > class basic_stringstream;
 
diff --git a/gcc/testsuite/g++.dg/torture/pr42704.C b/gcc/testsuite/g++.dg/torture/pr42704.C
index 735b1e7bdea..d1cbc8225cd 100644
--- a/gcc/testsuite/g++.dg/torture/pr42704.C
+++ b/gcc/testsuite/g++.dg/torture/pr42704.C
@@ -1,4 +1,5 @@
 /* { dg-do compile } */
+/* { dg-additional-options "-Wno-return-type" } */
 
 typedef int PRInt32;
 class nsTreeRows {
diff --git a/gcc/testsuite/g++.dg/torture/pr42760.C b/gcc/testsuite/g++.dg/torture/pr42760.C
index be85f7fc408..084fcfdfa68 100644
--- a/gcc/testsuite/g++.dg/torture/pr42760.C
+++ b/gcc/testsuite/g++.dg/torture/pr42760.C
@@ -16,6 +16,7 @@ baz (T x, T y, U z)
       *z = *x;
       ++z;
     }
+  return U();
 };
 
 template <typename T, typename U>
@@ -23,6 +24,7 @@ U
 bar (T x, T y, U z)
 {
   baz (A <T>::b (x), A <T>::b (y), A <U>::b (z));
+  return U();
 }
 
 struct C
diff --git a/gcc/testsuite/g++.dg/torture/pr42773.C b/gcc/testsuite/g++.dg/torture/pr42773.C
index 478ad278aa6..5d887cefed1 100644
--- a/gcc/testsuite/g++.dg/torture/pr42773.C
+++ b/gcc/testsuite/g++.dg/torture/pr42773.C
@@ -51,4 +51,5 @@ class Cell {
 };
 QValueList<Cell*> Cell::obscuringCells() const {
     QValueList<Cell*> empty;
+    return QValueList<Cell*>();
 }
diff --git a/gcc/testsuite/g++.dg/torture/pr42883.C b/gcc/testsuite/g++.dg/torture/pr42883.C
index f164c3781f5..ad2ae251637 100644
--- a/gcc/testsuite/g++.dg/torture/pr42883.C
+++ b/gcc/testsuite/g++.dg/torture/pr42883.C
@@ -1,4 +1,5 @@
 // { dg-do compile }
+// { dg-additional-options "-Wno-return-type" }
 
 typedef __SIZE_TYPE__ size_t;
 namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
diff --git a/gcc/testsuite/g++.dg/torture/pr43905.C b/gcc/testsuite/g++.dg/torture/pr43905.C
index 0e49a32a1dd..259ea785041 100644
--- a/gcc/testsuite/g++.dg/torture/pr43905.C
+++ b/gcc/testsuite/g++.dg/torture/pr43905.C
@@ -2,9 +2,11 @@ extern void sf ( __const char *);
 struct Matrix{
   int operator[](int n){
     sf ( __PRETTY_FUNCTION__);
+    return 0;
   }
   int operator[](int n)const{
     sf ( __PRETTY_FUNCTION__);
+    return 0;
   }
 };
 void calcmy(Matrix const &b, Matrix &c, int k){
diff --git a/gcc/testsuite/g++.dg/torture/pr44148.C b/gcc/testsuite/g++.dg/torture/pr44148.C
index a60ba9aa3a6..cebfccba5d6 100644
--- a/gcc/testsuite/g++.dg/torture/pr44148.C
+++ b/gcc/testsuite/g++.dg/torture/pr44148.C
@@ -2,6 +2,7 @@
 // { dg-do compile }
 // { dg-options "" }
 // { dg-options "-fpic" { target fpic } }
+// { dg-additional-options "-Wno-return-type" }
 
 template <typename T> struct S2
 {
diff --git a/gcc/testsuite/g++.dg/torture/pr44295.C b/gcc/testsuite/g++.dg/torture/pr44295.C
index 8169bb0a873..7525dc41a78 100644
--- a/gcc/testsuite/g++.dg/torture/pr44295.C
+++ b/gcc/testsuite/g++.dg/torture/pr44295.C
@@ -1,4 +1,6 @@
 /* { dg-do compile } */
+/* { dg-additional-options "-Wno-return-type" } */
+
 extern "C" {
   typedef __SIZE_TYPE__ size_t;
   typedef struct   {
diff --git a/gcc/testsuite/g++.dg/torture/pr44357.C b/gcc/testsuite/g++.dg/torture/pr44357.C
index 3380350e81b..2ffb6d07f7e 100644
--- a/gcc/testsuite/g++.dg/torture/pr44357.C
+++ b/gcc/testsuite/g++.dg/torture/pr44357.C
@@ -1,4 +1,6 @@
 /* { dg-do compile } */
+/* { dg-additional-options "-Wno-return-type" } */
+
 extern "C"
 {
   typedef long unsigned int size_t;
diff --git a/gcc/testsuite/g++.dg/torture/pr44813.C b/gcc/testsuite/g++.dg/torture/pr44813.C
index 1dc01b06a17..6ec1b60adc4 100644
--- a/gcc/testsuite/g++.dg/torture/pr44813.C
+++ b/gcc/testsuite/g++.dg/torture/pr44813.C
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-Wno-return-type" } */
+
 typedef unsigned int PRUint32;
 typedef int PRInt32;
 typedef unsigned long PRUint64;
diff --git a/gcc/testsuite/g++.dg/torture/pr45580.C b/gcc/testsuite/g++.dg/torture/pr45580.C
index c3af4910aeb..5728c0382bb 100644
--- a/gcc/testsuite/g++.dg/torture/pr45580.C
+++ b/gcc/testsuite/g++.dg/torture/pr45580.C
@@ -1,4 +1,5 @@
 // { dg-do compile }
+// { dg-additional-options "-Wno-return-type" }
 
 namespace std {
     typedef __SIZE_TYPE__ size_t;
diff --git a/gcc/testsuite/g++.dg/torture/pr45874.C b/gcc/testsuite/g++.dg/torture/pr45874.C
index 70965ff574e..37c2ccc8a3a 100644
--- a/gcc/testsuite/g++.dg/torture/pr45874.C
+++ b/gcc/testsuite/g++.dg/torture/pr45874.C
@@ -48,6 +48,7 @@ Status Mpeg2FrameConstructor::ParsePictureHeader(Ipp8u *buf, Ipp32s iLen, Mpeg2T
 	    bs.SkipBits(10);
 	}
     }
+    return Status();
 }
 void BitstreamReader::SkipBits(Ipp32s iNum) {
     if (iNum <= m_iReadyBits)     {
diff --git a/gcc/testsuite/g++.dg/torture/pr45877.C b/gcc/testsuite/g++.dg/torture/pr45877.C
index 9af6ae99985..1754fb5cb5c 100644
--- a/gcc/testsuite/g++.dg/torture/pr45877.C
+++ b/gcc/testsuite/g++.dg/torture/pr45877.C
@@ -1,4 +1,5 @@
 // { dg-do compile }
+// { dg-additional-options "-Wno-return-type" }
 
 namespace std __attribute__ ((__visibility__ ("default")))
 {
diff --git a/gcc/testsuite/g++.dg/torture/pr46383.C b/gcc/testsuite/g++.dg/torture/pr46383.C
index e4810c5ada8..ee00f358ea2 100644
--- a/gcc/testsuite/g++.dg/torture/pr46383.C
+++ b/gcc/testsuite/g++.dg/torture/pr46383.C
@@ -1,4 +1,5 @@
 // { dg-do compile }
+// { dg-additional-options "-Wno-return-type" }
 
 namespace std {
 template<class,class>struct pair{};
diff --git a/gcc/testsuite/g++.dg/torture/pr46469.C b/gcc/testsuite/g++.dg/torture/pr46469.C
index 8212ea4f9e2..c16a0f277a7 100644
--- a/gcc/testsuite/g++.dg/torture/pr46469.C
+++ b/gcc/testsuite/g++.dg/torture/pr46469.C
@@ -1,5 +1,6 @@
 extern "C"  __inline __attribute__ ((__gnu_inline__)) int pthread_equal ()
   {
+    return 0;
   }
 
 static
@@ -10,4 +11,5 @@ static
 int identifierByPthreadHandle ()
 {
   pthread_equal ();
+  return 0;
 }
diff --git a/gcc/testsuite/g++.dg/torture/pr47313.C b/gcc/testsuite/g++.dg/torture/pr47313.C
index c10f558a3eb..787445ed595 100644
--- a/gcc/testsuite/g++.dg/torture/pr47313.C
+++ b/gcc/testsuite/g++.dg/torture/pr47313.C
@@ -1,4 +1,5 @@
 // { dg-do compile }
+// { dg-additional-options "-Wno-return-type" }
 
 namespace internal {
     template < class DSC, bool Const >   struct CC_iterator   {
diff --git a/gcc/testsuite/g++.dg/torture/pr48271.C b/gcc/testsuite/g++.dg/torture/pr48271.C
index 5b60ccd768c..2e3eb5bfd05 100644
--- a/gcc/testsuite/g++.dg/torture/pr48271.C
+++ b/gcc/testsuite/g++.dg/torture/pr48271.C
@@ -1,5 +1,6 @@
 // { dg-do compile }
 // { dg-options "-ftree-vrp -fno-guess-branch-probability -fnon-call-exceptions" }
+// { dg-additional-options "-Wno-return-type" }
 
 void *xalloc ();
 void xfree (void *);
diff --git a/gcc/testsuite/g++.dg/torture/pr49615.C b/gcc/testsuite/g++.dg/torture/pr49615.C
index 98a2f95b8b3..bc5182b2716 100644
--- a/gcc/testsuite/g++.dg/torture/pr49615.C
+++ b/gcc/testsuite/g++.dg/torture/pr49615.C
@@ -5,6 +5,7 @@ template <class T>
 static inline bool Dispatch (T* obj, void (T::*func) ())
 {
   (obj->*func) ();
+  return true;
 }
 class C
 {
@@ -21,6 +22,8 @@ bool C::f (int n)
       case 1:
 	  b = Dispatch (this, &C::g);
     }
+
+  return true;
 }
 void C::g ()
 {
diff --git a/gcc/testsuite/g++.dg/torture/pr49770.C b/gcc/testsuite/g++.dg/torture/pr49770.C
index 7eac9e0d9bb..794bf3dba19 100644
--- a/gcc/testsuite/g++.dg/torture/pr49770.C
+++ b/gcc/testsuite/g++.dg/torture/pr49770.C
@@ -79,8 +79,10 @@ test01 ()
     __builtin_abort ();
 }
 
+int
 main ()
 {
   test01 ();
+  return 0;
 }
 
diff --git a/gcc/testsuite/g++.dg/torture/pr49938.C b/gcc/testsuite/g++.dg/torture/pr49938.C
index 91804f4b0d5..d2c73e73871 100644
--- a/gcc/testsuite/g++.dg/torture/pr49938.C
+++ b/gcc/testsuite/g++.dg/torture/pr49938.C
@@ -43,6 +43,8 @@ namespace net {
 	}
 	scoped_array<unsigned char> signed_data(new unsigned
 						char[signed_data_len]);
+
+	return true;
       }
 }
 
diff --git a/gcc/testsuite/g++.dg/torture/pr51436.C b/gcc/testsuite/g++.dg/torture/pr51436.C
index 43d6c730032..b01a33ca243 100644
--- a/gcc/testsuite/g++.dg/torture/pr51436.C
+++ b/gcc/testsuite/g++.dg/torture/pr51436.C
@@ -1,4 +1,5 @@
 /* { dg-do compile } */
+/* { dg-additional-options "-Wno-return-type" } */
 
 typedef __SIZE_TYPE__ size_t;
 extern "C" void *memcpy (void *, __const void *, size_t);
diff --git a/gcc/testsuite/g++.dg/torture/pr51482.C b/gcc/testsuite/g++.dg/torture/pr51482.C
index 28435919f46..4032703f720 100644
--- a/gcc/testsuite/g++.dg/torture/pr51482.C
+++ b/gcc/testsuite/g++.dg/torture/pr51482.C
@@ -27,4 +27,5 @@ WVECT * anim_track_bez_wvect::tangent(int kn, BEZIER_KEY_CLASS key_class, WVECT
   p_tn->y = (g1.y + g3.y*bp1)*tn1;
   p_tn->z = (g1.z + g3.z*bp1)*tn1;
   p_tn->w = (g1.w + g3.w*bp1)*tn1;
+  return 0;
 }
diff --git a/gcc/testsuite/g++.dg/torture/pr51737.C b/gcc/testsuite/g++.dg/torture/pr51737.C
index ff77edbf3d3..90edafffc88 100644
--- a/gcc/testsuite/g++.dg/torture/pr51737.C
+++ b/gcc/testsuite/g++.dg/torture/pr51737.C
@@ -20,6 +20,7 @@ struct id_state {
 };
 void * id_state::start_file(void) {
     intrusive_ptr<file_info> parent;
+    return 0;
 }
 struct id_generation_data : intrusive_base<id_generation_data> {
     void child_length() const {}
diff --git a/gcc/testsuite/g++.dg/torture/pr51959.C b/gcc/testsuite/g++.dg/torture/pr51959.C
index da0be71ebd8..1c98f4f6cc8 100644
--- a/gcc/testsuite/g++.dg/torture/pr51959.C
+++ b/gcc/testsuite/g++.dg/torture/pr51959.C
@@ -1,4 +1,5 @@
 // { dg-do compile }
+// { dg-additional-options "-Wno-return-type" }
 
 namespace std {
     typedef __SIZE_TYPE__ size_t;
diff --git a/gcc/testsuite/g++.dg/torture/pr52772.C b/gcc/testsuite/g++.dg/torture/pr52772.C
index 810e6579fba..0109f137676 100644
--- a/gcc/testsuite/g++.dg/torture/pr52772.C
+++ b/gcc/testsuite/g++.dg/torture/pr52772.C
@@ -46,7 +46,7 @@ class c5 : public c2 {
 };
 
 class c6 {
-  public: int get() const {};
+  public: int get() const { return 0; };
 };
 
 class c7 {
diff --git a/gcc/testsuite/g++.dg/torture/pr52918-2.C b/gcc/testsuite/g++.dg/torture/pr52918-2.C
index ba31295e41e..185444bdd0e 100644
--- a/gcc/testsuite/g++.dg/torture/pr52918-2.C
+++ b/gcc/testsuite/g++.dg/torture/pr52918-2.C
@@ -37,4 +37,5 @@ void * __cxa_allocate_exception(size_t thrown_size) throw()
   void *ret;
   if (! ret)     
     __scoped_lock sentry(emergency_mutex);
+  return 0;
 }
diff --git a/gcc/testsuite/g++.dg/torture/pr53011.C b/gcc/testsuite/g++.dg/torture/pr53011.C
index 2cd8a60332d..4882f23b19e 100644
--- a/gcc/testsuite/g++.dg/torture/pr53011.C
+++ b/gcc/testsuite/g++.dg/torture/pr53011.C
@@ -1,4 +1,5 @@
 // { dg-do compile }
+// { dg-additional-options "-Wno-return-type" }
 
 extern "C" class WvFastString;
 typedef WvFastString& WvStringParm;
diff --git a/gcc/testsuite/g++.dg/torture/pr53602.C b/gcc/testsuite/g++.dg/torture/pr53602.C
index 1bb9cf4faaf..67d9ed848f0 100644
--- a/gcc/testsuite/g++.dg/torture/pr53602.C
+++ b/gcc/testsuite/g++.dg/torture/pr53602.C
@@ -1,5 +1,6 @@
 // { dg-do compile }
 // { dg-options "-std=c++11" }
+// { dg-additional-options "-Wno-return-type" }
 
 namespace std
 {
diff --git a/gcc/testsuite/g++.dg/torture/pr53752.C b/gcc/testsuite/g++.dg/torture/pr53752.C
index fd6c687667c..61febdeb6b8 100644
--- a/gcc/testsuite/g++.dg/torture/pr53752.C
+++ b/gcc/testsuite/g++.dg/torture/pr53752.C
@@ -1,5 +1,6 @@
 // { dg-do compile }
 // { dg-options "-g" }
+// { dg-additional-options "-Wno-return-type" }
 
 typedef unsigned int uint32_t;
 typedef unsigned long int uint64_t;
diff --git a/gcc/testsuite/g++.dg/torture/pr54838.C b/gcc/testsuite/g++.dg/torture/pr54838.C
index 6d34d57a486..c3308210ebe 100644
--- a/gcc/testsuite/g++.dg/torture/pr54838.C
+++ b/gcc/testsuite/g++.dg/torture/pr54838.C
@@ -1,5 +1,6 @@
 // { dg-do compile }
 // { dg-options "-ftracer -fno-tree-dce -fno-tree-sra" }
+// { dg-additional-options "-Wno-return-type" }
 
 struct bidirectional_iterator_tag
 {};
diff --git a/gcc/testsuite/g++.dg/torture/pr54902.C b/gcc/testsuite/g++.dg/torture/pr54902.C
index 790ffe5fcb5..84707bd7136 100644
--- a/gcc/testsuite/g++.dg/torture/pr54902.C
+++ b/gcc/testsuite/g++.dg/torture/pr54902.C
@@ -1,4 +1,5 @@
 // { dg-do compile }
+// { dg-additional-options "-Wno-return-type" }
 
 namespace std __attribute__ ((__visibility__ ("default"))) {
     template<typename _Iterator>     struct iterator_traits     {
diff --git a/gcc/testsuite/g++.dg/torture/pr56029.C b/gcc/testsuite/g++.dg/torture/pr56029.C
index ca4a82a0060..72ad59b4354 100644
--- a/gcc/testsuite/g++.dg/torture/pr56029.C
+++ b/gcc/testsuite/g++.dg/torture/pr56029.C
@@ -1,5 +1,6 @@
 // PR tree-optimization/56029
 // { dg-do compile }
+// { dg-additional-options "-Wno-return-type" }
 
 template <class T>
 struct DefaultDeleter
diff --git a/gcc/testsuite/g++.dg/torture/pr56768.C b/gcc/testsuite/g++.dg/torture/pr56768.C
index db504c500e0..b2be74f28e4 100644
--- a/gcc/testsuite/g++.dg/torture/pr56768.C
+++ b/gcc/testsuite/g++.dg/torture/pr56768.C
@@ -7,7 +7,7 @@ struct Iter
   void operator++ ();
 };
 
-bool operator!= (Iter &, Iter &) { }
+bool operator!= (Iter &, Iter &) { return true; }
 
 struct Container
 {
diff --git a/gcc/testsuite/g++.dg/torture/pr57107.C b/gcc/testsuite/g++.dg/torture/pr57107.C
index 516dec16fc5..4dbd32bd298 100644
--- a/gcc/testsuite/g++.dg/torture/pr57107.C
+++ b/gcc/testsuite/g++.dg/torture/pr57107.C
@@ -1,4 +1,5 @@
 // { dg-do compile }
+// { dg-additional-options "-Wno-return-type" }
 
 typedef long unsigned int size_t;
 namespace std {
diff --git a/gcc/testsuite/g++.dg/torture/pr57140.C b/gcc/testsuite/g++.dg/torture/pr57140.C
index 2ea2f9c4d1b..654653d53aa 100644
--- a/gcc/testsuite/g++.dg/torture/pr57140.C
+++ b/gcc/testsuite/g++.dg/torture/pr57140.C
@@ -1,4 +1,5 @@
 // { dg-do compile }
+// { dg-additional-options "-Wno-return-type" }
 
 namespace std {
     typedef long unsigned int size_t;
diff --git a/gcc/testsuite/g++.dg/torture/pr57235.C b/gcc/testsuite/g++.dg/torture/pr57235.C
index fd5663348e9..8a9e522a36a 100644
--- a/gcc/testsuite/g++.dg/torture/pr57235.C
+++ b/gcc/testsuite/g++.dg/torture/pr57235.C
@@ -1,4 +1,5 @@
 // { dg-do compile }
+// { dg-additional-options "-Wno-return-type" }
 
 namespace std
 {
diff --git a/gcc/testsuite/g++.dg/torture/pr58252.C b/gcc/testsuite/g++.dg/torture/pr58252.C
index d38a7a7ea4b..db3270d9afb 100644
--- a/gcc/testsuite/g++.dg/torture/pr58252.C
+++ b/gcc/testsuite/g++.dg/torture/pr58252.C
@@ -1,5 +1,6 @@
 // { dg-do compile }
 // { dg-options "-fpermissive" }
+// { dg-additional-options "-Wno-return-type" }
 typedef long unsigned int size_t;
        typedef bool _CORBA_Boolean;
          typedef unsigned int _CORBA_ULong;
diff --git a/gcc/testsuite/g++.dg/torture/pr58555.C b/gcc/testsuite/g++.dg/torture/pr58555.C
index ac5009a7b26..454d33d8740 100644
--- a/gcc/testsuite/g++.dg/torture/pr58555.C
+++ b/gcc/testsuite/g++.dg/torture/pr58555.C
@@ -1,4 +1,6 @@
 /* { dg-do compile } */
+/* { dg-additional-options "-Wno-return-type" } */
+
 template <typename _Tp> _Tp *__addressof(_Tp &) {}
 template <typename _Tp> class A {
 public:
diff --git a/gcc/testsuite/g++.dg/torture/pr59208.C b/gcc/testsuite/g++.dg/torture/pr59208.C
index 3dc110c55e3..2b2ad6deea5 100644
--- a/gcc/testsuite/g++.dg/torture/pr59208.C
+++ b/gcc/testsuite/g++.dg/torture/pr59208.C
@@ -14,7 +14,7 @@ enum DebuggerType {};
 C a;
 DebuggerType b;
 void operator==(A &, const A &);
-static A get_dbx_doc(A &p1) { p1 == 0; }
+static A get_dbx_doc(A &p1) { p1 == 0; return A(); }
 
 void add_button() {
   A c;
diff --git a/gcc/testsuite/g++.dg/torture/pr60438-1.C b/gcc/testsuite/g++.dg/torture/pr60438-1.C
index 748295aabe0..3f79dd770eb 100644
--- a/gcc/testsuite/g++.dg/torture/pr60438-1.C
+++ b/gcc/testsuite/g++.dg/torture/pr60438-1.C
@@ -23,4 +23,6 @@ foo (struct C *y, float x)
       d.a = (int) (b * x);
     }
   baz (&d);
+
+  return 0;
 }
diff --git a/gcc/testsuite/g++.dg/torture/pr60746.C b/gcc/testsuite/g++.dg/torture/pr60746.C
index 7ce6ebe6bc0..941e42ca783 100644
--- a/gcc/testsuite/g++.dg/torture/pr60746.C
+++ b/gcc/testsuite/g++.dg/torture/pr60746.C
@@ -20,4 +20,6 @@ Two::run ()
       || list_arry[4][orig].getSize () > 0)
     {
     }
+
+  return 0;
 }
diff --git a/gcc/testsuite/g++.dg/torture/pr61554.C b/gcc/testsuite/g++.dg/torture/pr61554.C
index 6f609c8be09..90f8e85e303 100644
--- a/gcc/testsuite/g++.dg/torture/pr61554.C
+++ b/gcc/testsuite/g++.dg/torture/pr61554.C
@@ -1,4 +1,5 @@
 // { dg-do compile }
+// { dg-additional-options "-Wno-return-type" }
 
 struct A
 {
diff --git a/gcc/testsuite/g++.dg/torture/pr63419.C b/gcc/testsuite/g++.dg/torture/pr63419.C
index 6d4c0745d41..88b117883b7 100644
--- a/gcc/testsuite/g++.dg/torture/pr63419.C
+++ b/gcc/testsuite/g++.dg/torture/pr63419.C
@@ -1,5 +1,5 @@
 // { dg-do compile }
-// { dg-additional-options "-Wno-psabi" }
+// { dg-additional-options "-Wno-psabi -Wno-return-type" }
 // Ignore warning on some powerpc-linux configurations.
 // { dg-prune-output "non-standard ABI extension" }
 
diff --git a/gcc/testsuite/g++.dg/torture/pr63476.C b/gcc/testsuite/g++.dg/torture/pr63476.C
index 75ecc374065..c0c8ae44e85 100644
--- a/gcc/testsuite/g++.dg/torture/pr63476.C
+++ b/gcc/testsuite/g++.dg/torture/pr63476.C
@@ -1,5 +1,5 @@
 // { dg-do compile }
-// { dg-additional-options "-std=gnu++11" }
+// { dg-additional-options "-std=gnu++11 -Wno-return-type" }
 
 enum class nsresult;
 class A;
diff --git a/gcc/testsuite/g++.dg/torture/pr63512.C b/gcc/testsuite/g++.dg/torture/pr63512.C
index 1c1899dc6d8..d08e6174168 100644
--- a/gcc/testsuite/g++.dg/torture/pr63512.C
+++ b/gcc/testsuite/g++.dg/torture/pr63512.C
@@ -43,4 +43,5 @@ C::m_fn3 (const int &, int &, int **)
   if (a)
     c.Range.m_fn1 ();
   m_fn2 (semi, 0, b ? "" : a ? "alias declaration" : "using declaration");
+  return 0;
 }
diff --git a/gcc/testsuite/g++.dg/torture/pr64282.C b/gcc/testsuite/g++.dg/torture/pr64282.C
index 48429884e9f..9696effc38d 100644
--- a/gcc/testsuite/g++.dg/torture/pr64282.C
+++ b/gcc/testsuite/g++.dg/torture/pr64282.C
@@ -53,7 +53,7 @@ public:
 class H
 {
   void m_fn7 (const F &, bool &);
-  bool m_fn8 (const D<F> &, const F &, F &);
+  void m_fn8 (const D<F> &, const F &, F &);
 };
 typedef A<int> CandPair;
 class I
@@ -91,7 +91,7 @@ H::m_fn7 (const F &, bool &)
   F h;
   m_fn8 (g, f.first, h);
 }
-bool
+void
 H::m_fn8 (const D<F> &p1, const F &, F &)
 {
   F i;
diff --git a/gcc/testsuite/g++.dg/torture/pr64378.C b/gcc/testsuite/g++.dg/torture/pr64378.C
index 6770601eaf2..4d48cdc0946 100644
--- a/gcc/testsuite/g++.dg/torture/pr64378.C
+++ b/gcc/testsuite/g++.dg/torture/pr64378.C
@@ -5,7 +5,7 @@ struct data {
 };
 
 struct top {
-  virtual int topf() {}
+  virtual int topf() { return 0; }
 };
 
 struct child1: top {
diff --git a/gcc/testsuite/g++.dg/torture/pr64565.C b/gcc/testsuite/g++.dg/torture/pr64565.C
index 42b0239c525..ea5ca14e23a 100644
--- a/gcc/testsuite/g++.dg/torture/pr64565.C
+++ b/gcc/testsuite/g++.dg/torture/pr64565.C
@@ -1,4 +1,6 @@
 /* { dg-do compile } */
+/* { dg-additional-options "-Wno-return-type" } */
+
 typedef enum
 {
   NS_OK
diff --git a/gcc/testsuite/g++.dg/torture/pr64568-2.C b/gcc/testsuite/g++.dg/torture/pr64568-2.C
index 05782179008..5881b854d6a 100644
--- a/gcc/testsuite/g++.dg/torture/pr64568-2.C
+++ b/gcc/testsuite/g++.dg/torture/pr64568-2.C
@@ -1,4 +1,5 @@
 // { dg-do compile }
+// { dg-additional-options "-Wno-return-type" }
 
 namespace std
 {
diff --git a/gcc/testsuite/g++.dg/torture/pr64669.C b/gcc/testsuite/g++.dg/torture/pr64669.C
index b207739e6d3..a4e7d3a8a28 100644
--- a/gcc/testsuite/g++.dg/torture/pr64669.C
+++ b/gcc/testsuite/g++.dg/torture/pr64669.C
@@ -60,4 +60,6 @@ Lex::advance_one_char (const char *p, bool is_single_quote,
 	&& (*value == '\'' || *value == '\n') && !issued_error)
       error_at (this->location (), "invalid character literal");
   }
+
+  return 0;
 }
diff --git a/gcc/testsuite/g++.dg/torture/pr64686.C b/gcc/testsuite/g++.dg/torture/pr64686.C
index 714aa4100c5..9eb54160eba 100644
--- a/gcc/testsuite/g++.dg/torture/pr64686.C
+++ b/gcc/testsuite/g++.dg/torture/pr64686.C
@@ -15,5 +15,6 @@ A *
 B::m_fn1 (int *) const
 {
   new B (m_fn2 (0)->m_fn1 (0), 0, m_fn2 (0)->m_fn1 (0));
+  return 0;
 }
 
diff --git a/gcc/testsuite/g++.dg/torture/pr64978.C b/gcc/testsuite/g++.dg/torture/pr64978.C
index a9ac49f8e12..3e45be6f09c 100644
--- a/gcc/testsuite/g++.dg/torture/pr64978.C
+++ b/gcc/testsuite/g++.dg/torture/pr64978.C
@@ -27,4 +27,4 @@ void C::m_fn3(A, unsigned, const int *, int &) {
     1 ? VTables.m_fn2() : 0;
 }
 void B::m_fn1(bool, const int *, int &) { C(); }
-unsigned B::m_fn2() { m_fn1(0, 0, a); }
+unsigned B::m_fn2() { m_fn1(0, 0, a); return 0; }
diff --git a/gcc/testsuite/g++.dg/torture/pr64995.C b/gcc/testsuite/g++.dg/torture/pr64995.C
index f5b97cf371b..f2e1b1b3748 100644
--- a/gcc/testsuite/g++.dg/torture/pr64995.C
+++ b/gcc/testsuite/g++.dg/torture/pr64995.C
@@ -20,6 +20,7 @@ inline int *A::m_fn2() {
     a = acos(c);
     double d = m_fn1(b);
     acos(d);
+    return 0;
 }
 
 void passTime() {
diff --git a/gcc/testsuite/g++.dg/torture/pr65655.C b/gcc/testsuite/g++.dg/torture/pr65655.C
index 8dfc13b7d7d..ea07d2e976b 100644
--- a/gcc/testsuite/g++.dg/torture/pr65655.C
+++ b/gcc/testsuite/g++.dg/torture/pr65655.C
@@ -1,6 +1,6 @@
 /* { dg-do compile } */
 // { dg-timeout-factor 2.0 }
-// { dg-additional-options "-std=c++11 -fsanitize=undefined -O2" }
+// { dg-additional-options "-std=c++11 -fsanitize=undefined -O2 -Wno-return-type" }
 class ECoordinate { };
 class EPoint {
 public:
diff --git a/gcc/testsuite/g++.dg/torture/pr65851.C b/gcc/testsuite/g++.dg/torture/pr65851.C
index 6efe8861a19..81f3184296c 100644
--- a/gcc/testsuite/g++.dg/torture/pr65851.C
+++ b/gcc/testsuite/g++.dg/torture/pr65851.C
@@ -16,6 +16,7 @@ class C : A {
 public:
   unsigned long write(const char *p1, unsigned long p2) {
     m_string.push_range(p1 + p2);
+    return 0;
   }
 };
 char *write_signed_decimal_backward(bool) {
diff --git a/gcc/testsuite/g++.dg/torture/pr67055.C b/gcc/testsuite/g++.dg/torture/pr67055.C
index 7cbbca275c2..6621e58136f 100644
--- a/gcc/testsuite/g++.dg/torture/pr67055.C
+++ b/gcc/testsuite/g++.dg/torture/pr67055.C
@@ -15,6 +15,7 @@ namespace vespamalloc {
 	unsigned long A<StackRep>::fillStack(unsigned long p1) {
 	    void *retAddr[p1];
 	    fn1(retAddr);
+	    return 0;
 	}
     class B {
     protected:
@@ -33,6 +34,7 @@ namespace vespamalloc {
 	void *C<MemBlockPtrT, ThreadListT>::malloc(unsigned long) {
 	    MemBlockPtrT mem;
 	    mem.alloc(0);
+	    return 0;
 	}
     C<D<16>, int> *_GmemP;
 }
diff --git a/gcc/testsuite/g++.dg/torture/pr67191.C b/gcc/testsuite/g++.dg/torture/pr67191.C
index 79ee988ce7a..997c661d3ec 100644
--- a/gcc/testsuite/g++.dg/torture/pr67191.C
+++ b/gcc/testsuite/g++.dg/torture/pr67191.C
@@ -1,4 +1,5 @@
 // { dg-do compile }
+// { dg-additional-options "-Wno-return-type" }
 
 template <typename> class A;
 template <typename _Tp> using __allocator_base = _Tp;
diff --git a/gcc/testsuite/g++.dg/torture/pr68852.C b/gcc/testsuite/g++.dg/torture/pr68852.C
index 41727517760..c2c6a585d3c 100644
--- a/gcc/testsuite/g++.dg/torture/pr68852.C
+++ b/gcc/testsuite/g++.dg/torture/pr68852.C
@@ -34,6 +34,7 @@ public:
 	c[2] = m_fn2(b);
 	c[3] = m_fn2(a);
 	c[ProjectRectBounds_next].m_fn1();
+	return 0;
     }
     D operator*(D p1) {
 	D d;
diff --git a/gcc/testsuite/g++.dg/torture/pr69264.C b/gcc/testsuite/g++.dg/torture/pr69264.C
index 43753806758..a531bfc9b8c 100644
--- a/gcc/testsuite/g++.dg/torture/pr69264.C
+++ b/gcc/testsuite/g++.dg/torture/pr69264.C
@@ -1,4 +1,5 @@
 // { dg-do compile }
+// { dg-additional-options "-Wno-return-type" }
 // { dg-additional-options "-mcpu=970 -maltivec" { target powerpc*-*-* } }
 
 typedef union {
diff --git a/gcc/testsuite/g++.dg/torture/pr77674.C b/gcc/testsuite/g++.dg/torture/pr77674.C
index f933174317e..a24ce58dafc 100644
--- a/gcc/testsuite/g++.dg/torture/pr77674.C
+++ b/gcc/testsuite/g++.dg/torture/pr77674.C
@@ -3,6 +3,7 @@ typedef struct { } __fsid_t;
 typedef unsigned long int pthread_t;
 extern "C" {
   extern __inline __attribute__ ((__gnu_inline__)) int pthread_equal (pthread_t __thread1, pthread_t __thread2) throw ()   {
+      return 0;
   }
 }
 typedef pthread_t __gthread_t;
diff --git a/gcc/testsuite/g++.dg/torture/pr77947.C b/gcc/testsuite/g++.dg/torture/pr77947.C
index 3c8a24a16c6..14f8b13a864 100644
--- a/gcc/testsuite/g++.dg/torture/pr77947.C
+++ b/gcc/testsuite/g++.dg/torture/pr77947.C
@@ -18,9 +18,12 @@ B::m_fn2 () const
     bool
     m_fn1 () const
     {
+      return true;
     }
     C () {}
   };
+
+  return 0;
 }
 void
 fn1 (A &p1)
diff --git a/gcc/testsuite/g++.dg/torture/pr78268.C b/gcc/testsuite/g++.dg/torture/pr78268.C
index ef4547c1159..8458c20d417 100644
--- a/gcc/testsuite/g++.dg/torture/pr78268.C
+++ b/gcc/testsuite/g++.dg/torture/pr78268.C
@@ -1,4 +1,6 @@
 // { dg-do compile }
+// { dg-additional-options "-Wno-return-type" }
+
 typedef enum {} nsresult;
 
 struct A {
diff --git a/gcc/testsuite/g++.dg/torture/pr78507.C b/gcc/testsuite/g++.dg/torture/pr78507.C
index 9691cf9bd7a..6d6bd31c571 100644
--- a/gcc/testsuite/g++.dg/torture/pr78507.C
+++ b/gcc/testsuite/g++.dg/torture/pr78507.C
@@ -1,5 +1,7 @@
 // PR middle-end/78507
 // { dg-do compile }
+// { dg-additional-options "-Wno-return-type" }
+
 struct A {
   template <typename _Iterator1, typename _Iterator2>
   int operator()(_Iterator1, _Iterator2);
diff --git a/gcc/testsuite/g++.dg/torture/pr78692.C b/gcc/testsuite/g++.dg/torture/pr78692.C
index 57a0d2fcb0a..331cc81c210 100644
--- a/gcc/testsuite/g++.dg/torture/pr78692.C
+++ b/gcc/testsuite/g++.dg/torture/pr78692.C
@@ -22,5 +22,6 @@ int
 F::g ()
 {
   a = i (h, b, 0);
+  return 0;
 }
 }
diff --git a/gcc/testsuite/g++.dg/torture/pr80171.C b/gcc/testsuite/g++.dg/torture/pr80171.C
index 81f272583c5..c1f6e622515 100644
--- a/gcc/testsuite/g++.dg/torture/pr80171.C
+++ b/gcc/testsuite/g++.dg/torture/pr80171.C
@@ -1,4 +1,5 @@
 // { dg-do compile }
+// { dg-additional-options "-Wno-return-type" }
 
 template <typename> struct remove_reference;
 template <typename _Tp> struct remove_reference<_Tp &> { typedef _Tp type; };
diff --git a/gcc/testsuite/g++.dg/torture/pr82154.C b/gcc/testsuite/g++.dg/torture/pr82154.C
index f4e1c3ea139..e229c3e640e 100644
--- a/gcc/testsuite/g++.dg/torture/pr82154.C
+++ b/gcc/testsuite/g++.dg/torture/pr82154.C
@@ -25,6 +25,7 @@ class f
   i ()
   {
     static d j;
+    return d();
   }
   int *k () throw (a::c);
 };
@@ -47,4 +48,5 @@ int *f::k () throw (a::c)
 	}
     }
   i ().e ();
+  return 0;
 }
diff --git a/gcc/testsuite/g++.dg/tree-ssa/copyprop.C b/gcc/testsuite/g++.dg/tree-ssa/copyprop.C
index b30e5ddc5ba..8c05895e45e 100644
--- a/gcc/testsuite/g++.dg/tree-ssa/copyprop.C
+++ b/gcc/testsuite/g++.dg/tree-ssa/copyprop.C
@@ -2,7 +2,7 @@
 //
 // { dg-do compile { target { lp64 } } }
 // { dg-options  "-Wno-error -fno-exceptions -fno-tree-vrp -O2 -fprofile-generate  -finline-limit=500 -std=c++98"  }
-//
+// { dg-additional-options "-Wno-return-type" }
 
 #include <map>
 #include <vector>
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr22444.C b/gcc/testsuite/g++.dg/tree-ssa/pr22444.C
index 7df4b9cce15..04bf2009cbe 100644
--- a/gcc/testsuite/g++.dg/tree-ssa/pr22444.C
+++ b/gcc/testsuite/g++.dg/tree-ssa/pr22444.C
@@ -4,6 +4,7 @@
 // with the subvars leading to the subvars not being renamed when they should
 // { dg-do compile }
 // { dg-options "-O2" }
+// { dg-additional-options "-Wno-return-type" }
 __extension__ typedef __PTRDIFF_TYPE__ ptrdiff_t;
 __extension__ typedef __SIZE_TYPE__ size_t;
 namespace std
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr23948.C b/gcc/testsuite/g++.dg/tree-ssa/pr23948.C
index def01d95157..ed99217a7b9 100644
--- a/gcc/testsuite/g++.dg/tree-ssa/pr23948.C
+++ b/gcc/testsuite/g++.dg/tree-ssa/pr23948.C
@@ -6,7 +6,7 @@ struct MIOFILE {
 };
 double potentially_runnable_resource_share();
 void f1(double);
-int make_scheduler_request(double a, double b)
+void make_scheduler_request(double a, double b)
 {
   MIOFILE mf;
   double prrs = potentially_runnable_resource_share();
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr24172.C b/gcc/testsuite/g++.dg/tree-ssa/pr24172.C
index 245186a3c50..4d92bd592c0 100644
--- a/gcc/testsuite/g++.dg/tree-ssa/pr24172.C
+++ b/gcc/testsuite/g++.dg/tree-ssa/pr24172.C
@@ -1,6 +1,6 @@
 // { dg-options "-O2" }
 void IOException( char);
-inline int* dummy( const char* const mode )
+inline void dummy( const char* const mode )
 {
   IOException(*mode+*mode);
 }
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr24351-3.C b/gcc/testsuite/g++.dg/tree-ssa/pr24351-3.C
index 09a3f9462f3..f3aaee85286 100644
--- a/gcc/testsuite/g++.dg/tree-ssa/pr24351-3.C
+++ b/gcc/testsuite/g++.dg/tree-ssa/pr24351-3.C
@@ -1,5 +1,6 @@
 /* { dg-do compile } */
 /* { dg-options "-O2" } */
+// { dg-additional-options "-Wno-return-type" }
 namespace sigc {
     template <class T_type>     struct type_trait     {
     	typedef T_type& pass;
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr27283.C b/gcc/testsuite/g++.dg/tree-ssa/pr27283.C
index 224ea6a9bf9..1623d289a20 100644
--- a/gcc/testsuite/g++.dg/tree-ssa/pr27283.C
+++ b/gcc/testsuite/g++.dg/tree-ssa/pr27283.C
@@ -1,5 +1,6 @@
 /* { dg-do compile } */
 /* { dg-options "-O2" } */
+/* { dg-additional-options "-Wno-return-type" } */
 
 namespace Gambit
 {
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr27291.C b/gcc/testsuite/g++.dg/tree-ssa/pr27291.C
index b8b5e136a46..24f440dde06 100644
--- a/gcc/testsuite/g++.dg/tree-ssa/pr27291.C
+++ b/gcc/testsuite/g++.dg/tree-ssa/pr27291.C
@@ -1,5 +1,6 @@
 /* { dg-do compile } */
 /* { dg-options "-O2" } */
+/* { dg-additional-options "-Wno-return-type" } */
 
 namespace std
 {
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr27548.C b/gcc/testsuite/g++.dg/tree-ssa/pr27548.C
index d23b959a599..cbe7929aefe 100644
--- a/gcc/testsuite/g++.dg/tree-ssa/pr27548.C
+++ b/gcc/testsuite/g++.dg/tree-ssa/pr27548.C
@@ -1,6 +1,7 @@
 // PR tree-optimization/27548
 // { dg-do compile }
 // { dg-options "-O1" }
+// { dg-additional-options "-Wno-return-type" }
 
 namespace Gambit
 {
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr34355.C b/gcc/testsuite/g++.dg/tree-ssa/pr34355.C
index 978ed75df68..e7b4537697a 100644
--- a/gcc/testsuite/g++.dg/tree-ssa/pr34355.C
+++ b/gcc/testsuite/g++.dg/tree-ssa/pr34355.C
@@ -24,4 +24,5 @@ double Parse_Float ()
   EXPRESS Express = {1.0, 2.0, 3.0, 4.0, 5.0};
 
   Parse_Rel_Factor (Express, &Terms);
+  return 0.0;
 }
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr42337.C b/gcc/testsuite/g++.dg/tree-ssa/pr42337.C
index 8abd4b2d161..61beb737018 100644
--- a/gcc/testsuite/g++.dg/tree-ssa/pr42337.C
+++ b/gcc/testsuite/g++.dg/tree-ssa/pr42337.C
@@ -1,6 +1,7 @@
 // PR tree-optimize/42337
 // { dg-do compile }
 // { dg-options "-O2" }
+// { dg-additional-options "-Wno-return-type" }
 
 template<class _T1, class _T2> struct pair {
   _T2 second;
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pred-1.C b/gcc/testsuite/g++.dg/tree-ssa/pred-1.C
index 01b065ee966..19a066ab48d 100644
--- a/gcc/testsuite/g++.dg/tree-ssa/pred-1.C
+++ b/gcc/testsuite/g++.dg/tree-ssa/pred-1.C
@@ -2,6 +2,8 @@
 /* { dg-options "-O2 -fdump-tree-profile_estimate" } */
 int a[100];
 void foo(int);
+
+int
 main()
 {
   int i;
@@ -11,5 +13,7 @@ main()
 	continue;
        foo(i);
     }
+
+  return 0;
 }
 // { dg-final { scan-tree-dump "continue heuristics" "profile_estimate" } }
diff --git a/gcc/testsuite/g++.dg/ubsan/pr65019.C b/gcc/testsuite/g++.dg/ubsan/pr65019.C
index a7f21a7d241..380c10b65d1 100644
--- a/gcc/testsuite/g++.dg/ubsan/pr65019.C
+++ b/gcc/testsuite/g++.dg/ubsan/pr65019.C
@@ -17,6 +17,8 @@ C::foo (const A &x, int y)
   C *d = new C (x, y);
   if (d->c == nullptr)
     delete d;
+
+  return 0;
 }
 
 C::~C ()
diff --git a/gcc/testsuite/g++.dg/ubsan/pr65583.C b/gcc/testsuite/g++.dg/ubsan/pr65583.C
index 4e1149e9cb6..02acb361a22 100644
--- a/gcc/testsuite/g++.dg/ubsan/pr65583.C
+++ b/gcc/testsuite/g++.dg/ubsan/pr65583.C
@@ -1,6 +1,7 @@
 // PR sanitizer/65583
 // { dg-do compile }
 // { dg-options "-std=c++11 -fsanitize=undefined" }
+// { dg-additional-options "-Wno-return-type" }
 
 namespace std
 {
diff --git a/gcc/testsuite/g++.dg/vect/pr60836.cc b/gcc/testsuite/g++.dg/vect/pr60836.cc
index 425106dd44d..b2d66ec5b15 100644
--- a/gcc/testsuite/g++.dg/vect/pr60836.cc
+++ b/gcc/testsuite/g++.dg/vect/pr60836.cc
@@ -27,6 +27,8 @@ norm_ (const int &)
       b = e (b, d);
       b = e (b, c);
     }
+
+  return 0.0;
 }
 
 void
diff --git a/gcc/testsuite/g++.dg/vect/pr68145.cc b/gcc/testsuite/g++.dg/vect/pr68145.cc
index 51e663ae636..8a1e10ee783 100644
--- a/gcc/testsuite/g++.dg/vect/pr68145.cc
+++ b/gcc/testsuite/g++.dg/vect/pr68145.cc
@@ -1,4 +1,5 @@
 /* { dg-do compile } */
+/* { dg-additional-options "-Wno-return-type" } */
 
 struct A {
   bool operator()(int p1, int p2) { return p1 && p2; }
diff --git a/gcc/testsuite/g++.dg/vect/pr70729-nest.cc b/gcc/testsuite/g++.dg/vect/pr70729-nest.cc
index 96171e5ec94..931895b0a9c 100644
--- a/gcc/testsuite/g++.dg/vect/pr70729-nest.cc
+++ b/gcc/testsuite/g++.dg/vect/pr70729-nest.cc
@@ -2,7 +2,7 @@
 // { dg-additional-options "-ffast-math -fopenmp-simd" }
 // { dg-additional-options "-msse2" { target x86_64-*-* i?86-*-* } }
 
-inline void* my_alloc (__SIZE_TYPE__ bytes) {void *ptr; __builtin_posix_memalign (&ptr, bytes, 128);}
+inline void* my_alloc (__SIZE_TYPE__ bytes) {void *ptr; __builtin_posix_memalign (&ptr, bytes, 128); return 0; }
 inline void my_free (void* memory) {__builtin_free (memory);}
 float W[100];
 
diff --git a/gcc/testsuite/g++.dg/vect/pr70729.cc b/gcc/testsuite/g++.dg/vect/pr70729.cc
index ff868f7a41b..eac4b4bd75c 100644
--- a/gcc/testsuite/g++.dg/vect/pr70729.cc
+++ b/gcc/testsuite/g++.dg/vect/pr70729.cc
@@ -2,7 +2,7 @@
 // { dg-additional-options "-ffast-math -fopenmp-simd" }
 // { dg-additional-options "-msse2" { target x86_64-*-* i?86-*-* } }
 
-inline void* my_alloc (__SIZE_TYPE__ bytes) {void *ptr; __builtin_posix_memalign (&ptr, bytes, 128);}
+inline void* my_alloc (__SIZE_TYPE__ bytes) {void *ptr; __builtin_posix_memalign (&ptr, bytes, 128); return 0; }
 inline void my_free (void* memory) {__builtin_free (memory);}
 
 template <typename T>
diff --git a/gcc/testsuite/g++.dg/warn/Waddress-3.C b/gcc/testsuite/g++.dg/warn/Waddress-3.C
index 13d7cd2c001..a97c7814ce5 100644
--- a/gcc/testsuite/g++.dg/warn/Waddress-3.C
+++ b/gcc/testsuite/g++.dg/warn/Waddress-3.C
@@ -1,6 +1,6 @@
 // PR c++/65168
 // { dg-do compile { target c++11 } }
-// { dg-options -Waddress }
+// { dg-options "-Waddress -Wno-return-type" }
 // We shouldn't warn in unevaluated context about the address of a reference
 // always being true.
 
diff --git a/gcc/testsuite/g++.dg/warn/Wconversion-null-2.C b/gcc/testsuite/g++.dg/warn/Wconversion-null-2.C
index a71551fdf90..98f5c405165 100644
--- a/gcc/testsuite/g++.dg/warn/Wconversion-null-2.C
+++ b/gcc/testsuite/g++.dg/warn/Wconversion-null-2.C
@@ -48,7 +48,7 @@ void warn_for_NULL()
   NULL && NULL; // No warning: converting NULL to bool is OK
 }
 
-int warn_for___null()
+void warn_for___null()
 {
   int i = __null; // { dg-warning "" } converting __null to non-pointer type
   float z = __null; // { dg-warning "" } converting __null to non-pointer type
diff --git a/gcc/testsuite/g++.dg/warn/Wnull-conversion-2.C b/gcc/testsuite/g++.dg/warn/Wnull-conversion-2.C
index 92a87d1e76c..d5501fface5 100644
--- a/gcc/testsuite/g++.dg/warn/Wnull-conversion-2.C
+++ b/gcc/testsuite/g++.dg/warn/Wnull-conversion-2.C
@@ -34,6 +34,7 @@ void func1(long int a) {
 
 int x = 1;
 
+int
 main()
 {
   int *p = &x;
@@ -42,4 +43,6 @@ main()
   Foo::Compare<long int, int>(NULL, p);  // { dg-warning "passing NULL to" }
   Foo::Compare(NULL, p);
   func1(NULL);                           // { dg-warning "passing NULL to" }
+
+  return 0;
 }
diff --git a/gcc/testsuite/g++.dg/warn/Wparentheses-10.C b/gcc/testsuite/g++.dg/warn/Wparentheses-10.C
index c30df090f5e..557db091ad0 100644
--- a/gcc/testsuite/g++.dg/warn/Wparentheses-10.C
+++ b/gcc/testsuite/g++.dg/warn/Wparentheses-10.C
@@ -5,7 +5,7 @@
 
 int foo (int);
 
-int
+void
 bar (int a, int b, int c)
 {
   foo (a & b ^ c); // { dg-warning "parentheses" "correct warning" }
diff --git a/gcc/testsuite/g++.dg/warn/Wparentheses-11.C b/gcc/testsuite/g++.dg/warn/Wparentheses-11.C
index 912c3b7ae76..6f0ecbe8bd8 100644
--- a/gcc/testsuite/g++.dg/warn/Wparentheses-11.C
+++ b/gcc/testsuite/g++.dg/warn/Wparentheses-11.C
@@ -5,7 +5,7 @@
 
 int foo (int);
 
-int
+void
 bar (int a, int b, int c)
 {
   foo (a + b & c); // { dg-warning "parentheses" "correct warning" }
diff --git a/gcc/testsuite/g++.dg/warn/Wparentheses-12.C b/gcc/testsuite/g++.dg/warn/Wparentheses-12.C
index b04529827d5..ca6407aea74 100644
--- a/gcc/testsuite/g++.dg/warn/Wparentheses-12.C
+++ b/gcc/testsuite/g++.dg/warn/Wparentheses-12.C
@@ -7,7 +7,7 @@ int foo (int);
 
 int a, b, c;
 
-int
+void
 bar (void)
 {
   if (a)
diff --git a/gcc/testsuite/g++.dg/warn/Wparentheses-25.C b/gcc/testsuite/g++.dg/warn/Wparentheses-25.C
index d9951a4f46b..d3afa4ce784 100644
--- a/gcc/testsuite/g++.dg/warn/Wparentheses-25.C
+++ b/gcc/testsuite/g++.dg/warn/Wparentheses-25.C
@@ -5,7 +5,7 @@
 // C++ version of Wparentheses-11.c
 int foo (int);
 
-int
+void
 bar (int a, int b, int c)
 {
   foo (!a & b); /* { dg-warning "parentheses" "correct warning" } */
@@ -156,7 +156,7 @@ bar (int a, int b, int c)
 }
 
 
-int
+void
 baz (int a, int b, int c)
 {
   foo (!a & (b << c));/* { dg-warning "parentheses" "correct warning" } */
diff --git a/gcc/testsuite/g++.dg/warn/Wparentheses-6.C b/gcc/testsuite/g++.dg/warn/Wparentheses-6.C
index 9963d822e05..d985d7e45d6 100644
--- a/gcc/testsuite/g++.dg/warn/Wparentheses-6.C
+++ b/gcc/testsuite/g++.dg/warn/Wparentheses-6.C
@@ -5,7 +5,7 @@
 
 int foo (int);
 
-int
+void
 bar (int a, int b, int c)
 {
   foo (a <= b <= c); // { dg-warning "comparison" "correct warning" }
diff --git a/gcc/testsuite/g++.dg/warn/Wparentheses-7.C b/gcc/testsuite/g++.dg/warn/Wparentheses-7.C
index 7d549c38c31..69d555b3dfb 100644
--- a/gcc/testsuite/g++.dg/warn/Wparentheses-7.C
+++ b/gcc/testsuite/g++.dg/warn/Wparentheses-7.C
@@ -5,7 +5,7 @@
 
 int foo (int);
 
-int
+void
 bar (int a, int b, int c)
 {
   foo (a + b << c); // { dg-warning "parentheses" "correct warning" }
diff --git a/gcc/testsuite/g++.dg/warn/Wparentheses-8.C b/gcc/testsuite/g++.dg/warn/Wparentheses-8.C
index ddb5e64b4ad..2089dce968c 100644
--- a/gcc/testsuite/g++.dg/warn/Wparentheses-8.C
+++ b/gcc/testsuite/g++.dg/warn/Wparentheses-8.C
@@ -5,7 +5,7 @@
 
 int foo (int);
 
-int
+void
 bar (int a, int b, int c)
 {
   foo (a && b || c); // { dg-warning "parentheses" "correct warning" }
diff --git a/gcc/testsuite/g++.dg/warn/Wparentheses-9.C b/gcc/testsuite/g++.dg/warn/Wparentheses-9.C
index bad6fb1c570..7c8f01d327b 100644
--- a/gcc/testsuite/g++.dg/warn/Wparentheses-9.C
+++ b/gcc/testsuite/g++.dg/warn/Wparentheses-9.C
@@ -5,7 +5,7 @@
 
 int foo (int);
 
-int
+void
 bar (int a, int b, int c)
 {
   foo (a & b | c); // { dg-warning "parentheses" "correct warning" }
diff --git a/gcc/testsuite/g++.dg/warn/Wshadow-5.C b/gcc/testsuite/g++.dg/warn/Wshadow-5.C
index 7a90ec9c997..feb2bffcdc0 100644
--- a/gcc/testsuite/g++.dg/warn/Wshadow-5.C
+++ b/gcc/testsuite/g++.dg/warn/Wshadow-5.C
@@ -1,7 +1,7 @@
 // Wshadows was giving warnings for nested function parameters in nested class
 // or structure that we didn't want.
 // { dg-do compile }
-// { dg-options "-Wshadow" }
+// { dg-options "-Wshadow -Wno-return-type" }
 
 // PR c++/41825
 int f (int n)
diff --git a/gcc/testsuite/g++.dg/warn/Wtype-limits-Wextra.C b/gcc/testsuite/g++.dg/warn/Wtype-limits-Wextra.C
index 91b5c1b46d8..0cee96a8a98 100644
--- a/gcc/testsuite/g++.dg/warn/Wtype-limits-Wextra.C
+++ b/gcc/testsuite/g++.dg/warn/Wtype-limits-Wextra.C
@@ -69,7 +69,7 @@ void f(Int x) {
   assert(0 <= x and x <= D);
 }
 
-int ff(void) {
+void ff(void) {
   f<unsigned char, 2>(5);
   f<signed char, 2>(5);
 }
@@ -78,7 +78,7 @@ template <typename Int, Int D>
 void g(void) {
   assert(0 <= D);
 }
-int gg(void) {
+void gg(void) {
   g<unsigned char, 2>();
 }
 
diff --git a/gcc/testsuite/g++.dg/warn/Wtype-limits-no.C b/gcc/testsuite/g++.dg/warn/Wtype-limits-no.C
index 5040e2657ba..ad248d71808 100644
--- a/gcc/testsuite/g++.dg/warn/Wtype-limits-no.C
+++ b/gcc/testsuite/g++.dg/warn/Wtype-limits-no.C
@@ -69,7 +69,7 @@ void f(Int x) {
   assert(0 <= x and x <= D); // { dg-bogus "comparison is always true due to limited range of data type" }
 }
 
-int ff(void) {
+void ff(void) {
   f<unsigned char, 2>(5);
   f<signed char, 2>(5);
 }
@@ -78,7 +78,7 @@ template <typename Int, Int D>
 void g(void) {
   assert(0 <= D);
 }
-int gg(void) {
+void gg(void) {
   g<unsigned char, 2>();
 }
 
diff --git a/gcc/testsuite/g++.dg/warn/Wtype-limits.C b/gcc/testsuite/g++.dg/warn/Wtype-limits.C
index c345eff0b44..7919a42c834 100644
--- a/gcc/testsuite/g++.dg/warn/Wtype-limits.C
+++ b/gcc/testsuite/g++.dg/warn/Wtype-limits.C
@@ -69,7 +69,7 @@ void f(Int x) {
   assert(0 <= x and x <= D);
 }
 
-int ff(void) {
+void ff(void) {
   f<unsigned char, 2>(5);
   f<signed char, 2>(5);
 }
@@ -78,7 +78,7 @@ template <typename Int, Int D>
 void g(void) {
   assert(0 <= D);
 }
-int gg(void) {
+void gg(void) {
   g<unsigned char, 2>();
 }
 
diff --git a/gcc/testsuite/g++.dg/warn/Wunused-local-typedefs.C b/gcc/testsuite/g++.dg/warn/Wunused-local-typedefs.C
index 4fc8640ed7b..73f7ec79ce1 100644
--- a/gcc/testsuite/g++.dg/warn/Wunused-local-typedefs.C
+++ b/gcc/testsuite/g++.dg/warn/Wunused-local-typedefs.C
@@ -31,7 +31,7 @@ test0_tmpl(void)
     foo(2);
 }
 
-int
+void
 test0(void)
 {
     test0_tmpl<int>();
diff --git a/gcc/testsuite/g++.dg/warn/Wzero-as-null-pointer-constant-5.C b/gcc/testsuite/g++.dg/warn/Wzero-as-null-pointer-constant-5.C
index 185d2b5c4ee..4269beda28a 100644
--- a/gcc/testsuite/g++.dg/warn/Wzero-as-null-pointer-constant-5.C
+++ b/gcc/testsuite/g++.dg/warn/Wzero-as-null-pointer-constant-5.C
@@ -1,5 +1,5 @@
 // PR c++/52718
-// { dg-options "-Wzero-as-null-pointer-constant" }
+// { dg-options "-Wzero-as-null-pointer-constant -Wno-return-type" }
 
 struct foo
 {
diff --git a/gcc/testsuite/g++.dg/warn/pmf1.C b/gcc/testsuite/g++.dg/warn/pmf1.C
index 013c21b6db9..a63a00c33df 100644
--- a/gcc/testsuite/g++.dg/warn/pmf1.C
+++ b/gcc/testsuite/g++.dg/warn/pmf1.C
@@ -15,4 +15,5 @@ int
 a::f() const
 {
   int (a::* b)() const = &f; // { dg-error "&a::f" }
+  return 0;
 }
diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/p13417.C b/gcc/testsuite/g++.old-deja/g++.benjamin/p13417.C
index 132b13df277..e705f0dffb5 100644
--- a/gcc/testsuite/g++.old-deja/g++.benjamin/p13417.C
+++ b/gcc/testsuite/g++.old-deja/g++.benjamin/p13417.C
@@ -1,5 +1,5 @@
 // { dg-do assemble  }
-// { dg-options "-Wno-deprecated" }
+// { dg-options "-Wno-deprecated -Wno-return-type" }
 // prms-id: 13417
 
 class   Foo {
diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/crash24.C b/gcc/testsuite/g++.old-deja/g++.brendan/crash24.C
index 42d0fabc238..e1e9d32c94f 100644
--- a/gcc/testsuite/g++.old-deja/g++.brendan/crash24.C
+++ b/gcc/testsuite/g++.old-deja/g++.brendan/crash24.C
@@ -11,9 +11,12 @@
 // array bounds, and then force the array to be allocated on the stack instead
 // of a register.
 
+int
 main()
 {
   char i[1];
 
   i[1] = 0;
+
+  return 0;
 }
diff --git a/gcc/testsuite/g++.old-deja/g++.ext/constructor.C b/gcc/testsuite/g++.old-deja/g++.ext/constructor.C
index a7995bbfe79..3dc15c52acd 100644
--- a/gcc/testsuite/g++.old-deja/g++.ext/constructor.C
+++ b/gcc/testsuite/g++.old-deja/g++.ext/constructor.C
@@ -9,6 +9,7 @@ struct Any {
 
 int i, j;
 
+int
 main () {
   struct Any *ap = (struct Any *)
     __builtin_alloca (sizeof(struct Any));
diff --git a/gcc/testsuite/g++.old-deja/g++.ext/namedret1.C b/gcc/testsuite/g++.old-deja/g++.ext/namedret1.C
index 29955fb525c..ae0391d1559 100644
--- a/gcc/testsuite/g++.old-deja/g++.ext/namedret1.C
+++ b/gcc/testsuite/g++.old-deja/g++.ext/namedret1.C
@@ -1,7 +1,7 @@
 // { dg-do assemble  }
 // { dg-options "-Wno-deprecated" }
 
-int f(int x) return y(x) { } // { dg-error "" } 
+int f(int x) return y(x) { return 0; } // { dg-error "" } 
 
 extern "C" void abort ();
 
diff --git a/gcc/testsuite/g++.old-deja/g++.ext/namedret3.C b/gcc/testsuite/g++.old-deja/g++.ext/namedret3.C
index 7a0e0d5943f..0caf6a31378 100644
--- a/gcc/testsuite/g++.old-deja/g++.ext/namedret3.C
+++ b/gcc/testsuite/g++.old-deja/g++.ext/namedret3.C
@@ -1,5 +1,5 @@
 // { dg-do assemble  }
-// { dg-options "-Wno-deprecated" }
+// { dg-options "-Wno-deprecated -Wno-return-type" }
 
 extern "C" void abort();
 
diff --git a/gcc/testsuite/g++.old-deja/g++.ext/return1.C b/gcc/testsuite/g++.old-deja/g++.ext/return1.C
index f6bbc4da211..60d7c8abcf8 100644
--- a/gcc/testsuite/g++.old-deja/g++.ext/return1.C
+++ b/gcc/testsuite/g++.old-deja/g++.ext/return1.C
@@ -1,5 +1,5 @@
 // { dg-do assemble  }
-// { dg-options "-Wno-deprecated" }
+// { dg-options "-Wno-deprecated -Wno-return-type" }
 // Test that the named return value extension works when passed as a reference.
 // Origin: Jason Merrill <jason@redhat.com>
 
diff --git a/gcc/testsuite/g++.old-deja/g++.jason/anon4.C b/gcc/testsuite/g++.old-deja/g++.jason/anon4.C
index 588bf263c8d..47b87790119 100644
--- a/gcc/testsuite/g++.old-deja/g++.jason/anon4.C
+++ b/gcc/testsuite/g++.old-deja/g++.jason/anon4.C
@@ -3,6 +3,7 @@
 // PRMS Id: 5371
 // Bug: g++ screws up the alignment of buff and dies.
 
+int
 main()
 {
   union {
@@ -11,4 +12,5 @@ main()
   };
 
   void *p = buff;
+  return 0;
 }
diff --git a/gcc/testsuite/g++.old-deja/g++.jason/enum6.C b/gcc/testsuite/g++.old-deja/g++.jason/enum6.C
index c5bcec9ad7a..4894b55cdb3 100644
--- a/gcc/testsuite/g++.old-deja/g++.jason/enum6.C
+++ b/gcc/testsuite/g++.old-deja/g++.jason/enum6.C
@@ -18,6 +18,7 @@ enum C { c1 = -1, c2 = 0x80000000 };
 enum D { d1 = CHAR_MIN, d2 = CHAR_MAX };
 enum E { e1 = CHAR_MIN, e2 = CHAR_MIN };
 
+int
 main()
 {
   return (sizeof (A) != 4 || sizeof (B) != 4 || sizeof (C) != 8
diff --git a/gcc/testsuite/g++.old-deja/g++.jason/lineno2.C b/gcc/testsuite/g++.old-deja/g++.jason/lineno2.C
index 7f33176493c..a4f524acb70 100644
--- a/gcc/testsuite/g++.old-deja/g++.jason/lineno2.C
+++ b/gcc/testsuite/g++.old-deja/g++.jason/lineno2.C
@@ -8,7 +8,9 @@ public:
 # 200 "lineno2.C"
 };
 
+int
 main()
 {
-   undef1(); // { dg-error "" "" { target *-*-* } 204 }
+   undef1(); // { dg-error "" "" { target *-*-* } 205 }
+   return 0;
 }
diff --git a/gcc/testsuite/g++.old-deja/g++.jason/lineno3.C b/gcc/testsuite/g++.old-deja/g++.jason/lineno3.C
index 997267e7244..8e305606b64 100644
--- a/gcc/testsuite/g++.old-deja/g++.jason/lineno3.C
+++ b/gcc/testsuite/g++.old-deja/g++.jason/lineno3.C
@@ -7,7 +7,7 @@ template <class T> class A
 {
 public:
 # 200 "lineno3.C"
-      int foo () { undef1(); } // { dg-error "" "" { target *-*-* } 200 }
+      void foo () { undef1(); } // { dg-error "" "" { target *-*-* } 200 }
       // { dg-message "note" "note" { target *-*-* } 200 }
 };
 
diff --git a/gcc/testsuite/g++.old-deja/g++.jason/lineno4.C b/gcc/testsuite/g++.old-deja/g++.jason/lineno4.C
index caa5bc216cd..703c897d12f 100644
--- a/gcc/testsuite/g++.old-deja/g++.jason/lineno4.C
+++ b/gcc/testsuite/g++.old-deja/g++.jason/lineno4.C
@@ -7,7 +7,7 @@ template <class T> class A
 public:
 
 # 200 "lineno4.C"
-      int foo () { undef1(); } // { dg-error "" "" { target *-*-* } 200 }
+      void foo () { undef1(); } // { dg-error "" "" { target *-*-* } 200 }
       // { dg-message "note" "note" { target *-*-* } 200 }
 };
 
diff --git a/gcc/testsuite/g++.old-deja/g++.jason/new2.C b/gcc/testsuite/g++.old-deja/g++.jason/new2.C
index 75d353da124..a2e000e19bf 100644
--- a/gcc/testsuite/g++.old-deja/g++.jason/new2.C
+++ b/gcc/testsuite/g++.old-deja/g++.jason/new2.C
@@ -7,7 +7,9 @@ struct A {
   A() { i = 2; }
 };
  
+int
 main()
 {
   A *p = new A ();
+  return 0;
 }
diff --git a/gcc/testsuite/g++.old-deja/g++.jason/new4.C b/gcc/testsuite/g++.old-deja/g++.jason/new4.C
index 770a2a26f92..d09ca1453cc 100644
--- a/gcc/testsuite/g++.old-deja/g++.jason/new4.C
+++ b/gcc/testsuite/g++.old-deja/g++.jason/new4.C
@@ -10,6 +10,7 @@ struct A {
 A* ap = new A (1);
 A* ap2 = new A[3];
 
+int
 main ()
 {
   if (ap->i != 1 || ap2[0].i != 42 || ap2[1].i != 42 || ap2[2].i != 42)
@@ -20,4 +21,6 @@ main ()
 
   if (ap->i != 1 || ap2[0].i != 42 || ap2[1].i != 42 || ap2[2].i != 42)
     return 1;
+
+  return 0;
 }
diff --git a/gcc/testsuite/g++.old-deja/g++.jason/shadow1.C b/gcc/testsuite/g++.old-deja/g++.jason/shadow1.C
index 941f80cfc00..fe3ec951b78 100644
--- a/gcc/testsuite/g++.old-deja/g++.jason/shadow1.C
+++ b/gcc/testsuite/g++.old-deja/g++.jason/shadow1.C
@@ -10,7 +10,9 @@ private:
 
 void x::fun() { }
 
+int
 main ()
 {
         float foo;
+	return 0;
 }
diff --git a/gcc/testsuite/g++.old-deja/g++.jason/tempcons.C b/gcc/testsuite/g++.old-deja/g++.jason/tempcons.C
index a9974dbf779..d56eab51978 100644
--- a/gcc/testsuite/g++.old-deja/g++.jason/tempcons.C
+++ b/gcc/testsuite/g++.old-deja/g++.jason/tempcons.C
@@ -4,5 +4,5 @@
 template <class T>
 struct A {
   int i;
-  Blarg () : i(0) { }		// { dg-error "" } 
+  Blarg () : i(0) { return 0; }		// { dg-error "" } 
 };
diff --git a/gcc/testsuite/g++.old-deja/g++.jason/thunk2.C b/gcc/testsuite/g++.old-deja/g++.jason/thunk2.C
index 427ef7f921d..8c02fc8f1d9 100644
--- a/gcc/testsuite/g++.old-deja/g++.jason/thunk2.C
+++ b/gcc/testsuite/g++.old-deja/g++.jason/thunk2.C
@@ -40,10 +40,13 @@ void* test(MMixin& anExample)
   return anExample.MixinFunc(1,A(0)).p;
 }
 
+int
 main ()
 {
   CExample c;
 
   if (test(c) != &c)
     return 1;
+
+  return 0;
 }
diff --git a/gcc/testsuite/g++.old-deja/g++.law/builtin1.C b/gcc/testsuite/g++.old-deja/g++.law/builtin1.C
index 67b71a83685..de228642250 100644
--- a/gcc/testsuite/g++.old-deja/g++.law/builtin1.C
+++ b/gcc/testsuite/g++.old-deja/g++.law/builtin1.C
@@ -14,4 +14,6 @@ extern "C" int printf (const char *, ...);
 void* junk() {
   return __builtin_alloca(10);
 }
-main() { printf ("PASS\n");}
+
+int
+main() { printf ("PASS\n"); return 0; }
diff --git a/gcc/testsuite/g++.old-deja/g++.law/enum9.C b/gcc/testsuite/g++.old-deja/g++.law/enum9.C
index a1a551d6e55..4fdb7aaeff5 100644
--- a/gcc/testsuite/g++.old-deja/g++.law/enum9.C
+++ b/gcc/testsuite/g++.old-deja/g++.law/enum9.C
@@ -15,6 +15,7 @@
 
   enum E { A = 0x80000000, B = 0 };
 
+  int
   main()
   {
     if (sizeof (E) != 4)
diff --git a/gcc/testsuite/g++.old-deja/g++.law/except3.C b/gcc/testsuite/g++.old-deja/g++.law/except3.C
index ec8bb100ee7..dc416eb3682 100644
--- a/gcc/testsuite/g++.old-deja/g++.law/except3.C
+++ b/gcc/testsuite/g++.old-deja/g++.law/except3.C
@@ -34,6 +34,7 @@ void do_something(Vector& v)
     int i = v[v.size()+10];
 }
  
+int
 main()
 {
     Vector v(10);
diff --git a/gcc/testsuite/g++.old-deja/g++.law/init6.C b/gcc/testsuite/g++.old-deja/g++.law/init6.C
index 861b9252c95..65a07803070 100644
--- a/gcc/testsuite/g++.old-deja/g++.law/init6.C
+++ b/gcc/testsuite/g++.old-deja/g++.law/init6.C
@@ -1,4 +1,5 @@
 // { dg-do assemble  }
+// { dg-additional-options "-Wno-return-type" }
 // GROUPS passed initialization
 class Vector {
         double  *v;
diff --git a/gcc/testsuite/g++.old-deja/g++.law/profile1.C b/gcc/testsuite/g++.old-deja/g++.law/profile1.C
index ecd3b834c76..66ef7766d04 100644
--- a/gcc/testsuite/g++.old-deja/g++.law/profile1.C
+++ b/gcc/testsuite/g++.old-deja/g++.law/profile1.C
@@ -4,9 +4,12 @@
 // { dg-options "-pg -static" { target hppa*-*-hpux* } }
 // GROUPS passed profiling
 #include <stdio.h>
+
+int
 main()
 {
   printf ("PASS\n");
+  return 0;
 }
 
 /* { dg-final { cleanup-profile-file } } */
diff --git a/gcc/testsuite/g++.old-deja/g++.law/shadow2.C b/gcc/testsuite/g++.old-deja/g++.law/shadow2.C
index 46f9dfcc32f..64d967a01d5 100644
--- a/gcc/testsuite/g++.old-deja/g++.law/shadow2.C
+++ b/gcc/testsuite/g++.old-deja/g++.law/shadow2.C
@@ -22,7 +22,9 @@ public:
   int f (int count) { return (count); }
 };
 
+int
 main ()
 {
   Y<char> y;
+  return 0;
 }
diff --git a/gcc/testsuite/g++.old-deja/g++.law/temps4.C b/gcc/testsuite/g++.old-deja/g++.law/temps4.C
index 3f8c9ed2c7d..df930537e2e 100644
--- a/gcc/testsuite/g++.old-deja/g++.law/temps4.C
+++ b/gcc/testsuite/g++.old-deja/g++.law/temps4.C
@@ -31,10 +31,13 @@ X foo() {
     return x;
 }
 
+int
 main() {
     X x = foo();
     if (did_it)
 	abort ();
     else
 	printf ("PASS\n");
+
+    return 0;
 }
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/bool2.C b/gcc/testsuite/g++.old-deja/g++.mike/bool2.C
index 3d8bc3c03eb..32b3d8c0f78 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/bool2.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/bool2.C
@@ -46,6 +46,8 @@ int i = true;
 bool b = true;
 bool c = (bool)(void (A::*)())0;
 bool d = 256;
+
+int
 main() {
   if (!d) return 1;
   if (!a) return 1;
@@ -55,4 +57,6 @@ main() {
   if (!a2) return 1;
   if (!a3) return 1;
   if (!a5) return 1;
+
+  return 0;
 }
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh1.C b/gcc/testsuite/g++.old-deja/g++.mike/eh1.C
index 8105107f363..98191a20bc5 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/eh1.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/eh1.C
@@ -24,6 +24,7 @@ struct Exception
      }
  }
 
+int
 main (int argc, const char *argv[])
 {
   if (argc != 2)
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh10.C b/gcc/testsuite/g++.old-deja/g++.mike/eh10.C
index a38e2ebc770..32587d4c158 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/eh10.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/eh10.C
@@ -16,6 +16,7 @@ void bar() {
 
 void ee(int *) { }
 
+int
 main() {
   try {
     foo();
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh13.C b/gcc/testsuite/g++.old-deja/g++.mike/eh13.C
index bac56865576..e2c7435c5ca 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/eh13.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/eh13.C
@@ -3,4 +3,4 @@
 
 #include <string>
 
-main() { }
+int main() { return 0; }
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh16.C b/gcc/testsuite/g++.old-deja/g++.mike/eh16.C
index 73beac0a5bd..7a985908f3b 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/eh16.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/eh16.C
@@ -16,6 +16,7 @@ struct B {
   }
 };
 
+int
 main() {
   try {
     B b;
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh17.C b/gcc/testsuite/g++.old-deja/g++.mike/eh17.C
index 5b066c9c36b..2443d568024 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/eh17.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/eh17.C
@@ -15,6 +15,7 @@ struct B : public A {
   }
 };
 
+int
 main() {
   try {
     B b;
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh2.C b/gcc/testsuite/g++.old-deja/g++.mike/eh2.C
index 0a08790fe03..862bd6e7598 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/eh2.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/eh2.C
@@ -63,12 +63,10 @@ f(Vector& v) {
   }
 }
 
+int
 main() {
   Vector v(10);
 
   f( v );
   return 1;
 }
-
-
-
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh23.C b/gcc/testsuite/g++.old-deja/g++.mike/eh23.C
index da2ac0ef39d..64733371b51 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/eh23.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/eh23.C
@@ -36,6 +36,7 @@ void my_terminate() {
   exit (0);		// double faults should call terminate
 }
 
+int
 main() {
   std::set_terminate (my_terminate);
   try {
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh24.C b/gcc/testsuite/g++.old-deja/g++.mike/eh24.C
index 829819b396d..89b27c88fd7 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/eh24.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/eh24.C
@@ -15,6 +15,7 @@ struct A {
   }
 };
 
+int
 main() {
   try {
     try {
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh25.C b/gcc/testsuite/g++.old-deja/g++.mike/eh25.C
index 0ac61981b97..6516494dd44 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/eh25.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/eh25.C
@@ -22,6 +22,7 @@ struct A {
   }
 };
 
+int
 main() {
   try {
     try {
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh26.C b/gcc/testsuite/g++.old-deja/g++.mike/eh26.C
index d0d65da311a..6d82a4e73a6 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/eh26.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/eh26.C
@@ -3,6 +3,7 @@
 
 class MyExceptionHandler { };
 
+int
 main() {
   try {
     throw MyExceptionHandler();
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh27.C b/gcc/testsuite/g++.old-deja/g++.mike/eh27.C
index 8be08da8c26..dcfb5e7a093 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/eh27.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/eh27.C
@@ -5,6 +5,7 @@
 
 class MyExceptionHandler { };
 
+int
 main() {
   try {
     throw MyExceptionHandler();
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh28.C b/gcc/testsuite/g++.old-deja/g++.mike/eh28.C
index 57cab1178a4..47cd3861ca1 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/eh28.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/eh28.C
@@ -8,6 +8,7 @@ int fail = 1;
 class X            { public: virtual void p() { } };
 class Y : public X { public: virtual void p() { fail = 0; } };
 
+int
 main()
 {
   try          { Y y; throw y; }
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh29.C b/gcc/testsuite/g++.old-deja/g++.mike/eh29.C
index 892e959647e..bcb4cea2874 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/eh29.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/eh29.C
@@ -17,6 +17,7 @@ public:
   }
 };
 
+int
 main() {
   try {
     A a[5];
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh30.C b/gcc/testsuite/g++.old-deja/g++.mike/eh30.C
index 8da682c5341..848809245c1 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/eh30.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/eh30.C
@@ -1,4 +1,5 @@
 // { dg-do assemble { target native } }
 // { dg-options "-fexceptions -fPIC -S" }
 
+int
 main() { throw 1; }
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh31.C b/gcc/testsuite/g++.old-deja/g++.mike/eh31.C
index 150d66b98a6..d7e84dd71e0 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/eh31.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/eh31.C
@@ -11,6 +11,7 @@ public:
 };
 
 
+int
 main() {
   try {
     throw Foo();
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh35.C b/gcc/testsuite/g++.old-deja/g++.mike/eh35.C
index adf852a64a3..9ea5a662d56 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/eh35.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/eh35.C
@@ -1,6 +1,7 @@
 // { dg-do run { xfail sparc64-*-elf arm-*-pe } }
 // { dg-options "-fexceptions" }
 
+int
 main() {
   try {  
     throw 'a';
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh36.C b/gcc/testsuite/g++.old-deja/g++.mike/eh36.C
index d6b4788cbfa..ba9e814ca3d 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/eh36.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/eh36.C
@@ -18,6 +18,7 @@ public:
   }
 } d(42);
 
+int
 main() {
   try {
     throw &d;
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh37.C b/gcc/testsuite/g++.old-deja/g++.mike/eh37.C
index a98b5df997f..63774119dd5 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/eh37.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/eh37.C
@@ -10,6 +10,7 @@ public:
   }
 } b(42);
 
+int
 main() {
   try {
     throw &b;
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh38.C b/gcc/testsuite/g++.old-deja/g++.mike/eh38.C
index 5a568798259..6482b900818 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/eh38.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/eh38.C
@@ -10,6 +10,7 @@ public:
   }
 } b(42);
 
+int
 main() {
   try {
     throw &b;
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh39.C b/gcc/testsuite/g++.old-deja/g++.mike/eh39.C
index e4bfff8d17a..8f8a84481e6 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/eh39.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/eh39.C
@@ -18,6 +18,7 @@ D::D() try : B() {
   throw;
 }
 
+int
 main() {
   try {
     D d;
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh40.C b/gcc/testsuite/g++.old-deja/g++.mike/eh40.C
index e42b419747a..f08836064c4 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/eh40.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/eh40.C
@@ -19,6 +19,7 @@ public:
   }
 };
 
+int
 main() {
   try {
     D d;
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh47.C b/gcc/testsuite/g++.old-deja/g++.mike/eh47.C
index 10eb8a8970f..36d3b9db329 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/eh47.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/eh47.C
@@ -8,6 +8,7 @@ void myterm() {
   exit (0);
 }
 
+int
 main() {
   try {
     throw "";
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh50.C b/gcc/testsuite/g++.old-deja/g++.mike/eh50.C
index 0ebaab41fa6..028a2de0c23 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/eh50.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/eh50.C
@@ -10,6 +10,7 @@ void my_unexpected() {
 
 template <class T> void foo(T) throw (int) { throw "Hi"; }	// { dg-warning "deprecated" "" { target c++11 } }
 
+int
 main() {
   std::set_unexpected (my_unexpected);
   try {
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh51.C b/gcc/testsuite/g++.old-deja/g++.mike/eh51.C
index 7d3cd413ee7..428635b175d 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/eh51.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/eh51.C
@@ -10,6 +10,7 @@ void my_unexpected() {
 
 template <class T> void foo(T) throw (T) { throw "Hi"; }	// { dg-warning "deprecated" "" { target c++11 } }
 
+int
 main() {
   std::set_unexpected (my_unexpected);
   try {
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh7.C b/gcc/testsuite/g++.old-deja/g++.mike/eh7.C
index f431fb96d86..6a0502c484e 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/eh7.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/eh7.C
@@ -1,6 +1,7 @@
 // { dg-do run { xfail sparc64-*-elf arm-*-pe } }
 // { dg-options "-fexceptions" }
 
+int
 main() {
   if (0)
     throw 1 | 2;
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh8.C b/gcc/testsuite/g++.old-deja/g++.mike/eh8.C
index 8e01da0b51b..be69abcf855 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/eh8.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/eh8.C
@@ -5,6 +5,7 @@ extern "C" int printf(const char *, ...);
 
 int i;
 
+int
 main() {
   try {
     try {
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh9.C b/gcc/testsuite/g++.old-deja/g++.mike/eh9.C
index 633642faa95..a84bc27df49 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/eh9.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/eh9.C
@@ -1,4 +1,5 @@
 // { dg-do run { xfail sparc64-*-elf arm-*-pe } }
 // { dg-options "-fexceptions" }
 
+int
 main() throw () { }
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/mangle1.C b/gcc/testsuite/g++.old-deja/g++.mike/mangle1.C
index de5e96588b3..3053af9dd58 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/mangle1.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/mangle1.C
@@ -22,6 +22,7 @@ void f3() {
 }
 #endif
 
+int
 main() {
   f.bar(foo::red);
 }
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p5958.C b/gcc/testsuite/g++.old-deja/g++.mike/p5958.C
index 666a4494509..ffcb13401da 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/p5958.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/p5958.C
@@ -4,6 +4,7 @@
 
 class A { };
 
+int
 main() {
   int i = 1;
   if (1 not_eq 1)
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p6004.C b/gcc/testsuite/g++.old-deja/g++.mike/p6004.C
index 2b262bdb047..d1db7e006fe 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/p6004.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/p6004.C
@@ -16,6 +16,7 @@ int bar3() { return 43; }
 
 int A::foo() { return 42; }
 
+int
 main() {
   return A::foo() - 42;
 }
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p700.C b/gcc/testsuite/g++.old-deja/g++.mike/p700.C
index 62247791775..e4537c72868 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/p700.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/p700.C
@@ -1,5 +1,5 @@
 // { dg-do assemble  }
-// { dg-options "-Wno-deprecated -Wno-register -Wno-builtin-declaration-mismatch" }
+// { dg-options "-Wno-deprecated -Wno-register -Wno-builtin-declaration-mismatch -Wno-return-type" }
 // { dg-error "limited range of data type" "16-bit target" { target xstormy16-*-* } 0 }
 // prms-id: 700
 
@@ -2111,6 +2111,7 @@ char mystrcmp(String30 s, String30 t)
 
 
 
+int
 main()
 {
 	Proc0();
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p7912.C b/gcc/testsuite/g++.old-deja/g++.mike/p7912.C
index e5584ec4cd9..fe381e2d0e6 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/p7912.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/p7912.C
@@ -12,6 +12,7 @@ public:
 };
 
 
+int
 main()
 {
   try {
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p811.C b/gcc/testsuite/g++.old-deja/g++.mike/p811.C
index 5c8260aa1f8..656fb213d25 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/p811.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/p811.C
@@ -535,6 +535,7 @@ X::stringify2()   // { dg-error "no declaration matches" }
     return "stringify2";
 }
 
+int
 main()
 {
     X x;
@@ -547,4 +548,6 @@ main()
     cout << "y\n";
     cout << y.stringify() << '\n';
     cout << y.stringify2() << '\n';
+
+    return 0;
 }
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/virt4.C b/gcc/testsuite/g++.old-deja/g++.mike/virt4.C
index 2d8b042632a..b6e4411ff65 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/virt4.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/virt4.C
@@ -22,7 +22,9 @@ public:
   void foo() { D1::foo(); D2::foo(); }
 };
 
+int
 main() {
   D1_2 h;
   h.foo();
+  return 0;
 }
diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/nameret1.C b/gcc/testsuite/g++.old-deja/g++.oliva/nameret1.C
index b32deedd4ee..8e5eccc293a 100644
--- a/gcc/testsuite/g++.old-deja/g++.oliva/nameret1.C
+++ b/gcc/testsuite/g++.old-deja/g++.oliva/nameret1.C
@@ -1,5 +1,5 @@
 // { dg-do assemble  }
-// { dg-options "-Wno-deprecated" }
+// { dg-options "-Wno-deprecated -Wno-return-type" }
 // Copyright (C) 1999, 2000, 2002 Free Software Foundation
 
 // by Alexandre Oliva <oliva@lsd.ic.unicamp.br>
diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/nameret2.C b/gcc/testsuite/g++.old-deja/g++.oliva/nameret2.C
index e0dfb7e129c..5f86b1c8417 100644
--- a/gcc/testsuite/g++.old-deja/g++.oliva/nameret2.C
+++ b/gcc/testsuite/g++.old-deja/g++.oliva/nameret2.C
@@ -1,5 +1,5 @@
 // { dg-do assemble  }
-// { dg-options "-O1 -Wno-deprecated" }
+// { dg-options "-O1 -Wno-deprecated -Wno-return-type" }
 // Copyright (C) 1999, 2000, 2002 Free Software Foundation
 
 // by Alexandre Oliva <oliva@lsd.ic.unicamp.br>
diff --git a/gcc/testsuite/g++.old-deja/g++.other/decl1.C b/gcc/testsuite/g++.old-deja/g++.other/decl1.C
index 07bcc914521..6262bf307df 100644
--- a/gcc/testsuite/g++.old-deja/g++.other/decl1.C
+++ b/gcc/testsuite/g++.old-deja/g++.other/decl1.C
@@ -6,4 +6,5 @@ int foo(int);
 int bar() {
   int baz(int(foo(0)));
   int foo = baz;
+  return 0;
 }
diff --git a/gcc/testsuite/g++.old-deja/g++.other/expr1.C b/gcc/testsuite/g++.old-deja/g++.other/expr1.C
index 831876d01cb..415f0f19ef2 100644
--- a/gcc/testsuite/g++.old-deja/g++.other/expr1.C
+++ b/gcc/testsuite/g++.old-deja/g++.other/expr1.C
@@ -3,9 +3,10 @@
 // Simplified from bug report by Trevor Taylor <ttaylor@powerup.com.au>
 
 struct T {
-  int operator()(int) { } // { dg-message "operator|candidate expects" }
+  int operator()(int) { return 0; } // { dg-message "operator|candidate expects" }
 };
 
 int main() {
   T()(); // { dg-error "match" } no such operator
+  return 0;
 }
diff --git a/gcc/testsuite/g++.old-deja/g++.other/inline8.C b/gcc/testsuite/g++.old-deja/g++.other/inline8.C
index a46dc382a7d..c12a8f74a90 100644
--- a/gcc/testsuite/g++.old-deja/g++.other/inline8.C
+++ b/gcc/testsuite/g++.old-deja/g++.other/inline8.C
@@ -62,8 +62,10 @@ bool operator<(const NAMES_ITEM& n1, const NAMES_ITEM& n2)
     lookup_t lookup;
 
 	NAMES_ITEM item ("one");
+
+int
 main()
   {
         lookup.insert(pair<NAMES_ITEM,size_t>(item,0));
+	return 0;
   }
-
diff --git a/gcc/testsuite/g++.old-deja/g++.other/loop1.C b/gcc/testsuite/g++.old-deja/g++.other/loop1.C
index 168734c545b..45b2acc3ef6 100644
--- a/gcc/testsuite/g++.old-deja/g++.other/loop1.C
+++ b/gcc/testsuite/g++.old-deja/g++.other/loop1.C
@@ -24,6 +24,7 @@ bool test ()
   return true;
 }
 
+int
 main ()
 {
   f (test);
diff --git a/gcc/testsuite/g++.old-deja/g++.other/syntax1.C b/gcc/testsuite/g++.old-deja/g++.other/syntax1.C
index f1d3a86549c..d219048bb68 100644
--- a/gcc/testsuite/g++.old-deja/g++.other/syntax1.C
+++ b/gcc/testsuite/g++.old-deja/g++.other/syntax1.C
@@ -11,7 +11,9 @@ void AAA::fff() {}
 
 AAA aaa;
 
+int
 main ()
 {
   aaa.fff();
+  return 0;
 }
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/repo3.C b/gcc/testsuite/g++.old-deja/g++.pt/repo3.C
index 53baf29f349..2f62139660e 100644
--- a/gcc/testsuite/g++.old-deja/g++.pt/repo3.C
+++ b/gcc/testsuite/g++.old-deja/g++.pt/repo3.C
@@ -29,9 +29,11 @@ struct D : public B<T>, public C<T>
 {
 };
 
+int
 main ()
 {
   D<int> x;
+  return 0;
 }
 
 // { dg-final { cleanup-repo-files } }
diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb27.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb27.C
index 204a143d619..2fe151cea7d 100644
--- a/gcc/testsuite/g++.old-deja/g++.robertl/eb27.C
+++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb27.C
@@ -1,5 +1,6 @@
 // { dg-do assemble  }
 // { dg-options "-Wno-deprecated" }
+// { dg-additional-options "-Wno-return-type" }
 /* bug.cc */
 /* simple program to demonstrate the bug with named return values in gcc
 */
@@ -39,4 +40,5 @@ int main()
    std::cout << x << std::endl;
    y = x + test<int>(2); 
    std::cout << y << std::endl;
+   return 0;
 }
diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb83.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb83.C
index ecdb6bed788..47cf5b88f04 100644
--- a/gcc/testsuite/g++.old-deja/g++.robertl/eb83.C
+++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb83.C
@@ -8,11 +8,13 @@ test_swap(int& x, int& y) throw()
   y = tmp;
 }
 
+int
 main()
 {
   int i = 5;
   int j = 7;
   test_swap(i, j);
+  return 0;
 }
 
 /* { dg-final { cleanup-coverage-files } } */
diff --git a/gcc/testsuite/gcc.dg/pr44545.c b/gcc/testsuite/gcc.dg/pr44545.c
index 51983ef76b9..8058261f850 100644
--- a/gcc/testsuite/gcc.dg/pr44545.c
+++ b/gcc/testsuite/gcc.dg/pr44545.c
@@ -1,6 +1,6 @@
 /* { dg-do compile } */
 /* { dg-options "-O2 -fnon-call-exceptions -ftrapv -fexceptions" } */
-int
+void
 DrawChunk(int *tabSize, int x) 
 {
   const int numEnds = 10;
diff --git a/gcc/testsuite/obj-c++.dg/comp-types-8.mm b/gcc/testsuite/obj-c++.dg/comp-types-8.mm
index 490f4ff1938..6db76bb20f3 100644
--- a/gcc/testsuite/obj-c++.dg/comp-types-8.mm
+++ b/gcc/testsuite/obj-c++.dg/comp-types-8.mm
@@ -1,4 +1,5 @@
 /* { dg-do compile } */
+/* { dg-additional-options "-Wno-return-type" } */
 
 /* We used to ICE because we removed the cast to List_linked*
    in -[ListIndex_linked next]. */
diff --git a/gcc/testsuite/obj-c++.dg/demangle-3.mm b/gcc/testsuite/obj-c++.dg/demangle-3.mm
index 01e6c618e5e..afb83d75bfe 100644
--- a/gcc/testsuite/obj-c++.dg/demangle-3.mm
+++ b/gcc/testsuite/obj-c++.dg/demangle-3.mm
@@ -1,5 +1,6 @@
 /* Test demangling an Objective-C method in error messages.  */
 /* { dg-do compile } */
+/* { dg-additional-options "-Wno-return-type" } */
 
 #include <objc/objc.h>
 
diff --git a/gcc/testsuite/obj-c++.dg/super-class-1.mm b/gcc/testsuite/obj-c++.dg/super-class-1.mm
index f8cccb3d4c8..ad14a58c29a 100644
--- a/gcc/testsuite/obj-c++.dg/super-class-1.mm
+++ b/gcc/testsuite/obj-c++.dg/super-class-1.mm
@@ -1,6 +1,7 @@
 /* Test calling super from within a category method.  */
 
 /* { dg-do compile } */
+/* { dg-additional-options "-Wno-return-type" } */
 
 #include <objc/objc.h>
 
-- 
2.14.2


^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH][RFC] Instrument function exit with __builtin_unreachable in C++.
  2017-10-18 12:47           ` Martin Liška
@ 2017-10-18 13:04             ` Marek Polacek
  2017-10-18 13:15               ` Martin Liška
  0 siblings, 1 reply; 64+ messages in thread
From: Marek Polacek @ 2017-10-18 13:04 UTC (permalink / raw)
  To: Martin Liška
  Cc: Jakub Jelinek, Jason Merrill, gcc-patches List, Jonathan Wakely

On Wed, Oct 18, 2017 at 02:46:23PM +0200, Martin Liška wrote:
> On 10/12/2017 10:48 AM, Jakub Jelinek wrote:
> > On Thu, Oct 12, 2017 at 10:40:42AM +0200, Martin Liška wrote:
> >> --- a/gcc/cp/constexpr.c
> >> +++ b/gcc/cp/constexpr.c
> >> @@ -1175,7 +1175,12 @@ cxx_eval_builtin_function_call (const constexpr_ctx *ctx, tree t, tree fun,
> >>  	{
> >>  	  new_call = build_call_array_loc (EXPR_LOCATION (t), TREE_TYPE (t),
> >>  					   CALL_EXPR_FN (t), nargs, args);
> >> -	  error ("%q+E is not a constant expression", new_call);
> >> +
> >> +	  /* Do not allow__builtin_unreachable in constexpr function.  */
> >> +	  if (DECL_FUNCTION_CODE (fun) == BUILT_IN_UNREACHABLE)
> > 
> > As I said earlier, I think it would be better to differentiate between
> > explicit __builtin_unreachable and the implicitly added one from the patch.
> > So this could be done as
> > if (DECL_FUNCTION_CODE (fun) == BUILT_IN_UNREACHABLE
> >     && EXPR_LOCATION (t) == BUILTINS_LOCATION)
> > 
> >> +  location_t loc = DECL_SOURCE_LOCATION (fndecl);
> >> +  if (sanitize_flags_p (SANITIZE_RETURN, fndecl))
> >> +    t = ubsan_instrument_return (loc);
> >> +  else
> >> +    t = build_call_expr_loc (loc, builtin_decl_explicit (BUILT_IN_UNREACHABLE),
> > 
> > and here use BUILTINS_LOCATION instead of loc.
> > The code might be more readable by doing:
> >     {
> >       tree fndecl = builtin_decl_explicit (BUILT_IN_UNREACHABLE);
> >       t = build_call_expr_loc (BUILTINS_LOCATION, fndecl, 0);
> >     }
> > 
> >> +			     0);
> >> +
> > 
> > 	Jakub
> > 
> 
> Hi.
> 
> I'm sending updated version of the patch that should address it.
> 
> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
> 
> Ready to be installed?
> Martin

> From 36f3f45d9fa42344261faf60bb3cfbe22ed262ac Mon Sep 17 00:00:00 2001
> From: marxin <mliska@suse.cz>
> Date: Thu, 12 Oct 2017 10:14:59 +0200
> Subject: [PATCH 1/3] Instrument function exit with __builtin_unreachable in
>  C++
> 
> gcc/c-family/ChangeLog:
> 
> 2017-10-12  Martin Liska  <mliska@suse.cz>
> 
> 	PR middle-end/82404
> 	* c-opts.c (c_common_post_options): Set -Wreturn-type for C++
> 	FE.
> 	* c.opt: Set default value of warn_return_type.
> 
> gcc/cp/ChangeLog:
> 
> 2017-10-12  Martin Liska  <mliska@suse.cz>
> 
> 	PR middle-end/82404
> 	* constexpr.c (cxx_eval_builtin_function_call): Handle
> 	__builtin_unreachable call.
> 	* cp-gimplify.c (cp_ubsan_maybe_instrument_return): Rename to
> 	...
> 	(cp_maybe_instrument_return): ... this.
> 	(cp_genericize): Call the function unconditionally.
> 
> gcc/fortran/ChangeLog:
> 
> 2017-10-12  Martin Liska  <mliska@suse.cz>
> 
> 	PR middle-end/82404
> 	* options.c (gfc_post_options): Set default value of
> 	-Wreturn-type to false.
> ---
>  gcc/c-family/c-opts.c |  3 +++
>  gcc/c-family/c.opt    |  2 +-
>  gcc/cp/constexpr.c    |  8 +++++++-
>  gcc/cp/cp-gimplify.c  | 20 ++++++++++++++------
>  gcc/fortran/options.c |  3 +++
>  5 files changed, 28 insertions(+), 8 deletions(-)
> 
> diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
> index 6bd535532d3..682d7a83ec5 100644
> --- a/gcc/c-family/c-opts.c
> +++ b/gcc/c-family/c-opts.c
> @@ -978,6 +978,9 @@ c_common_post_options (const char **pfilename)
>  	flag_extern_tls_init = 1;
>      }
>  
> +  if (warn_return_type == -1)
> +    warn_return_type = c_dialect_cxx () ? 1 : 0;

Here you can simply

  warn_return_type = c_dialect_cxx ();

no?

	Marek

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH][RFC] Instrument function exit with __builtin_unreachable in C++.
  2017-10-18 13:04             ` Marek Polacek
@ 2017-10-18 13:15               ` Martin Liška
  2017-10-24 14:30                 ` Jason Merrill
  0 siblings, 1 reply; 64+ messages in thread
From: Martin Liška @ 2017-10-18 13:15 UTC (permalink / raw)
  To: Marek Polacek
  Cc: Jakub Jelinek, Jason Merrill, gcc-patches List, Jonathan Wakely

[-- Attachment #1: Type: text/plain, Size: 3573 bytes --]

On 10/18/2017 02:52 PM, Marek Polacek wrote:
> On Wed, Oct 18, 2017 at 02:46:23PM +0200, Martin Liška wrote:
>> On 10/12/2017 10:48 AM, Jakub Jelinek wrote:
>>> On Thu, Oct 12, 2017 at 10:40:42AM +0200, Martin Liška wrote:
>>>> --- a/gcc/cp/constexpr.c
>>>> +++ b/gcc/cp/constexpr.c
>>>> @@ -1175,7 +1175,12 @@ cxx_eval_builtin_function_call (const constexpr_ctx *ctx, tree t, tree fun,
>>>>  	{
>>>>  	  new_call = build_call_array_loc (EXPR_LOCATION (t), TREE_TYPE (t),
>>>>  					   CALL_EXPR_FN (t), nargs, args);
>>>> -	  error ("%q+E is not a constant expression", new_call);
>>>> +
>>>> +	  /* Do not allow__builtin_unreachable in constexpr function.  */
>>>> +	  if (DECL_FUNCTION_CODE (fun) == BUILT_IN_UNREACHABLE)
>>>
>>> As I said earlier, I think it would be better to differentiate between
>>> explicit __builtin_unreachable and the implicitly added one from the patch.
>>> So this could be done as
>>> if (DECL_FUNCTION_CODE (fun) == BUILT_IN_UNREACHABLE
>>>     && EXPR_LOCATION (t) == BUILTINS_LOCATION)
>>>
>>>> +  location_t loc = DECL_SOURCE_LOCATION (fndecl);
>>>> +  if (sanitize_flags_p (SANITIZE_RETURN, fndecl))
>>>> +    t = ubsan_instrument_return (loc);
>>>> +  else
>>>> +    t = build_call_expr_loc (loc, builtin_decl_explicit (BUILT_IN_UNREACHABLE),
>>>
>>> and here use BUILTINS_LOCATION instead of loc.
>>> The code might be more readable by doing:
>>>     {
>>>       tree fndecl = builtin_decl_explicit (BUILT_IN_UNREACHABLE);
>>>       t = build_call_expr_loc (BUILTINS_LOCATION, fndecl, 0);
>>>     }
>>>
>>>> +			     0);
>>>> +
>>>
>>> 	Jakub
>>>
>>
>> Hi.
>>
>> I'm sending updated version of the patch that should address it.
>>
>> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
>>
>> Ready to be installed?
>> Martin
> 
>> From 36f3f45d9fa42344261faf60bb3cfbe22ed262ac Mon Sep 17 00:00:00 2001
>> From: marxin <mliska@suse.cz>
>> Date: Thu, 12 Oct 2017 10:14:59 +0200
>> Subject: [PATCH 1/3] Instrument function exit with __builtin_unreachable in
>>  C++
>>
>> gcc/c-family/ChangeLog:
>>
>> 2017-10-12  Martin Liska  <mliska@suse.cz>
>>
>> 	PR middle-end/82404
>> 	* c-opts.c (c_common_post_options): Set -Wreturn-type for C++
>> 	FE.
>> 	* c.opt: Set default value of warn_return_type.
>>
>> gcc/cp/ChangeLog:
>>
>> 2017-10-12  Martin Liska  <mliska@suse.cz>
>>
>> 	PR middle-end/82404
>> 	* constexpr.c (cxx_eval_builtin_function_call): Handle
>> 	__builtin_unreachable call.
>> 	* cp-gimplify.c (cp_ubsan_maybe_instrument_return): Rename to
>> 	...
>> 	(cp_maybe_instrument_return): ... this.
>> 	(cp_genericize): Call the function unconditionally.
>>
>> gcc/fortran/ChangeLog:
>>
>> 2017-10-12  Martin Liska  <mliska@suse.cz>
>>
>> 	PR middle-end/82404
>> 	* options.c (gfc_post_options): Set default value of
>> 	-Wreturn-type to false.
>> ---
>>  gcc/c-family/c-opts.c |  3 +++
>>  gcc/c-family/c.opt    |  2 +-
>>  gcc/cp/constexpr.c    |  8 +++++++-
>>  gcc/cp/cp-gimplify.c  | 20 ++++++++++++++------
>>  gcc/fortran/options.c |  3 +++
>>  5 files changed, 28 insertions(+), 8 deletions(-)
>>
>> diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
>> index 6bd535532d3..682d7a83ec5 100644
>> --- a/gcc/c-family/c-opts.c
>> +++ b/gcc/c-family/c-opts.c
>> @@ -978,6 +978,9 @@ c_common_post_options (const char **pfilename)
>>  	flag_extern_tls_init = 1;
>>      }
>>  
>> +  if (warn_return_type == -1)
>> +    warn_return_type = c_dialect_cxx () ? 1 : 0;
> 
> Here you can simply
> 
>   warn_return_type = c_dialect_cxx ();
> 
> no?
> 
> 	Marek
> 

Yes, thanks for the nit.

Martin

[-- Attachment #2: 0001-Instrument-function-exit-with-__builtin_unreachable-.patch --]
[-- Type: text/x-patch, Size: 5150 bytes --]

From 8bbb75392d13430ce43cc1c0572ec5506d8a4353 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Thu, 12 Oct 2017 10:14:59 +0200
Subject: [PATCH 1/3] Instrument function exit with __builtin_unreachable in
 C++

gcc/c-family/ChangeLog:

2017-10-12  Martin Liska  <mliska@suse.cz>

	PR middle-end/82404
	* c-opts.c (c_common_post_options): Set -Wreturn-type for C++
	FE.
	* c.opt: Set default value of warn_return_type.

gcc/cp/ChangeLog:

2017-10-12  Martin Liska  <mliska@suse.cz>

	PR middle-end/82404
	* constexpr.c (cxx_eval_builtin_function_call): Handle
	__builtin_unreachable call.
	* cp-gimplify.c (cp_ubsan_maybe_instrument_return): Rename to
	...
	(cp_maybe_instrument_return): ... this.
	(cp_genericize): Call the function unconditionally.

gcc/fortran/ChangeLog:

2017-10-12  Martin Liska  <mliska@suse.cz>

	PR middle-end/82404
	* options.c (gfc_post_options): Set default value of
	-Wreturn-type to false.
---
 gcc/c-family/c-opts.c |  3 +++
 gcc/c-family/c.opt    |  2 +-
 gcc/cp/constexpr.c    |  8 +++++++-
 gcc/cp/cp-gimplify.c  | 20 ++++++++++++++------
 gcc/fortran/options.c |  3 +++
 5 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
index 6bd535532d3..2b94128e941 100644
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -978,6 +978,9 @@ c_common_post_options (const char **pfilename)
 	flag_extern_tls_init = 1;
     }
 
+  if (warn_return_type == -1)
+    warn_return_type = c_dialect_cxx ();
+
   if (num_in_fnames > 1)
     error ("too many filenames given.  Type %s --help for usage",
 	   progname);
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index 13d2a59b8a5..e26fba734c0 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -960,7 +960,7 @@ C++ ObjC++ Var(warn_reorder) Warning LangEnabledBy(C++ ObjC++,Wall)
 Warn when the compiler reorders code.
 
 Wreturn-type
-C ObjC C++ ObjC++ Var(warn_return_type) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
+C ObjC C++ ObjC++ Var(warn_return_type) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall) Init(-1)
 Warn whenever a function's return type defaults to \"int\" (C), or about inconsistent return types (C++).
 
 Wscalar-storage-order
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index 59192829d71..15253ffad9d 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -1182,7 +1182,13 @@ cxx_eval_builtin_function_call (const constexpr_ctx *ctx, tree t, tree fun,
 	{
 	  new_call = build_call_array_loc (EXPR_LOCATION (t), TREE_TYPE (t),
 					   CALL_EXPR_FN (t), nargs, args);
-	  error ("%q+E is not a constant expression", new_call);
+
+	  /* Do not allow__builtin_unreachable in constexpr function.  */
+	  if (DECL_FUNCTION_CODE (fun) == BUILT_IN_UNREACHABLE
+	      && EXPR_LOCATION (t) == BUILTINS_LOCATION)
+	    error ("constexpr call flows off the end of the function");
+	  else
+	    error ("%q+E is not a constant expression", new_call);
 	}
       *non_constant_p = true;
       return t;
diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c
index 262485a5c1f..014c1ee7231 100644
--- a/gcc/cp/cp-gimplify.c
+++ b/gcc/cp/cp-gimplify.c
@@ -1556,10 +1556,11 @@ cp_genericize_tree (tree* t_p, bool handle_invisiref_parm_p)
 
 /* If a function that should end with a return in non-void
    function doesn't obviously end with return, add ubsan
-   instrumentation code to verify it at runtime.  */
+   instrumentation code to verify it at runtime.  If -fsanitize=return
+   is not enabled, instrument __builtin_unreachable.  */
 
 static void
-cp_ubsan_maybe_instrument_return (tree fndecl)
+cp_maybe_instrument_return (tree fndecl)
 {
   if (VOID_TYPE_P (TREE_TYPE (TREE_TYPE (fndecl)))
       || DECL_CONSTRUCTOR_P (fndecl)
@@ -1600,7 +1601,16 @@ cp_ubsan_maybe_instrument_return (tree fndecl)
   tree *p = &DECL_SAVED_TREE (fndecl);
   if (TREE_CODE (*p) == BIND_EXPR)
     p = &BIND_EXPR_BODY (*p);
-  t = ubsan_instrument_return (DECL_SOURCE_LOCATION (fndecl));
+
+  location_t loc = DECL_SOURCE_LOCATION (fndecl);
+  if (sanitize_flags_p (SANITIZE_RETURN, fndecl))
+    t = ubsan_instrument_return (loc);
+  else
+    {
+      tree fndecl = builtin_decl_explicit (BUILT_IN_UNREACHABLE);
+      t = build_call_expr_loc (BUILTINS_LOCATION, fndecl, 0);
+    }
+
   append_to_statement_list (t, p);
 }
 
@@ -1674,9 +1684,7 @@ cp_genericize (tree fndecl)
      walk_tree's hash functionality.  */
   cp_genericize_tree (&DECL_SAVED_TREE (fndecl), true);
 
-  if (sanitize_flags_p (SANITIZE_RETURN)
-      && current_function_decl != NULL_TREE)
-    cp_ubsan_maybe_instrument_return (fndecl);
+  cp_maybe_instrument_return (fndecl);
 
   /* Do everything else.  */
   c_genericize (fndecl);
diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c
index f7bbd7f2cde..59e7f028b09 100644
--- a/gcc/fortran/options.c
+++ b/gcc/fortran/options.c
@@ -430,6 +430,9 @@ gfc_post_options (const char **pfilename)
     gfc_fatal_error ("Maximum subrecord length cannot exceed %d",
 		     MAX_SUBRECORD_LENGTH);
 
+  if (warn_return_type == -1)
+    warn_return_type = 0;
+
   gfc_cpp_post_options ();
 
   if (gfc_option.allow_std & GFC_STD_F2008)
-- 
2.14.2


^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH][RFC] Instrument function exit with __builtin_unreachable in C++.
  2017-10-18 13:15               ` Martin Liška
@ 2017-10-24 14:30                 ` Jason Merrill
  2017-11-03 13:42                   ` Martin Liška
  0 siblings, 1 reply; 64+ messages in thread
From: Jason Merrill @ 2017-10-24 14:30 UTC (permalink / raw)
  To: Martin Liška, Marek Polacek
  Cc: Jakub Jelinek, gcc-patches List, Jonathan Wakely

On 10/18/2017 09:07 AM, Martin Liška wrote:
> @@ -1182,7 +1182,13 @@ cxx_eval_builtin_function_call (const constexpr_ctx *ctx, tree t, tree fun,
>  	{
>  	  new_call = build_call_array_loc (EXPR_LOCATION (t), TREE_TYPE (t),
>  					   CALL_EXPR_FN (t), nargs, args);
> -	  error ("%q+E is not a constant expression", new_call);
> +
> +	  /* Do not allow__builtin_unreachable in constexpr function.  */
> +	  if (DECL_FUNCTION_CODE (fun) == BUILT_IN_UNREACHABLE
> +	      && EXPR_LOCATION (t) == BUILTINS_LOCATION)
> +	    error ("constexpr call flows off the end of the function");
> +	  else
> +	    error ("%q+E is not a constant expression", new_call);

You don't need to build new_call in the new case, since you don't use it.

Also, please adjust the comment to say that a __builtin_unreachable call 
with BUILTINS_LOCATION comes from cp_maybe_instrument_return.

OK with those changes.

Jason

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH] Fix all tests that fail with -sanitize=return.
  2017-10-18 12:48           ` [PATCH] Fix all tests that fail with -sanitize=return Martin Liška
@ 2017-10-24 14:39             ` Jason Merrill
  2017-11-06  8:48               ` Martin Liška
  0 siblings, 1 reply; 64+ messages in thread
From: Jason Merrill @ 2017-10-24 14:39 UTC (permalink / raw)
  To: Martin Liška, Jakub Jelinek; +Cc: gcc-patches List, Jonathan Wakely

On 10/18/2017 08:47 AM, Martin Liška wrote:
> This is first patch that addresses test-suite fallout. All these tests fail in runtime.

> +++ b/gcc/testsuite/g++.dg/missing-return.C
> @@ -0,0 +1,8 @@
> +/* { dg-do compile } */
> +/* { dg-options "-Wreturn-type -fdump-tree-optimized" } */
> +
> +int foo(int a)
> +{
> +} /* { dg-warning "no return statement" } */
> +
> +/* { dg-final { scan-tree-dump "__builtin_unreachable" "optimized" } } */

This new test will fail with -fsanitize=return, won't it?

The rest of the patch is OK.

Jason

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH] Fix test-suite fallout of default -Wreturn-type.
  2017-10-18 12:53           ` [PATCH] Fix test-suite fallout of default -Wreturn-type Martin Liška
@ 2017-10-24 14:40             ` Jason Merrill
  2017-10-26 12:17               ` Martin Liška
  2017-11-07 17:33             ` Andreas Schwab
  2017-11-19 13:26             ` Thomas Schwinge
  2 siblings, 1 reply; 64+ messages in thread
From: Jason Merrill @ 2017-10-24 14:40 UTC (permalink / raw)
  To: Martin Liška, Jakub Jelinek; +Cc: gcc-patches List, Jonathan Wakely

On 10/18/2017 08:48 AM, Martin Liška wrote:
> This is second patch that addresses test-suite fallout. All these tests fail because -Wreturn-type is
> now on by default.

> +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-diag3.C
> -constexpr T g(T t) { return f(t); } // { dg-error "f.int" }
> +constexpr T g(T t) { return f(t); } // { dg-error "f.int" "" { target c++14_only } }

> +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-neg3.C
> -  constexpr int bar() { return a.foo(); } // { dg-error "foo" }
> +  constexpr int bar() { return a.foo(); } // { dg-error "foo" "" { target c++14_only } }

Why are these changes needed?  They aren't "Return a value for functions 
with non-void return type, or change type to void, or add 
-Wno-return-type for test."

The rest of the patch is OK.

Jason

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH] Fix test-suite fallout of default -Wreturn-type.
  2017-10-24 14:40             ` Jason Merrill
@ 2017-10-26 12:17               ` Martin Liška
  2017-11-03 15:29                 ` Jason Merrill
  0 siblings, 1 reply; 64+ messages in thread
From: Martin Liška @ 2017-10-26 12:17 UTC (permalink / raw)
  To: Jason Merrill, Jakub Jelinek; +Cc: gcc-patches List, Jonathan Wakely

On 10/24/2017 04:39 PM, Jason Merrill wrote:
> On 10/18/2017 08:48 AM, Martin Liška wrote:
>> This is second patch that addresses test-suite fallout. All these tests fail because -Wreturn-type is
>> now on by default.
> 
>> +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-diag3.C
>> -constexpr T g(T t) { return f(t); } // { dg-error "f.int" }
>> +constexpr T g(T t) { return f(t); } // { dg-error "f.int" "" { target c++14_only } }
> 
>> +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-neg3.C
>> -  constexpr int bar() { return a.foo(); } // { dg-error "foo" }
>> +  constexpr int bar() { return a.foo(); } // { dg-error "foo" "" { target c++14_only } }
> 
> Why are these changes needed?  They aren't "Return a value for functions with non-void return type, or change type to void, or add -Wno-return-type for test."
> 
> The rest of the patch is OK.
> 
> Jason

Hi.

Sorry, I forgot to describe this change. With -std=c++11 we do:

#0  massage_constexpr_body (fun=0x7ffff6955500, body=0x7ffff6813eb8) at ../../gcc/cp/constexpr.c:708
#1  0x000000000087700b in explain_invalid_constexpr_fn (fun=0x7ffff6955500) at ../../gcc/cp/constexpr.c:896
#2  0x00000000008799dc in cxx_eval_call_expression (ctx=0x7fffffffd150, t=0x7ffff6820118, lval=false, non_constant_p=0x7fffffffd1cf, overflow_p=0x7fffffffd1ce) at ../../gcc/cp/constexpr.c:1558
#3  0x00000000008843fe in cxx_eval_constant_expression (ctx=0x7fffffffd150, t=0x7ffff6820118, lval=false, non_constant_p=0x7fffffffd1cf, overflow_p=0x7fffffffd1ce, jump_target=0x0) at ../../gcc/cp/constexpr.c:4069

static tree
massage_constexpr_body (tree fun, tree body)
{
  if (DECL_CONSTRUCTOR_P (fun))
    body = build_constexpr_constructor_member_initializers
      (DECL_CONTEXT (fun), body);
  else if (cxx_dialect < cxx14)
    {
      if (TREE_CODE (body) == EH_SPEC_BLOCK)
        body = EH_SPEC_STMTS (body);
      if (TREE_CODE (body) == MUST_NOT_THROW_EXPR)
	body = TREE_OPERAND (body, 0);
      body = constexpr_fn_retval (body);
    }
  return body;
}

and we end up with error_mark_node and thus potential_constant_expression_1 does bail out.
That's why we don't print the later error with -std=c++11.

What should we do with that?
Thanks,
Martin

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH][RFC] Instrument function exit with __builtin_unreachable in C++.
  2017-10-24 14:30                 ` Jason Merrill
@ 2017-11-03 13:42                   ` Martin Liška
  2017-11-06 17:27                     ` Eric Botcazou
                                       ` (3 more replies)
  0 siblings, 4 replies; 64+ messages in thread
From: Martin Liška @ 2017-11-03 13:42 UTC (permalink / raw)
  To: Jason Merrill, Marek Polacek
  Cc: Jakub Jelinek, gcc-patches List, Jonathan Wakely

[-- Attachment #1: Type: text/plain, Size: 1405 bytes --]

On 10/24/2017 04:19 PM, Jason Merrill wrote:
> On 10/18/2017 09:07 AM, Martin Liška wrote:
>> @@ -1182,7 +1182,13 @@ cxx_eval_builtin_function_call (const constexpr_ctx *ctx, tree t, tree fun,
>>      {
>>        new_call = build_call_array_loc (EXPR_LOCATION (t), TREE_TYPE (t),
>>                         CALL_EXPR_FN (t), nargs, args);
>> -      error ("%q+E is not a constant expression", new_call);
>> +
>> +      /* Do not allow__builtin_unreachable in constexpr function.  */
>> +      if (DECL_FUNCTION_CODE (fun) == BUILT_IN_UNREACHABLE
>> +          && EXPR_LOCATION (t) == BUILTINS_LOCATION)
>> +        error ("constexpr call flows off the end of the function");
>> +      else
>> +        error ("%q+E is not a constant expression", new_call);
> 
> You don't need to build new_call in the new case, since you don't use it.
> 
> Also, please adjust the comment to say that a __builtin_unreachable call with BUILTINS_LOCATION comes from cp_maybe_instrument_return.
> 
> OK with those changes.
> 
> Jason

Hi.

Thank you for review, done that.
Can you please take a look at the single problematic test-case that blocks acceptance of the patch to trunk?

Martin

[-- Attachment #2: 0001-Instrument-function-exit-with-__builtin_unreachable-v2.patch --]
[-- Type: text/x-patch, Size: 5452 bytes --]

From 0c4fc1acba49d2d5ca2e6c475286a14e465b6f6c Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Thu, 12 Oct 2017 10:14:59 +0200
Subject: [PATCH 1/3] Instrument function exit with __builtin_unreachable in
 C++

gcc/c-family/ChangeLog:

2017-10-12  Martin Liska  <mliska@suse.cz>

	PR middle-end/82404
	* c-opts.c (c_common_post_options): Set -Wreturn-type for C++
	FE.
	* c.opt: Set default value of warn_return_type.

gcc/cp/ChangeLog:

2017-10-12  Martin Liska  <mliska@suse.cz>

	PR middle-end/82404
	* constexpr.c (cxx_eval_builtin_function_call): Handle
	__builtin_unreachable call.
	* cp-gimplify.c (cp_ubsan_maybe_instrument_return): Rename to
	...
	(cp_maybe_instrument_return): ... this.
	(cp_genericize): Call the function unconditionally.

gcc/fortran/ChangeLog:

2017-10-12  Martin Liska  <mliska@suse.cz>

	PR middle-end/82404
	* options.c (gfc_post_options): Set default value of
	-Wreturn-type to false.
---
 gcc/c-family/c-opts.c |  3 +++
 gcc/c-family/c.opt    |  2 +-
 gcc/cp/constexpr.c    | 15 ++++++++++++---
 gcc/cp/cp-gimplify.c  | 20 ++++++++++++++------
 gcc/fortran/options.c |  3 +++
 5 files changed, 33 insertions(+), 10 deletions(-)

diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
index 32120e636c2..cead15e7a63 100644
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -989,6 +989,9 @@ c_common_post_options (const char **pfilename)
 	flag_extern_tls_init = 1;
     }
 
+  if (warn_return_type == -1)
+    warn_return_type = c_dialect_cxx ();
+
   if (num_in_fnames > 1)
     error ("too many filenames given.  Type %s --help for usage",
 	   progname);
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index dae124ac1c2..9ab31f0e153 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -960,7 +960,7 @@ C++ ObjC++ Var(warn_reorder) Warning LangEnabledBy(C++ ObjC++,Wall)
 Warn when the compiler reorders code.
 
 Wreturn-type
-C ObjC C++ ObjC++ Var(warn_return_type) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
+C ObjC C++ ObjC++ Var(warn_return_type) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall) Init(-1)
 Warn whenever a function's return type defaults to \"int\" (C), or about inconsistent return types (C++).
 
 Wscalar-storage-order
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index 483f731a49a..7c2185851e0 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -1180,9 +1180,18 @@ cxx_eval_builtin_function_call (const constexpr_ctx *ctx, tree t, tree fun,
     {
       if (!*non_constant_p && !ctx->quiet)
 	{
-	  new_call = build_call_array_loc (EXPR_LOCATION (t), TREE_TYPE (t),
-					   CALL_EXPR_FN (t), nargs, args);
-	  error ("%q+E is not a constant expression", new_call);
+	  /* Do not allow__builtin_unreachable in constexpr function.
+	     The __builtin_unreachable call with BUILTINS_LOCATION
+	     comes from cp_maybe_instrument_return.  */
+	  if (DECL_FUNCTION_CODE (fun) == BUILT_IN_UNREACHABLE
+	      && EXPR_LOCATION (t) == BUILTINS_LOCATION)
+	    error ("constexpr call flows off the end of the function");
+	  else
+	    {
+	      new_call = build_call_array_loc (EXPR_LOCATION (t), TREE_TYPE (t),
+					       CALL_EXPR_FN (t), nargs, args);
+	      error ("%q+E is not a constant expression", new_call);
+	    }
 	}
       *non_constant_p = true;
       return t;
diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c
index 262485a5c1f..014c1ee7231 100644
--- a/gcc/cp/cp-gimplify.c
+++ b/gcc/cp/cp-gimplify.c
@@ -1556,10 +1556,11 @@ cp_genericize_tree (tree* t_p, bool handle_invisiref_parm_p)
 
 /* If a function that should end with a return in non-void
    function doesn't obviously end with return, add ubsan
-   instrumentation code to verify it at runtime.  */
+   instrumentation code to verify it at runtime.  If -fsanitize=return
+   is not enabled, instrument __builtin_unreachable.  */
 
 static void
-cp_ubsan_maybe_instrument_return (tree fndecl)
+cp_maybe_instrument_return (tree fndecl)
 {
   if (VOID_TYPE_P (TREE_TYPE (TREE_TYPE (fndecl)))
       || DECL_CONSTRUCTOR_P (fndecl)
@@ -1600,7 +1601,16 @@ cp_ubsan_maybe_instrument_return (tree fndecl)
   tree *p = &DECL_SAVED_TREE (fndecl);
   if (TREE_CODE (*p) == BIND_EXPR)
     p = &BIND_EXPR_BODY (*p);
-  t = ubsan_instrument_return (DECL_SOURCE_LOCATION (fndecl));
+
+  location_t loc = DECL_SOURCE_LOCATION (fndecl);
+  if (sanitize_flags_p (SANITIZE_RETURN, fndecl))
+    t = ubsan_instrument_return (loc);
+  else
+    {
+      tree fndecl = builtin_decl_explicit (BUILT_IN_UNREACHABLE);
+      t = build_call_expr_loc (BUILTINS_LOCATION, fndecl, 0);
+    }
+
   append_to_statement_list (t, p);
 }
 
@@ -1674,9 +1684,7 @@ cp_genericize (tree fndecl)
      walk_tree's hash functionality.  */
   cp_genericize_tree (&DECL_SAVED_TREE (fndecl), true);
 
-  if (sanitize_flags_p (SANITIZE_RETURN)
-      && current_function_decl != NULL_TREE)
-    cp_ubsan_maybe_instrument_return (fndecl);
+  cp_maybe_instrument_return (fndecl);
 
   /* Do everything else.  */
   c_genericize (fndecl);
diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c
index f7bbd7f2cde..59e7f028b09 100644
--- a/gcc/fortran/options.c
+++ b/gcc/fortran/options.c
@@ -430,6 +430,9 @@ gfc_post_options (const char **pfilename)
     gfc_fatal_error ("Maximum subrecord length cannot exceed %d",
 		     MAX_SUBRECORD_LENGTH);
 
+  if (warn_return_type == -1)
+    warn_return_type = 0;
+
   gfc_cpp_post_options ();
 
   if (gfc_option.allow_std & GFC_STD_F2008)
-- 
2.14.3


^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH] Fix test-suite fallout of default -Wreturn-type.
  2017-10-26 12:17               ` Martin Liška
@ 2017-11-03 15:29                 ` Jason Merrill
  2017-11-06  8:48                   ` Martin Liška
  0 siblings, 1 reply; 64+ messages in thread
From: Jason Merrill @ 2017-11-03 15:29 UTC (permalink / raw)
  To: Martin Liška; +Cc: Jakub Jelinek, gcc-patches List, Jonathan Wakely

On Thu, Oct 26, 2017 at 8:14 AM, Martin Liška <mliska@suse.cz> wrote:
> On 10/24/2017 04:39 PM, Jason Merrill wrote:
>> On 10/18/2017 08:48 AM, Martin Liška wrote:
>>> This is second patch that addresses test-suite fallout. All these tests fail because -Wreturn-type is
>>> now on by default.
>>
>>> +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-diag3.C
>>> -constexpr T g(T t) { return f(t); } // { dg-error "f.int" }
>>> +constexpr T g(T t) { return f(t); } // { dg-error "f.int" "" { target c++14_only } }
>>
>>> +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-neg3.C
>>> -  constexpr int bar() { return a.foo(); } // { dg-error "foo" }
>>> +  constexpr int bar() { return a.foo(); } // { dg-error "foo" "" { target c++14_only } }
>>
>> Why are these changes needed?  They aren't "Return a value for functions with non-void return type, or change type to void, or add -Wno-return-type for test."
>>
>> The rest of the patch is OK.
>>
>> Jason
>
> Hi.
>
> Sorry, I forgot to describe this change. With -std=c++11 we do:
>
> #0  massage_constexpr_body (fun=0x7ffff6955500, body=0x7ffff6813eb8) at ../../gcc/cp/constexpr.c:708
> #1  0x000000000087700b in explain_invalid_constexpr_fn (fun=0x7ffff6955500) at ../../gcc/cp/constexpr.c:896
> #2  0x00000000008799dc in cxx_eval_call_expression (ctx=0x7fffffffd150, t=0x7ffff6820118, lval=false, non_constant_p=0x7fffffffd1cf, overflow_p=0x7fffffffd1ce) at ../../gcc/cp/constexpr.c:1558
> #3  0x00000000008843fe in cxx_eval_constant_expression (ctx=0x7fffffffd150, t=0x7ffff6820118, lval=false, non_constant_p=0x7fffffffd1cf, overflow_p=0x7fffffffd1ce, jump_target=0x0) at ../../gcc/cp/constexpr.c:4069
>
> static tree
> massage_constexpr_body (tree fun, tree body)
> {
>   if (DECL_CONSTRUCTOR_P (fun))
>     body = build_constexpr_constructor_member_initializers
>       (DECL_CONTEXT (fun), body);
>   else if (cxx_dialect < cxx14)
>     {
>       if (TREE_CODE (body) == EH_SPEC_BLOCK)
>         body = EH_SPEC_STMTS (body);
>       if (TREE_CODE (body) == MUST_NOT_THROW_EXPR)
>         body = TREE_OPERAND (body, 0);
>       body = constexpr_fn_retval (body);
>     }
>   return body;
> }
>
> and we end up with error_mark_node and thus potential_constant_expression_1 does bail out.
> That's why we don't print the later error with -std=c++11.
>
> What should we do with that?

Fix constexpr_fn_retval to ignore the call to __builtin_unreachable.

Jason

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH] Fix all tests that fail with -sanitize=return.
  2017-10-24 14:39             ` Jason Merrill
@ 2017-11-06  8:48               ` Martin Liška
  0 siblings, 0 replies; 64+ messages in thread
From: Martin Liška @ 2017-11-06  8:48 UTC (permalink / raw)
  To: Jason Merrill, Jakub Jelinek; +Cc: gcc-patches List, Jonathan Wakely

On 10/24/2017 04:35 PM, Jason Merrill wrote:
> This new test will fail with -fsanitize=return, won't it?

Yes, but it's not a run-time test-case.

Martin

> 
> The rest of the patch is OK.
> 
> Jason

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH] Fix test-suite fallout of default -Wreturn-type.
  2017-11-03 15:29                 ` Jason Merrill
@ 2017-11-06  8:48                   ` Martin Liška
  2017-11-06  9:58                     ` Paolo Carlini
  0 siblings, 1 reply; 64+ messages in thread
From: Martin Liška @ 2017-11-06  8:48 UTC (permalink / raw)
  To: Jason Merrill; +Cc: Jakub Jelinek, gcc-patches List, Jonathan Wakely

On 11/03/2017 04:29 PM, Jason Merrill wrote:
> Fix constexpr_fn_retval to ignore the call to __builtin_unreachable.
> 
> Jason

Done that and I'm going to install the patches as it was last blocker.

Thanks,
Martin

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH] Fix test-suite fallout of default -Wreturn-type.
  2017-11-06  8:48                   ` Martin Liška
@ 2017-11-06  9:58                     ` Paolo Carlini
  2017-11-06 10:03                       ` Martin Liška
  0 siblings, 1 reply; 64+ messages in thread
From: Paolo Carlini @ 2017-11-06  9:58 UTC (permalink / raw)
  To: Martin Liška, Jason Merrill
  Cc: Jakub Jelinek, gcc-patches List, Jonathan Wakely

Hi,

On 06/11/2017 09:48, Martin Liška wrote:
> On 11/03/2017 04:29 PM, Jason Merrill wrote:
>> Fix constexpr_fn_retval to ignore the call to __builtin_unreachable.
>>
>> Jason
> Done that and I'm going to install the patches as it was last blocker.
Sorry, I didn't follow in detail the whole thread, but I'm now seeing 
many fails. Eg, many cilk-plus, or:

FAIL: g++.dg/pr45788.C  -std=gnu++98 (test for excess errors)
FAIL: g++.dg/pr45788.C  -std=gnu++11 (test for excess errors)
FAIL: g++.dg/pr45788.C  -std=gnu++14 (test for excess errors)
FAIL: g++.dg/pr64688.C   (test for excess errors)
FAIL: g++.dg/pr65032.C   (test for excess errors)
FAIL: g++.dg/pr71633.C  -std=gnu++98 (test for excess errors)
FAIL: g++.dg/pr71633.C  -std=gnu++11 (test for excess errors)
FAIL: g++.dg/pr71633.C  -std=gnu++14 (test for excess errors)
FAIL: g++.dg/stackprotectexplicit2.C  -std=gnu++98 (test for excess errors)
FAIL: g++.dg/stackprotectexplicit2.C  -std=gnu++11 (test for excess errors)
FAIL: g++.dg/stackprotectexplicit2.C  -std=gnu++14 (test for excess errors)
FAIL: g++.dg/eh/sighandle.C  -std=gnu++98 (test for excess errors)
FAIL: g++.dg/eh/sighandle.C  -std=gnu++11 (test for excess errors)
FAIL: g++.dg/eh/sighandle.C  -std=gnu++14 (test for excess errors)
FAIL: g++.dg/ext/vector14.C  -std=gnu++98 (test for excess errors)
FAIL: g++.dg/ext/vector14.C  -std=gnu++11 (test for excess errors)
FAIL: g++.dg/ext/vector14.C  -std=gnu++14 (test for excess errors)

are you still in the process of committing the testsuite changes? I had 
a quick look (eg, pr45788.C) and some of the fails seem certainly expected.

Thanks,
Paolo.

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH] Fix test-suite fallout of default -Wreturn-type.
  2017-11-06  9:58                     ` Paolo Carlini
@ 2017-11-06 10:03                       ` Martin Liška
  2017-11-06 10:09                         ` Paolo Carlini
  0 siblings, 1 reply; 64+ messages in thread
From: Martin Liška @ 2017-11-06 10:03 UTC (permalink / raw)
  To: Paolo Carlini, Jason Merrill
  Cc: Jakub Jelinek, gcc-patches List, Jonathan Wakely

On 11/06/2017 10:57 AM, Paolo Carlini wrote:
> are you still in the process of committing the testsuite changes? I had a quick look (eg, pr45788.C) and some of the fails seem certainly expected.
> 
> Thanks,
> Paolo.

Hi.

Revisions 254440 and r254438 contain fixes for test-suite. Can you please verify
it's still present?

Martin

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH] Fix test-suite fallout of default -Wreturn-type.
  2017-11-06 10:03                       ` Martin Liška
@ 2017-11-06 10:09                         ` Paolo Carlini
  2017-11-06 10:41                           ` Martin Liška
  0 siblings, 1 reply; 64+ messages in thread
From: Paolo Carlini @ 2017-11-06 10:09 UTC (permalink / raw)
  To: Martin Liška, Jason Merrill
  Cc: Jakub Jelinek, gcc-patches List, Jonathan Wakely

Hi,

On 06/11/2017 11:03, Martin Liška wrote:
> On 11/06/2017 10:57 AM, Paolo Carlini wrote:
>> are you still in the process of committing the testsuite changes? I had a quick look (eg, pr45788.C) and some of the fails seem certainly expected.
>>
>> Thanks,
>> Paolo.
> Hi.
>
> Revisions 254440 and r254438 contain fixes for test-suite. Can you please verify
> it's still present?
It's definitely there. I was testing r254440. And, hey, have a look to, 
eg, the pr45788.C which we have in svn, it does definitely trigger a 
-Wreturn-type. Likewise for many other testcases :-(

Paolo.

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH] Fix test-suite fallout of default -Wreturn-type.
  2017-11-06 10:09                         ` Paolo Carlini
@ 2017-11-06 10:41                           ` Martin Liška
  2017-11-06 11:40                             ` Paolo Carlini
  0 siblings, 1 reply; 64+ messages in thread
From: Martin Liška @ 2017-11-06 10:41 UTC (permalink / raw)
  To: Paolo Carlini, Jason Merrill
  Cc: Jakub Jelinek, gcc-patches List, Jonathan Wakely

On 11/06/2017 11:08 AM, Paolo Carlini wrote:
> Hi,
> 
> On 06/11/2017 11:03, Martin Liška wrote:
>> On 11/06/2017 10:57 AM, Paolo Carlini wrote:
>>> are you still in the process of committing the testsuite changes? I had a quick look (eg, pr45788.C) and some of the fails seem certainly expected.
>>>
>>> Thanks,
>>> Paolo.
>> Hi.
>>
>> Revisions 254440 and r254438 contain fixes for test-suite. Can you please verify
>> it's still present?
> It's definitely there. I was testing r254440. And, hey, have a look to, eg, the pr45788.C which we have in svn, it does definitely trigger a -Wreturn-type. Likewise for many other testcases :-(
> 
> Paolo.

Sorry for that. It's related to x86 target specific test-cases. I'll prepare patch as soon as possible.

Thanks,
Martin

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH] Fix test-suite fallout of default -Wreturn-type.
  2017-11-06 10:41                           ` Martin Liška
@ 2017-11-06 11:40                             ` Paolo Carlini
  2017-11-06 12:20                               ` Paolo Carlini
  0 siblings, 1 reply; 64+ messages in thread
From: Paolo Carlini @ 2017-11-06 11:40 UTC (permalink / raw)
  To: Martin Liška, Jason Merrill
  Cc: Jakub Jelinek, gcc-patches List, Jonathan Wakely

Hi,

On 06/11/2017 11:41, Martin Liška wrote:
> Sorry for that. It's related to x86 target specific test-cases. I'll 
> prepare patch as soon as possible. 
Ok, thanks.

Note, I'm seeing a few - expected, give the enabled warning - fails in 
the libstdc++-v3 testsuite too. Eg:

FAIL: 20_util/optional/cons/deduction.cc (test for excess errors)
FAIL: 20_util/pair/cons/deduction.cc (test for excess errors)
FAIL: 20_util/pair/traits.cc (test for excess errors)
FAIL: 20_util/tuple/cons/deduction.cc (test for excess errors)

Paolo.


^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH] Fix test-suite fallout of default -Wreturn-type.
  2017-11-06 11:40                             ` Paolo Carlini
@ 2017-11-06 12:20                               ` Paolo Carlini
  2017-11-06 13:38                                 ` Martin Liška
  0 siblings, 1 reply; 64+ messages in thread
From: Paolo Carlini @ 2017-11-06 12:20 UTC (permalink / raw)
  To: Martin Liška, Jason Merrill
  Cc: Jakub Jelinek, gcc-patches List, Jonathan Wakely

[-- Attachment #1: Type: text/plain, Size: 681 bytes --]

Hi again,

On 06/11/2017 12:40, Paolo Carlini wrote:
> Hi,
>
> On 06/11/2017 11:41, Martin Liška wrote:
>> Sorry for that. It's related to x86 target specific test-cases. I'll 
>> prepare patch as soon as possible. 
> Ok, thanks.
>
> Note, I'm seeing a few - expected, give the enabled warning - fails in 
> the libstdc++-v3 testsuite too. Eg:
>
> FAIL: 20_util/optional/cons/deduction.cc (test for excess errors)
> FAIL: 20_util/pair/cons/deduction.cc (test for excess errors)
> FAIL: 20_util/pair/traits.cc (test for excess errors)
> FAIL: 20_util/tuple/cons/deduction.cc (test for excess errors)
For the library I'm finishing testing the below.

Paolo.

////////////////////

[-- Attachment #2: CL_return --]
[-- Type: text/plain, Size: 492 bytes --]

2017-11-06  Paolo Carlini  <paolo.carlini@oracle.com>

	* testsuite/20_util/optional/cons/deduction.cc: Avoid -Wreturn-type
	warnings.
	* testsuite/20_util/pair/cons/deduction.cc: Likewise.
	* testsuite/20_util/pair/traits.cc: Likewise.
	* testsuite/20_util/tuple/cons/deduction.cc: Likewise.
	* testsuite/20_util/variant/compile.cc: Likewise.
	* testsuite/23_containers/map/modifiers/try_emplace/1.cc: Likewise.
	* testsuite/23_containers/unordered_map/modifiers/try_emplace.cc:
	Likewise.


[-- Attachment #3: patch_return --]
[-- Type: text/plain, Size: 11000 bytes --]

Index: testsuite/20_util/optional/cons/deduction.cc
===================================================================
--- testsuite/20_util/optional/cons/deduction.cc	(revision 254449)
+++ testsuite/20_util/optional/cons/deduction.cc	(working copy)
@@ -24,8 +24,8 @@
 struct MoveOnly
 {
   MoveOnly() = default;
-  MoveOnly(MoveOnly&&) {}
-  MoveOnly& operator=(MoveOnly&&) {}
+  MoveOnly(MoveOnly&&);
+  MoveOnly& operator=(MoveOnly&&);
 };
 
 int main()
Index: testsuite/20_util/pair/cons/deduction.cc
===================================================================
--- testsuite/20_util/pair/cons/deduction.cc	(revision 254449)
+++ testsuite/20_util/pair/cons/deduction.cc	(working copy)
@@ -30,8 +30,8 @@
 struct MoveOnly
 {
   MoveOnly() = default;
-  MoveOnly(MoveOnly&&) {}
-  MoveOnly& operator=(MoveOnly&&) {}
+  MoveOnly(MoveOnly&&);
+  MoveOnly& operator=(MoveOnly&&);
 };
 
 void
Index: testsuite/20_util/pair/traits.cc
===================================================================
--- testsuite/20_util/pair/traits.cc	(revision 254449)
+++ testsuite/20_util/pair/traits.cc	(working copy)
@@ -31,8 +31,8 @@
 
 struct ThrowingCopy
 {
-  ThrowingCopy(const ThrowingCopy&) {}
-  ThrowingCopy& operator=(const ThrowingCopy&) {}
+  ThrowingCopy(const ThrowingCopy&);
+  ThrowingCopy& operator=(const ThrowingCopy&);
 };
 
 int main()
Index: testsuite/20_util/tuple/cons/deduction.cc
===================================================================
--- testsuite/20_util/tuple/cons/deduction.cc	(revision 254442)
+++ testsuite/20_util/tuple/cons/deduction.cc	(working copy)
@@ -30,8 +30,8 @@
 struct MoveOnly
 {
   MoveOnly() = default;
-  MoveOnly(MoveOnly&&) {}
-  MoveOnly& operator=(MoveOnly&&) {}
+  MoveOnly(MoveOnly&&);
+  MoveOnly& operator=(MoveOnly&&);
 };
 
 void
Index: testsuite/20_util/variant/compile.cc
===================================================================
--- testsuite/20_util/variant/compile.cc	(revision 254442)
+++ testsuite/20_util/variant/compile.cc	(working copy)
@@ -481,37 +481,37 @@
     static_assert(MA_VAL == is_trivially_move_assignable_v<variant<A>>, ""); \
   }
   TEST_TEMPLATE(=default, =default, =default, =default, =default,  true,  true,  true,  true)
-  TEST_TEMPLATE(=default, =default, =default, =default,       {},  true,  true,  true, false)
-  TEST_TEMPLATE(=default, =default, =default,       {}, =default,  true,  true, false,  true)
-  TEST_TEMPLATE(=default, =default, =default,       {},       {},  true,  true, false, false)
-  TEST_TEMPLATE(=default, =default,       {}, =default, =default,  true, false,  true,  true)
-  TEST_TEMPLATE(=default, =default,       {}, =default,       {},  true, false,  true, false)
-  TEST_TEMPLATE(=default, =default,       {},       {}, =default,  true, false, false,  true)
-  TEST_TEMPLATE(=default, =default,       {},       {},       {},  true, false, false, false)
-  TEST_TEMPLATE(=default,       {}, =default, =default, =default, false,  true,  true,  true)
-  TEST_TEMPLATE(=default,       {}, =default, =default,       {}, false,  true,  true, false)
-  TEST_TEMPLATE(=default,       {}, =default,       {}, =default, false,  true, false,  true)
-  TEST_TEMPLATE(=default,       {}, =default,       {},       {}, false,  true, false, false)
-  TEST_TEMPLATE(=default,       {},       {}, =default, =default, false, false,  true,  true)
-  TEST_TEMPLATE(=default,       {},       {}, =default,       {}, false, false,  true, false)
-  TEST_TEMPLATE(=default,       {},       {},       {}, =default, false, false, false,  true)
-  TEST_TEMPLATE(=default,       {},       {},       {},       {}, false, false, false, false)
-  TEST_TEMPLATE(      {}, =default, =default, =default, =default, false, false, false, false)
-  TEST_TEMPLATE(      {}, =default, =default, =default,       {}, false, false, false, false)
-  TEST_TEMPLATE(      {}, =default, =default,       {}, =default, false, false, false, false)
-  TEST_TEMPLATE(      {}, =default, =default,       {},       {}, false, false, false, false)
-  TEST_TEMPLATE(      {}, =default,       {}, =default, =default, false, false, false, false)
-  TEST_TEMPLATE(      {}, =default,       {}, =default,       {}, false, false, false, false)
-  TEST_TEMPLATE(      {}, =default,       {},       {}, =default, false, false, false, false)
-  TEST_TEMPLATE(      {}, =default,       {},       {},       {}, false, false, false, false)
-  TEST_TEMPLATE(      {},       {}, =default, =default, =default, false, false, false, false)
-  TEST_TEMPLATE(      {},       {}, =default, =default,       {}, false, false, false, false)
-  TEST_TEMPLATE(      {},       {}, =default,       {}, =default, false, false, false, false)
-  TEST_TEMPLATE(      {},       {}, =default,       {},       {}, false, false, false, false)
-  TEST_TEMPLATE(      {},       {},       {}, =default, =default, false, false, false, false)
-  TEST_TEMPLATE(      {},       {},       {}, =default,       {}, false, false, false, false)
-  TEST_TEMPLATE(      {},       {},       {},       {}, =default, false, false, false, false)
-  TEST_TEMPLATE(      {},       {},       {},       {},       {}, false, false, false, false)
+  TEST_TEMPLATE(=default, =default, =default, =default,         ,  true,  true,  true, false)
+  TEST_TEMPLATE(=default, =default, =default,         , =default,  true,  true, false,  true)
+  TEST_TEMPLATE(=default, =default, =default,         ,         ,  true,  true, false, false)
+  TEST_TEMPLATE(=default, =default,         , =default, =default,  true, false,  true,  true)
+  TEST_TEMPLATE(=default, =default,         , =default,         ,  true, false,  true, false)
+  TEST_TEMPLATE(=default, =default,         ,         , =default,  true, false, false,  true)
+  TEST_TEMPLATE(=default, =default,         ,         ,         ,  true, false, false, false)
+  TEST_TEMPLATE(=default,         , =default, =default, =default, false,  true,  true,  true)
+  TEST_TEMPLATE(=default,         , =default, =default,         , false,  true,  true, false)
+  TEST_TEMPLATE(=default,         , =default,         , =default, false,  true, false,  true)
+  TEST_TEMPLATE(=default,         , =default,         ,         , false,  true, false, false)
+  TEST_TEMPLATE(=default,         ,         , =default, =default, false, false,  true,  true)
+  TEST_TEMPLATE(=default,         ,         , =default,         , false, false,  true, false)
+  TEST_TEMPLATE(=default,         ,         ,         , =default, false, false, false,  true)
+  TEST_TEMPLATE(=default,         ,         ,         ,         , false, false, false, false)
+  TEST_TEMPLATE(        , =default, =default, =default, =default, false, false, false, false)
+  TEST_TEMPLATE(        , =default, =default, =default,         , false, false, false, false)
+  TEST_TEMPLATE(        , =default, =default,         , =default, false, false, false, false)
+  TEST_TEMPLATE(        , =default, =default,         ,         , false, false, false, false)
+  TEST_TEMPLATE(        , =default,         , =default, =default, false, false, false, false)
+  TEST_TEMPLATE(        , =default,         , =default,         , false, false, false, false)
+  TEST_TEMPLATE(        , =default,         ,         , =default, false, false, false, false)
+  TEST_TEMPLATE(        , =default,         ,         ,         , false, false, false, false)
+  TEST_TEMPLATE(        ,         , =default, =default, =default, false, false, false, false)
+  TEST_TEMPLATE(        ,         , =default, =default,         , false, false, false, false)
+  TEST_TEMPLATE(        ,         , =default,         , =default, false, false, false, false)
+  TEST_TEMPLATE(        ,         , =default,         ,         , false, false, false, false)
+  TEST_TEMPLATE(        ,         ,         , =default, =default, false, false, false, false)
+  TEST_TEMPLATE(        ,         ,         , =default,         , false, false, false, false)
+  TEST_TEMPLATE(        ,         ,         ,         , =default, false, false, false, false)
+  TEST_TEMPLATE(        ,         ,         ,         ,         , false, false, false, false)
 #undef TEST_TEMPLATE
 
 #define TEST_TEMPLATE(CC, MC, CA, MA) \
@@ -529,21 +529,21 @@
     static_assert(!is_trivially_move_assignable_v<variant<AllDeleted, A>>, ""); \
   }
   TEST_TEMPLATE(=default, =default, =default, =default)
-  TEST_TEMPLATE(=default, =default, =default,       {})
-  TEST_TEMPLATE(=default, =default,       {}, =default)
-  TEST_TEMPLATE(=default, =default,       {},       {})
-  TEST_TEMPLATE(=default,       {}, =default, =default)
-  TEST_TEMPLATE(=default,       {}, =default,       {})
-  TEST_TEMPLATE(=default,       {},       {}, =default)
-  TEST_TEMPLATE(=default,       {},       {},       {})
-  TEST_TEMPLATE(      {}, =default, =default, =default)
-  TEST_TEMPLATE(      {}, =default, =default,       {})
-  TEST_TEMPLATE(      {}, =default,       {}, =default)
-  TEST_TEMPLATE(      {}, =default,       {},       {})
-  TEST_TEMPLATE(      {},       {}, =default, =default)
-  TEST_TEMPLATE(      {},       {}, =default,       {})
-  TEST_TEMPLATE(      {},       {},       {}, =default)
-  TEST_TEMPLATE(      {},       {},       {},       {})
+  TEST_TEMPLATE(=default, =default, =default,         )
+  TEST_TEMPLATE(=default, =default,         , =default)
+  TEST_TEMPLATE(=default, =default,         ,         )
+  TEST_TEMPLATE(=default,         , =default, =default)
+  TEST_TEMPLATE(=default,         , =default,         )
+  TEST_TEMPLATE(=default,         ,         , =default)
+  TEST_TEMPLATE(=default,         ,         ,         )
+  TEST_TEMPLATE(        , =default, =default, =default)
+  TEST_TEMPLATE(        , =default, =default,         )
+  TEST_TEMPLATE(        , =default,         , =default)
+  TEST_TEMPLATE(        , =default,         ,         )
+  TEST_TEMPLATE(        ,         , =default, =default)
+  TEST_TEMPLATE(        ,         , =default,         )
+  TEST_TEMPLATE(        ,         ,         , =default)
+  TEST_TEMPLATE(        ,         ,         ,         )
 #undef TEST_TEMPLATE
 
   static_assert(is_trivially_copy_constructible_v<variant<DefaultNoexcept, int, char, float, double>>, "");
Index: testsuite/23_containers/map/modifiers/try_emplace/1.cc
===================================================================
--- testsuite/23_containers/map/modifiers/try_emplace/1.cc	(revision 254442)
+++ testsuite/23_containers/map/modifiers/try_emplace/1.cc	(working copy)
@@ -39,6 +39,7 @@
   {
     val = other.val;
     other.moved_from_assign = true;
+    return *this;
   }
 };
 
Index: testsuite/23_containers/unordered_map/modifiers/try_emplace.cc
===================================================================
--- testsuite/23_containers/unordered_map/modifiers/try_emplace.cc	(revision 254442)
+++ testsuite/23_containers/unordered_map/modifiers/try_emplace.cc	(working copy)
@@ -39,6 +39,7 @@
   {
     val = other.val;
     other.moved_from_assign = true;
+    return *this;
   }
 };
 

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH] Fix test-suite fallout of default -Wreturn-type.
  2017-11-06 12:20                               ` Paolo Carlini
@ 2017-11-06 13:38                                 ` Martin Liška
  2017-11-06 13:58                                   ` Paolo Carlini
  0 siblings, 1 reply; 64+ messages in thread
From: Martin Liška @ 2017-11-06 13:38 UTC (permalink / raw)
  To: Paolo Carlini, Jason Merrill
  Cc: Jakub Jelinek, gcc-patches List, Jonathan Wakely

[-- Attachment #1: Type: text/plain, Size: 915 bytes --]

On 11/06/2017 01:19 PM, Paolo Carlini wrote:
> Hi again,
> 
> On 06/11/2017 12:40, Paolo Carlini wrote:
>> Hi,
>>
>> On 06/11/2017 11:41, Martin Liška wrote:
>>> Sorry for that. It's related to x86 target specific test-cases. I'll prepare patch as soon as possible. 
>> Ok, thanks.
>>
>> Note, I'm seeing a few - expected, give the enabled warning - fails in the libstdc++-v3 testsuite too. Eg:
>>
>> FAIL: 20_util/optional/cons/deduction.cc (test for excess errors)
>> FAIL: 20_util/pair/cons/deduction.cc (test for excess errors)
>> FAIL: 20_util/pair/traits.cc (test for excess errors)
>> FAIL: 20_util/tuple/cons/deduction.cc (test for excess errors)
> For the library I'm finishing testing the below.
> 
> Paolo.
> 
> ////////////////////

Thank you for the patch.
I'm going to install the remaining part that will fix x86_64 fallout. All changes are
quite obvious, so hope it's fine to install it.

Martin

[-- Attachment #2: 0001-Fix-Wreturn-type-fallout.patch --]
[-- Type: text/x-patch, Size: 17262 bytes --]

From feaf87410ad6b82b4997891892f71f20ff615c79 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Mon, 6 Nov 2017 13:43:04 +0100
Subject: [PATCH] Fix -Wreturn-type fallout.

gcc/testsuite/ChangeLog:

2017-11-06  Martin Liska  <mliska@suse.cz>

	* c-c++-common/cilk-plus/AN/pr57541-2.c (foo1): Return a value
	for functions with non-void return type, or change type to void,
	or add -Wno-return-type for test.
	(foo2): Likewise.
	* c-c++-common/cilk-plus/AN/pr57541.c (foo): Likewise.
	(foo1): Likewise.
	* c-c++-common/cilk-plus/CK/errors.c: Likewise.
	* c-c++-common/cilk-plus/CK/pr60197.c: Likewise.
	* c-c++-common/cilk-plus/CK/spawn_in_return.c: Likewise.
	* c-c++-common/fold-masked-cmp-1.c (test_pic): Likewise.
	(test_exe): Likewise.
	* c-c++-common/fold-masked-cmp-2.c (test_exe): Likewise.
	* g++.dg/cilk-plus/AN/builtin_fn_mutating_tplt.cc (my_func): Likewise.
	* g++.dg/cilk-plus/CK/pr68997.cc (fa2): Likewise.
	* g++.dg/eh/sighandle.C (dosegv): Likewise.
	* g++.dg/ext/vector14.C (foo): Likewise.
	(main): Likewise.
	* g++.dg/graphite/pr41305.C: Likewise.
	* g++.dg/graphite/pr42930.C: Likewise.
	* g++.dg/opt/pr46640.C (struct QBasicAtomicInt): Likewise.
	(makeDir): Likewise.
	* g++.dg/other/i386-8.C (foo): Likewise.
	* g++.dg/pr45788.C: Likewise.
	* g++.dg/pr64688.C (at_c): Likewise.
	* g++.dg/pr65032.C (G::DecodeVorbis): Likewise.
	* g++.dg/pr71633.C (c3::fn2): Likewise.
	* g++.dg/stackprotectexplicit2.C (A): Likewise.
	* g++.old-deja/g++.law/weak.C (main): Likewise.

libgomp/ChangeLog:

2017-11-06  Martin Liska  <mliska@suse.cz>

	* testsuite/libgomp.c++/loop-2.C: Return a value
	for functions with non-void return type, or change type to void,
	or add -Wno-return-type for test.
	* testsuite/libgomp.c++/loop-4.C: Likewise.
	* testsuite/libgomp.c++/parallel-1.C: Likewise.
	* testsuite/libgomp.c++/shared-1.C: Likewise.
	* testsuite/libgomp.c++/single-1.C: Likewise.
	* testsuite/libgomp.c++/single-2.C: Likewise.

libstdc++-v3/ChangeLog:

2017-11-06  Martin Liska  <mliska@suse.cz>

	* testsuite/27_io/basic_fstream/cons/char/path.cc (main):
	  Return a value for functions with non-void return type,
	  or change type to void, or add -Wno-return-type for test.
	* testsuite/27_io/basic_ifstream/cons/char/path.cc (main):
	Likewise.
	* testsuite/27_io/basic_ofstream/open/char/path.cc (main):
	Likewise.
---
 gcc/testsuite/c-c++-common/cilk-plus/AN/pr57541-2.c           | 4 ++--
 gcc/testsuite/c-c++-common/cilk-plus/AN/pr57541.c             | 9 ++-------
 gcc/testsuite/c-c++-common/cilk-plus/CK/errors.c              | 2 +-
 gcc/testsuite/c-c++-common/cilk-plus/CK/pr60197.c             | 2 +-
 gcc/testsuite/c-c++-common/cilk-plus/CK/spawn_in_return.c     | 2 +-
 gcc/testsuite/c-c++-common/fold-masked-cmp-1.c                | 4 +++-
 gcc/testsuite/c-c++-common/fold-masked-cmp-2.c                | 2 ++
 gcc/testsuite/g++.dg/cilk-plus/AN/builtin_fn_mutating_tplt.cc | 2 ++
 gcc/testsuite/g++.dg/cilk-plus/CK/pr68997.cc                  | 2 +-
 gcc/testsuite/g++.dg/eh/sighandle.C                           | 1 +
 gcc/testsuite/g++.dg/ext/vector14.C                           | 8 +++++++-
 gcc/testsuite/g++.dg/graphite/pr41305.C                       | 2 +-
 gcc/testsuite/g++.dg/graphite/pr42930.C                       | 2 +-
 gcc/testsuite/g++.dg/opt/pr46640.C                            | 3 +++
 gcc/testsuite/g++.dg/other/i386-8.C                           | 2 ++
 gcc/testsuite/g++.dg/pr45788.C                                | 2 +-
 gcc/testsuite/g++.dg/pr64688.C                                | 5 ++++-
 gcc/testsuite/g++.dg/pr65032.C                                | 2 ++
 gcc/testsuite/g++.dg/pr71633.C                                | 1 +
 gcc/testsuite/g++.dg/stackprotectexplicit2.C                  | 3 ++-
 gcc/testsuite/g++.old-deja/g++.law/weak.C                     | 2 ++
 libgomp/testsuite/libgomp.c++/loop-2.C                        | 1 +
 libgomp/testsuite/libgomp.c++/loop-4.C                        | 1 +
 libgomp/testsuite/libgomp.c++/parallel-1.C                    | 1 +
 libgomp/testsuite/libgomp.c++/shared-1.C                      | 1 +
 libgomp/testsuite/libgomp.c++/single-1.C                      | 1 +
 libgomp/testsuite/libgomp.c++/single-2.C                      | 1 +
 libstdc++-v3/testsuite/27_io/basic_fstream/cons/char/path.cc  | 1 +
 libstdc++-v3/testsuite/27_io/basic_ifstream/cons/char/path.cc | 1 +
 libstdc++-v3/testsuite/27_io/basic_ofstream/open/char/path.cc | 1 +
 30 files changed, 51 insertions(+), 20 deletions(-)

diff --git a/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57541-2.c b/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57541-2.c
index 83325a77501..89a3d57ebdd 100644
--- a/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57541-2.c
+++ b/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57541-2.c
@@ -2,13 +2,13 @@
 /* { dg-do compile } */
 /* { dg-options "-fcilkplus" } */
 
-int foo1 ()
+void foo1 ()
 {
   int a;
   a = __sec_reduce_add (1); /* { dg-error "Invalid builtin arguments" } */
 }
 
-int foo2 ()
+void foo2 ()
 {
   int a;
   a = __sec_reduce_add (); /* { dg-error "Invalid builtin arguments" } */
diff --git a/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57541.c b/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57541.c
index a956d0e18ab..b47de1e7ebc 100755
--- a/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57541.c
+++ b/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57541.c
@@ -4,8 +4,7 @@
 
 int A[10];
 
-int foo () {
-
+void foo () {
   /* C compiler uses the term "undeclared" whereas C++ compiler uses
     "not declared".  Thus, grepping for declared seem to be the easiest.  */
   char c = (char)N; /* { dg-error "declared" } */
@@ -15,12 +14,8 @@ int foo () {
   A[l:s:c];
 }
 
-int foo1 (int N) {
-
+void foo1 (int N) {
   char c = (char)N;
   short s = (short)N;
   A[l:s:c]; /* { dg-error "declared" } */
 }
-
-
-
diff --git a/gcc/testsuite/c-c++-common/cilk-plus/CK/errors.c b/gcc/testsuite/c-c++-common/cilk-plus/CK/errors.c
index b1e336e3328..d637924e9e1 100644
--- a/gcc/testsuite/c-c++-common/cilk-plus/CK/errors.c
+++ b/gcc/testsuite/c-c++-common/cilk-plus/CK/errors.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-fcilkplus" } */
+/* { dg-options "-fcilkplus -Wno-return-type" } */
 
 int func_2(void);
 
diff --git a/gcc/testsuite/c-c++-common/cilk-plus/CK/pr60197.c b/gcc/testsuite/c-c++-common/cilk-plus/CK/pr60197.c
index 2b47d1efb7d..301a6f2e9d1 100644
--- a/gcc/testsuite/c-c++-common/cilk-plus/CK/pr60197.c
+++ b/gcc/testsuite/c-c++-common/cilk-plus/CK/pr60197.c
@@ -1,6 +1,6 @@
 /* PR c/60197 */
 /* { dg-do compile } */
-/* { dg-options "-fcilkplus" } */
+/* { dg-options "-fcilkplus -Wno-return-type" } */
 
 extern int foo (void);
 extern int bar (int);
diff --git a/gcc/testsuite/c-c++-common/cilk-plus/CK/spawn_in_return.c b/gcc/testsuite/c-c++-common/cilk-plus/CK/spawn_in_return.c
index 14b7eef1276..602971e02c9 100644
--- a/gcc/testsuite/c-c++-common/cilk-plus/CK/spawn_in_return.c
+++ b/gcc/testsuite/c-c++-common/cilk-plus/CK/spawn_in_return.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-fcilkplus" } */
+/* { dg-options "-fcilkplus -Wno-return-type" } */
 
 int main (void)
 {
diff --git a/gcc/testsuite/c-c++-common/fold-masked-cmp-1.c b/gcc/testsuite/c-c++-common/fold-masked-cmp-1.c
index c56adc4d662..658cc092995 100644
--- a/gcc/testsuite/c-c++-common/fold-masked-cmp-1.c
+++ b/gcc/testsuite/c-c++-common/fold-masked-cmp-1.c
@@ -29,13 +29,15 @@ int result;
 void test_pic (struct bfd_link_info *info)
 {
   if (bfd_link_pic (info))
-    result++;
+    result++;  
 }
 
 int test_exe (struct bfd_link_info *info)
 {
   if (bfd_link_executable (info))
     result++;
+
+  return 0;
 }
 
 /* { dg-final { scan-assembler-times "testn?b" 2 } } */
diff --git a/gcc/testsuite/c-c++-common/fold-masked-cmp-2.c b/gcc/testsuite/c-c++-common/fold-masked-cmp-2.c
index a14bceb4566..c95cc56dfa9 100644
--- a/gcc/testsuite/c-c++-common/fold-masked-cmp-2.c
+++ b/gcc/testsuite/c-c++-common/fold-masked-cmp-2.c
@@ -36,6 +36,8 @@ int test_exe (struct bfd_link_info *info)
 {
   if (bfd_link_executable (info))
     result++;
+
+  return 0;
 }
 
 /* { dg-final { scan-assembler-times "testn?b" 2 } } */
diff --git a/gcc/testsuite/g++.dg/cilk-plus/AN/builtin_fn_mutating_tplt.cc b/gcc/testsuite/g++.dg/cilk-plus/AN/builtin_fn_mutating_tplt.cc
index db81912cbe5..111a2a29686 100644
--- a/gcc/testsuite/g++.dg/cilk-plus/AN/builtin_fn_mutating_tplt.cc
+++ b/gcc/testsuite/g++.dg/cilk-plus/AN/builtin_fn_mutating_tplt.cc
@@ -15,6 +15,8 @@ T my_func (T *x, T y)
     *x = y;
   else
     *x = *x;
+
+  return T();
 }
 
 template <class T> T my_func (T *x, T y);
diff --git a/gcc/testsuite/g++.dg/cilk-plus/CK/pr68997.cc b/gcc/testsuite/g++.dg/cilk-plus/CK/pr68997.cc
index b442bf9cc24..a9a8a51ce7e 100644
--- a/gcc/testsuite/g++.dg/cilk-plus/CK/pr68997.cc
+++ b/gcc/testsuite/g++.dg/cilk-plus/CK/pr68997.cc
@@ -16,7 +16,7 @@ struct A2 {
 };
 
 A2 fa2 () {
-  A2 ();
+  return A2 ();
 }
 
 struct B1 {
diff --git a/gcc/testsuite/g++.dg/eh/sighandle.C b/gcc/testsuite/g++.dg/eh/sighandle.C
index 5c4995e7677..c2200024687 100644
--- a/gcc/testsuite/g++.dg/eh/sighandle.C
+++ b/gcc/testsuite/g++.dg/eh/sighandle.C
@@ -12,6 +12,7 @@ void sighandler (int signo, siginfo_t * si, void * uc)
 char * dosegv ()
 {    
   * ((volatile int *)0) = 12;
+  return 0;
 }
 
 int main ()
diff --git a/gcc/testsuite/g++.dg/ext/vector14.C b/gcc/testsuite/g++.dg/ext/vector14.C
index 8e792108fb8..eecff39de47 100644
--- a/gcc/testsuite/g++.dg/ext/vector14.C
+++ b/gcc/testsuite/g++.dg/ext/vector14.C
@@ -8,7 +8,11 @@
 
 #define vector __attribute__((vector_size(16)))
 
-template<int N> vector signed int foo (vector float value) {}
+template<int N> vector signed int foo (vector float value)
+{
+  vector signed int a;
+  return a;
+}
 
 template<int> void foo (float) {}
 
@@ -19,4 +23,6 @@ main ()
   float f;
   foo<1> (v);
   foo<1> (f);
+
+  return 0;
 }
diff --git a/gcc/testsuite/g++.dg/graphite/pr41305.C b/gcc/testsuite/g++.dg/graphite/pr41305.C
index 6a30b0e9e39..756b1267288 100644
--- a/gcc/testsuite/g++.dg/graphite/pr41305.C
+++ b/gcc/testsuite/g++.dg/graphite/pr41305.C
@@ -1,5 +1,5 @@
 // { dg-do compile }
-// { dg-options "-O3 -floop-interchange -Wno-conversion-null" }
+// { dg-options "-O3 -floop-interchange -Wno-conversion-null -Wno-return-type" }
 
 void __throw_bad_alloc ();
 
diff --git a/gcc/testsuite/g++.dg/graphite/pr42930.C b/gcc/testsuite/g++.dg/graphite/pr42930.C
index c1150ce9353..e569cea0177 100644
--- a/gcc/testsuite/g++.dg/graphite/pr42930.C
+++ b/gcc/testsuite/g++.dg/graphite/pr42930.C
@@ -1,4 +1,4 @@
-/* { dg-options "-O1 -floop-block" } */
+/* { dg-options "-O1 -floop-block -Wno-return-type" } */
 
 typedef unsigned char byte;
 typedef unsigned int uint;
diff --git a/gcc/testsuite/g++.dg/opt/pr46640.C b/gcc/testsuite/g++.dg/opt/pr46640.C
index 1c25778e8da..b55afd4937e 100644
--- a/gcc/testsuite/g++.dg/opt/pr46640.C
+++ b/gcc/testsuite/g++.dg/opt/pr46640.C
@@ -7,6 +7,7 @@ struct QBasicAtomicInt
   bool deref ()
   {
     asm volatile ("":"=m" (i), "=qm" (j));
+    return true;
   }
 };
 
@@ -41,4 +42,6 @@ bool makeDir (unsigned len)
         return false;
       i = pos;
     }
+
+  return true;
 }
diff --git a/gcc/testsuite/g++.dg/other/i386-8.C b/gcc/testsuite/g++.dg/other/i386-8.C
index cf833a524de..a9465ef12bc 100644
--- a/gcc/testsuite/g++.dg/other/i386-8.C
+++ b/gcc/testsuite/g++.dg/other/i386-8.C
@@ -19,4 +19,6 @@ foo (float *x, short *y)
   __m64 c = _mm_cvtps_pi16 (b);
   __builtin_memcpy (y, &c, sizeof (short) * 4);
   y[0] = bar (y[0]);
+
+  return 0;
 }
diff --git a/gcc/testsuite/g++.dg/pr45788.C b/gcc/testsuite/g++.dg/pr45788.C
index 0f4db20c769..9148585a7f6 100644
--- a/gcc/testsuite/g++.dg/pr45788.C
+++ b/gcc/testsuite/g++.dg/pr45788.C
@@ -1,5 +1,5 @@
 // { dg-do compile { target i?86-*-* x86_64-*-* } }
-// { dg-options "-O3 -fwhole-program -msse2" }
+// { dg-options "-O3 -fwhole-program -msse2 -Wno-return-type" }
 
 typedef long unsigned int __darwin_size_t;
 typedef __darwin_size_t size_t;
diff --git a/gcc/testsuite/g++.dg/pr64688.C b/gcc/testsuite/g++.dg/pr64688.C
index 3525e49b735..bf85f1abb45 100644
--- a/gcc/testsuite/g++.dg/pr64688.C
+++ b/gcc/testsuite/g++.dg/pr64688.C
@@ -24,7 +24,10 @@ template <typename> struct F;
 template <typename> struct G;
 template <typename, typename, int> struct H;
 template <typename Element, typename Layout> struct H<Element, Layout, 3> {};
-template <int, typename E, typename L, int N> unsigned char at_c(H<E, L, N>) {}
+template <int, typename E, typename L, int N> unsigned char at_c(H<E, L, N>)
+{
+  return 0;
+}
 template <typename> class I;
 template <typename> class J;
 template <typename> class K;
diff --git a/gcc/testsuite/g++.dg/pr65032.C b/gcc/testsuite/g++.dg/pr65032.C
index a62f50b49bf..d6b6768d25a 100644
--- a/gcc/testsuite/g++.dg/pr65032.C
+++ b/gcc/testsuite/g++.dg/pr65032.C
@@ -84,4 +84,6 @@ G::DecodeVorbis (int *p1)
       mDecodedAudioFrames -= b;
       fn2 (b);
     }
+
+  return nsresult();
 }
diff --git a/gcc/testsuite/g++.dg/pr71633.C b/gcc/testsuite/g++.dg/pr71633.C
index 48e9c9833ec..8852695b910 100644
--- a/gcc/testsuite/g++.dg/pr71633.C
+++ b/gcc/testsuite/g++.dg/pr71633.C
@@ -20,6 +20,7 @@ class c3 : c1, c2
 
 int *c3::fn2 () const
 {
+  return 0;
 }
 
 int *c3::fn3 (int p) const
diff --git a/gcc/testsuite/g++.dg/stackprotectexplicit2.C b/gcc/testsuite/g++.dg/stackprotectexplicit2.C
index 9cf9ab909c9..35d9e886ccf 100644
--- a/gcc/testsuite/g++.dg/stackprotectexplicit2.C
+++ b/gcc/testsuite/g++.dg/stackprotectexplicit2.C
@@ -7,6 +7,7 @@ int A()
 {
 	int A[23];
 	char b[22];
+	return 0;
 }
 
 int __attribute__((stack_protect)) B()
@@ -24,4 +25,4 @@ int __attribute__((stack_protect)) c()
 }
 
 
-/* { dg-final { scan-assembler-times "stack_chk_fail" 2 } } */
\ No newline at end of file
+/* { dg-final { scan-assembler-times "stack_chk_fail" 2 } } */
diff --git a/gcc/testsuite/g++.old-deja/g++.law/weak.C b/gcc/testsuite/g++.old-deja/g++.law/weak.C
index 49132adbeb3..52444e77946 100644
--- a/gcc/testsuite/g++.old-deja/g++.law/weak.C
+++ b/gcc/testsuite/g++.old-deja/g++.law/weak.C
@@ -11,10 +11,12 @@
 
 std::istream x (0);
 
+int
 main () {
   x.get();
   std::putc(0, 0);
   std::fgets(0, 0, 0); 
   x.get((char*) 0, 0);
+  return 0;
 }
 
diff --git a/libgomp/testsuite/libgomp.c++/loop-2.C b/libgomp/testsuite/libgomp.c++/loop-2.C
index ea3dc588afd..77144b8e7c6 100644
--- a/libgomp/testsuite/libgomp.c++/loop-2.C
+++ b/libgomp/testsuite/libgomp.c++/loop-2.C
@@ -15,6 +15,7 @@ void parloop (int *a)
     a[i] = i + 3;
 }
 
+int
 main()
 {
   int i, a[N];
diff --git a/libgomp/testsuite/libgomp.c++/loop-4.C b/libgomp/testsuite/libgomp.c++/loop-4.C
index 731f2345021..a940854c637 100644
--- a/libgomp/testsuite/libgomp.c++/loop-4.C
+++ b/libgomp/testsuite/libgomp.c++/loop-4.C
@@ -1,5 +1,6 @@
 extern "C" void abort (void);
 
+int
 main()
 {
   int i, a;
diff --git a/libgomp/testsuite/libgomp.c++/parallel-1.C b/libgomp/testsuite/libgomp.c++/parallel-1.C
index 3c931471328..ce338d0ddf9 100644
--- a/libgomp/testsuite/libgomp.c++/parallel-1.C
+++ b/libgomp/testsuite/libgomp.c++/parallel-1.C
@@ -8,6 +8,7 @@ foo (void)
   return 10;
 }
 
+int
 main ()
 {
   int A = 0;
diff --git a/libgomp/testsuite/libgomp.c++/shared-1.C b/libgomp/testsuite/libgomp.c++/shared-1.C
index 334a553ce23..2f61daa1213 100644
--- a/libgomp/testsuite/libgomp.c++/shared-1.C
+++ b/libgomp/testsuite/libgomp.c++/shared-1.C
@@ -53,6 +53,7 @@ parallel (int a, int b)
     abort ();
 }
 
+int
 main()
 {
   parallel (1, 2);
diff --git a/libgomp/testsuite/libgomp.c++/single-1.C b/libgomp/testsuite/libgomp.c++/single-1.C
index e318a48ca5c..221236f24f2 100644
--- a/libgomp/testsuite/libgomp.c++/single-1.C
+++ b/libgomp/testsuite/libgomp.c++/single-1.C
@@ -1,5 +1,6 @@
 extern "C" void abort (void);
 
+int
 main()
 {
   int i = 0;
diff --git a/libgomp/testsuite/libgomp.c++/single-2.C b/libgomp/testsuite/libgomp.c++/single-2.C
index c2dd228568d..d24b1d85e66 100644
--- a/libgomp/testsuite/libgomp.c++/single-2.C
+++ b/libgomp/testsuite/libgomp.c++/single-2.C
@@ -7,6 +7,7 @@ struct X
   int c;
 };
 
+int
 main()
 {
   int i = 0;
diff --git a/libstdc++-v3/testsuite/27_io/basic_fstream/cons/char/path.cc b/libstdc++-v3/testsuite/27_io/basic_fstream/cons/char/path.cc
index 4442c28c56b..51337ebd909 100644
--- a/libstdc++-v3/testsuite/27_io/basic_fstream/cons/char/path.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_fstream/cons/char/path.cc
@@ -45,4 +45,5 @@ main()
 {
   test01();
   test02();
+  return 0;
 }
diff --git a/libstdc++-v3/testsuite/27_io/basic_ifstream/cons/char/path.cc b/libstdc++-v3/testsuite/27_io/basic_ifstream/cons/char/path.cc
index 24286f5eeaf..a0de4ba55b2 100644
--- a/libstdc++-v3/testsuite/27_io/basic_ifstream/cons/char/path.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ifstream/cons/char/path.cc
@@ -45,4 +45,5 @@ main()
 {
   test01();
   test02();
+  return 0;
 }
diff --git a/libstdc++-v3/testsuite/27_io/basic_ofstream/open/char/path.cc b/libstdc++-v3/testsuite/27_io/basic_ofstream/open/char/path.cc
index a3fc0c7ff68..38078c97ef7 100644
--- a/libstdc++-v3/testsuite/27_io/basic_ofstream/open/char/path.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ofstream/open/char/path.cc
@@ -47,4 +47,5 @@ main()
 {
   test01();
   test02();
+  return 0;
 }
-- 
2.14.3


^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH] Fix test-suite fallout of default -Wreturn-type.
  2017-11-06 13:38                                 ` Martin Liška
@ 2017-11-06 13:58                                   ` Paolo Carlini
  2017-11-06 14:12                                     ` Martin Liška
  0 siblings, 1 reply; 64+ messages in thread
From: Paolo Carlini @ 2017-11-06 13:58 UTC (permalink / raw)
  To: Martin Liška, Jason Merrill
  Cc: Jakub Jelinek, gcc-patches List, Jonathan Wakely

Hi,

On 06/11/2017 14:37, Martin Liška wrote:
> Thank you for the patch.
> I'm going to install the remaining part that will fix x86_64 fallout. All changes are
> quite obvious, so hope it's fine to install it.
I think so. Thanks.

Note that the 3 additional libstdc++-v3 changes aren't really necessary, 
but those testcases are failing, seg faulting, at run time for unrelated 
reasons. I don't know if Jonathan is already on that...

Paolo.

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH] Fix test-suite fallout of default -Wreturn-type.
  2017-11-06 13:58                                   ` Paolo Carlini
@ 2017-11-06 14:12                                     ` Martin Liška
  2017-11-06 21:17                                       ` [PATCH] Further -Wreturn-type testsuite fallout Jakub Jelinek
  2017-11-15 13:33                                       ` [PATCH] Fix test-suite fallout of default -Wreturn-type Jonathan Wakely
  0 siblings, 2 replies; 64+ messages in thread
From: Martin Liška @ 2017-11-06 14:12 UTC (permalink / raw)
  To: Paolo Carlini, Jason Merrill
  Cc: Jakub Jelinek, gcc-patches List, Jonathan Wakely

On 11/06/2017 02:58 PM, Paolo Carlini wrote:
> Hi,
> 
> On 06/11/2017 14:37, Martin Liška wrote:
>> Thank you for the patch.
>> I'm going to install the remaining part that will fix x86_64 fallout. All changes are
>> quite obvious, so hope it's fine to install it.
> I think so. Thanks.
> 
> Note that the 3 additional libstdc++-v3 changes aren't really necessary, but those testcases are failing, seg faulting, at run time for unrelated reasons. I don't know if Jonathan is already on that...
> 
> Paolo.

You're right, it started right when it was introduced in r254008.

I see:

g++ libstdc++-v3/testsuite/27_io/basic_ifstream/cons/char/path.cc -std=gnu++17 -I. -lstdc++fs && ./a.out
libstdc++-v3/testsuite/27_io/basic_ifstream/cons/char/path.cc:33: void test01(): Assertion 'f.is_open()' failed.
Aborted (core dumped)

Martin

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH][RFC] Instrument function exit with __builtin_unreachable in C++.
  2017-11-03 13:42                   ` Martin Liška
@ 2017-11-06 17:27                     ` Eric Botcazou
  2017-11-06 17:41                       ` Jakub Jelinek
  2017-11-06 18:41                     ` Martin Sebor
                                       ` (2 subsequent siblings)
  3 siblings, 1 reply; 64+ messages in thread
From: Eric Botcazou @ 2017-11-06 17:27 UTC (permalink / raw)
  To: Martin Liška
  Cc: gcc-patches, Jason Merrill, Marek Polacek, Jakub Jelinek,
	Jonathan Wakely

[-- Attachment #1: Type: text/plain, Size: 310 bytes --]

> Thank you for review, done that.

This has enabled -Wreturn-type for Ada, what we don't want since the warning 
is outsmarted by the language, so I have applied this.


2017-11-06  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc-interface/misc.c (gnat_post_options): Clear warn_return_type.

-- 
Eric Botcazou

[-- Attachment #2: p.diff --]
[-- Type: text/x-patch, Size: 508 bytes --]

Index: gcc-interface/misc.c
===================================================================
--- gcc-interface/misc.c	(revision 254449)
+++ gcc-interface/misc.c	(working copy)
@@ -262,6 +262,9 @@ gnat_post_options (const char **pfilenam
   /* No psABI change warnings for Ada.  */
   warn_psabi = 0;
 
+  /* No return type warnings for Ada.  */
+  warn_return_type = 0;
+
   /* No caret by default for Ada.  */
   if (!global_options_set.x_flag_diagnostics_show_caret)
     global_dc->show_caret = false;

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH][RFC] Instrument function exit with __builtin_unreachable in C++.
  2017-11-06 17:27                     ` Eric Botcazou
@ 2017-11-06 17:41                       ` Jakub Jelinek
  2017-11-06 23:07                         ` Eric Botcazou
  2017-11-07 10:18                         ` Martin Liška
  0 siblings, 2 replies; 64+ messages in thread
From: Jakub Jelinek @ 2017-11-06 17:41 UTC (permalink / raw)
  To: Eric Botcazou
  Cc: Martin Liška, gcc-patches, Jason Merrill, Marek Polacek,
	Jonathan Wakely

On Mon, Nov 06, 2017 at 06:23:11PM +0100, Eric Botcazou wrote:
> > Thank you for review, done that.
> 
> This has enabled -Wreturn-type for Ada, what we don't want since the warning 
> is outsmarted by the language, so I have applied this.
> 
> 
> 2017-11-06  Eric Botcazou  <ebotcazou@adacore.com>
> 
> 	* gcc-interface/misc.c (gnat_post_options): Clear warn_return_type.

Hasn't it enabled it also for any other FEs other than C family and Fortran?
Say jit, brig, go, lto?, ...
I think better would be to remove the initialization to -1 and revert the
fortran/options.c change, and instead use in the C family:
  if (!global_options_set.x_warn_return_type)
    warn_return_type = c_dialect_cxx ();

Unless it for some reason doesn't work for -Wall or -W or similar.

	Jakub

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH][RFC] Instrument function exit with __builtin_unreachable in C++.
  2017-11-03 13:42                   ` Martin Liška
  2017-11-06 17:27                     ` Eric Botcazou
@ 2017-11-06 18:41                     ` Martin Sebor
  2017-11-15 12:49                       ` [PATCH][RFC] Add quotes for constexpr keyword Martin Liška
  2017-11-07 17:28                     ` [PATCH][RFC] Instrument function exit with __builtin_unreachable in C++ Andreas Schwab
  2017-11-19 17:06                     ` Thomas Schwinge
  3 siblings, 1 reply; 64+ messages in thread
From: Martin Sebor @ 2017-11-06 18:41 UTC (permalink / raw)
  To: Martin Liška, Jason Merrill, Marek Polacek
  Cc: Jakub Jelinek, gcc-patches List, Jonathan Wakely

Sorry for being late with my comment.  I just spotted this minor
formatting issue.  Even though GCC isn't (yet) consistent about
it the keyword "constexpr" should be quoted in the error message
below (and, eventually, in all diagnostic messages).  Since the
patch has been committed by now this is just a reminder for us
to try to keep this in mind in the future.

Martin

--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -1180,9 +1180,18 @@ cxx_eval_builtin_function_call (const 
constexpr_ctx *ctx, tree t, tree fun,
      {
        if (!*non_constant_p && !ctx->quiet)
  	{
-	  new_call = build_call_array_loc (EXPR_LOCATION (t), TREE_TYPE (t),
-					   CALL_EXPR_FN (t), nargs, args);
-	  error ("%q+E is not a constant expression", new_call);
+	  /* Do not allow__builtin_unreachable in constexpr function.
+	     The __builtin_unreachable call with BUILTINS_LOCATION
+	     comes from cp_maybe_instrument_return.  */
+	  if (DECL_FUNCTION_CODE (fun) == BUILT_IN_UNREACHABLE
+	      && EXPR_LOCATION (t) == BUILTINS_LOCATION)
+	    error ("constexpr call flows off the end of the function");

^ permalink raw reply	[flat|nested] 64+ messages in thread

* [PATCH] Further -Wreturn-type testsuite fallout
  2017-11-06 14:12                                     ` Martin Liška
@ 2017-11-06 21:17                                       ` Jakub Jelinek
  2017-11-15 13:33                                       ` [PATCH] Fix test-suite fallout of default -Wreturn-type Jonathan Wakely
  1 sibling, 0 replies; 64+ messages in thread
From: Jakub Jelinek @ 2017-11-06 21:17 UTC (permalink / raw)
  To: Jason Merrill, Rainer Orth, Mike Stump, Martin Liška
  Cc: Paolo Carlini, gcc-patches List

On Mon, Nov 06, 2017 at 03:12:00PM +0100, Martin Liška wrote:
> On 11/06/2017 02:58 PM, Paolo Carlini wrote:
> > Hi,
> > 
> > On 06/11/2017 14:37, Martin Liška wrote:
> >> Thank you for the patch.
> >> I'm going to install the remaining part that will fix x86_64 fallout. All changes are
> >> quite obvious, so hope it's fine to install it.
> > I think so. Thanks.
> > 
> > Note that the 3 additional libstdc++-v3 changes aren't really necessary, but those testcases are failing, seg faulting, at run time for unrelated reasons. I don't know if Jonathan is already on that...
> > 
> > Paolo.
> 
> You're right, it started right when it was introduced in r254008.
> 
> I see:
> 
> g++ libstdc++-v3/testsuite/27_io/basic_ifstream/cons/char/path.cc -std=gnu++17 -I. -lstdc++fs && ./a.out
> libstdc++-v3/testsuite/27_io/basic_ifstream/cons/char/path.cc:33: void test01(): Assertion 'f.is_open()' failed.
> Aborted (core dumped)

I'm seeing also:
+FAIL: g++.dg/pr50763-3.C  -std=gnu++11 (test for excess errors)
+FAIL: g++.dg/pr50763-3.C  -std=gnu++14 (test for excess errors)
+FAIL: g++.dg/pr50763-3.C  -std=gnu++98 (test for excess errors)
+FAIL: g++.dg/pr57878.C  -std=gnu++11 (test for excess errors)
+FAIL: g++.dg/pr57878.C  -std=gnu++14 (test for excess errors)
on i686-linux.  The following patch fixes that and I've additionally
verified the testcases even with the changes ICE as before with
revisions before the fixes and work after those (and with current trunk).

Ok for trunk?

2017-11-06  Jakub Jelinek  <jakub@redhat.com>

	* g++.dg/pr57878.C (__sso_string_base::_M_get_allocator): Return
	a value.
	* g++.dg/pr50763-3.C (sExt::evalPoint): Likewise.

--- gcc/testsuite/g++.dg/pr57878.C.jj	2014-03-10 10:49:55.000000000 +0100
+++ gcc/testsuite/g++.dg/pr57878.C	2017-11-06 22:04:24.166063301 +0100
@@ -95,6 +95,8 @@ namespace __gnu_cxx __attribute__ ((__vi
     }
     __sso_string_base(const __sso_string_base& __rcs);
     const _CharT_alloc_type& _M_get_allocator() const {
+      static _CharT_alloc_type c;
+      return c;
     }
   };
   template<typename _CharT, typename _Traits, typename _Alloc>
--- gcc/testsuite/g++.dg/pr50763-3.C.jj	2011-11-04 07:49:39.000000000 +0100
+++ gcc/testsuite/g++.dg/pr50763-3.C	2017-11-06 21:59:48.983471233 +0100
@@ -54,4 +54,5 @@ long sExt::evalPoint(const v2d & crUV, v
       sUV = _Dom.clp2d(crUV);
    }
    eval();
+   return 0;
 }   


	Jakub

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH][RFC] Instrument function exit with __builtin_unreachable in C++.
  2017-11-06 17:41                       ` Jakub Jelinek
@ 2017-11-06 23:07                         ` Eric Botcazou
  2017-11-07 10:18                         ` Martin Liška
  1 sibling, 0 replies; 64+ messages in thread
From: Eric Botcazou @ 2017-11-06 23:07 UTC (permalink / raw)
  To: Jakub Jelinek
  Cc: gcc-patches, Martin Liška, Jason Merrill, Marek Polacek,
	Jonathan Wakely

> Hasn't it enabled it also for any other FEs other than C family and Fortran?
> Say jit, brig, go, lto?, ...

Very likely, yes.

> I think better would be to remove the initialization to -1 and revert the
> fortran/options.c change, and instead use in the C family:
>   if (!global_options_set.x_warn_return_type)
>     warn_return_type = c_dialect_cxx ();

No disagreement.

-- 
Eric Botcazou

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH][RFC] Instrument function exit with __builtin_unreachable in C++.
  2017-11-06 17:41                       ` Jakub Jelinek
  2017-11-06 23:07                         ` Eric Botcazou
@ 2017-11-07 10:18                         ` Martin Liška
  2017-11-15  7:57                           ` Martin Liška
  2017-11-15  8:23                           ` Jakub Jelinek
  1 sibling, 2 replies; 64+ messages in thread
From: Martin Liška @ 2017-11-07 10:18 UTC (permalink / raw)
  To: Jakub Jelinek, Eric Botcazou
  Cc: gcc-patches, Jason Merrill, Marek Polacek, Jonathan Wakely

[-- Attachment #1: Type: text/plain, Size: 1100 bytes --]

On 11/06/2017 06:33 PM, Jakub Jelinek wrote:
> On Mon, Nov 06, 2017 at 06:23:11PM +0100, Eric Botcazou wrote:
>>> Thank you for review, done that.
>>
>> This has enabled -Wreturn-type for Ada, what we don't want since the warning 
>> is outsmarted by the language, so I have applied this.
>>
>>
>> 2017-11-06  Eric Botcazou  <ebotcazou@adacore.com>
>>
>> 	* gcc-interface/misc.c (gnat_post_options): Clear warn_return_type.
> 
> Hasn't it enabled it also for any other FEs other than C family and Fortran?
> Say jit, brig, go, lto?, ...
> I think better would be to remove the initialization to -1 and revert the
> fortran/options.c change, and instead use in the C family:
>   if (!global_options_set.x_warn_return_type)
>     warn_return_type = c_dialect_cxx ();
> 
> Unless it for some reason doesn't work for -Wall or -W or similar.
> 
> 	Jakub
> 

Hello.

Sorry for the inconvenience, however using Jakub's approach really does not work properly
with -Wall.

Thus I'm suggesting following patch that will disable it in all *_post_options hooks.

Ready after it survives regression tests?
Martin

[-- Attachment #2: 0001-Drop-Wreturn-type-by-default-for-BRIG-GO-and-LTO-FEs.patch --]
[-- Type: text/x-patch, Size: 2137 bytes --]

From d5e41295202a09c98787dba436cc568bbf1bbf4a Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Tue, 7 Nov 2017 10:27:13 +0100
Subject: [PATCH] Drop -Wreturn-type by default for BRIG, GO and LTO FEs.

gcc/brig/ChangeLog:

2017-11-07  Martin Liska  <mliska@suse.cz>

	* brig-lang.c (brig_langhook_post_options): Drop
	warn_return_type if not set.

gcc/go/ChangeLog:

2017-11-07  Martin Liska  <mliska@suse.cz>

	* go-lang.c (go_langhook_post_options): Drop
	warn_return_type if not set.

gcc/lto/ChangeLog:

2017-11-07  Martin Liska  <mliska@suse.cz>

	* lto-lang.c (lto_post_options): Drop
	warn_return_type if not set.
---
 gcc/brig/brig-lang.c | 3 +++
 gcc/go/go-lang.c     | 3 +++
 gcc/lto/lto-lang.c   | 3 +++
 3 files changed, 9 insertions(+)

diff --git a/gcc/brig/brig-lang.c b/gcc/brig/brig-lang.c
index f34d9587632..1fd558cc6df 100644
--- a/gcc/brig/brig-lang.c
+++ b/gcc/brig/brig-lang.c
@@ -171,6 +171,9 @@ brig_langhook_post_options (const char **pfilename ATTRIBUTE_UNUSED)
      broken code if not force disabling it.  */
   flag_strict_aliasing = 0;
 
+  if (warn_return_type == -1)
+    warn_return_type = 0;
+
   /* Returning false means that the backend should be used.  */
   return false;
 }
diff --git a/gcc/go/go-lang.c b/gcc/go/go-lang.c
index 81eeb5c9cdc..0baebe32349 100644
--- a/gcc/go/go-lang.c
+++ b/gcc/go/go-lang.c
@@ -313,6 +313,9 @@ go_langhook_post_options (const char **pfilename ATTRIBUTE_UNUSED)
       && !global_options_set.x_flag_reorder_blocks_and_partition)
     global_options.x_flag_reorder_blocks_and_partition = 0;
 
+  if (warn_return_type == -1)
+    warn_return_type = 0;
+
   /* Returning false means that the backend should be used.  */
   return false;
 }
diff --git a/gcc/lto/lto-lang.c b/gcc/lto/lto-lang.c
index 88f29705e65..892d4767f76 100644
--- a/gcc/lto/lto-lang.c
+++ b/gcc/lto/lto-lang.c
@@ -877,6 +877,9 @@ lto_post_options (const char **pfilename ATTRIBUTE_UNUSED)
   if (!flag_merge_constants)
     flag_merge_constants = 1;
 
+  if (warn_return_type == -1)
+    warn_return_type = 0;
+
   /* Initialize the compiler back end.  */
   return false;
 }
-- 
2.14.3


^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH][RFC] Instrument function exit with __builtin_unreachable in C++.
  2017-11-03 13:42                   ` Martin Liška
  2017-11-06 17:27                     ` Eric Botcazou
  2017-11-06 18:41                     ` Martin Sebor
@ 2017-11-07 17:28                     ` Andreas Schwab
  2017-11-07 19:06                       ` Martin Liška
  2017-11-19 17:06                     ` Thomas Schwinge
  3 siblings, 1 reply; 64+ messages in thread
From: Andreas Schwab @ 2017-11-07 17:28 UTC (permalink / raw)
  To: Martin Liška
  Cc: Jason Merrill, Marek Polacek, Jakub Jelinek, gcc-patches List,
	Jonathan Wakely

This breaks g++.dg/torture/pr64669.C with -O3 on ia64:

$ gcc/xg++ -Bgcc/ ../../gcc/gcc/testsuite/g++.dg/torture/pr64669.C -nostdinc++ -Iia64-suse-linux/libstdc++-v3/include/ia64-suse-linux -Iia64-suse-linux/libstdc++-v3/include -I../libstdc++-v3/libsupc++ -I../libstdc++-v3/include/backward -I../libstdc++-v3/testsuite/util -O3 -S -o pr64669.s                   
../../gcc/gcc/testsuite/g++.dg/torture/pr64669.C: In member function ‘const char* Lex::advance_one_char(const char*, bool, unsigned int*, bool*)’:
../../gcc/gcc/testsuite/g++.dg/torture/pr64669.C:65:1: error: qsort comparator non-negative on sorted output: 1
 }
 ^
during RTL pass: mach
../../gcc/gcc/testsuite/g++.dg/torture/pr64669.C:65:1: internal compiler error: qsort checking failed
0x40000000001cc80f qsort_chk_error
        ../../gcc/vec.c:222
0x40000000025d20cf qsort_chk(void*, unsigned long, unsigned long, int (*)(void const*, void const*))
        ../../gcc/vec.c:274
0x40000000014f680f vec<_expr*, va_heap, vl_embed>::qsort(int (*)(void const*, void const*))
        ../../gcc/vec.h:973
0x40000000014f680f vec<_expr*, va_heap, vl_ptr>::qsort(int (*)(void const*, void const*))
        ../../gcc/vec.h:1735
0x40000000014f680f fill_vec_av_set
        ../../gcc/sel-sched.c:3725
0x40000000014fc59f fill_ready_list
        ../../gcc/sel-sched.c:4022
0x40000000014fc59f find_best_expr
        ../../gcc/sel-sched.c:4382
0x40000000014fc59f fill_insns
        ../../gcc/sel-sched.c:5539
0x40000000014fc59f schedule_on_fences
        ../../gcc/sel-sched.c:7356
0x40000000014fc59f sel_sched_region_2
        ../../gcc/sel-sched.c:7494
0x4000000001503acf sel_sched_region_1
        ../../gcc/sel-sched.c:7536
0x4000000001503acf sel_sched_region(int)
        ../../gcc/sel-sched.c:7637
0x4000000001504e6f run_selective_scheduling()
        ../../gcc/sel-sched.c:7713
0x4000000001df9bdf ia64_reorg
        ../../gcc/config/ia64/ia64.c:9854
0x400000000146d40f execute
        ../../gcc/reorg.c:3947

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH] Fix test-suite fallout of default -Wreturn-type.
  2017-10-18 12:53           ` [PATCH] Fix test-suite fallout of default -Wreturn-type Martin Liška
  2017-10-24 14:40             ` Jason Merrill
@ 2017-11-07 17:33             ` Andreas Schwab
  2017-11-07 17:38               ` Jakub Jelinek
  2017-11-19 13:26             ` Thomas Schwinge
  2 siblings, 1 reply; 64+ messages in thread
From: Andreas Schwab @ 2017-11-07 17:33 UTC (permalink / raw)
  To: Martin Liška
  Cc: Jakub Jelinek, Jason Merrill, gcc-patches List, Jonathan Wakely

	* g++.dg/pr50763-3.C (evalPoint): Return a value.

diff --git a/gcc/testsuite/g++.dg/pr50763-3.C b/gcc/testsuite/g++.dg/pr50763-3.C
index b66be87b1b..33aba30406 100644
--- a/gcc/testsuite/g++.dg/pr50763-3.C
+++ b/gcc/testsuite/g++.dg/pr50763-3.C
@@ -53,5 +53,5 @@ long sExt::evalPoint(const v2d & crUV, v3d & rPnt) const {
    if (!_Dom.cop2d(crUV)) {
       sUV = _Dom.clp2d(crUV);
    }
-   eval();
+   return eval();
 }   
-- 
2.15.0


-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH] Fix test-suite fallout of default -Wreturn-type.
  2017-11-07 17:33             ` Andreas Schwab
@ 2017-11-07 17:38               ` Jakub Jelinek
  2017-11-08  8:02                 ` Andreas Schwab
  0 siblings, 1 reply; 64+ messages in thread
From: Jakub Jelinek @ 2017-11-07 17:38 UTC (permalink / raw)
  To: Andreas Schwab
  Cc: Martin Liška, Jason Merrill, gcc-patches List, Jonathan Wakely

On Tue, Nov 07, 2017 at 06:27:52PM +0100, Andreas Schwab wrote:
> 	* g++.dg/pr50763-3.C (evalPoint): Return a value.

http://gcc.gnu.org/ml/gcc-patches/2017-11/msg00407.html
(waiting for review)

> diff --git a/gcc/testsuite/g++.dg/pr50763-3.C b/gcc/testsuite/g++.dg/pr50763-3.C
> index b66be87b1b..33aba30406 100644
> --- a/gcc/testsuite/g++.dg/pr50763-3.C
> +++ b/gcc/testsuite/g++.dg/pr50763-3.C
> @@ -53,5 +53,5 @@ long sExt::evalPoint(const v2d & crUV, v3d & rPnt) const {
>     if (!_Dom.cop2d(crUV)) {
>        sUV = _Dom.clp2d(crUV);
>     }
> -   eval();
> +   return eval();
>  }   
> -- 
> 2.15.0
> 
> 
> -- 
> Andreas Schwab, SUSE Labs, schwab@suse.de
> GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
> "And now for something completely different."

	Jakub

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH][RFC] Instrument function exit with __builtin_unreachable in C++.
  2017-11-07 17:28                     ` [PATCH][RFC] Instrument function exit with __builtin_unreachable in C++ Andreas Schwab
@ 2017-11-07 19:06                       ` Martin Liška
  0 siblings, 0 replies; 64+ messages in thread
From: Martin Liška @ 2017-11-07 19:06 UTC (permalink / raw)
  To: Andreas Schwab
  Cc: Jason Merrill, Marek Polacek, Jakub Jelinek, gcc-patches List,
	Jonathan Wakely

On 11/07/2017 06:15 PM, Andreas Schwab wrote:
> This breaks g++.dg/torture/pr64669.C with -O3 on ia64:
> 
> $ gcc/xg++ -Bgcc/ ../../gcc/gcc/testsuite/g++.dg/torture/pr64669.C -nostdinc++ -Iia64-suse-linux/libstdc++-v3/include/ia64-suse-linux -Iia64-suse-linux/libstdc++-v3/include -I../libstdc++-v3/libsupc++ -I../libstdc++-v3/include/backward -I../libstdc++-v3/testsuite/util -O3 -S -o pr64669.s
> ../../gcc/gcc/testsuite/g++.dg/torture/pr64669.C: In member function ‘const char* Lex::advance_one_char(const char*, bool, unsigned int*, bool*)’:
> ../../gcc/gcc/testsuite/g++.dg/torture/pr64669.C:65:1: error: qsort comparator non-negative on sorted output: 1
>   }
>   ^
> during RTL pass: mach
> ../../gcc/gcc/testsuite/g++.dg/torture/pr64669.C:65:1: internal compiler error: qsort checking failed
> 0x40000000001cc80f qsort_chk_error
>          ../../gcc/vec.c:222
> 0x40000000025d20cf qsort_chk(void*, unsigned long, unsigned long, int (*)(void const*, void const*))
>          ../../gcc/vec.c:274
> 0x40000000014f680f vec<_expr*, va_heap, vl_embed>::qsort(int (*)(void const*, void const*))
>          ../../gcc/vec.h:973
> 0x40000000014f680f vec<_expr*, va_heap, vl_ptr>::qsort(int (*)(void const*, void const*))
>          ../../gcc/vec.h:1735
> 0x40000000014f680f fill_vec_av_set
>          ../../gcc/sel-sched.c:3725
> 0x40000000014fc59f fill_ready_list
>          ../../gcc/sel-sched.c:4022
> 0x40000000014fc59f find_best_expr
>          ../../gcc/sel-sched.c:4382
> 0x40000000014fc59f fill_insns
>          ../../gcc/sel-sched.c:5539
> 0x40000000014fc59f schedule_on_fences
>          ../../gcc/sel-sched.c:7356
> 0x40000000014fc59f sel_sched_region_2
>          ../../gcc/sel-sched.c:7494
> 0x4000000001503acf sel_sched_region_1
>          ../../gcc/sel-sched.c:7536
> 0x4000000001503acf sel_sched_region(int)
>          ../../gcc/sel-sched.c:7637
> 0x4000000001504e6f run_selective_scheduling()
>          ../../gcc/sel-sched.c:7713
> 0x4000000001df9bdf ia64_reorg
>          ../../gcc/config/ia64/ia64.c:9854
> 0x400000000146d40f execute
>          ../../gcc/reorg.c:3947
> 
> Andreas.
> 

Hi Andreas.

That will be very probably dup of PR82398.

Martin

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH] Fix test-suite fallout of default -Wreturn-type.
  2017-11-07 17:38               ` Jakub Jelinek
@ 2017-11-08  8:02                 ` Andreas Schwab
  0 siblings, 0 replies; 64+ messages in thread
From: Andreas Schwab @ 2017-11-08  8:02 UTC (permalink / raw)
  To: Jakub Jelinek
  Cc: Martin Liška, Jason Merrill, gcc-patches List, Jonathan Wakely

On Nov 07 2017, Jakub Jelinek <jakub@redhat.com> wrote:

> On Tue, Nov 07, 2017 at 06:27:52PM +0100, Andreas Schwab wrote:
>> 	* g++.dg/pr50763-3.C (evalPoint): Return a value.
>
> http://gcc.gnu.org/ml/gcc-patches/2017-11/msg00407.html
> (waiting for review)

Sorry, I missed that.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH][RFC] Instrument function exit with __builtin_unreachable in C++.
  2017-11-07 10:18                         ` Martin Liška
@ 2017-11-15  7:57                           ` Martin Liška
  2017-11-15  8:23                           ` Jakub Jelinek
  1 sibling, 0 replies; 64+ messages in thread
From: Martin Liška @ 2017-11-15  7:57 UTC (permalink / raw)
  To: Jakub Jelinek, Eric Botcazou
  Cc: gcc-patches, Jason Merrill, Marek Polacek, Jonathan Wakely

PING^1

On 11/07/2017 11:08 AM, Martin Liška wrote:
> On 11/06/2017 06:33 PM, Jakub Jelinek wrote:
>> On Mon, Nov 06, 2017 at 06:23:11PM +0100, Eric Botcazou wrote:
>>>> Thank you for review, done that.
>>>
>>> This has enabled -Wreturn-type for Ada, what we don't want since the warning 
>>> is outsmarted by the language, so I have applied this.
>>>
>>>
>>> 2017-11-06  Eric Botcazou  <ebotcazou@adacore.com>
>>>
>>> 	* gcc-interface/misc.c (gnat_post_options): Clear warn_return_type.
>>
>> Hasn't it enabled it also for any other FEs other than C family and Fortran?
>> Say jit, brig, go, lto?, ...
>> I think better would be to remove the initialization to -1 and revert the
>> fortran/options.c change, and instead use in the C family:
>>   if (!global_options_set.x_warn_return_type)
>>     warn_return_type = c_dialect_cxx ();
>>
>> Unless it for some reason doesn't work for -Wall or -W or similar.
>>
>> 	Jakub
>>
> 
> Hello.
> 
> Sorry for the inconvenience, however using Jakub's approach really does not work properly
> with -Wall.
> 
> Thus I'm suggesting following patch that will disable it in all *_post_options hooks.
> 
> Ready after it survives regression tests?
> Martin
> 

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH][RFC] Instrument function exit with __builtin_unreachable in C++.
  2017-11-07 10:18                         ` Martin Liška
  2017-11-15  7:57                           ` Martin Liška
@ 2017-11-15  8:23                           ` Jakub Jelinek
  2017-11-15  9:58                             ` Eric Botcazou
  1 sibling, 1 reply; 64+ messages in thread
From: Jakub Jelinek @ 2017-11-15  8:23 UTC (permalink / raw)
  To: Martin Liška
  Cc: Eric Botcazou, gcc-patches, Jason Merrill, Marek Polacek,
	Jonathan Wakely

On Tue, Nov 07, 2017 at 11:08:58AM +0100, Martin Liška wrote:
> > Hasn't it enabled it also for any other FEs other than C family and Fortran?
> > Say jit, brig, go, lto?, ...
> > I think better would be to remove the initialization to -1 and revert the
> > fortran/options.c change, and instead use in the C family:
> >   if (!global_options_set.x_warn_return_type)
> >     warn_return_type = c_dialect_cxx ();
> > 
> > Unless it for some reason doesn't work for -Wall or -W or similar.
> > 
> 
> Hello.
> 
> Sorry for the inconvenience, however using Jakub's approach really does not work properly
> with -Wall.

If -Wall had an underlying variable, then we could use:
  if (!global_options_set.x_warn_return_type
      && !global_options_set.x_warn_all)
    warn_return_type = c_dialect_cxx ();

But we don't.  Wonder if in addition to your patch or instead of it it
wouldn't be safer (especially for FEs added in the future) to:
 
   /* If we see "return;" in some basic block, then we do reach the end
      without returning a value.  */
-  else if (warn_return_type
+  else if (warn_return_type > 0
            && !TREE_NO_WARNING (fun->decl)
            && EDGE_COUNT (EXIT_BLOCK_PTR_FOR_FN (fun)->preds) > 0
            && !VOID_TYPE_P (TREE_TYPE (TREE_TYPE (fun->decl))))

in tree-cfg.c.  That change is preapproved if it works, and your
patch if you want in addition to that is ok too.

	Jakub

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH][RFC] Instrument function exit with __builtin_unreachable in C++.
  2017-11-15  8:23                           ` Jakub Jelinek
@ 2017-11-15  9:58                             ` Eric Botcazou
  2017-11-15 10:02                               ` Martin Liška
  0 siblings, 1 reply; 64+ messages in thread
From: Eric Botcazou @ 2017-11-15  9:58 UTC (permalink / raw)
  To: Jakub Jelinek
  Cc: gcc-patches, Martin Liška, Jason Merrill, Marek Polacek,
	Jonathan Wakely

> But we don't.  Wonder if in addition to your patch or instead of it it
> wouldn't be safer (especially for FEs added in the future) to:
> 
>    /* If we see "return;" in some basic block, then we do reach the end
>       without returning a value.  */
> -  else if (warn_return_type
> +  else if (warn_return_type > 0
>             && !TREE_NO_WARNING (fun->decl)
>             && EDGE_COUNT (EXIT_BLOCK_PTR_FOR_FN (fun)->preds) > 0
>             && !VOID_TYPE_P (TREE_TYPE (TREE_TYPE (fun->decl))))
> 
> in tree-cfg.c.  That change is preapproved if it works, and your
> patch if you want in addition to that is ok too.

That's the first thing I tried and it indeed works.

-- 
Eric Botcazou

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH][RFC] Instrument function exit with __builtin_unreachable in C++.
  2017-11-15  9:58                             ` Eric Botcazou
@ 2017-11-15 10:02                               ` Martin Liška
  2017-11-15 10:10                                 ` Eric Botcazou
  2017-11-15 10:45                                 ` Jakub Jelinek
  0 siblings, 2 replies; 64+ messages in thread
From: Martin Liška @ 2017-11-15 10:02 UTC (permalink / raw)
  To: Eric Botcazou, Jakub Jelinek
  Cc: gcc-patches, Jason Merrill, Marek Polacek, Jonathan Wakely

[-- Attachment #1: Type: text/plain, Size: 913 bytes --]

On 11/15/2017 10:42 AM, Eric Botcazou wrote:
>> But we don't.  Wonder if in addition to your patch or instead of it it
>> wouldn't be safer (especially for FEs added in the future) to:
>>
>>    /* If we see "return;" in some basic block, then we do reach the end
>>       without returning a value.  */
>> -  else if (warn_return_type
>> +  else if (warn_return_type > 0
>>             && !TREE_NO_WARNING (fun->decl)
>>             && EDGE_COUNT (EXIT_BLOCK_PTR_FOR_FN (fun)->preds) > 0
>>             && !VOID_TYPE_P (TREE_TYPE (TREE_TYPE (fun->decl))))
>>
>> in tree-cfg.c.  That change is preapproved if it works, and your
>> patch if you want in addition to that is ok too.
> 
> That's the first thing I tried and it indeed works.
> 

Hi.

Following patch survives regression tests and bootstraps.
There are multiple places where warn_return_type should be compared
to zero.

Ready for trunk?
Thanks,
Martin

[-- Attachment #2: 0001-Disable-Wreturn-type-by-default-in-all-languages-oth.patch --]
[-- Type: text/x-patch, Size: 7337 bytes --]

From 5f8daccc584c7ae749d25d59526e0173aa4334f7 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Wed, 15 Nov 2017 09:16:23 +0100
Subject: [PATCH] Disable -Wreturn-type by default in all languages other from
 C++.

gcc/ChangeLog:

2017-11-15  Martin Liska  <mliska@suse.cz>

	* tree-cfg.c (pass_warn_function_return::execute):
	Compare warn_return_type for greater than zero.

gcc/ada/ChangeLog:

2017-11-15  Martin Liska  <mliska@suse.cz>

	* gcc-interface/misc.c (gnat_post_options):
	Do not set default value of warn_return_type.

gcc/c/ChangeLog:

2017-11-15  Martin Liska  <mliska@suse.cz>

	* c-decl.c (grokdeclarator):
	Compare warn_return_type for greater than zero.
	(start_function): Likewise.
	(finish_function): Likewise.
	* c-typeck.c (c_finish_return): Likewise.

gcc/cp/ChangeLog:

2017-11-15  Martin Liska  <mliska@suse.cz>

	* decl.c (finish_function):
	Compare warn_return_type for greater than zero.
	* semantics.c (finish_return_stmt): Likewise.

gcc/fortran/ChangeLog:

2017-11-15  Martin Liska  <mliska@suse.cz>

	* options.c (gfc_post_options):
	Do not set default value of warn_return_type.
	* trans-decl.c (gfc_trans_deferred_vars):
	Compare warn_return_type for greater than zero.
	(generate_local_decl): Likewise
	(gfc_generate_function_code): Likewise.
---
 gcc/ada/gcc-interface/misc.c | 3 ---
 gcc/c/c-decl.c               | 6 +++---
 gcc/c/c-typeck.c             | 2 +-
 gcc/cp/decl.c                | 2 +-
 gcc/cp/semantics.c           | 2 +-
 gcc/fortran/options.c        | 3 ---
 gcc/fortran/trans-decl.c     | 8 ++++----
 gcc/tree-cfg.c               | 2 +-
 8 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/gcc/ada/gcc-interface/misc.c b/gcc/ada/gcc-interface/misc.c
index 9a4a48fba42..7bdb3803c13 100644
--- a/gcc/ada/gcc-interface/misc.c
+++ b/gcc/ada/gcc-interface/misc.c
@@ -262,9 +262,6 @@ gnat_post_options (const char **pfilename ATTRIBUTE_UNUSED)
   /* No psABI change warnings for Ada.  */
   warn_psabi = 0;
 
-  /* No return type warnings for Ada.  */
-  warn_return_type = 0;
-
   /* No caret by default for Ada.  */
   if (!global_options_set.x_flag_diagnostics_show_caret)
     global_dc->show_caret = false;
diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
index d95a2b6ea4f..7120420f2df 100644
--- a/gcc/c/c-decl.c
+++ b/gcc/c/c-decl.c
@@ -5689,7 +5689,7 @@ grokdeclarator (const struct c_declarator *declarator,
       /* Issue a warning if this is an ISO C 99 program or if
 	 -Wreturn-type and this is a function, or if -Wimplicit;
 	 prefer the former warning since it is more explicit.  */
-      if ((warn_implicit_int || warn_return_type || flag_isoc99)
+      if ((warn_implicit_int || warn_return_type > 0 || flag_isoc99)
 	  && funcdef_flag)
 	warn_about_return_type = 1;
       else
@@ -8655,7 +8655,7 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator,
 
   if (warn_about_return_type)
     warn_defaults_to (loc, flag_isoc99 ? OPT_Wimplicit_int
-			   : (warn_return_type ? OPT_Wreturn_type
+			   : (warn_return_type > 0 ? OPT_Wreturn_type
 			      : OPT_Wimplicit_int),
 		      "return type defaults to %<int%>");
 
@@ -9373,7 +9373,7 @@ finish_function (void)
   finish_fname_decls ();
 
   /* Complain if there's just no return statement.  */
-  if (warn_return_type
+  if (warn_return_type > 0
       && TREE_CODE (TREE_TYPE (TREE_TYPE (fndecl))) != VOID_TYPE
       && !current_function_returns_value && !current_function_returns_null
       /* Don't complain if we are no-return.  */
diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
index 4bdc48a9ea3..492a245d296 100644
--- a/gcc/c/c-typeck.c
+++ b/gcc/c/c-typeck.c
@@ -10091,7 +10091,7 @@ c_finish_return (location_t loc, tree retval, tree origtype)
   if (!retval)
     {
       current_function_returns_null = 1;
-      if ((warn_return_type || flag_isoc99)
+      if ((warn_return_type > 0 || flag_isoc99)
 	  && valtype != NULL_TREE && TREE_CODE (valtype) != VOID_TYPE)
 	{
 	  bool warned_here;
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 041893db937..96bbff6c1f9 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -15583,7 +15583,7 @@ finish_function (bool inline_p)
     save_function_data (fndecl);
 
   /* Complain if there's just no return statement.  */
-  if (warn_return_type
+  if (warn_return_type > 0
       && !VOID_TYPE_P (TREE_TYPE (fntype))
       && !dependent_type_p (TREE_TYPE (fntype))
       && !current_function_returns_value && !current_function_returns_null
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 51489d17ad5..cbb395e3f61 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -890,7 +890,7 @@ finish_return_stmt (tree expr)
       || (flag_openmp && !check_omp_return ()))
     {
       /* Suppress -Wreturn-type for this function.  */
-      if (warn_return_type)
+      if (warn_return_type > 0)
 	TREE_NO_WARNING (current_function_decl) = true;
       return error_mark_node;
     }
diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c
index c584a19e559..0ee6b7808d9 100644
--- a/gcc/fortran/options.c
+++ b/gcc/fortran/options.c
@@ -435,9 +435,6 @@ gfc_post_options (const char **pfilename)
     gfc_fatal_error ("Maximum subrecord length cannot exceed %d",
 		     MAX_SUBRECORD_LENGTH);
 
-  if (warn_return_type == -1)
-    warn_return_type = 0;
-
   gfc_cpp_post_options ();
 
   if (gfc_option.allow_std & GFC_STD_F2008)
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 8efaae79ebc..60e7d8f79ee 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -4198,7 +4198,7 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, gfc_wrapped_block * block)
 		  break;
 	    }
 	  /* TODO: move to the appropriate place in resolve.c.  */
-	  if (warn_return_type && el == NULL)
+	  if (warn_return_type > 0 && el == NULL)
 	    gfc_warning (OPT_Wreturn_type,
 			 "Return value of function %qs at %L not set",
 			 proc_sym->name, &proc_sym->declared_at);
@@ -5619,7 +5619,7 @@ generate_local_decl (gfc_symbol * sym)
   else if (sym->attr.flavor == FL_PROCEDURE)
     {
       /* TODO: move to the appropriate place in resolve.c.  */
-      if (warn_return_type
+      if (warn_return_type > 0
 	  && sym->attr.function
 	  && sym->result
 	  && sym != sym->result
@@ -6494,11 +6494,11 @@ gfc_generate_function_code (gfc_namespace * ns)
       if (result == NULL_TREE || artificial_result_decl)
 	{
 	  /* TODO: move to the appropriate place in resolve.c.  */
-	  if (warn_return_type && sym == sym->result)
+	  if (warn_return_type > 0 && sym == sym->result)
 	    gfc_warning (OPT_Wreturn_type,
 			 "Return value of function %qs at %L not set",
 			 sym->name, &sym->declared_at);
-	  if (warn_return_type)
+	  if (warn_return_type > 0)
 	    TREE_NO_WARNING(sym->backend_decl) = 1;
 	}
       if (result != NULL_TREE)
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 9a2fa1d98ca..f08a0547f0f 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -9071,7 +9071,7 @@ pass_warn_function_return::execute (function *fun)
 
   /* If we see "return;" in some basic block, then we do reach the end
      without returning a value.  */
-  else if (warn_return_type
+  else if (warn_return_type > 0
 	   && !TREE_NO_WARNING (fun->decl)
 	   && EDGE_COUNT (EXIT_BLOCK_PTR_FOR_FN (fun)->preds) > 0
 	   && !VOID_TYPE_P (TREE_TYPE (TREE_TYPE (fun->decl))))
-- 
2.14.3


^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH][RFC] Instrument function exit with __builtin_unreachable in C++.
  2017-11-15 10:02                               ` Martin Liška
@ 2017-11-15 10:10                                 ` Eric Botcazou
  2017-11-15 10:45                                 ` Jakub Jelinek
  1 sibling, 0 replies; 64+ messages in thread
From: Eric Botcazou @ 2017-11-15 10:10 UTC (permalink / raw)
  To: Martin Liška
  Cc: gcc-patches, Jakub Jelinek, Jason Merrill, Marek Polacek,
	Jonathan Wakely

> Following patch survives regression tests and bootstraps.

Please drop the Ada bits though, -Wreturn-type just doesn't work in Ada.

-- 
Eric Botcazou

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH][RFC] Instrument function exit with __builtin_unreachable in C++.
  2017-11-15 10:02                               ` Martin Liška
  2017-11-15 10:10                                 ` Eric Botcazou
@ 2017-11-15 10:45                                 ` Jakub Jelinek
  2017-11-15 12:46                                   ` Martin Liška
  1 sibling, 1 reply; 64+ messages in thread
From: Jakub Jelinek @ 2017-11-15 10:45 UTC (permalink / raw)
  To: Martin Liška
  Cc: Eric Botcazou, gcc-patches, Jason Merrill, Marek Polacek,
	Jonathan Wakely

On Wed, Nov 15, 2017 at 10:54:23AM +0100, Martin Liška wrote:
> gcc/c/ChangeLog:
> 
> 2017-11-15  Martin Liska  <mliska@suse.cz>
> 
> 	* c-decl.c (grokdeclarator):
> 	Compare warn_return_type for greater than zero.
> 	(start_function): Likewise.
> 	(finish_function): Likewise.
> 	* c-typeck.c (c_finish_return): Likewise.
> 
> gcc/cp/ChangeLog:
> 
> 2017-11-15  Martin Liska  <mliska@suse.cz>
> 
> 	* decl.c (finish_function):
> 	Compare warn_return_type for greater than zero.
> 	* semantics.c (finish_return_stmt): Likewise.

The c/cp changes aren't really needed, are they?  Because
in that case you guarantee in the post options handling it is
0 or 1.

The rest looks good (except for Ada that Eric doesn't want to change).

	Jakub

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH][RFC] Instrument function exit with __builtin_unreachable in C++.
  2017-11-15 10:45                                 ` Jakub Jelinek
@ 2017-11-15 12:46                                   ` Martin Liška
  0 siblings, 0 replies; 64+ messages in thread
From: Martin Liška @ 2017-11-15 12:46 UTC (permalink / raw)
  To: Jakub Jelinek
  Cc: Eric Botcazou, gcc-patches, Jason Merrill, Marek Polacek,
	Jonathan Wakely

[-- Attachment #1: Type: text/plain, Size: 895 bytes --]

On 11/15/2017 11:04 AM, Jakub Jelinek wrote:
> On Wed, Nov 15, 2017 at 10:54:23AM +0100, Martin Liška wrote:
>> gcc/c/ChangeLog:
>>
>> 2017-11-15  Martin Liska  <mliska@suse.cz>
>>
>> 	* c-decl.c (grokdeclarator):
>> 	Compare warn_return_type for greater than zero.
>> 	(start_function): Likewise.
>> 	(finish_function): Likewise.
>> 	* c-typeck.c (c_finish_return): Likewise.
>>
>> gcc/cp/ChangeLog:
>>
>> 2017-11-15  Martin Liska  <mliska@suse.cz>
>>
>> 	* decl.c (finish_function):
>> 	Compare warn_return_type for greater than zero.
>> 	* semantics.c (finish_return_stmt): Likewise.
> 
> The c/cp changes aren't really needed, are they?  Because
> in that case you guarantee in the post options handling it is
> 0 or 1.

Yep, you're right!

> 
> The rest looks good (except for Ada that Eric doesn't want to change).
> 
> 	Jakub
> 


Done that and I'm going to install the patch.

Martin

[-- Attachment #2: 0001-Disable-Wreturn-type-by-default-in-all-languages-oth.patch --]
[-- Type: text/x-patch, Size: 3276 bytes --]

From c0934d0be85d40762d4bafbf9991b167b711736e Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Wed, 15 Nov 2017 09:16:23 +0100
Subject: [PATCH] Disable -Wreturn-type by default in all languages other from
 C++.

gcc/ChangeLog:

2017-11-15  Martin Liska  <mliska@suse.cz>

	* tree-cfg.c (pass_warn_function_return::execute):
	Compare warn_return_type for greater than zero.

gcc/fortran/ChangeLog:

2017-11-15  Martin Liska  <mliska@suse.cz>

	* options.c (gfc_post_options):
	Do not set default value of warn_return_type.
	* trans-decl.c (gfc_trans_deferred_vars):
	Compare warn_return_type for greater than zero.
	(generate_local_decl): Likewise
	(gfc_generate_function_code): Likewise.
---
 gcc/fortran/options.c    | 3 ---
 gcc/fortran/trans-decl.c | 8 ++++----
 gcc/tree-cfg.c           | 2 +-
 3 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c
index c584a19e559..0ee6b7808d9 100644
--- a/gcc/fortran/options.c
+++ b/gcc/fortran/options.c
@@ -435,9 +435,6 @@ gfc_post_options (const char **pfilename)
     gfc_fatal_error ("Maximum subrecord length cannot exceed %d",
 		     MAX_SUBRECORD_LENGTH);
 
-  if (warn_return_type == -1)
-    warn_return_type = 0;
-
   gfc_cpp_post_options ();
 
   if (gfc_option.allow_std & GFC_STD_F2008)
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 8efaae79ebc..60e7d8f79ee 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -4198,7 +4198,7 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, gfc_wrapped_block * block)
 		  break;
 	    }
 	  /* TODO: move to the appropriate place in resolve.c.  */
-	  if (warn_return_type && el == NULL)
+	  if (warn_return_type > 0 && el == NULL)
 	    gfc_warning (OPT_Wreturn_type,
 			 "Return value of function %qs at %L not set",
 			 proc_sym->name, &proc_sym->declared_at);
@@ -5619,7 +5619,7 @@ generate_local_decl (gfc_symbol * sym)
   else if (sym->attr.flavor == FL_PROCEDURE)
     {
       /* TODO: move to the appropriate place in resolve.c.  */
-      if (warn_return_type
+      if (warn_return_type > 0
 	  && sym->attr.function
 	  && sym->result
 	  && sym != sym->result
@@ -6494,11 +6494,11 @@ gfc_generate_function_code (gfc_namespace * ns)
       if (result == NULL_TREE || artificial_result_decl)
 	{
 	  /* TODO: move to the appropriate place in resolve.c.  */
-	  if (warn_return_type && sym == sym->result)
+	  if (warn_return_type > 0 && sym == sym->result)
 	    gfc_warning (OPT_Wreturn_type,
 			 "Return value of function %qs at %L not set",
 			 sym->name, &sym->declared_at);
-	  if (warn_return_type)
+	  if (warn_return_type > 0)
 	    TREE_NO_WARNING(sym->backend_decl) = 1;
 	}
       if (result != NULL_TREE)
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 9a2fa1d98ca..f08a0547f0f 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -9071,7 +9071,7 @@ pass_warn_function_return::execute (function *fun)
 
   /* If we see "return;" in some basic block, then we do reach the end
      without returning a value.  */
-  else if (warn_return_type
+  else if (warn_return_type > 0
 	   && !TREE_NO_WARNING (fun->decl)
 	   && EDGE_COUNT (EXIT_BLOCK_PTR_FOR_FN (fun)->preds) > 0
 	   && !VOID_TYPE_P (TREE_TYPE (TREE_TYPE (fun->decl))))
-- 
2.14.3


^ permalink raw reply	[flat|nested] 64+ messages in thread

* [PATCH][RFC] Add quotes for constexpr keyword.
  2017-11-06 18:41                     ` Martin Sebor
@ 2017-11-15 12:49                       ` Martin Liška
  2017-11-15 16:38                         ` Martin Sebor
  0 siblings, 1 reply; 64+ messages in thread
From: Martin Liška @ 2017-11-15 12:49 UTC (permalink / raw)
  To: Martin Sebor, Jason Merrill, Marek Polacek
  Cc: Jakub Jelinek, gcc-patches List, Jonathan Wakely

[-- Attachment #1: Type: text/plain, Size: 668 bytes --]

On 11/06/2017 07:29 PM, Martin Sebor wrote:
> Sorry for being late with my comment.  I just spotted this minor
> formatting issue.  Even though GCC isn't (yet) consistent about
> it the keyword "constexpr" should be quoted in the error message
> below (and, eventually, in all diagnostic messages).  Since the
> patch has been committed by now this is just a reminder for us
> to try to keep this in mind in the future.

Hi.

I've prepared patch for that. If it's desired, I can fix test-suite follow-up.
Do we want to change it also for error messages like:
"call to non-constexpr function"
"constexpr call flows off the end of the function"

Thanks,
Martin

[-- Attachment #2: 0001-Add-quotes-for-constexpr-keyword.patch --]
[-- Type: text/x-patch, Size: 12556 bytes --]

From eb554d8778be239a2edb06d21f98bda7e5153765 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Wed, 15 Nov 2017 08:41:12 +0100
Subject: [PATCH] Add quotes for constexpr keyword.

gcc/cp/ChangeLog:

2017-11-15  Martin Liska  <mliska@suse.cz>

	* class.c (finalize_literal_type_property): Add quotes for
	constexpr keyword.
	(explain_non_literal_class): Likewise.
	* constexpr.c (ensure_literal_type_for_constexpr_object): Likewise.
	(is_valid_constexpr_fn): Likewise.
	(check_constexpr_ctor_body): Likewise.
	(register_constexpr_fundef): Likewise.
	(explain_invalid_constexpr_fn): Likewise.
	(cxx_eval_builtin_function_call): Likewise.
	(cxx_eval_call_expression): Likewise.
	(cxx_eval_loop_expr): Likewise.
	(potential_constant_expression_1): Likewise.
	* decl.c (check_previous_goto_1): Likewise.
	(check_goto): Likewise.
	(grokfndecl): Likewise.
	(grokdeclarator): Likewise.
	* error.c (maybe_print_constexpr_context): Likewise.
	* method.c (process_subob_fn): Likewise.
	(defaulted_late_check): Likewise.
	* parser.c (cp_parser_compound_statement): Likewise.
---
 gcc/cp/class.c     |  4 ++--
 gcc/cp/constexpr.c | 35 ++++++++++++++++++-----------------
 gcc/cp/decl.c      | 12 ++++++------
 gcc/cp/error.c     |  4 ++--
 gcc/cp/method.c    |  6 +++---
 gcc/cp/parser.c    |  2 +-
 6 files changed, 32 insertions(+), 31 deletions(-)

diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 586a32c436f..529f37f24ee 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -5368,7 +5368,7 @@ finalize_literal_type_property (tree t)
 	  DECL_DECLARED_CONSTEXPR_P (fn) = false;
 	  if (!DECL_GENERATED_P (fn)
 	      && pedwarn (DECL_SOURCE_LOCATION (fn), OPT_Wpedantic,
-			  "enclosing class of constexpr non-static member "
+			  "enclosing class of %<constexpr%> non-static member "
 			  "function %q+#D is not a literal type", fn))
 	    explain_non_literal_class (t);
 	}
@@ -5406,7 +5406,7 @@ explain_non_literal_class (tree t)
     {
       inform (UNKNOWN_LOCATION,
 	      "  %q+T is not an aggregate, does not have a trivial "
-	      "default constructor, and has no constexpr constructor that "
+	      "default constructor, and has no %<constexpr%> constructor that "
 	      "is not a copy or move constructor", t);
       if (type_has_non_user_provided_default_constructor (t))
 	/* Note that we can't simply call locate_ctor because when the
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index d6b6843e804..e0a4133d89b 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -94,8 +94,8 @@ ensure_literal_type_for_constexpr_object (tree decl)
 	{
 	  if (DECL_DECLARED_CONSTEXPR_P (decl))
 	    {
-	      error ("the type %qT of constexpr variable %qD is not literal",
-		     type, decl);
+	      error ("the type %qT of %<constexpr%> variable %qD "
+		     "is not literal", type, decl);
 	      explain_non_literal_class (type);
 	    }
 	  else
@@ -177,7 +177,7 @@ is_valid_constexpr_fn (tree fun, bool complain)
     {
       ret = false;
       if (complain)
-	error ("inherited constructor %qD is not constexpr",
+	error ("inherited constructor %qD is not %<constexpr%>",
 	       DECL_INHERITED_CTOR (fun));
     }
   else
@@ -189,7 +189,7 @@ is_valid_constexpr_fn (tree fun, bool complain)
 	    ret = false;
 	    if (complain)
 	      {
-		error ("invalid type for parameter %d of constexpr "
+		error ("invalid type for parameter %d of %<constexpr%> "
 		       "function %q+#D", DECL_PARM_INDEX (parm), fun);
 		explain_non_literal_class (TREE_TYPE (parm));
 	      }
@@ -201,7 +201,7 @@ is_valid_constexpr_fn (tree fun, bool complain)
       ret = false;
       if (complain)
 	inform (DECL_SOURCE_LOCATION (fun),
-		"lambdas are implicitly constexpr only in C++17 and later");
+		"lambdas are implicitly %<constexpr%> only in C++17 and later");
     }
   else if (!DECL_CONSTRUCTOR_P (fun))
     {
@@ -211,7 +211,7 @@ is_valid_constexpr_fn (tree fun, bool complain)
 	  ret = false;
 	  if (complain)
 	    {
-	      error ("invalid return type %qT of constexpr function %q+D",
+	      error ("invalid return type %qT of %<constexpr%> function %q+D",
 		     rettype, fun);
 	      explain_non_literal_class (rettype);
 	    }
@@ -225,7 +225,7 @@ is_valid_constexpr_fn (tree fun, bool complain)
 	  ret = false;
 	  if (complain
 	      && pedwarn (DECL_SOURCE_LOCATION (fun), OPT_Wpedantic,
-			  "enclosing class of constexpr non-static member "
+			  "enclosing class of %<constexpr%> non-static member "
 			  "function %q+#D is not a literal type", fun))
 	    explain_non_literal_class (DECL_CONTEXT (fun));
 	}
@@ -494,7 +494,7 @@ check_constexpr_ctor_body (tree last, tree list, bool complain)
   if (!ok)
     {
       if (complain)
-	error ("constexpr constructor does not have empty body");
+	error ("%<constexpr%> constructor does not have empty body");
       DECL_DECLARED_CONSTEXPR_P (current_function_decl) = false;
     }
   return ok;
@@ -845,7 +845,8 @@ register_constexpr_fundef (tree fun, tree body)
   if (massaged == NULL_TREE || massaged == error_mark_node)
     {
       if (!DECL_CONSTRUCTOR_P (fun))
-	error ("body of constexpr function %qD not a return-statement", fun);
+	error ("body of %<constexpr%> function %qD not a return-statement",
+	       fun);
       return NULL;
     }
 
@@ -905,7 +906,7 @@ explain_invalid_constexpr_fn (tree fun)
 	 input_location set to our caller's location.  */
       input_location = DECL_SOURCE_LOCATION (fun);
       inform (input_location,
-	      "%qD is not usable as a constexpr function because:", fun);
+	      "%qD is not usable as a %<constexpr%> function because:", fun);
     }
   /* First check the declaration.  */
   if (is_valid_constexpr_fn (fun, true))
@@ -1194,7 +1195,7 @@ cxx_eval_builtin_function_call (const constexpr_ctx *ctx, tree t, tree fun,
 	     comes from cp_maybe_instrument_return.  */
 	  if (DECL_FUNCTION_CODE (fun) == BUILT_IN_UNREACHABLE
 	      && EXPR_LOCATION (t) == BUILTINS_LOCATION)
-	    error ("constexpr call flows off the end of the function");
+	    error ("%<constexpr%> call flows off the end of the function");
 	  else
 	    {
 	      new_call = build_call_array_loc (EXPR_LOCATION (t), TREE_TYPE (t),
@@ -1465,7 +1466,7 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t,
   if (TREE_CODE (fun) != FUNCTION_DECL)
     {
       if (!ctx->quiet && !*non_constant_p)
-	error_at (loc, "expression %qE does not designate a constexpr "
+	error_at (loc, "expression %qE does not designate a %<constexpr%> "
 		  "function", fun);
       *non_constant_p = true;
       return t;
@@ -1484,7 +1485,7 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t,
       if (!ctx->quiet)
 	{
 	  if (!lambda_static_thunk_p (fun))
-	    error_at (loc, "call to non-constexpr function %qD", fun);
+	    error_at (loc, "call to non-%<constexpr%> function %qD", fun);
 	  explain_invalid_constexpr_fn (fun);
 	}
       *non_constant_p = true;
@@ -1618,7 +1619,7 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t,
   if (!depth_ok)
     {
       if (!ctx->quiet)
-	error ("constexpr evaluation depth exceeds maximum of %d (use "
+	error ("%<constexpr%> evaluation depth exceeds maximum of %d (use "
 	       "-fconstexpr-depth= to increase the maximum)",
 	       max_constexpr_depth);
       *non_constant_p = true;
@@ -1701,7 +1702,7 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t,
 	      if (result == NULL_TREE && !*non_constant_p)
 		{
 		  if (!ctx->quiet)
-		    error ("constexpr call flows off the end "
+		    error ("%<constexpr%> call flows off the end "
 			   "of the function");
 		  *non_constant_p = true;
 		}
@@ -3847,7 +3848,7 @@ cxx_eval_loop_expr (const constexpr_ctx *ctx, tree t,
 	{
 	  if (!ctx->quiet)
 	    error_at (EXPR_LOC_OR_LOC (t, input_location),
-		      "constexpr loop iteration count exceeds limit of %d "
+		      "%<constexpr%> loop iteration count exceeds limit of %d "
 		      "(use -fconstexpr-loop-limit= to increase the limit)",
 		      constexpr_loop_limit);
 	  *non_constant_p = true;
@@ -5214,7 +5215,7 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now,
 		  {
 		    if (flags & tf_error)
 		      {
-			error_at (loc, "call to non-constexpr function %qD",
+			error_at (loc, "call to non-%<constexpr%> function %qD",
 				  fun);
 			explain_invalid_constexpr_fn (fun);
 		      }
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 041893db937..77103ae5b03 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -3180,7 +3180,7 @@ check_previous_goto_1 (tree decl, cp_binding_level* level, tree names,
 	case sk_block:
 	  if (!saw_cxif && level_for_constexpr_if (b->level_chain))
 	    {
-	      inf = N_("enters constexpr if statement");
+	      inf = N_("enters %<constexpr%> if statement");
 	      loc = EXPR_LOCATION (b->level_chain->this_entity);
 	      saw_cxif = true;
 	    }
@@ -3315,7 +3315,7 @@ check_goto (tree decl)
       else if (ent->in_transaction_scope)
 	inform (input_location, "  enters synchronized or atomic statement");
       else if (ent->in_constexpr_if)
-	inform (input_location, "  enters constexpr if statement");
+	inform (input_location, "  enters %<constexpr%> if statement");
     }
 
   if (ent->in_omp_scope)
@@ -8606,7 +8606,7 @@ grokfndecl (tree ctype,
       if (inlinep & 1)
 	error ("cannot declare %<::main%> to be inline");
       if (inlinep & 2)
-	error ("cannot declare %<::main%> to be constexpr");
+	error ("cannot declare %<::main%> to be %<constexpr%>");
       if (!publicp)
 	error ("cannot declare %<::main%> to be static");
       inlinep = 0;
@@ -12050,7 +12050,7 @@ grokdeclarator (const cp_declarator *declarator,
 			   unqualified_id);
 		else if (constexpr_p && !initialized)
 		  {
-		    error ("constexpr static data member %qD must have an "
+		    error ("%<constexpr%> static data member %qD must have an "
 			   "initializer", decl);
 		    constexpr_p = false;
 		  }
@@ -12278,8 +12278,8 @@ grokdeclarator (const cp_declarator *declarator,
 	  }
 	else if (constexpr_p && DECL_EXTERNAL (decl))
 	  {
-	    error ("declaration of constexpr variable %qD is not a definition",
-		   decl);
+	    error ("declaration of %<constexpr%> variable %qD "
+		   "is not a definition", decl);
 	    constexpr_p = false;
 	  }
 
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index 2537713b5c9..5c78f76db07 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -3584,11 +3584,11 @@ maybe_print_constexpr_context (diagnostic_context *context)
       const char *s = expr_as_string (t, 0);
       if (context->show_column)
 	pp_verbatim (context->printer,
-		     _("%r%s:%d:%d:%R   in constexpr expansion of %qs"),
+		     _("%r%s:%d:%d:%R   in %<constexpr%> expansion of %qs"),
 		     "locus", xloc.file, xloc.line, xloc.column, s);
       else
 	pp_verbatim (context->printer,
-		     _("%r%s:%d:%R   in constexpr expansion of %qs"),
+		     _("%r%s:%d:%R   in %<constexpr%> expansion of %qs"),
 		     "locus", xloc.file, xloc.line, s);
       pp_newline (context->printer);
     }
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index 714b5087991..534aaa32fd5 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -1293,7 +1293,7 @@ process_subob_fn (tree fn, tree *spec_p, bool *trivial_p,
       if (diag)
 	{
 	  inform (DECL_SOURCE_LOCATION (fn),
-		  "defaulted constructor calls non-constexpr %qD", fn);
+		  "defaulted constructor calls non-%<constexpr%> %qD", fn);
 	  explain_invalid_constexpr_fn (fn);
 	}
     }
@@ -2257,8 +2257,8 @@ defaulted_late_check (tree fn)
       if (!CLASSTYPE_TEMPLATE_INSTANTIATION (ctx))
 	{
 	  error ("explicitly defaulted function %q+D cannot be declared "
-		 "as constexpr because the implicit declaration is not "
-		 "constexpr:", fn);
+		 "as %<constexpr%> because the implicit declaration is not "
+		 "%<constexpr%>:", fn);
 	  explain_implicit_non_constexpr (fn);
 	}
       DECL_DECLARED_CONSTEXPR_P (fn) = false;
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 1860bf0f175..6c132da49ee 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -11292,7 +11292,7 @@ cp_parser_compound_statement (cp_parser *parser, tree in_statement_expr,
   if (DECL_DECLARED_CONSTEXPR_P (current_function_decl)
       && !function_body && cxx_dialect < cxx14)
     pedwarn (input_location, OPT_Wpedantic,
-	     "compound-statement in constexpr function");
+	     "compound-statement in %<constexpr%> function");
   /* Begin the compound-statement.  */
   compound_stmt = begin_compound_stmt (bcs_flags);
   /* If the next keyword is `__label__' we have a label declaration.  */
-- 
2.14.3


^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH] Fix test-suite fallout of default -Wreturn-type.
  2017-11-06 14:12                                     ` Martin Liška
  2017-11-06 21:17                                       ` [PATCH] Further -Wreturn-type testsuite fallout Jakub Jelinek
@ 2017-11-15 13:33                                       ` Jonathan Wakely
  1 sibling, 0 replies; 64+ messages in thread
From: Jonathan Wakely @ 2017-11-15 13:33 UTC (permalink / raw)
  To: Martin Liška
  Cc: Paolo Carlini, Jason Merrill, Jakub Jelinek, gcc-patches List

On 06/11/17 15:12 +0100, Martin Liška wrote:
>On 11/06/2017 02:58 PM, Paolo Carlini wrote:
>> Hi,
>>
>> On 06/11/2017 14:37, Martin Liška wrote:
>>> Thank you for the patch.
>>> I'm going to install the remaining part that will fix x86_64 fallout. All changes are
>>> quite obvious, so hope it's fine to install it.
>> I think so. Thanks.
>>
>> Note that the 3 additional libstdc++-v3 changes aren't really necessary, but those testcases are failing, seg faulting, at run time for unrelated reasons. I don't know if Jonathan is already on that...
>>
>> Paolo.

Right, adding "return 0;" to main() is just noise, it does nothing.

>You're right, it started right when it was introduced in r254008.
>
>I see:
>
>g++ libstdc++-v3/testsuite/27_io/basic_ifstream/cons/char/path.cc -std=gnu++17 -I. -lstdc++fs && ./a.out
>libstdc++-v3/testsuite/27_io/basic_ifstream/cons/char/path.cc:33: void test01(): Assertion 'f.is_open()' failed.
>Aborted (core dumped)

I think that was PR libstdc++/82917 so should be fixed.

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH][RFC] Add quotes for constexpr keyword.
  2017-11-15 12:49                       ` [PATCH][RFC] Add quotes for constexpr keyword Martin Liška
@ 2017-11-15 16:38                         ` Martin Sebor
  2017-11-15 16:59                           ` Jonathan Wakely
  0 siblings, 1 reply; 64+ messages in thread
From: Martin Sebor @ 2017-11-15 16:38 UTC (permalink / raw)
  To: Martin Liška, Jason Merrill, Marek Polacek
  Cc: Jakub Jelinek, gcc-patches List, Jonathan Wakely

On 11/15/2017 05:45 AM, Martin Liška wrote:
> On 11/06/2017 07:29 PM, Martin Sebor wrote:
>> Sorry for being late with my comment.  I just spotted this minor
>> formatting issue.  Even though GCC isn't (yet) consistent about
>> it the keyword "constexpr" should be quoted in the error message
>> below (and, eventually, in all diagnostic messages).  Since the
>> patch has been committed by now this is just a reminder for us
>> to try to keep this in mind in the future.
>
> Hi.
>
> I've prepared patch for that. If it's desired, I can fix test-suite follow-up.
> Do we want to change it also for error messages like:
> "call to non-constexpr function"
> "constexpr call flows off the end of the function"

If GCC had support for italics for defined terms of the language
or the grammar /constexpr function/ would be italicized because
it's a defined term.  Absent that, I think I would quote them all
for consistency.

Martin

PS I checked the C++ standard to see how it used the term and
the choices it makes seem pretty arbitrary.  There are even
sentences with two instances of two word, one in fixed width
font and the other in proportional.  So I don't think we can
use the spec as an example to follow.


^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH][RFC] Add quotes for constexpr keyword.
  2017-11-15 16:38                         ` Martin Sebor
@ 2017-11-15 16:59                           ` Jonathan Wakely
  2017-11-15 17:06                             ` Martin Sebor
  0 siblings, 1 reply; 64+ messages in thread
From: Jonathan Wakely @ 2017-11-15 16:59 UTC (permalink / raw)
  To: Martin Sebor
  Cc: Martin Liška, Jason Merrill, Marek Polacek, Jakub Jelinek,
	gcc-patches List

On 15/11/17 09:30 -0700, Martin Sebor wrote:
>On 11/15/2017 05:45 AM, Martin Liška wrote:
>>On 11/06/2017 07:29 PM, Martin Sebor wrote:
>>>Sorry for being late with my comment.  I just spotted this minor
>>>formatting issue.  Even though GCC isn't (yet) consistent about
>>>it the keyword "constexpr" should be quoted in the error message
>>>below (and, eventually, in all diagnostic messages).  Since the
>>>patch has been committed by now this is just a reminder for us
>>>to try to keep this in mind in the future.
>>
>>Hi.
>>
>>I've prepared patch for that. If it's desired, I can fix test-suite follow-up.
>>Do we want to change it also for error messages like:
>>"call to non-constexpr function"
>>"constexpr call flows off the end of the function"
>
>If GCC had support for italics for defined terms of the language
>or the grammar /constexpr function/ would be italicized because
>it's a defined term.  Absent that, I think I would quote them all
>for consistency.
>
>Martin
>
>PS I checked the C++ standard to see how it used the term and
>the choices it makes seem pretty arbitrary.  There are even
>sentences with two instances of two word, one in fixed width
>font and the other in proportional.  So I don't think we can
>use the spec as an example to follow.

Did you check the latest draft? That should have been fixed.

Defined terms should only be italicized when introduced, not when
used, e.g. in [dcl.constexpr] p2 "constexpr function" and "constexpr
constructor" are italicized, but are in normal font elsewhere. When
referring specifically to the keyword `constexpr` it should be in code
font.

Grammar productions are always italicized, but "constexpr function" is
not a grammar production.

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH][RFC] Add quotes for constexpr keyword.
  2017-11-15 16:59                           ` Jonathan Wakely
@ 2017-11-15 17:06                             ` Martin Sebor
  2017-11-15 17:14                               ` Jonathan Wakely
  0 siblings, 1 reply; 64+ messages in thread
From: Martin Sebor @ 2017-11-15 17:06 UTC (permalink / raw)
  To: Jonathan Wakely
  Cc: Martin Liška, Jason Merrill, Marek Polacek, Jakub Jelinek,
	gcc-patches List

On 11/15/2017 09:38 AM, Jonathan Wakely wrote:
> On 15/11/17 09:30 -0700, Martin Sebor wrote:
>> On 11/15/2017 05:45 AM, Martin Liška wrote:
>>> On 11/06/2017 07:29 PM, Martin Sebor wrote:
>>>> Sorry for being late with my comment.  I just spotted this minor
>>>> formatting issue.  Even though GCC isn't (yet) consistent about
>>>> it the keyword "constexpr" should be quoted in the error message
>>>> below (and, eventually, in all diagnostic messages).  Since the
>>>> patch has been committed by now this is just a reminder for us
>>>> to try to keep this in mind in the future.
>>>
>>> Hi.
>>>
>>> I've prepared patch for that. If it's desired, I can fix test-suite
>>> follow-up.
>>> Do we want to change it also for error messages like:
>>> "call to non-constexpr function"
>>> "constexpr call flows off the end of the function"
>>
>> If GCC had support for italics for defined terms of the language
>> or the grammar /constexpr function/ would be italicized because
>> it's a defined term.  Absent that, I think I would quote them all
>> for consistency.
>>
>> Martin
>>
>> PS I checked the C++ standard to see how it used the term and
>> the choices it makes seem pretty arbitrary.  There are even
>> sentences with two instances of two word, one in fixed width
>> font and the other in proportional.  So I don't think we can
>> use the spec as an example to follow.
>
> Did you check the latest draft? That should have been fixed.
>
> Defined terms should only be italicized when introduced, not when
> used, e.g. in [dcl.constexpr] p2 "constexpr function" and "constexpr
> constructor" are italicized, but are in normal font elsewhere. When
> referring specifically to the keyword `constexpr` it should be in code
> font.
>
> Grammar productions are always italicized, but "constexpr function" is
> not a grammar production.

Right, /constexpr function/ is a defined term (as is /constexpr
cosntructor/ and /constexpr if/).  As you say, its defining
occurrence is italicized in the text, and the rest aren't.
In contrast, in terms like "constexpr specifier," "constexpr"
is the keyword and it's always in monospace.

The challenge in GCC as I see it is to know how to decide which
of the two it is.  The difference between constexpr the keyword
and constexpr as part of a defined term is too subtle for most
people who don't work with the standard for a living.  So we end
up with these minor inconsistencies in the diagnostics.  I think
the easiest way to achieve consistency (in diagnostics) it is to
always quote keywords.  Having italics would be a nice touch but
it would probably not improve consistency.

Martin

PS I was looking at the February 2017 draft.  The October version
looks quite a bit better.

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH][RFC] Add quotes for constexpr keyword.
  2017-11-15 17:06                             ` Martin Sebor
@ 2017-11-15 17:14                               ` Jonathan Wakely
  2017-11-21 15:27                                 ` Martin Liška
  0 siblings, 1 reply; 64+ messages in thread
From: Jonathan Wakely @ 2017-11-15 17:14 UTC (permalink / raw)
  To: Martin Sebor
  Cc: Martin Liška, Jason Merrill, Marek Polacek, Jakub Jelinek,
	gcc-patches List

On 15/11/17 10:04 -0700, Martin Sebor wrote:
>On 11/15/2017 09:38 AM, Jonathan Wakely wrote:
>>On 15/11/17 09:30 -0700, Martin Sebor wrote:
>>>On 11/15/2017 05:45 AM, Martin Liška wrote:
>>>>On 11/06/2017 07:29 PM, Martin Sebor wrote:
>>>>>Sorry for being late with my comment.  I just spotted this minor
>>>>>formatting issue.  Even though GCC isn't (yet) consistent about
>>>>>it the keyword "constexpr" should be quoted in the error message
>>>>>below (and, eventually, in all diagnostic messages).  Since the
>>>>>patch has been committed by now this is just a reminder for us
>>>>>to try to keep this in mind in the future.
>>>>
>>>>Hi.
>>>>
>>>>I've prepared patch for that. If it's desired, I can fix test-suite
>>>>follow-up.
>>>>Do we want to change it also for error messages like:
>>>>"call to non-constexpr function"
>>>>"constexpr call flows off the end of the function"
>>>
>>>If GCC had support for italics for defined terms of the language
>>>or the grammar /constexpr function/ would be italicized because
>>>it's a defined term.  Absent that, I think I would quote them all
>>>for consistency.
>>>
>>>Martin
>>>
>>>PS I checked the C++ standard to see how it used the term and
>>>the choices it makes seem pretty arbitrary.  There are even
>>>sentences with two instances of two word, one in fixed width
>>>font and the other in proportional.  So I don't think we can
>>>use the spec as an example to follow.
>>
>>Did you check the latest draft? That should have been fixed.
>>
>>Defined terms should only be italicized when introduced, not when
>>used, e.g. in [dcl.constexpr] p2 "constexpr function" and "constexpr
>>constructor" are italicized, but are in normal font elsewhere. When
>>referring specifically to the keyword `constexpr` it should be in code
>>font.
>>
>>Grammar productions are always italicized, but "constexpr function" is
>>not a grammar production.
>
>Right, /constexpr function/ is a defined term (as is /constexpr
>cosntructor/ and /constexpr if/).  As you say, its defining
>occurrence is italicized in the text, and the rest aren't.
>In contrast, in terms like "constexpr specifier," "constexpr"
>is the keyword and it's always in monospace.
>
>The challenge in GCC as I see it is to know how to decide which
>of the two it is.  The difference between constexpr the keyword
>and constexpr as part of a defined term is too subtle for most
>people who don't work with the standard for a living.  So we end
>up with these minor inconsistencies in the diagnostics.  I think
>the easiest way to achieve consistency (in diagnostics) it is to
>always quote keywords.

Agreed. GCC also doesn't need to distinguish between the definition
and use of a standard term, it is always using the term, so can always
format it the same way.

>Having italics would be a nice touch but
>it would probably not improve consistency.

>PS I was looking at the February 2017 draft.  The October version
>looks quite a bit better.

These were the relevant fixes:
https://github.com/cplusplus/draft/issues/559
https://github.com/cplusplus/draft/issues/825
https://github.com/cplusplus/draft/pull/1153
https://github.com/cplusplus/draft/pull/1484

We've been trying to be more consistent about these kind of formatting
issues in the standard, as it was a bit of a mess.

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH] Fix test-suite fallout of default -Wreturn-type.
  2017-10-18 12:53           ` [PATCH] Fix test-suite fallout of default -Wreturn-type Martin Liška
  2017-10-24 14:40             ` Jason Merrill
  2017-11-07 17:33             ` Andreas Schwab
@ 2017-11-19 13:26             ` Thomas Schwinge
  2017-11-20 13:58               ` Martin Liška
  2017-11-20 14:14               ` Jason Merrill
  2 siblings, 2 replies; 64+ messages in thread
From: Thomas Schwinge @ 2017-11-19 13:26 UTC (permalink / raw)
  To: Martin Liška, gcc-patches
  Cc: Jason Merrill, Jonathan Wakely, Jakub Jelinek

Hi!

On Wed, 18 Oct 2017 14:48:13 +0200, Martin Liška <mliska@suse.cz> wrote:
> This is second patch that addresses test-suite fallout. All these tests fail because -Wreturn-type is
> now on by default.
> 
> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.

... but alters some LTO test cases as follows:

> --- a/gcc/testsuite/g++.dg/lto/20080907_0.C
> +++ b/gcc/testsuite/g++.dg/lto/20080907_0.C
> @@ -1,3 +1,5 @@
>  // { dg-lto-do assemble }
> +// { dg-lto-options "-Wno-return-type" }

This means that instead of the default (without explicit
"dg-lto-options") "LTO options torture testing" testing, we're now *only*
testing one variant, with only the "-Wno-return-type" option specified.

> --- a/gcc/testsuite/g++.dg/lto/20080915_0.C
> +++ b/gcc/testsuite/g++.dg/lto/20080915_0.C
> @@ -1,4 +1,6 @@
>  // { dg-lto-do assemble }
> +// { dg-lto-options "-Wno-return-type" }

Same, but...

> @@ -16,7 +18,7 @@ int func(const Bar& b) {
>  }
>  
>  struct Baz {
> - Bar& operator*() {}
> + Bar& operator*() { static Bar a; return a; }
>  };

... given that you're addressing here the (only, as it seems)
"-Wreturn-type" issue, you don't need to specify "-Wno-return-type" at
all.

> --- a/gcc/testsuite/g++.dg/lto/20091002-1_0.C
> +++ b/gcc/testsuite/g++.dg/lto/20091002-1_0.C
> @@ -1,6 +1,6 @@
>  // { dg-lto-do link }
>  // { dg-require-effective-target fpic }
> -// { dg-lto-options {{-fPIC -flto}} }
> +// { dg-lto-options {{-fPIC -flto -Wno-return-type}} }
>  // { dg-extra-ld-options "-fPIC -r -nostdlib" }

ACK.  This only tested one variant: "-fPIC -flto", now testing "-fPIC
-flto -Wno-return-type".  (Similarly for several more.)

> --- a/gcc/testsuite/g++.dg/lto/20101010-1_0.C
> +++ b/gcc/testsuite/g++.dg/lto/20101010-1_0.C
> @@ -1,4 +1,5 @@
>  // { dg-lto-do link }
> +// { dg-lto-options "-Wno-return-type" }

NACK, see above.

> --- a/gcc/testsuite/g++.dg/lto/20101010-2_0.C
> +++ b/gcc/testsuite/g++.dg/lto/20101010-2_0.C
> @@ -1,4 +1,5 @@
>  // { dg-lto-do link }
> +// { dg-lto-options "-Wno-return-type" }

NACK, see above.

> --- a/gcc/testsuite/g++.dg/lto/pr65475c_0.C
> +++ b/gcc/testsuite/g++.dg/lto/pr65475c_0.C
> @@ -1,6 +1,7 @@
>  /* { dg-lto-do link } */
> -/* { dg-lto-options "-O2  -w" } */
>  /* { dg-extra-ld-options { -O2 -Wno-odr -r -nostdlib } } */
> +/* { dg-lto-options { "-O2 -w -Wno-return-type" } } */

I don't know about that one.  This previously tested two variants
separately: "-O2" and "-w", and you've now changed it to test one
combined variant: "-O2 -w -Wno-return-type".  Your change is correct if
this previously meant to test the combined variant "-O2 -w" instead of
each of them separately -- which I don't know/have not verified.

> --- a/gcc/testsuite/g++.dg/lto/pr69589_0.C
> +++ b/gcc/testsuite/g++.dg/lto/pr69589_0.C
> @@ -1,5 +1,5 @@
>  // { dg-lto-do link }
> -// { dg-lto-options "-O2 -rdynamic" }
> +// { dg-lto-options { "-O2 -rdynamic -Wno-return-type" } }
>  // { dg-extra-ld-options "-r -nostdlib" }

Same: "-O2" and "-rdynamic" separately vs. now "-O2 -rdynamic
-Wno-return-type" combined.

Unfortunately, we can't use "dg-options" or "dg-additional-options" here:

    WARNING: lto.exp does not support dg-additional-options
    WARNING: lto.exp does not support dg-options in primary source file

OK to fix the first four issues as follows?  If approving this, please
respond with "Reviewed-by: NAME <EMAIL>" so that your effort will be
recorded.  See <https://gcc.gnu.org/wiki/Reviewed-by>.

diff --git gcc/testsuite/g++.dg/lto/20080907_0.C gcc/testsuite/g++.dg/lto/20080907_0.C
index a423196..153d0ab 100644
--- gcc/testsuite/g++.dg/lto/20080907_0.C
+++ gcc/testsuite/g++.dg/lto/20080907_0.C
@@ -1,5 +1,7 @@
 // { dg-lto-do assemble }
-// { dg-lto-options "-Wno-return-type" }
+
+/* "WARNING: lto.exp does not support dg-additional-options" */
+#pragma GCC diagnostic ignored "-Wreturn-type"
 
 struct Foo { void func (); }; Foo & bar () { } struct Baz { Baz (Baz &); };
 Baz dummy() { bar().func(); }
diff --git gcc/testsuite/g++.dg/lto/20080915_0.C gcc/testsuite/g++.dg/lto/20080915_0.C
index 40c5042..c91e756 100644
--- gcc/testsuite/g++.dg/lto/20080915_0.C
+++ gcc/testsuite/g++.dg/lto/20080915_0.C
@@ -1,5 +1,4 @@
 // { dg-lto-do assemble }
-// { dg-lto-options "-Wno-return-type" }
 
 struct Foo {
  static const int dummy;
diff --git gcc/testsuite/g++.dg/lto/20101010-1_0.C gcc/testsuite/g++.dg/lto/20101010-1_0.C
index 8f694c7..bb3e6d4 100644
--- gcc/testsuite/g++.dg/lto/20101010-1_0.C
+++ gcc/testsuite/g++.dg/lto/20101010-1_0.C
@@ -1,5 +1,7 @@
 // { dg-lto-do link }
-// { dg-lto-options "-Wno-return-type" }
+
+/* "WARNING: lto.exp does not support dg-additional-options" */
+#pragma GCC diagnostic ignored "-Wreturn-type"
 
 typedef long size_t;
 template < class, class > struct pair
diff --git gcc/testsuite/g++.dg/lto/20101010-2_0.C gcc/testsuite/g++.dg/lto/20101010-2_0.C
index a26956f..721ac01 100644
--- gcc/testsuite/g++.dg/lto/20101010-2_0.C
+++ gcc/testsuite/g++.dg/lto/20101010-2_0.C
@@ -1,5 +1,7 @@
 // { dg-lto-do link }
-// { dg-lto-options "-Wno-return-type" }
+
+/* "WARNING: lto.exp does not support dg-additional-options" */
+#pragma GCC diagnostic ignored "-Wreturn-type"
 
 typedef int size_t;
 template < size_t _Nw > struct _Base_bitset


Grüße
 Thomas

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH][RFC] Instrument function exit with __builtin_unreachable in C++.
  2017-11-03 13:42                   ` Martin Liška
                                       ` (2 preceding siblings ...)
  2017-11-07 17:28                     ` [PATCH][RFC] Instrument function exit with __builtin_unreachable in C++ Andreas Schwab
@ 2017-11-19 17:06                     ` Thomas Schwinge
  3 siblings, 0 replies; 64+ messages in thread
From: Thomas Schwinge @ 2017-11-19 17:06 UTC (permalink / raw)
  To: Martin Liška, gcc-patches
  Cc: Jakub Jelinek, Jonathan Wakely, Jason Merrill, Marek Polacek

Hi!

After r254437 "Instrument function exit with __builtin_unreachable in
C++" (assuming that I bisected that correctly), I'm seeing a number of
C++ "ifunc" test cases regress from PASS to UNSUPPORTED.  This is because
of:

    ifunc_available29518.c: In function 'void (* g())()':
    ifunc_available29518.c:6:15: warning: no return statement in function returning non-void [-Wreturn-type]

This is not a problem in C testing, where that diagnostic explicitly
needs to be enabled whereas in C++ mode it's enabled by default.

OK to fix that as follows?  If approving this, please respond with
"Reviewed-by: NAME <EMAIL>" so that your effort will be recorded.  See
<https://gcc.gnu.org/wiki/Reviewed-by>.

diff --git gcc/testsuite/lib/target-supports.exp gcc/testsuite/lib/target-supports.exp
index d7ef04f..63cc75b 100644
--- gcc/testsuite/lib/target-supports.exp
+++ gcc/testsuite/lib/target-supports.exp
@@ -439,8 +439,9 @@ proc check_ifunc_available { } {
 	#ifdef __cplusplus
 	extern "C" {
 	#endif
+	extern void f_ ();
 	typedef void F (void);
-	F* g (void) {}
+	F* g (void) { return &f_; }
 	void f () __attribute__ ((ifunc ("g")));
 	#ifdef __cplusplus
 	}


Grüße
 Thomas

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH] Fix test-suite fallout of default -Wreturn-type.
  2017-11-19 13:26             ` Thomas Schwinge
@ 2017-11-20 13:58               ` Martin Liška
  2017-11-20 14:14               ` Jason Merrill
  1 sibling, 0 replies; 64+ messages in thread
From: Martin Liška @ 2017-11-20 13:58 UTC (permalink / raw)
  To: Thomas Schwinge, gcc-patches
  Cc: Jason Merrill, Jonathan Wakely, Jakub Jelinek

On 11/19/2017 01:56 PM, Thomas Schwinge wrote:
> Hi!
> 
> On Wed, 18 Oct 2017 14:48:13 +0200, Martin Liška <mliska@suse.cz> wrote:
>> This is second patch that addresses test-suite fallout. All these tests fail because -Wreturn-type is
>> now on by default.
>>
>> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
> 
> ... but alters some LTO test cases as follows:
> 
>> --- a/gcc/testsuite/g++.dg/lto/20080907_0.C
>> +++ b/gcc/testsuite/g++.dg/lto/20080907_0.C
>> @@ -1,3 +1,5 @@
>>  // { dg-lto-do assemble }
>> +// { dg-lto-options "-Wno-return-type" }
> 
> This means that instead of the default (without explicit
> "dg-lto-options") "LTO options torture testing" testing, we're now *only*
> testing one variant, with only the "-Wno-return-type" option specified.
> 
>> --- a/gcc/testsuite/g++.dg/lto/20080915_0.C
>> +++ b/gcc/testsuite/g++.dg/lto/20080915_0.C
>> @@ -1,4 +1,6 @@
>>  // { dg-lto-do assemble }
>> +// { dg-lto-options "-Wno-return-type" }
> 
> Same, but...
> 
>> @@ -16,7 +18,7 @@ int func(const Bar& b) {
>>  }
>>  
>>  struct Baz {
>> - Bar& operator*() {}
>> + Bar& operator*() { static Bar a; return a; }
>>  };
> 
> ... given that you're addressing here the (only, as it seems)
> "-Wreturn-type" issue, you don't need to specify "-Wno-return-type" at
> all.
> 
>> --- a/gcc/testsuite/g++.dg/lto/20091002-1_0.C
>> +++ b/gcc/testsuite/g++.dg/lto/20091002-1_0.C
>> @@ -1,6 +1,6 @@
>>  // { dg-lto-do link }
>>  // { dg-require-effective-target fpic }
>> -// { dg-lto-options {{-fPIC -flto}} }
>> +// { dg-lto-options {{-fPIC -flto -Wno-return-type}} }
>>  // { dg-extra-ld-options "-fPIC -r -nostdlib" }
> 
> ACK.  This only tested one variant: "-fPIC -flto", now testing "-fPIC
> -flto -Wno-return-type".  (Similarly for several more.)
> 
>> --- a/gcc/testsuite/g++.dg/lto/20101010-1_0.C
>> +++ b/gcc/testsuite/g++.dg/lto/20101010-1_0.C
>> @@ -1,4 +1,5 @@
>>  // { dg-lto-do link }
>> +// { dg-lto-options "-Wno-return-type" }
> 
> NACK, see above.
> 
>> --- a/gcc/testsuite/g++.dg/lto/20101010-2_0.C
>> +++ b/gcc/testsuite/g++.dg/lto/20101010-2_0.C
>> @@ -1,4 +1,5 @@
>>  // { dg-lto-do link }
>> +// { dg-lto-options "-Wno-return-type" }
> 
> NACK, see above.
> 
>> --- a/gcc/testsuite/g++.dg/lto/pr65475c_0.C
>> +++ b/gcc/testsuite/g++.dg/lto/pr65475c_0.C
>> @@ -1,6 +1,7 @@
>>  /* { dg-lto-do link } */
>> -/* { dg-lto-options "-O2  -w" } */
>>  /* { dg-extra-ld-options { -O2 -Wno-odr -r -nostdlib } } */
>> +/* { dg-lto-options { "-O2 -w -Wno-return-type" } } */
> 
> I don't know about that one.  This previously tested two variants
> separately: "-O2" and "-w", and you've now changed it to test one
> combined variant: "-O2 -w -Wno-return-type".  Your change is correct if
> this previously meant to test the combined variant "-O2 -w" instead of
> each of them separately -- which I don't know/have not verified.

Hello.

I don't think so, I've just tested that and all invocations of the source file
have '-O2  -w' in corresponding command line. Can you please verify that it builds
all possible combinations of provided arguments of dg-lto-options?

> 
>> --- a/gcc/testsuite/g++.dg/lto/pr69589_0.C
>> +++ b/gcc/testsuite/g++.dg/lto/pr69589_0.C
>> @@ -1,5 +1,5 @@
>>  // { dg-lto-do link }
>> -// { dg-lto-options "-O2 -rdynamic" }
>> +// { dg-lto-options { "-O2 -rdynamic -Wno-return-type" } }
>>  // { dg-extra-ld-options "-r -nostdlib" }
> 
> Same: "-O2" and "-rdynamic" separately vs. now "-O2 -rdynamic
> -Wno-return-type" combined.
> 
> Unfortunately, we can't use "dg-options" or "dg-additional-options" here:
> 
>     WARNING: lto.exp does not support dg-additional-options
>     WARNING: lto.exp does not support dg-options in primary source file

I know, I've tried that :)

Martin

> 
> OK to fix the first four issues as follows?  If approving this, please
> respond with "Reviewed-by: NAME <EMAIL>" so that your effort will be
> recorded.  See <https://gcc.gnu.org/wiki/Reviewed-by>.
> 
> diff --git gcc/testsuite/g++.dg/lto/20080907_0.C gcc/testsuite/g++.dg/lto/20080907_0.C
> index a423196..153d0ab 100644
> --- gcc/testsuite/g++.dg/lto/20080907_0.C
> +++ gcc/testsuite/g++.dg/lto/20080907_0.C
> @@ -1,5 +1,7 @@
>  // { dg-lto-do assemble }
> -// { dg-lto-options "-Wno-return-type" }
> +
> +/* "WARNING: lto.exp does not support dg-additional-options" */
> +#pragma GCC diagnostic ignored "-Wreturn-type"
>  
>  struct Foo { void func (); }; Foo & bar () { } struct Baz { Baz (Baz &); };
>  Baz dummy() { bar().func(); }
> diff --git gcc/testsuite/g++.dg/lto/20080915_0.C gcc/testsuite/g++.dg/lto/20080915_0.C
> index 40c5042..c91e756 100644
> --- gcc/testsuite/g++.dg/lto/20080915_0.C
> +++ gcc/testsuite/g++.dg/lto/20080915_0.C
> @@ -1,5 +1,4 @@
>  // { dg-lto-do assemble }
> -// { dg-lto-options "-Wno-return-type" }
>  
>  struct Foo {
>   static const int dummy;
> diff --git gcc/testsuite/g++.dg/lto/20101010-1_0.C gcc/testsuite/g++.dg/lto/20101010-1_0.C
> index 8f694c7..bb3e6d4 100644
> --- gcc/testsuite/g++.dg/lto/20101010-1_0.C
> +++ gcc/testsuite/g++.dg/lto/20101010-1_0.C
> @@ -1,5 +1,7 @@
>  // { dg-lto-do link }
> -// { dg-lto-options "-Wno-return-type" }
> +
> +/* "WARNING: lto.exp does not support dg-additional-options" */
> +#pragma GCC diagnostic ignored "-Wreturn-type"
>  
>  typedef long size_t;
>  template < class, class > struct pair
> diff --git gcc/testsuite/g++.dg/lto/20101010-2_0.C gcc/testsuite/g++.dg/lto/20101010-2_0.C
> index a26956f..721ac01 100644
> --- gcc/testsuite/g++.dg/lto/20101010-2_0.C
> +++ gcc/testsuite/g++.dg/lto/20101010-2_0.C
> @@ -1,5 +1,7 @@
>  // { dg-lto-do link }
> -// { dg-lto-options "-Wno-return-type" }
> +
> +/* "WARNING: lto.exp does not support dg-additional-options" */
> +#pragma GCC diagnostic ignored "-Wreturn-type"
>  
>  typedef int size_t;
>  template < size_t _Nw > struct _Base_bitset
> 
> 
> Grüße
>  Thomas
> 

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH] Fix test-suite fallout of default -Wreturn-type.
  2017-11-19 13:26             ` Thomas Schwinge
  2017-11-20 13:58               ` Martin Liška
@ 2017-11-20 14:14               ` Jason Merrill
  2018-03-02 16:37                 ` Thomas Schwinge
  1 sibling, 1 reply; 64+ messages in thread
From: Jason Merrill @ 2017-11-20 14:14 UTC (permalink / raw)
  To: Thomas Schwinge
  Cc: Martin Liška, gcc-patches List, Jonathan Wakely, Jakub Jelinek

On Sun, Nov 19, 2017 at 7:56 AM, Thomas Schwinge
<thomas@codesourcery.com> wrote:
> OK to fix the first four issues as follows?  If approving this, please
> respond with "Reviewed-by: NAME <EMAIL>" so that your effort will be
> recorded.  See <https://gcc.gnu.org/wiki/Reviewed-by>.

OK.

Reviewed-by: Jason Merrill <jason@redhat.com>

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH][RFC] Add quotes for constexpr keyword.
  2017-11-15 17:14                               ` Jonathan Wakely
@ 2017-11-21 15:27                                 ` Martin Liška
  2017-11-21 15:48                                   ` Martin Sebor
  2017-11-21 17:23                                   ` Jeff Law
  0 siblings, 2 replies; 64+ messages in thread
From: Martin Liška @ 2017-11-21 15:27 UTC (permalink / raw)
  To: Jonathan Wakely, Martin Sebor
  Cc: Jason Merrill, Marek Polacek, Jakub Jelinek, gcc-patches List

[-- Attachment #1: Type: text/plain, Size: 174 bytes --]

Hi.

I'm sending v2 of the patch where I fixed test-suite fallout.

Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.

Ready to be installed?
Martin

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-quotes-for-constexpr-keyword.patch --]
[-- Type: text/x-patch; name="0001-Add-quotes-for-constexpr-keyword.patch", Size: 42947 bytes --]

From 3195b1b71c387b1359c90f6e752e1c312120cd69 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Wed, 15 Nov 2017 08:41:12 +0100
Subject: [PATCH] Add quotes for constexpr keyword.

gcc/cp/ChangeLog:

2017-11-15  Martin Liska  <mliska@suse.cz>

	* class.c (finalize_literal_type_property): Add quotes for
	constexpr keyword.
	(explain_non_literal_class): Likewise.
	* constexpr.c (ensure_literal_type_for_constexpr_object): Likewise.
	(is_valid_constexpr_fn): Likewise.
	(check_constexpr_ctor_body): Likewise.
	(register_constexpr_fundef): Likewise.
	(explain_invalid_constexpr_fn): Likewise.
	(cxx_eval_builtin_function_call): Likewise.
	(cxx_eval_call_expression): Likewise.
	(cxx_eval_loop_expr): Likewise.
	(potential_constant_expression_1): Likewise.
	* decl.c (check_previous_goto_1): Likewise.
	(check_goto): Likewise.
	(grokfndecl): Likewise.
	(grokdeclarator): Likewise.
	* error.c (maybe_print_constexpr_context): Likewise.
	* method.c (process_subob_fn): Likewise.
	(defaulted_late_check): Likewise.
	* parser.c (cp_parser_compound_statement): Likewise.

gcc/testsuite/ChangeLog:

2017-11-16  Martin Liska  <mliska@suse.cz>

	* g++.dg/cpp0x/constexpr-48089.C: Add quotes for constexpr
	keyword; add dg-message for 'in .constexpr. expansion of '.
	* g++.dg/cpp0x/constexpr-50060.C: Likewise.
	* g++.dg/cpp0x/constexpr-60049.C: Likewise.
	* g++.dg/cpp0x/constexpr-70323.C: Likewise.
	* g++.dg/cpp0x/constexpr-70323a.C: Likewise.
	* g++.dg/cpp0x/constexpr-cast.C: Likewise.
	* g++.dg/cpp0x/constexpr-diag3.C: Likewise.
	* g++.dg/cpp0x/constexpr-ex1.C: Likewise.
	* g++.dg/cpp0x/constexpr-generated1.C: Likewise.
	* g++.dg/cpp0x/constexpr-ice16.C: Likewise.
	* g++.dg/cpp0x/constexpr-ice5.C: Likewise.
	* g++.dg/cpp0x/constexpr-incomplete2.C: Likewise.
	* g++.dg/cpp0x/constexpr-neg1.C: Likewise.
	* g++.dg/cpp0x/constexpr-recursion.C: Likewise.
	* g++.dg/cpp0x/constexpr-shift1.C: Likewise.
	* g++.dg/cpp1y/constexpr-70265-1.C: Likewise.
	* g++.dg/cpp1y/constexpr-70265-2.C: Likewise.
	* g++.dg/cpp1y/constexpr-79655.C: Likewise.
	* g++.dg/cpp1y/constexpr-new.C: Likewise.
	* g++.dg/cpp1y/constexpr-return2.C: Likewise.
	* g++.dg/cpp1y/constexpr-shift1.C: Likewise.
	* g++.dg/cpp1y/constexpr-throw.C: Likewise.
	* g++.dg/cpp1z/constexpr-lambda6.C: Likewise.
	* g++.dg/ext/constexpr-vla1.C: Likewise.
	* g++.dg/ext/constexpr-vla2.C: Likewise.
	* g++.dg/ext/constexpr-vla3.C: Likewise.
	* g++.dg/cpp0x/static_assert10.C: Likewise.
	* g++.dg/cpp1y/pr63996.C: Likewise.
	* g++.dg/cpp1y/pr68180.C: Likewise.
	* g++.dg/cpp1y/pr77830.C: Likewise.
	* g++.dg/ubsan/pr63956.C: Likewise.
---
 gcc/cp/class.c                                     |  4 +--
 gcc/cp/constexpr.c                                 | 35 ++++++++++----------
 gcc/cp/decl.c                                      | 10 +++---
 gcc/cp/error.c                                     |  4 +--
 gcc/cp/method.c                                    |  6 ++--
 gcc/cp/parser.c                                    |  2 +-
 gcc/testsuite/g++.dg/cpp0x/constexpr-48089.C       |  2 +-
 gcc/testsuite/g++.dg/cpp0x/constexpr-50060.C       |  2 +-
 gcc/testsuite/g++.dg/cpp0x/constexpr-60049.C       | 10 +++---
 gcc/testsuite/g++.dg/cpp0x/constexpr-70323.C       |  4 +--
 gcc/testsuite/g++.dg/cpp0x/constexpr-70323a.C      |  4 +--
 gcc/testsuite/g++.dg/cpp0x/constexpr-cast.C        |  2 +-
 gcc/testsuite/g++.dg/cpp0x/constexpr-diag3.C       | 10 +++---
 gcc/testsuite/g++.dg/cpp0x/constexpr-ex1.C         |  6 ++--
 gcc/testsuite/g++.dg/cpp0x/constexpr-generated1.C  |  2 +-
 gcc/testsuite/g++.dg/cpp0x/constexpr-ice16.C       |  4 +--
 gcc/testsuite/g++.dg/cpp0x/constexpr-ice5.C        |  2 +-
 gcc/testsuite/g++.dg/cpp0x/constexpr-incomplete2.C |  2 +-
 gcc/testsuite/g++.dg/cpp0x/constexpr-neg1.C        |  6 ++--
 gcc/testsuite/g++.dg/cpp0x/constexpr-recursion.C   |  4 +--
 gcc/testsuite/g++.dg/cpp0x/constexpr-shift1.C      | 14 ++++----
 gcc/testsuite/g++.dg/cpp0x/static_assert10.C       |  2 +-
 gcc/testsuite/g++.dg/cpp1y/constexpr-70265-1.C     |  2 +-
 gcc/testsuite/g++.dg/cpp1y/constexpr-70265-2.C     |  2 +-
 gcc/testsuite/g++.dg/cpp1y/constexpr-79655.C       |  8 ++---
 gcc/testsuite/g++.dg/cpp1y/constexpr-new.C         |  4 +--
 gcc/testsuite/g++.dg/cpp1y/constexpr-return2.C     |  2 +-
 gcc/testsuite/g++.dg/cpp1y/constexpr-shift1.C      |  2 +-
 gcc/testsuite/g++.dg/cpp1y/constexpr-throw.C       |  2 +-
 gcc/testsuite/g++.dg/cpp1y/pr63996.C               |  3 +-
 gcc/testsuite/g++.dg/cpp1y/pr68180.C               |  2 +-
 gcc/testsuite/g++.dg/cpp1y/pr77830.C               |  4 +--
 gcc/testsuite/g++.dg/cpp1z/constexpr-lambda6.C     |  2 +-
 gcc/testsuite/g++.dg/ext/constexpr-vla1.C          |  2 +-
 gcc/testsuite/g++.dg/ext/constexpr-vla2.C          |  4 +--
 gcc/testsuite/g++.dg/ext/constexpr-vla3.C          |  2 +-
 gcc/testsuite/g++.dg/ubsan/pr63956.C               | 38 +++++++++++-----------
 37 files changed, 108 insertions(+), 108 deletions(-)

diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 586a32c436f..529f37f24ee 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -5368,7 +5368,7 @@ finalize_literal_type_property (tree t)
 	  DECL_DECLARED_CONSTEXPR_P (fn) = false;
 	  if (!DECL_GENERATED_P (fn)
 	      && pedwarn (DECL_SOURCE_LOCATION (fn), OPT_Wpedantic,
-			  "enclosing class of constexpr non-static member "
+			  "enclosing class of %<constexpr%> non-static member "
 			  "function %q+#D is not a literal type", fn))
 	    explain_non_literal_class (t);
 	}
@@ -5406,7 +5406,7 @@ explain_non_literal_class (tree t)
     {
       inform (UNKNOWN_LOCATION,
 	      "  %q+T is not an aggregate, does not have a trivial "
-	      "default constructor, and has no constexpr constructor that "
+	      "default constructor, and has no %<constexpr%> constructor that "
 	      "is not a copy or move constructor", t);
       if (type_has_non_user_provided_default_constructor (t))
 	/* Note that we can't simply call locate_ctor because when the
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index 5eac64bd8a3..d101849caee 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -94,8 +94,8 @@ ensure_literal_type_for_constexpr_object (tree decl)
 	{
 	  if (DECL_DECLARED_CONSTEXPR_P (decl))
 	    {
-	      error ("the type %qT of constexpr variable %qD is not literal",
-		     type, decl);
+	      error ("the type %qT of %<constexpr%> variable %qD "
+		     "is not literal", type, decl);
 	      explain_non_literal_class (type);
 	    }
 	  else
@@ -177,7 +177,7 @@ is_valid_constexpr_fn (tree fun, bool complain)
     {
       ret = false;
       if (complain)
-	error ("inherited constructor %qD is not constexpr",
+	error ("inherited constructor %qD is not %<constexpr%>",
 	       DECL_INHERITED_CTOR (fun));
     }
   else
@@ -189,7 +189,7 @@ is_valid_constexpr_fn (tree fun, bool complain)
 	    ret = false;
 	    if (complain)
 	      {
-		error ("invalid type for parameter %d of constexpr "
+		error ("invalid type for parameter %d of %<constexpr%> "
 		       "function %q+#D", DECL_PARM_INDEX (parm), fun);
 		explain_non_literal_class (TREE_TYPE (parm));
 	      }
@@ -201,7 +201,7 @@ is_valid_constexpr_fn (tree fun, bool complain)
       ret = false;
       if (complain)
 	inform (DECL_SOURCE_LOCATION (fun),
-		"lambdas are implicitly constexpr only in C++17 and later");
+		"lambdas are implicitly %<constexpr%> only in C++17 and later");
     }
   else if (!DECL_CONSTRUCTOR_P (fun))
     {
@@ -211,7 +211,7 @@ is_valid_constexpr_fn (tree fun, bool complain)
 	  ret = false;
 	  if (complain)
 	    {
-	      error ("invalid return type %qT of constexpr function %q+D",
+	      error ("invalid return type %qT of %<constexpr%> function %q+D",
 		     rettype, fun);
 	      explain_non_literal_class (rettype);
 	    }
@@ -225,7 +225,7 @@ is_valid_constexpr_fn (tree fun, bool complain)
 	  ret = false;
 	  if (complain
 	      && pedwarn (DECL_SOURCE_LOCATION (fun), OPT_Wpedantic,
-			  "enclosing class of constexpr non-static member "
+			  "enclosing class of %<constexpr%> non-static member "
 			  "function %q+#D is not a literal type", fun))
 	    explain_non_literal_class (DECL_CONTEXT (fun));
 	}
@@ -494,7 +494,7 @@ check_constexpr_ctor_body (tree last, tree list, bool complain)
   if (!ok)
     {
       if (complain)
-	error ("constexpr constructor does not have empty body");
+	error ("%<constexpr%> constructor does not have empty body");
       DECL_DECLARED_CONSTEXPR_P (current_function_decl) = false;
     }
   return ok;
@@ -845,7 +845,8 @@ register_constexpr_fundef (tree fun, tree body)
   if (massaged == NULL_TREE || massaged == error_mark_node)
     {
       if (!DECL_CONSTRUCTOR_P (fun))
-	error ("body of constexpr function %qD not a return-statement", fun);
+	error ("body of %<constexpr%> function %qD not a return-statement",
+	       fun);
       return NULL;
     }
 
@@ -905,7 +906,7 @@ explain_invalid_constexpr_fn (tree fun)
 	 input_location set to our caller's location.  */
       input_location = DECL_SOURCE_LOCATION (fun);
       inform (input_location,
-	      "%qD is not usable as a constexpr function because:", fun);
+	      "%qD is not usable as a %<constexpr%> function because:", fun);
     }
   /* First check the declaration.  */
   if (is_valid_constexpr_fn (fun, true))
@@ -1194,7 +1195,7 @@ cxx_eval_builtin_function_call (const constexpr_ctx *ctx, tree t, tree fun,
 	     comes from cp_maybe_instrument_return.  */
 	  if (DECL_FUNCTION_CODE (fun) == BUILT_IN_UNREACHABLE
 	      && EXPR_LOCATION (t) == BUILTINS_LOCATION)
-	    error ("constexpr call flows off the end of the function");
+	    error ("%<constexpr%> call flows off the end of the function");
 	  else
 	    {
 	      new_call = build_call_array_loc (EXPR_LOCATION (t), TREE_TYPE (t),
@@ -1465,7 +1466,7 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t,
   if (TREE_CODE (fun) != FUNCTION_DECL)
     {
       if (!ctx->quiet && !*non_constant_p)
-	error_at (loc, "expression %qE does not designate a constexpr "
+	error_at (loc, "expression %qE does not designate a %<constexpr%> "
 		  "function", fun);
       *non_constant_p = true;
       return t;
@@ -1484,7 +1485,7 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t,
       if (!ctx->quiet)
 	{
 	  if (!lambda_static_thunk_p (fun))
-	    error_at (loc, "call to non-constexpr function %qD", fun);
+	    error_at (loc, "call to non-%<constexpr%> function %qD", fun);
 	  explain_invalid_constexpr_fn (fun);
 	}
       *non_constant_p = true;
@@ -1618,7 +1619,7 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t,
   if (!depth_ok)
     {
       if (!ctx->quiet)
-	error ("constexpr evaluation depth exceeds maximum of %d (use "
+	error ("%<constexpr%> evaluation depth exceeds maximum of %d (use "
 	       "-fconstexpr-depth= to increase the maximum)",
 	       max_constexpr_depth);
       *non_constant_p = true;
@@ -1701,7 +1702,7 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t,
 	      if (result == NULL_TREE && !*non_constant_p)
 		{
 		  if (!ctx->quiet)
-		    error ("constexpr call flows off the end "
+		    error ("%<constexpr%> call flows off the end "
 			   "of the function");
 		  *non_constant_p = true;
 		}
@@ -3886,7 +3887,7 @@ cxx_eval_loop_expr (const constexpr_ctx *ctx, tree t,
 	{
 	  if (!ctx->quiet)
 	    error_at (EXPR_LOC_OR_LOC (t, input_location),
-		      "constexpr loop iteration count exceeds limit of %d "
+		      "%<constexpr%> loop iteration count exceeds limit of %d "
 		      "(use -fconstexpr-loop-limit= to increase the limit)",
 		      constexpr_loop_limit);
 	  *non_constant_p = true;
@@ -5255,7 +5256,7 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now,
 		  {
 		    if (flags & tf_error)
 		      {
-			error_at (loc, "call to non-constexpr function %qD",
+			error_at (loc, "call to non-%<constexpr%> function %qD",
 				  fun);
 			explain_invalid_constexpr_fn (fun);
 		      }
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 54e06568e46..a7cb61506ee 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -3315,7 +3315,7 @@ check_goto (tree decl)
       else if (ent->in_transaction_scope)
 	inform (input_location, "  enters synchronized or atomic statement");
       else if (ent->in_constexpr_if)
-	inform (input_location, "  enters constexpr if statement");
+	inform (input_location, "  enters %<constexpr%> if statement");
     }
 
   if (ent->in_omp_scope)
@@ -8606,7 +8606,7 @@ grokfndecl (tree ctype,
       if (inlinep & 1)
 	error ("cannot declare %<::main%> to be inline");
       if (inlinep & 2)
-	error ("cannot declare %<::main%> to be constexpr");
+	error ("cannot declare %<::main%> to be %<constexpr%>");
       if (!publicp)
 	error ("cannot declare %<::main%> to be static");
       inlinep = 0;
@@ -12050,7 +12050,7 @@ grokdeclarator (const cp_declarator *declarator,
 			   unqualified_id);
 		else if (constexpr_p && !initialized)
 		  {
-		    error ("constexpr static data member %qD must have an "
+		    error ("%<constexpr%> static data member %qD must have an "
 			   "initializer", decl);
 		    constexpr_p = false;
 		  }
@@ -12278,8 +12278,8 @@ grokdeclarator (const cp_declarator *declarator,
 	  }
 	else if (constexpr_p && DECL_EXTERNAL (decl))
 	  {
-	    error ("declaration of constexpr variable %qD is not a definition",
-		   decl);
+	    error ("declaration of %<constexpr%> variable %qD "
+		   "is not a definition", decl);
 	    constexpr_p = false;
 	  }
 
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index 2537713b5c9..5c78f76db07 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -3584,11 +3584,11 @@ maybe_print_constexpr_context (diagnostic_context *context)
       const char *s = expr_as_string (t, 0);
       if (context->show_column)
 	pp_verbatim (context->printer,
-		     _("%r%s:%d:%d:%R   in constexpr expansion of %qs"),
+		     _("%r%s:%d:%d:%R   in %<constexpr%> expansion of %qs"),
 		     "locus", xloc.file, xloc.line, xloc.column, s);
       else
 	pp_verbatim (context->printer,
-		     _("%r%s:%d:%R   in constexpr expansion of %qs"),
+		     _("%r%s:%d:%R   in %<constexpr%> expansion of %qs"),
 		     "locus", xloc.file, xloc.line, s);
       pp_newline (context->printer);
     }
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index 714b5087991..534aaa32fd5 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -1293,7 +1293,7 @@ process_subob_fn (tree fn, tree *spec_p, bool *trivial_p,
       if (diag)
 	{
 	  inform (DECL_SOURCE_LOCATION (fn),
-		  "defaulted constructor calls non-constexpr %qD", fn);
+		  "defaulted constructor calls non-%<constexpr%> %qD", fn);
 	  explain_invalid_constexpr_fn (fn);
 	}
     }
@@ -2257,8 +2257,8 @@ defaulted_late_check (tree fn)
       if (!CLASSTYPE_TEMPLATE_INSTANTIATION (ctx))
 	{
 	  error ("explicitly defaulted function %q+D cannot be declared "
-		 "as constexpr because the implicit declaration is not "
-		 "constexpr:", fn);
+		 "as %<constexpr%> because the implicit declaration is not "
+		 "%<constexpr%>:", fn);
 	  explain_implicit_non_constexpr (fn);
 	}
       DECL_DECLARED_CONSTEXPR_P (fn) = false;
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index b0617048209..1ad351cdbd7 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -11295,7 +11295,7 @@ cp_parser_compound_statement (cp_parser *parser, tree in_statement_expr,
   if (DECL_DECLARED_CONSTEXPR_P (current_function_decl)
       && !function_body && cxx_dialect < cxx14)
     pedwarn (input_location, OPT_Wpedantic,
-	     "compound-statement in constexpr function");
+	     "compound-statement in %<constexpr%> function");
   /* Begin the compound-statement.  */
   compound_stmt = begin_compound_stmt (bcs_flags);
   /* If the next keyword is `__label__' we have a label declaration.  */
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-48089.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-48089.C
index 31010ed2355..4574eb83ff7 100644
--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-48089.C
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-48089.C
@@ -14,7 +14,7 @@ struct s {
   int v;
 };
 
-constexpr s bang;		// { dg-error "" }
+constexpr s bang;		// { dg-error "|" }
 
 struct R {
   int i,j;
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-50060.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-50060.C
index d2df08e7ca9..d9914288241 100644
--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-50060.C
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-50060.C
@@ -17,5 +17,5 @@ struct T
   int y;
 };
 
-static_assert (S (6.5).x == 0.8125, "");	// { dg-error "non-constant condition for static assertion|in constexpr expansion" "" { target { ! c++14 } } }
+static_assert (S (6.5).x == 0.8125, "");	// { dg-error "non-constant condition for static assertion|in .constexpr. expansion" "" { target { ! c++14 } } }
 static_assert (T (6.5).x == 0.8125, "");	// { dg-error "non-constant condition for static assertion|called in a constant expression" "" { target { ! c++14 } } }
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-60049.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-60049.C
index 3a1ee811c63..172963f1fc4 100644
--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-60049.C
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-60049.C
@@ -11,11 +11,11 @@ constexpr int f5 (int n) { return 1 >> n; }   // { dg-error "shift expression" }
 
 constexpr int X = __CHAR_BIT__ * sizeof (int) + 1;
 
-constexpr int x1 = f1 (X);
-constexpr int x2 = f2 (-1);
-constexpr int x3 = f3 (-1);
-constexpr int x4 = f4 (X);
-constexpr int x5 = f5 (-1);
+constexpr int x1 = f1 (X);    // { dg-message "in .constexpr. expansion of" }
+constexpr int x2 = f2 (-1);   // { dg-message "in .constexpr. expansion of" }
+constexpr int x3 = f3 (-1);   // { dg-message "in .constexpr. expansion of" }
+constexpr int x4 = f4 (X);    // { dg-message "in .constexpr. expansion of" }
+constexpr int x5 = f5 (-1);   // { dg-message "in .constexpr. expansion of" }
 
 constexpr int y1 =  1 << X;   // { dg-error "shift expression" }
 constexpr int y2 =  1 << -1;  // { dg-error "shift expression" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-70323.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-70323.C
index 8307ac8e0a6..272a225d967 100644
--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-70323.C
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-70323.C
@@ -4,7 +4,7 @@
 constexpr int overflow_if_0 (int i) { return __INT_MAX__ + !i; }
 constexpr int overflow_if_1 (int i) { return __INT_MAX__ + i; }
 
-constexpr bool i0_0 = overflow_if_0 (0);   // { dg-error "overflow in constant expression" }
+constexpr bool i0_0 = overflow_if_0 (0);   // { dg-error "overflow in constant expression|in .constexpr. expansion of " }
 constexpr bool i0_1 = overflow_if_0 (1);
 constexpr bool i1_0 = overflow_if_1 (0);
-constexpr bool i1_1 = overflow_if_1 (1);   // { dg-error "overflow in constant expression" }
+constexpr bool i1_1 = overflow_if_1 (1);   // { dg-error "overflow in constant expression|in .constexpr. expansion of " }
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-70323a.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-70323a.C
index d166787ca8b..1990ab6be2d 100644
--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-70323a.C
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-70323a.C
@@ -5,7 +5,7 @@
 constexpr int overflow_if_0 (int i) { return __INT_MAX__ + !i; }
 constexpr int overflow_if_1 (int i) { return __INT_MAX__ + i; }
 
-constexpr bool i0_0 = overflow_if_0 (0);   // { dg-error "overflow in constant expression" }
+constexpr bool i0_0 = overflow_if_0 (0);   // { dg-error "overflow in constant expression|in .constexpr. expansion of" }
 constexpr bool i0_1 = overflow_if_0 (1);
 constexpr bool i1_0 = overflow_if_1 (0);
-constexpr bool i1_1 = overflow_if_1 (1);   // { dg-error "overflow in constant expression" }
+constexpr bool i1_1 = overflow_if_1 (1);   // { dg-error "overflow in constant expression|in .constexpr. expansion of" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-cast.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-cast.C
index e23d0d47889..1ed01c88ff5 100644
--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-cast.C
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-cast.C
@@ -21,4 +21,4 @@ constexpr bool f ()
 #endif
 }
 
-constexpr bool b = f<int>();   // { dg-error "not a constant expression" }
+constexpr bool b = f<int>();   // { dg-error "not a constant expression|in .constexpr. expansion of " }
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-diag3.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-diag3.C
index 27aad93e6c3..fc5a7210853 100644
--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-diag3.C
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-diag3.C
@@ -13,7 +13,7 @@ int main()
 
 // --------------------
 
-struct complex 			// { dg-message "no constexpr constructor" }
+struct complex 			// { dg-message "no .constexpr. constructor" }
 {
   complex(double r, double i) : re(r), im(i) { }
   constexpr double real() const { return re; } // { dg-error "not a literal type" "" { target c++11_only } }
@@ -25,11 +25,11 @@ private:
 };
 
 constexpr complex co1(0, 1);	   // { dg-error "not literal" }
-constexpr double dd2 = co1.real(); // { dg-error "" }
+constexpr double dd2 = co1.real(); // { dg-error "|in .constexpr. expansion of " }
 
 // --------------------
 
-struct base		       // { dg-message "no constexpr constructor" }
+struct base		       // { dg-message "no .constexpr. constructor" }
 {
   int _M_i;
   base() : _M_i(5) { }
@@ -37,7 +37,7 @@ struct base		       // { dg-message "no constexpr constructor" }
 
 struct derived : public base	// { dg-message "base class" }
 {
-  constexpr derived(): base() { } // { dg-error "non-constexpr function" }
+  constexpr derived(): base() { } // { dg-error "non-.constexpr. function" }
 };
 
 constexpr derived obj;		// { dg-error "not literal" }
@@ -48,7 +48,7 @@ struct Def
 {
   int _M_i;			// { dg-message "does not initialize" }
 
-  constexpr Def() = default;	// { dg-error "implicit declaration is not constexpr" }
+  constexpr Def() = default;	// { dg-error "implicit declaration is not .constexpr." }
 };
 
 constexpr Def defobj;		// { dg-error "uninitialized" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ex1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ex1.C
index c4c052a607a..e5e58bddab0 100644
--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-ex1.C
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ex1.C
@@ -54,7 +54,7 @@ constexpr complex I(0, 1);  // OK -- literal complex
 
 
 // 2 invoked with non-const args
-double x5 = 1.0;	       // { dg-message "not declared .constexpr" }
+double x5 = 1.0;	       // { dg-message "not declared .constexpr." }
 constexpr complex unit(x5, 0);	// { dg-error "x5|argument" } error: x5 non-constant
 const complex one(x5, 0);   // OK, ‘‘ordinary const’’ -- dynamic
                            //   initialization
@@ -87,7 +87,7 @@ struct resource {
   }
 };
 constexpr resource f(resource d)
-{ return d; }                  // { dg-error "non-constexpr" }
-constexpr resource d = f(9);   // { dg-message "constexpr" }
+{ return d; }                  // { dg-error "non-.constexpr." }
+constexpr resource d = f(9);   // { dg-message ".constexpr." }
 
 // 4.4 floating-point constant expressions
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-generated1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-generated1.C
index 39be3ed571f..4b0d68bf661 100644
--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-generated1.C
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-generated1.C
@@ -9,7 +9,7 @@ int g();
 
 // We should complain about this.
 template<> constexpr int A<int>::f()
-{ return g(); }			// { dg-error "non-constexpr" }
+{ return g(); }			// { dg-error "non-.constexpr." }
 
 // But not about this.
 struct B
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ice16.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ice16.C
index 42b9226dcd3..112415b655b 100644
--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-ice16.C
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ice16.C
@@ -6,9 +6,9 @@
 struct Foo {
     constexpr Foo(const unsigned i) : val(i) {}
     constexpr Foo operator-(const Foo &rhs) const {
-      return assert(val >= rhs.val), Foo(val - rhs.val); // { dg-error "call to non-constexpr" }
+      return assert(val >= rhs.val), Foo(val - rhs.val); // { dg-error "call to non-.constexpr." }
     }
     unsigned val;
 };
 
-constexpr Foo foo(Foo(1) - Foo(2));
+constexpr Foo foo(Foo(1) - Foo(2)); // { dg-message "in .constexpr. expansion of " }
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ice5.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ice5.C
index c5a117c02dd..51b328e2598 100644
--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-ice5.C
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ice5.C
@@ -9,5 +9,5 @@ struct A
 struct B
 {
   A a[1];
-  constexpr B() : a() {} // { dg-error "non-constant|non-constexpr" }
+  constexpr B() : a() {} // { dg-error "non-constant|non-.constexpr." }
 };
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-incomplete2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-incomplete2.C
index a8af2e66f2a..a04f1d51d22 100644
--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-incomplete2.C
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-incomplete2.C
@@ -28,4 +28,4 @@ struct D
   C<D> c;
 };
 
-constexpr D d {};		// { dg-error "non-constexpr function" }
+constexpr D d {};		// { dg-error "non-.constexpr. function" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-neg1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-neg1.C
index 9c832b14cbc..336699292a2 100644
--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-neg1.C
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-neg1.C
@@ -5,7 +5,7 @@
 constexpr int square(int x);	// { dg-message "never defined" }
 
 // error: pixel is a type
-constexpr struct pixel {        // { dg-error "constexpr" }
+constexpr struct pixel {        // { dg-error ".constexpr." }
   int x;
   int y;
   // OK: declaration
@@ -18,7 +18,7 @@ constexpr pixel::pixel(int a)
 
 // error: square not defined, so small(2) not constant (5.19), so constexpr
 // not satisfied
-constexpr pixel small(2);	// { dg-message "in constexpr expansion" }
+constexpr pixel small(2);	// { dg-message "in .constexpr. expansion of " }
 
 // error: not for parameters
 int next(constexpr int x) {	// { dg-error "parameter" }
@@ -40,7 +40,7 @@ constexpr int g(int x, int n) {
   int r = 1;
   while (--n > 0) r *= x;
   return r;
-} // { dg-error "body of constexpr function" "" { target c++11_only } }
+} // { dg-error "body of .constexpr. function" "" { target c++11_only } }
 
 class debug_flag {
 public:
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-recursion.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-recursion.C
index e3e13f755f9..8c4201e1ec2 100644
--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-recursion.C
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-recursion.C
@@ -2,5 +2,5 @@
 // { dg-do compile { target c++11 } }
 // { dg-options "-fconstexpr-depth=5" }
 // { dg-prune-output "in constexpr expansion" }
-constexpr int f (int i) { return f (i-1); }
-constexpr int i = f(42);	// { dg-error "constexpr evaluation depth" }
+constexpr int f (int i) { return f (i-1); } // { dg-message "in .constexpr. expansion of " }
+constexpr int i = f(42);	// { dg-error ".constexpr. evaluation depth|in .constexpr. expansion of " }
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-shift1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-shift1.C
index 1f4ee73d1b7..4abd9e0cfb6 100644
--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-shift1.C
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-shift1.C
@@ -6,7 +6,7 @@ fn1 (int i, int j)
   return i << j; // { dg-error "is negative" }
 }
 
-constexpr int i1 = fn1 (1, -1);
+constexpr int i1 = fn1 (1, -1); // { dg-message "in .constexpr. expansion of " }
 
 constexpr int
 fn2 (int i, int j)
@@ -14,7 +14,7 @@ fn2 (int i, int j)
   return i << j; // { dg-error "is >= than the precision of the left operand" }
 }
 
-constexpr int i2 = fn2 (1, 200);
+constexpr int i2 = fn2 (1, 200); // { dg-message "in .constexpr. expansion of " }
 
 constexpr int
 fn3 (int i, int j)
@@ -22,7 +22,7 @@ fn3 (int i, int j)
   return i << j; // { dg-error "is negative" }
 }
 
-constexpr int i3 = fn3 (-1, 2);
+constexpr int i3 = fn3 (-1, 2); // { dg-message "in .constexpr. expansion of " }
 
 constexpr int
 fn4 (int i, int j)
@@ -30,7 +30,7 @@ fn4 (int i, int j)
   return i << j; // { dg-error "overflows" }
 }
 
-constexpr int i4 = fn4 (__INT_MAX__, 2);
+constexpr int i4 = fn4 (__INT_MAX__, 2); // { dg-message "in .constexpr. expansion of " }
 
 constexpr int
 fn5 (int i, int j)
@@ -46,7 +46,7 @@ fn6 (unsigned int i, unsigned int j)
   return i << j; // { dg-error "is >= than the precision of the left operand" }
 }
 
-constexpr int i6 = fn6 (1, -1);
+constexpr int i6 = fn6 (1, -1); // { dg-message "in .constexpr. expansion of " }
 
 constexpr int
 fn7 (int i, int j)
@@ -54,7 +54,7 @@ fn7 (int i, int j)
   return i >> j; // { dg-error "is negative" }
 }
 
-constexpr int i7 = fn7 (1, -1);
+constexpr int i7 = fn7 (1, -1); // { dg-message "in .constexpr. expansion of " }
 
 constexpr int
 fn8 (int i, int j)
@@ -70,4 +70,4 @@ fn9 (int i, int j)
   return i >> j;  // { dg-error "is >= than the precision of the left operand" }
 }
 
-constexpr int i9 = fn9 (1, 200);
+constexpr int i9 = fn9 (1, 200); // { dg-message "in .constexpr. expansion of " }
diff --git a/gcc/testsuite/g++.dg/cpp0x/static_assert10.C b/gcc/testsuite/g++.dg/cpp0x/static_assert10.C
index ffbf3c047eb..5ff085487cc 100644
--- a/gcc/testsuite/g++.dg/cpp0x/static_assert10.C
+++ b/gcc/testsuite/g++.dg/cpp0x/static_assert10.C
@@ -4,6 +4,6 @@
 template<typename T> bool foo(T)
 {
   int i;
-  static_assert(foo(i), "Error"); // { dg-error "non-constant condition|not usable|non-constexpr" }
+  static_assert(foo(i), "Error"); // { dg-error "non-constant condition|not usable|non-.constexpr." }
   return true;
 }
diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-70265-1.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-70265-1.C
index e0fcdfeb693..902fe1defbd 100644
--- a/gcc/testsuite/g++.dg/cpp1y/constexpr-70265-1.C
+++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-70265-1.C
@@ -10,4 +10,4 @@ foo (int p)
   return t;
 }
 
-static_assert (foo (1) == 0, "");  // { dg-error "non-constant" }
+static_assert (foo (1) == 0, "");  // { dg-error "non-constant|in .constexpr. expansion of " }
diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-70265-2.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-70265-2.C
index fc360f1a9bb..895870effe1 100644
--- a/gcc/testsuite/g++.dg/cpp1y/constexpr-70265-2.C
+++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-70265-2.C
@@ -10,4 +10,4 @@ foo (int p)
   return t;
 }
 
-static_assert (foo (1) == 0, "");  // { dg-error "non-constant" }
+static_assert (foo (1) == 0, "");  // { dg-error "non-constant|in .constexpr. expansion of " }
diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-79655.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-79655.C
index 0be94b6b810..cc9ce6c505e 100644
--- a/gcc/testsuite/g++.dg/cpp1y/constexpr-79655.C
+++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-79655.C
@@ -9,10 +9,10 @@ foo (int x, int y)
   return a[y];
 }
 
-constexpr int b = foo (0, -1);	// { dg-error "is outside the bounds" }
-constexpr int c = foo (0, 6);	// { dg-error "is outside the bounds" }
-constexpr int d = foo (6, 0);	// { dg-error "is outside the bounds" }
-constexpr int e = foo (-1, 0);	// { dg-error "is outside the bounds" }
+constexpr int b = foo (0, -1);	// { dg-error "is outside the bounds|in .constexpr. expansion of " }
+constexpr int c = foo (0, 6);	// { dg-error "is outside the bounds|in .constexpr. expansion of " }
+constexpr int d = foo (6, 0);	// { dg-error "is outside the bounds|in .constexpr. expansion of " }
+constexpr int e = foo (-1, 0);	// { dg-error "is outside the bounds|in .constexpr. expansion of " }
 static_assert (foo (5, 5) == 0, "");
 static_assert (foo (4, 5) == 6, "");
 static_assert (foo (5, 4) == 5, "");
diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-new.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-new.C
index 7241fefc41e..9e300b9a866 100644
--- a/gcc/testsuite/g++.dg/cpp1y/constexpr-new.C
+++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-new.C
@@ -4,8 +4,8 @@ constexpr int *f4(bool b) {
   if (b) {
     return nullptr;
   } else {
-    return new int{42}; // { dg-error "call to non-constexpr" }
+    return new int{42}; // { dg-error "call to non-.constexpr." }
   }
 }
 static_assert(f4(true) == nullptr, "");
-static_assert(f4(false) == nullptr, ""); // { dg-error "non-constant condition" }
+static_assert(f4(false) == nullptr, ""); // { dg-error "non-.constant. condition|" }
diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-return2.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-return2.C
index d330ccfed3e..cb0185414af 100644
--- a/gcc/testsuite/g++.dg/cpp1y/constexpr-return2.C
+++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-return2.C
@@ -5,4 +5,4 @@ constexpr int f (int i)
 {
 }
 
-constexpr int i = f(42);	// { dg-error "flows off the end" }
+constexpr int i = f(42);	// { dg-error "flows off the end|in .constexpr. expansion of " }
diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-shift1.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-shift1.C
index a739fd2dfae..d63c954f42f 100644
--- a/gcc/testsuite/g++.dg/cpp1y/constexpr-shift1.C
+++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-shift1.C
@@ -5,5 +5,5 @@ constexpr __PTRDIFF_TYPE__ bar (int a)
 {
   return ((__PTRDIFF_TYPE__) &p) << a; // { dg-error "is not a constant expression" }
 }
-constexpr __PTRDIFF_TYPE__ r = bar (2);
+constexpr __PTRDIFF_TYPE__ r = bar (2); // { dg-message "in .constexpr. expansion of" }
 constexpr __PTRDIFF_TYPE__ s = bar (0); // { dg-error "conversion from pointer" }
diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-throw.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-throw.C
index 21629a7990a..3bbc8ac1b88 100644
--- a/gcc/testsuite/g++.dg/cpp1y/constexpr-throw.C
+++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-throw.C
@@ -31,4 +31,4 @@ constexpr int fun(int n) {
 }
 
 static_assert(fun(0), "");
-static_assert(fun(1), ""); // { dg-error "non-constant" }
+static_assert(fun(1), ""); // { dg-error "non-constant|in .constexpr. expansion of" }
diff --git a/gcc/testsuite/g++.dg/cpp1y/pr63996.C b/gcc/testsuite/g++.dg/cpp1y/pr63996.C
index da1e0764a10..2e8cab58a7a 100644
--- a/gcc/testsuite/g++.dg/cpp1y/pr63996.C
+++ b/gcc/testsuite/g++.dg/cpp1y/pr63996.C
@@ -7,5 +7,4 @@ foo (int i)
   int a[i] = { }; // { dg-error "forbids variable length" }
 }
 
-constexpr int j = foo (1); // { dg-error "flows off the end" }
-
+constexpr int j = foo (1); // { dg-error "flows off the end|in .constexpr. expansion of" }
diff --git a/gcc/testsuite/g++.dg/cpp1y/pr68180.C b/gcc/testsuite/g++.dg/cpp1y/pr68180.C
index 5c8ec534f33..9e6e5e984f9 100644
--- a/gcc/testsuite/g++.dg/cpp1y/pr68180.C
+++ b/gcc/testsuite/g++.dg/cpp1y/pr68180.C
@@ -11,6 +11,6 @@ constexpr float32x4_t fill(float x) {
 }
 
 float32x4_t foo(float32x4_t x) {
-  constexpr float32x4_t v = fill(1.f); // { dg-error "not a constant" }
+  constexpr float32x4_t v = fill(1.f); // { dg-error "not a constant||in .constexpr. expansion of " }
   return x+v;
 }
diff --git a/gcc/testsuite/g++.dg/cpp1y/pr77830.C b/gcc/testsuite/g++.dg/cpp1y/pr77830.C
index 9235b405225..6fcb1ba8847 100644
--- a/gcc/testsuite/g++.dg/cpp1y/pr77830.C
+++ b/gcc/testsuite/g++.dg/cpp1y/pr77830.C
@@ -23,12 +23,12 @@ bar (T... a)
   const char *s[]{a...};
   P<sizeof...(a)> p{};
   for (auto i = 0; i < sizeof...(a); ++i)
-    p.foo (s[i], i);
+    p.foo (s[i], i); // { dg-message "in .constexpr. expansion of " }
   return p;
 }
 
 int
 main ()
 {
-  constexpr auto a = bar ("", "");	// { dg-error "outside the bounds of array type" }
+  constexpr auto a = bar ("", "");	// { dg-error "outside the bounds of array type|in .constexpr. expansion of " }
 }
diff --git a/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda6.C b/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda6.C
index 3fe4bb949bd..cd7c5b9f3ef 100644
--- a/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda6.C
+++ b/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda6.C
@@ -24,6 +24,6 @@ int main()
   // expression.
   auto two = monoid(2);
   if (!(two() == 2)) __builtin_abort(); // OK, not a constant expression.
-  static_assert(add(one)(one)() == two()); // { dg-error "" } two() is not a constant expression
+  static_assert(add(one)(one)() == two()); // { dg-error "|in .constexpr. expansion of " } two() is not a constant expression
   static_assert(add(one)(one)() == monoid(2)()); // OK
 }
diff --git a/gcc/testsuite/g++.dg/ext/constexpr-vla1.C b/gcc/testsuite/g++.dg/ext/constexpr-vla1.C
index 21eb93dc654..aff1d21a4b7 100644
--- a/gcc/testsuite/g++.dg/ext/constexpr-vla1.C
+++ b/gcc/testsuite/g++.dg/ext/constexpr-vla1.C
@@ -27,4 +27,4 @@ fn_not_ok (int n)
 }
 
 constexpr int n1 = fn_ok (3);
-constexpr int n2 = fn_not_ok (3); // { dg-error "array subscript" }
+constexpr int n2 = fn_not_ok (3); // { dg-error "array subscript|in .constexpr. expansion of " }
diff --git a/gcc/testsuite/g++.dg/ext/constexpr-vla2.C b/gcc/testsuite/g++.dg/ext/constexpr-vla2.C
index 6aab18436d5..d4ea7c58c0d 100644
--- a/gcc/testsuite/g++.dg/ext/constexpr-vla2.C
+++ b/gcc/testsuite/g++.dg/ext/constexpr-vla2.C
@@ -5,7 +5,7 @@ constexpr int
 fn_bad (int n)
 {
   __extension__ int a [n] = { 0 };
-  int z = a [0] + (n ? fn_bad (n - 1) : 0);
+  int z = a [0] + (n ? fn_bad (n - 1) : 0); // { dg-message "in .constexpr. expansion of " } 
   return z;
 }
 
@@ -18,4 +18,4 @@ fn_ok (int n)
 }
 
 constexpr int i1 = fn_ok (3);
-constexpr int i2 = fn_bad (3); // { dg-error "array subscript" }
+constexpr int i2 = fn_bad (3); // { dg-error "array subscript|in .constexpr. expansion of " }
diff --git a/gcc/testsuite/g++.dg/ext/constexpr-vla3.C b/gcc/testsuite/g++.dg/ext/constexpr-vla3.C
index 33fc968ad5a..538b576a825 100644
--- a/gcc/testsuite/g++.dg/ext/constexpr-vla3.C
+++ b/gcc/testsuite/g++.dg/ext/constexpr-vla3.C
@@ -11,4 +11,4 @@ foo (int n)
   return z;
 }
 
-constexpr int n = foo (3); // { dg-error "array subscript" }
+constexpr int n = foo (3); // { dg-error "array subscript|in .constexpr. expansion of " }
diff --git a/gcc/testsuite/g++.dg/ubsan/pr63956.C b/gcc/testsuite/g++.dg/ubsan/pr63956.C
index bce7b1cd2da..34b5dd71ec2 100644
--- a/gcc/testsuite/g++.dg/ubsan/pr63956.C
+++ b/gcc/testsuite/g++.dg/ubsan/pr63956.C
@@ -17,11 +17,11 @@ fn1 (int a, int b)
 }
 
 constexpr int i1 = fn1 (5, 3);
-constexpr int i2 = fn1 (5, -2); // { dg-message "in constexpr expansion" }
-constexpr int i3 = fn1 (5, sizeof (int) * __CHAR_BIT__); // { dg-message "in constexpr expansion" }
-constexpr int i4 = fn1 (5, 256); // { dg-message "in constexpr expansion" }
+constexpr int i2 = fn1 (5, -2); // { dg-message "in .constexpr. expansion" }
+constexpr int i3 = fn1 (5, sizeof (int) * __CHAR_BIT__); // { dg-message "in .constexpr. expansion" }
+constexpr int i4 = fn1 (5, 256); // { dg-message "in .constexpr. expansion" }
 constexpr int i5 = fn1 (5, 2);
-constexpr int i6 = fn1 (-2, 4); // { dg-message "in constexpr expansion" }
+constexpr int i6 = fn1 (-2, 4); // { dg-message "in .constexpr. expansion" }
 constexpr int i7 = fn1 (0, 2);
 
 SA (i1 == 40);
@@ -40,9 +40,9 @@ fn2 (int a, int b)
 }
 
 constexpr int j1 = fn2 (4, 1);
-constexpr int j2 = fn2 (4, -1); // { dg-message "in constexpr expansion" }
-constexpr int j3 = fn2 (10, sizeof (int) * __CHAR_BIT__); // { dg-message "in constexpr expansion" }
-constexpr int j4 = fn2 (1, 256); // { dg-message "in constexpr expansion" }
+constexpr int j2 = fn2 (4, -1); // { dg-message "in .constexpr. expansion" }
+constexpr int j3 = fn2 (10, sizeof (int) * __CHAR_BIT__); // { dg-message "in .constexpr. expansion" }
+constexpr int j4 = fn2 (1, 256); // { dg-message "in .constexpr. expansion" }
 constexpr int j5 = fn2 (5, 2);
 constexpr int j6 = fn2 (-2, 4);
 constexpr int j7 = fn2 (0, 4);
@@ -60,8 +60,8 @@ fn3 (int a, int b)
 }
 
 constexpr int k1 = fn3 (8, 4);
-constexpr int k2 = fn3 (7, 0); // { dg-message "in constexpr expansion" }
-constexpr int k3 = fn3 (INT_MIN, -1); // { dg-error "overflow in constant expression" }
+constexpr int k2 = fn3 (7, 0); // { dg-message "in .constexpr. expansion" }
+constexpr int k3 = fn3 (INT_MIN, -1); // { dg-error "overflow in constant expression|in .constexpr. expansion of " }
 
 SA (k1 == 2);
 
@@ -74,7 +74,7 @@ fn4 (float a, float b)
 }
 
 constexpr float l1 = fn4 (5.0, 3.0);
-constexpr float l2 = fn4 (7.0, 0.0); // { dg-message "in constexpr expansion" }
+constexpr float l2 = fn4 (7.0, 0.0); // { dg-message "in .constexpr. expansion" }
 
 constexpr int
 fn5 (const int *a, int b)
@@ -86,7 +86,7 @@ fn5 (const int *a, int b)
 
 constexpr int m1[4] = { 1, 2, 3, 4 };
 constexpr int m2 = fn5 (m1, 3);
-constexpr int m3 = fn5 (m1, 4); // { dg-error "array subscript" }
+constexpr int m3 = fn5 (m1, 4); // { dg-error "array subscript|in .constexpr. expansion of " }
 
 constexpr int
 fn6 (const int &a, int b)
@@ -106,7 +106,7 @@ fn7 (const int *a, int b)
 
 constexpr int n1 = 7;
 constexpr int n2 = fn7 (&n1, 5);
-constexpr int n3 = fn7 ((const int *) 0, 8);  // { dg-error "null pointer" }
+constexpr int n3 = fn7 ((const int *) 0, 8);  // { dg-error "null pointer|in .constexpr. expansion of " }
 
 constexpr int
 fn8 (int i)
@@ -116,7 +116,7 @@ fn8 (int i)
 }
 
 constexpr int o1 = fn8 (9);
-constexpr int o2 = fn8 (10); // { dg-error "array subscript" }
+constexpr int o2 = fn8 (10); // { dg-error "array subscript|in .constexpr. expansion of " }
 
 constexpr int
 fn9 (int a, int b)
@@ -127,10 +127,10 @@ fn9 (int a, int b)
 }
 
 constexpr int p1 = fn9 (42, 7);
-constexpr int p2 = fn9 (__INT_MAX__, 1); // { dg-error "overflow in constant expression" }
+constexpr int p2 = fn9 (__INT_MAX__, 1); // { dg-error "overflow in constant expression|in .constexpr. expansion of " }
 constexpr int p3 = fn9 (__INT_MAX__, -1);
 constexpr int p4 = fn9 (INT_MIN, 1);
-constexpr int p5 = fn9 (INT_MIN, -1); // { dg-error "overflow in constant expression" }
+constexpr int p5 = fn9 (INT_MIN, -1); // { dg-error "overflow in constant expression|in .constexpr. expansion of " }
 
 SA (p1 == 49);
 SA (p3 == __INT_MAX__ - 1);
@@ -145,8 +145,8 @@ fn10 (int a, int b)
 }
 
 constexpr int q1 = fn10 (10, 10);
-constexpr int q2 = fn10 (__INT_MAX__, 2); // { dg-error "overflow in constant expression" }
-constexpr int q3 = fn10 (INT_MIN, 2); // { dg-error "overflow in constant expression" }
+constexpr int q2 = fn10 (__INT_MAX__, 2); // { dg-error "overflow in constant expression|in .constexpr. expansion of " }
+constexpr int q3 = fn10 (INT_MIN, 2); // { dg-error "overflow in constant expression|in .constexpr. expansion of " }
 constexpr int q4 = fn10 (-1, -1);
 
 SA (q1 == 100);
@@ -162,7 +162,7 @@ fn11 (double d)
 }
 
 constexpr int r1 = fn11 (3.4);
-constexpr int r2 = fn11 (__builtin_inf ()); // { dg-error "overflow in constant expression" }
+constexpr int r2 = fn11 (__builtin_inf ()); // { dg-error "overflow in constant expression|in .constexpr. expansion of " }
 
 constexpr int
 fn12 (int i)
@@ -173,6 +173,6 @@ fn12 (int i)
 }
 
 constexpr int s1 = fn12 (1);
-constexpr int s2 = fn12 (42);
+constexpr int s2 = fn12 (42); // { dg-message "in .constexpr. expansion of " }
 
 SA (s1 == 11);
-- 
2.14.3


^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH][RFC] Add quotes for constexpr keyword.
  2017-11-21 15:27                                 ` Martin Liška
@ 2017-11-21 15:48                                   ` Martin Sebor
  2017-11-21 17:23                                   ` Jeff Law
  1 sibling, 0 replies; 64+ messages in thread
From: Martin Sebor @ 2017-11-21 15:48 UTC (permalink / raw)
  To: Martin Liška, Jonathan Wakely
  Cc: Jason Merrill, Marek Polacek, Jakub Jelinek, gcc-patches List

On 11/21/2017 08:00 AM, Martin Liška wrote:
> Hi.
>
> I'm sending v2 of the patch where I fixed test-suite fallout.
>
> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.

The changes look good to me.  Thanks for the nice cleanup!

Martin

PS While going through the patch I noticed the -fconstexpr-depth=
option also isn't quoted in a few instances.  That would be nice
to fix as well at some point (this can of course be done
independently):

        if (!ctx->quiet)
-	error ("constexpr evaluation depth exceeds maximum of %d (use "
+	error ("%<constexpr%> evaluation depth exceeds maximum of %d (use "
  	       "-fconstexpr-depth= to increase the maximum)",
  	       max_constexpr_depth);

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH][RFC] Add quotes for constexpr keyword.
  2017-11-21 15:27                                 ` Martin Liška
  2017-11-21 15:48                                   ` Martin Sebor
@ 2017-11-21 17:23                                   ` Jeff Law
  2017-11-21 19:07                                     ` Martin Liška
  1 sibling, 1 reply; 64+ messages in thread
From: Jeff Law @ 2017-11-21 17:23 UTC (permalink / raw)
  To: Martin Liška, Jonathan Wakely, Martin Sebor
  Cc: Jason Merrill, Marek Polacek, Jakub Jelinek, gcc-patches List

On 11/21/2017 08:00 AM, Martin Liška wrote:
> Hi.
> 
> I'm sending v2 of the patch where I fixed test-suite fallout.
> 
> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
> 
> Ready to be installed?
> Martin
> 
> 
> 0001-Add-quotes-for-constexpr-keyword.patch
> 
> 
> From 3195b1b71c387b1359c90f6e752e1c312120cd69 Mon Sep 17 00:00:00 2001
> From: marxin <mliska@suse.cz>
> Date: Wed, 15 Nov 2017 08:41:12 +0100
> Subject: [PATCH] Add quotes for constexpr keyword.
> 
> gcc/cp/ChangeLog:
> 
> 2017-11-15  Martin Liska  <mliska@suse.cz>
> 
> 	* class.c (finalize_literal_type_property): Add quotes for
> 	constexpr keyword.
> 	(explain_non_literal_class): Likewise.
> 	* constexpr.c (ensure_literal_type_for_constexpr_object): Likewise.
> 	(is_valid_constexpr_fn): Likewise.
> 	(check_constexpr_ctor_body): Likewise.
> 	(register_constexpr_fundef): Likewise.
> 	(explain_invalid_constexpr_fn): Likewise.
> 	(cxx_eval_builtin_function_call): Likewise.
> 	(cxx_eval_call_expression): Likewise.
> 	(cxx_eval_loop_expr): Likewise.
> 	(potential_constant_expression_1): Likewise.
> 	* decl.c (check_previous_goto_1): Likewise.
> 	(check_goto): Likewise.
> 	(grokfndecl): Likewise.
> 	(grokdeclarator): Likewise.
> 	* error.c (maybe_print_constexpr_context): Likewise.
> 	* method.c (process_subob_fn): Likewise.
> 	(defaulted_late_check): Likewise.
> 	* parser.c (cp_parser_compound_statement): Likewise.
> 
> gcc/testsuite/ChangeLog:
> 
> 2017-11-16  Martin Liska  <mliska@suse.cz>
> 
> 	* g++.dg/cpp0x/constexpr-48089.C: Add quotes for constexpr
> 	keyword; add dg-message for 'in .constexpr. expansion of '.
> 	* g++.dg/cpp0x/constexpr-50060.C: Likewise.
> 	* g++.dg/cpp0x/constexpr-60049.C: Likewise.
> 	* g++.dg/cpp0x/constexpr-70323.C: Likewise.
> 	* g++.dg/cpp0x/constexpr-70323a.C: Likewise.
> 	* g++.dg/cpp0x/constexpr-cast.C: Likewise.
> 	* g++.dg/cpp0x/constexpr-diag3.C: Likewise.
> 	* g++.dg/cpp0x/constexpr-ex1.C: Likewise.
> 	* g++.dg/cpp0x/constexpr-generated1.C: Likewise.
> 	* g++.dg/cpp0x/constexpr-ice16.C: Likewise.
> 	* g++.dg/cpp0x/constexpr-ice5.C: Likewise.
> 	* g++.dg/cpp0x/constexpr-incomplete2.C: Likewise.
> 	* g++.dg/cpp0x/constexpr-neg1.C: Likewise.
> 	* g++.dg/cpp0x/constexpr-recursion.C: Likewise.
> 	* g++.dg/cpp0x/constexpr-shift1.C: Likewise.
> 	* g++.dg/cpp1y/constexpr-70265-1.C: Likewise.
> 	* g++.dg/cpp1y/constexpr-70265-2.C: Likewise.
> 	* g++.dg/cpp1y/constexpr-79655.C: Likewise.
> 	* g++.dg/cpp1y/constexpr-new.C: Likewise.
> 	* g++.dg/cpp1y/constexpr-return2.C: Likewise.
> 	* g++.dg/cpp1y/constexpr-shift1.C: Likewise.
> 	* g++.dg/cpp1y/constexpr-throw.C: Likewise.
> 	* g++.dg/cpp1z/constexpr-lambda6.C: Likewise.
> 	* g++.dg/ext/constexpr-vla1.C: Likewise.
> 	* g++.dg/ext/constexpr-vla2.C: Likewise.
> 	* g++.dg/ext/constexpr-vla3.C: Likewise.
> 	* g++.dg/cpp0x/static_assert10.C: Likewise.
> 	* g++.dg/cpp1y/pr63996.C: Likewise.
> 	* g++.dg/cpp1y/pr68180.C: Likewise.
> 	* g++.dg/cpp1y/pr77830.C: Likewise.
> 	* g++.dg/ubsan/pr63956.C: Likewise.
OK.  And ISTM that other patches of a similar nature ought to just be
considered OK without the need to review.

Jeff

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH][RFC] Add quotes for constexpr keyword.
  2017-11-21 17:23                                   ` Jeff Law
@ 2017-11-21 19:07                                     ` Martin Liška
  0 siblings, 0 replies; 64+ messages in thread
From: Martin Liška @ 2017-11-21 19:07 UTC (permalink / raw)
  To: Jeff Law, Jonathan Wakely, Martin Sebor
  Cc: Jason Merrill, Marek Polacek, Jakub Jelinek, gcc-patches List

On 11/21/2017 06:13 PM, Jeff Law wrote:
> On 11/21/2017 08:00 AM, Martin Liška wrote:
>> Hi.
>>
>> I'm sending v2 of the patch where I fixed test-suite fallout.
>>
>> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
>>
>> Ready to be installed?
>> Martin
>>
>>
>> 0001-Add-quotes-for-constexpr-keyword.patch
>>
>>
>>  From 3195b1b71c387b1359c90f6e752e1c312120cd69 Mon Sep 17 00:00:00 2001
>> From: marxin <mliska@suse.cz>
>> Date: Wed, 15 Nov 2017 08:41:12 +0100
>> Subject: [PATCH] Add quotes for constexpr keyword.
>>
>> gcc/cp/ChangeLog:
>>
>> 2017-11-15  Martin Liska  <mliska@suse.cz>
>>
>> 	* class.c (finalize_literal_type_property): Add quotes for
>> 	constexpr keyword.
>> 	(explain_non_literal_class): Likewise.
>> 	* constexpr.c (ensure_literal_type_for_constexpr_object): Likewise.
>> 	(is_valid_constexpr_fn): Likewise.
>> 	(check_constexpr_ctor_body): Likewise.
>> 	(register_constexpr_fundef): Likewise.
>> 	(explain_invalid_constexpr_fn): Likewise.
>> 	(cxx_eval_builtin_function_call): Likewise.
>> 	(cxx_eval_call_expression): Likewise.
>> 	(cxx_eval_loop_expr): Likewise.
>> 	(potential_constant_expression_1): Likewise.
>> 	* decl.c (check_previous_goto_1): Likewise.
>> 	(check_goto): Likewise.
>> 	(grokfndecl): Likewise.
>> 	(grokdeclarator): Likewise.
>> 	* error.c (maybe_print_constexpr_context): Likewise.
>> 	* method.c (process_subob_fn): Likewise.
>> 	(defaulted_late_check): Likewise.
>> 	* parser.c (cp_parser_compound_statement): Likewise.
>>
>> gcc/testsuite/ChangeLog:
>>
>> 2017-11-16  Martin Liska  <mliska@suse.cz>
>>
>> 	* g++.dg/cpp0x/constexpr-48089.C: Add quotes for constexpr
>> 	keyword; add dg-message for 'in .constexpr. expansion of '.
>> 	* g++.dg/cpp0x/constexpr-50060.C: Likewise.
>> 	* g++.dg/cpp0x/constexpr-60049.C: Likewise.
>> 	* g++.dg/cpp0x/constexpr-70323.C: Likewise.
>> 	* g++.dg/cpp0x/constexpr-70323a.C: Likewise.
>> 	* g++.dg/cpp0x/constexpr-cast.C: Likewise.
>> 	* g++.dg/cpp0x/constexpr-diag3.C: Likewise.
>> 	* g++.dg/cpp0x/constexpr-ex1.C: Likewise.
>> 	* g++.dg/cpp0x/constexpr-generated1.C: Likewise.
>> 	* g++.dg/cpp0x/constexpr-ice16.C: Likewise.
>> 	* g++.dg/cpp0x/constexpr-ice5.C: Likewise.
>> 	* g++.dg/cpp0x/constexpr-incomplete2.C: Likewise.
>> 	* g++.dg/cpp0x/constexpr-neg1.C: Likewise.
>> 	* g++.dg/cpp0x/constexpr-recursion.C: Likewise.
>> 	* g++.dg/cpp0x/constexpr-shift1.C: Likewise.
>> 	* g++.dg/cpp1y/constexpr-70265-1.C: Likewise.
>> 	* g++.dg/cpp1y/constexpr-70265-2.C: Likewise.
>> 	* g++.dg/cpp1y/constexpr-79655.C: Likewise.
>> 	* g++.dg/cpp1y/constexpr-new.C: Likewise.
>> 	* g++.dg/cpp1y/constexpr-return2.C: Likewise.
>> 	* g++.dg/cpp1y/constexpr-shift1.C: Likewise.
>> 	* g++.dg/cpp1y/constexpr-throw.C: Likewise.
>> 	* g++.dg/cpp1z/constexpr-lambda6.C: Likewise.
>> 	* g++.dg/ext/constexpr-vla1.C: Likewise.
>> 	* g++.dg/ext/constexpr-vla2.C: Likewise.
>> 	* g++.dg/ext/constexpr-vla3.C: Likewise.
>> 	* g++.dg/cpp0x/static_assert10.C: Likewise.
>> 	* g++.dg/cpp1y/pr63996.C: Likewise.
>> 	* g++.dg/cpp1y/pr68180.C: Likewise.
>> 	* g++.dg/cpp1y/pr77830.C: Likewise.
>> 	* g++.dg/ubsan/pr63956.C: Likewise.
> OK.  And ISTM that other patches of a similar nature ought to just be
> considered OK without the need to review.
> 
> Jeff
> 

Thanks for review, installed as r255025.

Martin

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [PATCH] Fix test-suite fallout of default -Wreturn-type.
  2017-11-20 14:14               ` Jason Merrill
@ 2018-03-02 16:37                 ` Thomas Schwinge
  0 siblings, 0 replies; 64+ messages in thread
From: Thomas Schwinge @ 2018-03-02 16:37 UTC (permalink / raw)
  To: gcc-patches
  Cc: Martin Liška, Jonathan Wakely, Jakub Jelinek, Jason Merrill

Hi!

On Mon, 20 Nov 2017 09:11:19 -0500, Jason Merrill <jason@redhat.com> wrote:
> On Sun, Nov 19, 2017 at 7:56 AM, Thomas Schwinge
> <thomas@codesourcery.com> wrote:
> > OK to fix the first four issues as follows?
> 
> OK.
> 
> Reviewed-by: Jason Merrill <jason@redhat.com>

Better late than never, committed to trunk in r258142:

commit 0e793314b12e82e8a7eeee0971e509572d67b773
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Fri Mar 2 16:35:36 2018 +0000

    Fix "dg-lto-options" misuse
    
            gcc/testsuite/
            * g++.dg/lto/20080915_0.C: Don't use "dg-lto-options".
            * g++.dg/lto/20080907_0.C: Use "#pragma GCC" instead of
            "dg-lto-options".
            * g++.dg/lto/20101010-1_0.C: Likewise.
            * g++.dg/lto/20101010-2_0.C: Likewise.
    
    Reviewed-by: Jason Merrill <jason@redhat.com>
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@258142 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/testsuite/ChangeLog                 | 8 ++++++++
 gcc/testsuite/g++.dg/lto/20080907_0.C   | 4 +++-
 gcc/testsuite/g++.dg/lto/20080915_0.C   | 1 -
 gcc/testsuite/g++.dg/lto/20101010-1_0.C | 4 +++-
 gcc/testsuite/g++.dg/lto/20101010-2_0.C | 4 +++-
 5 files changed, 17 insertions(+), 4 deletions(-)

diff --git gcc/testsuite/ChangeLog gcc/testsuite/ChangeLog
index 84ebf2e..3864204 100644
--- gcc/testsuite/ChangeLog
+++ gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2018-03-02  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* g++.dg/lto/20080915_0.C: Don't use "dg-lto-options".
+	* g++.dg/lto/20080907_0.C: Use "#pragma GCC" instead of
+	"dg-lto-options".
+	* g++.dg/lto/20101010-1_0.C: Likewise.
+	* g++.dg/lto/20101010-2_0.C: Likewise.
+
 2018-03-02  Jakub Jelinek  <jakub@redhat.com>
 
 	PR ipa/84628
diff --git gcc/testsuite/g++.dg/lto/20080907_0.C gcc/testsuite/g++.dg/lto/20080907_0.C
index a423196..153d0ab 100644
--- gcc/testsuite/g++.dg/lto/20080907_0.C
+++ gcc/testsuite/g++.dg/lto/20080907_0.C
@@ -1,5 +1,7 @@
 // { dg-lto-do assemble }
-// { dg-lto-options "-Wno-return-type" }
+
+/* "WARNING: lto.exp does not support dg-additional-options" */
+#pragma GCC diagnostic ignored "-Wreturn-type"
 
 struct Foo { void func (); }; Foo & bar () { } struct Baz { Baz (Baz &); };
 Baz dummy() { bar().func(); }
diff --git gcc/testsuite/g++.dg/lto/20080915_0.C gcc/testsuite/g++.dg/lto/20080915_0.C
index 40c5042..c91e756 100644
--- gcc/testsuite/g++.dg/lto/20080915_0.C
+++ gcc/testsuite/g++.dg/lto/20080915_0.C
@@ -1,5 +1,4 @@
 // { dg-lto-do assemble }
-// { dg-lto-options "-Wno-return-type" }
 
 struct Foo {
  static const int dummy;
diff --git gcc/testsuite/g++.dg/lto/20101010-1_0.C gcc/testsuite/g++.dg/lto/20101010-1_0.C
index 8f694c7..bb3e6d4 100644
--- gcc/testsuite/g++.dg/lto/20101010-1_0.C
+++ gcc/testsuite/g++.dg/lto/20101010-1_0.C
@@ -1,5 +1,7 @@
 // { dg-lto-do link }
-// { dg-lto-options "-Wno-return-type" }
+
+/* "WARNING: lto.exp does not support dg-additional-options" */
+#pragma GCC diagnostic ignored "-Wreturn-type"
 
 typedef long size_t;
 template < class, class > struct pair
diff --git gcc/testsuite/g++.dg/lto/20101010-2_0.C gcc/testsuite/g++.dg/lto/20101010-2_0.C
index a26956f..721ac01 100644
--- gcc/testsuite/g++.dg/lto/20101010-2_0.C
+++ gcc/testsuite/g++.dg/lto/20101010-2_0.C
@@ -1,5 +1,7 @@
 // { dg-lto-do link }
-// { dg-lto-options "-Wno-return-type" }
+
+/* "WARNING: lto.exp does not support dg-additional-options" */
+#pragma GCC diagnostic ignored "-Wreturn-type"
 
 typedef int size_t;
 template < size_t _Nw > struct _Base_bitset


Grüße
 Thomas

^ permalink raw reply	[flat|nested] 64+ messages in thread

end of thread, other threads:[~2018-03-02 16:37 UTC | newest]

Thread overview: 64+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-05 10:32 [PATCH][RFC] Instrument function exit with __builtin_unreachable in C++ Martin Liška
2017-10-05 11:04 ` Jakub Jelinek
2017-10-05 15:08 ` Jason Merrill
2017-10-05 16:53   ` Martin Liška
2017-10-11 14:04     ` Martin Liška
2017-10-11 15:31     ` Jason Merrill
2017-10-12  8:48       ` Martin Liška
2017-10-12  9:36         ` Jakub Jelinek
2017-10-18 12:47           ` Martin Liška
2017-10-18 13:04             ` Marek Polacek
2017-10-18 13:15               ` Martin Liška
2017-10-24 14:30                 ` Jason Merrill
2017-11-03 13:42                   ` Martin Liška
2017-11-06 17:27                     ` Eric Botcazou
2017-11-06 17:41                       ` Jakub Jelinek
2017-11-06 23:07                         ` Eric Botcazou
2017-11-07 10:18                         ` Martin Liška
2017-11-15  7:57                           ` Martin Liška
2017-11-15  8:23                           ` Jakub Jelinek
2017-11-15  9:58                             ` Eric Botcazou
2017-11-15 10:02                               ` Martin Liška
2017-11-15 10:10                                 ` Eric Botcazou
2017-11-15 10:45                                 ` Jakub Jelinek
2017-11-15 12:46                                   ` Martin Liška
2017-11-06 18:41                     ` Martin Sebor
2017-11-15 12:49                       ` [PATCH][RFC] Add quotes for constexpr keyword Martin Liška
2017-11-15 16:38                         ` Martin Sebor
2017-11-15 16:59                           ` Jonathan Wakely
2017-11-15 17:06                             ` Martin Sebor
2017-11-15 17:14                               ` Jonathan Wakely
2017-11-21 15:27                                 ` Martin Liška
2017-11-21 15:48                                   ` Martin Sebor
2017-11-21 17:23                                   ` Jeff Law
2017-11-21 19:07                                     ` Martin Liška
2017-11-07 17:28                     ` [PATCH][RFC] Instrument function exit with __builtin_unreachable in C++ Andreas Schwab
2017-11-07 19:06                       ` Martin Liška
2017-11-19 17:06                     ` Thomas Schwinge
2017-10-18 12:48           ` [PATCH] Fix all tests that fail with -sanitize=return Martin Liška
2017-10-24 14:39             ` Jason Merrill
2017-11-06  8:48               ` Martin Liška
2017-10-18 12:53           ` [PATCH] Fix test-suite fallout of default -Wreturn-type Martin Liška
2017-10-24 14:40             ` Jason Merrill
2017-10-26 12:17               ` Martin Liška
2017-11-03 15:29                 ` Jason Merrill
2017-11-06  8:48                   ` Martin Liška
2017-11-06  9:58                     ` Paolo Carlini
2017-11-06 10:03                       ` Martin Liška
2017-11-06 10:09                         ` Paolo Carlini
2017-11-06 10:41                           ` Martin Liška
2017-11-06 11:40                             ` Paolo Carlini
2017-11-06 12:20                               ` Paolo Carlini
2017-11-06 13:38                                 ` Martin Liška
2017-11-06 13:58                                   ` Paolo Carlini
2017-11-06 14:12                                     ` Martin Liška
2017-11-06 21:17                                       ` [PATCH] Further -Wreturn-type testsuite fallout Jakub Jelinek
2017-11-15 13:33                                       ` [PATCH] Fix test-suite fallout of default -Wreturn-type Jonathan Wakely
2017-11-07 17:33             ` Andreas Schwab
2017-11-07 17:38               ` Jakub Jelinek
2017-11-08  8:02                 ` Andreas Schwab
2017-11-19 13:26             ` Thomas Schwinge
2017-11-20 13:58               ` Martin Liška
2017-11-20 14:14               ` Jason Merrill
2018-03-02 16:37                 ` Thomas Schwinge
2017-10-12 12:57         ` [PATCH][RFC] Instrument function exit with __builtin_unreachable in C++ Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).