[PATCH] Fix ICE: in function_and_variable_visibility, at ipa-visibility.c:795 (PR99466)

Jeff Law jeffreyalaw@gmail.com
Thu Mar 18 22:23:28 GMT 2021


On 3/14/2021 8:03 AM, Iain Buclaw via Gcc-patches wrote:
> Excerpts from Iain Sandoe's message of March 13, 2021 6:09 pm:
>> Hi Iain,
>>
>> Iain Buclaw via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
>>
>>> This patch fixes an ICE caused by emutls routines generating a weak,
>>> non-public symbol for storing the initializer of a weak TLS variable.
>>>
>>> In get_emutls_init_templ_addr, only declarations that were DECL_ONE_ONLY
>>> would get a public initializer symbol, ignoring variables that were
>>> declared with __attribute__((weak)).
>>>
>>> Because DECL_VISIBILITY is also copied to the emutls initializer, a
>>> second test is included which checks that the expected visibility is
>>> emitted too.
>>>
>>> Tested on x86_64-apple-darwin10, OK for mainline?
>>>
>>> The oldest version of gcc I've checked is 7.5.0, and the ICE is present
>>> there too.  Is this OK for backporting, and if so which versions should
>>> it be backported to?
>>>
>>> Regards,
>>> Iain.
>>>
>>> ---
>>> gcc/ChangeLog:
>>>
>>> 	PR ipa/99466
>>> 	* tree-emutls.c (get_emutls_init_templ_addr): Mark initializer of weak
>>> 	TLS declarations as public.
>>>
>>> gcc/testsuite/ChangeLog:
>>>
>>> 	* gcc.dg/tls/pr98607-1.c: New test.
>>> 	* gcc.dg/tls/pr98607-2.c: New test.
>> ^^^ s/98607/99466/ ?
>>
> Oops, good catch.  I must have copied the number from the wrong tab.
> Mechanically updated the PR numbers and trying again...
>
> ---
> gcc/ChangeLog:
>
> 	PR ipa/99466
> 	* tree-emutls.c (get_emutls_init_templ_addr): Mark initializer of weak
> 	TLS declarations as public.
>
> gcc/testsuite/ChangeLog:
>
> 	PR ipa/99466
> 	* gcc.dg/tls/pr99466-1.c: New test.
> 	* gcc.dg/tls/pr99466-2.c: New test.
OK for the trunk.  I'd probably go back to gcc-9 and gcc-10.
Jeff


More information about the Gcc-patches mailing list