[cpp-threads] infinite loops

Boehm, Hans hans.boehm at hp.com
Mon Jul 31 18:35:46 BST 2006


I'm actually more comfortable with the original wording.

I think there are two problems with wording things this way:

1) Once you start talking explicitly about transformations in the spec,
it seems very hard to get things right.  You really want to know that
whatever statement you come up with is general enough to justify
existing analysis.  I think this can be accurately summarizes as "any
statements directly before the loop are executed iff statements directly
after the loop are".  I think this assumption is pervasive.  I'm not
sure exactly what all of its consequences are.  If we start allowing
individual transformations, it's very likely that we will forget others.

By Doug's rule, is loop jamming OK?  That cannot be expressed as a
finite number of transformations of the kind we described here.

2) We'd forever be stuck explaining to people that correctly
synchronized programs behave sequentially consistently EXCEPT in this
one corner case.  The original wording was an attempt to avoid having to
explain that.

I agree that adding more undefined behavior is generally undesirable.
But there are already many of these, and this seems to be a relatively
benign case.  In some ways it might actually improve matters.  There are
currently some compilers that generate obnoxious warnings about
blatantly infinite loops.  This would presumably:

a) Turn the obnoxious warning into an even more obnoxious error message,
which is hopefully issued on my development machine, not just one or two
test machines.
b) Give me an easy way to avoid it by inserting an acquire operation.

Hans

> -----Original Message-----
> From: cpp-threads-bounces at decadentplace.org.uk 
> [mailto:cpp-threads-bounces at decadentplace.org.uk] On Behalf 
> Of Peter A. Buhr
> Sent: Monday, July 31, 2006 7:55 AM
> To: cpp-threads at decadentplace.org.uk
> Subject: Re: [cpp-threads] infinite loops
> 
>    In other words, your proposed rule is that if
> 
>    something; something; something; ...; something; x = 42;
> 
>    can be transformed to
> 
>    x = 42; something; something; something; ...; something;
> 
>    for any finite amount of somethings, then it is allowed 
> even when the actual 
>    amount of iterations may be infinite.
> 
> I'd like to suggest one small wording change to the last line:
> 
>    for any finite amount of somethings, then it is allowed 
> even when the actual 
>    amount of *something* may be infinite.
> 
> because formally the term "something" subsumes the term 
> "iteration". This change would remove an further ambiguities. ;-)
> 
> --
> cpp-threads mailing list
> cpp-threads at decadentplace.org.uk
> http://www.decadentplace.org.uk/cgi-bin/mailman/listinfo/cpp-threads
> 



More information about the cpp-threads mailing list