[all-commits] [llvm/llvm-project] bbab17: [Clang][Attr] fix a btf_type_attr CGDebugInfo code...

yonghong-song via All-commits all-commits at lists.llvm.org
Sat Nov 6 18:21:52 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bbab17c6c987d7a6612855c02a4e8988dac0dc17
      https://github.com/llvm/llvm-project/commit/bbab17c6c987d7a6612855c02a4e8988dac0dc17
  Author: Yonghong Song <yhs at fb.com>
  Date:   2021-11-06 (Sat, 06 Nov 2021)

  Changed paths:
    M clang/lib/CodeGen/CGDebugInfo.cpp

  Log Message:
  -----------
  [Clang][Attr] fix a btf_type_attr CGDebugInfo codegen bug

Nathan Chancellor reported a crash due to commit
3466e00716e1 (Reland "[Attr] support btf_type_tag attribute").

The following test can reproduce the crash:
  $ cat efi.i
  typedef unsigned long efi_query_variable_info_t(int);
  typedef struct {
    struct {
      efi_query_variable_info_t __attribute__((regparm(0))) * query_variable_info;
    };
  } efi_runtime_services_t;
  efi_runtime_services_t efi_0;
  $ clang -m32 -O2 -g -c -o /dev/null efi.i

The reason is that FunctionTypeLoc.getParam(Idx) may return a
nullptr which should be checked before dereferencing the
result pointer. This patch fixed this issue.




More information about the All-commits mailing list