-
Notifications
You must be signed in to change notification settings - Fork 27
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
warning: ‘fmpz_mod_mat_mul’ accessing 40 bytes in a region of size 32 #187
Comments
Here we have: cdef extern from "flint/fmpz_mod_mat.h":
ctypedef struct fmpz_mod_mat_struct:
fmpz_mat_t mat
fmpz_t mod
ctypedef fmpz_mod_mat_struct fmpz_mod_mat_t[1] and in the C source: https://github.com/flintlib/flint/blob/05340d2a7349761aff2cd3370810c93e2174ce46/src/fmpz_mod_types.h#L36 typedef fmpz_mat_struct fmpz_mod_mat_struct;
typedef fmpz_mod_mat_struct fmpz_mod_mat_t[1]; So maybe we want instead cdef extern from "flint/fmpz_mod_mat.h":
ctypedef fmpz_mat_struct fmpz_mod_mat_struct:
ctypedef fmpz_mod_mat_struct fmpz_mod_mat_t[1] |
oh i see there's this change in 3.1.0 versus earlier versions of flint -- so maybe that's the issue? |
It is probably better to correct the struct definition but I don't know if that would break under older Flint. It might be that we can just make it an opaque struct. I assume we don't need to access the I have been seeing warnings like that for a long time coming from different parts of the codebase but I don't see them now when building with latest flint. The CI job you point to is using Flint 3.0.1 though. |
We're not able to do two different struct definitions for different flint, right? |
We can have different struct definitions but it needs to be done in the C preprocessor just like the other python-flint/src/flint/flintlib/fmpz_mod_mat.pxd Lines 21 to 30 in 5445684
From Cython's perspective the struct would be opaque but we could also use the preprocessor to define macros to access the elements if needed. |
so could we do: cdef extern from "flint/fmpz_mod_mat.h":
ctypedef struct fmpz_mod_mat_struct_new:
fmpz_mat_t mat
fmpz_t mod
ctypedef fmpz_mod_mat_struct_newfmpz_mod_mat_new_t[1]
ctypedef fmpz_mat_struct fmpz_mod_mat_struct_old:
ctypedef fmpz_mod_mat_struct fmpz_mod_mat_old_t[1] Then use |
That might work. I was imagining something more like
If we need something to be different at the C level for different Flint versions it needs to be handled by the C preprocessor and it all needs to be opaque from Cython's perspective. |
Noticed in the CI that there's something wrong about the mat_mul operations (https://github.com/flintlib/python-flint/actions/runs/10402835971/job/28808112409?pr=182)
For example
The text was updated successfully, but these errors were encountered: