[patch] Fix PR tree-optimization/47056

Richard Guenther richard.guenther@gmail.com
Tue Jan 4 16:26:00 GMT 2011


On Tue, Jan 4, 2011 at 1:03 PM, Eric Botcazou <ebotcazou@adacore.com> wrote:
> Hi,
>
> this is the link failure of 10 ACATS tests on IA64/Linux.  The problem is that
> reachability analysis fails to see that some functions are needed because
> they are referenced in the code.  More precisely, CCP turns:
>
>  pr47056___alignment.46_308 = pr47056___alignment;
>  D.2264_309 = MEM[(struct  *)pr47056___alignment.46_308].D.227;
>
> into
>
>  D.2264_309 = MEM[(struct  *)pr47056___alignment].D.227;
>
> (pr47056___alignment being a function) and while walk_stmt_load_store_addr_ops
> recognizes the former as an address-of pattern (the & is implicit for
> functions), it doesn't for the latter (unlike for TARGET_MEM_REF) so

Yeah, the TARGET_MEM_REF thing looks from before the MEM_REF
merge.  It shouldn't recognize it as an address either.

> build_cgraph_edges is fooled and missed the reference to pr47056___alignment.
>
> The attached patch adds a specific kludge to mark_load for this case.  It also
> removes bogus ATTRIBUTE_UNUSED markers and makes mark_store pass the STMT to
> ipa_record_reference like the 2 other functions (mark_load and mark_address).
>
> It passed regression testing on x86.  OK after a complete testing cycle?

I don't know if manipulating the descriptor would count effectively as
an address-taking of the function.  Maybe Honza can comment.  Otherwise
the patch is ok.

Thanks,
Richard.

>
> 2011-01-04  Eric Botcazou  <ebotcazou@adacore.com>
>
>        PR tree-optimization/47056
>        * cgraphbuild.c (mark_address): Remove ATTRIBUTE_UNUSED markers.
>        (mark_load): Likewise.  Handle FUNCTION_DECL specially.
>        (mark_store): Likewise.  Pass STMT to ipa_record_reference.
>
>
> --
> Eric Botcazou
>



More information about the Gcc-patches mailing list