<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<div>
<div>
<div>No; the standard says that we get to assume that the loop will eventually terminate, or do I/O, or a few other possible things. I can find the text for you later if you'd like.</div>
<div><br>
</div>
<div>-Hal</div>
<div><br>
</div>
<div><font style="color:#333333"><i>Sent from my Verizon Wireless 4G LTE DROID</i></font></div>
</div>
<br>
<br>
Sanjoy Das <sanjoy@playingwithpointers.com> wrote:<br>
<br>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">On Sat, Jun 27, 2015 at 2:16 PM, Nuno Lopes <nunoplopes@sapo.pt> wrote:<br>
> At least in C/C++ that's UB, yes.<br>
<br>
So you cannot map every turing machine to a valid C/C++ program then. :)<br>
<br>
Also, does this mean that "daemon" programs that run continuously till<br>
they're killed by the OS (using a mechanism that is not visible in C)<br>
are effectively undefined?<br>
<br>
-- Sanjoy<br>
<br>
> Some years ago there was a lot of discussion about this on the ML.  Se<br>
> Nick's patch, for example:<br>
> <a href="http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20100705/103670.html">
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20100705/103670.html</a><br>
> The patch was eventually dropped, I don't recall why.  I think it's fine to<br>
> assume that readnone functions always terminate.  It would probably fine for<br>
> readonly functions as well.<br>
><br>
> Nuno<br>
><br>
><br>
> -----Original Message-----<br>
> From: Sanjoy Das<br>
> Sent: Saturday, June 27, 2015 9:29 PM<br>
> Subject: [LLVMdev] readonly and infinite loops<br>
><br>
> Running -early-cse on<br>
><br>
> declare void @rn() readnone nounwind<br>
><br>
> define void @f() {<br>
> entry:<br>
>  call void @rn()<br>
>  ret void<br>
> }<br>
><br>
> removes the call to @rn().  But @rn() could have had an infinite loop<br>
> in it in which case @f() went from being a non-terminating<br>
> program to an terminating no-op.  Is this intentional?<br>
><br>
> The only way I can see this transform being legal is if infinite loops<br>
> are declared to have undefined behavior, but I could not find anything<br>
> in the LLVM specification that mentions this.<br>
><br>
> -- Sanjoy<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
LLVMdev@cs.uiuc.edu         <a href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</div>
</span></font>
</body>
</html>