This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/37591] suppress "signed and unsigned" warnings when signed value known to be positive
- From: "manu at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 22 Sep 2008 16:43:26 -0000
- Subject: [Bug c/37591] suppress "signed and unsigned" warnings when signed value known to be positive
- References: <bug-37591-37@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #6 from manu at gcc dot gnu dot org 2008-09-22 16:43 -------
Then, try to raise the issue in GCC and outline a clear plan. Otherwise, I
assure you this is going to stay as-is for the next 5-10 years because nobody
has a clear idea on how to tackle this in a way that pleases a majority. Also,
because it has an easy workaround: use a casting to unsigned.
Some starting points:
* Moving the warning to the middle-end is not going to avoid warning in this
testcase unless VRP is enabled. For -O0 and -O1, we will keep warning.
* Moving the warning to the middle-end means that we will warn/not warn
depending on the ordering of passes, missed optimisations, etc.
* Clang people claim that they can do a simple CCP pass very efficiently in the
FE. Perhaps we could do the same. However, we are currently moving
optimizations (such as folding) to later stages. In any case, VRP in the
front-end is what would be needed for this testcase. Is that even possible? Can
be done efficiently?
The same issues apply to many warnings: -Wconversion, -Wuninitialized,
-Wtype-limits.
As Richard said: This is the usual trade-off of doing warnings from the
frontends versus from the middle-end. One gives consistency and speed but
frequent false positives, and the other gives more precision at the cost of
consistent results and more compilation time.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37591