lkml.org 
[lkml]   [2002]   [Jan]   [7]   [last100]   RSS Feed
Views: [more markup]   [less markup]   [headers]   [forward]  
 
Messages in this thread
/
DateMon, 7 Jan 2002 23:16:20 +0100
Fromjtv <>
SubjectRe: [PATCH] C undefined behavior fix
On Mon, Jan 07, 2002 at 05:28:32PM -0500, Tim Hollebeek wrote:
> 
> 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.

Naturally I hope you're right.  But how does that follow from the Standard?
I have to admit I don't have a copy handy.  :(

Let's say we have this simplified version of the problem:

	int a = 3;
	{
		volatile int b = 10;
		a += b;
	}
Is there really language in the Standard preventing the compiler from
constant-folding this code to "int a = 13;"?


Jeroen

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:15    [W:0.146 / U:0.330 seconds]
©2003-2008 Jasper Spaans