Research question: integral type sizes on various platforms

I’m a bit curious about sizes of various integral types on different platforms, and I’d really appreciate a little help from people running various non-common architectures/toolchains. I’ve prepared a little package which just tries to get various type sizes using the C++ compiler, and I’d really appreciate if you could run it and paste the results in a comment.

To run it:

wget http://dev.gentoo.org/~mgorny/cxx-type-sizes-0.tar.bz2
tar -xf cxx-type-sizes-0.tar.bz2
cd cxx-type-sizes-0/
./configure
make
cat output/_all

It will try to compile a few programs, and then run them. Then it concatenates the results into output/_all and that’s the file I’d like to get, along with your platform, toolchain, CHOST and ARCH, ABI and everything else you consider relevant.

I’d really like to get a single output for each architecture, and possibly additional outputs if some toolchain/other magic resulted in different results than the previous one. I’ll put the results then into a nice table. Thanks in advance.

Current results.

17 thoughts on “Research question: integral type sizes on various platforms”

  1. And mine: amd64, gcc (Gentoo 4.7.1 p1.0, pie-0.5.3) 4.7.1

    int: 1;7;7;8;15;16;31;32;63;64;
    longlong: 63;64;
    stdint: 7;8;15;16;-;-;31;32;63;64;-;-;
    stdint-least: 7;8;15;16;-;-;31;32;63;64;-;-;
    stdint-fast: 7;8;63;64;-;-;63;64;63;64;-;-;
    int128: 127;
    stdint-other: 63;64;63;64;
    ptr: 0;64;0;64;0;64;
    float: 24;32;53;64;
    lfloat: 64;128;
  2. From monolith, the Gentoo Dev Alpha (EV68AL, aka 21264B) I’m admin of:
    $ gcc –version
    gcc (Gentoo 4.5.3-r2 p1.1, pie-0.4.7) 4.5.3

    int: 1;7;7;8;15;16;31;32;63;64;
    longlong: 63;64;
    stdint: 7;8;15;16;-;-;31;32;63;64;-;-;
    stdint-least: 7;8;15;16;-;-;31;32;63;64;-;-;
    stdint-fast: 7;8;63;64;-;-;63;64;63;64;-;-;
    int128: 
    stdint-other: 63;64;63;64;
    ptr: 0;64;0;64;0;64;
    float: 24;32;53;64;
    lfloat: 113;128;

    Full log: http://kaini.schwarzvogel.de/~klausman/its_results.txt

  3. g++ (Gentoo 4.5.3-r2 p1.1, pie-0.4.7) 4.5.3
    mips64el-unknown-linux-gnu-4.5.3
    cpu model : ICT Loongson-2 V0.3 FPU V0.1

    int: 1;7;7;8;15;16;31;32;31;32;
    longlong: 63;64;
    stdint: 7;8;15;16;-;-;31;32;63;64;-;-;
    stdint-least: 7;8;15;16;-;-;31;32;63;64;-;-;
    stdint-fast: 7;8;31;32;-;-;31;32;63;64;-;-;
    int128: 
    stdint-other: 31;32;63;64;
    ptr: 0;32;0;32;0;32;
    float: 24;32;53;64;
    lfloat: 113;128;
    
  4. SLES11.1 IBM power7 gcc-4.7.1 (default 64 bit):
    int: 1;8;7;8;15;16;31;32;63;64;
    longlong: 63;64;
    stdint: 7;8;15;16;-;-;31;32;63;64;-;-;
    stdint-least: 7;8;15;16;-;-;31;32;63;64;-;-;
    stdint-fast: 7;8;63;64;-;-;63;64;63;64;-;-;
    int128: 127;
    stdint-other: 63;64;63;64;
    ptr: 0;64;0;64;0;64;
    float: 24;32;53;64;
    lfloat: 106;128;

    SLES11.1 Power7 IBM xl compiler (default 32 bit)
    int: 1;8;7;8;15;16;31;32;31;32;
    longlong: 63;64;
    stdint: 7;8;15;16;-;-;31;32;63;64;-;-;
    stdint-least: 7;8;15;16;-;-;31;32;63;64;-;-;
    stdint-fast: 7;8;31;32;-;-;31;32;63;64;-;-;
    int128: 63;
    stdint-other: 31;32;63;64;
    ptr: 0;32;0;32;0;32;
    float: 24;32;53;64;
    lfloat: 106;128;

    1. Hmm, do you maybe have the run log for the 32-bit run? Or result of sizeof(__int128). I’m pretty curious because your results would mean that __int128 in that compiler is 64-bit…

      1. For the ibm xl compiler (xlC) this is the 32bit run. The 64 bit one is identical to the one from gcc-4.7.1 I cannot give you a 32 bit with a gnu compiler – I haven’t figured the magic formula to make it work.
        Now the 64 bit run with
        ./configure CXX=xlC_r CXXFLAGS=-q64

        int: 1;8;7;8;15;16;31;32;63;64;
        longlong: 63;64;
        stdint: 7;8;15;16;-;-;31;32;63;64;-;-;
        stdint-least: 7;8;15;16;-;-;31;32;63;64;-;-;
        stdint-fast: 7;8;63;64;-;-;63;64;63;64;-;-;
        int128: 63;
        stdint-other: 63;64;63;64;
        ptr: 0;64;0;64;0;64;
        float: 24;32;53;64;
        lfloat: 106;128;

        So it looks like to me xlC has just a very strange definition of int128.

        1. It might be that, or that std::numeric_limits are mis-defined for it.

          Try the following:

          #include 
          
          int main()
          {
              std::cout << sizeof(__int128) << std::endl;
          }
  5. Portage 2.2.0_alpha121 (default/linux/amd64/10.0, gcc-4.6.3, glibc-2.15-r2, 3.5.1-vs2.3.4.1 x86_64)
    System uname:
    Linux-3.5.1-vs2.3.4.1-x86_64-Intel-R-_Core-TM-_i7-3770K_CPU_@_3.50GHz-with-gentoo-2.1

    int: 1;7;7;8;15;16;31;32;63;64;
    longlong: 63;64;
    stdint: 7;8;15;16;-;-;31;32;63;64;-;-;
    stdint-least: 7;8;15;16;-;-;31;32;63;64;-;-;
    stdint-fast: 7;8;63;64;-;-;63;64;63;64;-;-;
    int128: 0;
    stdint-other: 63;64;63;64;
    ptr: 0;64;0;64;0;64;
    float: 24;32;53;64;
    lfloat: 64;128;

  6. ia64

    int: 1;7;7;8;15;16;31;32;63;64;
    longlong: 63;64;
    stdint: 7;8;15;16;-;-;31;32;63;64;-;-;
    stdint-least: 7;8;15;16;-;-;31;32;63;64;-;-;
    stdint-fast: 7;8;63;64;-;-;63;64;63;64;-;-;
    int128: 
    stdint-other: 63;64;63;64;
    ptr: 0;64;0;64;0;64;
    float: 24;32;53;64;
    lfloat: 64;128;

    s390

    int: 1;8;7;8;15;16;31;32;31;32;
    longlong: 63;64;
    stdint: 7;8;15;16;-;-;31;32;63;64;-;-;
    stdint-least: 7;8;15;16;-;-;31;32;63;64;-;-;
    stdint-fast: 7;8;31;32;-;-;31;32;63;64;-;-;
    int128: 
    stdint-other: 31;32;63;64;
    ptr: 0;32;0;32;0;32;
    float: 24;32;53;64;
    lfloat: 113;128;

    s390x

    int: 1;8;7;8;15;16;31;32;63;64;
    longlong: 63;64;
    stdint: 7;8;15;16;-;-;31;32;63;64;-;-;
    stdint-least: 7;8;15;16;-;-;31;32;63;64;-;-;
    stdint-fast: 7;8;63;64;-;-;63;64;63;64;-;-;
    int128: 
    stdint-other: 63;64;63;64;
    ptr: 0;64;0;64;0;64;
    float: 24;32;53;64;
    lfloat: 113;128;

    sh

    int: 1;7;7;8;15;16;31;32;31;32;
    longlong: 63;64;
    stdint: 7;8;15;16;-;-;31;32;63;64;-;-;
    stdint-least: 7;8;15;16;-;-;31;32;63;64;-;-;
    stdint-fast: 7;8;31;32;-;-;31;32;63;64;-;-;
    int128: 
    stdint-other: 31;32;63;64;
    ptr: 0;32;0;32;0;32;
    float: 24;32;53;64;
    lfloat: 53;64;

    sparc

    int: 1;7;7;8;15;16;31;32;31;32;
    longlong: 63;64;
    stdint: 7;8;15;16;-;-;31;32;63;64;-;-;
    stdint-least: 7;8;15;16;-;-;31;32;63;64;-;-;
    stdint-fast: 7;8;31;32;-;-;31;32;63;64;-;-;
    int128: 
    stdint-other: 31;32;63;64;
    ptr: 0;32;0;32;0;32;
    float: 24;32;53;64;
    lfloat: 113;128;
    1. arm

      int: 1;8;7;8;15;16;31;32;31;32;
      longlong: 63;64;
      stdint: 7;8;15;16;-;-;31;32;63;64;-;-;
      stdint-least: 7;8;15;16;-;-;31;32;63;64;-;-;
      stdint-fast: 7;8;31;32;-;-;31;32;63;64;-;-;
      int128: 
      stdint-other: 31;32;63;64;
      ptr: 0;32;0;32;0;32;
      float: 24;32;53;64;
      lfloat: 53;64;

      I forgot to say that all of the results are done with gcc-4.5.3(i.e, current stable)

      I’ve also tried with the Intel compiler 11.1.072 on an x86-64 machine with the same results as gcc.

  7. Western Digital MyBook World Edition II
    (it doesn’t run Gentoo… yet… maybe won’t ever…)

    int: 1;8;7;8;15;16;31;32;31;32;
    longlong: 63;64;
    stdint: 7;8;15;16;-;-;31;32;63;64;-;-;
    stdint-least: 7;8;15;16;-;-;31;32;63;64;-;-;
    stdint-fast: 7;8;31;32;-;-;31;32;63;64;-;-;
    int128: 
    stdint-other: 31;32;63;64;
    ptr: 0;32;0;32;0;32;
    float: 24;32;53;64;
    lfloat: 53;64;
    
    [root@argo cxx-type-sizes-0]# uname -a
    Linux argo 2.6.17.14 #5 PREEMPT Tue Jun 2 22:17:10 EEST 2009 armv5tejl GNU/Linux
    
    [root@argo cxx-type-sizes-0]# cat /proc/cpuinfo 
    Processor	: ARM926EJ-Sid(wb) rev 5 (v5l)
    BogoMIPS	: 99.73
    Features	: swp half thumb fastmult edsp java 
    CPU implementer	: 0x41
    CPU architecture: 5TEJ
    CPU variant	: 0x0
    CPU part	: 0x926
    CPU revision	: 5
    Cache type	: write-back
    Cache clean	: cp15 c7 ops
    Cache lockdown	: format C
    Cache format	: Harvard
    I size		: 32768
    I assoc		: 4
    I line length	: 32
    I sets		: 256
    D size		: 32768
    D assoc		: 4
    D line length	: 32
    D sets		: 256
    
    Hardware	: Oxsemi NAS
    Revision	: 0000
    Serial		: 0000000000000000
    
    
    [root@argo cxx-type-sizes-0]# gcc -v
    Using built-in specs.
    Configured with: /II/WD_v2.0_RC18/buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/usr --build=i386-pc-linux-gnu --host=arm-linux-uclibc --target=arm-linux-uclibc --enable-languages=c,c++ --enable-shared --with-gxx-include-dir=/usr/include/c++ --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --enable-threads --enable-multilib --with-float=soft
    Thread model: posix
    gcc version 3.4.2

Leave a Reply

Your email address will not be published.