diff mbox series

Fix all tests that fail with -sanitize=return.

Message ID f1de41af-8e45-1180-e427-4c22a158a71e@suse.cz
State New
Headers show
Series Fix all tests that fail with -sanitize=return. | expand

Commit Message

Martin Liška Oct. 18, 2017, 12:47 p.m. UTC
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

Comments

Jason Merrill Oct. 24, 2017, 2:35 p.m. UTC | #1
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
Martin Liška Nov. 6, 2017, 8:48 a.m. UTC | #2
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
diff mbox series

Patch

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