public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/48211] New: [C++0x] Segment Fault When Compiling
@ 2011-03-20 16:40 neuront at bitfoc dot us
  2011-03-20 18:37 ` [Bug c++/48211] " redi at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: neuront at bitfoc dot us @ 2011-03-20 16:40 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: [C++0x] Segment Fault When Compiling
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: neuront@bitfoc.us


Created attachment 23729
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23729
source file and temp file.

Source file that leads to crash is in attachment, named as function.cpp, along
with temp files function. ii and function.s

The following is what I did to compile the source and the output by the
compiler.

$ gcc -std=c++0x function.cpp
In file included from
/usr/local/lib/gcc/i686-pc-cygwin/4.7.0/../../../../include/c++/4.7.0/memory:85:0,
                 from function.cpp:2:
/usr/local/lib/gcc/i686-pc-cygwin/4.7.0/../../../../include/c++/4.7.0/bits/unique_ptr.h:
In instantiation of ‘constexpr std::unique_ptr<_Tp, _Dp>::unique_ptr() [with
_Tp = const stmt_base, _Dp = std::default_delete<const stmt_base>]’:
function.cpp:8:8:   instantiated from ‘sptr<const stmt_base>’
function.cpp:28:33:   instantiated from here
/usr/local/lib/gcc/i686-pc-cygwin/4.7.0/../../../../include/c++/4.7.0/bits/unique_ptr.h:115:59:
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.

The following is compiler and system info.

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/i686-pc-cygwin/4.7.0/lto-wrapper.exe
Target: i686-pc-cygwin
Configured with: ./configure --enable-languages=c,c++,fortran,lto,objc
Thread model: single
gcc version 4.7.0 20110320 (experimental) (GCC)


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

* [Bug c++/48211] [C++0x] Segment Fault When Compiling
  2011-03-20 16:40 [Bug c++/48211] New: [C++0x] Segment Fault When Compiling neuront at bitfoc dot us
@ 2011-03-20 18:37 ` redi at gcc dot gnu.org
  2011-03-21 13:24 ` neuront at bitfoc dot us
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2011-03-20 18:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-03-20 16:55:55 UTC ---
The bug reporting guidelines request that you don't upload an archive of files.
The contained source file is:

#include <list>
#include <memory>
#include <sstream>

struct stmt_base;

template <typename _RawType>
struct sptr
    : public std::unique_ptr<_RawType>
{
    typedef std::unique_ptr<_RawType> base_type;
    typedef typename base_type::pointer pointer;
    typedef typename base_type::deleter_type deleter_type;
    sptr() = default;
};

struct block
{
    std::list<sptr<stmt_base const>> _stmts;
};

struct stmt_base {};

struct branch
    : public stmt_base
{
    branch(sptr<stmt_base const> c);
    sptr<stmt_base const> const alternative;
};

I can't reproduce the crash on x86_64-linux


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

* [Bug c++/48211] [C++0x] Segment Fault When Compiling
  2011-03-20 16:40 [Bug c++/48211] New: [C++0x] Segment Fault When Compiling neuront at bitfoc dot us
  2011-03-20 18:37 ` [Bug c++/48211] " redi at gcc dot gnu.org
@ 2011-03-21 13:24 ` neuront at bitfoc dot us
  2011-04-01 19:16 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: neuront at bitfoc dot us @ 2011-03-21 13:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Neuron Teckid <neuront at bitfoc dot us> 2011-03-21 13:01:38 UTC ---
I have reproduced this problem on Ubuntu (in a virtualbox guest), also GCC
4.7.0 experimental:

$ uname -a
Linux GCC4 2.6.35-27-generic #48-Ubuntu SMP Tue Feb 22 20:25:29 UTC 2011 i686
GNU/Linux

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/i686-pc-linux-gnu/4.7.0/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: ./configure --enable-languages=c,c++
Thread model: posix
gcc version 4.7.0 20110321 (experimental) (GCC)

$ g++ crash.cpp -std=c++0x
In file included from
/usr/local/lib/gcc/i686-pc-linux-gnu/4.7.0/../../../../include/c++/4.7.0/memory:85:0,
                 from crash.cpp:2:
/usr/local/lib/gcc/i686-pc-linux-gnu/4.7.0/../../../../include/c++/4.7.0/bits/unique_ptr.h:
In instantiation of ‘constexpr std::unique_ptr<_Tp, _Dp>::unique_ptr() [with
_Tp = acceptor_of_pack, _Dp = std::default_delete<acceptor_of_pack>]’:
crash.cpp:5:8:   instantiated from ‘sptr<acceptor_of_pack>’
crash.cpp:27:30:   instantiated from here
/usr/local/lib/gcc/i686-pc-linux-gnu/4.7.0/../../../../include/c++/4.7.0/bits/unique_ptr.h:115:59:
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.

where crash.cpp is

/* BEGIN */
#include <list>
#include <memory>

template <typename _RawType>
struct sptr
    : public std::unique_ptr<_RawType>
{
    sptr() = default;
};

struct stmt_base;

std::list<sptr<stmt_base>> move(std::list<sptr<stmt_base>>&& rhs)
{
    return std::move(rhs);
}

sptr<int> _last_else_pos;
sptr<stmt_base const> _predicate;

struct acceptor;

sptr<acceptor> acccc;
std::list<sptr<acceptor>> _acceptors;

struct acceptor_of_pack;
sptr<acceptor_of_pack> const _packer;

#include <sstream>
/* END */


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

* [Bug c++/48211] [C++0x] Segment Fault When Compiling
  2011-03-20 16:40 [Bug c++/48211] New: [C++0x] Segment Fault When Compiling neuront at bitfoc dot us
  2011-03-20 18:37 ` [Bug c++/48211] " redi at gcc dot gnu.org
  2011-03-21 13:24 ` neuront at bitfoc dot us
@ 2011-04-01 19:16 ` pinskia at gcc dot gnu.org
  2011-05-03 21:03 ` [Bug c++/48211] [4.7 Regression] " redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-04-01 19:16 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|critical                    |normal

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-04-01 19:16:30 UTC ---
C++0x is considered experimental so it can never be critical.


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

* [Bug c++/48211] [4.7 Regression] [C++0x] Segment Fault When Compiling
  2011-03-20 16:40 [Bug c++/48211] New: [C++0x] Segment Fault When Compiling neuront at bitfoc dot us
                   ` (2 preceding siblings ...)
  2011-04-01 19:16 ` pinskia at gcc dot gnu.org
@ 2011-05-03 21:03 ` redi at gcc dot gnu.org
  2011-05-26 17:02 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2011-05-03 21:03 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-invalid-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.05.03 21:00:51
      Known to work|                            |4.5.2, 4.6.0
            Summary|[C++0x] Segment Fault When  |[4.7 Regression] [C++0x]
                   |Compiling                   |Segment Fault When
                   |                            |Compiling
     Ever Confirmed|0                           |1
      Known to fail|                            |4.7.0

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-05-03 21:00:51 UTC ---
I can confirm this with the 4.7-20110430 snapshot, but only on i686 not x86_64

The code in comment 2 gets a segfault here:

Program received signal SIGSEGV, Segmentation fault.
0x08336684 in ggc_set_mark (p=0xb6f7a878) at
../../gcc-4.7-20110430/gcc/ggc-page.c:1333
1333      if (entry->in_use_p[word] & mask)
(gdb) p entry
$1 = (page_entry *) 0x9014f48
(gdb) p word
$2 = 8699297
(gdb) p entry->in_use_p
$3 = {4293918719}

Valgrind shows lots of errors in cpp.  The code is not valid, I don't know if
the ICE also happens with a fixed version.

The code in comment 1 does not ICE


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

* [Bug c++/48211] [4.7 Regression] [C++0x] Segment Fault When Compiling
  2011-03-20 16:40 [Bug c++/48211] New: [C++0x] Segment Fault When Compiling neuront at bitfoc dot us
                   ` (3 preceding siblings ...)
  2011-05-03 21:03 ` [Bug c++/48211] [4.7 Regression] " redi at gcc dot gnu.org
@ 2011-05-26 17:02 ` jason at gcc dot gnu.org
  2011-05-26 18:31 ` jason at gcc dot gnu.org
  2011-05-26 18:32 ` jason at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2011-05-26 17:02 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |jason at gcc dot gnu.org
         AssignedTo|unassigned at gcc dot       |jason at gcc dot gnu.org
                   |gnu.org                     |


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

* [Bug c++/48211] [4.7 Regression] [C++0x] Segment Fault When Compiling
  2011-03-20 16:40 [Bug c++/48211] New: [C++0x] Segment Fault When Compiling neuront at bitfoc dot us
                   ` (4 preceding siblings ...)
  2011-05-26 17:02 ` jason at gcc dot gnu.org
@ 2011-05-26 18:31 ` jason at gcc dot gnu.org
  2011-05-26 18:32 ` jason at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2011-05-26 18:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> 2011-05-26 18:30:17 UTC ---
Author: jason
Date: Thu May 26 18:30:13 2011
New Revision: 174303

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=174303
Log:
    PR c++/48211
    * name-lookup.h (cp_class_binding): Make base a pointer.
    * name-lookup.c (new_class_binding): Adjust.
    (poplevel_class): Adjust.

Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/name-lookup.c
    trunk/gcc/cp/name-lookup.h


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

* [Bug c++/48211] [4.7 Regression] [C++0x] Segment Fault When Compiling
  2011-03-20 16:40 [Bug c++/48211] New: [C++0x] Segment Fault When Compiling neuront at bitfoc dot us
                   ` (5 preceding siblings ...)
  2011-05-26 18:31 ` jason at gcc dot gnu.org
@ 2011-05-26 18:32 ` jason at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2011-05-26 18:32 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.7.0

--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> 2011-05-26 18:30:46 UTC ---
Fixed.


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

end of thread, other threads:[~2011-05-26 18:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-20 16:40 [Bug c++/48211] New: [C++0x] Segment Fault When Compiling neuront at bitfoc dot us
2011-03-20 18:37 ` [Bug c++/48211] " redi at gcc dot gnu.org
2011-03-21 13:24 ` neuront at bitfoc dot us
2011-04-01 19:16 ` pinskia at gcc dot gnu.org
2011-05-03 21:03 ` [Bug c++/48211] [4.7 Regression] " redi at gcc dot gnu.org
2011-05-26 17:02 ` jason at gcc dot gnu.org
2011-05-26 18:31 ` jason at gcc dot gnu.org
2011-05-26 18:32 ` jason at gcc dot gnu.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).