public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/47874] New: Multiple Inheritance - Virtual Function - Segfault
@ 2011-02-24  7:14 isahib at xtra dot co.nz
  2011-02-24  9:54 ` [Bug c++/47874] " redi at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: isahib at xtra dot co.nz @ 2011-02-24  7:14 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: Multiple Inheritance - Virtual Function - Segfault
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: isahib@xtra.co.nz


Created attachment 23449
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23449
gcc-4.6 -save-temps output, demos bug

The attached BugReport.ii demos a reproducible bug in a complex multiple
inheritance scheme. When the virtual function BugReport::Tier1::Object::Print
is overridden and called in a derived class then the program segfaults.

ggc-4.6 -v
==========
Using built-in specs.
COLLECT_GCC=gcc-4.6
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6.0/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.6-20110216-1'
--with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++,go --prefix=/usr
--program-suffix=-4.6 --enable-shared --enable-multiarch
--enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls
--enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes
--enable-plugin --enable-gold --enable-ld=default --with-plugin-ld=ld.gold
--enable-objc-gc --with-arch-32=i586 --with-tune=generic
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu
Thread model: posix
gcc version 4.6.0 20110216 (experimental) [trunk revision 170225] (Debian
4.6-20110216-1)

gcc-4.6 build command line
==========================
-std=c++0x -Wall -Wextra -pedantic -g -save-temps

Shell output
============
Segmentation fault

Gdb output
==========
Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()


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

* [Bug c++/47874] Multiple Inheritance - Virtual Function - Segfault
  2011-02-24  7:14 [Bug c++/47874] New: Multiple Inheritance - Virtual Function - Segfault isahib at xtra dot co.nz
@ 2011-02-24  9:54 ` redi at gcc dot gnu.org
  2011-02-25  8:52 ` isahib at xtra dot co.nz
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2011-02-24  9:54 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2011.02.24 09:52:25
     Ever Confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-02-24 09:52:25 UTC ---
is this a duplicate of Bug 47873?

the attachments are slightly different, but presumably it's the same problem


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

* [Bug c++/47874] Multiple Inheritance - Virtual Function - Segfault
  2011-02-24  7:14 [Bug c++/47874] New: Multiple Inheritance - Virtual Function - Segfault isahib at xtra dot co.nz
  2011-02-24  9:54 ` [Bug c++/47874] " redi at gcc dot gnu.org
@ 2011-02-25  8:52 ` isahib at xtra dot co.nz
  2011-02-26 20:50 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: isahib at xtra dot co.nz @ 2011-02-25  8:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Ibaidul Sahib <isahib at xtra dot co.nz> 2011-02-25 05:29:27 UTC ---
(In reply to comment #1)
> is this a duplicate of Bug 47873?
> 
> the attachments are slightly different, but presumably it's the same problem

I presume that the problem is related. In both cases the segfault is happening
on members of the same BugReport::Tier2::Object.

However the difference is in the following:

In the case of 47873 BugReport::Tier2::Object itself is calling this->This()
internally

In the case of 47874 external object is calling
BugReport::Tier2::Object().Print()


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

* [Bug c++/47874] Multiple Inheritance - Virtual Function - Segfault
  2011-02-24  7:14 [Bug c++/47874] New: Multiple Inheritance - Virtual Function - Segfault isahib at xtra dot co.nz
  2011-02-24  9:54 ` [Bug c++/47874] " redi at gcc dot gnu.org
  2011-02-25  8:52 ` isahib at xtra dot co.nz
@ 2011-02-26 20:50 ` redi at gcc dot gnu.org
  2011-02-28  6:47 ` isahib at xtra dot co.nz
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2011-02-26 20:50 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |DUPLICATE

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-02-26 19:45:08 UTC ---
I assume this is a dup, when the other bug is fixed let's retest this case, it
should be fixed too

*** This bug has been marked as a duplicate of bug 47873 ***


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

* [Bug c++/47874] Multiple Inheritance - Virtual Function - Segfault
  2011-02-24  7:14 [Bug c++/47874] New: Multiple Inheritance - Virtual Function - Segfault isahib at xtra dot co.nz
                   ` (2 preceding siblings ...)
  2011-02-26 20:50 ` redi at gcc dot gnu.org
@ 2011-02-28  6:47 ` isahib at xtra dot co.nz
  2011-03-01  1:19 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: isahib at xtra dot co.nz @ 2011-02-28  6:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Ibaidul Sahib <isahib at xtra dot co.nz> 2011-02-28 06:31:01 UTC ---
Here are some additional test results on gcc 4.4.5/4.5.2:

g++-4.4.5
=========
(gdb) run
Starting program: /home/ibaidul/BugReport/Build/BugReport 

Program received signal SIGSEGV, Segmentation fault.
0x0000000000408d05 in BugReport::Tier2::Entity::Entity::Print (this=0x616298,
Stream=...) at /home/ibaidul/BugReport/Tier2/Entity/Entity.hpp:65
65                      This().Body().Print(Stream);
(gdb) bt

g++-4.5.2
=========
(gdb) run
Starting program: /home/ibaidul/BugReport/Build/BugReport 

Program received signal SIGSEGV, Segmentation fault.
0x00000000004091f1 in BugReport::Tier2::Entity::Entity::Print (this=0x615298,
Stream=...) at /home/ibaidul/BugReport/Tier2/Entity/Entity.hpp:65
65                      This().Body().Print(Stream);
(gdb) bt

However http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47873 seems to work fine on
both gcc 4.4.5/4.5.2


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

* [Bug c++/47874] Multiple Inheritance - Virtual Function - Segfault
  2011-02-24  7:14 [Bug c++/47874] New: Multiple Inheritance - Virtual Function - Segfault isahib at xtra dot co.nz
                   ` (3 preceding siblings ...)
  2011-02-28  6:47 ` isahib at xtra dot co.nz
@ 2011-03-01  1:19 ` redi at gcc dot gnu.org
  2011-03-01  1:30 ` redi at gcc dot gnu.org
  2011-03-12  2:18 ` isahib at xtra dot co.nz
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2011-03-01  1:19 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|DUPLICATE                   |

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-03-01 01:19:41 UTC ---
PR 47873 is fixed but this still crashes, so not a dup


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

* [Bug c++/47874] Multiple Inheritance - Virtual Function - Segfault
  2011-02-24  7:14 [Bug c++/47874] New: Multiple Inheritance - Virtual Function - Segfault isahib at xtra dot co.nz
                   ` (4 preceding siblings ...)
  2011-03-01  1:19 ` redi at gcc dot gnu.org
@ 2011-03-01  1:30 ` redi at gcc dot gnu.org
  2011-03-12  2:18 ` isahib at xtra dot co.nz
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2011-03-01  1:30 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |INVALID

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-03-01 01:30:28 UTC ---
BugReport::Tier2::Entity::m_Body is null when dereferenced


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

* [Bug c++/47874] Multiple Inheritance - Virtual Function - Segfault
  2011-02-24  7:14 [Bug c++/47874] New: Multiple Inheritance - Virtual Function - Segfault isahib at xtra dot co.nz
                   ` (5 preceding siblings ...)
  2011-03-01  1:30 ` redi at gcc dot gnu.org
@ 2011-03-12  2:18 ` isahib at xtra dot co.nz
  6 siblings, 0 replies; 8+ messages in thread
From: isahib at xtra dot co.nz @ 2011-03-12  2:18 UTC (permalink / raw)
  To: gcc-bugs

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

Ibaidul Sahib <isahib at xtra dot co.nz> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |CLOSED

--- Comment #7 from Ibaidul Sahib <isahib at xtra dot co.nz> 2011-03-12 02:18:47 UTC ---
(In reply to comment #6)
> BugReport::Tier2::Entity::m_Body is null when dereferenced

Confirmed http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47874#c6 in the attached
test case BugReport::Tier2::Entity::Entity fails to initialise m_Body properly.

In production code however the cause of the segfault may have been the
covariant Print() which may have been fixed by
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47873


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

end of thread, other threads:[~2011-03-12  2:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-24  7:14 [Bug c++/47874] New: Multiple Inheritance - Virtual Function - Segfault isahib at xtra dot co.nz
2011-02-24  9:54 ` [Bug c++/47874] " redi at gcc dot gnu.org
2011-02-25  8:52 ` isahib at xtra dot co.nz
2011-02-26 20:50 ` redi at gcc dot gnu.org
2011-02-28  6:47 ` isahib at xtra dot co.nz
2011-03-01  1:19 ` redi at gcc dot gnu.org
2011-03-01  1:30 ` redi at gcc dot gnu.org
2011-03-12  2:18 ` isahib at xtra dot co.nz

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).