https://gcc.gnu.org/bugzilla/show_bug.cgi?id=31377
Heiko Eißfeldt <heiko at hexco dot de> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |heiko at hexco dot de
--- Comment #4 from Heiko Eißfeldt <heiko at hexco dot de> ---
I think the reporter was assuming the subtraction was done with signed ints, so
the following comparison looked incorrect at first glance.
But since all involved variables are of type unsigned int, the comparison is
correct IMHO, although not easily readable/understandable.
Anyway, since "room" cannot be smaller than 0, the proposed "fix" would not
compile.
Since this bug was confirmed and even the author was assuming an error in the
comparison, maybe it should be either changed to signed ints (to make the code
better understandable) or the "underflow" should be avoided. Then it could be
expressed like this:
```cpp
diff --git a/gcc/opts.cc b/gcc/opts.cc
index 6658b6acd37..fb3a9a7cf83 100644
--- a/gcc/opts.cc
+++ b/gcc/opts.cc
@@ -1624,9 +1624,11 @@ wrap_help (const char *help,
do
{
- room = columns - 3 - MAX (col_width, item_width);
- if (room > columns)
+ if (columns > 3 + MAX (col_width, item_width))
+ room = columns - 3 - MAX (col_width, item_width);
+ else
room = 0;
+
len = remaining;
if (room < len)
```
I can sent this as a patch, if this rather cosmetic change is wanted.
In any case this PR seems to be no real bug to me (and could be closed).