aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Stump <mrs@gcc.gnu.org>2006-06-19 21:13:13 +0000
committerMike Stump <mrs@gcc.gnu.org>2006-06-19 21:13:13 +0000
commitca84a9a2e37fc3803f8f1b8485d374f24c1cc4c1 (patch)
treeeee05720492e143f4558176ab46c8b33a8bfa5f0
parent73617bce35915afa940389526d44d3bf74a7f31b (diff)
downloadgcc-ca84a9a2e37fc3803f8f1b8485d374f24c1cc4c1.zip
gcc-ca84a9a2e37fc3803f8f1b8485d374f24c1cc4c1.tar.gz
gcc-ca84a9a2e37fc3803f8f1b8485d374f24c1cc4c1.tar.bz2
tree.c (variably_modified_type_p): VM arguments don't make the type a VM type.
* tree.c (variably_modified_type_p): VM arguments don't make the type a VM type. testsuite: * gcc.dg/vla-8.c: Add. From-SVN: r114787
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.dg/vla-8.c6
-rw-r--r--gcc/tree.c16
4 files changed, 21 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 81535ec..c664415 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2006-06-19 Mike Stump <mrs@apple.com>
+
+ * tree.c (variably_modified_type_p): VM arguments don't make the
+ type a VM type.
+
2006-06-19 Richard Guenther <rguenther@suse.de>
* tree-ssa-pre.c (try_combine_conversion): Strip useless
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 8fda51d..c3f298a 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2006-06-19 Joseph S. Myers <joseph@codesourcery.com>
+
+ * gcc.dg/vla-8.c: Add.
+
2006-06-19 Richard Guenther <rguenther@suse.de>
PR tree-optimization/27090
diff --git a/gcc/testsuite/gcc.dg/vla-8.c b/gcc/testsuite/gcc.dg/vla-8.c
new file mode 100644
index 0000000..a5b8113
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vla-8.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-std=c99 -pedantic-errors" } */
+/* Radar 4336222 */
+
+int a;
+struct s { void (*f)(int (*)[a]); };
diff --git a/gcc/tree.c b/gcc/tree.c
index c369d60..0d40a51 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -5602,8 +5602,10 @@ find_var_from_fn (tree *tp, int *walk_subtrees, void *data)
}
/* Returns true if T is, contains, or refers to a type with variable
- size. If FN is nonzero, only return true if a modifier of the type
- or position of FN is a variable or parameter inside FN.
+ size. For METHOD_TYPEs and FUNCTION_TYPEs we exclude the
+ arguments, but not the return type. If FN is nonzero, only return
+ true if a modifier of the type or position of FN is a variable or
+ parameter inside FN.
This concept is more general than that of C99 'variably modified types':
in C99, a struct type is never variably modified because a VLA may not
@@ -5644,16 +5646,10 @@ variably_modified_type_p (tree type, tree fn)
case FUNCTION_TYPE:
case METHOD_TYPE:
- /* If TYPE is a function type, it is variably modified if any of the
- parameters or the return type are variably modified. */
+ /* If TYPE is a function type, it is variably modified if the
+ return type is variably modified. */
if (variably_modified_type_p (TREE_TYPE (type), fn))
return true;
-
- for (t = TYPE_ARG_TYPES (type);
- t && t != void_list_node;
- t = TREE_CHAIN (t))
- if (variably_modified_type_p (TREE_VALUE (t), fn))
- return true;
break;
case INTEGER_TYPE: