[PATCH] D132900: [DWARF] Fix infinite recursion in Type Printer.

Alexander Yermolovich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 9 15:42:02 PDT 2022


ayermolo added a comment.

In D132900#3781118 <https://reviews.llvm.org/D132900#3781118>, @dblaikie wrote:

> In D132900#3780904 <https://reviews.llvm.org/D132900#3780904>, @dblaikie wrote:
>
>> Reduced down to:
>>
>>   struct t1;
>>   
>>   void f1() {
>>     using t2 = t1;
>>     void (t2::* __fn)();
>>   }
>>
>> Still investigating.
>
> Ah, so the critical difference between GCC and Clang's DWARF on this is that GCC creates the pointer type (when it's pointer-to-local-typedef) inside the subroutine_type (it's probably trying to create it inside the function, since the pointer type, while not strictly scoped, would only be usable inside the function type anyway) - this creates the infinite recursion when trying to print the scope of the pointer type (really a pointer type is unscoped, since it's unnamed - maybe we could fix it so we don't print out any scope info for unnameable types (anonymous structs/classes/etc are still logically scoped even though they don't have a name, for instance - but pointer types never really have a scope/name, just a representation))

So basically if path goes from DW_TAG_ptr_to_member_type or DW_TAG_pointer_type and DW_TAG_subroutine_type we will end up in the infinite loop?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132900/new/

https://reviews.llvm.org/D132900



More information about the llvm-commits mailing list