[PATCH] D79507: [flang] Change DIE("unreachable") cases to use llvm_unreachable
David Truby via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 27 01:35:16 PDT 2020
DavidTruby added a comment.
In D79507#2056617 <https://reviews.llvm.org/D79507#2056617>, @sscalpone wrote:
> +1 for good messages.
>
> I think there's universal agreement that code that cannot be reached with user input should be marked as unreachable. The point of contention is whether or not code in a RELEASE build is allowed to catch & report that situation.
>
> What about something like:
>
> #define DIE(x) { Fortran::common::die(x " at " __FILE__ "(%d)", __LINE__); LLVM_BUILTIN_UNREACHABLE; }
>
>
> ?
There's other technical issues with this. Firstly, an approach like this wouldn't work because DIE is used in places that we don't necessarily want to signal as unreachable.
Secondly, the LLVM_BUILTIN_UNREACHABLE doesn't actually do anything here as Fortran::common::die() is already marked `[[no return]]` so any code after it is unreachable anyway.
Ultimately the problem with using this here would be the same as using the current DIE macro; by inserting a function call you're not only not telling the compiler that area is unreachable but you're actively telling the compiler that you think it //can// be reached, since this function should be called if it is.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D79507/new/
https://reviews.llvm.org/D79507
More information about the llvm-commits
mailing list