This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PR 28034: -fsection-anchors and coverage counters

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[20];
>       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.


Mark Mitchell
(650) 331-3385 x713

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]