Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Mon, 3 Aug 2020 13:47:07 -0400
From: Rich Felker <dalias@...c.org>
To: Markus Wichmann <nullplan@....net>
Cc: musl@...ts.openwall.com
Subject: Re: Musl's FD_{SET,ISSET,CLR} macros from sys/select.h
 trigger gcc's -Wsign-conversion warnings

On Mon, Aug 03, 2020 at 07:43:43AM +0200, Markus Wichmann wrote:
> On Sun, Aug 02, 2020 at 09:43:56PM +0200, Petr Skocik wrote:
> > A direct size_t cast of (d) could potentially do some type-unsafe things (like convert a pointer),
> 
> Then just add 0ul? Pointers stay pointers, and ints become unsigned
> longs. Only signed long longs remain signed, but using 0ull would turn
> this into 64-bit calculations on 32-bit systems, typically requiring
> libgcc calls. Also, storing FDs in long longs is a tad overkill, and
> probably not the normal case.

That's no different than what the code is already doing, getting the
desired promotion via C's promotion rules. Unfortunately compilers are
wrongly complaining about it because it doesn't meet their preferred
style rules.

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.