[PATCH] D105974: [analyzer] Do not assume that all pointers have the same bitwidth as void*

Bjorn Pettersson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 14 09:32:16 PDT 2021


bjope added a comment.

I think you can create an upstream test case by looking at `clang/test/Analysis/ptr.cl`.
It uses amdgcn and address space 256, which seems to have a different pointer size compared to address space zero for that specific target.

So the test case (named with a .cl extension) would look like this (I don't think you really need to specify verde as target cpu):

  // RUN: %clang_analyze_cc1 -triple amdgcn-unknown-unknown -target-cpu verde -analyze -analyzer-checker=core %s
  
  void test(__attribute__((address_space(256))) int * p) {
    __attribute__((address_space(256))) int * q = p-1;
    if (q) {}
    if (q) {} // crash
    (void)q;
  }


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105974



More information about the cfe-commits mailing list