gh-111178: Avoid calling functions from incompatible pointer types in `longobject.c` by picnixz · Pull Request #122972 · python/cpython

@picnixz

@picnixz

@picnixz

I'll need a core dev to check whether this would fix the AMD64 Arch Linux Usan PR build bot. I think it should at least fix this compilation error but I'm not sure if there won't be more compilations errors.

@encukou Tell me if you want a NEWS entry for this one by the way (for me, it's an internal change that shouldn't affect the end user but feel free to argue). By the way, I closed python/buildmaster-config#517 in favor of keeping the meta issue even though the meta issue was only about warnings whereas the other issue was about the buildbot failure itself (for which the warnings are errors).

@encukou

@bedevere-bot

🤖 New build scheduled with the buildbot fleet by @encukou for commit cd63f58 🤖

The command will test the builders whose names match following regular expression: Usan

The builders matched are:

  • AMD64 Arch Linux Usan PR

@encukou

Thank you for the fix! It looks good to merge if the buildbot passes.

No NEWS required; I agree with your triage.

@picnixz

So, the fix fixed it but since the compiler early exits, there are more errors appearing:

Objects/object.c:2892:5: runtime error: call to function MemoryError_dealloc through pointer to incorrect function type 'void (*)(struct _object *)'
/buildbot/buildarea/pull_request.pablogsal-arch-x86_64.clang-ubsan/build/Objects/exceptions.c:3391: note: MemoryError_dealloc defined here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior Objects/object.c:2892:5 in 

Should I try to fix the build bot in one go, or do we just merge this one, then fix compilation errors one by one? (this would affect the title of the PR as well btw and I don't think I'm able to run a build bot myself to check).

(I fear that the build bot will be failing until we fix all those kind of functions with explicit casts...)

See #123004 for the incremental fixes that I will make.

@encukou

Should I try to fix the build bot in one go, or do we just merge this one, then fix compilation errors one by one?

Let's go for something between that. After a PR is merged, or in a few days, open a new one with however many fixes you have.

Even if it's just one.
I'll merge this PR; it's an improvement.

I don't think I'm able to run a build bot myself to check

Are you able to run USAN on your machine? There are instructions in the devguide (for *nix, though the installation looks very outdated, it should be easier now); also the buildbot logs have the commands to run (but not to install clang).
For this particular issue you can use -fsanitize=function rather than the full -fsanitize=undefined.

@picnixz picnixz deleted the fix-arch-linux-usan-failure branch

August 14, 2024 09:57

blhsing pushed a commit to blhsing/cpython that referenced this pull request

Aug 22, 2024