Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libgccjit: Allow sending a const pointer as argument #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

antoyo
Copy link
Owner

@antoyo antoyo commented Oct 16, 2024

ML Link: https://gcc.gnu.org/pipermail/jit/2023q4/001759.html

gcc/jit/ChangeLog:

* jit-recording.h: Remove memento_of_get_const::accepts_writes_from.

gcc/testsuite/ChangeLog:

* jit.dg/all-non-failing-tests.h: Add test-const-pointer-argument.c.
* jit.dg/test-const-pointer-argument.c: New test.

@antoyo antoyo added the waiting for review Waiting for review from upstream libgccjit maintainer label Oct 17, 2024
@davidmalcolm
Copy link
Collaborator

I've commented on the ML here: https://gcc.gnu.org/pipermail/jit/2024q4/001941.html

@antoyo antoyo added waiting on author and removed waiting for review Waiting for review from upstream libgccjit maintainer labels Nov 20, 2024
gcc/jit/ChangeLog:

	* jit-recording.h: Remove memento_of_get_const::accepts_writes_from,
	memento_of_get_type::is_same_type_as: new method.

gcc/testsuite/ChangeLog:

	* jit.dg/all-non-failing-tests.h: Add test-const-pointer-argument.c.
	* jit.dg/test-const-pointer-argument.c: New test.
@antoyo antoyo force-pushed the const-pointer-argument branch from 7a57f72 to f8ae821 Compare November 22, 2024 16:44
@antoyo
Copy link
Owner Author

antoyo commented Nov 22, 2024

@davidmalcolm: Thanks for the review.

I updated the test so that it makes more sense and reflect the bug I actually have: I needed to add an implementation of is_same_type_as to make it work.

I do not know how to keep the type safety, though, as the same code is used for assignements (where we would not want to assign to a const) and parameters (where we can send a const argument).
Do you have an idea for an easy way to fix this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants