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: jamagallon at able dot es, jtv at xs4all dot nl
- 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, tim at hollebeek dot com,trini at kernel dot crashing dot org, velco at fadata dot bg
- Date: Tue, 8 Jan 2002 20:19:47 -0500 (EST)
- Subject: Re: [PATCH] C undefined behavior fix
<<Yes, thank you, that part was obvious already. The question pertained
to the fact that nobody outside compiler-visible code was being handed
an address for b, and so the compiler could (if it wanted to) prove
under pretty broad assumptions that nobody could *find* b to make the
change in the first place.
>>
Suppose that a hardware emulator is used to change the value of b (IT
knows the address) at the point of:
> >>>>>>>>> here b changes
The reason was precisely to test a different value for b. This should
work if b is volatile. So the compiler's proof is flawed. The whole
point of volatile is that ALL such proofs are forbidden for volatile
objects.