Commit 23dbc169 by Martin Liska Committed by Martin Liska

Fix all tests that fail with -sanitize=return.

2017-11-06  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.

From-SVN: r254438
parent 1b6fa695
2017-11-06 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.
2017-11-05 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/82471
......
......@@ -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;
}
......
......@@ -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);
......
......@@ -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; }())
......
......@@ -14,6 +14,8 @@ template<typename T> T foo()
sum += x;
if (sum != T(10))
abort();
return sum;
}
int main()
......
......@@ -23,7 +23,7 @@ template<>
operator"" _abc<'6','6','6'>()
{ return 21; }
int
void
test1()
{
int i = operator"" _abc<'1','2','3'>();
......
......@@ -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)
......
......@@ -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();
......
......@@ -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);
......
......@@ -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++)
......
......@@ -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)
{
......
......@@ -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)
{
......
......@@ -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
......
/* { 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" } } */
......@@ -53,6 +53,8 @@ UINT32 bar (const C * sPtr)
if (a.xy[0] != ((SINT16) 0xffff << 2))
abort ();
return 0;
}
int main()
......
......@@ -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()
{
......
......@@ -50,6 +50,8 @@ E::c ()
if (x > 10)
throw 1;
x |= 2;
return x;
}
int
......
......@@ -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
{
......
......@@ -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() {}
......
......@@ -65,6 +65,8 @@ bool
jump = 0;
}
}
return false;
}
bool
......@@ -102,4 +104,5 @@ bool
}
}
return true;
}
......@@ -21,6 +21,7 @@ void f()
void *thread_main(void *)
{
f(); f(); f();
return 0;
}
#include <pthread.h>
......
......@@ -19,6 +19,7 @@ thread_local A a;
void *thread_main(void *)
{
A* ap = &a;
return 0;
}
#include <pthread.h>
......
......@@ -30,6 +30,7 @@ void f()
void *thread_main(void *)
{
f(); f(); f();
return 0;
}
int main()
......
......@@ -28,6 +28,7 @@ thread_local A a;
void *thread_main(void *)
{
A* ap = &a;
return 0;
}
int main()
......
......@@ -22,6 +22,7 @@ void f()
void *thread_main(void *)
{
f(); f(); f();
return 0;
}
int main()
......
......@@ -20,6 +20,7 @@ thread_local A a;
void *thread_main(void *)
{
A* ap = &a;
return 0;
}
int main()
......
......@@ -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) {
......
......@@ -11,6 +11,8 @@ fn2 ()
{
if (a (c == 0))
return 0;
return 0;
}
int main()
......
......@@ -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
......
/* { 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 ()
......
......@@ -15,4 +15,6 @@ int test() {
//
std::string s = "";
s += 'x' + "y"; // { dg-warning "bounds of constant string" }
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment