www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1539] New: X86 inline assembler fails to recognize when the branch address outside range

reply d-bugmail puremagic.com writes:

           Summary: X86 inline assembler fails to recognize when the branch
                    address outside range
           Product: D
           Version: 1.021
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: minor
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: grahamc001uk yahoo.co.uk

Inline assembler for X86 platform fails to recognize when the branch address of
a loop assembler instruction falls outside of the -128 .. +127 range.

Test program:

// Compiled with Digital Mars D Compiler v1.021
// on Windows XP.
import std.stdio;

void main() {

        writefln("start of loop");
        asm {
                mov     ECX,10  ;
                next:           ;
                // when the number of nop is increased to 127 the program
                // with 126 or less it works.
                nop             ;
                nop             ;
                nop             ;
                nop             ;
                nop             ;
                loop next       ;
        writefln("end of loop");

on failure produces the output:
start of loop
Error: Access Violation

despite compiling without any errors or warnings.

I classified as minor as I doubt if many people will be hit by it.
Only those writing more complex inline assembler code.

Sep 28 2007
parent d-bugmail puremagic.com writes:

thomas-dloop kuehne.cn changed:

           What    |Removed                     |Added
         OS/Version|Windows                     |All

------- Comment #1 from thomas-dloop kuehne.cn  2007-09-30 05:01 -------
Added to DStress as

Sep 30 2007