This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/12218] [3.4 regression] runtime segfault when initializing global variable with pointer-to-member


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]