This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] C undefined behavior fix
- From: Tim Hollebeek <tim at hollebeek dot com>
- To: jtv <jtv at xs4all dot nl>
- Cc: Bernard Dautrevaux <Dautrevaux at microprocess dot com>, "'dewar at gnat dot com'" <dewar at gnat dot com>, paulus at samba dot org, gcc at gcc dot gnu dot org, linux-kernel at vger dot kernel dot org, trini at kernel dot crashing dot org, velco at fadata dot bg
- Date: Mon, 7 Jan 2002 17:28:32 -0500
- Subject: Re: [PATCH] C undefined behavior fix
- References: <17B78BDF120BD411B70100500422FC6309E402@IIS000> <20020107224907.D8157@xs4all.nl>
- Reply-to: tim at hollebeek dot com
> Nothing's taking the pointer's address, so the compiler _will_ be able
> to prove that (in a sensible universe) no other thread, interrupt,
> kernel code or Angered Rain God will be able to find our pointer--much
> less change it.
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.
-Tim