Bug 2941 – Wrong code for inline asm because CPU type is set too late

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2009-05-05T17:23:00Z
Last change time
2014-02-15T13:13:13Z
Keywords
wrong-code
Assigned to
nobody
Creator
clugdbug

Comments

Comment #0 by clugdbug — 2009-05-05T17:23:36Z
fstsw AX; should be producing fwait; fnstsw AX; (9B DF E0). Instead, it simply produces fnstsw AX; (DF E0).
Comment #1 by clugdbug — 2009-05-06T02:23:44Z
I've found the cause: iasm.c, line 1650-1651 is: else if ((ptb.pptb0->usFlags & _fwait) && config.target_cpu >= TARGET_80386) { Turns out that at this point, config.target_cpu is uninitialized! It's 0! It doesn't get initialized until much later. (In obj_start() in glue.c). I suspect that there should be a call to out_config_init() (in msc.c) at a very much earlier point, possibly even in mars.c. As this could be causing all sorts of problems elsewhere, I'm raising the severity.
Comment #2 by bugzilla — 2011-08-27T15:07:18Z