From 4e3d4622b1e7bd419815510e5f7cd0f96595b2a3 Mon Sep 17 00:00:00 2001 From: Alexey Bataev Date: Thu, 4 Jun 2020 17:33:13 -0400 Subject: [PATCH] Fix undefined behaviour when trying to deref nullptr. --- clang/lib/CodeGen/CodeGenFunction.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index 2b0ebad..cfd9950 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -684,18 +684,18 @@ public: /// Manages parent directive for scan directives. class ParentLoopDirectiveForScanRegion { CodeGenFunction &CGF; - const OMPExecutableDirective &ParentLoopDirectiveForScan; + const OMPExecutableDirective *ParentLoopDirectiveForScan; public: ParentLoopDirectiveForScanRegion( CodeGenFunction &CGF, const OMPExecutableDirective &ParentLoopDirectiveForScan) : CGF(CGF), - ParentLoopDirectiveForScan(*CGF.OMPParentLoopDirectiveForScan) { + ParentLoopDirectiveForScan(CGF.OMPParentLoopDirectiveForScan) { CGF.OMPParentLoopDirectiveForScan = &ParentLoopDirectiveForScan; } ~ParentLoopDirectiveForScanRegion() { - CGF.OMPParentLoopDirectiveForScan = &ParentLoopDirectiveForScan; + CGF.OMPParentLoopDirectiveForScan = ParentLoopDirectiveForScan; } }; -- 2.7.4