The following testcase segfaults on 3.4.4 and 3.4.0, but runs to completion on 3.2.3. Note this test won't even compile on mainline, so I don't know if the same problem exists there. See: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19878 -------------------------------------------------------- //test.c struct S { char k; }; char const volatile S::* const p01 = &S::k; int main(void) { return 0; } -------------------------------------------------------- /opt/gcc-nightly/3.4-20050211/bin/g++ -o test test.c ./test Segmentation fault ------------------------------------------------ $ gdb ./test (gdb) run Starting program: /home/jgrimm/tmp/13930/test Program received signal SIGSEGV, Segmentation fault. 0x10000474 in __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535) at g.c:5 5 char const volatile S::* const p01 = &S::k; ----------------------------------------------- $ /opt/gcc-nightly/3.4-20050211/bin/g++ -v Reading specs from /home/gcc-nightly/3.4-20050211/bin/../lib/gcc/powerpc64-linux/3.4.4/specs Configured with: /home/gccbuild/gcc_3.4_anoncvs/gcc/configure --prefix=/opt/gcc-nightly/3.4-20050211 --build=powerpc64-linux --host=powerpc64-linux --target=powerpc64-linux --with-cpu=default32 --with-as=/opt/gcc-nightly/binutils/bin/as --with-ld=/opt/gcc-nightly/binutils/bin/ld --enable-threads=posix --enable-shared --enable-__cxa_atexit --enable-languages=c,c++,f77,java,objc Thread model: posix gcc version 3.4.4 20050211 (prerelease)
Confirmed.
The behavior changed between 20030722 and 20030724.
I think this was caused by: 2003-07-22 Mark Mitchell <mark@codesourcery.com> Eliminate use of POINTER_TYPE for pointers-to-members.
Now that 19878 has been fixed, we can see that this does in fact fail on the mainline as well.
Subject: Bug 19916 CVSROOT: /cvs/gcc Module name: gcc Changes by: mmitchel@gcc.gnu.org 2005-03-02 17:13:10 Modified files: gcc : ChangeLog varasm.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/init: ptrmem2.C Log message: PR c++/19916 * varasm.c (initializer_constant_valid_p): Allow conversions between OFFSET_TYPEs. Tidy. PR c++/19916 * g++.dg/init/ptrmem2.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.7636&r2=2.7637 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/varasm.c.diff?cvsroot=gcc&r1=1.477&r2=1.478 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5102&r2=1.5103 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/init/ptrmem2.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
Subject: Bug 19916 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-4_0-branch Changes by: mmitchel@gcc.gnu.org 2005-03-02 20:55:58 Modified files: gcc : ChangeLog varasm.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/init: ptrmem2.C Log message: PR c++/19916 * varasm.c (initializer_constant_valid_p): Allow conversions between OFFSET_TYPEs. Tidy. PR c++/19916 * g++.dg/init/ptrmem2.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.7592.2.18&r2=2.7592.2.19 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/varasm.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.477&r2=1.477.6.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5084.2.13&r2=1.5084.2.14 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/init/ptrmem2.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1
Subject: Bug 19916 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_4-branch Changes by: mmitchel@gcc.gnu.org 2005-03-02 20:57:53 Modified files: gcc : ChangeLog varasm.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/init: ptrmem2.C Log message: PR c++/19916 * varasm.c (initializer_constant_valid_p): Allow conversions between OFFSET_TYPEs. Tidy. PR c++/19916 * g++.dg/init/ptrmem2.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.809&r2=2.2326.2.810 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/varasm.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.405.2.6&r2=1.405.2.7 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.366&r2=1.3389.2.367 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/init/ptrmem2.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.4.1
Fixed in GCC 3.4.4.
Verified. Thanks.