[all-commits] [llvm/llvm-project] 09b5eb: [mlir][CAPI][test] Change casts and fprintf format...

zero9178 via All-commits all-commits at lists.llvm.org
Tue May 25 08:49:19 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 09b5ebc07b477e7e115299cf42fe7737736dd5da
      https://github.com/llvm/llvm-project/commit/09b5ebc07b477e7e115299cf42fe7737736dd5da
  Author: Markus Böck <markus.boeck02 at gmail.com>
  Date:   2021-05-25 (Tue, 25 May 2021)

  Changed paths:
    M mlir/test/CAPI/ir.c

  Log Message:
  -----------
  [mlir][CAPI][test] Change casts and fprintf format strings from long to intptr_t

A test in ir.c makes use of casting a void* to an integer type to print it's address. This cast is currently done with the datatype `long` however, which is only guaranteed to be equal to the pointer width on LP64 system. Other platforms may use a length not equal to the pointer width. 64bit Windows as an example uses 32 bit for `long` which does not match the 64 bit pointers.
This also results in clang warning due to `-Wvoid-pointer-to-int-cast`.

Technically speaking, since the test only passes the value 42, it does not cause any issues, but it'd be nice to fix the warning at least.

Differential Revision: https://reviews.llvm.org/D103085




More information about the All-commits mailing list