Hi Richard,

> On 3 Jun 2023, at 12:20, Richard Biener <richard.guent...@gmail.com> wrote:
> 
>> Am 02.06.2023 um 21:12 schrieb Iain Sandoe via Gcc-patches 
>> <gcc-patches@gcc.gnu.org>:
>> 

>> --- 8< ---
>> 
>> This bug was essentially that darwin_rs6000_special_round_type_align()
>> was ignoring externally-imposed capping of field alignment.
>> 
>> 

>> diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
>> index 5b3b8b52e7e..42f49e4a56b 100644
>> --- a/gcc/config/rs6000/rs6000.cc
>> +++ b/gcc/config/rs6000/rs6000.cc
>> @@ -8209,7 +8209,8 @@ darwin_rs6000_special_round_type_align (tree type, 
>> unsigned int computed,
>>      type = TREE_TYPE (type);
>>  } while (AGGREGATE_TYPE_P (type));
>> 
>> -  if (! AGGREGATE_TYPE_P (type) && type != error_mark_node)
>> +  if (type != error_mark_node && ! AGGREGATE_TYPE_P (type)
>> +      && ! TYPE_PACKED (type) && maximum_field_alignment == 0)
> 
> Just noticed while browsing mail.  ‚Maximum_field_alignment‘ sounds like
> Something that should be factored in when 
> Computing align but as written there’s no adjustment done instead?  Is there 
> a way to get that to more than BITS_PER_UNIT?

I believe it is already correctly factored in (the values of ‘computed’ and 
’specified’ supplied to the
darwin_rs6000_special_round_type_align() take it into account).  The point of 
this function is to
override the supplied values under specific conditions (that the first element 
in the aggregate is a
double or long long).  However, [at least in the de facto Darwin PPC32 ABI] we 
should not do so if
there is a packed pragma in effect (that takes priority) and omitting that 
check is the bug being fixed.

It is a bit unfortunate to be looking at a global from deep in the machinery 
(although I did a 
quick grep and it seems that this would not be easily fixable - several targets 
and other places do
inspect maximum_field_alignment).  I suppose we could add a parm indicating the 
packed status
and/or value.

Part of the motivation for a self-contained and Darwin-local solution is to 
allow backport to 10.x
before it closes (since that’s the last GCC branch that can be built with 
native tools on the earlier boxes).

hopefully, I understood your point?
cheers
Iain


Reply via email to