This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PR tree-optimization/47190: ICE on weakref missing alias info
>
> But this is not in cgraphunit.c or called from visibility attribute
> processing. It would be ok to move the error to assemble_alias,
> but if we accepted the code before then we should only issue a
> warning that the wearkref is ignored.
assemble_alias is never called on the variable since we dispatch to it
only on existence of "alias" attribute, not "weakref", from rest_of_decl_compilation.
We probably could try to do the warning from rest_of_decl_compilation, but I think this
function is still not unit-at-a-time, so we might have problem with attributes added
after the initialization. Will check this.
>
> > I think it was supposed to catch the those weakrefs, too. It doesn't because
> > we get into assemble_alias only for "alias" attribute, not weakref.
>
> Well. Still process_function_and_variable_attributes is not the
> proper place to emit the error.
Well, process_function_and_variable_attributes was invented to finalize attributes
that can not be handled well at parsing time because of decl merging issues.
(we orginally tried to handle the attributes processed there in FE too and had
funny bugs)
You are concerned that the error is too late?
>
> If we want to emit errors from the middle-end and not from the frontend
> then cgraph_finalize_function is probably the time to do it (we already
> dispatch to do_warn_unused_parameter there).
Since those functions are not defined, cgraph_finalize_function is never called
on the decl. Also we support weakrefs on vars, too, as far as I can tell.
Honza
>
> Richard.