This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/29455] Issues with -Wchar-subscripts
- From: "preston at bannister dot us" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 08 Jan 2015 11:56:15 +0000
- Subject: [Bug c++/29455] Issues with -Wchar-subscripts
- Auto-submitted: auto-generated
- References: <bug-29455-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=29455
Preston L Bannister <preston at bannister dot us> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |preston at bannister dot us
--- Comment #9 from Preston L Bannister <preston at bannister dot us> ---
(In reply to Hallvard B Furuseth from comment #7)
> > The warning in C++ is arguably bogus because the value of the
> > character '%' is known at compile-time, consequently the warning
> > is unwarranted (unless it really is negative).
>
> unwarranted unless it _could_ be negative on some host.
Are there any hosts of this sort left? And for which GCC compiles?
The job of the compiler is to generate code for a specific machine. For a
character literal the compiler knows the exact value. If the value were
negative, a warning is justified.
Generating a warning on code that is correct for the target is not useful.
Likely the code will never be compiled on a platform where the warning is
correct.
Given almost no possibility the warning will ever be correctly identify a
problem, this is at least a very poor choice, and infinitely close to a bug. :)