Created attachment 22840 [details] main.ii file This simple program #include<iostream> int main() {} gives internal compiler error, wenn compiled with options -std=c++0x -fno-elide-constructors (original program drastically reduced in order to concentrate on the error) Compiler version: g++ (GCC) 4.6.0 20101218 (experimental) Suse Linux System, Kernel: Linux 2.6.31.14-0.4-desktop i686 No special options when building the compiler (built with g++ (SUSE Linux) 4.4.1 [gcc-4_4-branch revision 150839]) complete command that triggers the error: /usr/local/gcc46/bin/g++ -v -save-temps -std=c++0x -fno-elide-constructors main.cpp compiler output of usr/local/gcc46/bin/g++ -v -save-temps -std=c++0x -fno-elide-constructors main.cpp is ***************************************************+ Es werden eingebaute Spezifikationen verwendet. COLLECT_GCC=/usr/local/gcc46/bin/g++ COLLECT_LTO_WRAPPER=/usr/local/gcc46/libexec/gcc/i686-pc-linux-gnu/4.6.0/lto-wrapper Ziel: i686-pc-linux-gnu Konfiguriert mit: ./configure --prefix=/usr/local/gcc46 Thread-Modell: posix gcc-Version 4.6.0 20101218 (experimental) (GCC) COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++0x' '-fno-elide-constructors' '-shared-libgcc' '-mtune=generic' '-march=pentiumpro' /usr/local/gcc46/libexec/gcc/i686-pc-linux-gnu/4.6.0/cc1plus -E -quiet -v -D_GNU_SOURCE main.cpp -mtune=generic -march=pentiumpro -std=c++0x -fno-elide-constructors -fpch-preprocess -o main.ii nicht vorhandenes Verzeichnis »/usr/local/gcc46/lib/gcc/i686-pc-linux-gnu/4.6.0/../../../../i686-pc-linux-gnu/include« wird ignoriert #include "..." - Suche beginnt hier: #include <...> - Suche beginnt hier: /usr/local/gcc46/lib/gcc/i686-pc-linux-gnu/4.6.0/../../../../include/c++/4.6.0 /usr/local/gcc46/lib/gcc/i686-pc-linux-gnu/4.6.0/../../../../include/c++/4.6.0/i686-pc-linux-gnu /usr/local/gcc46/lib/gcc/i686-pc-linux-gnu/4.6.0/../../../../include/c++/4.6.0/backward /usr/local/gcc46/lib/gcc/i686-pc-linux-gnu/4.6.0/include /usr/local/include /usr/local/gcc46/include /usr/local/gcc46/lib/gcc/i686-pc-linux-gnu/4.6.0/include-fixed /usr/include Ende der Suchliste. COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++0x' '-fno-elide-constructors' '-shared-libgcc' '-mtune=generic' '-march=pentiumpro' /usr/local/gcc46/libexec/gcc/i686-pc-linux-gnu/4.6.0/cc1plus -fpreprocessed main.ii -quiet -dumpbase main.cpp -mtune=generic -march=pentiumpro -auxbase main -std=c++0x -version -fno-elide-constructors -o main.s GNU C++ (GCC) Version 4.6.0 20101218 (experimental) (i686-pc-linux-gnu) kompiliert von GNU-C-Version 4.6.0 20101218 (experimental), GMP-Version 4.3.1, MPFR-Version 2.4.1-p5, MPC-Version 0.8.2. GGC-Heuristik: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 GNU C++ (GCC) Version 4.6.0 20101218 (experimental) (i686-pc-linux-gnu) kompiliert von GNU-C-Version 4.6.0 20101218 (experimental), GMP-Version 4.3.1, MPFR-Version 2.4.1-p5, MPC-Version 0.8.2. GGC-Heuristik: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 Compiler executable checksum: a7a8062331528f92f191beca128c8e4c In file included from /usr/local/gcc46/lib/gcc/i686-pc-linux-gnu/4.6.0/../../../../include/c++/4.6.0/cstdlib:67:0, from /usr/local/gcc46/lib/gcc/i686-pc-linux-gnu/4.6.0/../../../../include/c++/4.6.0/ext/string_conversions.h:33, from /usr/local/gcc46/lib/gcc/i686-pc-linux-gnu/4.6.0/../../../../include/c++/4.6.0/bits/basic_string.h:2747, from /usr/local/gcc46/lib/gcc/i686-pc-linux-gnu/4.6.0/../../../../include/c++/4.6.0/string:53, from /usr/local/gcc46/lib/gcc/i686-pc-linux-gnu/4.6.0/../../../../include/c++/4.6.0/bits/locale_classes.h:42, from /usr/local/gcc46/lib/gcc/i686-pc-linux-gnu/4.6.0/../../../../include/c++/4.6.0/bits/ios_base.h:43, from /usr/local/gcc46/lib/gcc/i686-pc-linux-gnu/4.6.0/../../../../include/c++/4.6.0/ios:43, from /usr/local/gcc46/lib/gcc/i686-pc-linux-gnu/4.6.0/../../../../include/c++/4.6.0/ostream:40, from /usr/local/gcc46/lib/gcc/i686-pc-linux-gnu/4.6.0/../../../../include/c++/4.6.0/iostream:40, from main.cpp:1: /usr/include/stdlib.h: In constructor »constexpr ldiv_t::ldiv_t(ldiv_t&&)«: /usr/include/stdlib.h:110:5: interner Compiler-Fehler: in build_data_member_initialization, bei cp/semantics.c:5483 Bitte senden Sie einen vollständigen Fehlerbericht auf Englisch ein; bearbeiten Sie die Quellen zunächst mit einem Präprozessor, wenn es dienlich ist. Fehler in der deutschen Übersetzung sind an translation-team-de@lists.sourceforge.net zu melden. Gehen Sie gemäß den Hinweisen in <http://gcc.gnu.org/bugs.html> vor. **************** end of compiler output *********** attached is main.ii greetings alfons
Created attachment 22915 [details] reduced testcase Probably the same issue. $ gcc -fno-elide-constructors -std=c++0x pr47041.C pr47041.C: In constructor 'constexpr S::S(S&&)': pr47041.C:1:8: internal compiler error: in build_data_member_initialization, at cp/semantics.c:5498 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. (gdb) bt #0 fancy_abort (file=0x1224370 "/usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/semantics.c", line=5498, function=0x12276a0 "build_data_member_initialization") at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/diagnostic.c:892 #1 0x0000000000641dfe in build_data_member_initialization (t=<value optimized out>, vec=0x7fffffffcfc8) at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/semantics.c:5498 #2 0x000000000064249a in build_constexpr_constructor_member_initializers (fun=0x7ffff5cce700, body=<value optimized out>) at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/semantics.c:5570 #3 register_constexpr_fundef (fun=0x7ffff5cce700, body=<value optimized out>) at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/semantics.c:5602 #4 0x0000000000530967 in maybe_save_function_definition (flags=0) at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/decl.c:12808 #5 finish_function (flags=0) at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/decl.c:12927 #6 0x00000000006238db in synthesize_method (fndecl=0x7ffff5cce700) at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/method.c:759 #7 0x00000000005b5ae3 in mark_used (decl=0x7ffff5cdf000) at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/decl2.c:4272 #8 0x000000000050fd2e in build_over_call (cand=0x1940100, flags=11, complain=3) at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/call.c:6339 #9 0x000000000050ce6d in build_new_method_call (instance=0x7ffff7ec8930, fns=0x7ffff5cd9800, args=<value optimized out>, conversion_path=<value optimized out>, flags=11, fn_p=0x0, complain=3) at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/call.c:6916 #10 0x000000000050dd64 in build_special_member_call (instance=0x7ffff7ec8930, name=<value optimized out>, args=0x7fffffffd378, binfo=0x7ffff5cd64e0, flags=11, complain=3) at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/call.c:6608 #11 0x000000000060cef3 in ocp_convert (type=0x7ffff5ccd540, expr=0x7ffff5cc7630, convtype=0, flags=11) at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/cvt.c:807 #12 0x00000000006007aa in check_return_expr (retval=<value optimized out>, no_warning=0x7fffffffd43f "") at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/typeck.c:7775 #13 0x000000000062e58f in finish_return_stmt (expr=<value optimized out>) at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/semantics.c:800 #14 0x00000000005ce3d2 in cp_parser_jump_statement (parser=0x7ffff5cdc108, in_statement_expr=0x0, in_compound=1 '\001', if_p=<value optimized out>) at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/parser.c:9194 #15 cp_parser_statement (parser=0x7ffff5cdc108, in_statement_expr=0x0, in_compound=1 '\001', if_p=<value optimized out>) at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/parser.c:8080 #16 0x00000000005ced46 in cp_parser_statement_seq_opt (parser=0x7ffff5cdc108, in_statement_expr=0x0) at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/parser.c:8414 #17 0x00000000005cee7c in cp_parser_compound_statement (parser=0x7ffff5cdc108, in_statement_expr=0x0, in_try=<value optimized out>) at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/parser.c:8368 #18 0x00000000005e28dc in cp_parser_function_body (parser=0x7ffff5cdc108) at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/parser.c:16371 #19 cp_parser_ctor_initializer_opt_and_function_body (parser=0x7ffff5cdc108) at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/parser.c:16408 #20 0x00000000005e3052 in cp_parser_function_definition_after_declarator (parser=0x7ffff5cdc108, inline_p=0 '\000') at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/parser.c:19814 #21 0x00000000005e465c in cp_parser_function_definition_from_specifiers_and_declarator (parser=0x7ffff5cdc108, decl_specifiers=0x7fffffffd740, checks=0x0, function_definition_allowed_p=1 '\001', member_p=0 '\000', declares_class_or_enum=0, function_definition_p=0x7fffffffd7af "\001\200\360\223\001") at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/parser.c:19743 #22 cp_parser_init_declarator (parser=0x7ffff5cdc108, decl_specifiers=0x7fffffffd740, checks=0x0, function_definition_allowed_p=1 '\001', member_p=0 '\000', declares_class_or_enum=0, function_definition_p=0x7fffffffd7af "\001\200\360\223\001") at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/parser.c:14518 #23 0x00000000005e987b in cp_parser_simple_declaration (parser=0x7ffff5cdc108, function_definition_allowed_p=1 '\001') at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/parser.c:9689 #24 0x00000000005e9be7 in cp_parser_block_declaration (parser=0x7ffff5cdc108, statement_p=0 '\000') at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/parser.c:9587 #25 cp_parser_block_declaration (parser=0x7ffff5cdc108, statement_p=0 '\000') at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/parser.c:9521 #26 0x00000000005ed8f2 in cp_parser_declaration (parser=0x7ffff5cdc108) at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/parser.c:9492 #27 cp_parser_declaration (parser=0x7ffff5cdc108) at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/parser.c:9399 #28 0x00000000005ec41a in cp_parser_declaration_seq_opt (parser=0x7ffff5cdc108) at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/parser.c:9378 #29 0x00000000005edf69 in cp_parser_translation_unit () at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/parser.c:3461 #30 c_parse_file () at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cp/parser.c:25214 #31 0x00000000006c2195 in c_common_parse_file () at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/c-family/c-opts.c:1071 #32 0x0000000000a24598 in compile_file (argc=15, argv=0x7fffffffda78) at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/toplev.c:579 #33 do_compile (argc=15, argv=0x7fffffffda78) at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/toplev.c:1874 #34 toplev_main (argc=15, argv=0x7fffffffda78) at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/toplev.c:1937 #35 0x00007ffff6586bbd in __libc_start_main () from /lib/libc.so.6 #36 0x00000000004fef2d in _start () Tested revisions: r168552 - crash r165699 - OK 4.5 r168062 - OK Probably regression from 4.5 (I can't edit the bug details).
Created attachment 22916 [details] even shorter testcase $ gcc -std=c++0x -fno-elide-constructors pr47041-2.C pr47041-2.C: In constructor 'constexpr S::S(S&&)': pr47041-2.C:1:8: internal compiler error: in build_data_member_initialization, at cp/semantics.c:5498 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions.
It is caused by revision 166297: http://gcc.gnu.org/ml/gcc-cvs/2010-11/msg00183.html
Looking.
Author: jason Date: Fri Jan 21 22:30:26 2011 New Revision: 169108 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=169108 Log: PR c++/47041 * semantics.c (build_constexpr_constructor_member_initializers): Handle trivial copy. Added: trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor6.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/semantics.c trunk/gcc/testsuite/ChangeLog
Fixed.
*** Bug 47206 has been marked as a duplicate of this bug. ***