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

Segfaults with 64bit addresses #17

Open
MintPaw opened this issue Oct 30, 2022 · 1 comment
Open

Segfaults with 64bit addresses #17

MintPaw opened this issue Oct 30, 2022 · 1 comment

Comments

@MintPaw
Copy link

MintPaw commented Oct 30, 2022

I see that 64bit support was added pretty recently. I get a lot of nondeterministic segfaults when trying to use the backend.c by itself.

Randomly on these line:

self->placement[set_id*self->ways+i] = self->placement[set_id*self->ways+i-1];

if(self->placement[set_id*self->ways+i].invalid == 0 &&

In cases when it crashes set_id and cl_id are negative while the source addr is positive, I get the feeling that shouldn't be the case.

Cache__get_cacheline_id takes addr as a long long, shifts it to the right, then returns it as a long. This can result in a negative return value, is that ok?

inline static long Cache__get_cacheline_id(Cache* self, long long addr) {
return addr >> self->cl_bits;
}

@JanLJL
Copy link
Contributor

JanLJL commented Nov 2, 2022

Hi @MintPaw,

thanks for the issue!
From what I can see it looks like you are right and we have to take care of some type conversions or data types, respectively.
Could you provide some test cases or sample code snippets to reproduce the segfaults?

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

No branches or pull requests

2 participants