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 2015-04-22 11:33, Florian Weimer wrote:
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.

Given that stdint.h is already included it's perhaps easier to just use INT32_MIN?

I've replied about it and other issues in the previous thread but I'm afraid I'm lost all Cc there. Here it is:

https://sourceware.org/ml/libc-alpha/2015-04/msg00257.html

--
Alexander Cherepanov


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