Save the attachments (pin.c and ntoskrnl.h) to the same directory. Then run the
following commands:

gcc -o ntoskrnl.h.gch -I. -fno-unit-at-a-time -Os ntoskrnl.h
gcc -v -o pin.o -I. -fno-unit-at-a-time -Os -c pin.c

The latter will print the following:

Using built-in specs.
Target: mingw32
Configured with: ../gcc-4.1.3/configure --prefix=/gcc-4.1.3 --with-gcc
--with-gnu-ld --with-gnu-as --host=mingw32 --target=mingw32 --build=mingw32
--enable-languages=c,c++ --enable-checking=release --enable-threads=win32
--disable-win32-registry --disable-nls --disable-shared
Thread model: win32
gcc version 4.1.3 20071015 (prerelease)
 c:/users/hyperion/rosbe/4.1.3/bin/../libexec/gcc/mingw32/4.1.3/cc1.exe -quiet
-v -I. -iprefix c:\users\hyperion\rosbe\4.1.3\bin\../lib/gcc/mingw32/4.1.3/
pin.c -quiet -dumpbase pin.c -auxbase-strip pin.o -Os -version
-fno-unit-at-a-time -o C:\Users\Hyperion\AppData\Local\Temp/ccphrNAF.s
ignoring nonexistent directory "C:/MSYS/gcc-4.1.3/include"
ignoring nonexistent directory "/gcc-4.1.3/include"
ignoring nonexistent directory
"C:/MSYS/gcc-4.1.3/lib/gcc/mingw32/4.1.3/include"
ignoring nonexistent directory "C:/MSYS/gcc-4.1.3/mingw32/include"
ignoring nonexistent directory "/mingw/include"
#include "..." search starts here:
#include <...> search starts here:
 .
 C:/Users/Hyperion/RosBE/4.1.3/include
 C:/Users/Hyperion/RosBE/4.1.3/lib/gcc/mingw32/4.1.3/include
 c:/users/hyperion/rosbe/4.1.3/bin/../lib/gcc/mingw32/4.1.3/include
End of search list.
GNU C version 4.1.3 20071015 (prerelease) (mingw32)
        compiled by GNU C version 4.1.3 20071015 (prerelease).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 3f527ff7c87fdc28aecf612037bc62b2


Very often (but not always), when executing the second command line, cc1.exe
will ICE with the following message:

ntoskrnl.h: In function 'ExAllocateFromNPagedLookasideList':
ntoskrnl.h:56: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

I attached a debugger to cc1.exe, and resolved the symbols by hand to the
following call stack:

143e04  _main_block_label
143fa1  _cleanup_dead_labels
124461  _execute_cleanup_cfg_post_optimizing
11ed04  _execute_one_pass
11ee3b  _execute_pass_list
11ee4f  _execute_pass_list
1245fe  _tree_rest_of_compilation
09194   _c_expand_body
4eecb   _cgraph_expand_function
4efa9   _cgraph_assemble_pending_functions
50125   _cgraph_finalize_function
09573   _finish_function
3fd4e   _c_parser_declaration_or_fndef
4132e   _c_parser_external_declaration
41f1d   _c_gimplify_expr
305c4   _c_common_post_options
f84bc   _toplev_main
461f7   _main
0124b   ___mingw_CRTStartup
01298   _mainCRTStartup


Note that I'm forced to use -fno-unit-at-a-time because of an issue related to
PR 17982 and PR 38054


-- 
           Summary: Segmentation fault in main_block_label when using -fno-
                    unit-at-a-time and precompiled headers containing inline
                    functions
           Product: gcc
           Version: 4.1.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hackbunny at reactos dot com
 GCC build triplet: mingw32
  GCC host triplet: mingw32
GCC target triplet: mingw32


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

Reply via email to