public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/47388] New: [4.6 Regression] ICE: in begin_for_stmt, at cp/semantics.c:863 with -fno-for-scope and for(;;) inside a template
@ 2011-01-20 22:53 zsojka at seznam dot cz
  2011-01-21  5:34 ` [Bug c++/47388] " zsojka at seznam dot cz
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: zsojka at seznam dot cz @ 2011-01-20 22:53 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: [4.6 Regression] ICE: in begin_for_stmt, at
                    cp/semantics.c:863 with -fno-for-scope and for(;;)
                    inside a template
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: zsojka@seznam.cz


Created attachment 23054
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23054
reduced testcase

Compiler output:
$ gcc -fno-for-scope testcase.C
testcase.C: In function 'void foo()':
testcase.C:3:8: internal compiler error: in begin_for_stmt, at
cp/semantics.c:863
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=0x11f4eb0 "/mnt/svn/gcc-trunk/gcc/cp/semantics.c",
line=863, function=0x11f78a3 "begin_for_stmt")
    at /mnt/svn/gcc-trunk/gcc/diagnostic.c:892
#1  0x000000000062aa84 in begin_for_stmt (scope=0x0, init=0x7ffff5d76aa0) at
/mnt/svn/gcc-trunk/gcc/cp/semantics.c:863
#2  0x00000000005ca0f5 in cp_parser_c_for (parser=0x7ffff5d90f78,
in_statement_expr=0x0, in_compound=<value optimized out>, 
    if_p=<value optimized out>) at /mnt/svn/gcc-trunk/gcc/cp/parser.c:8728
#3  cp_parser_for (parser=0x7ffff5d90f78, in_statement_expr=0x0,
in_compound=<value optimized out>, 
    if_p=<value optimized out>) at /mnt/svn/gcc-trunk/gcc/cp/parser.c:8717
#4  cp_parser_iteration_statement (parser=0x7ffff5d90f78,
in_statement_expr=0x0, in_compound=<value optimized out>, 
    if_p=<value optimized out>) at /mnt/svn/gcc-trunk/gcc/cp/parser.c:9016
#5  cp_parser_statement (parser=0x7ffff5d90f78, in_statement_expr=0x0,
in_compound=<value optimized out>, 
    if_p=<value optimized out>) at /mnt/svn/gcc-trunk/gcc/cp/parser.c:8075
#6  0x00000000005cab66 in cp_parser_statement_seq_opt (parser=0x7ffff5d90f78,
in_statement_expr=0x0)
    at /mnt/svn/gcc-trunk/gcc/cp/parser.c:8416
#7  0x00000000005cac9c in cp_parser_compound_statement (parser=0x7ffff5d90f78,
in_statement_expr=0x0, 
    in_try=<value optimized out>) at /mnt/svn/gcc-trunk/gcc/cp/parser.c:8370
#8  0x00000000005de70c in cp_parser_function_body (parser=0x7ffff5d90f78) at
/mnt/svn/gcc-trunk/gcc/cp/parser.c:16399
#9  cp_parser_ctor_initializer_opt_and_function_body (parser=0x7ffff5d90f78) at
/mnt/svn/gcc-trunk/gcc/cp/parser.c:16436
#10 0x00000000005dee82 in cp_parser_function_definition_after_declarator
(parser=0x7ffff5d90f78, inline_p=0 '\000')
    at /mnt/svn/gcc-trunk/gcc/cp/parser.c:19842
#11 0x00000000005e04ce in
cp_parser_function_definition_from_specifiers_and_declarator
(parser=0x7ffff5d90f78, 
    decl_specifiers=0x7fffffffd7b0, checks=0x0, function_definition_allowed_p=1
'\001', member_p=0 '\000', 
    declares_class_or_enum=0, function_definition_p=0x7fffffffd81f
"\001x\017\331\365\377\177", maybe_range_for_decl=0x0)
    at /mnt/svn/gcc-trunk/gcc/cp/parser.c:19771
#12 cp_parser_init_declarator (parser=0x7ffff5d90f78,
decl_specifiers=0x7fffffffd7b0, checks=0x0, 
    function_definition_allowed_p=1 '\001', member_p=0 '\000',
declares_class_or_enum=0, 
    function_definition_p=0x7fffffffd81f "\001x\017\331\365\377\177",
maybe_range_for_decl=0x0)
    at /mnt/svn/gcc-trunk/gcc/cp/parser.c:14538
#13 0x00000000005e4c75 in cp_parser_single_declaration (parser=0x7ffff5d90f78,
checks=0x0, member_p=0 '\000', 
    explicit_specialization_p=0 '\000', friend_p=0x7fffffffd87f "") at
/mnt/svn/gcc-trunk/gcc/cp/parser.c:20096
#14 0x00000000005e4fd6 in cp_parser_template_declaration_after_export
(parser=0x7ffff5d90f78, member_p=0 '\000')
    at /mnt/svn/gcc-trunk/gcc/cp/parser.c:19946
#15 0x00000000005e9a3a in cp_parser_declaration (parser=0x7ffff5d90f78) at
/mnt/svn/gcc-trunk/gcc/cp/parser.c:9444
#16 cp_parser_declaration (parser=0x7ffff5d90f78) at
/mnt/svn/gcc-trunk/gcc/cp/parser.c:9395
#17 0x00000000005e833a in cp_parser_declaration_seq_opt (parser=0x7ffff5d90f78)
at /mnt/svn/gcc-trunk/gcc/cp/parser.c:9374
#18 0x00000000005e9e89 in cp_parser_translation_unit () at
/mnt/svn/gcc-trunk/gcc/cp/parser.c:3463
#19 c_parse_file () at /mnt/svn/gcc-trunk/gcc/cp/parser.c:25269
#20 0x00000000006be125 in c_common_parse_file () at
/mnt/svn/gcc-trunk/gcc/c-family/c-opts.c:1071
#21 0x0000000000a213e6 in compile_file (argc=14, argv=0x7fffffffdad8) at
/mnt/svn/gcc-trunk/gcc/toplev.c:579
#22 do_compile (argc=14, argv=0x7fffffffdad8) at
/mnt/svn/gcc-trunk/gcc/toplev.c:1874
#23 toplev_main (argc=14, argv=0x7fffffffdad8) at
/mnt/svn/gcc-trunk/gcc/toplev.c:1937
#24 0x00007ffff65f1bbd in __libc_start_main () from /lib/libc.so.6
#25 0x00000000004fa9d1 in _start ()


Tested revisions:
r169065 - crash
4.5 r168785 - OK


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

* [Bug c++/47388] [4.6 Regression] ICE: in begin_for_stmt, at cp/semantics.c:863 with -fno-for-scope and for(;;) inside a template
  2011-01-20 22:53 [Bug c++/47388] New: [4.6 Regression] ICE: in begin_for_stmt, at cp/semantics.c:863 with -fno-for-scope and for(;;) inside a template zsojka at seznam dot cz
@ 2011-01-21  5:34 ` zsojka at seznam dot cz
  2011-01-21 11:49 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: zsojka at seznam dot cz @ 2011-01-21  5:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Zdenek Sojka <zsojka at seznam dot cz> 2011-01-21 01:02:19 UTC ---
Created attachment 23057
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23057
range-for testcase

Probably the same problem.

$ gcc -fno-for-scope -std=c++0x testcase.C 
testcase.C: In function 'void foo(const T&)':
testcase.C:3:16: internal compiler error: in begin_range_for_stmt, at
cp/semantics.c:965
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=0x11f4eb0 "/mnt/svn/gcc-trunk/gcc/cp/semantics.c",
line=965, 
    function=0x11f7910 "begin_range_for_stmt") at
/mnt/svn/gcc-trunk/gcc/diagnostic.c:892
#1  0x000000000062b14b in begin_range_for_stmt (scope=0x0, init=0x7ffff5d2caa0)
at /mnt/svn/gcc-trunk/gcc/cp/semantics.c:965
#2  0x00000000005ca742 in cp_parser_range_for (parser=0x7ffff5d47108,
in_statement_expr=0x0, 
    in_compound=<value optimized out>, if_p=<value optimized out>) at
/mnt/svn/gcc-trunk/gcc/cp/parser.c:8775
#3  cp_parser_for (parser=0x7ffff5d47108, in_statement_expr=0x0,
in_compound=<value optimized out>, 
    if_p=<value optimized out>) at /mnt/svn/gcc-trunk/gcc/cp/parser.c:8715
#4  cp_parser_iteration_statement (parser=0x7ffff5d47108,
in_statement_expr=0x0, in_compound=<value optimized out>, 
    if_p=<value optimized out>) at /mnt/svn/gcc-trunk/gcc/cp/parser.c:9016
#5  cp_parser_statement (parser=0x7ffff5d47108, in_statement_expr=0x0,
in_compound=<value optimized out>, 
    if_p=<value optimized out>) at /mnt/svn/gcc-trunk/gcc/cp/parser.c:8075
#6  0x00000000005cab66 in cp_parser_statement_seq_opt (parser=0x7ffff5d47108,
in_statement_expr=0x0)
    at /mnt/svn/gcc-trunk/gcc/cp/parser.c:8416
#7  0x00000000005cac9c in cp_parser_compound_statement (parser=0x7ffff5d47108,
in_statement_expr=0x0, 
    in_try=<value optimized out>) at /mnt/svn/gcc-trunk/gcc/cp/parser.c:8370
#8  0x00000000005de70c in cp_parser_function_body (parser=0x7ffff5d47108) at
/mnt/svn/gcc-trunk/gcc/cp/parser.c:16399
#9  cp_parser_ctor_initializer_opt_and_function_body (parser=0x7ffff5d47108) at
/mnt/svn/gcc-trunk/gcc/cp/parser.c:16436
#10 0x00000000005dee82 in cp_parser_function_definition_after_declarator
(parser=0x7ffff5d47108, inline_p=0 '\000')
    at /mnt/svn/gcc-trunk/gcc/cp/parser.c:19842
#11 0x00000000005e04ce in
cp_parser_function_definition_from_specifiers_and_declarator
(parser=0x7ffff5d47108, 
    decl_specifiers=0x7fffffffd790, checks=0x0, function_definition_allowed_p=1
'\001', member_p=0 '\000', 
    declares_class_or_enum=0, function_definition_p=0x7fffffffd7ff
"\001\bq\324\365\377\177", maybe_range_for_decl=0x0)
    at /mnt/svn/gcc-trunk/gcc/cp/parser.c:19771
#12 cp_parser_init_declarator (parser=0x7ffff5d47108,
decl_specifiers=0x7fffffffd790, checks=0x0, 
    function_definition_allowed_p=1 '\001', member_p=0 '\000',
declares_class_or_enum=0, 
    function_definition_p=0x7fffffffd7ff "\001\bq\324\365\377\177",
maybe_range_for_decl=0x0)
    at /mnt/svn/gcc-trunk/gcc/cp/parser.c:14538
#13 0x00000000005e4c75 in cp_parser_single_declaration (parser=0x7ffff5d47108,
checks=0x0, member_p=0 '\000', 
    explicit_specialization_p=0 '\000', friend_p=0x7fffffffd85f "") at
/mnt/svn/gcc-trunk/gcc/cp/parser.c:20096
#14 0x00000000005e4fd6 in cp_parser_template_declaration_after_export
(parser=0x7ffff5d47108, member_p=0 '\000')
    at /mnt/svn/gcc-trunk/gcc/cp/parser.c:19946
#15 0x00000000005e9a3a in cp_parser_declaration (parser=0x7ffff5d47108) at
/mnt/svn/gcc-trunk/gcc/cp/parser.c:9444
#16 cp_parser_declaration (parser=0x7ffff5d47108) at
/mnt/svn/gcc-trunk/gcc/cp/parser.c:9395
#17 0x00000000005e833a in cp_parser_declaration_seq_opt (parser=0x7ffff5d47108)
at /mnt/svn/gcc-trunk/gcc/cp/parser.c:9374
#18 0x00000000005e9e89 in cp_parser_translation_unit () at
/mnt/svn/gcc-trunk/gcc/cp/parser.c:3463
#19 c_parse_file () at /mnt/svn/gcc-trunk/gcc/cp/parser.c:25269
#20 0x00000000006be125 in c_common_parse_file () at
/mnt/svn/gcc-trunk/gcc/c-family/c-opts.c:1071
#21 0x0000000000a213e6 in compile_file (argc=15, argv=0x7fffffffdab8) at
/mnt/svn/gcc-trunk/gcc/toplev.c:579
#22 do_compile (argc=15, argv=0x7fffffffdab8) at
/mnt/svn/gcc-trunk/gcc/toplev.c:1874
#23 toplev_main (argc=15, argv=0x7fffffffdab8) at
/mnt/svn/gcc-trunk/gcc/toplev.c:1937
#24 0x00007ffff65f1bbd in __libc_start_main () from /lib/libc.so.6
#25 0x00000000004fa9d1 in _start ()


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

* [Bug c++/47388] [4.6 Regression] ICE: in begin_for_stmt, at cp/semantics.c:863 with -fno-for-scope and for(;;) inside a template
  2011-01-20 22:53 [Bug c++/47388] New: [4.6 Regression] ICE: in begin_for_stmt, at cp/semantics.c:863 with -fno-for-scope and for(;;) inside a template zsojka at seznam dot cz
  2011-01-21  5:34 ` [Bug c++/47388] " zsojka at seznam dot cz
@ 2011-01-21 11:49 ` rguenth at gcc dot gnu.org
  2011-01-21 16:41 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-01-21 11:49 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1
   Target Milestone|---                         |4.6.0


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

* [Bug c++/47388] [4.6 Regression] ICE: in begin_for_stmt, at cp/semantics.c:863 with -fno-for-scope and for(;;) inside a template
  2011-01-20 22:53 [Bug c++/47388] New: [4.6 Regression] ICE: in begin_for_stmt, at cp/semantics.c:863 with -fno-for-scope and for(;;) inside a template zsojka at seznam dot cz
  2011-01-21  5:34 ` [Bug c++/47388] " zsojka at seznam dot cz
  2011-01-21 11:49 ` rguenth at gcc dot gnu.org
@ 2011-01-21 16:41 ` jakub at gcc dot gnu.org
  2011-01-21 17:29 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-01-21 16:41 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.01.21 16:22:26
                 CC|                            |jason at gcc dot gnu.org
     Ever Confirmed|0                           |1

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-01-21 16:22:26 UTC ---
Caused by r168731.


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

* [Bug c++/47388] [4.6 Regression] ICE: in begin_for_stmt, at cp/semantics.c:863 with -fno-for-scope and for(;;) inside a template
  2011-01-20 22:53 [Bug c++/47388] New: [4.6 Regression] ICE: in begin_for_stmt, at cp/semantics.c:863 with -fno-for-scope and for(;;) inside a template zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2011-01-21 16:41 ` jakub at gcc dot gnu.org
@ 2011-01-21 17:29 ` jakub at gcc dot gnu.org
  2011-01-21 22:13 ` jakub at gcc dot gnu.org
  2011-01-21 22:23 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-01-21 17:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-01-21 17:15:52 UTC ---
Created attachment 23065
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23065
gcc46-pr47388.patch

Untested fix.


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

* [Bug c++/47388] [4.6 Regression] ICE: in begin_for_stmt, at cp/semantics.c:863 with -fno-for-scope and for(;;) inside a template
  2011-01-20 22:53 [Bug c++/47388] New: [4.6 Regression] ICE: in begin_for_stmt, at cp/semantics.c:863 with -fno-for-scope and for(;;) inside a template zsojka at seznam dot cz
                   ` (3 preceding siblings ...)
  2011-01-21 17:29 ` jakub at gcc dot gnu.org
@ 2011-01-21 22:13 ` jakub at gcc dot gnu.org
  2011-01-21 22:23 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-01-21 22:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-01-21 21:34:29 UTC ---
Author: jakub
Date: Fri Jan 21 21:34:25 2011
New Revision: 169105

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=169105
Log:
    PR c++/47388
    * semantics.c (begin_for_stmt): If -fno-for-scope, don't
    assume init must be NULL if scope is NULL.
    (begin_range_for_stmt): Likewise.

    * g++.dg/cpp0x/range-for10.C: New test.
    * g++.dg/template/for1.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/range-for10.C
    trunk/gcc/testsuite/g++.dg/template/for1.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/semantics.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/47388] [4.6 Regression] ICE: in begin_for_stmt, at cp/semantics.c:863 with -fno-for-scope and for(;;) inside a template
  2011-01-20 22:53 [Bug c++/47388] New: [4.6 Regression] ICE: in begin_for_stmt, at cp/semantics.c:863 with -fno-for-scope and for(;;) inside a template zsojka at seznam dot cz
                   ` (4 preceding siblings ...)
  2011-01-21 22:13 ` jakub at gcc dot gnu.org
@ 2011-01-21 22:23 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-01-21 22:23 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |jakub at gcc dot gnu.org
         Resolution|                            |FIXED
         AssignedTo|unassigned at gcc dot       |jakub at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-01-21 21:36:07 UTC ---
Fixed.


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

end of thread, other threads:[~2011-01-21 21:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-20 22:53 [Bug c++/47388] New: [4.6 Regression] ICE: in begin_for_stmt, at cp/semantics.c:863 with -fno-for-scope and for(;;) inside a template zsojka at seznam dot cz
2011-01-21  5:34 ` [Bug c++/47388] " zsojka at seznam dot cz
2011-01-21 11:49 ` rguenth at gcc dot gnu.org
2011-01-21 16:41 ` jakub at gcc dot gnu.org
2011-01-21 17:29 ` jakub at gcc dot gnu.org
2011-01-21 22:13 ` jakub at gcc dot gnu.org
2011-01-21 22:23 ` jakub 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).