[PATCH] include: sbi: fix swap errors with newer gcc -Werror=sequence-point

Ben Dooks ben.dooks at codethink.co.uk
Wed Jul 9 02:22:53 PDT 2025


On 09/07/2025 03:15, Rahul Pathak wrote:
> On Fri, Jul 4, 2025 at 5:59 PM Ben Dooks <ben.dooks at codethink.co.uk> wrote:
>>
>> The BSWAPxx() macros are now throwing the following warnings with
>> newer gcc versions. This is due to throwing an argument in that may
>> be evaluated more than one (I think) and therefore things like the
>> example below should be avoided.
>>
>> Fix by making a set of BSWAPxx() wrappers which specifically onlt
> 
> nit: %s/only/onlt ?
> 
>> evaluate 'x' once.
>>
>> In file included lib/sbi/sbi_mpxy.c:21:
>> lib/sbi/sbi_mpxy.c: In function ‘sbi_mpxy_write_attrs’:
>> ib/sbi/sbi_mpxy.c:632:63: error: operation on ‘mem_idx’ may be undefined [-Werror=sequence-point]
>>    632 |                         attr_val = le32_to_cpu(mem_ptr[mem_idx++]);
>>        |                                                        ~~~~~~~^~
>>
> 
> May I ask which gcc version?

gcc 15.1 (required as it is the only one that currently builds a
big-endian rootfs with glibc on buildroot)

> LGTM
> 
> Reviewed-by: Rahul Pathak <rahul at summations.net>


-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html



More information about the opensbi mailing list