r360998 - Fix crash if, during evaluation of __builtin_object_size, we try to load

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Fri May 17 11:03:30 PDT 2019


Looks good, thanks :)

On Fri, 17 May 2019, 10:31 Nico Weber via cfe-commits, <
cfe-commits at lists.llvm.org> wrote:

> I attempted to fix this in 361054.
>
> *From: *Nico Weber <thakis at chromium.org>
> *Date: *Fri, May 17, 2019 at 1:16 PM
> *To: *Richard Smith
> *Cc: *cfe-commits
>
> Also on the LLVM waterfall:
>> http://lab.llvm.org:8011/builders/clang-x64-windows-msvc
>>
>> http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/6937/steps/stage%201%20check/logs/stdio
>>
>> (Same error.)
>>
>> *From: *Nico Weber <thakis at chromium.org>
>> *Date: *Fri, May 17, 2019 at 1:14 PM
>> *To: *Richard Smith
>> *Cc: *cfe-commits
>>
>> -- Testing: 49966 tests, 32 threads --
>>> Testing: 0 .. 10.. 20..
>>> FAIL: Clang :: SemaCXX/builtin-object-size-cxx14.cpp (14324 of 49966)
>>> ******************** TEST 'Clang ::
>>> SemaCXX/builtin-object-size-cxx14.cpp' FAILED ********************
>>> Script:
>>> --
>>> : 'RUN: at line 1';
>>> c:\b\s\w\ir\k\src\third_party\llvm-bootstrap\bin\clang.exe -cc1
>>> -internal-isystem
>>> c:\b\s\w\ir\k\src\third_party\llvm-bootstrap\lib\clang\9.0.0\include
>>> -nostdsysteminc -fsyntax-only -verify -std=c++14
>>> C:\b\s\w\ir\k\src\third_party\llvm\tools\clang\test\SemaCXX\builtin-object-size-cxx14.cpp
>>> --
>>> Exit Code: 1
>>>
>>> Command Output (stdout):
>>> --
>>> $ ":" "RUN: at line 1"
>>> $ "c:\b\s\w\ir\k\src\third_party\llvm-bootstrap\bin\clang.exe" "-cc1"
>>> "-internal-isystem"
>>> "c:\b\s\w\ir\k\src\third_party\llvm-bootstrap\lib\clang\9.0.0\include"
>>> "-nostdsysteminc" "-fsyntax-only" "-verify" "-std=c++14"
>>> "C:\b\s\w\ir\k\src\third_party\llvm\tools\clang\test\SemaCXX\builtin-object-size-cxx14.cpp"
>>> # command stderr:
>>> error: 'warning' diagnostics seen but not expected:
>>>   File
>>> C:\b\s\w\ir\k\src\third_party\llvm\tools\clang\test\SemaCXX\builtin-object-size-cxx14.cpp
>>> Line 105: implicit conversion from 'unsigned long long' to 'const long'
>>> changes value from 18446744073709551615 to -1
>>> 1 error generated.
>>>
>>> error: command failed with exit status: 1
>>>
>>>
>>> https://logs.chromium.org/logs/chromium/buildbucket/cr-buildbucket.appspot.com/8913196957157807760/+/steps/package_clang/0/stdout
>>>
>>> *From: *Nico Weber <thakis at chromium.org>
>>> *Date: *Fri, May 17, 2019 at 1:13 PM
>>> *To: *Richard Smith
>>> *Cc: *cfe-commits
>>>
>>> The test fails on Windows:
>>>>
>>>>
>>>> *From: *Richard Smith via cfe-commits <cfe-commits at lists.llvm.org>
>>>> *Date: *Fri, May 17, 2019 at 3:58 AM
>>>> *To: * <cfe-commits at lists.llvm.org>
>>>>
>>>> Author: rsmith
>>>>> Date: Fri May 17 01:01:34 2019
>>>>> New Revision: 360998
>>>>>
>>>>> URL: http://llvm.org/viewvc/llvm-project?rev=360998&view=rev
>>>>> Log:
>>>>> Fix crash if, during evaluation of __builtin_object_size, we try to
>>>>> load
>>>>> through an invalid base.
>>>>>
>>>>> Modified:
>>>>>     cfe/trunk/lib/AST/ExprConstant.cpp
>>>>>     cfe/trunk/test/SemaCXX/builtin-object-size-cxx14.cpp
>>>>>
>>>>> Modified: cfe/trunk/lib/AST/ExprConstant.cpp
>>>>> URL:
>>>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=360998&r1=360997&r2=360998&view=diff
>>>>>
>>>>> ==============================================================================
>>>>> --- cfe/trunk/lib/AST/ExprConstant.cpp (original)
>>>>> +++ cfe/trunk/lib/AST/ExprConstant.cpp Fri May 17 01:01:34 2019
>>>>> @@ -3285,6 +3285,11 @@ static bool AreElementsOfSameArray(QualT
>>>>>  static CompleteObject findCompleteObject(EvalInfo &Info, const Expr
>>>>> *E,
>>>>>                                           AccessKinds AK, const LValue
>>>>> &LVal,
>>>>>                                           QualType LValType) {
>>>>> +  if (LVal.InvalidBase) {
>>>>> +    Info.FFDiag(E);
>>>>> +    return CompleteObject();
>>>>> +  }
>>>>> +
>>>>>    if (!LVal.Base) {
>>>>>      Info.FFDiag(E, diag::note_constexpr_access_null) << AK;
>>>>>      return CompleteObject();
>>>>>
>>>>> Modified: cfe/trunk/test/SemaCXX/builtin-object-size-cxx14.cpp
>>>>> URL:
>>>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/builtin-object-size-cxx14.cpp?rev=360998&r1=360997&r2=360998&view=diff
>>>>>
>>>>> ==============================================================================
>>>>> --- cfe/trunk/test/SemaCXX/builtin-object-size-cxx14.cpp (original)
>>>>> +++ cfe/trunk/test/SemaCXX/builtin-object-size-cxx14.cpp Fri May 17
>>>>> 01:01:34 2019
>>>>> @@ -97,3 +97,10 @@ void tooSmallBuf() {
>>>>>    copy5CharsIntoStrict(small.buf); // expected-error{{no matching
>>>>> function for call}}
>>>>>  }
>>>>>  }
>>>>> +
>>>>> +namespace InvalidBase {
>>>>> +  // Ensure this doesn't crash.
>>>>> +  struct S { const char *name; };
>>>>> +  S invalid_base();
>>>>> +  constexpr long bos_name =
>>>>> __builtin_object_size(invalid_base().name, 1);
>>>>> +}
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> cfe-commits mailing list
>>>>> cfe-commits at lists.llvm.org
>>>>> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>>>>
>>>> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190517/767a1755/attachment.html>


More information about the cfe-commits mailing list