public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/12218] New: code generated for initializing global variable with pointer-to-member crashes
@ 2003-09-08 22:27 bryner at brianryner dot com
  2003-09-08 22:29 ` [Bug c++/12218] " bryner at brianryner dot com
                   ` (20 more replies)
  0 siblings, 21 replies; 22+ messages in thread
From: bryner at brianryner dot com @ 2003-09-08 22:27 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: code generated for initializing global variable with
                    pointer-to-member crashes
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bryner at brianryner dot com
                CC: dbaron at dbaron dot org,gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-gnu-linux
  GCC host triplet: i686-gnu-linux
GCC target triplet: i686-gnu-linux

As the summary says... if you initialize a global variable with a
pointer-to-member, the application will crash at startup.  GCC CVS trunk pulled
on  9/6/03.  Testcase and stack trace coming up.


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Bug c++/12218] code generated for initializing global variable with pointer-to-member crashes
  2003-09-08 22:27 [Bug c++/12218] New: code generated for initializing global variable with pointer-to-member crashes bryner at brianryner dot com
@ 2003-09-08 22:29 ` bryner at brianryner dot com
  2003-09-08 22:30 ` bryner at brianryner dot com
                   ` (19 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: bryner at brianryner dot com @ 2003-09-08 22:29 UTC (permalink / raw)
  To: gcc-bugs

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 bryner at brianryner dot com  2003-09-08 22:29 -------
Created an attachment (id=4722)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=4722&action=view)
testcase


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Bug c++/12218] code generated for initializing global variable with pointer-to-member crashes
  2003-09-08 22:27 [Bug c++/12218] New: code generated for initializing global variable with pointer-to-member crashes bryner at brianryner dot com
  2003-09-08 22:29 ` [Bug c++/12218] " bryner at brianryner dot com
@ 2003-09-08 22:30 ` bryner at brianryner dot com
  2003-09-08 23:14 ` [Bug c++/12218] [3.4 regression] runtime segfault when initializing global variable with pointer-to-member bangerth at dealii dot org
                   ` (18 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: bryner at brianryner dot com @ 2003-09-08 22:30 UTC (permalink / raw)
  To: gcc-bugs

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 bryner at brianryner dot com  2003-09-08 22:30 -------
Created an attachment (id=4723)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=4723&action=view)
stack trace of testcase crash


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Bug c++/12218] [3.4 regression] runtime segfault when initializing global variable with pointer-to-member
  2003-09-08 22:27 [Bug c++/12218] New: code generated for initializing global variable with pointer-to-member crashes bryner at brianryner dot com
  2003-09-08 22:29 ` [Bug c++/12218] " bryner at brianryner dot com
  2003-09-08 22:30 ` bryner at brianryner dot com
@ 2003-09-08 23:14 ` bangerth at dealii dot org
  2003-09-08 23:18 ` pinskia at gcc dot gnu dot org
                   ` (17 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: bangerth at dealii dot org @ 2003-09-08 23:14 UTC (permalink / raw)
  To: gcc-bugs

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


bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2003-09-08 23:14:41
               date|                            |
            Summary|code generated for          |[3.4 regression] runtime
                   |initializing global variable|segfault when initializing
                   |with pointer-to-member      |global variable with
                   |crashes                     |pointer-to-member
   Target Milestone|---                         |3.4


------- Additional Comments From bangerth at dealii dot org  2003-09-08 23:14 -------
Indeed, a regression on mainline. Slightly massaged and put
into the style in which we usually have it, this looks like so:
------------------------
struct C {
  int i;
  typedef int C::*mPtr;
  static const mPtr side;
};

const C::mPtr C::side = &C::i;

int main() {}
------------------------
The code segfaults in run time.

W.


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Bug c++/12218] [3.4 regression] runtime segfault when initializing global variable with pointer-to-member
  2003-09-08 22:27 [Bug c++/12218] New: code generated for initializing global variable with pointer-to-member crashes bryner at brianryner dot com
                   ` (2 preceding siblings ...)
  2003-09-08 23:14 ` [Bug c++/12218] [3.4 regression] runtime segfault when initializing global variable with pointer-to-member bangerth at dealii dot org
@ 2003-09-08 23:18 ` pinskia at gcc dot gnu dot org
  2003-09-08 23:20 ` bryner at brianryner dot com
                   ` (16 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-09-08 23:18 UTC (permalink / raw)
  To: gcc-bugs

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


pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-09-08 23:18 -------
The problem is _ZN9nsCSSRect4sideE (nsCSSRect::side) is being put in the read only data section 
which it should not be.


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Bug c++/12218] [3.4 regression] runtime segfault when initializing global variable with pointer-to-member
  2003-09-08 22:27 [Bug c++/12218] New: code generated for initializing global variable with pointer-to-member crashes bryner at brianryner dot com
                   ` (3 preceding siblings ...)
  2003-09-08 23:18 ` pinskia at gcc dot gnu dot org
@ 2003-09-08 23:20 ` bryner at brianryner dot com
  2003-09-08 23:22 ` bangerth at dealii dot org
                   ` (15 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: bryner at brianryner dot com @ 2003-09-08 23:20 UTC (permalink / raw)
  To: gcc-bugs

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 bryner at brianryner dot com  2003-09-08 23:20 -------
Why wouldn't that be read-only data?  Isn't the value of the pointer-to-member
determined at compile time?


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Bug c++/12218] [3.4 regression] runtime segfault when initializing global variable with pointer-to-member
  2003-09-08 22:27 [Bug c++/12218] New: code generated for initializing global variable with pointer-to-member crashes bryner at brianryner dot com
                   ` (4 preceding siblings ...)
  2003-09-08 23:20 ` bryner at brianryner dot com
@ 2003-09-08 23:22 ` bangerth at dealii dot org
  2003-09-08 23:27 ` bangerth at dealii dot org
                   ` (14 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: bangerth at dealii dot org @ 2003-09-08 23:22 UTC (permalink / raw)
  To: gcc-bugs

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:22 -------
For added confusion -- this code crashes:
-------------------------------
struct C { int i; };

typedef int C::*mPtr;
const mPtr m = &C::i;

int main() {}
-------------------------------
whereas it doesn't if either
a) the variable m is not declared constant, or
b) m is declared in the entirely equivalent way
    const int C::*m = &C::i;

W.


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Bug c++/12218] [3.4 regression] runtime segfault when initializing global variable with pointer-to-member
  2003-09-08 22:27 [Bug c++/12218] New: code generated for initializing global variable with pointer-to-member crashes bryner at brianryner dot com
                   ` (5 preceding siblings ...)
  2003-09-08 23:22 ` bangerth at dealii dot org
@ 2003-09-08 23:27 ` bangerth at dealii dot org
  2003-09-08 23:39 ` dbaron at dbaron dot org
                   ` (13 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: bangerth at dealii dot org @ 2003-09-08 23:27 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Bug c++/12218] [3.4 regression] runtime segfault when initializing global variable with pointer-to-member
  2003-09-08 22:27 [Bug c++/12218] New: code generated for initializing global variable with pointer-to-member crashes bryner at brianryner dot com
                   ` (6 preceding siblings ...)
  2003-09-08 23:27 ` bangerth at dealii dot org
@ 2003-09-08 23:39 ` dbaron at dbaron dot org
  2003-09-08 23:49 ` dbaron at dbaron dot org
                   ` (12 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: dbaron at dbaron dot org @ 2003-09-08 23:39 UTC (permalink / raw)
  To: gcc-bugs

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 dbaron at dbaron dot org  2003-09-08 23:39 -------
It should be zero, since that's its offset within the struct.


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Bug c++/12218] [3.4 regression] runtime segfault when initializing global variable with pointer-to-member
  2003-09-08 22:27 [Bug c++/12218] New: code generated for initializing global variable with pointer-to-member crashes bryner at brianryner dot com
                   ` (7 preceding siblings ...)
  2003-09-08 23:39 ` dbaron at dbaron dot org
@ 2003-09-08 23:49 ` dbaron at dbaron dot org
  2003-09-09 21:58 ` dbaron at dbaron dot org
                   ` (11 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: dbaron at dbaron dot org @ 2003-09-08 23:49 UTC (permalink / raw)
  To: gcc-bugs

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 dbaron at dbaron dot org  2003-09-08 23:49 -------
So it's clear what the regression is:

gcc 3.3 puts the variables in .rodata with the correct value and emits no
initialization code

gcc trunk puts the variables in .rodata with the value -1 and emits
initialization code (with the correct value) which segfaults

That's based on the testcase:

struct C { int i, j; };
typedef int C::*mPtr;
extern const mPtr should_be_0 = &C::i;
extern const mPtr should_be_4 = &C::j;


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Bug c++/12218] [3.4 regression] runtime segfault when initializing global variable with pointer-to-member
  2003-09-08 22:27 [Bug c++/12218] New: code generated for initializing global variable with pointer-to-member crashes bryner at brianryner dot com
                   ` (8 preceding siblings ...)
  2003-09-08 23:49 ` dbaron at dbaron dot org
@ 2003-09-09 21:58 ` dbaron at dbaron dot org
  2003-09-11 18:37 ` dbaron at dbaron dot org
                   ` (10 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: dbaron at dbaron dot org @ 2003-09-09 21:58 UTC (permalink / raw)
  To: gcc-bugs

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 dbaron at dbaron dot org  2003-09-09 21:58 -------
I think (assuming that my old gcc trunk builds don't find pieces of new builds
after being moved into different directories) that this regressed between
2003-05-12 and 2003-07-27.


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Bug c++/12218] [3.4 regression] runtime segfault when initializing global variable with pointer-to-member
  2003-09-08 22:27 [Bug c++/12218] New: code generated for initializing global variable with pointer-to-member crashes bryner at brianryner dot com
                   ` (9 preceding siblings ...)
  2003-09-09 21:58 ` dbaron at dbaron dot org
@ 2003-09-11 18:37 ` dbaron at dbaron dot org
  2003-09-15  7:07 ` dbaron at dbaron dot org
                   ` (9 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: dbaron at dbaron dot org @ 2003-09-11 18:37 UTC (permalink / raw)
  To: gcc-bugs

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 dbaron at dbaron dot org  2003-09-11 18:37 -------
I did a build of gcc from 2003-07-21, so I can say it's a regression between
2003-0721 and 2003-07-27.


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Bug c++/12218] [3.4 regression] runtime segfault when initializing global variable with pointer-to-member
  2003-09-08 22:27 [Bug c++/12218] New: code generated for initializing global variable with pointer-to-member crashes bryner at brianryner dot com
                   ` (10 preceding siblings ...)
  2003-09-11 18:37 ` dbaron at dbaron dot org
@ 2003-09-15  7:07 ` dbaron at dbaron dot org
  2003-09-16 21:56 ` bangerth at dealii dot org
                   ` (8 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: dbaron at dbaron dot org @ 2003-09-15  7:07 UTC (permalink / raw)
  To: gcc-bugs

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 dbaron at dbaron dot org  2003-09-15 04:46 -------
Ignore the last sentence of my previous comment.


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Bug c++/12218] [3.4 regression] runtime segfault when initializing global variable with pointer-to-member
  2003-09-08 22:27 [Bug c++/12218] New: code generated for initializing global variable with pointer-to-member crashes bryner at brianryner dot com
                   ` (11 preceding siblings ...)
  2003-09-15  7:07 ` dbaron at dbaron dot org
@ 2003-09-16 21:56 ` bangerth at dealii dot org
  2003-10-06 23:26 ` dbaron at dbaron dot org
                   ` (7 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: bangerth at dealii dot org @ 2003-09-16 21:56 UTC (permalink / raw)
  To: gcc-bugs

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-16 20:20 -------
A patch was posted here: 
  http://gcc.gnu.org/ml/gcc-patches/2003-09/msg00947.html


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Bug c++/12218] [3.4 regression] runtime segfault when initializing global variable with pointer-to-member
  2003-09-08 22:27 [Bug c++/12218] New: code generated for initializing global variable with pointer-to-member crashes bryner at brianryner dot com
                   ` (12 preceding siblings ...)
  2003-09-16 21:56 ` bangerth at dealii dot org
@ 2003-10-06 23:26 ` dbaron at dbaron dot org
  2003-10-14 21:07 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: dbaron at dbaron dot org @ 2003-10-06 23:26 UTC (permalink / raw)
  To: gcc-bugs

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 dbaron at dbaron dot org  2003-10-06 23:26 -------
I was told that this patch produces 2 new regression test failures:

FAIL: g++.old-deja/g++.mike/p10849a.C (test for excess errors)
WARNING: g++.old-deja/g++.mike/p10849a.C compilation failed to produce
executable
FAIL: g++.old-deja/g++.mike/pmf1.C (test for excess errors)
WARNING: g++.old-deja/g++.mike/pmf1.C compilation failed to produce
executable

(which I see in my tree, although I didn't try backing the patch out to see what
happens then).  Thus it was not checked in.  And I may not have time to look
into this much further.


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Bug c++/12218] [3.4 regression] runtime segfault when initializing global variable with pointer-to-member
  2003-09-08 22:27 [Bug c++/12218] New: code generated for initializing global variable with pointer-to-member crashes bryner at brianryner dot com
                   ` (13 preceding siblings ...)
  2003-10-06 23:26 ` dbaron at dbaron dot org
@ 2003-10-14 21:07 ` pinskia at gcc dot gnu dot org
  2003-11-14 22:21 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-10-14 21:07 UTC (permalink / raw)
  To: gcc-bugs

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


pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ahaas at airmail dot net


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-10-14 21:07 -------
*** Bug 12616 has been marked as a duplicate of this bug. ***


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Bug c++/12218] [3.4 regression] runtime segfault when initializing global variable with pointer-to-member
  2003-09-08 22:27 [Bug c++/12218] New: code generated for initializing global variable with pointer-to-member crashes bryner at brianryner dot com
                   ` (14 preceding siblings ...)
  2003-10-14 21:07 ` pinskia at gcc dot gnu dot org
@ 2003-11-14 22:21 ` pinskia at gcc dot gnu dot org
  2003-12-02  0:48 ` zack at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-11-14 22:21 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-11-14 22:21 -------
Updated patch here: <http://gcc.gnu.org/ml/gcc-patches/2003-11/msg01169.html>.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12218


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Bug c++/12218] [3.4 regression] runtime segfault when initializing global variable with pointer-to-member
  2003-09-08 22:27 [Bug c++/12218] New: code generated for initializing global variable with pointer-to-member crashes bryner at brianryner dot com
                   ` (15 preceding siblings ...)
  2003-11-14 22:21 ` pinskia at gcc dot gnu dot org
@ 2003-12-02  0:48 ` zack at gcc dot gnu dot org
  2003-12-02  1:30 ` bangerth at dealii dot org
                   ` (3 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: zack at gcc dot gnu dot org @ 2003-12-02  0:48 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From zack at gcc dot gnu dot org  2003-12-02 00:48 -------
I'd like an opinion from a C++ expert as to whether (a) the code here is even
legitimate, (b) the proposed patch has no unexpected side effects.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12218


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Bug c++/12218] [3.4 regression] runtime segfault when initializing global variable with pointer-to-member
  2003-09-08 22:27 [Bug c++/12218] New: code generated for initializing global variable with pointer-to-member crashes bryner at brianryner dot com
                   ` (16 preceding siblings ...)
  2003-12-02  0:48 ` zack at gcc dot gnu dot org
@ 2003-12-02  1:30 ` bangerth at dealii dot org
  2003-12-17  2:28 ` mmitchel at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: bangerth at dealii dot org @ 2003-12-02  1:30 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2003-12-02 01:30 -------
As to a) -- yes, the code is legal. gcc should simply not put a variable
into read-only memory and still emit initializer code. That's a gcc bug,
not a bug in the code.

W.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12218


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Bug c++/12218] [3.4 regression] runtime segfault when initializing global variable with pointer-to-member
  2003-09-08 22:27 [Bug c++/12218] New: code generated for initializing global variable with pointer-to-member crashes bryner at brianryner dot com
                   ` (17 preceding siblings ...)
  2003-12-02  1:30 ` bangerth at dealii dot org
@ 2003-12-17  2:28 ` mmitchel at gcc dot gnu dot org
  2003-12-17  4:55 ` cvs-commit at gcc dot gnu dot org
  2003-12-17  5:36 ` mmitchel at gcc dot gnu dot org
  20 siblings, 0 replies; 22+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2003-12-17  2:28 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |mark at codesourcery dot com
                   |dot org                     |
             Status|NEW                         |ASSIGNED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12218


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Bug c++/12218] [3.4 regression] runtime segfault when initializing global variable with pointer-to-member
  2003-09-08 22:27 [Bug c++/12218] New: code generated for initializing global variable with pointer-to-member crashes bryner at brianryner dot com
                   ` (18 preceding siblings ...)
  2003-12-17  2:28 ` mmitchel at gcc dot gnu dot org
@ 2003-12-17  4:55 ` cvs-commit at gcc dot gnu dot org
  2003-12-17  5:36 ` mmitchel at gcc dot gnu dot org
  20 siblings, 0 replies; 22+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2003-12-17  4:55 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2003-12-17 04:46 -------
Subject: Bug 12218

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2003-12-17 04:45:53

Modified files:
	gcc            : ChangeLog varasm.c 
	gcc/cp         : ChangeLog decl.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/init: error1.C pm3.C 

Log message:
	PR c++/12218
	* varasm.c (initializer_constant_valid_p): Allow a conversion from
	an integral constant to an OFFSET_TYPE.
	
	PR c++/12696
	* decl.c (reshape_init): Recover quickly from errors.
	
	PR c++/12218
	* g++.dg/init/pm3.C: New test.
	
	PR c++/12696
	* g++.dg/init/error1.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.2014&r2=2.2015
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/varasm.c.diff?cvsroot=gcc&r1=1.399&r2=1.400
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3814&r2=1.3815
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.1162&r2=1.1163
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3273&r2=1.3274
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/init/error1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/init/pm3.C.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12218


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Bug c++/12218] [3.4 regression] runtime segfault when initializing global variable with pointer-to-member
  2003-09-08 22:27 [Bug c++/12218] New: code generated for initializing global variable with pointer-to-member crashes bryner at brianryner dot com
                   ` (19 preceding siblings ...)
  2003-12-17  4:55 ` cvs-commit at gcc dot gnu dot org
@ 2003-12-17  5:36 ` mmitchel at gcc dot gnu dot org
  20 siblings, 0 replies; 22+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2003-12-17  5:36 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2003-12-17 05:28 -------
Fixed in GCC 3.4.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12218


^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2003-12-17  5:28 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-08 22:27 [Bug c++/12218] New: code generated for initializing global variable with pointer-to-member crashes bryner at brianryner dot com
2003-09-08 22:29 ` [Bug c++/12218] " bryner at brianryner dot com
2003-09-08 22:30 ` bryner at brianryner dot com
2003-09-08 23:14 ` [Bug c++/12218] [3.4 regression] runtime segfault when initializing global variable with pointer-to-member bangerth at dealii dot org
2003-09-08 23:18 ` pinskia at gcc dot gnu dot org
2003-09-08 23:20 ` bryner at brianryner dot com
2003-09-08 23:22 ` bangerth at dealii dot org
2003-09-08 23:27 ` bangerth at dealii dot org
2003-09-08 23:39 ` dbaron at dbaron dot org
2003-09-08 23:49 ` dbaron at dbaron dot org
2003-09-09 21:58 ` dbaron at dbaron dot org
2003-09-11 18:37 ` dbaron at dbaron dot org
2003-09-15  7:07 ` dbaron at dbaron dot org
2003-09-16 21:56 ` bangerth at dealii dot org
2003-10-06 23:26 ` dbaron at dbaron dot org
2003-10-14 21:07 ` pinskia at gcc dot gnu dot org
2003-11-14 22:21 ` pinskia at gcc dot gnu dot org
2003-12-02  0:48 ` zack at gcc dot gnu dot org
2003-12-02  1:30 ` bangerth at dealii dot org
2003-12-17  2:28 ` mmitchel at gcc dot gnu dot org
2003-12-17  4:55 ` cvs-commit at gcc dot gnu dot org
2003-12-17  5:36 ` mmitchel at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).