Issue 113747
Summary [clang] __attribute__((__noreturn__)) miscompile
Labels clang
Assignees
Reporter ZijunZhaoCCK
    `__attribute__((__noreturn__))` is miscompiled upstream.
See https://godbolt.org/z/T6nMoa75G from Miguel Young and his comment.

```
When using the standard [[noreturn]] and _Noreturn in their respective languages, codegen is identical, and correct. The C codegen is obviously wrong and clearly confusing the hell out of LLVM, as evidenced by this instruction sequence:

    jne     .LBB1_1
 mov     rax, qword ptr [rip + baz@GOTPCREL]
    call    rax
.LBB1_1: mov rax, qword ptr [rip + foo@GOTPCREL] call rax

(Just do call foo@PLT?)

My recommendation is that upstream use _Noreturn, or noreturn + <stdnoreturn.h>. Clang is clearly able to get this right, but somehow left hand isn't talking to right hand in the unification algorithm.

(This really isn't a C v. C++ difference at all; both languages define their standard noreturn primitives identically.)
```

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to