This is an archive of the discontinued LLVM Phabricator instance.

[flang] Fix dangling pointer in LabelEnforce
ClosedPublic

Authored by tskeith on Jan 13 2021, 11:02 AM.

Details

Summary

DirectiveStructureChecker was passing in a pointer to a temporary
string for the construct argument to the constructor for LabelEnforce.
The LabelEnforce object had a lifetime longer than the temporary,
resulting in accessing a dangling pointer when emitting an error message
for omp-parallell01.f90.

The fix is to make the lifetime of the temporary as long as the lifetime
of the LabelEnforce object.

Diff Detail

Event Timeline

tskeith created this revision.Jan 13 2021, 11:02 AM
tskeith requested review of this revision.Jan 13 2021, 11:02 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 13 2021, 11:02 AM
sameeranjoshi accepted this revision.Jan 14 2021, 6:39 AM

Thank you for the patch.
I did get an email from the bot with a weird text Control flow escapes from \xcb\x1c\xda\xff\xff\nexpect at 16: Control flow escapes from PARALLEL\n'
I had a build of gcc 9.2 and the tried to check with the recent pull from main and all tests seem to work.
It was pointed[1] by @awarzynski that the issue was specifically due to clang-10.

Thank you again.
[1] https://reviews.llvm.org/D93447#2498085

This revision is now accepted and ready to land.Jan 14 2021, 6:39 AM
This revision was landed with ongoing or failed builds.Jan 14 2021, 6:52 AM
This revision was automatically updated to reflect the committed changes.