public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/54253] New: [C++11] constexpr constructor crashes with polymorphic base classes
@ 2012-08-14 14:15 mrks at koios dot de
  2012-08-14 14:20 ` [Bug c++/54253] " paolo.carlini at oracle dot com
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: mrks at koios dot de @ 2012-08-14 14:15 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 54253
           Summary: [C++11] constexpr constructor crashes with polymorphic
                    base classes
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: mrks@koios.de


Created attachment 28010
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28010
preprocessed source

In _some_ constellations, g++ exits with a segmentation fault:
I could not figure out a pattern to reduce all to a common 'sourceproblem', so
here is a list of what I tried:

* One polymorphic base class:
** implicit base constructor, explicitly called (as in the example): crashes
** implicit base constructor (even with default non-static member assignments),
implicitly called: works
** explicit constexpr base constructor, explicitly called: works
** explicit constexpr base constructor, implicitly called: works

* Multiple Inhertiance, first Base is polymorphic:
nearly the same as above, except that it doesn't crash in the first case but
says
const3.cc: In constructor 'constexpr Derived::Derived()':
const3.cc:15:42: error: uninitialized member 'Derived::<anonymous>' in
'constexpr' constructor
const3.cc:15: confused by earlier errors, bailing out

* Multiple Inhertiance, second Base is polymorphic:
crashes always


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

* [Bug c++/54253] [C++11] constexpr constructor crashes with polymorphic base classes
  2012-08-14 14:15 [Bug c++/54253] New: [C++11] constexpr constructor crashes with polymorphic base classes mrks at koios dot de
@ 2012-08-14 14:20 ` paolo.carlini at oracle dot com
  2012-08-14 14:34 ` paolo.carlini at oracle dot com
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-08-14 14:20 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-08-14
     Ever Confirmed|0                           |1

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-08-14 14:20:18 UTC ---
Confirmed.


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

* [Bug c++/54253] [C++11] constexpr constructor crashes with polymorphic base classes
  2012-08-14 14:15 [Bug c++/54253] New: [C++11] constexpr constructor crashes with polymorphic base classes mrks at koios dot de
  2012-08-14 14:20 ` [Bug c++/54253] " paolo.carlini at oracle dot com
@ 2012-08-14 14:34 ` paolo.carlini at oracle dot com
  2012-08-14 14:45 ` mrks at koios dot de
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-08-14 14:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-08-14 14:34:00 UTC ---
It would be nice to have 2 slightly more complex testcases too, like const3.cc
and one for your third case. Care to add something? Thanks in advance.


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

* [Bug c++/54253] [C++11] constexpr constructor crashes with polymorphic base classes
  2012-08-14 14:15 [Bug c++/54253] New: [C++11] constexpr constructor crashes with polymorphic base classes mrks at koios dot de
  2012-08-14 14:20 ` [Bug c++/54253] " paolo.carlini at oracle dot com
  2012-08-14 14:34 ` paolo.carlini at oracle dot com
@ 2012-08-14 14:45 ` mrks at koios dot de
  2012-08-14 14:48 ` paolo.carlini at oracle dot com
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mrks at koios dot de @ 2012-08-14 14:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from mrks at koios dot de 2012-08-14 14:45:31 UTC ---
Created attachment 28012
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28012
first base polymorphic

multiple inheritance, first base class is polymorphic
-> complains about uninitialized member Derived::<anonymous>
If Base::Base is the default ctor (no arguments), it doesn't complain but
segfaults.


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

* [Bug c++/54253] [C++11] constexpr constructor crashes with polymorphic base classes
  2012-08-14 14:15 [Bug c++/54253] New: [C++11] constexpr constructor crashes with polymorphic base classes mrks at koios dot de
                   ` (2 preceding siblings ...)
  2012-08-14 14:45 ` mrks at koios dot de
@ 2012-08-14 14:48 ` paolo.carlini at oracle dot com
  2012-08-14 14:49 ` mrks at koios dot de
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-08-14 14:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-08-14 14:48:45 UTC ---
Thanks!


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

* [Bug c++/54253] [C++11] constexpr constructor crashes with polymorphic base classes
  2012-08-14 14:15 [Bug c++/54253] New: [C++11] constexpr constructor crashes with polymorphic base classes mrks at koios dot de
                   ` (3 preceding siblings ...)
  2012-08-14 14:48 ` paolo.carlini at oracle dot com
@ 2012-08-14 14:49 ` mrks at koios dot de
  2012-08-14 14:51 ` mrks at koios dot de
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mrks at koios dot de @ 2012-08-14 14:49 UTC (permalink / raw)
  To: gcc-bugs

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

mrks at koios dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #28012|application/octet-stream    |text/plain
          mime type|                            |

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-08-14 14:48:45 UTC ---
Thanks!


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

* [Bug c++/54253] [C++11] constexpr constructor crashes with polymorphic base classes
  2012-08-14 14:15 [Bug c++/54253] New: [C++11] constexpr constructor crashes with polymorphic base classes mrks at koios dot de
                   ` (4 preceding siblings ...)
  2012-08-14 14:49 ` mrks at koios dot de
@ 2012-08-14 14:51 ` mrks at koios dot de
  2012-08-21 11:54 ` paolo.carlini at oracle dot com
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mrks at koios dot de @ 2012-08-14 14:51 UTC (permalink / raw)
  To: gcc-bugs

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

mrks at koios dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #28012|application/octet-stream    |text/plain
          mime type|                            |

--- Comment #5 from mrks at koios dot de 2012-08-14 14:51:02 UTC ---
Created attachment 28013
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28013
second base polymorphic

multiple inheritance, second base class is polymorphic
-> crashes if the first base class has a member (int x)


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

* [Bug c++/54253] [C++11] constexpr constructor crashes with polymorphic base classes
  2012-08-14 14:15 [Bug c++/54253] New: [C++11] constexpr constructor crashes with polymorphic base classes mrks at koios dot de
                   ` (5 preceding siblings ...)
  2012-08-14 14:51 ` mrks at koios dot de
@ 2012-08-21 11:54 ` paolo.carlini at oracle dot com
  2012-09-06 16:24 ` jason at gcc dot gnu.org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-08-21 11:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-08-21 11:53:53 UTC ---
Related to PR54341


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

* [Bug c++/54253] [C++11] constexpr constructor crashes with polymorphic base classes
  2012-08-14 14:15 [Bug c++/54253] New: [C++11] constexpr constructor crashes with polymorphic base classes mrks at koios dot de
                   ` (6 preceding siblings ...)
  2012-08-21 11:54 ` paolo.carlini at oracle dot com
@ 2012-09-06 16:24 ` jason at gcc dot gnu.org
  2012-09-06 16:25 ` jason at gcc dot gnu.org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu.org @ 2012-09-06 16:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> 2012-09-06 16:24:25 UTC ---
Author: jason
Date: Thu Sep  6 16:24:10 2012
New Revision: 191033

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=191033
Log:
    PR c++/54341
    PR c++/54253
    * semantics.c (sort_constexpr_mem_initializers): New.
    (build_constexpr_constructor_member_initializers): Use it.
    (cx_check_missing_mem_inits): Skip artificial fields.
    * init.c (expand_aggr_init_1): Don't zero out a class
    with no data.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-virtual2.C
    trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-virtual3.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/init.c
    trunk/gcc/cp/semantics.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/54253] [C++11] constexpr constructor crashes with polymorphic base classes
  2012-08-14 14:15 [Bug c++/54253] New: [C++11] constexpr constructor crashes with polymorphic base classes mrks at koios dot de
                   ` (8 preceding siblings ...)
  2012-09-06 16:25 ` jason at gcc dot gnu.org
@ 2012-09-06 16:25 ` jason at gcc dot gnu.org
  2012-09-10 14:24 ` jason at gcc dot gnu.org
  2012-09-10 14:43 ` jason at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu.org @ 2012-09-06 16:25 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org
   Target Milestone|---                         |4.8.0

--- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> 2012-09-06 16:24:25 UTC ---
Author: jason
Date: Thu Sep  6 16:24:10 2012
New Revision: 191033

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=191033
Log:
    PR c++/54341
    PR c++/54253
    * semantics.c (sort_constexpr_mem_initializers): New.
    (build_constexpr_constructor_member_initializers): Use it.
    (cx_check_missing_mem_inits): Skip artificial fields.
    * init.c (expand_aggr_init_1): Don't zero out a class
    with no data.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-virtual2.C
    trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-virtual3.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/init.c
    trunk/gcc/cp/semantics.c
    trunk/gcc/testsuite/ChangeLog

--- Comment #8 from Jason Merrill <jason at gcc dot gnu.org> 2012-09-06 16:25:00 UTC ---
Fixed for 4.8.


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

* [Bug c++/54253] [C++11] constexpr constructor crashes with polymorphic base classes
  2012-08-14 14:15 [Bug c++/54253] New: [C++11] constexpr constructor crashes with polymorphic base classes mrks at koios dot de
                   ` (7 preceding siblings ...)
  2012-09-06 16:24 ` jason at gcc dot gnu.org
@ 2012-09-06 16:25 ` jason at gcc dot gnu.org
  2012-09-06 16:25 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu.org @ 2012-09-06 16:25 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org
   Target Milestone|---                         |4.8.0

--- Comment #8 from Jason Merrill <jason at gcc dot gnu.org> 2012-09-06 16:25:00 UTC ---
Fixed for 4.8.


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

* [Bug c++/54253] [C++11] constexpr constructor crashes with polymorphic base classes
  2012-08-14 14:15 [Bug c++/54253] New: [C++11] constexpr constructor crashes with polymorphic base classes mrks at koios dot de
                   ` (9 preceding siblings ...)
  2012-09-06 16:25 ` jason at gcc dot gnu.org
@ 2012-09-10 14:24 ` jason at gcc dot gnu.org
  2012-09-10 14:43 ` jason at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu.org @ 2012-09-10 14:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Jason Merrill <jason at gcc dot gnu.org> 2012-09-10 14:24:15 UTC ---
Author: jason
Date: Mon Sep 10 14:24:07 2012
New Revision: 191145

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=191145
Log:
    PR c++/54341
    PR c++/54253
    * semantics.c (sort_constexpr_mem_initializers): New.
    (build_constexpr_constructor_member_initializers): Use it.
    (cx_check_missing_mem_inits): Skip artificial fields.
    * init.c (expand_aggr_init_1): Don't zero out a class
    with no data.

Added:
    branches/gcc-4_7-branch/gcc/testsuite/g++.dg/cpp0x/constexpr-virtual2.C
    branches/gcc-4_7-branch/gcc/testsuite/g++.dg/cpp0x/constexpr-virtual3.C
Modified:
    branches/gcc-4_7-branch/gcc/cp/ChangeLog
    branches/gcc-4_7-branch/gcc/cp/init.c
    branches/gcc-4_7-branch/gcc/cp/semantics.c
    branches/gcc-4_7-branch/gcc/testsuite/ChangeLog


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

* [Bug c++/54253] [C++11] constexpr constructor crashes with polymorphic base classes
  2012-08-14 14:15 [Bug c++/54253] New: [C++11] constexpr constructor crashes with polymorphic base classes mrks at koios dot de
                   ` (10 preceding siblings ...)
  2012-09-10 14:24 ` jason at gcc dot gnu.org
@ 2012-09-10 14:43 ` jason at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu.org @ 2012-09-10 14:43 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|4.8.0                       |4.7.2

--- Comment #9 from Jason Merrill <jason at gcc dot gnu.org> 2012-09-10 14:24:15 UTC ---
Author: jason
Date: Mon Sep 10 14:24:07 2012
New Revision: 191145

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=191145
Log:
    PR c++/54341
    PR c++/54253
    * semantics.c (sort_constexpr_mem_initializers): New.
    (build_constexpr_constructor_member_initializers): Use it.
    (cx_check_missing_mem_inits): Skip artificial fields.
    * init.c (expand_aggr_init_1): Don't zero out a class
    with no data.

Added:
    branches/gcc-4_7-branch/gcc/testsuite/g++.dg/cpp0x/constexpr-virtual2.C
    branches/gcc-4_7-branch/gcc/testsuite/g++.dg/cpp0x/constexpr-virtual3.C
Modified:
    branches/gcc-4_7-branch/gcc/cp/ChangeLog
    branches/gcc-4_7-branch/gcc/cp/init.c
    branches/gcc-4_7-branch/gcc/cp/semantics.c
    branches/gcc-4_7-branch/gcc/testsuite/ChangeLog

--- Comment #10 from Jason Merrill <jason at gcc dot gnu.org> 2012-09-10 14:43:06 UTC ---
And for 4.7.2.


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

end of thread, other threads:[~2012-09-10 14:43 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-14 14:15 [Bug c++/54253] New: [C++11] constexpr constructor crashes with polymorphic base classes mrks at koios dot de
2012-08-14 14:20 ` [Bug c++/54253] " paolo.carlini at oracle dot com
2012-08-14 14:34 ` paolo.carlini at oracle dot com
2012-08-14 14:45 ` mrks at koios dot de
2012-08-14 14:48 ` paolo.carlini at oracle dot com
2012-08-14 14:49 ` mrks at koios dot de
2012-08-14 14:51 ` mrks at koios dot de
2012-08-21 11:54 ` paolo.carlini at oracle dot com
2012-09-06 16:24 ` jason at gcc dot gnu.org
2012-09-06 16:25 ` jason at gcc dot gnu.org
2012-09-06 16:25 ` jason at gcc dot gnu.org
2012-09-10 14:24 ` jason at gcc dot gnu.org
2012-09-10 14:43 ` 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).