This is the mail archive of the
mailing list for the GCC project.
Re: PR 28034: -fsection-anchors and coverage counters
- From: Mark Mitchell <mark at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org, richard at codesourcery dot com
- Date: Wed, 21 Jun 2006 01:10:09 -0700
- Subject: Re: PR 28034: -fsection-anchors and coverage counters
- References: <firstname.lastname@example.org>
Richard Sandiford wrote:
> /* Generate and save a copy of this so it can be shared. */
> /* We don't know the size yet; make it big enough that nobody
> will make any clever transformation on it. */
> char buf;
> tree gcov_type_node = get_gcov_type ();
> tree domain_tree
> = build_index_type (build_int_cst (NULL_TREE, 1000)); /* replaced later */
> tree gcov_type_array_type
> = build_array_type (gcov_type_node, domain_tree);
I think this code should be considered wrong, in current GCC. Your
concern about the optimizers getting confused if we access too many
elements is reasonable. I don't think it's safe to rely on the type not
being shared with other variables, either.
I think it would be better to give the variable the type "T " (with no
array bounds) at this point, and to leave DECL_SIZE set to NULL_TREE, as
we would with "extern int i". Then, set the type, and DECL_SIZE, when
the final size of the array is known.
Do you think such a patch would be hard? If it is, then your patch
certainly looks to be a reasonable fallback.
(650) 331-3385 x713