<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><span class="vcard"><a class="email" href="mailto:reid.kleckner@gmail.com" title="reid.kleckner@gmail.com <reid.kleckner@gmail.com>"> <span class="fn">reid.kleckner@gmail.com</span></a>
</span> changed
              <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - __attribute__((noreturn)) corrupts instruction pointer on method call"
   href="http://llvm.org/bugs/show_bug.cgi?id=16649">bug 16649</a>
        <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Status</td>
           <td>NEW
           </td>
           <td>RESOLVED
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">CC</td>
           <td>
                
           </td>
           <td>reid.kleckner@gmail.com
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>---
           </td>
           <td>INVALID
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - __attribute__((noreturn)) corrupts instruction pointer on method call"
   href="http://llvm.org/bugs/show_bug.cgi?id=16649#c2">Comment # 2</a>
              on <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - __attribute__((noreturn)) corrupts instruction pointer on method call"
   href="http://llvm.org/bugs/show_bug.cgi?id=16649">bug 16649</a>
              from <span class="vcard"><a class="email" href="mailto:reid.kleckner@gmail.com" title="reid.kleckner@gmail.com <reid.kleckner@gmail.com>"> <span class="fn">reid.kleckner@gmail.com</span></a>
</span></b>
        <pre>The noreturn attribute is part of the method type and is inherited onto the
derived foo method, for better or worse.

TOT clang actually warns you and generates an trap at -O0:

$ clang t.cpp -o t
t.cpp:16:3: warning: control reaches end of non-void function [-Wreturn-type]
  }
  ^
1 warning generated.

$ ./t
foo
Illegal instruction

Clang generates this IR-ish:

  switch i32 %2, label %sw.epilog [
    i32 3, label %sw.bb
    i32 4, label %sw.bb2
  ]

sw.bb:                                            ; preds = %entry
  %3 = load %class.A** %b, align 4
  %4 = bitcast %class.A* %3 to i1 (%class.A*)***
  %vtable = load i1 (%class.A*)*** %4
  %vfn = getelementptr inbounds i1 (%class.A*)** %vtable, i64 0
  %5 = load i1 (%class.A*)** %vfn
  %6 = call x86_thiscallcc zeroext i1 %5(%class.A* %3) #5
  unreachable

; Note the missing call to printf("3\n");

sw.bb2:                                           ; preds = %entry
  %call3 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([3 x i8]*
@.str, i32 0, i32 0))

Apple clang 4.2 / upstream clang 3.2 appears to simply fall through when the
unreachable is executed.

I think the fact that TOT clang warns on this is enough to declare this Working
As Intended.</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>