]> gcc.gnu.org Git - gcc.git/commitdiff
re PR c/19977 (overflow in non-static initializer should not be pedwarn)
authorManuel López-Ibáñez <manu@gcc.gnu.org>
Tue, 2 Jan 2007 20:07:44 +0000 (20:07 +0000)
committerManuel López-Ibáñez <manu@gcc.gnu.org>
Tue, 2 Jan 2007 20:07:44 +0000 (20:07 +0000)
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.

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

From-SVN: r120355

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 e7e62e9caf3b94e8d96b77639be00d45b2e3e543..a6a1232ecb708804e10701fae17244f2b68b1f83 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 08f7d4a3a7965f4637c69571f6653fd5453cf873..955bfd959f81c3f8993e577e52fc02432dd3c7fa 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 5f17a946fe67c2b022a384351ef72c3dd97bd589..9b38348651d2915d03f7f33a0a09093bd17a2d18 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 f20940efdcd11a1fa0fe88244ad29268bcc3d0ff..2aa8b7f7eb67a2e7baade7f9d38be51e6e85ab87 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 acf2c876bf21be27ccedc15b6198824285f2097e..a36f66f14fe1347c117b1886c51bcd43441e7e68 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.  */
This page took 0.161391 seconds and 5 git commands to generate.