public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/38427]  New: crash for reference init code
@ 2008-12-06 11:45 dcb314 at hotmail dot com
  2008-12-06 12:05 ` [Bug c++/38427] [4.4 Regression] " rguenth at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: dcb314 at hotmail dot com @ 2008-12-06 11:45 UTC (permalink / raw)
  To: gcc-bugs

I just tried to compile the following C++ source code
with the GNU C compiler version 4.4 snapshot 20081205.

struct S
{
        int & ref;
        S() : ref() {
        };
};

The compiler said

$ ~/gcc/20081205/results/bin/g++ jun17.cc
jun17.cc: In constructor 'S::S()':
jun17.cc:5: warning: default-initialization of 'int& S::ref', which has
reference type
jun17.cc:5: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

Here is valgrind helping out with a stack backtrace

==32646== Invalid read of size 2
==32646==    at 0x54A935: cp_gimplify_expr (cp-gimplify.c:435)
==32646==    by 0x6FB6F4: gimplify_expr (gimplify.c:6255)
==32646==    by 0x704DD6: gimplify_stmt (gimplify.c:5006)
==32646==    by 0x705E4B: gimplify_cleanup_point_expr (gimplify.c:4808)
==32646==    by 0x6FC164: gimplify_expr (gimplify.c:6576)
==32646==    by 0x704DD6: gimplify_stmt (gimplify.c:5006)
==32646==    by 0x7058B5: gimplify_bind_expr (gimplify.c:1264)
==32646==    by 0x6FBF36: gimplify_expr (gimplify.c:6430)
==32646==    by 0x704DD6: gimplify_stmt (gimplify.c:5006)
==32646==    by 0x704EBD: gimplify_body (gimplify.c:7226)
==32646==    by 0x7051B4: gimplify_function_tree (gimplify.c:7304)
==32646==    by 0x58B259: c_genericize (c-gimplify.c:107)
==32646==  Address 0x0 is not stack'd, malloc'd or (recently) free'd

This code used to compile ok on snapshot 20081128


-- 
           Summary: crash for reference init code
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dcb314 at hotmail dot com
  GCC host triplet: suse-linux-x86_64


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


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

* [Bug c++/38427] [4.4 Regression] crash for reference init code
  2008-12-06 11:45 [Bug c++/38427] New: crash for reference init code dcb314 at hotmail dot com
@ 2008-12-06 12:05 ` rguenth at gcc dot gnu dot org
  2008-12-09 19:38 ` mmitchel at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-12-06 12:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2008-12-06 12:03 -------
Confirmed.  It would be error-recovery if GCC rejected the code as required
(2.95.4 rejects it).  Default-initialization of references is not valid.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |accepts-invalid, ice-on-
                   |                            |invalid-code
      Known to work|                            |2.95.4 4.3.2
   Last reconfirmed|0000-00-00 00:00:00         |2008-12-06 12:03:39
               date|                            |
            Summary|crash for reference init    |[4.4 Regression] crash for
                   |code                        |reference init code
   Target Milestone|---                         |4.4.0


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


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

* [Bug c++/38427] [4.4 Regression] crash for reference init code
  2008-12-06 11:45 [Bug c++/38427] New: crash for reference init code dcb314 at hotmail dot com
  2008-12-06 12:05 ` [Bug c++/38427] [4.4 Regression] " rguenth at gcc dot gnu dot org
@ 2008-12-09 19:38 ` mmitchel at gcc dot gnu dot org
  2008-12-18 20:53 ` jakub at gcc dot gnu dot org
  2008-12-18 20:59 ` jakub at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2008-12-09 19:38 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


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


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

* [Bug c++/38427] [4.4 Regression] crash for reference init code
  2008-12-06 11:45 [Bug c++/38427] New: crash for reference init code dcb314 at hotmail dot com
  2008-12-06 12:05 ` [Bug c++/38427] [4.4 Regression] " rguenth at gcc dot gnu dot org
  2008-12-09 19:38 ` mmitchel at gcc dot gnu dot org
@ 2008-12-18 20:53 ` jakub at gcc dot gnu dot org
  2008-12-18 20:59 ` jakub at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-12-18 20:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jakub at gcc dot gnu dot org  2008-12-18 20:52 -------
Subject: Bug 38427

Author: jakub
Date: Thu Dec 18 20:51:07 2008
New Revision: 142818

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=142818
Log:
        PR c++/38427
        * init.c (perform_member_init): For value-initialized
        references call permerror instead of warning and don't emit any
        INIT_EXPR.

        * g++.dg/init/ctor9.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/init/ctor9.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/init.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c++/38427] [4.4 Regression] crash for reference init code
  2008-12-06 11:45 [Bug c++/38427] New: crash for reference init code dcb314 at hotmail dot com
                   ` (2 preceding siblings ...)
  2008-12-18 20:53 ` jakub at gcc dot gnu dot org
@ 2008-12-18 20:59 ` jakub at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-12-18 20:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jakub at gcc dot gnu dot org  2008-12-18 20:57 -------
Fixed.


-- 

jakub at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2008-12-18 20:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-06 11:45 [Bug c++/38427] New: crash for reference init code dcb314 at hotmail dot com
2008-12-06 12:05 ` [Bug c++/38427] [4.4 Regression] " rguenth at gcc dot gnu dot org
2008-12-09 19:38 ` mmitchel at gcc dot gnu dot org
2008-12-18 20:53 ` jakub at gcc dot gnu dot org
2008-12-18 20:59 ` jakub 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).