> Am 30.05.2024 um 13:46 schrieb Eric Botcazou <botca...@adacore.com>:
>
>
>>
>> Do function pointers inter-operate TBAA wise for this case and would this
>> possibly An issue?
>
> Do you mean in LTO mode? I must say I'm not sure of the way LTO performs TBAA
> for function pointers: does it require (strict) matching of the type for all
> the parameters of the pointed-to function types?
Yes, I think in terms of how we compute canonical types. These pointer to
derived types prove difficult for c23 as well (even without considering cross
language interoperability and LTO).
> If so, then I guess it could
> theoretically assign different alias sets to compatible function pointers when
> one of them happens to point to the function type of a function imported with
> the transparent union gap, with some problematic fallout when objects of these
> function pointers happen to be indirectly modified in the program...
>
> Note that there is an equivalent bypass based on common_or_extern a few lines
> below in the function (although I'm not sure if it's problematic TBAA-wise).
I’d have to check. I think the diagnostic at hand tries to diagnose possible
call ABI issues, so not sure why it mentions strict aliasing. Or maybe I
misremember.
A patch like yours would be OK if this is really just about the ABI issue.
Richard
> --
> Eric Botcazou
>
>