The problem here is that
void* labels[] = {
&&l0, &&l1, &&l2
};
gets gimplified to
labels = *.LC0;
but .LC0 is not in the set of local decls, so that when copy_forbidden is
called during sra versioning we fail to forbid the copy. We could set a
different flag, but I think it's easiest to just add the artificial decl to
where it can be seen.
Ok?
r~
* gimplify.c (gimplify_init_constructor): Add the constant def decl
to the function's local decls.
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index b331e41..884482e 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -4016,6 +4016,7 @@ gimplify_init_constructor (tree *expr_p, gimple_seq
*pre_p, gimple_seq *post_p,
walk_tree (&ctor, force_labels_r, NULL, NULL);
ctor = tree_output_constant_def (ctor);
+ add_local_decl (cfun, ctor);
if (!useless_type_conversion_p (type, TREE_TYPE (ctor)))
ctor = build1 (VIEW_CONVERT_EXPR, type, ctor);
TREE_OPERAND (*expr_p, 1) = ctor;