Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sat, 05 Apr 2014 11:04:58 +0200
From: Jens Gustedt <>
Subject: Re: build with clang-3.4 warnings report


Am Freitag, den 04.04.2014, 21:54 -0400 schrieb Rich Felker:
> On Sat, Apr 05, 2014 at 03:06:03AM +0200, Abdoulaye Walsimou Gaye wrote:
> > In file included from src/errno/strerror.c:7:
> > src/errno/__strerror.h:100:1: warning: implicit conversion from 'int' to 'unsigned char' changes value from 1133 to 109 [-Wconstant-conversion]
> > 1133,
> > ^~~~
> > 1 warning generated.
> Again, I'm confused why we're getting this one.

This seems to come from the bogus handling of EDQUOT by mips:

	/* mips has one error code outside of the 8-bit range due to a
	 * historical typo, so we just remap it. */

This remapping seems only to have been done correctly for the strerror
function itself but not for the array declaration.

An equivalent patch for that line would be

#define E(a,b) (unsigned char)((EDQUOT==1133 && (a)==EDQUOT) ? 109 : a),

but which makes it only apparent how bogus this is.

In the function

if (EDQUOT==1133) {..}

is basically and equivalent of

#if MIPS

or so but without saying it. (I thought that musl didn't wanted these
architecture dependent use of #if/#else).

To "repair" the mips problem I would just do

I think the real bug is here

#define E(a,b) ((unsigned char)a),

this is a typical case of someone using a cast to burry a
problem, black magic, "casting a spell".

As this bug shows, the whole technique of searching the error string
in strerror is somehow fragile.

The whole thing could be avoided by using designated initializers and
eliminating the whole errid array right away. Designated initializers
should be present in all decent versions of gcc. Do you want me to
prepare a patch?


:: INRIA Nancy Grand Est ::   ::
:: AlGorille ::::::::::::::: office Nancy : +33 383593090   ::
:: ICube :::::::::::::: office Strasbourg : +33 368854536   ::
:: ::::::::::::::::::::::::::: gsm France : +33 651400183   ::
:: :::::::::::::::::::: gsm international : +49 15737185122 ::

Download attachment "signature.asc" of type "application/pgp-signature" (199 bytes)

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.