User account creation filtered due to spam.

Bug 16344 - libstdc++'s PCH built by profiledbootstrap does not work with the built compiler
Summary: libstdc++'s PCH built by profiledbootstrap does not work with the built compiler
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 3.4.1
: P2 minor
Target Milestone: 3.4.2
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-07-03 08:25 UTC by Debian GCC Maintainers
Modified: 2004-07-08 22:27 UTC (History)
2 users (show)

See Also:
Host: hppa-linux
Target: hppa-linux
Build: hppa-linux
Known to work:
Known to fail:
Last reconfirmed: 2004-07-08 05:17:22


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Debian GCC Maintainers 2004-07-03 08:25:40 UTC
On hppa-linux, using gcc-3.3.4 as the system/stage1 compiler, building gcc-3.4.1
using the profiledbootstrap target, leaves the libstdc++ with 

                === libstdc++ tests ===

Running target unix
FAIL: 17_intro/header_cassert.cc (test for excess errors)
WARNING: 17_intro/header_cassert.cc compilation failed to produce executable
[...]
                === libstdc++ Summary ===

# of expected passes            75
# of unexpected failures        1367
# of expected failures          3

<command line>:1: 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.

$ gdb /build/packages/gcc/3.4/gcc-3.4-3.4.0/build/gcc/cc1plus
GNU gdb 6.1-debian
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "hppa-linux"...Using host libthread_db library
"/lib/libthread_db.so.1".

(gdb) set args -quiet -nostdinc++ -nostdinc++
-I/build/packages/gcc/3.4/gcc-3.4-3.4.0/build/hppa-linux/libstdc++-v3/include/hppa-linux
-I/build/packages/gcc/3.4/gcc-3.4-3.4.0/build/hppa-linux/libstdc++-v3/include
-I/build/packages/gcc/3.4/gcc-3.4-3.4.0/src/libstdc++-v3/libsupc++
-I/build/packages/gcc/3.4/gcc-3.4-3.4.0/src/libstdc++-v3/libsupc++
-I/build/packages/gcc/3.4/gcc-3.4-3.4.0/src/libstdc++-v3/include/backward
-I/build/packages/gcc/3.4/gcc-3.4-3.4.0/src/libstdc++-v3/testsuite -iprefix
/build/packages/gcc/3.4/gcc-3.4-3.4.0/build/gcc/../lib/gcc/hppa-linux/3.4.0/
-isystem /build/packages/gcc/3.4/gcc-3.4-3.4.0/build/gcc/include -isystem
/usr/hppa-linux/bin/include -isystem /usr/hppa-linux/lib/include -D_GNU_SOURCE
-D_GLIBCXX_ASSERT
-DLOCALEDIR=/build/packages/gcc/3.4/gcc-3.4-3.4.0/build/hppa-linux/libstdc++-v3/po/share/locale
-isystem /usr/hppa-linux/include -isystem /usr/hppa-linux/sys-include -include
bits/stdc++.h
/build/packages/gcc/3.4/gcc-3.4-3.4.0/src/libstdc++-v3/testsuite/17_intro/header_cassert.cc
-quiet -dumpbase header_cassert.cc -auxbase header_cassert -g -O2 -version
-ffunction-sections -fdata-sections -fmessage-length=0 -o header_cassert.s
(gdb) r
Starting program: /build/packages/gcc/3.4/gcc-3.4-3.4.0/build/gcc/cc1plus -quiet
-nostdinc++ -nostdinc++
-I/build/packages/gcc/3.4/gcc-3.4-3.4.0/build/hppa-linux/libstdc++-v3/include/hppa-linux
-I/build/packages/gcc/3.4/gcc-3.4-3.4.0/build/hppa-linux/libstdc++-v3/include
-I/build/packages/gcc/3.4/gcc-3.4-3.4.0/src/libstdc++-v3/libsupc++
-I/build/packages/gcc/3.4/gcc-3.4-3.4.0/src/libstdc++-v3/libsupc++
-I/build/packages/gcc/3.4/gcc-3.4-3.4.0/src/libstdc++-v3/include/backward
-I/build/packages/gcc/3.4/gcc-3.4-3.4.0/src/libstdc++-v3/testsuite -iprefix
/build/packages/gcc/3.4/gcc-3.4-3.4.0/build/gcc/../lib/gcc/hppa-linux/3.4.0/
-isystem /build/packages/gcc/3.4/gcc-3.4-3.4.0/build/gcc/include -isystem
/usr/hppa-linux/bin/include -isystem /usr/hppa-linux/lib/include -D_GNU_SOURCE
-D_GLIBCXX_ASSERT
-DLOCALEDIR=/build/packages/gcc/3.4/gcc-3.4-3.4.0/build/hppa-linux/libstdc++-v3/po/share/locale
-isystem /usr/hppa-linux/include -isystem /usr/hppa-linux/sys-include -include
bits/stdc++.h
/build/packages/gcc/3.4/gcc-3.4-3.4.0/src/libstdc++-v3/testsuite/17_intro/header_cassert.cc
-quiet -dumpbase header_cassert.cc -auxbase header_cassert -g -O2 -version
-ffunction-sections -fdata-sections -fmessage-length=0 -o header_cassert.s
GNU C++ version 3.4.0 (Debian 3.4.0-4) (hppa-linux)
        compiled by GNU C version 3.4.0 (Debian 3.4.0-4).
GGC heuristics: --param ggc-min-expand=98 --param ggc-min-heapsize=127775

Program received signal SIGSEGV, Segmentation fault.
__canonicalize_funcptr_for_compare (fptr=@0x7fb602: 0) at fptr.c:80
80        got = (unsigned int *) (plabel[0] + GOT_FROM_PLT_STUB);
(gdb) bt
#0  __canonicalize_funcptr_for_compare (fptr=@0x7fb602: 0) at fptr.c:80
#1  0x400b0e5c in ?? ()
Cannot find bounds of current function (@0x0), unwinding will fail.

building with the bootstrap target doesn't show these errors.

    Matthias
Comment 1 John David Anglin 2004-07-04 20:44:21 UTC
The SIGSEGV is caused by function pointer canonicalization in this code

  /* If the text segment was not loaded at the same address as it was
     when the PCH file was created, function pointers loaded from the
     PCH will not be valid.  We could in theory remap all the function
     pointers, but no support for that exists at present.  */
  if (v.pch_init != &pch_init)

in c-pch.c.  Canonicalization will fail if v.pch_init or &pch_init
point to invalid function descriptors.  I believe that the SIGSEGV
can be prevented by adding a "void *" cast to one of the sides of the
comparison.  If the function descriptor compare succeeds, then
possibly it may be valid to do a canonicalized comparison.

The above failure indicates an issue with mmap.  With 2.4 hppa-linux
kernels, the largefile.c pch test fails.  There seems to be a similar
problem here with the 2.6.6-pa4 kernel (that's what I used).  I'm
guessing but I think profiledbootstrap changes the size of the pch
file causing this failure.
Comment 2 Andrew Pinski 2004-07-08 05:17:21 UTC
well not really true the G++ build by the profiledbootstrap is fine, it is the build of libstdc++'s PCH 
which is broken.
Comment 3 CVS Commits 2004-07-08 21:49:50 UTC
Subject: Bug 16344

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	danglin@gcc.gnu.org	2004-07-08 21:49:45

Modified files:
	.              : ChangeLog Makefile.tpl Makefile.in 

Log message:
	PR target/16344
	* Makefile.tpl (profiledbootstrap): Build runtime libraries with
	feedback based compiler.
	* Makefile.in: Rebuilt.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/ChangeLog.diff?cvsroot=gcc&r1=1.949&r2=1.950
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/Makefile.tpl.diff?cvsroot=gcc&r1=1.107&r2=1.108
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/Makefile.in.diff?cvsroot=gcc&r1=1.229&r2=1.230

Comment 4 CVS Commits 2004-07-08 22:16:07 UTC
Subject: Bug 16344

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	danglin@gcc.gnu.org	2004-07-08 22:16:05

Modified files:
	.              : ChangeLog Makefile.tpl Makefile.in 

Log message:
	PR target/16344
	* Makefile.tpl (profiledbootstrap): Build runtime libraries with
	feedback based compiler.
	* Makefile.in: Rebuilt.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.856.2.17&r2=1.856.2.18
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/Makefile.tpl.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.79&r2=1.79.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/Makefile.in.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.195&r2=1.195.2.1

Comment 5 Andrew Pinski 2004-07-08 22:27:22 UTC
Fixed.
Comment 6 dave 2004-07-08 23:00:05 UTC
Subject: Re:  libstdc++'s PCH built by profiledbootstrap doe

>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>              Status|NEW                         |RESOLVED
>          Resolution|                            |FIXED
>    Target Milestone|---                         |3.4.2

The patch fixes the cause of the PCH failure.  However, it doesn't
fix the SEGV caused by trying to canonicalize an invalid function address.

I think this could be fixed by canonicalizing the address of pch_init
before it is written to the PCH file.

Dave