[Bug c/38341] Wrong warning comparison of promoted ~unsigned with unsigned

manu at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Mar 10 21:57:00 GMT 2016


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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu.org

--- Comment #12 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
At this stage, this will not get fixed before GCC 7 is released in March 2017,
if at all.

If somebody wants to see progress on this, they way forward is:

1) Put a breakpoint at warn_for_sign_compare () at
/home/manuel/test1/src/gcc/c-family/c-common.c
2) Figure out exactly why one case is warned and the other is not.
3) Figure out exactly when the difference is introduced (very likely in
shorten_compare in the same file). The C FE does "folding" (optimizing) while
parsing even at -O0. It is a goal to stop doing this (without breaking anything
else of course, so abundant testing that the generated code does not change is
required).
4) Figure out how to fix the warning or avoid introducing a difference.

Even improving the warning text could help someone to figure out the problem
(printing the types involved, explaining that the comparison is always false,
etc.)

Any of the steps above would make it a bit easier for the next person to come
along and continue the work until a fix is committed.

If you never debugged/modified GCC before, see
https://gcc.gnu.org/wiki/GettingStarted#Basics:_Contributing_to_GCC_in_10_easy_steps

(In reply to Fredrik Hederstierna from comment #5)
> On Intel i386-GCC (4.2.3) we just get warning only for the line
> 
>   if (c1 == ~c2)
> 
> The other lines does not give warnings, so maybe its just the ARM-backend
> that catch this warning.

I don't see these differences. It works the same in both cases.


More information about the Gcc-bugs mailing list