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

Invalid instruction error even though no invalid instructions emitted #1384

Open
negge opened this issue Jan 22, 2025 · 1 comment
Open

Invalid instruction error even though no invalid instructions emitted #1384

negge opened this issue Jan 22, 2025 · 1 comment

Comments

@negge
Copy link

negge commented Jan 22, 2025

I am getting error E1156: Assembler error: 'Invalid instruction with current CPU setting' even though no invalid instructions are emitted when compiling. For example:

int times3(int a);
#pragma aux times3 parm [ax] value [ax] = \
  "imul ax, 3"

void main() {
}

when compiled with wcc -0 test.c gives the following error:

$ wcc -0 test.c
Open Watcom C x86 16-bit Optimizing Compiler
Version 2.0 beta Jun  1 2024 01:58:31 (32-bit)
Copyright (c) 2002-2024 The Open Watcom Contributors. All Rights Reserved.
Portions Copyright (c) 1984-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See https://github.com/open-watcom/open-watcom-v2#readme for details.
test.c(3): Error! E1156: Assembler error: 'Invalid instruction with current CPU setting'
test.c: 7 lines, 0 warnings, 1 errors

This should be a warning at most, and preferably not even that, since times3() is never called.

@jmalak
Copy link
Member

jmalak commented Jan 22, 2025

IMUL reg,imm is invalid on 8086.
#pragma aux times3 is template, not instantiated in code then it isn't reason to suppress error.

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