[libcxx-commits] [PATCH] D101206: [libc++] Remove UB in list, forward_list and __hash_table

David Blaikie via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Sep 18 14:26:55 PDT 2023


dblaikie added a comment.

In D101206#4647500 <https://reviews.llvm.org/D101206#4647500>, @ldionne wrote:

> In D101206#4647492 <https://reviews.llvm.org/D101206#4647492>, @dblaikie wrote:
>
>>   RUN: clang x.cpp -g -c -o %t.o
>>   RUN: llvm-dwarfdump %t.o | FileCheck %s
>>   
>>   CHECK:   DW_AT_name "SomeType"
>>   CHECK-NOT: DW_AT_declaration
>>   CHECK-NOT: DW_TAG
>>   CHECK:  DW_AT_byte_size
>>   CHECK: DW_TAG
>>
>> (This is sort of hedging my bets a bit - checking both that it's not a declaration, and that it does have a size (size isn't included in declarations) - there's some risk that the attributes are out of order and that declaration or size could come before name, but I don't think LLVM produces type attributes in that order - pretty sure the name comes first)
>
> Thanks for the suggestion! We don't have access to FileCheck in the libc++ tests unfortunately, so this would require a bunch of additional work (as outlined in https://github.com/llvm/llvm-project/pull/65917). I also tried running this locally and I don't see anything that looks like `DW_AT_name "SomeType"` (where I imagine `SomeType` should be e.g. `__list_node` in some form)?

looks like it's `__forward_list_node` in this case? Here's an example with/without the attribute at some version of libc++ I have installed locally:

  $ clang++-tot test.cpp -g -c -stdlib=libc++ && llvm-dwarfdump-tot test.o | grep "DW_AT_name.*\"__forward_list_node<" -A5
                      DW_AT_name  ("__forward_list_node<int, void *>")
                      DW_AT_byte_size     (0x10)
                      DW_AT_decl_file     ("/usr/local/google/home/blaikie/dev/llvm/build/default/bin/../include/c++/v1/forward_list")
                      DW_AT_decl_line     (324)
  ...

  $ clang++-tot test.cpp -g -c -stdlib=libc++ && llvm-dwarfdump-tot test.o | grep "DW_AT_name.*\"__forward_list_node<" -A5
                      DW_AT_name  ("__forward_list_node<int, void *>")
                      DW_AT_declaration   (true)
  ...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101206



More information about the libcxx-commits mailing list