public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58725] New: g++ segfault with non-static member initializer in a nested struct
@ 2013-10-14 15:23 lhyatt at gmail dot com
  2013-10-14 15:24 ` [Bug c++/58725] " lhyatt at gmail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: lhyatt at gmail dot com @ 2013-10-14 15:23 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58725
           Summary: g++ segfault with non-static member initializer in a
                    nested struct
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lhyatt at gmail dot com

The short code below that involves a non-static member initializer in a class
nested in a template class nested in another class causes g++ to segfault.
Seems to require this particular combination of features. It crashes with or
without -std=c++11. (Without -std=c++11 it notes the error, but then crashes
after.) and independent of optimization level. Output below is with -std=c++11.

t.cpp
-----
struct A { //only happens if B is wrapped in another struct
    template<int=0> //only happens if B is a template
    struct B {
        struct C {
            int x = 0;
            double y = x; //this line must be present to produce the problem
        } c; //only happens if B contains a C object
    };
};
int main() {
    A::B<>();
}
------

$ g++ -v -save-temps -std=c++11 t.cpp
Using built-in specs.
COLLECT_GCC=/usr/local/gcc48/bin/g++
COLLECT_LTO_WRAPPER=/usr/local/gcc-4.8.1/libexec/gcc/x86_64-unknown-linux-gnu/4.8.1/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ./configure --enable-threads=posix --enable-__cxa_atexit
--prefix=/usr/local/gcc-4.8.1
Thread model: posix
gcc version 4.8.1 (GCC)
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++11' '-shared-libgcc'
'-mtune=generic' '-march=x86-64'
 /usr/local/gcc-4.8.1/libexec/gcc/x86_64-unknown-linux-gnu/4.8.1/cc1plus -E
-quiet -v -D_GNU_SOURCE t.cpp -mtune=generic -march=x86-64 -std=c++11
-fpch-preprocess -o t.ii
ignoring nonexistent directory
"/usr/local/gcc-4.8.1/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../x86_64-unknown-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:

/usr/local/gcc-4.8.1/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../include/c++/4.8.1

/usr/local/gcc-4.8.1/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../include/c++/4.8.1/x86_64-unknown-linux-gnu

/usr/local/gcc-4.8.1/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../include/c++/4.8.1/backward
 /usr/local/gcc-4.8.1/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/include
 /usr/local/include
 /usr/local/gcc-4.8.1/include
 /usr/local/gcc-4.8.1/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/include-fixed
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++11' '-shared-libgcc'
'-mtune=generic' '-march=x86-64'
 /usr/local/gcc-4.8.1/libexec/gcc/x86_64-unknown-linux-gnu/4.8.1/cc1plus
-fpreprocessed t.ii -quiet -dumpbase t.cpp -mtune=generic -march=x86-64
-auxbase t -std=c++11 -version -o t.s
GNU C++ (GCC) version 4.8.1 (x86_64-unknown-linux-gnu)
    compiled by GNU C version 4.8.1, GMP version 4.3.2, MPFR version 2.4.2-p1,
MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++ (GCC) version 4.8.1 (x86_64-unknown-linux-gnu)
    compiled by GNU C version 4.8.1, GMP version 4.3.2, MPFR version 2.4.2-p1,
MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 9381368e685e312c931bb6a2db2d568c
t.cpp: In constructor 'constexpr A::B<>::C::C()':
t.cpp:4:16: internal compiler error: Segmentation fault
         struct C {
                ^
0x89ffef crash_signal
    ../.././gcc/toplev.c:332
0x7276e5 size_binop_loc(unsigned int, tree_code, tree_node*, tree_node*)
    ../.././gcc/fold-const.c:1431
0x765476 gimplify_compound_lval
    ../.././gcc/gimplify.c:2267
0x761ad4 gimplify_expr(tree_node**, gimple_statement_d**, gimple_statement_d**,
bool (*)(tree_node*), int)
    ../.././gcc/gimplify.c:7145
0x7631c6 gimplify_expr(tree_node**, gimple_statement_d**, gimple_statement_d**,
bool (*)(tree_node*), int)
    ../.././gcc/gimplify.c:7804
0x76774f gimplify_modify_expr
    ../.././gcc/gimplify.c:4902
0x761fc9 gimplify_expr(tree_node**, gimple_statement_d**, gimple_statement_d**,
bool (*)(tree_node*), int)
    ../.././gcc/gimplify.c:7193
0x763da6 gimplify_stmt(tree_node**, gimple_statement_d**)
    ../.././gcc/gimplify.c:5725
0x76181d gimplify_cleanup_point_expr
    ../.././gcc/gimplify.c:5501
0x76181d gimplify_expr(tree_node**, gimple_statement_d**, gimple_statement_d**,
bool (*)(tree_node*), int)
    ../.././gcc/gimplify.c:7530
0x763da6 gimplify_stmt(tree_node**, gimple_statement_d**)
    ../.././gcc/gimplify.c:5725
0x761bdb gimplify_statement_list
    ../.././gcc/gimplify.c:1561
0x761bdb gimplify_expr(tree_node**, gimple_statement_d**, gimple_statement_d**,
bool (*)(tree_node*), int)
    ../.././gcc/gimplify.c:7582
0x763da6 gimplify_stmt(tree_node**, gimple_statement_d**)
    ../.././gcc/gimplify.c:5725
0x764472 gimplify_bind_expr
    ../.././gcc/gimplify.c:1253
0x761a6a gimplify_expr(tree_node**, gimple_statement_d**, gimple_statement_d**,
bool (*)(tree_node*), int)
    ../.././gcc/gimplify.c:7364
0x763da6 gimplify_stmt(tree_node**, gimple_statement_d**)
    ../.././gcc/gimplify.c:5725
0x76983d gimplify_body(tree_node*, bool)
    ../.././gcc/gimplify.c:8226
0x769a57 gimplify_function_tree(tree_node*)
    ../.././gcc/gimplify.c:8358
0x66e82f cgraph_analyze_function
    ../.././gcc/cgraphunit.c:658
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.


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

* [Bug c++/58725] g++ segfault with non-static member initializer in a nested struct
  2013-10-14 15:23 [Bug c++/58725] New: g++ segfault with non-static member initializer in a nested struct lhyatt at gmail dot com
@ 2013-10-14 15:24 ` lhyatt at gmail dot com
  2013-10-14 15:25 ` lhyatt at gmail dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: lhyatt at gmail dot com @ 2013-10-14 15:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Lewis Hyatt <lhyatt at gmail dot com> ---
Created attachment 31001
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31001&action=edit
pre-processed source


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

* [Bug c++/58725] g++ segfault with non-static member initializer in a nested struct
  2013-10-14 15:23 [Bug c++/58725] New: g++ segfault with non-static member initializer in a nested struct lhyatt at gmail dot com
  2013-10-14 15:24 ` [Bug c++/58725] " lhyatt at gmail dot com
@ 2013-10-14 15:25 ` lhyatt at gmail dot com
  2013-10-14 15:58 ` paolo.carlini at oracle dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: lhyatt at gmail dot com @ 2013-10-14 15:25 UTC (permalink / raw)
  To: gcc-bugs

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

Lewis Hyatt <lhyatt at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|major                       |normal


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

* [Bug c++/58725] g++ segfault with non-static member initializer in a nested struct
  2013-10-14 15:23 [Bug c++/58725] New: g++ segfault with non-static member initializer in a nested struct lhyatt at gmail dot com
  2013-10-14 15:24 ` [Bug c++/58725] " lhyatt at gmail dot com
  2013-10-14 15:25 ` lhyatt at gmail dot com
@ 2013-10-14 15:58 ` paolo.carlini at oracle dot com
  2013-11-15 23:33 ` [Bug c++/58725] " paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-10-14 15:58 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-10-14
                 CC|lhyatt at gmail dot com            |
     Ever confirmed|0                           |1

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Confirmed. Mainline ICEs in a similar way if FLOAT_EXPR is handled in
tsubst_copy.


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

* [Bug c++/58725] segfault with non-static member initializer in a nested struct
  2013-10-14 15:23 [Bug c++/58725] New: g++ segfault with non-static member initializer in a nested struct lhyatt at gmail dot com
                   ` (2 preceding siblings ...)
  2013-10-14 15:58 ` paolo.carlini at oracle dot com
@ 2013-11-15 23:33 ` paolo.carlini at oracle dot com
  2013-11-15 23:52 ` paolo at gcc dot gnu.org
  2013-11-15 23:57 ` paolo.carlini at oracle dot com
  5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-11-15 23:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Fixed in mainline. I'm adding the testcase and closing the bug.


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

* [Bug c++/58725] segfault with non-static member initializer in a nested struct
  2013-10-14 15:23 [Bug c++/58725] New: g++ segfault with non-static member initializer in a nested struct lhyatt at gmail dot com
                   ` (3 preceding siblings ...)
  2013-11-15 23:33 ` [Bug c++/58725] " paolo.carlini at oracle dot com
@ 2013-11-15 23:52 ` paolo at gcc dot gnu.org
  2013-11-15 23:57 ` paolo.carlini at oracle dot com
  5 siblings, 0 replies; 7+ messages in thread
From: paolo at gcc dot gnu.org @ 2013-11-15 23:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Fri Nov 15 23:51:23 2013
New Revision: 204881

URL: http://gcc.gnu.org/viewcvs?rev=204881&root=gcc&view=rev
Log:
2013-11-15  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/58188
    * g++.dg/cpp0x/nsdmi-template8.C: New.

2013-11-15  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/58725
    * g++.dg/cpp0x/nsdmi-template7.C: New.

2013-11-15  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/58829
    * g++.dg/cpp0x/nsdmi-template6.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/nsdmi-template6.C
    trunk/gcc/testsuite/g++.dg/cpp0x/nsdmi-template7.C
    trunk/gcc/testsuite/g++.dg/cpp0x/nsdmi-template8.C
Modified:
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/58725] segfault with non-static member initializer in a nested struct
  2013-10-14 15:23 [Bug c++/58725] New: g++ segfault with non-static member initializer in a nested struct lhyatt at gmail dot com
                   ` (4 preceding siblings ...)
  2013-11-15 23:52 ` paolo at gcc dot gnu.org
@ 2013-11-15 23:57 ` paolo.carlini at oracle dot com
  5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-11-15 23:57 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Done.


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

end of thread, other threads:[~2013-11-15 23:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-14 15:23 [Bug c++/58725] New: g++ segfault with non-static member initializer in a nested struct lhyatt at gmail dot com
2013-10-14 15:24 ` [Bug c++/58725] " lhyatt at gmail dot com
2013-10-14 15:25 ` lhyatt at gmail dot com
2013-10-14 15:58 ` paolo.carlini at oracle dot com
2013-11-15 23:33 ` [Bug c++/58725] " paolo.carlini at oracle dot com
2013-11-15 23:52 ` paolo at gcc dot gnu.org
2013-11-15 23:57 ` paolo.carlini at oracle dot com

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