This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/12218] [3.4 regression] runtime segfault when initializing global variable with pointer-to-member
- From: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Sep 2003 23:27:31 -0000
- Subject: [Bug c++/12218] [3.4 regression] runtime segfault when initializing global variable with pointer-to-member
- References: <20030908222714.12218.bryner@brianryner.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12218
------- Additional Comments From bangerth at dealii dot org 2003-09-08 23:27 -------
As to Andrew's comment -- of course the static variable should go into
the constants section. The problem, of course, is that gcc stills generates
initialization code that writes to this location:
.section .rodata
.align 4
.type problematic_variable, @object
.size problematic_variable, 4
problematic_variable:
.long -1
.text
.align 2
.type _Z41__static_initialization_and_destruction_0ii, @function
_Z41__static_initialization_and_destruction_0ii:
.LFB3:
pushl %ebp
.LCFI3:
movl %esp, %ebp
.LCFI4:
cmpl $65535, 12(%ebp)
jne .L2
cmpl $1, 8(%ebp)
jne .L2
movl $0, problematic_variable
Note in particular that the static initializer is also wrong: it
fills the location with zero, and the address of C::i is nowhere
taken.
W.