bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GCC optimizes integer overflow: bug or feature?


From: Paul Eggert
Subject: Re: GCC optimizes integer overflow: bug or feature?
Date: Thu, 21 Dec 2006 15:44:44 -0800
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)

Ian Lance Taylor <address@hidden> writes:

> We could disable VRP's assumptions about signed overflow.  I don't
> know what else we could do to fix this case.  I don't even know how we
> could issue a useful warning.  Perhaps there is a way.

It is a knotty problem.  Thanks for thinking about it.

I'm Handwaving with a capital H here, but one possibility is
for plain -O2 to keep VRP, but disable its assumption about
signed overflow when attempting to optimize away a
comparison that comes directly from the user's code (as
opposed to a comparison coming from subscript checking and
the like).

Here's another wild idea.  Perhaps GCC could add an option
"-fundefinedv" to request for aggressive optimizations
assuming that the program will never have an signed integer
overflow.  I.e., if you want the optimization that is
causing trouble here, you would specify "-O2 -fundefinedv";
but the default would be to disable this particular
troublesome optimization.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]