diff mbox

[C++] PR 54583

Message ID 509135E6.3090004@oracle.com
State New
Headers show

Commit Message

Paolo Carlini Oct. 31, 2012, 2:29 p.m. UTC
Hi,

On 10/31/2012 02:50 PM, Jason Merrill wrote:
> On 10/30/2012 07:44 PM, Paolo Carlini wrote:
>> straightforward fix. The below, which regtests fine, simply acts on any
>> MULT_EXPR as TYPE_SIZE, which I think should be fine, but, in case the
>> idea is basically Ok, we could also consider the more complex but more
>> sophisticated variably_modified_type_p?
> I think I'd use EXPR_P rather than check for a particular tree code.
Yes, I also wondered whether that would be better. The below also passes 
testing.

Thanks,
Paolo.

/////////////////

Comments

Jason Merrill Oct. 31, 2012, 6:56 p.m. UTC | #1
OK.

Jason
diff mbox

Patch

Index: testsuite/g++.dg/ext/vla13.C
===================================================================
--- testsuite/g++.dg/ext/vla13.C	(revision 0)
+++ testsuite/g++.dg/ext/vla13.C	(working copy)
@@ -0,0 +1,8 @@ 
+// PR c++/54583
+// { dg-options "-Wunused-value" }
+
+void fred()
+{
+  int n=10;
+  double (*x)[n];
+}
Index: cp/tree.c
===================================================================
--- cp/tree.c	(revision 193033)
+++ cp/tree.c	(working copy)
@@ -824,6 +824,10 @@  build_cplus_array_type (tree elt_type, tree index_
 	}
     }
 
+  /* 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)