public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58516] New: ICE with __transaction_atomic
@ 2013-09-23 21:35 reichelt at gcc dot gnu.org
  2013-09-24 14:13 ` [Bug c++/58516] [4.7/4.8/4.9 Regression] " mpolacek at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: reichelt at gcc dot gnu.org @ 2013-09-23 21:35 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58516
           Summary: ICE with __transaction_atomic
           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 code snippet (compiled with "-std=c++0x -fgnu-tm") triggers an
ICE since GCC 4.7.0 (when transactional memory was introduced):

=================================================
void foo()
{
  __transaction_atomic noexcept(false) {}
}
=================================================

bug.cc: In function 'void foo()':
bug.cc:3:41: internal compiler error: tree check: expected class 'expression',
have 'exceptional' (statement_list) in finish_transaction_stmt, at
cp/semantics.c:5202
   __transaction_atomic noexcept(false) {}
                                         ^
0xcd2399 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
        ../../gcc/gcc/tree.c:9258
0x6b576b expr_check
        ../../gcc/gcc/tree.h:2773
0x6b576b finish_transaction_stmt(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/gcc/cp/semantics.c:5202
0x635842 cp_parser_transaction
        ../../gcc/gcc/cp/parser.c:28482
0x635842 cp_parser_statement
        ../../gcc/gcc/cp/parser.c:9205
0x636dde cp_parser_statement_seq_opt
        ../../gcc/gcc/cp/parser.c:9552
0x636f26 cp_parser_compound_statement
        ../../gcc/gcc/cp/parser.c:9506
0x648323 cp_parser_function_body
        ../../gcc/gcc/cp/parser.c:18313
0x648323 cp_parser_ctor_initializer_opt_and_function_body
        ../../gcc/gcc/cp/parser.c:18349
0x64935f cp_parser_function_definition_after_declarator
        ../../gcc/gcc/cp/parser.c:22333
0x64a079 cp_parser_function_definition_from_specifiers_and_declarator
        ../../gcc/gcc/cp/parser.c:22254
0x64a079 cp_parser_init_declarator
        ../../gcc/gcc/cp/parser.c:16348
0x64a32f cp_parser_simple_declaration
        ../../gcc/gcc/cp/parser.c:10986
0x64c190 cp_parser_block_declaration
        ../../gcc/gcc/cp/parser.c:10867
0x6551ae cp_parser_declaration
        ../../gcc/gcc/cp/parser.c:10764
0x653f0d cp_parser_declaration_seq_opt
        ../../gcc/gcc/cp/parser.c:10650
0x6557e6 cp_parser_translation_unit
        ../../gcc/gcc/cp/parser.c:3939
0x6557e6 c_parse_file()
        ../../gcc/gcc/cp/parser.c:28893
0x768164 c_common_parse_file()
        ../../gcc/gcc/c-family/c-opts.c:1046
Please submit a full bug report, [etc.]


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

* [Bug c++/58516] [4.7/4.8/4.9 Regression] ICE with __transaction_atomic
  2013-09-23 21:35 [Bug c++/58516] New: ICE with __transaction_atomic reichelt at gcc dot gnu.org
@ 2013-09-24 14:13 ` mpolacek at gcc dot gnu.org
  2013-09-24 14:50 ` mpolacek at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-09-24 14:13 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-09-24
                 CC|                            |mpolacek at gcc dot gnu.org
   Target Milestone|---                         |4.9.0
            Summary|ICE with                    |[4.7/4.8/4.9 Regression]
                   |__transaction_atomic        |ICE with
                   |                            |__transaction_atomic
     Ever confirmed|0                           |1

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed.


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

* [Bug c++/58516] [4.7/4.8/4.9 Regression] ICE with __transaction_atomic
  2013-09-23 21:35 [Bug c++/58516] New: ICE with __transaction_atomic reichelt at gcc dot gnu.org
  2013-09-24 14:13 ` [Bug c++/58516] [4.7/4.8/4.9 Regression] " mpolacek at gcc dot gnu.org
@ 2013-09-24 14:50 ` mpolacek at gcc dot gnu.org
  2013-09-24 15:01 ` mpolacek at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-09-24 14:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Maybe something like the following might fix it?

--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -5199,7 +5199,9 @@ finish_transaction_stmt (tree stmt, tree compound_stmt,
int flags, tree noex)
     {
       tree body = build_must_not_throw_expr (TRANSACTION_EXPR_BODY (stmt),
                          noex);
-      SET_EXPR_LOCATION (body, EXPR_LOCATION (TRANSACTION_EXPR_BODY (stmt)));
+      /* Check that the STATEMENT_LIST is not empty.  */
+      if (TREE_CODE (TRANSACTION_EXPR_BODY (stmt)) != STATEMENT_LIST)
+        SET_EXPR_LOCATION (body, EXPR_LOCATION (TRANSACTION_EXPR_BODY
(stmt)));
       TREE_SIDE_EFFECTS (body) = 1;
       TRANSACTION_EXPR_BODY (stmt) = body;
     }


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

* [Bug c++/58516] [4.7/4.8/4.9 Regression] ICE with __transaction_atomic
  2013-09-23 21:35 [Bug c++/58516] New: ICE with __transaction_atomic reichelt at gcc dot gnu.org
  2013-09-24 14:13 ` [Bug c++/58516] [4.7/4.8/4.9 Regression] " mpolacek at gcc dot gnu.org
  2013-09-24 14:50 ` mpolacek at gcc dot gnu.org
@ 2013-09-24 15:01 ` mpolacek at gcc dot gnu.org
  2013-09-25  7:48 ` mpolacek at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-09-24 15:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Or alternatively ...

--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -5199,7 +5199,9 @@ finish_transaction_stmt (tree stmt, tree compound_stmt,
int flags, tree noex)
     {
       tree body = build_must_not_throw_expr (TRANSACTION_EXPR_BODY (stmt),
                          noex);
-      SET_EXPR_LOCATION (body, EXPR_LOCATION (TRANSACTION_EXPR_BODY (stmt)));
+      /* This may occur when the STATEMENT_LIST is empty.  */
+      if (CAN_HAVE_LOCATION_P (body))
+        SET_EXPR_LOCATION (body, EXPR_LOCATION (TRANSACTION_EXPR_BODY
(stmt)));
       TREE_SIDE_EFFECTS (body) = 1;
       TRANSACTION_EXPR_BODY (stmt) = body;
     }


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

* [Bug c++/58516] [4.7/4.8/4.9 Regression] ICE with __transaction_atomic
  2013-09-23 21:35 [Bug c++/58516] New: ICE with __transaction_atomic reichelt at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2013-09-24 15:01 ` mpolacek at gcc dot gnu.org
@ 2013-09-25  7:48 ` mpolacek at gcc dot gnu.org
  2013-09-25  7:59 ` mpolacek at gcc dot gnu.org
  2013-09-25  8:00 ` mpolacek at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-09-25  7:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Author: mpolacek
Date: Wed Sep 25 07:48:47 2013
New Revision: 202883

URL: http://gcc.gnu.org/viewcvs?rev=202883&root=gcc&view=rev
Log:
    PR c++/58516
cp/
    * semantics.c (finish_transaction_stmt): Check for EXPR_P before
    setting the expr location.

testsuite/
    * g++.dg/tm/pr58516.C: New test.


Added:
    trunk/gcc/testsuite/g++.dg/tm/pr58516.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++/58516] [4.7/4.8/4.9 Regression] ICE with __transaction_atomic
  2013-09-23 21:35 [Bug c++/58516] New: ICE with __transaction_atomic reichelt at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2013-09-25  7:48 ` mpolacek at gcc dot gnu.org
@ 2013-09-25  7:59 ` mpolacek at gcc dot gnu.org
  2013-09-25  8:00 ` mpolacek at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-09-25  7:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed.


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

* [Bug c++/58516] [4.7/4.8/4.9 Regression] ICE with __transaction_atomic
  2013-09-23 21:35 [Bug c++/58516] New: ICE with __transaction_atomic reichelt at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2013-09-25  7:59 ` mpolacek at gcc dot gnu.org
@ 2013-09-25  8:00 ` mpolacek at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-09-25  8:00 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
.


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

end of thread, other threads:[~2013-09-25  8:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-23 21:35 [Bug c++/58516] New: ICE with __transaction_atomic reichelt at gcc dot gnu.org
2013-09-24 14:13 ` [Bug c++/58516] [4.7/4.8/4.9 Regression] " mpolacek at gcc dot gnu.org
2013-09-24 14:50 ` mpolacek at gcc dot gnu.org
2013-09-24 15:01 ` mpolacek at gcc dot gnu.org
2013-09-25  7:48 ` mpolacek at gcc dot gnu.org
2013-09-25  7:59 ` mpolacek at gcc dot gnu.org
2013-09-25  8:00 ` mpolacek 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).