title: Why does "noreturn" function return?
body: <p>I read <a href="https://stackoverflow.com/questions/10538291/what-is-the-point-of-noreturn">this</a> question about <code>noreturn</code> attribute, which is used for functions that don't return to the caller.</p>
  
  <p>Then I have made a program in C.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdnoreturn.h&gt;
  
  noreturn void func()
  {
          printf("noreturn func\n");
  }
  
  int main()
  {
          func();
  }
  </code></pre>
  
  <p>And generated assembly of the code using <a href="https://gcc.godbolt.org/" rel="noreferrer">this</a>:</p>
  
  <pre><code>.LC0:
          .string "func"
  func:
          pushq   %rbp
          movq    %rsp, %rbp
          movl    $.LC0, %edi
          call    puts
          nop
          popq    %rbp
          ret   // ==&gt; Here function return value.
  main:
          pushq   %rbp
          movq    %rsp, %rbp
          movl    $0, %eax
          call    func
  </code></pre>
  
  <p><strong>Why does function <code>func()</code> return after providing <code>noreturn</code> attribute?</strong></p>