[llvm] r265514 - [IRVerifier] Avoid crashing on an invalid compile unit.

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 7 17:08:03 PDT 2016


On Wed, Apr 6, 2016 at 1:19 PM, Davide Italiano <davide at freebsd.org> wrote:
> On Wed, Apr 6, 2016 at 8:25 AM, David Blaikie <dblaikie at gmail.com> wrote:
>>
>>
>> On Tue, Apr 5, 2016 at 8:07 PM, Davide Italiano via llvm-commits
>> <llvm-commits at lists.llvm.org> wrote:
>>>
>>> Author: davide
>>> Date: Tue Apr  5 22:07:58 2016
>>> New Revision: 265514
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=265514&view=rev
>>> Log:
>>> [IRVerifier] Avoid crashing on an invalid compile unit.
>>>
>>> Added:
>>>     llvm/trunk/test/Verifier/dbg-invalid-compileunit.ll
>>> Modified:
>>>     llvm/trunk/lib/IR/Verifier.cpp
>>>
>>> Modified: llvm/trunk/lib/IR/Verifier.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Verifier.cpp?rev=265514&r1=265513&r2=265514&view=diff
>>>
>>> ==============================================================================
>>> --- llvm/trunk/lib/IR/Verifier.cpp (original)
>>> +++ llvm/trunk/lib/IR/Verifier.cpp Tue Apr  5 22:07:58 2016
>>> @@ -4376,13 +4376,14 @@ void Verifier::verifyTypeRefs() {
>>>    // Visit all the compile units again to map the type references.
>>>    SmallDenseMap<const MDString *, const DIType *, 32> TypeRefs;
>>>    for (auto *CU : CUs->operands())
>>> -    if (auto Ts = cast<DICompileUnit>(CU)->getRetainedTypes())
>>> -      for (DIType *Op : Ts)
>>> -        if (auto *T = dyn_cast_or_null<DICompositeType>(Op))
>>> -          if (auto *S = T->getRawIdentifier()) {
>>> -            UnresolvedTypeRefs.erase(S);
>>> -            TypeRefs.insert(std::make_pair(S, T));
>>> -          }
>>> +    if (isa<DICompileUnit>(CU))
>>> +      if (auto Ts = cast<DICompileUnit>(CU)->getRetainedTypes())
>>> +        for (DIType *Op : Ts)
>>> +          if (auto *T = dyn_cast_or_null<DICompositeType>(Op))
>>
>>
>> Total aside. I assume something should be checking that there aren't any
>> null entries in the retained types list (or indeed any entries that aren't
>> composite types, either)
>>

Hi David, I checked and we should be covered now.
r265752 fixes the crash I outlined earlier.



-- 
Davide

"There are no solved problems; there are only problems that are more
or less solved" -- Henri Poincare


More information about the llvm-commits mailing list