Adjust text of expected warnings to g:b825a22890740f341eae566af27e18e528cd29a7.

gcc/testsuite/ChangeLog:
	* c-c++-common/goacc/uninit-use-device-clause.c: Adjust.
	* c-c++-common/pr59223.c: Same.
	* g++.dg/warn/Wnonnull5.C: Same.
	* gcc.dg/pr59924.c: Same.
	* gcc.dg/ubsan/pr81981.c: Same.
	* gcc.dg/ubsan/pr89284.c: Same.
	* gfortran.dg/goacc/uninit-use-device-clause.f95: Same.
This commit is contained in:
Martin Sebor 2020-06-05 09:34:39 -06:00
parent 89b49a963c
commit 300452d7bf
7 changed files with 116 additions and 8 deletions

View File

@ -8,7 +8,7 @@ foo (void)
{
int i;
#pragma acc host_data use_device(i) /* { dg-warning "is used uninitialized in this function" "" { xfail *-*-* } } */
#pragma acc host_data use_device(i) /* { dg-warning "is used uninitialized" "" { xfail *-*-* } } */
{
}
}

View File

@ -9,5 +9,5 @@ int foo (int x)
y = 1;
else if (x == 1)
y = 2;
return y; /* { dg-warning "may be used uninitialized in this function" } */
return y; /* { dg-warning "may be used uninitialized" } */
}

View File

@ -0,0 +1,108 @@
/* PR c++/86568 - -Wnonnull warnings should highlight the relevant argument
not the closing parenthesis.
{ dg-do compile }
{ dg-options "-O2 -Wall" } */
#define NONNULL __attribute__ ((nonnull))
#if __cplusplus < 201103L
# define nullptr __null
#endif
struct S
{
void
f0 (const void*) const; // { dg-message "in a call to non-static member function 'void S::f0\\(const void\\*\\) const'" }
void
f1 (const void*) const; // { dg-message "in a call to non-static member function 'void S::f1\\(const void\\*\\) const'" }
void
f2 (const void*) const; // { dg-message "in a call to non-static member function 'void S::f2\\(const void\\*\\) const'" }
NONNULL void
f3 (const void*, const void*); // { dg-message "in a call to function 'void S::f3\\(const void\\*, const void\\*\\)' declared 'nonnull'" }
NONNULL void
f4 (const void*, const void*); // { dg-message "in a call to function 'void S::f4\\(const void\\*, const void\\*\\)' declared 'nonnull'" }
NONNULL void
f5 (const void*, const void*); // { dg-message "in a call to function 'void S::f5\\\(const void\\*, const void\\*\\)' declared 'nonnull'" }
NONNULL void
f6 (const void*, const void*); // { dg-message "in a call to function 'void S::f6\\\(const void\\*, const void\\*\\)' declared 'nonnull'" }
};
void warn_nullptr_this ()
{
((S*)nullptr)->f0 (""); // { dg-warning "3:'this' pointer null" "pr86568" { xfail *-*-* } }
// { dg-warning "this' pointer null" "pr86568" { target *-*-* } .-1 }
}
void warn_null_this_cst ()
{
S* const null = 0;
null->f1 (""); // { dg-warning "3:'this' pointer null" }
}
void warn_null_this_var ()
{
S* null = 0;
null->f2 (&null); // { dg-warning "3:'this' pointer null" "pr86568" { xfail *-*-* } }
// { dg-warning "'this' pointer null" "pr86568" { target *-*-* } .-1 }
}
void warn_nullptr (S s)
{
s.f3 (nullptr, &s); // { dg-warning "9:argument 1 null where non-null expected" "pr86568" { xfail *-*-* } }
// { dg-warning "argument 1 null where non-null expected" "pr86568" { target *-*-* } .-1 }
s.f3 (&s, nullptr); // { dg-warning "13:argument 2 null where non-null expected" "pr86568" { xfail *-*-* } }
// { dg-warning "argument 2 null where non-null expected" "pr86568" { target *-*-* } .-1 }
}
void warn_null_cst (S s)
{
void* const null = 0;
s.f4 (null, &s); // { dg-warning "9:argument 1 null where non-null expected" }
s.f4 (&s, null); // { dg-warning "13:argument 2 null where non-null expected" }
}
void warn_null_var (S s)
{
void* null = 0;
s.f5 (null, &s); // { dg-warning "9:argument 1 null where non-null expected" "pr86568" { xfail *-*-* } }
// { dg-warning "argument 1 null where non-null expected" "pr86568" { target *-*-* } .-1 }
s.f5 (&s, null); // { dg-warning "16:argument 2 null where non-null expected" "pr86568" { xfail *-*-* } }
// { dg-warning "argument 2 null where non-null expected" "pr86568" { target *-*-* } .-1 }
}
void warn_null_cond (S s, void *null)
{
if (null)
return;
s.f6 (null, &s); // { dg-warning "9:argument 1 null where non-null expected" "pr86568" { xfail *-*-* } }
// { dg-warning "argument 1 null where non-null expected" "pr86568" { target *-*-* } .-1 }
s.f6 (&s, null); // { dg-warning "13:argument 2 null where non-null expected" "pr86568" { xfail *-*-* } }
// { dg-warning "argument 2 null where non-null expected" "pr86568" { target *-*-* } .-1 }
}
typedef NONNULL void Fvp (const void*, const void*);
void warn_fptr_null_cst (Fvp *p)
{
void* const null = 0;
p (null, ""); // { dg-warning "6:argument 1 null where non-null expected" }
p ("", null); // { dg-warning "10:argument 2 null where non-null expected" }
}
typedef NONNULL void (S::*SMemFvp) (const void*, const void*);
void warn_memfptr_null_cst (S *p, SMemFvp pmf)
{
void* const null = 0;
(p->*pmf) (null, ""); // { dg-warning "14:argument 1 null where non-null expected" }
(p->*pmf) ("", null); // { dg-warning "18:argument 2 null where non-null expected" }
}

View File

@ -21,7 +21,7 @@ foo (struct S * x, int y, int z, int w)
}
if (y != 0 || z != 0)
{
double g = x->b + (double) e * (double) y; /* { dg-warning "may be used uninitialized in this function" } */
double g = x->b + (double) e * (double) y; /* { dg-warning "may be used uninitialized" } */
bar (g * g);
}
}

View File

@ -16,6 +16,6 @@ foo (int i)
u[0] = i;
}
v = u[0]; /* { dg-warning "may be used uninitialized in this function" } */
return t[0]; /* { dg-warning "may be used uninitialized in this function" } */
v = u[0]; /* { dg-warning "may be used uninitialized" } */
return t[0]; /* { dg-warning "may be used uninitialized" } */
}

View File

@ -8,7 +8,7 @@ int
foo (void)
{
struct A a;
if (a.i) /* { dg-warning "'a.i' is used uninitialized in this function" } */
if (a.i) /* { dg-warning "'a.i' is used uninitialized" } */
return 1;
return 0;
}
@ -17,7 +17,7 @@ int
bar (void)
{
struct A a;
if (a.a) /* { dg-warning "'a.a' is used uninitialized in this function" } */
if (a.a) /* { dg-warning "'a.a' is used uninitialized" } */
return 1;
return 0;
}

View File

@ -4,7 +4,7 @@
subroutine test
integer, pointer :: p
!$acc host_data use_device(p) ! { dg-warning "is used uninitialized in this function" }
!$acc host_data use_device(p) ! { dg-warning "is used uninitialized" }
!$acc end host_data
end subroutine test