This small piece of code doesn't work with gcc 4.0.0, but with 3.4/3.3:

-----------------------------------------
#include <stdio.h>
#include <stdlib.h>

FILE* out = stdout;

int main( int argc, char **argv )
{
//  out = stdout; // this is ok
  return 0;
}
-----------------------------------------

Here the output:
C:\tmp>gcc main.c
main.c:4: error: initializer element is not constant

C:\tmp>g++ main.c
main.c:9: internal compiler error: output_operand: invalid expression as operand

Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

C:\tmp>gcc -v
Using built-in specs.
Target: mingw32
Configured with: ../gcc-4.0.0/configure --with-gcc --with-gnu-ld --with-gnu-as -
-host=mingw32 --target=mingw32 --prefix=/mingw --enable-languages=c,c++ --enable
-threads --disable-nls --disable-win32-registry --disable-shared --enable-sjlj-e
xceptions --enable-libgcj --disable-java-awt --without-x --enable-java-gc=boehm
--disable-libgcj-debug --enable-interpreter --enable-hash-synchronization --enab
le-libstdcxx-debug : (reconfigured) ../gcc-4.0.0/configure --disable-libada --wi
th-gcc --with-gnu-ld --with-gnu-as --host=mingw32 --target=mingw32 --prefix=/min
gw --enable-languages=c,c++ --enable-threads --disable-nls --disable-win32-regis
try --disable-shared --enable-sjlj-exceptions --enable-libgcj --disable-java-awt
 --without-x --enable-java-gc=boehm --disable-libgcj-debug --enable-interpreter
--enable-hash-synchronization --enable-libstdcxx-debug
Thread model: win32
gcc version 4.0.0

-- 
           Summary: gcc 4.0.0 crash with mingw when using stdout in global
                    var
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ch dot ehrlicher at gmx dot de
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21275

Reply via email to