Thread overview
[Issue 1829] New: Inline assembler cannot get label addresses
Feb 12, 2008
d-bugmail
Feb 25, 2008
d-bugmail
Mar 04, 2008
d-bugmail
Mar 10, 2008
d-bugmail
May 15, 2012
ponce
Dec 27, 2012
yebblies
Dec 27, 2012
yebblies
Dec 27, 2012
Dmitry Olshansky
February 12, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1829

           Summary: Inline assembler cannot get label addresses
           Product: D
           Version: 1.026
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: burton-radons@shaw.ca


The inline assembler can't read label addresses. This makes it impossible to do certain low-level tasks. For example, this code is rejected:

        asm
        {
        label:
                push label;
        }

With the error "undefined identifier 'label'". Given that it's blocking me, I've given this major severity.


-- 

February 25, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1829





------- Comment #1 from thomas-dloop@kuehne.cn  2008-02-25 05:08 -------
Added to DStress as http://dstress.kuehne.cn/run/a/asm_lea_03_A.d http://dstress.kuehne.cn/run/a/asm_lea_03_B.d


-- 

March 04, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1829


bugzilla@digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|major                       |minor




------- Comment #2 from bugzilla@digitalmars.com  2008-03-04 02:01 -------
Here's how to push a label on the stack:

    call L1 ;
 L1:

Because the workaround is straightforward, I'm going to lower the priority. It's not likely to get fixed soon, as it's been a limitation of the inline assembler for 15 years. :-(


-- 

March 10, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1829





------- Comment #3 from burton-radons@shaw.ca  2008-03-10 14:45 -------
That's a bizarre workaround. If I needed to get the address of a block of code (such as an exception handler) I'd have to do something like this:

  call grab_exception_handler_address; // Grab the exception handler and put it
in EAX.
  ...

grab_exception_handler_address:
  // Try to make it as thread-safe as possible to tell the exception handler
we're pulling an address.
  mov EAX, 0xDEADBEEF;
  mov ECX, 0xBEEFDEAD;
  mov EDX, 0x12345678;
  call exception_handler;
  mov EAX, [ESP];
  ret;

exception_handler:
  test EAX, 0xDEADBEEF;
  jne exception_handler_body;
  test ECX, 0xBEEFDEAD;
  jne exception_handler_body;
  test EDX, 0x12345678;
  jne exception_handler_body;
  // Pulling an address, do nothing.
  ret;
exception_handler_body:
  // Actually calling the exception.

I don't know that I'd call that "straightforward", but I understand you being limited by your code.


-- 

May 15, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=1829


ponce <aliloko@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aliloko@gmail.com


--- Comment #4 from ponce <aliloko@gmail.com> 2012-05-15 15:42:19 PDT ---
This missing feature pervents making manual jump-tables.

It's not a biggie if final switch can generate branchless jump-tables.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 27, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=1829


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |p0lycyb0rg@gmail.com


--- Comment #5 from yebblies <yebblies@gmail.com> 2012-12-27 18:27:53 EST ---
*** Issue 2505 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 27, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=1829


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dmitry.olsh@gmail.com


--- Comment #6 from yebblies <yebblies@gmail.com> 2012-12-27 18:27:59 EST ---
*** Issue 8448 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 27, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=1829


Dmitry Olshansky <dmitry.olsh@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|1.026                       |D1 & D2
         OS/Version|Windows                     |All


--- Comment #7 from Dmitry Olshansky <dmitry.olsh@gmail.com> 2012-12-27 01:52:43 PST ---
Applies to D2 as well.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------