On 04/04/2018 07:34 PM, Jakub Jelinek wrote:
> On Wed, Apr 04, 2018 at 06:51:00PM +0200, Andreas Krebbel wrote:
>>> On targets enforcing a function alignment bigger than 4 bytes this triggers 
>>> an error instead:
>>>
>>> +inline int ATTR ((aligned (4)))
>>> +finline_hot_noret_align (int);  /* { dg-warning "ignoring attribute 
>>> .aligned \\(4\\). because it
>>> conflicts with attribute .aligned \\(8\\)." } */
>>>
>>> gcc/gcc/testsuite/c-c++-common/Wattributes.c:404:1: error: alignment for 
>>> 'finline_hot_noret_align'
>>> must be at least 8^M
>>>
>>
>> diff --git a/gcc/testsuite/c-c++-common/Wattributes.c 
>> b/gcc/testsuite/c-c++-common/Wattributes.c
>> index 902bcb61c30..a260d018dcf 100644
>> --- a/gcc/testsuite/c-c++-common/Wattributes.c
>> +++ b/gcc/testsuite/c-c++-common/Wattributes.c
>> @@ -401,7 +401,8 @@ inline int ATTR ((warn_unused_result))
>>  finline_hot_noret_align (int);  /* { dg-warning "ignoring attribute 
>> .warn_unused_result. because it
>> conflicts with attribute .noreturn." } */
>>
>>  inline int ATTR ((aligned (4)))
>> -finline_hot_noret_align (int);  /* { dg-warning "ignoring attribute 
>> .aligned \\(4\\). because it
>> conflicts with attribute .aligned \\(8\\)." } */
>> +  finline_hot_noret_align (int);  /* { dg-warning "ignoring attribute 
>> .aligned \\(4\\). because it
>> conflicts with attribute .aligned \\(8\\)." "" { target { ! s390*-*-* } } } 
>> */
>> +/* { dg-error "alignment for 'finline_hot_noret_align' must be at least 8" 
>> "" { target s390*-*-* }
>> .-1 } */
>>
>>  inline int ATTR ((aligned (8)))
>>  finline_hot_noret_align (int);
>>
>> OK?
> 
> Wouldn't it be better to just use aligned (8) and aligned (16) instead of
> aligned (4) and aligned (8)?

aligned (8) does not trigger the warning anymore.  Neither on s390 nor on x86.  
I don't think there
is a way to ever see this warning on s390.  Values >= 8 would be ok (no 
warning, no error) and
values < 8 would trigger the error but not the warning.

-Andreas-

> 
>       Jakub
> 

Reply via email to