Bug 11341 - [cygwin] [pch] ICE in ggc_pop_context, at ggc-page.c:1441 while compiling libstc++3
[cygwin] [pch] ICE in ggc_pop_context, at ggc-page.c:1441 while compiling lib...
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: pch
3.4.0
: P2 enhancement
: 4.1.0
Assigned To: Not yet assigned to anyone
: build, ice-on-valid-code
: 10935 11324 11360 15316 26596 (view as bug list)
Depends on: 11361
Blocks:
  Show dependency treegraph
 
Reported: 2003-06-26 23:43 UTC by Giovanni Bajo
Modified: 2012-05-15 11:40 UTC (History)
10 users (show)

See Also:
Host: i686-pc-cygwin
Target: i686-pc-cygwin
Build: i686-pc-cygwin
Known to work:
Known to fail:
Last reconfirmed: 2005-02-23 01:30:36


Attachments
Preprocessed source (102.15 KB, application/octet-stream)
2003-06-26 23:44 UTC, Giovanni Bajo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Giovanni Bajo 2003-06-26 23:43:11 UTC
With today's mainline, I get this failure while compiling libstdc++3:

/home/Administrator/gcc/mainline/out/gcc/xgcc -shared-libgcc -
B/home/Administrator/gcc/mainline/out/gcc/ -nostdinc++  -
L/home/Administrator/gcc/mainline/out/i686-pc-cygwin/libstdc++-v3/src -
L/home/Administrator/gcc/mainline/out/i686-pc-cygwin/libstdc++-v3/src/.libs -
B/usr/local/i686-pc-cygwin/bin/ -B/usr/local/i686-pc-cygwin/lib/ -
isystem /usr/local/i686-pc-cygwin/include -isystem /usr/local/i686-pc-
cygwin/sys-include -Winvalid-pch -Wno-deprecated -x c++-header -g -O2 -
nostdinc++ -I/home/Administrator/gcc/mainline/out/i686-pc-cygwin/libstdc++-
v3/include/i686-pc-cygwin -I/home/Administrator/gcc/mainline/out/i686-pc-
cygwin/libstdc++-v3/include -I../../../../gcc/libstdc++-
v3/libsupc++ /home/Administrator/gcc/mainline/gcc/libstdc++-
v3/include/stdc++.h -O2 -g -o ./i686-pc-cygwin/bits/stdc++.h.gch/O2g;
/home/Administrator/gcc/mainline/out/i686-pc-cygwin/libstdc++-v3/include/valarra
y: In
   constructor `std::valarray<_Tp>::valarray() [with _Tp = size_t]':
/home/Administrator/gcc/mainline/out/i686-pc-cygwin/libstdc++-v3/include/valarra
y:245:   instantiated from `std::valarray<_Tp>::valarray() [with _Tp = size_t]'
/home/Administrator/gcc/mainline/out/i686-pc-cygwin/libstdc++-v3/include/bits/gs
lice.h:86:   instantiated from here
/home/Administrator/gcc/mainline/out/i686-pc-cygwin/libstdc++-v3/include/valarra
y:245: 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.

Reducing the problem, I have this:

$ ./xgcc.exe -O2 -g -x c++-header stc++.ii
/home/Administrator/gcc/mainline/gcc/libstdc++-v3/include/stdc++.h:83: 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.

This is using the stage 3 compiler (the last built) and the preprocessed source 
generated from above.

I would be interested in seeing if this bug can be reproduced on other 
platforms.

While reducing the command line options, I was sometimes getting this ICE 
instead:

/home/Administrator/gcc/mainline/gcc/libstdc++-v3/include/stdc++.h:84: internal
compiler error: in ggc_pop_context, at ggc-page.c:1441
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

hence the summary. It seems like it switches from a standard segmentation fault 
to this ICE without a sensible reason.
Comment 1 Giovanni Bajo 2003-06-26 23:44:23 UTC
Created attachment 4289 [details]
Preprocessed source
Comment 2 Giovanni Bajo 2003-06-26 23:46:14 UTC
I forgot this, might be useful:

$ ./xgcc -v
Reading specs from /usr/local/lib/gcc-lib/i686-pc-cygwin/3.4/specs
Configured with: ../gcc/configure --program-suffix=-3.4 --enable-languages=c,c++
,java --enable-threads=posix --enable-sjlj-exceptions --with-system-zlib --enabl
e-nls --enable-version-specific-runtime-libs --without-included-gettext --disabl
e-shared
Thread model: posix
gcc version 3.4 20030626 (experimental)
Comment 3 Andrew Pinski 2003-06-26 23:55:17 UTC
I think this is the same error almost every one is getting see <http://gcc.gnu.org/ml/gcc/2003-
06/msg02270.html> for a patch which looks the most correct one so far but I have little 
experience with GGC and PCH.
Can you try this patch, if it works then it is the same problem as everyone and can be confirmed.
Comment 4 Wolfgang Bangerth 2003-06-26 23:56:51 UTC
I can compile this on Linux with this gcc from tonight:

tmp/gg> ~/tmp/build-gcc/gcc-install/bin/c++ -v
Reading specs from
/homes/csm2/bangerth/tmp/build-gcc/gcc-install/bin/../lib/gcc-lib/i686-pc-linux-gnu/3.4/specs
Configured with: ../gcc/configure --enable-languages=c,c++
--prefix=/ticam/bangerth/tmp/build-gcc/gcc-install --disable-checking
Thread model: posix
gcc version 3.4 20030626 (experimental)


I just get this:

tmp/gg> ~/tmp/build-gcc/gcc-install/bin/c++ -O2 -g -x c++-header stc++.ii
/usr/lib/crt1.o(.text+0x18): In function `_start':
../sysdeps/i386/elf/start.S:77: undefined reference to `main'
collect2: ld returned 1 exit status

tmp/gg> ~/tmp/build-gcc/gcc-install/bin/c++ -O2 -g -c -x c++-header stc++.ii

W.
Comment 5 Andrew Pinski 2003-06-27 00:02:48 UTC
Some platforms do not have the problem reported in this bug, I think it does not happen on i686-
pc-linux-gnu and powerpc-apple-darwin6.6 at least these are the ones that seems to be able to 
bootstrap so far.
Comment 6 Giovanni Bajo 2003-06-27 09:35:14 UTC
No, the patch does not help, I get the same segmentation fault. That patch 
seems to help only on 64bit systems since it replaces an unsigned int with 
size_t, but on i686-pc-cygwin is no help.
Comment 7 Giovanni Bajo 2003-06-27 13:21:23 UTC
I talked with Ulrich offlist and he believes it's not related. Anybody knows a 
patch to disable PCH during v3 build? Cygwin bootstrap issues lasts months 
usually, so I'd rather have a workaround.
Comment 8 Andrew Pinski 2003-06-27 13:33:18 UTC
Actually I think this was a known problem with cygwin. For some reason cygwin has always had 
problems with PCH.
Here is the patch which disables PCH generation for libstdc++ stolen from someone (I forgot who 
though, it is in the test-result mailing list):
Needs this patch to disable PCH in libstdc++-v3 testsuite
--- libstdc++-v3/testsuite_flags.in  26 Apr 2003 04:01:47 -0000      1.17
+++ libstdc++-v3/testsuite_flags.in  7 May 2003 02:37:34 -0000
@@ -43,7 +43,7 @@
       echo \${CXX}
       ;;
     --build-cxx)
-      PCHFLAGS="-include bits/stdc++.h"
+      PCHFLAGS= #"-include bits/stdc++.h"
       CXX_build="@glibcpp_CXX@ \${PCHFLAGS}"
       CXX=\`echo "\$CXX_build" | sed 's,gcc/xgcc ,gcc/g++ ,'\`
       echo \${CXX}
Comment 9 Giovanni Bajo 2003-06-28 01:45:34 UTC
Your patch didn't apply. I installed this:

Index: testsuite_flags.in
===================================================================
RCS file: /cvsroot/gcc/gcc/libstdc++-v3/scripts/testsuite_flags.in,v
retrieving revision 1.1
diff -c -w -r1.1 testsuite_flags.in
*** testsuite_flags.in  18 Jun 2003 01:52:08 -0000      1.1
--- testsuite_flags.in  28 Jun 2003 01:40:07 -0000
***************
*** 43,49 ****
        echo ${CXX}
        ;;
      --build-cxx)
!       PCHFLAGS="@glibcpp_PCHFLAGS@"
        CXX_build="@glibcpp_CXX@ ${PCHFLAGS}"
        CXX=`echo "$CXX_build" | sed 's,gcc/xgcc ,gcc/g++ ,'`
        echo ${CXX}
--- 43,49 ----
        echo ${CXX}
        ;;
      --build-cxx)
!       PCHFLAGS=#"@glibcpp_PCHFLAGS@"
        CXX_build="@glibcpp_CXX@ ${PCHFLAGS}"
        CXX=`echo "$CXX_build" | sed 's,gcc/xgcc ,gcc/g++ ,'`
        echo ${CXX}


but I still get the segmentation fault. Besides, isn't this for testsuite only?
Comment 10 Giovanni Bajo 2003-06-28 01:50:37 UTC
Subject: Re:  [cygwin] ICE in ggc_pop_context, at ggc-page.c:1441 while compiling libstc++3

Your patch didn't apply. I installed this:

Index: testsuite_flags.in
===================================================================
RCS file: /cvsroot/gcc/gcc/libstdc++-v3/scripts/testsuite_flags.in,v
retrieving revision 1.1
diff -c -w -r1.1 testsuite_flags.in
*** testsuite_flags.in  18 Jun 2003 01:52:08 -0000      1.1
--- testsuite_flags.in  28 Jun 2003 01:40:07 -0000
***************
*** 43,49 ****
        echo ${CXX}
        ;;
      --build-cxx)
!       PCHFLAGS="@glibcpp_PCHFLAGS@"
        CXX_build="@glibcpp_CXX@ ${PCHFLAGS}"
        CXX=`echo "$CXX_build" | sed 's,gcc/xgcc ,gcc/g++ ,'`
        echo ${CXX}
--- 43,49 ----
        echo ${CXX}
        ;;
      --build-cxx)
!       PCHFLAGS=#"@glibcpp_PCHFLAGS@"
        CXX_build="@glibcpp_CXX@ ${PCHFLAGS}"
        CXX=`echo "$CXX_build" | sed 's,gcc/xgcc ,gcc/g++ ,'`
        echo ${CXX}


but I still get the segmentation fault. Besides, isn't this for testsuite
only?

Comment 11 Andrew Pinski 2003-06-28 02:02:24 UTC
you are right that only disables for the testsuite, you can disable the gch from creating for 
the testsuite by switching GLIBCPP_BUILD_PCH_TRUE and 
GLIBCPP_BUILD_PCH_FALSE around in src/libstdc++-v3/include/Makefile.in, this will 
disable the creation of the gch but it does not fill the bug which causes the ICE.
Comment 12 Giovanni Bajo 2003-06-28 02:37:32 UTC
Geoff, I'm CC'ing you since this seems to be a PCH bug. Have you seen this 
failure before? Would reducing the preprocessed file that's ICEing my 
bootstrapped GCC help fixing the bug?
Comment 13 Andrew Pinski 2003-06-28 13:35:58 UTC
*** Bug 11360 has been marked as a duplicate of this bug. ***
Comment 14 Giovanni Bajo 2003-06-28 15:58:23 UTC
Andrew, I installed this:

Index: Makefile.in
===================================================================
RCS file: /cvsroot/gcc/gcc/libstdc++-v3/include/Makefile.in,v
retrieving revision 1.76
diff -c -w -r1.76 Makefile.in
*** Makefile.in 12 Jun 2003 03:24:14 -0000      1.76
--- Makefile.in 28 Jun 2003 15:56:43 -0000
***************
*** 463,472 ****
  pch_output_builddir = ${target_builddir}/stdc++.h.gch
  pch_source = ${glibcpp_srcdir}/include/stdc++.h
  PCHFLAGS = -Winvalid-pch -Wno-deprecated -x c++-header $(CXXFLAGS)
! @GLIBCPP_BUILD_PCH_TRUE@pch_build = @GLIBCPP_BUILD_PCH_TRUE@${pch_input}
! @GLIBCPP_BUILD_PCH_FALSE@pch_build =
! @GLIBCPP_BUILD_PCH_TRUE@pch_install = @GLIBCPP_BUILD_PCH_TRUE@install-pch
! @GLIBCPP_BUILD_PCH_FALSE@pch_install =

  # List of all timestamp files.  By keeping only one copy of this list, both
  # CLEANFILES and all-local are kept up-to-date.
--- 463,472 ----
  pch_output_builddir = ${target_builddir}/stdc++.h.gch
  pch_source = ${glibcpp_srcdir}/include/stdc++.h
  PCHFLAGS = -Winvalid-pch -Wno-deprecated -x c++-header $(CXXFLAGS)
! @GLIBCPP_BUILD_PCH_TRUE@pch_build =
! @GLIBCPP_BUILD_PCH_FALSE@pch_build = @GLIBCPP_BUILD_PCH_TRUE@${pch_input}
! @GLIBCPP_BUILD_PCH_TRUE@pch_install =
! @GLIBCPP_BUILD_PCH_FALSE@pch_install = @GLIBCPP_BUILD_PCH_TRUE@install-pch

  # List of all timestamp files.  By keeping only one copy of this list, both
  # CLEANFILES and all-local are kept up-to-date.


and I end up with:

make[4]: Entering directory `/home/Administrator/gcc/mainline/out/i686-pc-cygwin
/libstdc++-v3/testsuite'
Makefile:495: warning: overriding commands for target `check-am'
Makefile:408: warning: ignoring old commands for target `check-am'
`/home/Administrator/gcc/mainline/out/i686-pc-cygwin/libstdc++-v3/scripts/testsu
ite_flags --build-cxx` -DHAVE_CONFIG_H -I. -I../../../../gcc/libstdc++-v3/testsu
ite -I.. -nostdinc++ -I/home/Administrator/gcc/mainline/out/i686-pc-cygwin/libst
dc++-v3/include/i686-pc-cygwin -I/home/Administrator/gcc/mainline/out/i686-pc-cy
gwin/libstdc++-v3/include -I../../../../gcc/libstdc++-v3/libsupc++    -O2 -g -O2
  -g -O2 -c ../../../../gcc/libstdc++-v3/testsuite/testsuite_hooks.cc
cc1plus: bits/stdc++.h: No such file or directory


Still no luck bootstrapping :/
Comment 15 Geoff Keating 2003-06-28 20:01:41 UTC
Subject: Re:  [cygwin] ICE in ggc_pop_context, at ggc-page.c:1441 while compiling libstc++3

> Date: 28 Jun 2003 02:37:32 -0000
> From: "giovannibajo at libero dot it" <gcc-bugzilla@gcc.gnu.org>

> Geoff, I'm CC'ing you since this seems to be a PCH bug. Have you seen this 
> failure before? Would reducing the preprocessed file that's ICEing my 
> bootstrapped GCC help fixing the bug?

No, I've never seen this before.  It's probably specific to Cygwin.  I
doubt that a reduced testcase would be very interesting.  It seems to
be a random-memory-corruption bug, and so there's no guarantee that
it's actually related to PCH at all; but it's well worth tracking
down.  I would start by spending some time with the debugger.

Comment 16 Giovanni Bajo 2003-06-28 20:06:31 UTC
Subject: Re:  [cygwin] [pch] ICE in ggc_pop_context, at ggc-page.c:1441 while compiling libstc++3

geoffk at geoffk dot org <gcc-bugzilla@gcc.gnu.org> wrote:

> No, I've never seen this before.  It's probably specific to Cygwin.  I
> doubt that a reduced testcase would be very interesting.  It seems to
> be a random-memory-corruption bug, and so there's no guarantee that
> it's actually related to PCH at all; but it's well worth tracking
> down.  I would start by spending some time with the debugger.

Geoff, do you have any patch to completely disable PCH during bootstrap? At
least that would be a check if it's PCH related or not. If you look in the
audit trail of the bug, you will see two different patches that I tried to
apply without success. I was thinking it's PCH related because the bug
requires the "-x" parameter on the command line to show up.

Besides, I was able to bootstrap cygwin with no problems till two weeks ago.
Can you think of any patches in this timeframe that might have
caused/uncovered this problem?

Giovanni Bajo

Comment 17 Geoff Keating 2003-06-28 20:33:39 UTC
Subject: Re:  [cygwin] [pch] ICE in ggc_pop_context, at ggc-page.c:1441 while compiling libstc++3

> Date: 28 Jun 2003 20:06:33 -0000
> From: "giovannibajo at libero dot it" <gcc-bugzilla@gcc.gnu.org>

> ------- Additional Comments From giovannibajo at libero dot it  2003-06-28 20:06 -------
> Subject: Re:  [cygwin] [pch] ICE in ggc_pop_context, at ggc-page.c:1441 while compiling libstc++3
> 
> geoffk at geoffk dot org <gcc-bugzilla@gcc.gnu.org> wrote:
> 
> > No, I've never seen this before.  It's probably specific to Cygwin.  I
> > doubt that a reduced testcase would be very interesting.  It seems to
> > be a random-memory-corruption bug, and so there's no guarantee that
> > it's actually related to PCH at all; but it's well worth tracking
> > down.  I would start by spending some time with the debugger.
> 
> Geoff, do you have any patch to completely disable PCH during bootstrap? At
> least that would be a check if it's PCH related or not.

That wouldn't prove that it's really anything to do with PCH.  It
could be a random memory corruption bug that just happens to only turn
up when PCH is in use.

> Besides, I was able to bootstrap cygwin with no problems till two weeks ago.
> Can you think of any patches in this timeframe that might have
> caused/uncovered this problem?

No, but it might be interesting to find if there's one patch that
caused the problem to appear.

Comment 18 Giovanni Bajo 2003-06-28 21:02:01 UTC
Subject: Re:  [cygwin] [pch] ICE in ggc_pop_context, at ggc-page.c:1441 while compiling libstc++3

geoffk at geoffk dot org <gcc-bugzilla@gcc.gnu.org> wrote:

>> Geoff, do you have any patch to completely disable PCH during bootstrap?
At
>> least that would be a check if it's PCH related or not.
>
> That wouldn't prove that it's really anything to do with PCH.  It
> could be a random memory corruption bug that just happens to only turn
> up when PCH is in use.

Ok. I would appreciate a patch anyway since it would let me bootstrap again.

Meanwhile, I cannot reduce the testcase properly because of PR11361 coming
into my way while reducing it (everytime #line infos are a little screwed).

Giovanni Bajo

Comment 19 david.billinghurst 2003-06-29 23:05:06 UTC
Subject: RE:  [cygwin] ICE in ggc_pop_context, at ggc-page.c:1441 while compiling libstc++3

I just continue over this error with another "make bootstrap".  I haven't had time to follow up.
Comment 20 Giovanni Bajo 2003-06-29 23:17:14 UTC
Yes, but if you continue after this error the testsuite shows a lot of 
failures. I would like a proper fix for this. I'll try to isolate this after 
PR11361 gets fixed. BTW, I tried with configure --disable-pch but it still uses 
PCH.
Comment 21 david.billinghurst 2003-06-29 23:19:09 UTC
Subject: RE:  [cygwin] [pch] ICE in ggc_pop_context, at ggc-page.c:1441 while compiling libstc++3

I use the patch to testsuite.in as well.

Comment 22 Christian Joensson 2003-07-01 05:33:05 UTC
For some reason unknown to me, gcc 3.4 cvs HEAD as of
Mon Jun 30 19:39:54 GMT 2003 bootstraps... see

http://gcc.gnu.org/ml/gcc-testresults/2003-07/msg00021.html

Cheers,

/ChJ
Comment 23 Andrew Pinski 2003-07-01 14:54:14 UTC
*** Bug 10935 has been marked as a duplicate of this bug. ***
Comment 24 Dara Hazeghi 2003-07-11 22:07:49 UTC
Still there as of yesterday (20030710).
Comment 25 Dara Hazeghi 2003-07-11 22:09:23 UTC
*** Bug 11324 has been marked as a duplicate of this bug. ***
Comment 26 Andrew Pinski 2003-11-09 23:19:13 UTC
Does this work now?
Comment 27 Robert McNulty Junior 2003-11-10 00:24:34 UTC
Subject: RE:  [cygwin] [pch] ICE in ggc_pop_context, at ggc-page.c:1441 while compiling libstc++3

Last time I checked, gcc 3.4 compiled fine with PCH.
I've not tried it lately, though.


-----Original Message-----
From: pinskia at gcc dot gnu dot org [mailto:gcc-bugzilla@gcc.gnu.org]
Sent: Sunday, November 09, 2003 5:19 PM
To: bmj2001@bellsouth.net
Subject: [Bug bootstrap/11341] [cygwin] [pch] ICE in ggc_pop_context, at
ggc-page.c:1441 while compiling libstc++3



------- Additional Comments From pinskia at gcc dot gnu dot org  2003-11-09
23:19 -------
Does this work now?

--


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


Comment 28 Kelley Cook 2003-11-10 15:15:14 UTC
AFAIK, cygwin virtually never works with PCH, which IIRC is because of the fact
that PCH hasn't had PIC support properly implemented yet, and PIC is always
enabled with Cygwin.

On the other hand, a libstdc++ autoconf test verifying that PCH works before
using it was put in place quite some time ago, so libstdc++ under cygwin will no
longer attempt to use PCH and therefore build correctly.

Certainly this particular PR should be closed.  There probably should be a
different PR asking to implement PCH with PIC though.
Comment 29 Andrew Pinski 2003-12-19 08:08:11 UTC
Okay Darwin's backend handles PIC just fine, most likely you just want to copy how they do it.
Also the same thing for Linux because it also has the same problem now.
Comment 30 Andrew Pinski 2003-12-19 10:12:05 UTC
Not as serious now.
Comment 31 Andrew Pinski 2003-12-19 10:13:08 UTC
Also a host bug now.
Comment 32 Andrew Pinski 2004-01-10 22:53:40 UTC
This is an enchanment for cygwin so moving to 3.5 and noone is working on this.
Comment 33 Andrew Pinski 2004-05-06 12:57:52 UTC
*** Bug 15316 has been marked as a duplicate of this bug. ***
Comment 34 Andrew Pinski 2005-03-07 23:16:00 UTC
Fixed by:
	2005-03-08  Earl Chew <earl_chew@agilent.com>
	David Billinghurst <David.Billinghurst@riotinto.com>
	
	* config/i386/host-cygwin.c: New file to support precompiled
	headers on cygwin
	* config/i386/x-cygwin: Use host-cygwin.c on cygwin host
	* config.host: Use above files for cygwin host.

Comment 35 Andrew Pinski 2006-03-07 15:50:58 UTC
*** Bug 26596 has been marked as a duplicate of this bug. ***
Comment 36 Blogspot 2012-05-15 11:40:06 UTC
those responses did the trick for this awkward fix, also some body building fixes here is you want to get building your muscles and bodybuiling up next year, and into good shape and not just spending time fixing bugs bodybuilding blogspot http://bodybuilding2013.blogspot.co.uk/