Commit 99b68476 by Tom de Vries Committed by Tom de Vries

Replace absolute line numbers in g++.dg/warn

2017-05-04  Tom de Vries  <tom@codesourcery.com>

	PR testsuite/80557
	* g++.dg/warn/Wstrict-aliasing-float-ref-int-obj.C: Replace absolute
	line numbers.
	* g++.dg/warn/miss-format-1.C: Same.
	* g++.dg/warn/overflow-warn-1.C: Same.
	* g++.dg/warn/overflow-warn-3.C: Same.
	* g++.dg/warn/overflow-warn-4.C: Same.

From-SVN: r247580
parent 09177a4b
2017-05-04 Tom de Vries <tom@codesourcery.com> 2017-05-04 Tom de Vries <tom@codesourcery.com>
PR testsuite/80557 PR testsuite/80557
* g++.dg/warn/Wstrict-aliasing-float-ref-int-obj.C: Replace absolute
line numbers.
* g++.dg/warn/miss-format-1.C: Same.
* g++.dg/warn/overflow-warn-1.C: Same.
* g++.dg/warn/overflow-warn-3.C: Same.
* g++.dg/warn/overflow-warn-4.C: Same.
2017-05-04 Tom de Vries <tom@codesourcery.com>
PR testsuite/80557
* gcc.target/i386/pr57655.c: Replace absolute line numbers. * gcc.target/i386/pr57655.c: Replace absolute line numbers.
* gcc.target/i386/pr68657.c: Same. * gcc.target/i386/pr68657.c: Same.
* gcc.target/i386/pr69255-1.c: Same. * gcc.target/i386/pr69255-1.c: Same.
......
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
int foo() { int foo() {
int x; int x;
float& q = reinterpret_cast<float&> (x); /* { dg-message "dereferencing type-punned" "deref" } */ float& q = reinterpret_cast<float&> (x); /* { dg-message "dereferencing type-punned" "deref" } */
/* { dg-message "initialized" "note" { xfail *-*-* } .-1 } */
q = 1.0; /* { dg-warning "does break strict-aliasing" "strict-aliasing" { xfail *-*-* } } */ q = 1.0; /* { dg-warning "does break strict-aliasing" "strict-aliasing" { xfail *-*-* } } */
return x; return x;
} }
/* { dg-message "initialized" "note" { xfail *-*-* } 7 } */
...@@ -3,8 +3,6 @@ ...@@ -3,8 +3,6 @@
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-Wmissing-format-attribute" } */ /* { dg-options "-Wmissing-format-attribute" } */
/* { dg-options "-Wmissing-format-attribute -Wno-abi" { target arm_eabi } } */ /* { dg-options "-Wmissing-format-attribute -Wno-abi" { target arm_eabi } } */
/* VxWorks does not provide vscanf, either in kernel or RTP mode. */
/* { dg-error "not declared" "" { target *-*-vxworks* } 26 } */
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
...@@ -24,6 +22,8 @@ bar (const char *fmt, ...) ...@@ -24,6 +22,8 @@ bar (const char *fmt, ...)
va_list ap; va_list ap;
va_start (ap, fmt); va_start (ap, fmt);
vscanf (fmt, ap); /* { dg-warning "candidate" "scanf attribute warning" { xfail *-*-vxworks* } } */ vscanf (fmt, ap); /* { dg-warning "candidate" "scanf attribute warning" { xfail *-*-vxworks* } } */
/* VxWorks does not provide vscanf, either in kernel or RTP mode. */
/* { dg-error "not declared" "" { target *-*-vxworks* } .-2 } */
va_end (ap); va_end (ap);
} }
......
...@@ -18,6 +18,7 @@ enum e { ...@@ -18,6 +18,7 @@ enum e {
whole expression violates the constraints. */ whole expression violates the constraints. */
E4 = 0 * (1 / 0), /* { dg-warning "division by zero" } */ E4 = 0 * (1 / 0), /* { dg-warning "division by zero" } */
/* { dg-error "enumerator value for 'E4' is not an integer constant" "enum error" { target c++ } .-1 } */ /* { dg-error "enumerator value for 'E4' is not an integer constant" "enum error" { target c++ } .-1 } */
/* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } .-2 } */
E5 = INT_MAX + 1, /* { dg-warning "integer overflow in expression" } */ E5 = INT_MAX + 1, /* { dg-warning "integer overflow in expression" } */
/* { dg-warning "overflow in constant expression" "constant" { target *-*-* } .-1 } */ /* { dg-warning "overflow in constant expression" "constant" { target *-*-* } .-1 } */
/* Again, overflow in evaluated subexpression. */ /* Again, overflow in evaluated subexpression. */
...@@ -30,6 +31,9 @@ enum e { ...@@ -30,6 +31,9 @@ enum e {
struct s { struct s {
int a; int a;
int : 0 * (1 / 0); /* { dg-warning "division by zero" } */ int : 0 * (1 / 0); /* { dg-warning "division by zero" } */
/* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } .-1 } */
/* { dg-error "width not an integer constant" "bit.field" { target c++ } .-2 } */
/* { dg-error "is not a constant expression" "division" { target c++ } .-3 } */
int : 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } */ int : 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } */
/* { dg-warning "overflow in constant expression" "constant" { target *-*-* } .-1 } */ /* { dg-warning "overflow in constant expression" "constant" { target *-*-* } .-1 } */
}; };
...@@ -53,16 +57,25 @@ void *n = 0; ...@@ -53,16 +57,25 @@ void *n = 0;
subexpression, so is a null pointer constant. */ subexpression, so is a null pointer constant. */
void *p = 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } */ void *p = 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } */
/* { dg-warning "invalid conversion from 'int' to 'void" "null" { target *-*-* } .-1 } */ /* { dg-warning "invalid conversion from 'int' to 'void" "null" { target *-*-* } .-1 } */
void *q = 0 * (1 / 0); /* { dg-warning "division by zero" } */
/* { dg-error "invalid conversion from 'int' to 'void*'" "null" { xfail *-*-* } .-1 } */ void *q = 0 * (1 / 0);
void *r = (1 ? 0 : INT_MAX+1); /* { dg-bogus "integer overflow in expression" "" { xfail *-*-* } } */ /* { dg-warning "division by zero" "" { target *-*-* } .-1 } */
/* { dg-error "invalid conversion from 'int' to 'void*'" "null" { xfail *-*-* } .-2 } */
/* { dg-warning "invalid conversion from" "convert" { target *-*-* } .-3 } */
void *r = (1 ? 0 : INT_MAX+1);
/* { dg-bogus "integer overflow in expression" "" { xfail *-*-* } .-1 } */
/* { dg-warning "invalid conversion from" "convert" { target c++11 } .-2 } */
void void
g (int i) g (int i)
{ {
switch (i) switch (i)
{ {
case 0 * (1/0): /* { dg-warning "division by zero" } */ case 0 * (1/0):
/* { dg-warning "division by zero" "" { target *-*-* } .-1 } */
/* { dg-error "division by zero is not a constant expression" "division" { target c++11 } .-2 } */
/* { dg-error "is not a constant expression" "const" { target *-*-* } .-3 } */
; ;
case 1 + 0 * (INT_MAX + 1): /* { dg-warning "integer overflow in expression" } */ case 1 + 0 * (INT_MAX + 1): /* { dg-warning "integer overflow in expression" } */
/* { dg-warning "overflow in constant expression" "constant" { target *-*-* } .-1 } */ /* { dg-warning "overflow in constant expression" "constant" { target *-*-* } .-1 } */
...@@ -126,11 +139,3 @@ h2i (int x) ...@@ -126,11 +139,3 @@ h2i (int x)
ui = INT_MIN; ui = INT_MIN;
ui = x ? INT_MIN : 1U; ui = x ? INT_MIN : 1U;
} }
/* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } 19 } */
/* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } 32 } */
/* { dg-warning "invalid conversion from" "convert" { target *-*-* } 56 } */
/* { dg-warning "invalid conversion from" "convert" { target c++11 } 58 } */
/* { dg-error "division by zero is not a constant expression" "division" { target c++11 } 65 } */
/* { dg-error "is not a constant expression" "const" { target *-*-* } 65 } */
/* { dg-error "width not an integer constant" "bit.field" { target c++ } 32 } */
/* { dg-error "is not a constant expression" "division" { target c++ } 32 } */
...@@ -18,6 +18,7 @@ enum e { ...@@ -18,6 +18,7 @@ enum e {
whole expression violates the constraints. */ whole expression violates the constraints. */
E4 = 0 * (1 / 0), /* { dg-warning "division by zero" } */ E4 = 0 * (1 / 0), /* { dg-warning "division by zero" } */
/* { dg-error "enumerator value for 'E4' is not an integer constant" "enum error" { target c++ } .-1 } */ /* { dg-error "enumerator value for 'E4' is not an integer constant" "enum error" { target c++ } .-1 } */
/* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } .-2 } */
E5 = INT_MAX + 1, /* { dg-warning "integer overflow in expression" } */ E5 = INT_MAX + 1, /* { dg-warning "integer overflow in expression" } */
/* { dg-warning "overflow in constant expression" "constant" { target *-*-* } .-1 } */ /* { dg-warning "overflow in constant expression" "constant" { target *-*-* } .-1 } */
/* Again, overflow in evaluated subexpression. */ /* Again, overflow in evaluated subexpression. */
...@@ -29,7 +30,11 @@ enum e { ...@@ -29,7 +30,11 @@ enum e {
struct s { struct s {
int a; int a;
int : 0 * (1 / 0); /* { dg-warning "division by zero" } */ int : 0 * (1 / 0);
/* { dg-warning "division by zero" "" { target *-*-* } .-1 } */
/* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } .-2 } */
/* { dg-error "width not an integer constant" "bit.field" { target c++ } .-3 } */
/* { dg-error "is not a constant expression" "division" { target c++ } .-4 } */
int : 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } */ int : 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } */
/* { dg-warning "overflow in constant expression" "constant" { target *-*-* } .-1 } */ /* { dg-warning "overflow in constant expression" "constant" { target *-*-* } .-1 } */
}; };
...@@ -57,15 +62,20 @@ void *p = 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } ...@@ -57,15 +62,20 @@ void *p = 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" }
void *q = 0 * (1 / 0); /* { dg-warning "division by zero" } */ void *q = 0 * (1 / 0); /* { dg-warning "division by zero" } */
/* { dg-warning "invalid conversion from 'int' to 'void" "null" { target *-*-* } .-1 } */ /* { dg-warning "invalid conversion from 'int' to 'void" "null" { target *-*-* } .-1 } */
void *r = (1 ? 0 : INT_MAX+1); /* { dg-bogus "integer overflow in expression" "" { xfail *-*-* } } */ void *r = (1 ? 0 : INT_MAX+1);
/* { dg-bogus "integer overflow in expression" "" { xfail *-*-* } .-1 } */
/* { dg-warning "invalid conversion from" "convert" { target c++11 } .-2 } */
void void
g (int i) g (int i)
{ {
switch (i) switch (i)
{ {
case 0 * (1/0): /* { dg-warning "division by zero" } */ case 0 * (1/0):
; /* { dg-error "division by zero is not a constant expression" "division" { target c++11 } .-1 } */ /* { dg-warning "division by zero" "" { target *-*-* } .-1 } */
/* { dg-error "division by zero is not a constant expression" "division" { target c++11 } .-2 } */
/* { dg-error "not a constant expression" "constant" { target *-*-* } .-3 } */
;
case 1 + 0 * (INT_MAX + 1): /* { dg-warning "integer overflow in expression" } */ case 1 + 0 * (INT_MAX + 1): /* { dg-warning "integer overflow in expression" } */
/* { dg-warning "overflow in constant expression" "constant" { target *-*-* } .-1 } */ /* { dg-warning "overflow in constant expression" "constant" { target *-*-* } .-1 } */
; ;
...@@ -128,9 +138,3 @@ h2i (int x) ...@@ -128,9 +138,3 @@ h2i (int x)
ui = INT_MIN; ui = INT_MIN;
ui = x ? INT_MIN : 1U; ui = x ? INT_MIN : 1U;
} }
/* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } 19 } */
/* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } 32 } */
/* { dg-warning "invalid conversion from" "convert" { target c++11 } 60 } */
/* { dg-error "not a constant expression" "constant" { target *-*-* } 67 } */
/* { dg-error "width not an integer constant" "bit.field" { target c++ } 32 } */
/* { dg-error "is not a constant expression" "division" { target c++ } 32 } */
...@@ -18,6 +18,7 @@ enum e { ...@@ -18,6 +18,7 @@ enum e {
whole expression violates the constraints. */ whole expression violates the constraints. */
E4 = 0 * (1 / 0), /* { dg-warning "division by zero" } */ E4 = 0 * (1 / 0), /* { dg-warning "division by zero" } */
/* { dg-error "enumerator value for 'E4' is not an integer constant" "enum error" { target c++ } .-1 } */ /* { dg-error "enumerator value for 'E4' is not an integer constant" "enum error" { target c++ } .-1 } */
/* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } .-2 } */
E5 = INT_MAX + 1, /* { dg-warning "integer overflow in expression" } */ E5 = INT_MAX + 1, /* { dg-warning "integer overflow in expression" } */
/* { dg-error "overflow in constant expression" "constant" { target *-*-* } .-1 } */ /* { dg-error "overflow in constant expression" "constant" { target *-*-* } .-1 } */
/* { dg-error "enumerator value for 'E5' is not an integer constant" "enum error" { target *-*-* } .-2 } */ /* { dg-error "enumerator value for 'E5' is not an integer constant" "enum error" { target *-*-* } .-2 } */
...@@ -32,6 +33,9 @@ enum e { ...@@ -32,6 +33,9 @@ enum e {
struct s { struct s {
int a; int a;
int : 0 * (1 / 0); /* { dg-warning "division by zero" } */ int : 0 * (1 / 0); /* { dg-warning "division by zero" } */
/* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } .-1 } */
/* { dg-error "width not an integer constant" "bit.field" { target c++ } .-2 } */
/* { dg-error "is not a constant expression" "division" { target c++ } .-3 } */
int : 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } */ int : 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } */
/* { dg-error "overflow in constant expression" "constant" { target *-*-* } .-1 } */ /* { dg-error "overflow in constant expression" "constant" { target *-*-* } .-1 } */
/* { dg-error "bit-field .* width not an integer constant" "" { target *-*-* } .-2 } */ /* { dg-error "bit-field .* width not an integer constant" "" { target *-*-* } .-2 } */
...@@ -60,15 +64,21 @@ void *p = 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } ...@@ -60,15 +64,21 @@ void *p = 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" }
void *q = 0 * (1 / 0); /* { dg-warning "division by zero" } */ void *q = 0 * (1 / 0); /* { dg-warning "division by zero" } */
/* { dg-error "invalid conversion from 'int' to 'void" "null" { target *-*-* } .-1 } */ /* { dg-error "invalid conversion from 'int' to 'void" "null" { target *-*-* } .-1 } */
void *r = (1 ? 0 : INT_MAX+1); /* { dg-bogus "integer overflow in expression" "" { xfail *-*-* } } */
void *r = (1 ? 0 : INT_MAX+1);
/* { dg-bogus "integer overflow in expression" "" { xfail *-*-* } .-1 } */
/* { dg-error "invalid conversion from" "convert" { target c++11 } .-2 } */
void void
g (int i) g (int i)
{ {
switch (i) switch (i)
{ {
case 0 * (1/0): /* { dg-warning "division by zero" } */ case 0 * (1/0):
; /* { dg-error "division by zero is not a constant expression" "division" { target c++11 } .-1 } */ /* { dg-warning "division by zero" "" { target *-*-* } .-1 } */
/* { dg-error "division by zero is not a constant expression" "division" { target c++11 } .-2 } */
/* { dg-error "is not a constant expression" "const" { target *-*-* } .-3 } */
;
case 1 + 0 * (INT_MAX + 1): /* { dg-warning "integer overflow in expression" } */ case 1 + 0 * (INT_MAX + 1): /* { dg-warning "integer overflow in expression" } */
/* { dg-error "overflow in constant expression" "constant" { target *-*-* } .-1 } */ /* { dg-error "overflow in constant expression" "constant" { target *-*-* } .-1 } */
; ;
...@@ -131,9 +141,3 @@ h2i (int x) ...@@ -131,9 +141,3 @@ h2i (int x)
ui = INT_MIN; ui = INT_MIN;
ui = x ? INT_MIN : 1U; ui = x ? INT_MIN : 1U;
} }
/* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } 19 } */
/* { dg-error "invalid conversion from" "convert" { target c++11 } 63 } */
/* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } 34 } */
/* { dg-error "is not a constant expression" "const" { target *-*-* } 70 } */
/* { dg-error "width not an integer constant" "bit.field" { target c++ } 34 } */
/* { dg-error "is not a constant expression" "division" { target c++ } 34 } */
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