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 Brook
Subject: Re: GCC optimizes integer overflow: bug or feature?
Date: Fri, 22 Dec 2006 02:03:23 +0000
User-agent: KMail/1.9.5

On Friday 22 December 2006 00:58, Denis Vlasenko wrote:
> On Tuesday 19 December 2006 23:39, Denis Vlasenko wrote:
> > There are a lot of 100.00% safe optimizations which gcc
> > can do. Value range propagation for bitwise operations, for one
>
> Or this, absolutely typical C code. i386 arch can compare
> 16 bits at a time here (luckily, no alighment worries on this arch):
>
> int f(char *p)
> {
>     if (p[0] == 1 && p[1] == 2) return 1;
>     return 0;
> }

Definitely not 100% safe. p may point to memory that is sensitive to the 
access width and/or number of accesses. (ie. memory mapped IO).

Paul




reply via email to

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