Page MenuHomePhabricator

[mlir][CAPI][test] Change casts and fprintf format strings from long to intptr_t

Authored by zero9178 on May 25 2021, 6:48 AM.



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.

Diff Detail

Event Timeline

zero9178 created this revision.May 25 2021, 6:48 AM
zero9178 requested review of this revision.May 25 2021, 6:48 AM
stellaraccident accepted this revision.May 25 2021, 8:39 AM

Thank you for the fix!

This revision is now accepted and ready to land.May 25 2021, 8:39 AM