Bug 61546 - MINGW : __int64 is #define'd as 'long long'
Summary: MINGW : __int64 is #define'd as 'long long'
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: libgcc (show other bugs)
Version: 4.8.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-18 05:23 UTC by Anton Baskanov
Modified: 2014-06-18 08:58 UTC (History)
1 user (show)

See Also:
Host: Ubuntu 14.04 LTS, x86_64
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
Preprocessed input (5.55 KB, text/plain)
2014-06-18 05:23 UTC, Anton Baskanov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Anton Baskanov 2014-06-18 05:23:50 UTC
Created attachment 32961 [details]
Preprocessed input

The following input fails to compile:


#include <cstdlib>

int main()
{
	__int64(123456789012345678);
	return EXIT_SUCCESS;
}


a-baskanov@uk-rnd-10:~/src/int64$ i686-w64-mingw32-g++ -v -save-temps -static int64.cpp 
Using built-in specs.
COLLECT_GCC=i686-w64-mingw32-g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-w64-mingw32/4.8/lto-wrapper
Target: i686-w64-mingw32
Configured with: ../../src/configure --build=x86_64-linux-gnu --prefix=/usr --includedir='/usr/include' --mandir='/usr/share/man' --infodir='/usr/share/info' --sysconfdir=/etc --localstatedir=/var --libexecdir='/usr/lib/gcc-mingw-w64' --disable-maintainer-mode --disable-dependency-tracking --prefix=/usr --enable-shared --enable-static --disable-multilib --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --libdir=/usr/lib --enable-libstdcxx-time=yes --with-tune=generic --enable-version-specific-runtime-libs --enable-threads=posix --enable-fully-dynamic-string --enable-sjlj-exceptions --enable-libgomp --enable-languages=c,c++,fortran,objc,obj-c++ --enable-lto --with-plugin-ld --target=i686-w64-mingw32 --with-gxx-include-dir=/usr/include/c++/4.8 --with-as=/usr/bin/i686-w64-mingw32-as --with-ld=/usr/bin/i686-w64-mingw32-ld
Thread model: posix
gcc version 4.8.2 (GCC) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-static' '-mtune=generic' '-march=pentiumpro'
 /usr/lib/gcc/i686-w64-mingw32/4.8/cc1plus -E -quiet -v -D_REENTRANT int64.cpp -mtune=generic -march=pentiumpro -fpch-preprocess -o int64.ii
ignoring nonexistent directory "/usr/lib/gcc/i686-w64-mingw32/4.8/../../../../i686-w64-mingw32/sys-include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/4.8
 /usr/include/c++/4.8/i686-w64-mingw32
 /usr/include/c++/4.8/backward
 /usr/lib/gcc/i686-w64-mingw32/4.8/include
 /usr/lib/gcc/i686-w64-mingw32/4.8/include-fixed
 /usr/lib/gcc/i686-w64-mingw32/4.8/../../../../i686-w64-mingw32/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-static' '-mtune=generic' '-march=pentiumpro'
 /usr/lib/gcc/i686-w64-mingw32/4.8/cc1plus -fpreprocessed int64.ii -quiet -dumpbase int64.cpp -mtune=generic -march=pentiumpro -auxbase int64 -version -o int64.s
GNU C++ (GCC) version 4.8.2 (i686-w64-mingw32)
        compiled by GNU C version 4.8.2, GMP version 5.1.2, MPFR version 3.1.2-p3, MPC version 1.0.1
warning: GMP header version 5.1.2 differs from library version 5.1.3.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++ (GCC) version 4.8.2 (i686-w64-mingw32)
        compiled by GNU C version 4.8.2, GMP version 5.1.2, MPFR version 3.1.2-p3, MPC version 1.0.1
warning: GMP header version 5.1.2 differs from library version 5.1.3.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: cfbaee3c6c337b4507631fc7f47e4864
int64.cpp: In function ‘int main()’:
int64.cpp:5:2: error: expected primary-expression before ‘long’
  __int64(123456789012345678);
  ^
int64.cpp:5:2: error: expected ‘;’ before ‘long’
Comment 1 Richard Biener 2014-06-18 07:50:01 UTC
Well,

  long long(123456789012345678);

isn't valid C++.  Either use cast syntax or provide a typedef.
Comment 2 Anton Baskanov 2014-06-18 07:55:47 UTC
(In reply to Richard Biener from comment #1)
> Well,
> 
>   long long(123456789012345678);
> 
> isn't valid C++.  Either use cast syntax or provide a typedef.

Yes, you are right, but why libgcc uses #define for __int64 instead of typedef? This is confusing.
Comment 3 Ozkan Sezer 2014-06-18 08:45:55 UTC
(In reply to Anton Baskanov from comment #2)
> 
>  why libgcc uses #define for __int64 instead of typedef?

MinGW and MinGW-w64 use #define instead of a typedef, because that allows for uses like 'signed __int64' and 'unsigned __int64', i.e. __int64 isn't native to gcc.
Comment 4 Anton Baskanov 2014-06-18 08:58:11 UTC
(In reply to Ozkan Sezer from comment #3)
> (In reply to Anton Baskanov from comment #2)
> > 
> >  why libgcc uses #define for __int64 instead of typedef?
> 
> MinGW and MinGW-w64 use #define instead of a typedef, because that allows
> for uses like 'signed __int64' and 'unsigned __int64', i.e. __int64 isn't
> native to gcc.

OK, got it. Thanks for the answer!