[PATCH] Fix PR target/16344
John David Anglin
dave@hiauly1.hia.nrc.ca
Mon Jul 5 17:15:00 GMT 2004
This small fix prevents the SIGSEGV noted in the PR when the PCH is
loaded at an address different from the one that it was created at.
hppa-unknown-linux-gnu uses function descriptors and function pointer
canonicalization will fail if a pointer doesn't point to a valid
function descriptor.
Tested with 3.4.1 release with a profiledbootstrap. I saw two
regressions in the libstdc++ testsuite compared to what I normally
see in a regular bootstrap on this target:
Executing on host: /home/dave/gcc-3.4/objdir/gcc/g++ -shared-libgcc -B/home/dave/gcc-3.4/objdir/gcc/ -nostdinc++ -L/home/dave/gcc-3.4/objdir/hppa-linux/libstdc++-v3/src -L/home/dave/gcc-3.4/objdir/hppa-linux/libstdc++-v3/src/.libs -B/home/dave/opt/gnu/gcc/gcc-3.4.2/hppa-linux/bin/ -B/home/dave/opt/gnu/gcc/gcc-3.4.2/hppa-linux/lib/ -isystem /home/dave/opt/gnu/gcc/gcc-3.4.2/hppa-linux/include -isystem /home/dave/opt/gnu/gcc/gcc-3.4.2/hppa-linux/sys-include -g -O2 -D_GLIBCXX_ASSERT -ffunction-sections -fdata-sections -fmessage-length=0 -DLOCALEDIR="/home/dave/gcc-3.4/objdir/hppa-linux/libstdc++-v3/po/share/locale" -nostdinc++ -I/home/dave/gcc-3.4/objdir/hppa-linux/libstdc++-v3/include/hppa-linux -I/home/dave/gcc-3.4/objdir/hppa-linux/libstdc++-v3/include -I/home/dave/gcc-3.4/gcc/libstdc++-v3/libsupc++ -I/home/dave/gcc-3.4/gcc/libstdc++-v3/libsupc++ -I/home/dave/gcc-3.4/gcc/libstdc++-v3/include/backward -I/home/dave/gcc-3.4/gcc/libstdc++-v3/testsuite /home/dave/gcc-3.4/gcc/libst!
dc++-v3/testsuite/ext/enc_filebuf/char/13189.cc -include bits/stdc++.h -L/home/dave/gcc-3.4/objdir/hppa-linux/./libstdc++-v3/testsuite -lv3test -lm -o ./13189.exe (timeout = 300)
/home/dave/gcc-3.4/gcc/libstdc++-v3/testsuite/ext/enc_filebuf/char/13189.cc: In function `void test01()':
/home/dave/gcc-3.4/gcc/libstdc++-v3/testsuite/ext/enc_filebuf/char/13189.cc:30: error: expected init-declarator before '<' token
/home/dave/gcc-3.4/gcc/libstdc++-v3/testsuite/ext/enc_filebuf/char/13189.cc:30: error: expected `,' or `;' before '<' token
/home/dave/gcc-3.4/gcc/libstdc++-v3/testsuite/ext/enc_filebuf/char/13189.cc:38: error: `filebuf_type' undeclared (first use this function)
...
Executing on host: /home/dave/gcc-3.4/objdir/gcc/g++ -shared-libgcc -B/home/dave/gcc-3.4/objdir/gcc/ -nostdinc++ -L/home/dave/gcc-3.4/objdir/hppa-linux/libstdc++-v3/src -L/home/dave/gcc-3.4/objdir/hppa-linux/libstdc++-v3/src/.libs -B/home/dave/opt/gnu/gcc/gcc-3.4.2/hppa-linux/bin/ -B/home/dave/opt/gnu/gcc/gcc-3.4.2/hppa-linux/lib/ -isystem /home/dave/opt/gnu/gcc/gcc-3.4.2/hppa-linux/include -isystem /home/dave/opt/gnu/gcc/gcc-3.4.2/hppa-linux/sys-include -g -O2 -D_GLIBCXX_ASSERT -ffunction-sections -fdata-sections -fmessage-length=0 -DLOCALEDIR="/home/dave/gcc-3.4/objdir/hppa-linux/libstdc++-v3/po/share/locale" -nostdinc++ -I/home/dave/gcc-3.4/objdir/hppa-linux/libstdc++-v3/include/hppa-linux -I/home/dave/gcc-3.4/objdir/hppa-linux/libstdc++-v3/include -I/home/dave/gcc-3.4/gcc/libstdc++-v3/libsupc++ -I/home/dave/gcc-3.4/gcc/libstdc++-v3/libsupc++ -I/home/dave/gcc-3.4/gcc/libstdc++-v3/include/backward -I/home/dave/gcc-3.4/gcc/libstdc++-v3/testsuite /home/dave/gcc-3.4/gcc/libst!
dc++-v3/testsuite/ext/enc_filebuf/wchar_t/13189.cc -include bits/stdc++.h -L/home/dave/gcc-3.4/objdir/hppa-linux/./libstdc++-v3/testsuite -lv3test -lm -o ./13189.exe (timeout = 300)
/home/dave/gcc-3.4/gcc/libstdc++-v3/testsuite/ext/enc_filebuf/wchar_t/13189.cc: In function `void test01()':
/home/dave/gcc-3.4/gcc/libstdc++-v3/testsuite/ext/enc_filebuf/wchar_t/13189.cc:30: error: expected init-declarator before '<' token
/home/dave/gcc-3.4/gcc/libstdc++-v3/testsuite/ext/enc_filebuf/wchar_t/13189.cc:30: error: expected `,' or `;' before '<' token
/home/dave/gcc-3.4/gcc/libstdc++-v3/testsuite/ext/enc_filebuf/wchar_t/13189.cc:38: error: `filebuf_type' undeclared (first use this function)
...
I'm currently doing a regular bootstrap. Is this ok for 3.4 and 3.5
assuming no regressions in the regular bootstrap?
Dave
--
J. David Anglin dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6602)
2004-07-05 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
PR target/16344
* c-pch.c (c_common_valid_pch): Do a non-canonicalized function pointer
comparison before doing a canonicalized comparison.
Index: c-pch.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-pch.c,v
retrieving revision 1.19.4.1
diff -u -3 -p -r1.19.4.1 c-pch.c
--- c-pch.c 24 Mar 2004 22:27:54 -0000 1.19.4.1
+++ c-pch.c 5 Jul 2004 16:35:36 -0000
@@ -333,7 +333,7 @@ c_common_valid_pch (cpp_reader *pfile, c
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)
+ if (v.pch_init != (void *) &pch_init || v.pch_init != &pch_init)
{
if (cpp_get_options (pfile)->warn_invalid_pch)
cpp_error (pfile, CPP_DL_WARNING,
More information about the Gcc-patches
mailing list