forked from OSchip/llvm-project
[flang] Fix dangling pointer in LabelEnforce
`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. Differential Revision: https://reviews.llvm.org/D94618
This commit is contained in:
parent
0b46f19a9e
commit
3e41ab18db
|
@ -280,9 +280,9 @@ void DirectiveStructureChecker<D, C, PC, ClauseEnumSize>::CheckNoBranching(
|
|||
context_, directiveSource, directive, ContextDirectiveAsFortran()};
|
||||
parser::Walk(block, noBranchingEnforce);
|
||||
|
||||
auto construct{parser::ToUpperCaseLetters(getDirectiveName(directive).str())};
|
||||
LabelEnforce directiveLabelEnforce{context_, noBranchingEnforce.labels(),
|
||||
directiveSource,
|
||||
parser::ToUpperCaseLetters(getDirectiveName(directive).str()).c_str()};
|
||||
directiveSource, construct.c_str()};
|
||||
parser::Walk(block, directiveLabelEnforce);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue