<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - missed opt: indeterminate value in lvalue expression does not optimize function call away"
   href="https://bugs.llvm.org/show_bug.cgi?id=41112">41112</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>missed opt: indeterminate value in lvalue expression does not optimize function call away
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Scalar Optimizations
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>gonzalobg88@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This code (<a href="https://gcc.godbolt.org/z/Zw-9jM">https://gcc.godbolt.org/z/Zw-9jM</a>):

extern int foo(int);

int bar() {
    int a;
    return foo(a);
}

int baz() {
    int a;
    return a;
}

compiles with -O3 to:

bar:                                    # @bar
        jmp     foo                     # TAILCALL
baz:                                    # @baz
        retq

Here, `baz` is optimized away because an indeterminate value participates in an
lvalue-expression, which is undefined behavior.

However, an indeterminate value participates in an lvalue expression in `bar`,
yet the call to `foo` is not optimized away. I believe it should.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>