public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/60211] New: ICE with #pragma GCC ivdep and for-loop on global scope
@ 2014-02-15 12:11 reichelt at gcc dot gnu.org
  2014-12-29  9:32 ` [Bug c++/60211] [4.9/5 Regression] " paolo.carlini at oracle dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: reichelt at gcc dot gnu.org @ 2014-02-15 12:11 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 60211
           Summary: ICE with #pragma GCC ivdep and for-loop on global
                    scope
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: reichelt at gcc dot gnu.org

The following invalid code snippet triggers an ICE on trunk:

=================================
void foo()
{}
  int i;
#pragma GCC ivdep
  for (i = 0; i < 2; ++i)
    ;
}
=================================

bug.cc:6:5: internal compiler error: in add_stmt, at cp/semantics.c:391
     ;
     ^
0x7268a8 add_stmt(tree_node*)
        ../../gcc/gcc/cp/semantics.c:391
0x6d0457 cp_parser_iteration_statement
        ../../gcc/gcc/cp/parser.c:10516
0x6a7600 cp_parser_pragma
        ../../gcc/gcc/cp/parser.c:31461
0x6d2c51 cp_parser_declaration_seq_opt
        ../../gcc/gcc/cp/parser.c:10864
0x6d44ba cp_parser_translation_unit
        ../../gcc/gcc/cp/parser.c:4014
0x6d44ba c_parse_file()
        ../../gcc/gcc/cp/parser.c:31536
0x7f3823 c_common_parse_file()
        ../../gcc/gcc/c-family/c-opts.c:1060
Please submit a full bug report, [etc.]


Declaring the variable within the for-loop produces a different stack trace:

=================================
void foo()
{}
#pragma GCC ivdep
  for (int i = 0; i < 2; ++i)
    ;
}
=================================

bug.cc:4:12: internal compiler error: tree check: expected tree that contains
'decl with visibility' structure, have 'parm_decl' in start_decl, at
cp/decl.c:4572
   for (int i = 0; i < 2; ++i)
            ^
0xdc0f24 tree_contains_struct_check_failed(tree_node const*,
tree_node_structure_enum, char const*, int, char const*)
        ../../gcc/gcc/tree.c:9364
0x5ee658 contains_struct_check
        ../../gcc/gcc/tree.h:2823
0x5ee658 start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,
tree_node*, tree_node*, tree_node**)
        ../../gcc/gcc/cp/decl.c:4572
0x6c7efe cp_parser_init_declarator
        ../../gcc/gcc/cp/parser.c:16680
0x6c9989 cp_parser_simple_declaration
        ../../gcc/gcc/cp/parser.c:11205
0x6d02bd cp_parser_for_init_statement
        ../../gcc/gcc/cp/parser.c:10558
0x6d02bd cp_parser_for
        ../../gcc/gcc/cp/parser.c:10038
0x6d02bd cp_parser_iteration_statement
        ../../gcc/gcc/cp/parser.c:10505
0x6a7600 cp_parser_pragma
        ../../gcc/gcc/cp/parser.c:31461
0x6d2c51 cp_parser_declaration_seq_opt
        ../../gcc/gcc/cp/parser.c:10864
0x6d44ba cp_parser_translation_unit
        ../../gcc/gcc/cp/parser.c:4014
0x6d44ba c_parse_file()
        ../../gcc/gcc/cp/parser.c:31536
0x7f3823 c_common_parse_file()
        ../../gcc/gcc/c-family/c-opts.c:1060
Please submit a full bug report, [etc.]


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

* [Bug c++/60211] [4.9/5 Regression] ICE with #pragma GCC ivdep and for-loop on global scope
  2014-02-15 12:11 [Bug c++/60211] New: ICE with #pragma GCC ivdep and for-loop on global scope reichelt at gcc dot gnu.org
@ 2014-12-29  9:32 ` paolo.carlini at oracle dot com
  2015-01-09 11:29 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-12-29  9:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60211

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-12-29
            Summary|ICE with #pragma GCC ivdep  |[4.9/5 Regression] ICE with
                   |and for-loop on global      |#pragma GCC ivdep and
                   |scope                       |for-loop on global scope
     Ever confirmed|0                           |1


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

* [Bug c++/60211] [4.9/5 Regression] ICE with #pragma GCC ivdep and for-loop on global scope
  2014-02-15 12:11 [Bug c++/60211] New: ICE with #pragma GCC ivdep and for-loop on global scope reichelt at gcc dot gnu.org
  2014-12-29  9:32 ` [Bug c++/60211] [4.9/5 Regression] " paolo.carlini at oracle dot com
@ 2015-01-09 11:29 ` rguenth at gcc dot gnu.org
  2015-01-21 18:48 ` paolo.carlini at oracle dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-01-09 11:29 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60211

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.9.3


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

* [Bug c++/60211] [4.9/5 Regression] ICE with #pragma GCC ivdep and for-loop on global scope
  2014-02-15 12:11 [Bug c++/60211] New: ICE with #pragma GCC ivdep and for-loop on global scope reichelt at gcc dot gnu.org
  2014-12-29  9:32 ` [Bug c++/60211] [4.9/5 Regression] " paolo.carlini at oracle dot com
  2015-01-09 11:29 ` rguenth at gcc dot gnu.org
@ 2015-01-21 18:48 ` paolo.carlini at oracle dot com
  2015-02-13 14:44 ` jason at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2015-01-21 18:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60211

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |paolo.carlini at oracle dot com

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> ---
This is strictly speaking a regression that would be easy to fix in
cp_parser_pragma. I wonder, however, if we want to handle the pragma as, eg,
PRAGMA_CILK_SIMD, thus explicitly reject the pragma itself when context ==
pragma_external, or we want to eseentially ignore it in that case, thus do not
call cp_parser_iteration_statement and return. Or something else?!?


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

* [Bug c++/60211] [4.9/5 Regression] ICE with #pragma GCC ivdep and for-loop on global scope
  2014-02-15 12:11 [Bug c++/60211] New: ICE with #pragma GCC ivdep and for-loop on global scope reichelt at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2015-01-21 18:48 ` paolo.carlini at oracle dot com
@ 2015-02-13 14:44 ` jason at gcc dot gnu.org
  2015-02-13 17:57 ` paolo at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2015-02-13 14:44 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60211

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

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

--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> ---
(In reply to Paolo Carlini from comment #1)
> This is strictly speaking a regression that would be easy to fix in
> cp_parser_pragma. I wonder, however, if we want to handle the pragma as, eg,
> PRAGMA_CILK_SIMD, thus explicitly reject the pragma itself when context ==
> pragma_external

Sounds good to me.


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

* [Bug c++/60211] [4.9/5 Regression] ICE with #pragma GCC ivdep and for-loop on global scope
  2014-02-15 12:11 [Bug c++/60211] New: ICE with #pragma GCC ivdep and for-loop on global scope reichelt at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2015-02-13 14:44 ` jason at gcc dot gnu.org
@ 2015-02-13 17:57 ` paolo at gcc dot gnu.org
  2015-02-13 17:59 ` [Bug c++/60211] [4.9 " paolo.carlini at oracle dot com
  2015-02-13 19:13 ` jason at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: paolo at gcc dot gnu.org @ 2015-02-13 17:57 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60211

--- Comment #3 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Fri Feb 13 17:57:13 2015
New Revision: 220689

URL: https://gcc.gnu.org/viewcvs?rev=220689&root=gcc&view=rev
Log:
/cp
2015-02-13  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/60211
    * parser.c (cp_parser_pragma): Diagnose PRAGMA_IVDEP at
    pragma_external context.

/testsuite
2015-02-13  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/60211
    * g++.dg/parse/ivdep-2.C: New.
    * g++.dg/parse/ivdep-3.C: Likewise.

Added:
    trunk/gcc/testsuite/g++.dg/parse/ivdep-2.C
    trunk/gcc/testsuite/g++.dg/parse/ivdep-3.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/parser.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/60211] [4.9 Regression] ICE with #pragma GCC ivdep and for-loop on global scope
  2014-02-15 12:11 [Bug c++/60211] New: ICE with #pragma GCC ivdep and for-loop on global scope reichelt at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2015-02-13 17:57 ` paolo at gcc dot gnu.org
@ 2015-02-13 17:59 ` paolo.carlini at oracle dot com
  2015-02-13 19:13 ` jason at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2015-02-13 17:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60211

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|paolo.carlini at oracle dot com    |
         Resolution|---                         |FIXED
   Target Milestone|4.9.3                       |5.0
            Summary|[4.9/5 Regression] ICE with |[4.9 Regression] ICE with
                   |#pragma GCC ivdep and       |#pragma GCC ivdep and
                   |for-loop on global scope    |for-loop on global scope

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Fixed for 5.0. I don't think it's worth fiddling with the release branch at
this point. If somebody really cares, the patch can be backported, anyway.


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

* [Bug c++/60211] [4.9 Regression] ICE with #pragma GCC ivdep and for-loop on global scope
  2014-02-15 12:11 [Bug c++/60211] New: ICE with #pragma GCC ivdep and for-loop on global scope reichelt at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2015-02-13 17:59 ` [Bug c++/60211] [4.9 " paolo.carlini at oracle dot com
@ 2015-02-13 19:13 ` jason at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2015-02-13 19:13 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60211

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> ---
Agreed, we usually don't backport fixes for invalid-code bugs.


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

end of thread, other threads:[~2015-02-13 19:13 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-15 12:11 [Bug c++/60211] New: ICE with #pragma GCC ivdep and for-loop on global scope reichelt at gcc dot gnu.org
2014-12-29  9:32 ` [Bug c++/60211] [4.9/5 Regression] " paolo.carlini at oracle dot com
2015-01-09 11:29 ` rguenth at gcc dot gnu.org
2015-01-21 18:48 ` paolo.carlini at oracle dot com
2015-02-13 14:44 ` jason at gcc dot gnu.org
2015-02-13 17:57 ` paolo at gcc dot gnu.org
2015-02-13 17:59 ` [Bug c++/60211] [4.9 " paolo.carlini at oracle dot com
2015-02-13 19:13 ` 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).