-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[flang]Add new intrinsic function backtrace and complete the TODO of abort #117603
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 9 commits
2d5d310
6b57193
0862afd
d28136f
bf60ffe
594c2b3
ca2ceb5
156e434
6c22384
c2e4cca
0270969
d3df426
96a861c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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 for instance. Please also document the extension support in docs/Intrinsics.md. Thanks for adding this, it is a great feature. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh! I understand what you said. I think you are right. But in this case, it seems to me that the built-in functions such as Abort and Exit need to be rewritten, because they can be regarded as user processes like backtrace. (If I understand correctly) I plan to complete backtrace in the original way first, and rewrite the built-in functions such as Abort and exit in the next new PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I temporarily changed pure to impure to match element (I saw the original Abort implementation was the same). Since the previous PR was problematic and had been rejected, I submitted a new PR after making modifications. You can follow this PR to follow the latest changes.#118179 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do not think that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agree. |
||
{"co_broadcast", | ||
{{"a", AnyData, Rank::anyOrAssumedRank, Optionality::required, | ||
common::Intent::InOut}, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
! RUN: bbc -emit-fir %s -o - | FileCheck %s | ||
|
||
! CHECK-LABEL: func.func @_QPbacktrace_test() { | ||
! CHECK: %[[VAL_0:.*]] = fir.call @_FortranABacktrace() {{.*}}: () -> none | ||
! CHECK: return | ||
! CHECK: } | ||
|
||
subroutine backtrace_test() | ||
call backtrace | ||
end subroutine |
Uh oh!
There was an error while loading. Please reload this page.