Skip to content

tests/codegen/casm.c: Move to casm.i to avoid calling the preprocessor #4662

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

Merged
merged 1 commit into from
May 19, 2024

Conversation

the-horo
Copy link
Contributor

This test may fail on x86 because, when calling the C preprocessor, ldc will append a -m argument based on the target. If the target is x86_64 and the host is x86 the C compiler may fail with:

cc1: error: CPU you selected does not support x86-64 instruction set

An easy solution for this is to specify i386 instead of x86_64 in the target triple.

I'm not 100% sure if the -mtriple argument can be just dropped so I went ahead with a more conservative fix.

@kinke
Copy link
Member

kinke commented May 19, 2024

We only need this to be a .c to preprocess the __asm__ to asm (done in importc.h). The cross-compilation complications for the preprocessor is also the only reason why this test is disabled on Windows. So I'd suggest making this an .i and replacing the __asm__ manually to asm to avoid the preprocessor and its complications, incl. enabling this test on Windows hosts too then.

FWIW, this test originates from https://github.com/ldc-developers/ldc/blob/master/tests/dmd/fail_compilation/fail24389.c.

Don't call the C preprocessor as it may fail in a cross-compilation
environment. Drop the `-mtriple` argument and let the test run on all
platforms.

Signed-off-by: Andrei Horodniceanu <[email protected]>
@the-horo the-horo changed the title tests/codegen/casm.c: Use i386 in target triple instead of x86_64 tests/codegen/casm.c: Move to casm.i to avoid calling the preprocessor May 19, 2024
@kinke kinke enabled auto-merge (squash) May 19, 2024 11:40
@kinke kinke merged commit 6a6dc70 into ldc-developers:master May 19, 2024
23 checks passed
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

Successfully merging this pull request may close these issues.

2 participants