r241705 - AST: Avoid reading an unitialized value

Aaron Ballman aaron at aaronballman.com
Wed Jul 8 13:44:15 PDT 2015


On Wed, Jul 8, 2015 at 3:55 PM, Justin Bogner <mail at justinbogner.com> wrote:
> Aaron Ballman <aaron at aaronballman.com> writes:
>> Test case?
>
> Well, it fixed at least 30 test failures in "ninja check-clang" under
> ubsan. I'm not really sure it can be triggered reliably without ubsan.

If we have ubsan tests that are run by a bot, then I think existing
tests probably cover it.

~Aaron

>
>> ~Aaron
>>
>> On Wed, Jul 8, 2015 at 2:32 PM, Justin Bogner <mail at justinbogner.com> wrote:
>>> Author: bogner
>>> Date: Wed Jul  8 13:32:26 2015
>>> New Revision: 241705
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=241705&view=rev
>>> Log:
>>> AST: Avoid reading an unitialized value
>>>
>>> Desugar doesn't necessarily initialize ShouldAKA, but as of r241542 it
>>> may read it. Fix the misuse of the API and initialize this before
>>> passing it in.
>>>
>>> Found by ubsan.
>>>
>>> Modified:
>>>     cfe/trunk/lib/AST/ASTDiagnostic.cpp
>>>
>>> Modified: cfe/trunk/lib/AST/ASTDiagnostic.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDiagnostic.cpp?rev=241705&r1=241704&r2=241705&view=diff
>>> ==============================================================================
>>> --- cfe/trunk/lib/AST/ASTDiagnostic.cpp (original)
>>> +++ cfe/trunk/lib/AST/ASTDiagnostic.cpp Wed Jul  8 13:32:26 2015
>>> @@ -192,8 +192,8 @@ ConvertTypeToDiagnosticString(ASTContext
>>>      if (CompareCanTy == CanTy)
>>>        continue;  // Same canonical types
>>>      std::string CompareS = CompareTy.getAsString(Context.getPrintingPolicy());
>>> -    bool aka;
>>> -    QualType CompareDesugar = Desugar(Context, CompareTy, aka);
>>> +    bool ShouldAKA = false;
>>> +    QualType CompareDesugar = Desugar(Context, CompareTy, ShouldAKA);
>>>      std::string CompareDesugarStr =
>>>          CompareDesugar.getAsString(Context.getPrintingPolicy());
>>>      if (CompareS != S && CompareDesugarStr != S)
>>>
>>>
>>> _______________________________________________
>>> cfe-commits mailing list
>>> cfe-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits



More information about the cfe-commits mailing list