[PATCH][PR89341]Fix ICE on function definition with weakref/alias attributes attached

Jeff Law law@redhat.com
Tue Jun 18 20:39:00 GMT 2019


On 3/26/19 5:40 AM, JunMa wrote:
> Hi
> 
> According to gnu document of function attributes, neither weakref nor alias
> could be attached to a function defined in current translation unit.
> Although GCC checks the attributes under some circumstances, it still fails
> on some cases and even causes ICE.
> 
> This patch checks whether alias/weakref attribute attaches on a function
> declaration which has body, and removes the attribute later.
> This also avoid the ICE.
> 
> Bootstrapped/regtested on x86_64-linux, ok for GCC10?
> 
> Regards
> JunMa
> 
> 
> gcc/ChangeLog
> 
> 2019-03-26  Jun Ma <JunMa@linux.alibaba.com>
> 
>     PR89341
>     * cgraphunit.c (handle_alias_pairs): Check whether alias attribute
> attaches
>     on a function declaration which has body.
> 
> gcc/testsuite/ChangeLog
> 
> 2019-03-26  Jun Ma <JunMa@linux.alibaba.com>
> 
>     PR89341
>     * gcc.dg/attr-alias-6.c: New test.
>     * gcc.dg/attr-weakref-5.c: Likewise.
Based on my reading of the BZ, this should result in a hard error,
rather than an "attribute ignored" warning.

Jeff



More information about the Gcc-patches mailing list