copy_warning (exp, orig_exp);
+ bool varmod = C_TYPE_VARIABLY_MODIFIED (restype);
+
ptrtype = build_pointer_type (restype);
+ C_TYPE_VARIABLY_MODIFIED (ptrtype) = varmod;
+
if (INDIRECT_REF_P (exp))
return convert (ptrtype, TREE_OPERAND (exp, 0));
tree eptype = NULL_TREE;
const char *invalid_op_diag;
bool int_operands;
+ bool varmod;
int_operands = EXPR_INT_CONST_OPERANDS (xarg);
if (int_operands)
gcc_assert (TREE_CODE (arg) != COMPONENT_REF
|| !DECL_C_BIT_FIELD (TREE_OPERAND (arg, 1)));
+ varmod = C_TYPE_VARIABLY_MODIFIED (argtype);
+
argtype = build_pointer_type (argtype);
+ C_TYPE_VARIABLY_MODIFIED (argtype) = varmod;
+
/* ??? Cope with user tricks that amount to offsetof. Delete this
when we have proper support for integer constant expressions. */
val = get_base_address (arg);
--- /dev/null
+/* { dg-do compile }
+ * { dg-options "-std=gnu23" } */
+
+int foo(int n)
+{
+ int (*a(void))[n] { return 0; };
+ goto err; /* { dg-error "jump into scope" "variably modified" } */
+ typeof((n++,a)) b2;
+err:
+ return n;
+}
+
--- /dev/null
+/* { dg-do compile }
+ * { dg-options "-std=c23" } */
+
+void f(int n)
+{
+ int a[n];
+ goto foo; /* { dg-error "jump into scope" "variably modified" } */
+ typeof(a) b1;
+foo:
+}
+
+void g(int n)
+{
+ int a2[1][n];
+ goto foo; /* { dg-error "jump into scope" "variably modified" } */
+ typeof((n++,a2)) b2;
+foo:
+}
+
+void h(int n)
+{
+ int a[n];
+ typeof(a) b1;
+ goto foo; /* { dg-error "jump into scope" "variably modified" } */
+ typeof(&b1) b;
+foo:
+}