[PATCH] D118445: [clang][AVR] Fix a crash in AVRTargetCodeGenInfo::getGlobalVarAddressSpace

Ben Shi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 28 02:15:45 PST 2022


benshi001 added a comment.

clang crashes when compling some c++ for for AVR targets with `clang++ test.cc --target=avr -mmcu=atmega328 -S`, and the test.cc is

  volatile char *p = (volatile char *) 0x4000;
  class test {
          int v;
  public:
          test(int q): v(q) {}
          int get(void) { return v; }
          ~test() { *p = v; }
  };
  test obj(4);

The crash information shows that there is an derefference of an empty pointer in `AVRTargetCodeGenInfo::getGlobalVarAddressSpace`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118445



More information about the cfe-commits mailing list