|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH] Fix error: array subscript has type 'char'
Manuel Bouyer writes ("Re: [PATCH] Fix error: array subscript has type 'char'"):
> On Thu, Jan 14, 2021 at 03:16:15PM +0100, Manuel Bouyer wrote:
> > On Thu, Jan 14, 2021 at 02:25:05PM +0100, Jan Beulich wrote:
> > > Which means you're shifting the undefined-ness from the implementation
The undefined-ness is in the *specification*. [1]
> > > Isn't this something that wants changing in your ctype.h instead?
> > > the functions (or macros), as per the C standard
Jan, can you please check your facts before asserting the existence
of a pretty blatant bug in a platform's implementation of basic C
functions ?
>From my copy of C99+TC1+TC2, para 7.4:
1 In all cases the argument is an int, the value of which shall be
representable as an unsigned char or shall equal the value of the
macro EOF. If the argument has any other value, the behavior is
undefined. [...]
If char is signed, then it can contain -ve values. Those values are
promoted to int by the usual integer promotions. Naturally such
negative values are not representable as unsigned char. Passing them
to ctype macros is UB.
So Manuel's ctypes.h is conforming and the compiler warning (which I
have seen on Linux too) is correct.
> I guess I'm going to give up on this one. We'll keep it as a local patch.
Manuel, your original patch:
Reviewed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Release-Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
(The R-A is FTAOD since IMO this is a bugfix.)
Ian.
[1] I agree that "fixing" ctypes.h everywhere might be nice (eg the
way glibc does it) but that has other implications and it is not
reasonable to expect platforms supporting Xen to do that.
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |