[flang] Fix crashes in ResolveOmpObject and RewriteOpenMPLoopConstruct
Using debug build of f18, `omp-resolve01.f90` sometimes crashed in `OmpVisitor::ResolveOmpObject`. This was because when the designator was analyzed it could be rewritten from an `ArrayElement` to a `Substring`. That made the reference to the `Name` inside the designator no longer valid so the crash happened when it was referenced later. The fix is to return when the substring is detected so the name is not referenced. Also, the name returned from `ResolveDesignator` can but null so it must be checked. The crash in `RewriteOpenMPLoopConstruct` happened intermittently on `omp-loop-association.f90`. It happened when the DO construct was the last element of the block. In that case `block.erase()` returns an iterator pointing to `block.end()` which must not be dereferenced. Original-commit: flang-compiler/f18@3299972d047696aca28212131ab4644a3966fc8b Reviewed-on: https://github.com/flang-compiler/f18/pull/824
Loading
Please sign in to comment