http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49820
--- Comment #15 from Agner Fog 2011-07-27 14:27:33 UTC
---
How do you define "clever things"? Checking that a variable is within the
allowed range is certainly a standard thing that every SW teacher tells you to
do. I think it is reasonable to ex
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49820
--- Comment #14 from Eric Botcazou 2011-07-27
11:23:25 UTC ---
> My example does indeed give a warning when compiled with -Wstrict-overflow=2.
> Unfortunately, -Wall implies only -Wstrict-overflow=1 so I got no warning in
> the first place. I thi
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49820
--- Comment #13 from Agner Fog 2011-07-26 19:31:48 UTC
---
My example does indeed give a warning when compiled with -Wstrict-overflow=2.
Unfortunately, -Wall implies only -Wstrict-overflow=1 so I got no warning in
the first place. I think the war
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49820
--- Comment #12 from Agner Fog 2011-07-25 14:21:52 UTC
---
No the behavior is not predictable when it sometimes warns about ignoring
overflow, and sometimes not. Please add a warning when it optimizes away an
overflow check after the abs function
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49820
--- Comment #11 from Eric Botcazou 2011-07-25
07:45:36 UTC ---
> -Wall produces the warning "assuming signed overflow does not occur when
> assuming that (X + c) < X is always false" in the above example, but there is
> no warning when it assumes
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49820
--- Comment #10 from Agner Fog 2011-07-25 07:43:58 UTC
---
I still think that a compiler should be predictable and consistent. It is
inconsistent that a+5
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49820
--- Comment #9 from Andrew Pinski 2011-07-24
09:40:57 UTC ---
(In reply to comment #8)
> Why is the behavior different for signed and unsigned?
> The expression (a + 5 < a) is reduced to always false when a is signed, but
> not
> when a is unsig
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49820
--- Comment #8 from Agner Fog 2011-07-24 08:16:39 UTC
---
Thanks for your comments.
Why is the behavior different for signed and unsigned?
The expression (a + 5 < a) is reduced to always false when a is signed, but not
when a is unsigned.
-Wal
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49820
--- Comment #7 from Eric Botcazou 2011-07-24
06:56:13 UTC ---
> I think there is a disconnect between ISO/IEC and their desire to produce
> portable code, secure programming, and practical implementations. Confer:
>
> ME: "I want to check the
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49820
--- Comment #6 from Jeffrey Walton 2011-07-23
22:28:07 UTC ---
(In reply to comment #5)
> > CPUs which use 2s compliment representations are usually well equipped to
> > deal
> > with overflow and carry. I would claim a result which overflows is
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49820
Eric Botcazou changed:
What|Removed |Added
CC||ebotcazou at gcc dot
|
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49820
Jeffrey Walton changed:
What|Removed |Added
CC||noloader at gmail dot com
--- Comment #4
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49820
--- Comment #3 from Andreas Schwab 2011-07-23 17:30:21
UTC ---
Unsigned integers never overflow.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49820
--- Comment #2 from Andrew Pinski 2011-07-23
17:23:44 UTC ---
(In reply to comment #1)
> Integer overflow is undefined. You have to check before the fact, or compile
> with -fwrapv.
That should say signed integer overflow is undefined.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49820
Andreas Schwab changed:
What|Removed |Added
Status|UNCONFIRMED |RESOLVED
Resolution|
15 matches
Mail list logo