This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] elf.h SHF_EXCLUDE signed int 31 bit shift triggers undefined behaviour.


On 04/22/2015 10:25 AM, Andreas Schwab wrote:
> Florian Weimer <fweimer@redhat.com> writes:
> 
>> I think the safer change is to use -0x80000000 as the value of the
>> constant, without making it unsigned.
> 
> -0x80000000 has unsigned type.

Ugh.  The joys of C.

Using a cast would rely on a GCC extension, so one has to write
(-2147483647 - 1) to get the desired value.  Wow.

-- 
Florian Weimer / Red Hat Product Security


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]