This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] C undefined behavior fix
- From: Gérard Roudier <groudier at free dot fr>
- To: "J.A. Magallon" <jamagallon at able dot es>
- Cc: jtv <jtv at xs4all dot nl>, Tim Hollebeek <tim at hollebeek dot com>, 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: Wed, 9 Jan 2002 20:47:15 +0100 (CET)
- Subject: Re: [PATCH] C undefined behavior fix
On Tue, 8 Jan 2002, J.A. Magallon wrote:
>
> On 20020107 jtv wrote:
> >
> >Let's say we have this simplified version of the problem:
> >
> > int a = 3;
> > {
> > volatile int b = 10;
>
> >>>>>>>>> here b changes
Hmmm...
Then your hardware is probably broken or may-be you are dreaming. :-)
There is nothing in this code that requires the compiler to allocate
memory for 'b'. You just invent the volatile constant concept. :)
> > a += b;
> > }
> >
> >Is there really language in the Standard preventing the compiler from
> >constant-folding this code to "int a = 13;"?
Gérard.