https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80793

--- Comment #6 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Manuel López-Ibáñez from comment #5)
> (In reply to Martin Sebor from comment #0)
> 
> There are several issues conflated here.
> 
> > t.c: In function ‘f’:
> > t.c:3:46: warning: signed and unsigned type in conditional expression
> > [-Wsign-compare]
> >    unsigned char c = i ? (-__SCHAR_MAX__ - 1) : 1U;
> 
> This warning should be moved to where -Wsign-conversion is handled to avoid
> emitting both.
> 
> The reason we cannot simply remove -Wsign-compare is because
> -Wsign-conversion is not enabled by neither -Wall nor -Wextra, while
> -Wsign-compare is.

Only in C++ though, and this bug is for plain C

> 
> The reason -Wsign-conversion is not enabled by neither -Wall nor -Wextra is
> because it has annoying false positives like PR40752. Clang doesn't have
> those.
>                                               
> > t.c:3:46: warning: negative integer implicitly converted to unsigned type
> > [-Wsign-conversion]
> 
> This is same warning as Clang gives, just less informative than Clang's.
> Printing the types should be easy.
> 
> > t.c:3:21: warning: conversion to ‘unsigned char’ alters ‘unsigned int’
> > constant value [-Wconversion]
> >    unsigned char c = i ? (-__SCHAR_MAX__ - 1) : 1U;
> 
> This warning is a bug in my opinion. Probably the patch in PR40752 silences
> it.

Reply via email to