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

Compiler Crash (unable to legalize) #41

Closed
mateoconlechuga opened this issue Nov 23, 2023 · 2 comments
Closed

Compiler Crash (unable to legalize) #41

mateoconlechuga opened this issue Nov 23, 2023 · 2 comments

Comments

@mateoconlechuga
Copy link

mateoconlechuga commented Nov 23, 2023

Compiler crashes when any of O1,O2,O3,Os,Ofast is used.

main.c

extern void a(int k);
void m(void)
{
    for (int k = 0;;)
    {
        a(k++ / 3);
    }
}

error:

fatal error: error in backend: unable to legalize instruction: %26:_(s48) = G_LSHR %24:_, %27:_(s8) (in function: m)
@adriweb
Copy link

adriweb commented Nov 23, 2023

The nightly toolchain just wasn't pulling the "correct" compiler build (due to one of the CI thing failing (the old mac build can be fixed or removed @jacobly0 :P)
I can confirm the latest compiler works fine:

	section	.text,"ax",@progbits
	assume	adl = 1
	section	.text,"ax",@progbits
	public	_m
_m:
	ld	hl, -3
	call	__frameset
	or	a, a
	sbc	hl, hl
	push	hl
	pop	de
BB0_1:
	inc	de
	ld	(ix - 3), de
	ld	bc, 3
	call	__idivu
	push	hl
	call	_a
	ld	de, (ix - 3)
	pop	hl
	push	de
	pop	hl
	jr	BB0_1
	section	.text,"ax",@progbits

	ident	"clang version 15.0.0 (https://github.com/jacobly0/llvm-project.git 87dbcb9ad4aac66fa28b578e02021919589d3e82)"
	extern	__idivu
	extern	__Unwind_SjLj_Register
	extern	__Unwind_SjLj_Unregister
	extern	__frameset
	extern	_a

@mateoconlechuga
Copy link
Author

This is because the actions are broken so I was testing the wrong compiler version

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