This is an archive of the discontinued LLVM Phabricator instance.

[flang] Avoid deallocation of intent(out) when dummy arg is not in entry stmt
ClosedPublic

Authored by clementval on Sep 21 2022, 2:13 AM.

Details

Summary

In some case, the ENTRY statement in a procedure is including some
dummy argument. Until now, deallocation of intent(out) allocatable was
not checking for this and it could result in a segmentation fault.

This patch avoids deallocation when the value is not in the ENTRY stmt.

Diff Detail

Event Timeline

clementval created this revision.Sep 21 2022, 2:13 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptSep 21 2022, 2:13 AM
Herald added a subscriber: mehdi_amini. · View Herald Transcript
clementval requested review of this revision.Sep 21 2022, 2:13 AM
jeanPerier accepted this revision.Sep 21 2022, 6:03 AM

LGTM (assuming the next build succeeds).

This revision is now accepted and ready to land.Sep 21 2022, 6:03 AM

Rebase to trigger a fresh build

PeteSteinfeld accepted this revision.Sep 21 2022, 7:24 AM

Other than the clang-format problem, all builds and tests correctly and looks good.

flang/lib/Lower/ConvertVariable.cpp
627

I get a diff when I run clang-format on this line. Here's what I think it should be:

if (mlir::Operation *op = mutBox->getAddr().getDefiningOp())

clang-format

clementval added inline comments.Sep 21 2022, 9:29 AM
flang/lib/Lower/ConvertVariable.cpp
627

Yeah you are right. My clang-format was a bit out of date.

LGTM (assuming the next build succeeds).

Thanks. Looks like pre commit checks are down for the moment.

This revision was landed with ongoing or failed builds.Sep 21 2022, 9:48 AM
This revision was automatically updated to reflect the committed changes.
clementval marked an inline comment as done.