OSDN Git Service

2007-01-02 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
authormanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 2 Jan 2007 20:07:44 +0000 (20:07 +0000)
committermanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 2 Jan 2007 20:07:44 +0000 (20:07 +0000)
PR c/19977
* c-typeck.c (store_init_value): Don't emit pedantic overflow
warning for non-static initializers.

testsuite/
* gcc/testsuite/gcc.dg/overflow-warn-3.c: Remove XFAIL.
* gcc/testsuite/gcc.dg/overflow-warn-4.c: Remove XFAIL.

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

gcc/ChangeLog
gcc/c-typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/overflow-warn-3.c
gcc/testsuite/gcc.dg/overflow-warn-4.c

index e7e62e9..a6a1232 100644 (file)
@@ -1,3 +1,9 @@
+2007-01-02  Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+       PR c/19977
+       * c-typeck.c (store_init_value): Don't emit pedantic overflow
+       warning for non-static initializers.
+       
 2007-01-02  Steven Bosscher  <steven@gcc.gnu.org>
 
        * config/alpha/alpha.md, arm/arm.c, darwin.c, frv/frv.md,
index 08f7d4a..955bfd9 100644 (file)
@@ -4292,7 +4292,7 @@ store_init_value (tree decl, tree init)
 
   /* ANSI wants warnings about out-of-range constant initializers.  */
   STRIP_TYPE_NOPS (value);
-  constant_expression_warning (value);
+  if (TREE_STATIC (decl)) constant_expression_warning (value);
 
   /* Check if we need to set array size from compound literal size.  */
   if (TREE_CODE (type) == ARRAY_TYPE
index 5f17a94..9b38348 100644 (file)
@@ -1,3 +1,9 @@
+2007-01-02  Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+       PR c/19977
+       * gcc/testsuite/gcc.dg/overflow-warn-3.c: Remove XFAIL.
+       * gcc/testsuite/gcc.dg/overflow-warn-4.c: Remove XFAIL.
+
 2006-01-02  Ian Lance Taylor  <iant@google.com>
 
        * g++.dg/warn/Wparentheses-22.C: New test.
index f20940e..2aa8b7f 100644 (file)
@@ -40,7 +40,7 @@ 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" } */
-  /* { dg-bogus "warning: overflow in constant expression" "constant" { xfail *-*-* } 42 } */
+
 }
 
 /* But this expression does need to be constant.  */
index acf2c87..a36f66f 100644 (file)
@@ -40,7 +40,7 @@ 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" } */
-  /* { dg-bogus "error: overflow in constant expression" "constant" { xfail *-*-* } 42 } */
+
 }
 
 /* But this expression does need to be constant.  */