<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    This code is essentially from an LTP test (
    <meta http-equiv="content-type" content="text/html;
      charset=ISO-8859-1">
    <a href="http://ltp.sourceforge.net/"> http://ltp.sourceforge.net/</a>
    ).<br>
    <br>
    <br>
    #include <stdlib.h><br>
    <br>
    int main() {<br>
      void  *curr;<br>
    <br>
      do {<br>
        curr = malloc(1);<br>
      } while (curr);<br>
    <br>
      return 0;<br>
    <br>
    }<br>
    <br>
    If you compile it with no optimization, it will keep the malloc
    calls.<br>
    <br>
    If you compile it with -O2, it will create an infinite loop, i.e.
    assuming that malloc always returns a non zero result and the result
    is not used.<br>
    <br>
    ~/llvmpb/install/bin/clang loop.c -O2 -S<br>
    <br>
        .file    "loop.c"<br>
        .text<br>
        .globl    main<br>
        .align    16, 0x90<br>
        .type    main,@function<br>
    main:                                   # @main<br>
        .cfi_startproc<br>
    # BB#0:                                 # %entry<br>
        .align    16, 0x90<br>
    .LBB0_1:                                # %do.body<br>
                                            # =>This Inner Loop
    Header: Depth=1<br>
        jmp    .LBB0_1<br>
    .Ltmp0:<br>
        .size    main, .Ltmp0-main<br>
        .cfi_endproc<br>
    <br>
    <br>
        .section    ".note.GNU-stack","",@progbits<br>
    <br>
  </body>
</html>