OSDN Git Service

/cp
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 31 Oct 2012 19:14:39 +0000 (19:14 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 31 Oct 2012 19:14:39 +0000 (19:14 +0000)
2012-10-31  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/54583
* tree.c (build_cplus_array_type): Set TREE_NO_WARNING on the
TYPE_SIZE of VLAs.

/testsuite
2012-10-31  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/54583
* g++.dg/ext/vla13.C: New.

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

gcc/cp/ChangeLog
gcc/cp/tree.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/vla13.C [new file with mode: 0644]

index a1abdde..70d001c 100644 (file)
@@ -1,3 +1,9 @@
+2012-10-31  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/54583
+       * tree.c (build_cplus_array_type): Set TREE_NO_WARNING on the
+       TYPE_SIZE of VLAs.
+
 2012-10-31  Dodji Seketeli  <dodji@redhat.com>
 
        PR c++/54955
index 8d555c2..bcc2779 100644 (file)
@@ -824,6 +824,10 @@ build_cplus_array_type (tree elt_type, tree index_type)
        }
     }
 
+  /* Avoid spurious warnings with VLAs (c++/54583).  */
+  if (TYPE_SIZE (t) && EXPR_P (TYPE_SIZE (t)))
+    TREE_NO_WARNING (TYPE_SIZE (t)) = 1;
+
   /* Push these needs up so that initialization takes place
      more easily.  */
   TYPE_NEEDS_CONSTRUCTING (t)
index 9bc92df..b32d9f7 100644 (file)
@@ -1,3 +1,8 @@
+2012-10-31  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/54583
+       * g++.dg/ext/vla13.C: New.
+
 2012-10-31  Vladimir Makarov  <vmakarov@redhat.com>
 
        PR middle-end/55150
diff --git a/gcc/testsuite/g++.dg/ext/vla13.C b/gcc/testsuite/g++.dg/ext/vla13.C
new file mode 100644 (file)
index 0000000..719c35b
--- /dev/null
@@ -0,0 +1,8 @@
+// PR c++/54583
+// { dg-options "-Wunused-value" }
+
+void fred()
+{
+  int n=10;
+  double (*x)[n];
+}