bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

'call dword ptr label' producing wrong code ?


From: Krzysztof Foltman
Subject: 'call dword ptr label' producing wrong code ?
Date: Mon, 3 Mar 2003 00:50:28 +0100

Version: 2.13.90.0.16 (debian) or 2.13 (mingw)

Code snippet:
          .intel_syntax
          .section .text

          call dword ptr label
          call dword ptr [label]

          .section .data,"w"
label:

Command line:
        as test.s && objdump -Mintel_syntax -S a.out

Output:
00000000 <.text>:
   0:   e8 fc ff ff ff          call   1 <.text+0x1>         ; this is
wrong ?
   5:   ff 15 00 00 00 00       call   *0x0                  ; this is
right

Comment:
This sequence produces two calls, the first one is NEAR PTR, the second
one is DWORD PTR. However, GCC 3.2.2 in -masm=intel mode produces the
first form when it really wants an indirect call (so it should generate
the second form), which leads to wrong code. AFAIR (and according to
common sense too), in correctly implemented Intel syntax both forms
should generate an indirect call (FF 15 labeloffset) - and it's
consistent with GCC behaviour.

Right or wrong ?

Krzysztof Foltman






reply via email to

[Prev in Thread] Current Thread [Next in Thread]