[flang-commits] [flang] [flang]Add new intrinsic function backtrace and complete the TODO of abort (PR #117603)

via flang-commits flang-commits at lists.llvm.org
Thu Nov 28 08:59:42 PST 2024


================
@@ -1336,6 +1336,7 @@ static const IntrinsicInterface intrinsicSubroutine[]{
             {"stat", AnyInt, Rank::scalar, Optionality::optional,
                 common::Intent::Out}},
         {}, Rank::elemental, IntrinsicClass::atomicSubroutine},
+    {"backtrace", {}, {}, Rank::elemental, IntrinsicClass::pureSubroutine},
----------------
jeanPerier wrote:

I am late in the review, but since this has been reverted, I do not think "elemental" is correct here, and I would also debate the pure aspect since this is doing IO on the standard output which is forbidden for pure subroutine.

In fact, I am not quite sure that the front-end needs to know about backtrace since there are type resolution or argument requiring explicit interface.

It may just be simpler to deal with it like a user procedure for which the runtime provides an implementation (if the user has not). See [FDATE implementation](https://github.com/llvm/llvm-project/pull/71222/files) for instance.

Please also document the extension support in docs/Intrinsics.md. 

Thanks for adding this, it is a great feature.

https://github.com/llvm/llvm-project/pull/117603


More information about the flang-commits mailing list