#1436 WIN32 not defined for gfortran (4.5)

OTHER
closed
nobody
Bug
out-of-date
Unknown
False
2013-02-07
2010-06-01
No

None of the various WIN32 flags (WIN32, _WIN32, WINNT, etc.) that are defined in gcc (preprocessor) are defined when running gfortran. Note that __GNUC__ is defined for both, while __GFORTRAN__ only for FORTRAN code (as expected). Is this intentional? Or should nobody need them...

Test case (alternately named either t.c or t.F):

#if defined(WIN32)
#error "WIN32"
#endif

#if defined(_WIN32)
#error "_WIN32"
#endif

#if defined(_WIN32)
#error "WINNT"
#endif

#if defined(__GNUC__)
#error "__GNUC__"
#endif

#if defined(__GFORTRAN__)
#error "__GFORTRAN__"
#endif

gcc output:
$ gcc t.c
t.c:2:2: error: #error "WIN32"
t.c:6:2: error: #error "_WIN32"
t.c:10:2: error: #error "WINNT"
t.c:14:2: error: #error "__GNUC__"

gfortran output:

$ gcc t.F
t.F:14:2: error: #error "__GNUC__"
t.F:22:2: error: #error "__GFORTRAN__"

Running on Windows XP SP3

MSYS:
$ uname -a
MINGW32_NT-5.1 0827-LINSED 1.0.11(0.46/3/2) 2009-07-11 17:46 i686 Msys

$ gcc -v
Using built-in specs.
COLLECT_GCC=c:\MinGW\bin\gcc.exe
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/4.5.0/lto-wrapper.exe
Target: mingw32
Configured with: ../gcc-4.5.0/configure --enable-languages=c,c++,ada,fortran,obj
c,obj-c++ --disable-sjlj-exceptions --with-dwarf2 --enable-shared --enable-libgo
mp --disable-win32-registry --enable-libstdcxx-debug --enable-version-specific-r
untime-libs --disable-werror --build=mingw32 --prefix=/mingw
Thread model: win32
gcc version 4.5.0 (GCC)

Discussion

  • Earnie Boyd

    Earnie Boyd - 2012-10-21
    • milestone: 102881 --> component_package
    • assigned_to: nobody --> earnie
    • status: open --> open-postponed
     
  • Earnie Boyd

    Earnie Boyd - 2012-10-22
    • status: open-postponed --> pending-remind
     
  • Earnie Boyd

    Earnie Boyd - 2012-10-22

    It appears there is a patch for GCC-4.8 for this. This should be closed once we confirm that 4.8 delivers the fix.

     
  • Earnie Boyd

    Earnie Boyd - 2013-02-04
    • labels: gcc -->
    • status: pending-remind --> pending
    • resolution: --> later
    • category: --> Known_bugs
    • milestone: component_package --> OTHER
     
  • Earnie Boyd

    Earnie Boyd - 2013-02-07
    • labels: --> gcc, gfortran
    • status: pending --> closed
    • assigned_to: Earnie Boyd --> nobody
    • type: --> Bug
    • resolution: later --> out-of-date
    • category: Known_bugs --> Unknown
    • patch_attached: --> False
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks