Re: QWORD PTR error on Intel Mac




"fiopa" <fiopax@xxxxxxxxx> wrote in message
news:1i0hz96.1s6tz081yp3opgN%fiopax@xxxxxxxxxxxx
I use the XCode default compiler (GCC 4.0).
(XCode is the Apple free IDE)


It is like DWORD PTR point to a 64 bit real number on GCC 4.0 for Mac, ...

What do sizeof(float) and sizeof(double) return for each architecture: PC
and Mac? e.g., 4, and 8, respectively for both? This should tell you what
underlying size is being used by the compiler for each type. It's possible
that both float and double are the same (larger - 8) size on the Mac.
Anyway, your assembly needs to match the sizes each compiler is using. They
also need to match the binary floating point format used by the x87.
Compilers usually match the native binary format for simplicity. So, it
shouldn't be a problem. There are a few things you can do to get more
information: 1) compile some code using floats and doubles and disassemble
to see what instruction and syntax is being used, and 2) check for sections
on inline assembly in each compilers' manual. For GCC, to produce assembly
means using 'gcc -S' or 'objdump -d'.

Also, AFAICT, WORD PTR isn't valid with FLD.

From the Intel manuals, there are four forms of FLD:

FLD m32real
FLD m64real
FLD m80real
FLD ST(i)

From the MASM 5.1 manuals:

BYTE 1 byte
SBYTE 1 byte
WORD 2 bytes
SWORD 2 bytes
DWORD 4 byte, i.e., DWORD PTR is m32real
SDWORD 4 bytes
FWORD 6 bytes
QWORD 8 bytes, i.e., QWORD PTR is m64real
TBYTE 10 bytes, i.e., TBYTE PTR is m80real

So, WORD PTR shouldn't be valid with FLD. You should only use DWORD PTR,
QWORD PTR, or TBYTE PTR with FLD.


Rod Pemberton

.



Relevant Pages

  • Re: Fastcode integration
    ... function RectAdd(const X, Y: TRegtangularComplexS): TRegtangularComplexS; ... FLD X ... mov ax, OldCW ... fist dword ptr ...
    (borland.public.delphi.language.basm)
  • Re: sprintf leading up to bus error (signal 10)
    ... I don't know what exactly you're doing but this pointer cast makes me suspect that this is the case. ... value returned by malloc to the pointer you want to point to it. ... you are effectively telling the compiler you want space for N of the things ptr points to. ...
    (comp.lang.c)
  • Re: const variables
    ... The pointed-to int cannot be changed through ptr, ... Is it the C compiler that would give compile time error while trying to ... the behavior depends on what ptr and tmp point ... While freeing the memory, the compiler generated warning. ...
    (comp.lang.c)
  • Re: VC8 Compiler bizarreness
    ... The non relevant classes are te quirk of Koenig lookup that ... compiler tries to perform. ... TBool operator!=(TYPE* ptr) ... The above function must be const. ...
    (microsoft.public.vc.language)
  • Re: const variables
    ... Is it the C compiler that would give compile time error while trying to ... and may still issue a warning for this line. ... the behavior depends on what ptr and tmp point ... While freeing the memory, the compiler generated warning. ...
    (comp.lang.c)