[clang] 4e3d462 - Fix undefined behaviour when trying to deref nullptr.

Alexey Bataev via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 8 18:13:44 PDT 2020


Yes, it was revealed by the tests in ubsan testbot.

Best regards,
Alexey Bataev

> 8 июня 2020 г., в 21:10, David Blaikie <dblaikie at gmail.com> написал(а):
> 
> Is this covered by existing tests?
> 
>> On Thu, Jun 4, 2020 at 2:52 PM Alexey Bataev via cfe-commits
>> <cfe-commits at lists.llvm.org> wrote:
>> 
>> 
>> Author: Alexey Bataev
>> Date: 2020-06-04T17:52:06-04:00
>> New Revision: 4e3d4622b1e7bd419815510e5f7cd0f96595b2a3
>> 
>> URL: https://github.com/llvm/llvm-project/commit/4e3d4622b1e7bd419815510e5f7cd0f96595b2a3
>> DIFF: https://github.com/llvm/llvm-project/commit/4e3d4622b1e7bd419815510e5f7cd0f96595b2a3.diff
>> 
>> LOG: Fix undefined behaviour when trying to deref nullptr.
>> 
>> Added:
>> 
>> 
>> Modified:
>>    clang/lib/CodeGen/CodeGenFunction.h
>> 
>> Removed:
>> 
>> 
>> 
>> ################################################################################
>> diff  --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h
>> index 2b0ebad3088e..cfd9950066bb 100644
>> --- a/clang/lib/CodeGen/CodeGenFunction.h
>> +++ b/clang/lib/CodeGen/CodeGenFunction.h
>> @@ -684,18 +684,18 @@ class CodeGenFunction : public CodeGenTypeCache {
>>   /// 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;
>>     }
>>   };
>> 
>> 
>> 
>> 
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


More information about the cfe-commits mailing list