Endilll wrote: > Perhaps I'm misunderstanding something, but the visitor should return > instances of `CXChildVisitResult`, which is a bare `enum` with no explicit > type and only 3 variants, so a regular `int` should be enough. Why would this > need a `long`?
The issue is that when this enum is put into a register that serves as the return slot, `c_int` preserves the upper four bytes of that register, which causes them to be garbage alongside the actual value in the lower 4 bytes. So the fix definitely makes sense on some level, but I wonder why `ctypes` does not sign-extend `c_int` on s390x to satisfy their psABI. @miladfarca can you raise or find an existing issue about this on ctypes side, and put it as a comment in the code? My hope is that this would be a somewhat temporary fix, until Python releases with this bug reach EOL. Also, can we limit this workaround to s390x? I guess `ctypes` has less bugs on mainstream platforms, because I haven't seen other platform complaining about this. For the reference, I dug up the following in s390x psABI version 1.7 (1.2.5 "Return Values"): > Any integer type with 64 or fewer bits, including _BitInt(𝑁) with 𝑁 ≤ 64, > _Bool, as well as any enum type, is returned in r2. The return value is zero- or sign-extended to 64 bits, as appropriate. https://github.com/llvm/llvm-project/pull/221024 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
