http://www.perlmonks.org?node_id=879044

BrowserUk has asked for the wisdom of the Perl Monks concerning the following question:

Please modify this MS specific C code to compile under gcc on both 32-bit & 64-bit platforma and produce the same output:

#include <stdio.h> #define ALIGN_BITS ( sizeof(void*) >> 1i64 ) #define BIT_BITS 3i64 #define BYTE_BITS 14i64 #define SLOT_BITS ( sizeof( void*) * 8 )-( ALIGN_BITS + BIT_BITS + B +YTE_BITS ) #define BYTES_PER_SLOT 1i64 << BYTE_BITS int check_new( uintptr_t p ) { ptrdiff_t slot = ( p >> (BYTE_BITS + BIT_BITS + ALIGN_BITS) ); ptrdiff_t byte = ( p >> (ALIGN_BITS + BIT_BITS)) & 0x00003fffi64; ptrdiff_t bit = ( p >> ALIGN_BITS) & 0x00000007i64; ptrdiff_t nop = p & 0x3i64; printf( "address: %p slot: %p byte: %4x bit: %4x nop:%x\n", p, slot, byte, bit, nop ); return 1; } void main( void ) { uintptr_t p; for( p = 123456i64; p < ( 1Ui64 << 34 ); p += ( 1Ui64 << 29 ) ) { check_new( p ); } } /* C:\test>tracking address: 000000000001E240 slot: 0000000000000000 byte: 3c4 bit: 4 +nop:0 address: 000000002001E240 slot: 0000000000000100 byte: 3c4 bit: 4 +nop:0 address: 000000004001E240 slot: 0000000000000200 byte: 3c4 bit: 4 +nop:0 address: 000000006001E240 slot: 0000000000000300 byte: 3c4 bit: 4 +nop:0 address: 000000008001E240 slot: 0000000000000400 byte: 3c4 bit: 4 +nop:0 address: 00000000A001E240 slot: 0000000000000500 byte: 3c4 bit: 4 +nop:0 address: 00000000C001E240 slot: 0000000000000600 byte: 3c4 bit: 4 +nop:0 address: 00000000E001E240 slot: 0000000000000700 byte: 3c4 bit: 4 +nop:0 address: 000000010001E240 slot: 0000000000000800 byte: 3c4 bit: 4 +nop:0 address: 000000012001E240 slot: 0000000000000900 byte: 3c4 bit: 4 +nop:0 address: 000000014001E240 slot: 0000000000000A00 byte: 3c4 bit: 4 +nop:0 address: 000000016001E240 slot: 0000000000000B00 byte: 3c4 bit: 4 +nop:0 address: 000000018001E240 slot: 0000000000000C00 byte: 3c4 bit: 4 +nop:0 address: 00000001A001E240 slot: 0000000000000D00 byte: 3c4 bit: 4 +nop:0 address: 00000001C001E240 slot: 0000000000000E00 byte: 3c4 bit: 4 +nop:0 address: 00000001E001E240 slot: 0000000000000F00 byte: 3c4 bit: 4 +nop:0 address: 000000020001E240 slot: 0000000000001000 byte: 3c4 bit: 4 +nop:0 address: 000000022001E240 slot: 0000000000001100 byte: 3c4 bit: 4 +nop:0 address: 000000024001E240 slot: 0000000000001200 byte: 3c4 bit: 4 +nop:0 address: 000000026001E240 slot: 0000000000001300 byte: 3c4 bit: 4 +nop:0 address: 000000028001E240 slot: 0000000000001400 byte: 3c4 bit: 4 +nop:0 address: 00000002A001E240 slot: 0000000000001500 byte: 3c4 bit: 4 +nop:0 address: 00000002C001E240 slot: 0000000000001600 byte: 3c4 bit: 4 +nop:0 address: 00000002E001E240 slot: 0000000000001700 byte: 3c4 bit: 4 +nop:0 address: 000000030001E240 slot: 0000000000001800 byte: 3c4 bit: 4 +nop:0 address: 000000032001E240 slot: 0000000000001900 byte: 3c4 bit: 4 +nop:0 address: 000000034001E240 slot: 0000000000001A00 byte: 3c4 bit: 4 +nop:0 address: 000000036001E240 slot: 0000000000001B00 byte: 3c4 bit: 4 +nop:0 address: 000000038001E240 slot: 0000000000001C00 byte: 3c4 bit: 4 +nop:0 address: 00000003A001E240 slot: 0000000000001D00 byte: 3c4 bit: 4 +nop:0 address: 00000003C001E240 slot: 0000000000001E00 byte: 3c4 bit: 4 +nop:0 address: 00000003E001E240 slot: 0000000000001F00 byte: 3c4 bit: 4 +nop:0 */

Many thanks!


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re: 64-bit *nix/gcc expertise required
by ikegami (Patriarch) on Dec 24, 2010 at 17:27 UTC

    Please modify this MS specific C code to compile under gcc on both 32-bit & 64-bit platforma and produce the same output:

    Pointer 1<<34 doesn't make sense on 32-bit platforms.

    I also don't see how you can get the same output on 32-bit and 64-bit platforms when ALIGN_BITS depends on the pointer size (sizeof(void*) >> 1i64). The data or ALIGN_BITS would need to be changed.

    On to the real question, you need the following to be configurable:

    • The integer type that corresponds to a pointer (uintptr_t),
    • the format specifiers for uintptr_t constants (UINTPTR_CONST) and
    • the printf format specifiers for uintptr_t (UINTPTRXf).

    So here goes:

    #include <stdio.h> /* **** For a system where a pointer is an unsigned long long: */ typedef unsigned long long uintptr_t; #define UINTPTR_CONST(p) ((uintptr_t)p##ULL) #define UINTPTRXf "llX" /* **** For a system where a pointer is an unsigned long: typedef unsigned long uintptr_t; #define UINTPTR_CONST(p) ((uintptr_t)p##UL) #define UINTPTRXf "lX" */ #define NOP_BITS 2 #define BIT_BITS 3 #define BYTE_BITS 14 #define NOP_MASK UINTPTR_CONST(0x00000003) #define BIT_MASK UINTPTR_CONST(0x00000007) #define BYTE_MASK UINTPTR_CONST(0x00003FFF) #define NOP_OFFSET 0 #define BIT_OFFSET (sizeof(void*) >> 1) #define BYTE_OFFSET (BIT_OFFSET + BIT_BITS) #define SLOT_OFFSET (BYTE_OFFSET + BYTE_BITS) void check_new(void* p) { register uintptr_t i = (uintptr_t)p; uintptr_t slot = ( i >> SLOT_OFFSET ); uintptr_t byte = ( i >> BYTE_OFFSET ) & BYTE_MASK; uintptr_t bit = ( i >> BIT_OFFSET ) & BIT_MASK; uintptr_t nop = ( i >> NOP_OFFSET ) & NOP_MASK; printf("address: %012p " "slot: %012p " "byte: %4"UINTPTRXf" " "bit: %4"UINTPTRXf" " "nop: %"UINTPTRXf"\n", p, (void*)slot, byte, bit, nop ); } int main(int argc, char *argv[]) { void* p; for ( p = (void*)UINTPTR_CONST(123456); p < (void*)(UINTPTR_CONST(1) << 34); p += (UINTPTR_CONST(1) << 29) ) check_new(p); return 0; }
      Pointer 1<<34 doesn't make sense on 32-bit platforms.

      The for loop in main, indeed the whole of main is just a test harness.

      I need to simulate addresses that span the 32-bit boundary in 64-bit and slot size in both 32/64-bit.

      I also don't see how you can get the same output on 32-bit and 64-bit platforms when ALIGN_BITS depends on the pointer size (sizeof(void*) >> 1i64). The data or ALIGN_BITS would need to be changed.

      You are right that the output won't be the same in both modes.

      The nice thing about the MS compiler intrinsic types is that my posted code compiles clean under /Wall in both modes. And runs, doing the 'right thing' in both modes. Albiet that the for loop never terminates in 32-bit mode due to wraparound.

      Your code

      The salient bit missing from your code is the conditional test for 32/64 bit compilation?

      Also, what you've called NOP_BITS (which is unused) would be 3 or 4 (32/64 repectively) not 2.

      Does your code produce the same output for 64-bit?


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

        The nice thing about the MS compiler intrinsic types is that my posted code compiles clean under /Wall in both modes

        MS compiler is usually good about giving these kind warnings from what I hear. I guess this is a situation it misses.

        Does your code produce the same output for 64-bit?

        Aside from printf formatting differences, yes.

        Also, what you've called NOP_BITS (which is unused) would be 3 or 4 (32/64 repectively) not 2.

        Your code uses & 0x3. That's 2 bits. I take it that's a bug.

        The salient bit missing from your code is the conditional test for 32/64 bit compilation?

        That's normally handled by a configuration script. It's not just based on the size of the pointers, but on the compiler's definition of "unsigned long" and such.

        stdint.h provides uintptr_t, but not the others.

        If this is XS code, Perl providers similar tools for you already.

        The code is now:

        #include <stdint.h> #include <stdio.h> #if UINTPTR_MAX == UINT32_MAX # define UINTPTR_C(p) UINT32_C(p) #elif UINTPTR_MAX == UINT64_MAX # define UINTPTR_C(p) UINT64_C(p) #else # error uintptr_t size not handled. #endif #define PAD_BITS (sizeof(void*) >> 1) #define BIT_BITS 3 #define BYTE_BITS 14 #define PAD_MASK ((UINTPTR_C(1) << PAD_BITS) - 1) #define BIT_MASK UINTPTR_C(0x00000007) #define BYTE_MASK UINTPTR_C(0x00003FFF) #define PAD_OFFSET 0 #define BIT_OFFSET (PAD_OFFSET + PAD_BITS) #define BYTE_OFFSET (BIT_OFFSET + BIT_BITS) #define SLOT_OFFSET (BYTE_OFFSET + BYTE_BITS) void check_new(void* p) { register uintptr_t i = (uintptr_t)p; uintptr_t slot = ( i >> SLOT_OFFSET ); uintptr_t byte = ( i >> BYTE_OFFSET ) & BYTE_MASK; uintptr_t bit = ( i >> BIT_OFFSET ) & BIT_MASK; uintptr_t pad = ( i >> PAD_OFFSET ) & PAD_MASK; printf("address: %016p " "slot: %016p " "byte: %4x " "bit: %4x " "nop: %x\n", p, (void*)slot, (unsigned)byte, (unsigned)bit, (unsigned)pad ); } int main(int argc, char *argv[]) { void* p; for ( p = (void*)UINTPTR_C(123456); p < (void*)(UINTPTR_C(1) << 34); p += (UINTPTR_C(1) << 29) ) check_new(p); return 0; }
        $ gcc -Wall -m64 -o a a.c && a
        a.c: In function ‘check_new’:
        a.c:38: warning: '0' flag used with ‘%p’ printf format
        a.c:38: warning: '0' flag used with ‘%p’ printf format
        address: 0x0000000001e240 slot:            (nil) byte:  3c4 bit:    4 nop: 0
        address: 0x0000002001e240 slot: 0x00000000000100 byte:  3c4 bit:    4 nop: 0
        address: 0x0000004001e240 slot: 0x00000000000200 byte:  3c4 bit:    4 nop: 0
        address: 0x0000006001e240 slot: 0x00000000000300 byte:  3c4 bit:    4 nop: 0
        address: 0x0000008001e240 slot: 0x00000000000400 byte:  3c4 bit:    4 nop: 0
        address: 0x000000a001e240 slot: 0x00000000000500 byte:  3c4 bit:    4 nop: 0
        address: 0x000000c001e240 slot: 0x00000000000600 byte:  3c4 bit:    4 nop: 0
        address: 0x000000e001e240 slot: 0x00000000000700 byte:  3c4 bit:    4 nop: 0
        address: 0x0000010001e240 slot: 0x00000000000800 byte:  3c4 bit:    4 nop: 0
        address: 0x0000012001e240 slot: 0x00000000000900 byte:  3c4 bit:    4 nop: 0
        address: 0x0000014001e240 slot: 0x00000000000a00 byte:  3c4 bit:    4 nop: 0
        address: 0x0000016001e240 slot: 0x00000000000b00 byte:  3c4 bit:    4 nop: 0
        address: 0x0000018001e240 slot: 0x00000000000c00 byte:  3c4 bit:    4 nop: 0
        address: 0x000001a001e240 slot: 0x00000000000d00 byte:  3c4 bit:    4 nop: 0
        address: 0x000001c001e240 slot: 0x00000000000e00 byte:  3c4 bit:    4 nop: 0
        address: 0x000001e001e240 slot: 0x00000000000f00 byte:  3c4 bit:    4 nop: 0
        address: 0x0000020001e240 slot: 0x00000000001000 byte:  3c4 bit:    4 nop: 0
        address: 0x0000022001e240 slot: 0x00000000001100 byte:  3c4 bit:    4 nop: 0
        address: 0x0000024001e240 slot: 0x00000000001200 byte:  3c4 bit:    4 nop: 0
        address: 0x0000026001e240 slot: 0x00000000001300 byte:  3c4 bit:    4 nop: 0
        address: 0x0000028001e240 slot: 0x00000000001400 byte:  3c4 bit:    4 nop: 0
        address: 0x000002a001e240 slot: 0x00000000001500 byte:  3c4 bit:    4 nop: 0
        address: 0x000002c001e240 slot: 0x00000000001600 byte:  3c4 bit:    4 nop: 0
        address: 0x000002e001e240 slot: 0x00000000001700 byte:  3c4 bit:    4 nop: 0
        address: 0x0000030001e240 slot: 0x00000000001800 byte:  3c4 bit:    4 nop: 0
        address: 0x0000032001e240 slot: 0x00000000001900 byte:  3c4 bit:    4 nop: 0
        address: 0x0000034001e240 slot: 0x00000000001a00 byte:  3c4 bit:    4 nop: 0
        address: 0x0000036001e240 slot: 0x00000000001b00 byte:  3c4 bit:    4 nop: 0
        address: 0x0000038001e240 slot: 0x00000000001c00 byte:  3c4 bit:    4 nop: 0
        address: 0x000003a001e240 slot: 0x00000000001d00 byte:  3c4 bit:    4 nop: 0
        address: 0x000003c001e240 slot: 0x00000000001e00 byte:  3c4 bit:    4 nop: 0
        address: 0x000003e001e240 slot: 0x00000000001f00 byte:  3c4 bit:    4 nop: 0
        

        Update: I couldn't get UINTPTR_C and UINTPTRxf configured automatically. I initially tried to use sizeof in conditional pre-processor directives (as shown below), but that's not allowed. Fixed.

        #if sizeof(uintptr_t) == 4 # define UINTPTR_C(p) UINT32_C(p) #elif sizeof(uintptr_t) == 8 # define UINTPTR_C(p) UINT64_C(p) #else # error uintptr_t size not handled. #endif #if sizeof(uintptr_t) == sizeof(unsigned) # define UINTPTRxf "x" #if sizeof(uintptr_t) == sizeof(unsigned long) # define UINTPTRxf "lx" #if sizeof(uintptr_t) == sizeof(unsigned long long) # define UINTPTRxf "Lx" #else # error uintptr_t size not handled. #endif
Re: 64-bit *nix/gcc expertise required
by roboticus (Chancellor) on Dec 24, 2010 at 15:14 UTC

    BrowserUk:

    I don't have a 64 bit box to run on, but I think this is a good start. Note: I hacked the ALIGN_BITS and SLOT_BITS macros to use unsigned long long rather than void * because a pointer on this box isn't 64 bits. I think you'll be able to retain your original definition for those macros on a 64 bit box.

    #include <stdio.h> #define ALIGN_BITS ( sizeof(unsigned long long) >> 1 ) #define BIT_BITS 3 #define BYTE_BITS 14 #define SLOT_BITS ( sizeof(unsigned long long) * 8 )-( ALIGN_BITS + +BIT_BITS + BYTE_BITS ) #define BYTES_PER_SLOT 1 << BYTE_BITS #define TRACKING_SLOTS 8192 // max. 8192 for 4GB/32-bit machine int check_new( unsigned long long p ) { unsigned long long slot = ( p >> (BYTE_BITS + BIT_BITS + ALIGN_BIT +S) ); unsigned long long byte = ( p >> (ALIGN_BITS + BIT_BITS)) & 0x0000 +3fffULL; unsigned long long bit = ( p >> ALIGN_BITS) & 0x000 +00007ULL; unsigned long long nop = p & 0x3UL +L; printf( "address: %016llx slot: %016llx byte: %4llx bit: %4llx nop:%ll +x\n", p, slot, byte, bit, nop ); return 1; } int main( void ) { unsigned long long p; for( p = 123456ULL; p < ( 1ULL << 34 ); p += ( 1ULL << 29 ) ) { check_new( p ); } return 1; }

    Here on my (32 bit Linux) box, it's doing this:

    roboticus@Boink:~ $ gcc 879044.cpp -lstdc++ roboticus@Boink:~ $ ./a.out address: 000000000001e240 slot: 0000000000000000 byte: 3c4 bit: 4 +nop:0 address: 000000002001e240 slot: 0000000000000100 byte: 3c4 bit: 4 +nop:0 address: 000000004001e240 slot: 0000000000000200 byte: 3c4 bit: 4 +nop:0 address: 000000006001e240 slot: 0000000000000300 byte: 3c4 bit: 4 +nop:0 address: 000000008001e240 slot: 0000000000000400 byte: 3c4 bit: 4 +nop:0 address: 00000000a001e240 slot: 0000000000000500 byte: 3c4 bit: 4 +nop:0 address: 00000000c001e240 slot: 0000000000000600 byte: 3c4 bit: 4 +nop:0 address: 00000000e001e240 slot: 0000000000000700 byte: 3c4 bit: 4 +nop:0 address: 000000010001e240 slot: 0000000000000800 byte: 3c4 bit: 4 +nop:0 address: 000000012001e240 slot: 0000000000000900 byte: 3c4 bit: 4 +nop:0 address: 000000014001e240 slot: 0000000000000a00 byte: 3c4 bit: 4 +nop:0 address: 000000016001e240 slot: 0000000000000b00 byte: 3c4 bit: 4 +nop:0 address: 000000018001e240 slot: 0000000000000c00 byte: 3c4 bit: 4 +nop:0 address: 00000001a001e240 slot: 0000000000000d00 byte: 3c4 bit: 4 +nop:0 address: 00000001c001e240 slot: 0000000000000e00 byte: 3c4 bit: 4 +nop:0 address: 00000001e001e240 slot: 0000000000000f00 byte: 3c4 bit: 4 +nop:0 address: 000000020001e240 slot: 0000000000001000 byte: 3c4 bit: 4 +nop:0 address: 000000022001e240 slot: 0000000000001100 byte: 3c4 bit: 4 +nop:0 address: 000000024001e240 slot: 0000000000001200 byte: 3c4 bit: 4 +nop:0 address: 000000026001e240 slot: 0000000000001300 byte: 3c4 bit: 4 +nop:0 address: 000000028001e240 slot: 0000000000001400 byte: 3c4 bit: 4 +nop:0 address: 00000002a001e240 slot: 0000000000001500 byte: 3c4 bit: 4 +nop:0 address: 00000002c001e240 slot: 0000000000001600 byte: 3c4 bit: 4 +nop:0 address: 00000002e001e240 slot: 0000000000001700 byte: 3c4 bit: 4 +nop:0 address: 000000030001e240 slot: 0000000000001800 byte: 3c4 bit: 4 +nop:0 address: 000000032001e240 slot: 0000000000001900 byte: 3c4 bit: 4 +nop:0 address: 000000034001e240 slot: 0000000000001a00 byte: 3c4 bit: 4 +nop:0 address: 000000036001e240 slot: 0000000000001b00 byte: 3c4 bit: 4 +nop:0 address: 000000038001e240 slot: 0000000000001c00 byte: 3c4 bit: 4 +nop:0 address: 00000003a001e240 slot: 0000000000001d00 byte: 3c4 bit: 4 +nop:0 address: 00000003c001e240 slot: 0000000000001e00 byte: 3c4 bit: 4 +nop:0 address: 00000003e001e240 slot: 0000000000001f00 byte: 3c4 bit: 4 +nop:0

    Update 2: You can use 'X' instead of 'x' in your printf specification to get upper-case in your hex strings, if that's important:

    printf( "address: %016llX slot: %016llX byte: %4llX bit: %4llX nop:%ll +X\n", p, slot, byte, bit, nop );

    Update: Moved signature to correct location.

    ...roboticus

    When your only tool is a hammer, all problems look like your thumb.

      Unfortunately that won't work. p in main and the arg to check_new() must be pointers. That's what makes this a problem.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
Re: 64-bit *nix/gcc expertise required
by Tux (Canon) on Dec 24, 2010 at 14:53 UTC

    Does it matter what architecture? e.g. Itanium (ia64) vs PA-RISC (lp64) vs RISC (ppc5) vs Intel (x86_64)?


    Enjoy, Have FUN! H.Merijn

      Preferably all of them, but the latter would satisfy the majority of the target audience.

      Please note, there are no actually addresses involved. The problem lies in the types and constants required to make the math work correctly.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

        On my x86_64 machine:

        #include <stdio.h> #define ALIGN_BITS (sizeof (void *) >> 1LL) #define BIT_BITS 3LL #define BYTE_BITS 14LL #define SLOT_BITS (sizeof (void *) * 8) - (ALIGN_BITS + BIT_BITS + + BYTE_BITS) #define BYTES_PER_SLOT 1LL << BYTE_BITS #define TRACKING_SLOTS 8192 int check_new (unsigned long long p) { unsigned long long slot = (p >> (BYTE_BITS + BIT_BITS + ALIGN_BIT +S)); unsigned long long byte = (p >> (ALIGN_BITS + BIT_BITS)) & 0x00003 +fffLL; unsigned long long bit = (p >> ALIGN_BITS) & 0x00000 +007LL; unsigned long long nop = p & 0x3LL; printf ("address: %012p slot: %012p byte: %4x bit: %4x nop: %x\n", p, slot, byte, bit, nop); return (1); } /* check_new */ int main (int argc, char *argv[]) { unsigned long long p; for (p = 123456LL; p < (1ULL << 34); p += (1ULL << 29)) check_new (p); } /* main */

        Yields

        ELF 64-bit LSB executable, x86-64, version 1 (SYSV), for GNU/Linux 2.6 +.4, dynamically linked (uses shared libs), not stripped address: 0x000001e240 slot: (nil) byte: 3c4 bit: 4 nop: 0 address: 0x002001e240 slot: 0x0000000100 byte: 3c4 bit: 4 nop: 0 address: 0x004001e240 slot: 0x0000000200 byte: 3c4 bit: 4 nop: 0 address: 0x006001e240 slot: 0x0000000300 byte: 3c4 bit: 4 nop: 0 address: 0x008001e240 slot: 0x0000000400 byte: 3c4 bit: 4 nop: 0 address: 0x00a001e240 slot: 0x0000000500 byte: 3c4 bit: 4 nop: 0 address: 0x00c001e240 slot: 0x0000000600 byte: 3c4 bit: 4 nop: 0 address: 0x00e001e240 slot: 0x0000000700 byte: 3c4 bit: 4 nop: 0 address: 0x010001e240 slot: 0x0000000800 byte: 3c4 bit: 4 nop: 0 address: 0x012001e240 slot: 0x0000000900 byte: 3c4 bit: 4 nop: 0 address: 0x014001e240 slot: 0x0000000a00 byte: 3c4 bit: 4 nop: 0 address: 0x016001e240 slot: 0x0000000b00 byte: 3c4 bit: 4 nop: 0 address: 0x018001e240 slot: 0x0000000c00 byte: 3c4 bit: 4 nop: 0 address: 0x01a001e240 slot: 0x0000000d00 byte: 3c4 bit: 4 nop: 0 address: 0x01c001e240 slot: 0x0000000e00 byte: 3c4 bit: 4 nop: 0 address: 0x01e001e240 slot: 0x0000000f00 byte: 3c4 bit: 4 nop: 0 address: 0x020001e240 slot: 0x0000001000 byte: 3c4 bit: 4 nop: 0 address: 0x022001e240 slot: 0x0000001100 byte: 3c4 bit: 4 nop: 0 address: 0x024001e240 slot: 0x0000001200 byte: 3c4 bit: 4 nop: 0 address: 0x026001e240 slot: 0x0000001300 byte: 3c4 bit: 4 nop: 0 address: 0x028001e240 slot: 0x0000001400 byte: 3c4 bit: 4 nop: 0 address: 0x02a001e240 slot: 0x0000001500 byte: 3c4 bit: 4 nop: 0 address: 0x02c001e240 slot: 0x0000001600 byte: 3c4 bit: 4 nop: 0 address: 0x02e001e240 slot: 0x0000001700 byte: 3c4 bit: 4 nop: 0 address: 0x030001e240 slot: 0x0000001800 byte: 3c4 bit: 4 nop: 0 address: 0x032001e240 slot: 0x0000001900 byte: 3c4 bit: 4 nop: 0 address: 0x034001e240 slot: 0x0000001a00 byte: 3c4 bit: 4 nop: 0 address: 0x036001e240 slot: 0x0000001b00 byte: 3c4 bit: 4 nop: 0 address: 0x038001e240 slot: 0x0000001c00 byte: 3c4 bit: 4 nop: 0 address: 0x03a001e240 slot: 0x0000001d00 byte: 3c4 bit: 4 nop: 0 address: 0x03c001e240 slot: 0x0000001e00 byte: 3c4 bit: 4 nop: 0 address: 0x03e001e240 slot: 0x0000001f00 byte: 3c4 bit: 4 nop: 0

        That was what you were looking for?


        Enjoy, Have FUN! H.Merijn

        Same program on Itanium2 with HP's ANSI C compiler:

        ELF-64 executable object file - IA64 address: 000000000001e240 slot: 0000000000000000 byte: 3c4 bit: 4 +nop: 0 address: 000000002001e240 slot: 0000000000000100 byte: 3c4 bit: 4 +nop: 0 address: 000000004001e240 slot: 0000000000000200 byte: 3c4 bit: 4 +nop: 0 address: 000000006001e240 slot: 0000000000000300 byte: 3c4 bit: 4 +nop: 0 address: 000000008001e240 slot: 0000000000000400 byte: 3c4 bit: 4 +nop: 0 address: 00000000a001e240 slot: 0000000000000500 byte: 3c4 bit: 4 +nop: 0 address: 00000000c001e240 slot: 0000000000000600 byte: 3c4 bit: 4 +nop: 0 address: 00000000e001e240 slot: 0000000000000700 byte: 3c4 bit: 4 +nop: 0 address: 000000010001e240 slot: 0000000000000800 byte: 3c4 bit: 4 +nop: 0 address: 000000012001e240 slot: 0000000000000900 byte: 3c4 bit: 4 +nop: 0 address: 000000014001e240 slot: 0000000000000a00 byte: 3c4 bit: 4 +nop: 0 address: 000000016001e240 slot: 0000000000000b00 byte: 3c4 bit: 4 +nop: 0 address: 000000018001e240 slot: 0000000000000c00 byte: 3c4 bit: 4 +nop: 0 address: 00000001a001e240 slot: 0000000000000d00 byte: 3c4 bit: 4 +nop: 0 address: 00000001c001e240 slot: 0000000000000e00 byte: 3c4 bit: 4 +nop: 0 address: 00000001e001e240 slot: 0000000000000f00 byte: 3c4 bit: 4 +nop: 0 address: 000000020001e240 slot: 0000000000001000 byte: 3c4 bit: 4 +nop: 0 address: 000000022001e240 slot: 0000000000001100 byte: 3c4 bit: 4 +nop: 0 address: 000000024001e240 slot: 0000000000001200 byte: 3c4 bit: 4 +nop: 0 address: 000000026001e240 slot: 0000000000001300 byte: 3c4 bit: 4 +nop: 0 address: 000000028001e240 slot: 0000000000001400 byte: 3c4 bit: 4 +nop: 0 address: 00000002a001e240 slot: 0000000000001500 byte: 3c4 bit: 4 +nop: 0 address: 00000002c001e240 slot: 0000000000001600 byte: 3c4 bit: 4 +nop: 0 address: 00000002e001e240 slot: 0000000000001700 byte: 3c4 bit: 4 +nop: 0 address: 000000030001e240 slot: 0000000000001800 byte: 3c4 bit: 4 +nop: 0 address: 000000032001e240 slot: 0000000000001900 byte: 3c4 bit: 4 +nop: 0 address: 000000034001e240 slot: 0000000000001a00 byte: 3c4 bit: 4 +nop: 0 address: 000000036001e240 slot: 0000000000001b00 byte: 3c4 bit: 4 +nop: 0 address: 000000038001e240 slot: 0000000000001c00 byte: 3c4 bit: 4 +nop: 0 address: 00000003a001e240 slot: 0000000000001d00 byte: 3c4 bit: 4 +nop: 0 address: 00000003c001e240 slot: 0000000000001e00 byte: 3c4 bit: 4 +nop: 0 address: 00000003e001e240 slot: 0000000000001f00 byte: 3c4 bit: 4 +nop: 0

        Same program on PA-RISC2 with HP's ANSI C compiler:

        ELF-64 executable object file - PA-RISC 2.0 (LP64) address: 000000000001e240 slot: 0000000000000000 byte: 3c4 bit: 4 +nop: 0 address: 000000002001e240 slot: 0000000000000100 byte: 3c4 bit: 4 +nop: 0 address: 000000004001e240 slot: 0000000000000200 byte: 3c4 bit: 4 +nop: 0 address: 000000006001e240 slot: 0000000000000300 byte: 3c4 bit: 4 +nop: 0 address: 000000008001e240 slot: 0000000000000400 byte: 3c4 bit: 4 +nop: 0 address: 00000000a001e240 slot: 0000000000000500 byte: 3c4 bit: 4 +nop: 0 address: 00000000c001e240 slot: 0000000000000600 byte: 3c4 bit: 4 +nop: 0 address: 00000000e001e240 slot: 0000000000000700 byte: 3c4 bit: 4 +nop: 0 address: 000000010001e240 slot: 0000000000000800 byte: 3c4 bit: 4 +nop: 0 address: 000000012001e240 slot: 0000000000000900 byte: 3c4 bit: 4 +nop: 0 address: 000000014001e240 slot: 0000000000000a00 byte: 3c4 bit: 4 +nop: 0 address: 000000016001e240 slot: 0000000000000b00 byte: 3c4 bit: 4 +nop: 0 address: 000000018001e240 slot: 0000000000000c00 byte: 3c4 bit: 4 +nop: 0 address: 00000001a001e240 slot: 0000000000000d00 byte: 3c4 bit: 4 +nop: 0 address: 00000001c001e240 slot: 0000000000000e00 byte: 3c4 bit: 4 +nop: 0 address: 00000001e001e240 slot: 0000000000000f00 byte: 3c4 bit: 4 +nop: 0 address: 000000020001e240 slot: 0000000000001000 byte: 3c4 bit: 4 +nop: 0 address: 000000022001e240 slot: 0000000000001100 byte: 3c4 bit: 4 +nop: 0 address: 000000024001e240 slot: 0000000000001200 byte: 3c4 bit: 4 +nop: 0 address: 000000026001e240 slot: 0000000000001300 byte: 3c4 bit: 4 +nop: 0 address: 000000028001e240 slot: 0000000000001400 byte: 3c4 bit: 4 +nop: 0 address: 00000002a001e240 slot: 0000000000001500 byte: 3c4 bit: 4 +nop: 0 address: 00000002c001e240 slot: 0000000000001600 byte: 3c4 bit: 4 +nop: 0 address: 00000002e001e240 slot: 0000000000001700 byte: 3c4 bit: 4 +nop: 0 address: 000000030001e240 slot: 0000000000001800 byte: 3c4 bit: 4 +nop: 0 address: 000000032001e240 slot: 0000000000001900 byte: 3c4 bit: 4 +nop: 0 address: 000000034001e240 slot: 0000000000001a00 byte: 3c4 bit: 4 +nop: 0 address: 000000036001e240 slot: 0000000000001b00 byte: 3c4 bit: 4 +nop: 0 address: 000000038001e240 slot: 0000000000001c00 byte: 3c4 bit: 4 +nop: 0 address: 00000003a001e240 slot: 0000000000001d00 byte: 3c4 bit: 4 +nop: 0 address: 00000003c001e240 slot: 0000000000001e00 byte: 3c4 bit: 4 +nop: 0 address: 00000003e001e240 slot: 0000000000001f00 byte: 3c4 bit: 4 +nop: 0

        Same program on PowerPC5 with IBM's XLC compiler:

        64-bit XCOFF executable or object module address: 00000001e240 slot: 000000000000 byte: 3c4 bit: 4 nop: 0 address: 00002001e240 slot: 000000000100 byte: 3c4 bit: 4 nop: 0 address: 00004001e240 slot: 000000000200 byte: 3c4 bit: 4 nop: 0 address: 00006001e240 slot: 000000000300 byte: 3c4 bit: 4 nop: 0 address: 00008001e240 slot: 000000000400 byte: 3c4 bit: 4 nop: 0 address: 0000a001e240 slot: 000000000500 byte: 3c4 bit: 4 nop: 0 address: 0000c001e240 slot: 000000000600 byte: 3c4 bit: 4 nop: 0 address: 0000e001e240 slot: 000000000700 byte: 3c4 bit: 4 nop: 0 address: 00010001e240 slot: 000000000800 byte: 3c4 bit: 4 nop: 0 address: 00012001e240 slot: 000000000900 byte: 3c4 bit: 4 nop: 0 address: 00014001e240 slot: 000000000a00 byte: 3c4 bit: 4 nop: 0 address: 00016001e240 slot: 000000000b00 byte: 3c4 bit: 4 nop: 0 address: 00018001e240 slot: 000000000c00 byte: 3c4 bit: 4 nop: 0 address: 0001a001e240 slot: 000000000d00 byte: 3c4 bit: 4 nop: 0 address: 0001c001e240 slot: 000000000e00 byte: 3c4 bit: 4 nop: 0 address: 0001e001e240 slot: 000000000f00 byte: 3c4 bit: 4 nop: 0 address: 00020001e240 slot: 000000001000 byte: 3c4 bit: 4 nop: 0 address: 00022001e240 slot: 000000001100 byte: 3c4 bit: 4 nop: 0 address: 00024001e240 slot: 000000001200 byte: 3c4 bit: 4 nop: 0 address: 00026001e240 slot: 000000001300 byte: 3c4 bit: 4 nop: 0 address: 00028001e240 slot: 000000001400 byte: 3c4 bit: 4 nop: 0 address: 0002a001e240 slot: 000000001500 byte: 3c4 bit: 4 nop: 0 address: 0002c001e240 slot: 000000001600 byte: 3c4 bit: 4 nop: 0 address: 0002e001e240 slot: 000000001700 byte: 3c4 bit: 4 nop: 0 address: 00030001e240 slot: 000000001800 byte: 3c4 bit: 4 nop: 0 address: 00032001e240 slot: 000000001900 byte: 3c4 bit: 4 nop: 0 address: 00034001e240 slot: 000000001a00 byte: 3c4 bit: 4 nop: 0 address: 00036001e240 slot: 000000001b00 byte: 3c4 bit: 4 nop: 0 address: 00038001e240 slot: 000000001c00 byte: 3c4 bit: 4 nop: 0 address: 0003a001e240 slot: 000000001d00 byte: 3c4 bit: 4 nop: 0 address: 0003c001e240 slot: 000000001e00 byte: 3c4 bit: 4 nop: 0 address: 0003e001e240 slot: 000000001f00 byte: 3c4 bit: 4 nop: 0

        Enjoy, Have FUN! H.Merijn
Re: 64-bit *nix/gcc expertise required (THIS IS NOT OFF TOPIC!)
by Mr. Muskrat (Canon) on Dec 25, 2010 at 18:36 UTC

    The OP looks OT and that's why it is up for such consideration. Perhaps if you explain what you are trying to do (give the big picture) instead of such a narrowly focused post, you might get better responses. Looking your recent posts, I can't help but wonder if this related to Module development: concurrent versions (Updated) where you are trying something with Devel::Size.

    Update: I fixed the link, thanks for pointing that out BrowserUK.

      Your link points back to the post you've replied to, so your point is a little confusing.

      But, if the OP was off topic, I would have labelled it as such. Just as I have always done.

      Yes. This is directly related to my attempt to fix a bug in the 64-bit linux build of Devel::Size.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
          But, if the OP was off topic, I would have labelled it as such. Just as I have always done. ... Yes. This is directly related to my attempt to fix a bug in the 64-bit linux build of Devel::Size.

        Ah! The explanation that this was related to a problem in Devel::Size would have been useful to see in the first paragraph of your original post. Without that detail, your post was an interesting technical question about C compilers on different platforms, seemingly unrelated to Perl. Hence, my consideration request to mark the node off-topic.

        Alex / talexb / Toronto

        "Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds