This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Signed int overflow behavior in the security context
- From: Paul Schlie <schlie at comcast dot net>
- To: Robert Dewar <dewar at adacore dot com>
- Cc: Andreas Bogk <andreas at andreas dot org>, <gcc at gcc dot gnu dot org>
- Date: Fri, 26 Jan 2007 18:57:43 -0500
- Subject: Re: Signed int overflow behavior in the security context
> Robert Dewar wrote:
>
> People always say this, but they don't really realize what they are
> saying. This would mean you could not put variables in registers, and
> would essentially totally disable optimization.
- can you provide an example of a single threaded program where the
assignment of variable to a machine register validly changes its
observable logical results?
> The -O2 flag is exactly a request to do optimizations that may cause
> wrong programs to generate different results.
- well this is certainly an interesting definition of -O2; and implicit
definition of any program which invokes an undefined behavior as being
"wrong"; as opposed to being arguably more accurately non-portable; as
the standard enables compilers to specify a well defined behavior to
that otherwise specified as being undefined. (nor seemingly particularly
clever, as intentionally invoking a behavior not previously expressed
seems like a great way to silently inject bugs into a program debugged
utilizing lesser degrees of optimization as is typically done.)