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

__divdi3 crashes on 68060 #391

Closed
BSzili opened this issue Apr 11, 2024 · 6 comments
Closed

__divdi3 crashes on 68060 #391

BSzili opened this issue Apr 11, 2024 · 6 comments

Comments

@BSzili
Copy link
Contributor

BSzili commented Apr 11, 2024

I have a standard 16.16 fixed point division function, and it seem like the 060 version of __divdi3 has some issues. I created a small test case to reproduce it. This is my fixeddiv.c:

int FixedDiv(int a, int b)
{
	return (int)(((long long)a << 16) / b);
}

int main(void)
{
	int j = FixedDiv(0, 4194304);
	return 0;
}

Then I build two executables:
m68k-amigaos-gcc -save-temps -noixemul -m68060 -o fixeddiv.060 fixeddiv.c
m68k-amigaos-gcc -save-temps -noixemul -m68020 -o fixeddiv.020 fixeddiv.c
The 020 one works, but the 060 exe crashes with a 80000005 program failure. The generated asm output is the same, so I guess the difference is in libgcc.a? For reference I uploaded the two executables I built, in case my setup is borked:
https://bszili.morphos.me/stuff/fixeddiv.020
https://bszili.morphos.me/stuff/fixeddiv.060
Thank you for the help in advance!

@bebbo
Copy link
Owner

bebbo commented Apr 11, 2024

I can't reproduce this issue.

@BSzili
Copy link
Contributor Author

BSzili commented Apr 11, 2024

It must be config dependent. I made a self-contained test case with WinUAE that reproduces the crash:
https://bszili.morphos.me/stuff/divtest.zip
I included setpatch, but it happens without it as well.

@bebbo
Copy link
Owner

bebbo commented Apr 11, 2024

your executable crashes, but I cannot build such a crashing executable.

@bebbo
Copy link
Owner

bebbo commented Apr 11, 2024

agc391.zip
these are the results building with a clean and fresh prefix

@BSzili
Copy link
Contributor Author

BSzili commented Apr 11, 2024

I see, thanks for the clarification! I'll do a drop-prefix + clean and report back.

@BSzili
Copy link
Contributor Author

BSzili commented Apr 13, 2024

Re-doing my setup fixed it. Sorry for the false alarm, closing this.

@BSzili BSzili closed this as completed Apr 13, 2024
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