[cfe-dev] clang not observing -fno-signed-char, and other triple realted issues

Javier Múgica via cfe-dev cfe-dev at lists.llvm.org
Wed Dec 23 13:17:32 PST 2020


> > 1. Regarding -funsigned-char.
> >
> > A minimum example also works for me, but I am sure I got those warnings,
> > so I wet through it and here is a different kind of minimum example:
> >
> > typedef unsigned char char8_t;
> >
> > int func(const char8_t *s){return 0;}
> > int main(void){
> >         char8_t *s="Some text"; //-Wpointer-sign
> >         return func("Some text"); //-Wpointer-sign
> > }
> >
> > As you can see, the bug is restricted to the type Clang assigns to string
> > literals [...]
> >
> This might just be bad message text. "char" is never the same type as
> "signed char" or "unsigned char", so that there is a warning is intended.
> 

I know "char" is always a different type than "signed char" or "unsigned char". If "char" has been set to be unsigned there is no sign mismatch in an assignment like char8_t *s="Some text"; above, so the warning is certainly wrong. It is very annoying, and removing it is not a very good idea because a pointer-sign mismatch is really worth having reported when it actually happens.


More information about the cfe-dev mailing list