]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
2007-01-08 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
authormanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 8 Jan 2007 21:04:26 +0000 (21:04 +0000)
committermanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 8 Jan 2007 21:04:26 +0000 (21:04 +0000)
testsuite/
* g++.dg/warn/overflow-warn-1.C: Fix testcase.
* g++.dg/warn/overflow-warn-3.C: Likewise.
* g++.dg/warn/overflow-warn-4.C: Likewise.
* g++.dg/warn/overflow-warn-5.C: Likewise.
* g++.dg/warn/overflow-warn-6.C: Likewise.
* g++.dg/warn/Woverflow-1.C: Likewise.
* g++.dg/warn/Woverflow-2.C: Likewise.
* g++.dg/warn/Woverflow-3.C: Likewise.
* g++.dg/warn/multiple-overflow-warn-2.C: Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@120588 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/warn/Woverflow-1.C
gcc/testsuite/g++.dg/warn/Woverflow-2.C
gcc/testsuite/g++.dg/warn/Woverflow-3.C
gcc/testsuite/g++.dg/warn/multiple-overflow-warn-2.C
gcc/testsuite/g++.dg/warn/overflow-warn-1.C
gcc/testsuite/g++.dg/warn/overflow-warn-3.C
gcc/testsuite/g++.dg/warn/overflow-warn-4.C
gcc/testsuite/g++.dg/warn/overflow-warn-5.C
gcc/testsuite/g++.dg/warn/overflow-warn-6.C

index 8da20bc382a0ab5bf2a355f1cf22136efb4ed469..af17631dbb32cacd25f67cafc68fcc4644e40cdd 100644 (file)
@@ -1,3 +1,15 @@
+2007-01-08  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>
+
+       * g++.dg/warn/overflow-warn-1.C: Fix testcase.
+       * g++.dg/warn/overflow-warn-3.C: Likewise.
+       * g++.dg/warn/overflow-warn-4.C: Likewise.
+       * g++.dg/warn/overflow-warn-5.C: Likewise.
+       * g++.dg/warn/overflow-warn-6.C: Likewise.
+       * g++.dg/warn/Woverflow-1.C: Likewise.
+       * g++.dg/warn/Woverflow-2.C: Likewise.
+       * g++.dg/warn/Woverflow-3.C: Likewise.
+       * g++.dg/warn/multiple-overflow-warn-2.C: Likewise.
+
 2007-01-08  Roger Sayle  <roger@eyesopen.com>
 
        * gfortran.dg/array_constructor_14.f90: New test case.
index 66750472e7493f855fbbe4080958957ee302b4eb..064af4561eaa6a710043afdcefd01d1a464b3eda 100644 (file)
@@ -5,17 +5,3 @@
 
 int foo = INT_MAX + 1;  /* { dg-warning "integer overflow" } */
 
-/* { dg-do compile } */
-/* { dg-options "-O2" } */
-
-#include <limits.h>
-
-int foo = INT_MAX + 1;  /* { dg-warning "integer overflow" } */
-
-/* { dg-do compile } */
-/* { dg-options "-O2" } */
-
-#include <limits.h>
-
-int foo = INT_MAX + 1;  /* { dg-warning "integer overflow" } */
-
index 392a5ee3e5ae5c2f8216c0838d068b0a34339338..44368b66f9f739daf2b19f0ff847b98caa9bde4a 100644 (file)
@@ -5,17 +5,3 @@
 
 int foo = INT_MAX + 1;  /* { dg-warning "integer overflow" } */
 
-/* { dg-do compile } */
-/* { dg-options "-O2 -Woverflow" } */
-
-#include <limits.h>
-
-int foo = INT_MAX + 1;  /* { dg-warning "integer overflow" } */
-
-/* { dg-do compile } */
-/* { dg-options "-O2 -Woverflow" } */
-
-#include <limits.h>
-
-int foo = INT_MAX + 1;  /* { dg-warning "integer overflow" } */
-
index d3b8afad41683e9b11a56b40c4ec4415a52dab77..73a021b59460a4a7da0c96ba7b9d269f926b6ac5 100644 (file)
@@ -5,17 +5,3 @@
 
 int foo = INT_MAX + 1;
 
-/* { dg-do compile } */
-/* { dg-options "-O2 -Wno-overflow" } */
-
-#include <limits.h>
-
-int foo = INT_MAX + 1;
-
-/* { dg-do compile } */
-/* { dg-options "-O2 -Wno-overflow" } */
-
-#include <limits.h>
-
-int foo = INT_MAX + 1;
-
index aa7f40bc7933713f2a282636e7a24f36781a6e01..863016bfd68fc20421043ed81c418f303a5aeaf3 100644 (file)
@@ -10,27 +10,3 @@ g1 (void)
   return INT_MAX + 1 - INT_MAX; /* { dg-bogus "integer overflow in expression.*integer overflow in expression" } */
   /* { dg-warning "integer overflow in expression" "" { target *-*-* } 10 } */
 }
-/* PR c/19978 : Test for duplicated warnings (binary operators).  */
-/* { dg-do compile } */
-/* { dg-options "-Woverflow" } */
-
-#include <limits.h>
-
-int 
-g1 (void)
-{
-  return INT_MAX + 1 - INT_MAX; /* { dg-bogus "integer overflow in expression.*integer overflow in expression" } */
-  /* { dg-warning "integer overflow in expression" "" { target *-*-* } 10 } */
-}
-/* PR c/19978 : Test for duplicated warnings (binary operators).  */
-/* { dg-do compile } */
-/* { dg-options "-Woverflow" } */
-
-#include <limits.h>
-
-int 
-g1 (void)
-{
-  return INT_MAX + 1 - INT_MAX; /* { dg-bogus "integer overflow in expression.*integer overflow in expression" } */
-  /* { dg-warning "integer overflow in expression" "" { target *-*-* } 10 } */
-}
index d87774f136ad29e117b80b45a653623299666834..1c6c849990b505375bc6e61c0c66f9683274f548 100644 (file)
@@ -43,251 +43,6 @@ f (void)
 static int sc = INT_MAX + 1; /* { dg-warning "warning: integer overflow in expression" } */
 
 
-// Test for overflow in null pointer constant.  
-void *n = 0;
-/* The first two of these involve overflow, so are not null pointer
-   constants.  The third has the overflow in an unevaluated
-   subexpression, so is a null pointer constant.  */
-void *p = 0 * (INT_MAX + 1); /* { dg-warning "warning: integer overflow in expression" } */
-/* { dg-error "invalid conversion from 'int' to 'void" "null" { target *-*-* } 51 } */
-void *q = 0 * (1 / 0); /* { dg-warning "warning: division by zero" } */
-/* { dg-error "invalid conversion from 'int' to 'void*'" "null" { xfail *-*-* } 53 } */
-void *r = (1 ? 0 : INT_MAX+1); /* { dg-bogus "integer overflow in expression" "" { xfail *-*-* } 55 } */
-
-void
-g (int i)
-{
-  switch (i)
-    {
-    case 0 * (1/0): /* { dg-warning "warning: division by zero" } */
-      ;
-    case 1 + 0 * (INT_MAX + 1): /* { dg-warning "warning: integer overflow in expression" } */
-      ;
-    }
-}
-
-int
-h (void)
-{
-  return INT_MAX + 1; /* { dg-warning "warning: integer overflow in expression" } */
-}
-
-int
-h1 (void)
-{
-  return INT_MAX + 1 - INT_MAX; /* { dg-warning "warning: integer overflow in expression" } */
-}
-
-void fuc (unsigned char);
-void fsc (signed char);
-
-void
-h2 (void)
-{
-  fsc (SCHAR_MAX + 1);
-  fsc (SCHAR_MIN - 1); /* { dg-warning "warning: overflow in implicit constant conversion" } */
-  fsc (UCHAR_MAX);
-  fsc (UCHAR_MAX + 1); /* { dg-warning "warning: overflow in implicit constant conversion" } */
-  fuc (-1);
-  fuc (UCHAR_MAX + 1); /* { dg-warning "warning: large integer implicitly truncated to unsigned type" } */
-  fuc (SCHAR_MIN);
-  fuc (SCHAR_MIN - 1); /* { dg-warning "warning: large integer implicitly truncated to unsigned type" } */
-  fuc (-UCHAR_MAX); /* { dg-warning "warning: large integer implicitly truncated to unsigned type" } */
-}
-
-void fui (unsigned int);
-void fsi (signed int);
-
-int si;
-unsigned ui;
-
-void
-h2i (int x)
-{
-  /* For some reason, we only give certain warnings for implicit
-     conversions among values of the same precision with -Wconversion,
-     while we don't give others at all.  */
-  fsi ((unsigned)INT_MAX + 1);
-  si = (unsigned)INT_MAX + 1;
-  si = x ? (unsigned)INT_MAX + 1 : 1;
-  fsi ((unsigned)INT_MAX + 2);
-  si = (unsigned)INT_MAX + 2;
-  si = x ? (unsigned)INT_MAX + 2 : 1;
-  fsi (UINT_MAX);
-  si = UINT_MAX;
-  fui (-1);
-  ui = -1;
-  ui = x ? -1 : 1U;
-  fui (INT_MIN);
-  ui = INT_MIN;
-  ui = x ? INT_MIN : 1U;
-}
-/* Test for diagnostics for constant overflow.  */
-/* Origin: Joseph Myers <joseph@codesourcery.com> */
-/* { dg-do compile } */
-/* { dg-options "" } */
-
-#include <limits.h>
-
-enum e {
-  E0 = INT_MAX,
-  /* Unsigned overflow wraps around.  */
-  E1 = UINT_MAX + 1,
-  /* Overflow in an unevaluated part of an expression is OK (example
-     in the standard).  */
-  E2 = 2 || 1 / 0, /* { dg-bogus "warning: division by zero" "" { xfail *-*-* } 14 } */
-  E3 = 1 / 0, /* { dg-warning "warning: division by zero" } */
-  /* { dg-error "error: enumerator value for 'E3' is not an integer constant" "enum error" { target *-*-* } 15 } */
-  /* But as in DR#031, the 1/0 in an evaluated subexpression means the
-     whole expression violates the constraints.  */
-  E4 = 0 * (1 / 0), /* { dg-warning "warning: division by zero" } */
-  /* { dg-error "error: enumerator value for 'E4' is not an integer constant" "enum error" { xfail *-*-* } 19 } */
-  E5 = INT_MAX + 1, /* { dg-warning "warning: integer overflow in expression" } */
-  /* Again, overflow in evaluated subexpression.  */
-  E6 = 0 * (INT_MAX + 1), /* { dg-warning "warning: integer overflow in expression" } */
-  /* A cast does not constitute overflow in conversion.  */
-  E7 = (char) INT_MAX
-};
-
-struct s {
-  int a;
-  int : 0 * (1 / 0); /* { dg-warning "warning: division by zero" } */
-  int : 0 * (INT_MAX + 1); /* { dg-warning "warning: integer overflow in expression" } */
-};
-
-void
-f (void)
-{
-  /* This expression is not required to be a constant expression, so
-     it should just involve undefined behavior at runtime.  */
-  int c = INT_MAX + 1; /* { dg-warning "warning: integer overflow in expression" } */
-}
-
-/* But this expression does need to be constant.  */
-static int sc = INT_MAX + 1; /* { dg-warning "warning: integer overflow in expression" } */
-
-/* The first two of these involve overflow, so are not null pointer
-   constants.  The third has the overflow in an unevaluated
-   subexpression, so is a null pointer constant.  */
-void *p = 0 * (INT_MAX + 1); /* { dg-warning "warning: integer overflow in expression" } */
-/* { dg-error "invalid conversion from 'int' to 'void" "null" { target *-*-* } 48 } */
-void *q = 0 * (1 / 0); /* { dg-warning "warning: division by zero" } */
-/* { dg-error "invalid conversion from 'int' to 'void*'" "null" { xfail *-*-* } 50 } */
-void *r = (1 ? 0 : INT_MAX+1); /* { dg-bogus "integer overflow in expression" "" { xfail *-*-* } 52 } */
-
-void
-g (int i)
-{
-  switch (i)
-    {
-    case 0 * (1/0): /* { dg-warning "warning: division by zero" } */
-      ;
-    case 1 + 0 * (INT_MAX + 1): /* { dg-warning "warning: integer overflow in expression" } */
-      ;
-    }
-}
-
-int
-h (void)
-{
-  return INT_MAX + 1; /* { dg-warning "warning: integer overflow in expression" } */
-}
-
-int
-h1 (void)
-{
-  return INT_MAX + 1 - INT_MAX; /* { dg-warning "warning: integer overflow in expression" } */
-}
-
-void fuc (unsigned char);
-void fsc (signed char);
-
-void
-h2 (void)
-{
-  fsc (SCHAR_MAX + 1);
-  fsc (SCHAR_MIN - 1); /* { dg-warning "warning: overflow in implicit constant conversion" } */
-  fsc (UCHAR_MAX);
-  fsc (UCHAR_MAX + 1); /* { dg-warning "warning: overflow in implicit constant conversion" } */
-  fuc (-1);
-  fuc (UCHAR_MAX + 1); /* { dg-warning "warning: large integer implicitly truncated to unsigned type" } */
-  fuc (SCHAR_MIN);
-  fuc (SCHAR_MIN - 1); /* { dg-warning "warning: large integer implicitly truncated to unsigned type" } */
-  fuc (-UCHAR_MAX); /* { dg-warning "warning: large integer implicitly truncated to unsigned type" } */
-}
-
-void fui (unsigned int);
-void fsi (signed int);
-
-int si;
-unsigned ui;
-
-void
-h2i (int x)
-{
-  /* For some reason, we only give certain warnings for implicit
-     conversions among values of the same precision with -Wconversion,
-     while we don't give others at all.  */
-  fsi ((unsigned)INT_MAX + 1);
-  si = (unsigned)INT_MAX + 1;
-  si = x ? (unsigned)INT_MAX + 1 : 1;
-  fsi ((unsigned)INT_MAX + 2);
-  si = (unsigned)INT_MAX + 2;
-  si = x ? (unsigned)INT_MAX + 2 : 1;
-  fsi (UINT_MAX);
-  si = UINT_MAX;
-  fui (-1);
-  ui = -1;
-  ui = x ? -1 : 1U;
-  fui (INT_MIN);
-  ui = INT_MIN;
-  ui = x ? INT_MIN : 1U;
-}
-/* Test for diagnostics for constant overflow.  */
-/* Origin: Joseph Myers <joseph@codesourcery.com> */
-/* { dg-do compile } */
-/* { dg-options "" } */
-
-#include <limits.h>
-
-enum e {
-  E0 = INT_MAX,
-  /* Unsigned overflow wraps around.  */
-  E1 = UINT_MAX + 1,
-  /* Overflow in an unevaluated part of an expression is OK (example
-     in the standard).  */
-  E2 = 2 || 1 / 0, /* { dg-bogus "warning: division by zero" "" { xfail *-*-* } 14 } */
-  E3 = 1 / 0, /* { dg-warning "warning: division by zero" } */
-  /* { dg-error "error: enumerator value for 'E3' is not an integer constant" "enum error" { target *-*-* } 15 } */
-  /* But as in DR#031, the 1/0 in an evaluated subexpression means the
-     whole expression violates the constraints.  */
-  E4 = 0 * (1 / 0), /* { dg-warning "warning: division by zero" } */
-  /* { dg-error "error: enumerator value for 'E4' is not an integer constant" "enum error" { xfail *-*-* } 19 } */
-  E5 = INT_MAX + 1, /* { dg-warning "warning: integer overflow in expression" } */
-  /* Again, overflow in evaluated subexpression.  */
-  E6 = 0 * (INT_MAX + 1), /* { dg-warning "warning: integer overflow in expression" } */
-  /* A cast does not constitute overflow in conversion.  */
-  E7 = (char) INT_MAX
-};
-
-struct s {
-  int a;
-  int : 0 * (1 / 0); /* { dg-warning "warning: division by zero" } */
-  int : 0 * (INT_MAX + 1); /* { dg-warning "warning: integer overflow in expression" } */
-};
-
-void
-f (void)
-{
-  /* This expression is not required to be a constant expression, so
-     it should just involve undefined behavior at runtime.  */
-  int c = INT_MAX + 1; /* { dg-warning "warning: integer overflow in expression" } */
-}
-
-/* This expression is neither required to be constant.  */
-static int sc = INT_MAX + 1; /* { dg-warning "warning: integer overflow in expression" } */
-
-
 // Test for overflow in null pointer constant.  
 void *n = 0;
 /* The first two of these involve overflow, so are not null pointer
index a8651c9f645862e5b851c080eabe04d2831ec444..b449a49510384bd6e12b21a6242cebed716cb529 100644 (file)
@@ -47,264 +47,6 @@ f (void)
 static int sc = INT_MAX + 1; /* { dg-warning "warning: integer overflow in expression" } */
 
 
-// Test for overflow in null pointer constant.  
-void *n = 0;
-/* The first two of these involve overflow, so are not null pointer
-   constants.  The third has the overflow in an unevaluated
-   subexpression, so is a null pointer constant.  */
-void *p = 0 * (INT_MAX + 1); /* { dg-warning "warning: integer overflow in expression" } */
-/* { dg-error "invalid conversion from 'int' to 'void" "null" { target *-*-* } 55 } */
-
-void *q = 0 * (1 / 0); /* { dg-warning "warning: division by zero" } */
-/* { dg-error "invalid conversion from 'int' to 'void*'" "null" { xfail *-*-* } 58 } */
-void *r = (1 ? 0 : INT_MAX+1); /* { dg-bogus "integer overflow in expression" "" { xfail *-*-* } 60 } */
-
-void
-g (int i)
-{
-  switch (i)
-    {
-    case 0 * (1/0): /* { dg-warning "warning: division by zero" } */
-      ;
-    case 1 + 0 * (INT_MAX + 1): /* { dg-warning "warning: integer overflow in expression" } */
-      /* { dg-warning "warning: overflow in constant expression" "constant" { target *-*-* } 69 } */
-      ;
-    }
-}
-
-int
-h (void)
-{
-  return INT_MAX + 1; /* { dg-warning "warning: integer overflow in expression" } */
-}
-
-int
-h1 (void)
-{
-  return INT_MAX + 1 - INT_MAX; /* { dg-warning "warning: integer overflow in expression" } */
-}
-
-void fuc (unsigned char);
-void fsc (signed char);
-
-void
-h2 (void)
-{
-  fsc (SCHAR_MAX + 1); /* { dg-warning "warning: overflow in implicit constant conversion" } */
-  fsc (SCHAR_MIN - 1); /* { dg-warning "warning: overflow in implicit constant conversion" } */
-  fsc (UCHAR_MAX); /* { dg-warning "warning: overflow in implicit constant conversion" } */
-  fsc (UCHAR_MAX + 1); /* { dg-warning "warning: overflow in implicit constant conversion" } */
-  fuc (-1);
-  fuc (UCHAR_MAX + 1); /* { dg-warning "warning: large integer implicitly truncated to unsigned type" } */
-  fuc (SCHAR_MIN);
-  fuc (SCHAR_MIN - 1); /* { dg-warning "warning: large integer implicitly truncated to unsigned type" } */
-  fuc (-UCHAR_MAX); /* { dg-warning "warning: large integer implicitly truncated to unsigned type" } */
-}
-
-void fui (unsigned int);
-void fsi (signed int);
-
-int si;
-unsigned ui;
-
-void
-h2i (int x)
-{
-  /* For some reason, we only give certain warnings for implicit
-     conversions among values of the same precision with -Wconversion,
-     while we don't give others at all.  */
-  fsi ((unsigned)INT_MAX + 1);
-  si = (unsigned)INT_MAX + 1;
-  si = x ? (unsigned)INT_MAX + 1 : 1;
-  fsi ((unsigned)INT_MAX + 2);
-  si = (unsigned)INT_MAX + 2;
-  si = x ? (unsigned)INT_MAX + 2 : 1;
-  fsi (UINT_MAX);
-  si = UINT_MAX;
-  fui (-1);
-  ui = -1;
-  ui = x ? -1 : 1U;
-  fui (INT_MIN);
-  ui = INT_MIN;
-  ui = x ? INT_MIN : 1U;
-}
-/* Test for diagnostics for constant overflow.  Test with -pedantic.  */
-/* Origin: Joseph Myers <joseph@codesourcery.com> */
-/* { dg-do compile } */
-/* { dg-options "-fpermissive -pedantic" } */
-
-#include <limits.h>
-
-enum e {
-  E0 = INT_MAX,
-  /* Unsigned overflow wraps around.  */
-  E1 = UINT_MAX + 1,
-  /* Overflow in an unevaluated part of an expression is OK (example
-     in the standard).  */
-  E2 = 2 || 1 / 0, /* { dg-bogus "warning: division by zero" "" { xfail *-*-* } 14 } */
-  E3 = 1 / 0, /* { dg-warning "warning: division by zero" } */
-  /* { dg-error "error: enumerator value for 'E3' is not an integer constant" "enum error" { target *-*-* } 15 } */
-  /* But as in DR#031, the 1/0 in an evaluated subexpression means the
-     whole expression violates the constraints.  */
-  E4 = 0 * (1 / 0), /* { dg-warning "warning: division by zero" } */
-  /* { dg-error "error: enumerator value for 'E4' is not an integer constant" "enum error" { xfail *-*-* } 19 } */
-  E5 = INT_MAX + 1, /* { dg-warning "warning: integer overflow in expression" } */
-  /* { dg-warning "warning: overflow in constant expression" "constant" { target *-*-* } 21 } */
-  /* Again, overflow in evaluated subexpression.  */
-  E6 = 0 * (INT_MAX + 1), /* { dg-warning "warning: integer overflow in expression" } */
-  /* { dg-warning "warning: overflow in constant expression" "constant" { target *-*-* } 24 } */
-  /* A cast does not constitute overflow in conversion.  */
-  E7 = (char) INT_MAX
-};
-
-struct s {
-  int a;
-  int : 0 * (1 / 0); /* { dg-warning "warning: division by zero" } */
-  int : 0 * (INT_MAX + 1); /* { dg-warning "warning: integer overflow in expression" } */
-  /* { dg-warning "warning: overflow in constant expression" "constant" { target *-*-* } 33 } */
-};
-
-void
-f (void)
-{
-  /* This expression is not required to be a constant expression, so
-     it should just involve undefined behavior at runtime.  */
-  int c = INT_MAX + 1; /* { dg-warning "warning: integer overflow in expression" } */
-
-}
-
-/* But this expression does need to be constant (in C++ ???).  */
-static int sc = INT_MAX + 1; /* { dg-warning "warning: integer overflow in expression" } */
-/* { dg-warning "warning: overflow in constant expression" "constant" { xfail *-*-* } 47 } */
-
-/* The first two of these involve overflow, so are not null pointer
-   constants.  The third has the overflow in an unevaluated
-   subexpression, so is a null pointer constant.  */
-void *p = 0 * (INT_MAX + 1); /* { dg-warning "warning: integer overflow in expression" } */
-/* { dg-error "invalid conversion from 'int' to 'void" "null" { target *-*-* } 53 } */
-
-void *q = 0 * (1 / 0); /* { dg-warning "warning: division by zero" } */
-/* { dg-error "invalid conversion from 'int' to 'void*'" "null" { xfail *-*-* } 56 } */
-void *r = (1 ? 0 : INT_MAX+1); /* { dg-bogus "integer overflow in expression" "" { xfail *-*-* } 58 } */
-
-void
-g (int i)
-{
-  switch (i)
-    {
-    case 0 * (1/0): /* { dg-warning "warning: division by zero" } */
-      ;
-    case 1 + 0 * (INT_MAX + 1): /* { dg-warning "warning: integer overflow in expression" } */
-      /* { dg-warning "warning: overflow in constant expression" "constant" { target *-*-* } 67 } */
-      ;
-    }
-}
-
-int
-h (void)
-{
-  return INT_MAX + 1; /* { dg-warning "warning: integer overflow in expression" } */
-}
-
-int
-h1 (void)
-{
-  return INT_MAX + 1 - INT_MAX; /* { dg-warning "warning: integer overflow in expression" } */
-}
-
-void fuc (unsigned char);
-void fsc (signed char);
-
-void
-h2 (void)
-{
-  fsc (SCHAR_MAX + 1); /* { dg-warning "warning: overflow in implicit constant conversion" } */
-  fsc (SCHAR_MIN - 1); /* { dg-warning "warning: overflow in implicit constant conversion" } */
-  fsc (UCHAR_MAX); /* { dg-warning "warning: overflow in implicit constant conversion" } */
-  fsc (UCHAR_MAX + 1); /* { dg-warning "warning: overflow in implicit constant conversion" } */
-  fuc (-1);
-  fuc (UCHAR_MAX + 1); /* { dg-warning "warning: large integer implicitly truncated to unsigned type" } */
-  fuc (SCHAR_MIN);
-  fuc (SCHAR_MIN - 1); /* { dg-warning "warning: large integer implicitly truncated to unsigned type" } */
-  fuc (-UCHAR_MAX); /* { dg-warning "warning: large integer implicitly truncated to unsigned type" } */
-}
-
-void fui (unsigned int);
-void fsi (signed int);
-
-int si;
-unsigned ui;
-
-void
-h2i (int x)
-{
-  /* For some reason, we only give certain warnings for implicit
-     conversions among values of the same precision with -Wconversion,
-     while we don't give others at all.  */
-  fsi ((unsigned)INT_MAX + 1);
-  si = (unsigned)INT_MAX + 1;
-  si = x ? (unsigned)INT_MAX + 1 : 1;
-  fsi ((unsigned)INT_MAX + 2);
-  si = (unsigned)INT_MAX + 2;
-  si = x ? (unsigned)INT_MAX + 2 : 1;
-  fsi (UINT_MAX);
-  si = UINT_MAX;
-  fui (-1);
-  ui = -1;
-  ui = x ? -1 : 1U;
-  fui (INT_MIN);
-  ui = INT_MIN;
-  ui = x ? INT_MIN : 1U;
-}
-/* Test for diagnostics for constant overflow.  Test with -pedantic.  */
-/* Origin: Joseph Myers <joseph@codesourcery.com> */
-/* { dg-do compile } */
-/* { dg-options "-fpermissive -pedantic" } */
-
-#include <limits.h>
-
-enum e {
-  E0 = INT_MAX,
-  /* Unsigned overflow wraps around.  */
-  E1 = UINT_MAX + 1,
-  /* Overflow in an unevaluated part of an expression is OK (example
-     in the standard).  */
-  E2 = 2 || 1 / 0, /* { dg-bogus "warning: division by zero" "" { xfail *-*-* } 14 } */
-  E3 = 1 / 0, /* { dg-warning "warning: division by zero" } */
-  /* { dg-error "error: enumerator value for 'E3' is not an integer constant" "enum error" { target *-*-* } 15 } */
-  /* But as in DR#031, the 1/0 in an evaluated subexpression means the
-     whole expression violates the constraints.  */
-  E4 = 0 * (1 / 0), /* { dg-warning "warning: division by zero" } */
-  /* { dg-error "error: enumerator value for 'E4' is not an integer constant" "enum error" { xfail *-*-* } 19 } */
-  E5 = INT_MAX + 1, /* { dg-warning "warning: integer overflow in expression" } */
-  /* { dg-warning "warning: overflow in constant expression" "constant" { target *-*-* } 21 } */
-  /* Again, overflow in evaluated subexpression.  */
-  E6 = 0 * (INT_MAX + 1), /* { dg-warning "warning: integer overflow in expression" } */
-  /* { dg-warning "warning: overflow in constant expression" "constant" { target *-*-* } 24 } */
-  /* A cast does not constitute overflow in conversion.  */
-  E7 = (char) INT_MAX
-};
-
-struct s {
-  int a;
-  int : 0 * (1 / 0); /* { dg-warning "warning: division by zero" } */
-  int : 0 * (INT_MAX + 1); /* { dg-warning "warning: integer overflow in expression" } */
-  /* { dg-warning "warning: overflow in constant expression" "constant" { target *-*-* } 33 } */
-};
-
-void
-f (void)
-{
-  /* This expression is not required to be a constant expression, so
-     it should just involve undefined behavior at runtime.  */
-  int c = INT_MAX + 1; /* { dg-warning "warning: integer overflow in expression" } */
-
-}
-
-/* This expression is neither required to be constant.  */
-static int sc = INT_MAX + 1; /* { dg-warning "warning: integer overflow in expression" } */
-
-
 // Test for overflow in null pointer constant.  
 void *n = 0;
 /* The first two of these involve overflow, so are not null pointer
index 4d4ecf0bf027448785b4ef2fd328f52d15e04e73..65e220070fb6e1ff90d48ad3d9e55e46ed684280 100644 (file)
@@ -47,264 +47,6 @@ f (void)
 static int sc = INT_MAX + 1; /* { dg-warning "warning: integer overflow in expression" } */
 
 
-// Test for overflow in null pointer constant.  
-void *n = 0;
-/* The first two of these involve overflow, so are not null pointer
-   constants.  The third has the overflow in an unevaluated
-   subexpression, so is a null pointer constant.  */
-void *p = 0 * (INT_MAX + 1); /* { dg-warning "warning: integer overflow in expression" } */
-/* { dg-error "invalid conversion from 'int' to 'void" "null" { target *-*-* } 55 } */
-
-void *q = 0 * (1 / 0); /* { dg-warning "warning: division by zero" } */
-/* { dg-error "invalid conversion from 'int' to 'void*'" "null" { xfail *-*-* } 58 } */
-void *r = (1 ? 0 : INT_MAX+1); /* { dg-bogus "integer overflow in expression" "" { xfail *-*-* } 60 } */
-
-void
-g (int i)
-{
-  switch (i)
-    {
-    case 0 * (1/0): /* { dg-warning "warning: division by zero" } */
-      ;
-    case 1 + 0 * (INT_MAX + 1): /* { dg-warning "warning: integer overflow in expression" } */
-      /* { dg-error "error: overflow in constant expression" "constant" { target *-*-* } 69 } */
-      ;
-    }
-}
-
-int
-h (void)
-{
-  return INT_MAX + 1; /* { dg-warning "warning: integer overflow in expression" } */
-}
-
-int
-h1 (void)
-{
-  return INT_MAX + 1 - INT_MAX; /* { dg-warning "warning: integer overflow in expression" } */
-}
-
-void fuc (unsigned char);
-void fsc (signed char);
-
-void
-h2 (void)
-{
-  fsc (SCHAR_MAX + 1); /* { dg-warning "warning: overflow in implicit constant conversion" } */
-  fsc (SCHAR_MIN - 1); /* { dg-warning "warning: overflow in implicit constant conversion" } */
-  fsc (UCHAR_MAX); /* { dg-warning "warning: overflow in implicit constant conversion" } */
-  fsc (UCHAR_MAX + 1); /* { dg-warning "warning: overflow in implicit constant conversion" } */
-  fuc (-1);
-  fuc (UCHAR_MAX + 1); /* { dg-warning "warning: large integer implicitly truncated to unsigned type" } */
-  fuc (SCHAR_MIN);
-  fuc (SCHAR_MIN - 1); /* { dg-warning "warning: large integer implicitly truncated to unsigned type" } */
-  fuc (-UCHAR_MAX); /* { dg-warning "warning: large integer implicitly truncated to unsigned type" } */
-}
-
-void fui (unsigned int);
-void fsi (signed int);
-
-int si;
-unsigned ui;
-
-void
-h2i (int x)
-{
-  /* For some reason, we only give certain warnings for implicit
-     conversions among values of the same precision with -Wconversion,
-     while we don't give others at all.  */
-  fsi ((unsigned)INT_MAX + 1);
-  si = (unsigned)INT_MAX + 1;
-  si = x ? (unsigned)INT_MAX + 1 : 1;
-  fsi ((unsigned)INT_MAX + 2);
-  si = (unsigned)INT_MAX + 2;
-  si = x ? (unsigned)INT_MAX + 2 : 1;
-  fsi (UINT_MAX);
-  si = UINT_MAX;
-  fui (-1);
-  ui = -1;
-  ui = x ? -1 : 1U;
-  fui (INT_MIN);
-  ui = INT_MIN;
-  ui = x ? INT_MIN : 1U;
-}
-/* Test for diagnostics for constant overflow.  Test with -pedantic-errors.  */
-/* Origin: Joseph Myers <joseph@codesourcery.com> */
-/* { dg-do compile } */
-/* { dg-options "-pedantic-errors" } */
-
-#include <limits.h>
-
-enum e {
-  E0 = INT_MAX,
-  /* Unsigned overflow wraps around.  */
-  E1 = UINT_MAX + 1,
-  /* Overflow in an unevaluated part of an expression is OK (example
-     in the standard).  */
-  E2 = 2 || 1 / 0, /* { dg-bogus "warning: division by zero" "" { xfail *-*-* } 14 } */
-  E3 = 1 / 0, /* { dg-warning "warning: division by zero" } */
-  /* { dg-error "error: enumerator value for 'E3' is not an integer constant" "enum error" { target *-*-* } 15 } */
-  /* But as in DR#031, the 1/0 in an evaluated subexpression means the
-     whole expression violates the constraints.  */
-  E4 = 0 * (1 / 0), /* { dg-warning "warning: division by zero" } */
-  /* { dg-error "error: enumerator value for 'E4' is not an integer constant" "enum error" { xfail *-*-* } 19 } */
-  E5 = INT_MAX + 1, /* { dg-warning "warning: integer overflow in expression" } */
-  /* { dg-error "error: overflow in constant expression" "constant" { target *-*-* } 21 } */
-  /* Again, overflow in evaluated subexpression.  */
-  E6 = 0 * (INT_MAX + 1), /* { dg-warning "warning: integer overflow in expression" } */
-  /* { dg-error "error: overflow in constant expression" "constant" { target *-*-* } 24 } */
-  /* A cast does not constitute overflow in conversion.  */
-  E7 = (char) INT_MAX
-};
-
-struct s {
-  int a;
-  int : 0 * (1 / 0); /* { dg-warning "warning: division by zero" } */
-  int : 0 * (INT_MAX + 1); /* { dg-warning "warning: integer overflow in expression" } */
-  /* { dg-error "error: overflow in constant expression" "constant" { target *-*-* } 33 } */
-};
-
-void
-f (void)
-{
-  /* This expression is not required to be a constant expression, so
-     it should just involve undefined behavior at runtime.  */
-  int c = INT_MAX + 1; /* { dg-warning "warning: integer overflow in expression" } */
-
-}
-
-/* But this expression does need to be constant (in C++ ???).  */
-static int sc = INT_MAX + 1; /* { dg-warning "warning: integer overflow in expression" } */
-/* { dg-error "error: overflow in constant expression" "constant" { xfail *-*-* } 47 } */
-
-/* The first two of these involve overflow, so are not null pointer
-   constants.  The third has the overflow in an unevaluated
-   subexpression, so is a null pointer constant.  */
-void *p = 0 * (INT_MAX + 1); /* { dg-warning "warning: integer overflow in expression" } */
-/* { dg-error "invalid conversion from 'int' to 'void" "null" { target *-*-* } 53 } */
-
-void *q = 0 * (1 / 0); /* { dg-warning "warning: division by zero" } */
-/* { dg-error "invalid conversion from 'int' to 'void*'" "null" { xfail *-*-* } 56 } */
-void *r = (1 ? 0 : INT_MAX+1); /* { dg-bogus "integer overflow in expression" "" { xfail *-*-* } 58 } */
-
-void
-g (int i)
-{
-  switch (i)
-    {
-    case 0 * (1/0): /* { dg-warning "warning: division by zero" } */
-      ;
-    case 1 + 0 * (INT_MAX + 1): /* { dg-warning "warning: integer overflow in expression" } */
-      /* { dg-error "error: overflow in constant expression" "constant" { target *-*-* } 67 } */
-      ;
-    }
-}
-
-int
-h (void)
-{
-  return INT_MAX + 1; /* { dg-warning "warning: integer overflow in expression" } */
-}
-
-int
-h1 (void)
-{
-  return INT_MAX + 1 - INT_MAX; /* { dg-warning "warning: integer overflow in expression" } */
-}
-
-void fuc (unsigned char);
-void fsc (signed char);
-
-void
-h2 (void)
-{
-  fsc (SCHAR_MAX + 1); /* { dg-warning "warning: overflow in implicit constant conversion" } */
-  fsc (SCHAR_MIN - 1); /* { dg-warning "warning: overflow in implicit constant conversion" } */
-  fsc (UCHAR_MAX); /* { dg-warning "warning: overflow in implicit constant conversion" } */
-  fsc (UCHAR_MAX + 1); /* { dg-warning "warning: overflow in implicit constant conversion" } */
-  fuc (-1);
-  fuc (UCHAR_MAX + 1); /* { dg-warning "warning: large integer implicitly truncated to unsigned type" } */
-  fuc (SCHAR_MIN);
-  fuc (SCHAR_MIN - 1); /* { dg-warning "warning: large integer implicitly truncated to unsigned type" } */
-  fuc (-UCHAR_MAX); /* { dg-warning "warning: large integer implicitly truncated to unsigned type" } */
-}
-
-void fui (unsigned int);
-void fsi (signed int);
-
-int si;
-unsigned ui;
-
-void
-h2i (int x)
-{
-  /* For some reason, we only give certain warnings for implicit
-     conversions among values of the same precision with -Wconversion,
-     while we don't give others at all.  */
-  fsi ((unsigned)INT_MAX + 1);
-  si = (unsigned)INT_MAX + 1;
-  si = x ? (unsigned)INT_MAX + 1 : 1;
-  fsi ((unsigned)INT_MAX + 2);
-  si = (unsigned)INT_MAX + 2;
-  si = x ? (unsigned)INT_MAX + 2 : 1;
-  fsi (UINT_MAX);
-  si = UINT_MAX;
-  fui (-1);
-  ui = -1;
-  ui = x ? -1 : 1U;
-  fui (INT_MIN);
-  ui = INT_MIN;
-  ui = x ? INT_MIN : 1U;
-}
-/* Test for diagnostics for constant overflow.  Test with -pedantic-errors.  */
-/* Origin: Joseph Myers <joseph@codesourcery.com> */
-/* { dg-do compile } */
-/* { dg-options "-pedantic-errors" } */
-
-#include <limits.h>
-
-enum e {
-  E0 = INT_MAX,
-  /* Unsigned overflow wraps around.  */
-  E1 = UINT_MAX + 1,
-  /* Overflow in an unevaluated part of an expression is OK (example
-     in the standard).  */
-  E2 = 2 || 1 / 0, /* { dg-bogus "warning: division by zero" "" { xfail *-*-* } 14 } */
-  E3 = 1 / 0, /* { dg-warning "warning: division by zero" } */
-  /* { dg-error "error: enumerator value for 'E3' is not an integer constant" "enum error" { target *-*-* } 15 } */
-  /* But as in DR#031, the 1/0 in an evaluated subexpression means the
-     whole expression violates the constraints.  */
-  E4 = 0 * (1 / 0), /* { dg-warning "warning: division by zero" } */
-  /* { dg-error "error: enumerator value for 'E4' is not an integer constant" "enum error" { xfail *-*-* } 19 } */
-  E5 = INT_MAX + 1, /* { dg-warning "warning: integer overflow in expression" } */
-  /* { dg-error "error: overflow in constant expression" "constant" { target *-*-* } 21 } */
-  /* Again, overflow in evaluated subexpression.  */
-  E6 = 0 * (INT_MAX + 1), /* { dg-warning "warning: integer overflow in expression" } */
-  /* { dg-error "error: overflow in constant expression" "constant" { target *-*-* } 24 } */
-  /* A cast does not constitute overflow in conversion.  */
-  E7 = (char) INT_MAX
-};
-
-struct s {
-  int a;
-  int : 0 * (1 / 0); /* { dg-warning "warning: division by zero" } */
-  int : 0 * (INT_MAX + 1); /* { dg-warning "warning: integer overflow in expression" } */
-  /* { dg-error "error: overflow in constant expression" "constant" { target *-*-* } 33 } */
-};
-
-void
-f (void)
-{
-  /* This expression is not required to be a constant expression, so
-     it should just involve undefined behavior at runtime.  */
-  int c = INT_MAX + 1; /* { dg-warning "warning: integer overflow in expression" } */
-
-}
-
-/* This expression is neither required to be constant.  */
-static int sc = INT_MAX + 1; /* { dg-warning "warning: integer overflow in expression" } */
-
-
 // Test for overflow in null pointer constant.  
 void *n = 0;
 /* The first two of these involve overflow, so are not null pointer
index 5fd0ac4f93cf5f9f78d03b0154f9e8307159df39..472d4a7cab14185384cebeb819a6d104093f21fc 100644 (file)
@@ -5,17 +5,3 @@
 unsigned char rx_async(unsigned char p) {
     return p & 512; /* { dg-warning "overflow in implicit constant conversion" } */
 }
-/* PR c/27273 */
-/* { dg-do compile } */
-/* { dg-options "-Woverflow" } */
-
-unsigned char rx_async(unsigned char p) {
-    return p & 512; /* { dg-warning "overflow in implicit constant conversion" } */
-}
-/* PR c/27273 */
-/* { dg-do compile } */
-/* { dg-options "-Woverflow" } */
-
-unsigned char rx_async(unsigned char p) {
-    return p & 512; /* { dg-warning "overflow in implicit constant conversion" } */
-}
index af549abb54f76e6849f4303b66aa059e499ef60c..fa0cc83fa4dedb47c995fef37b491ebe056191b2 100644 (file)
@@ -16,39 +16,3 @@ h2 (int x)
   return ((INT_MAX + 1) * 0) * x; /* { dg-warning "warning: integer overflow in expression" } */
 }
 
-/* Test non-constant operands in overflowed expressions.  */
-/* { dg-do compile } */
-/* { dg-options "-Woverflow" } */
-
-#include <limits.h>
-
-int 
-h1 (int x)
-{
-  return x * (0 * (INT_MAX + 1)); /* { dg-warning "warning: integer overflow in expression" } */
-}
-
-int 
-h2 (int x)
-{
-  return ((INT_MAX + 1) * 0) * x; /* { dg-warning "warning: integer overflow in expression" } */
-}
-
-/* Test non-constant operands in overflowed expressions.  */
-/* { dg-do compile } */
-/* { dg-options "-Woverflow" } */
-
-#include <limits.h>
-
-int 
-h1 (int x)
-{
-  return x * (0 * (INT_MAX + 1)); /* { dg-warning "warning: integer overflow in expression" } */
-}
-
-int 
-h2 (int x)
-{
-  return ((INT_MAX + 1) * 0) * x; /* { dg-warning "warning: integer overflow in expression" } */
-}
-