在 2019/6/19 上午4:38, Jeff Law 写道:
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 <ju...@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 <ju...@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.
Sorry for the late reply.

Yes, It should error out with message like "'foo' defined both normally
and as 'alias' attribute". However, this patch just tries to fix ICE, and
keeps remain unchanged.

I do have a patch to fix the message and the testcases, I'll send it later.

Regards
JunMa
Jeff


Reply via email to