This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] C undefined behavior fix
- From: dewar at gnat dot com
- To: jtv at xs4all dot nl, tim at hollebeek dot com
- Cc: Dautrevaux at microprocess dot com, dewar at gnat dot com, gcc at gcc dot gnu dot org,linux-kernel at vger dot kernel dot org, paulus at samba dot org,trini at kernel dot crashing dot org, velco at fadata dot bg
- Date: Mon, 7 Jan 2002 18:11:05 -0500 (EST)
- Subject: Re: [PATCH] C undefined behavior fix
<<You're not allowed to be that smart wrt volatile. If the programmer
says the value might change unpredictably and should not be optimized,
then It Is So and the compiler must respect that even if it determines
It Cannot Possibly Happen.
>>
Indeed, this is the case, for example, you may have a hardware monitor
on the bus, and you are looking for this address, or some external
process may be modifying the location. Or you may legitimately use
volatile so that your debugger works as expected on this location.