[PATCH v4] fix warnings in sys/select.h fortification with -Wsign-conversion

Carlos O'Donell carlos@systemhalted.org
Sun Jun 10 19:04:00 GMT 2012


On Sat, Jun 09, 2012 at 04:06:58PM -0700, Paul Pluzhnikov wrote:
> On Sat, Jun 9, 2012 at 1:24 PM, Paul Eggert <eggert@cs.ucla.edu> wrote:
> 
> >> it has slightly more overhead
> >
> > Not for any modern compiler with normal optimization;
> > they all turn (0 <= x && x < CONSTANT) into a single
> > unsigned comparison, even if x is signed.
> 
> Mike opened BZ#14210 for this, and I commented there:
> 
> on Linux/x86_64, the code for __fdelt_chk is identical before/after the patch:
> 
> (gdb) disas __fdelt_chk
> Dump of assembler code for function __fdelt_chk:
>    0x00000000000fb910 <+0>:    cmp    $0x3ff,%rdi
>    0x00000000000fb917 <+7>:    ja     0xfb921 <__fdelt_chk+17>
>    0x00000000000fb919 <+9>:    mov    %rdi,%rax
>    0x00000000000fb91c <+12>:    shr    $0x6,%rax
>    0x00000000000fb920 <+16>:    retq
>    0x00000000000fb921 <+17>:    push   %rax
>    0x00000000000fb922 <+18>:    callq  0xf9a60 <__GI___chk_fail>
> End of assembler dump.
> 
> 
> Can I have an explicit approval to commit (latest version of) my patch?

Paul,

I'd like to see you and Mike come to a concensus. Once you both agree
on a patch, I'll review that.

Mike,

Given that Paul's version generates the same code, what do you think of
his patch?

Cheers,
Carlos.



More information about the Libc-alpha mailing list