public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58635] New: [c++11] ICE with __transaction_atomic and noexcept(false)
@ 2013-10-05 21:20 reichelt at gcc dot gnu.org
  2013-10-07 12:34 ` [Bug c++/58635] " mpolacek at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: reichelt at gcc dot gnu.org @ 2013-10-05 21:20 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58635
           Summary: [c++11] ICE with __transaction_atomic and
                    noexcept(false)
           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 three code snippets (compiled with "-std=c++0x -fgnu-tm")
trigger slightly different ICEs in build_transaction_expr since GCC 4.7.0.
The first two snippets are valid, the last one is invalid:

===========================================================
int foo()
{
  return __transaction_atomic noexcept(false) (false);
}
===========================================================

bug.cc: In function 'int foo()':
bug.cc:3:53: internal compiler error: tree check: expected class 'expression',
have 'constant' (integer_cst) in build_transaction_expr, at cp/semantics.c:5224
   return __transaction_atomic noexcept(false) (false);
                                                     ^
0xcd8c59 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
        ../../gcc/gcc/tree.c:9227
0x6bcf7a expr_check
        ../../gcc/gcc/tree.h:2778
0x6bcf7a build_transaction_expr(unsigned int, tree_node*, int, tree_node*)
        ../../gcc/gcc/cp/semantics.c:5224
0x6443e9 cp_parser_transaction_expression
        ../../gcc/gcc/cp/parser.c:28568
0x6443e9 cp_parser_unary_expression
        ../../gcc/gcc/cp/parser.c:6845
0x644cff cp_parser_binary_expression
        ../../gcc/gcc/cp/parser.c:7701
0x6451bf cp_parser_assignment_expression
        ../../gcc/gcc/cp/parser.c:7937
0x647023 cp_parser_expression
        ../../gcc/gcc/cp/parser.c:8099
0x63dbf2 cp_parser_expression
        ../../gcc/gcc/cp/parser.c:8138
0x63dbf2 cp_parser_jump_statement
        ../../gcc/gcc/cp/parser.c:10472
0x63dbf2 cp_parser_statement
        ../../gcc/gcc/cp/parser.c:9182
0x63e452 cp_parser_statement_seq_opt
        ../../gcc/gcc/cp/parser.c:9552
0x63e596 cp_parser_compound_statement
        ../../gcc/gcc/cp/parser.c:9506
0x64f95b cp_parser_function_body
        ../../gcc/gcc/cp/parser.c:18328
0x64f95b cp_parser_ctor_initializer_opt_and_function_body
        ../../gcc/gcc/cp/parser.c:18364
0x6509af cp_parser_function_definition_after_declarator
        ../../gcc/gcc/cp/parser.c:22351
0x6516d5 cp_parser_function_definition_from_specifiers_and_declarator
        ../../gcc/gcc/cp/parser.c:22272
0x6516d5 cp_parser_init_declarator
        ../../gcc/gcc/cp/parser.c:16357
0x65198f cp_parser_simple_declaration
        ../../gcc/gcc/cp/parser.c:10995
0x653810 cp_parser_block_declaration
        ../../gcc/gcc/cp/parser.c:10876
Please submit a full bug report, [etc.]


===========================================================
int foo(int i)
{
  return __transaction_atomic noexcept(false) (i);
}
===========================================================

bug.cc: In function 'int foo(int)':
bug.cc:3:49: internal compiler error: tree check: expected class 'expression',
have 'declaration' (parm_decl) in build_transaction_expr, at
cp/semantics.c:5224
   return __transaction_atomic noexcept(false) (i);
                                                 ^
0xcd8c59 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
        ../../gcc/gcc/tree.c:9227
[etc.]


===========================================================
int foo()
{
  return __transaction_atomic noexcept(false) (x);
}
===========================================================

bug.cc: In function 'int foo()':
bug.cc:3:48: error: 'x' was not declared in this scope
   return __transaction_atomic noexcept(false) (x);
                                                ^
bug.cc:3:49: internal compiler error: tree check: expected class 'expression',
have 'exceptional' (error_mark) in build_transaction_expr, at
cp/semantics.c:5224
   return __transaction_atomic noexcept(false) (x);
                                                 ^
0xcd8c59 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
        ../../gcc/gcc/tree.c:9227
[etc.]


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

* [Bug c++/58635] [c++11] ICE with __transaction_atomic and noexcept(false)
  2013-10-05 21:20 [Bug c++/58635] New: [c++11] ICE with __transaction_atomic and noexcept(false) reichelt at gcc dot gnu.org
@ 2013-10-07 12:34 ` mpolacek at gcc dot gnu.org
  2013-10-07 13:43 ` mpolacek at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-10-07 12:34 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-10-07
                 CC|                            |mpolacek at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
For the first two it needs the same fix as for PR58516:

--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -5221,7 +5221,8 @@ build_transaction_expr (location_t loc, tree expr, int
flags, tree 
   if (noex)
     {
       expr = build_must_not_throw_expr (expr, noex);
-      SET_EXPR_LOCATION (expr, loc);
+      if (EXPR_P (expr))
+       SET_EXPR_LOCATION (expr, loc);
       TREE_SIDE_EFFECTS (expr) = 1;
     }
   ret = build1 (TRANSACTION_EXPR, TREE_TYPE (expr), expr);


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

* [Bug c++/58635] [c++11] ICE with __transaction_atomic and noexcept(false)
  2013-10-05 21:20 [Bug c++/58635] New: [c++11] ICE with __transaction_atomic and noexcept(false) reichelt at gcc dot gnu.org
  2013-10-07 12:34 ` [Bug c++/58635] " mpolacek at gcc dot gnu.org
@ 2013-10-07 13:43 ` mpolacek at gcc dot gnu.org
  2013-10-09 14:51 ` mpolacek at gcc dot gnu.org
  2013-10-09 14:53 ` mpolacek at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-10-07 13:43 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |mpolacek at gcc dot gnu.org

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


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

* [Bug c++/58635] [c++11] ICE with __transaction_atomic and noexcept(false)
  2013-10-05 21:20 [Bug c++/58635] New: [c++11] ICE with __transaction_atomic and noexcept(false) reichelt at gcc dot gnu.org
  2013-10-07 12:34 ` [Bug c++/58635] " mpolacek at gcc dot gnu.org
  2013-10-07 13:43 ` mpolacek at gcc dot gnu.org
@ 2013-10-09 14:51 ` mpolacek at gcc dot gnu.org
  2013-10-09 14:53 ` mpolacek at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-10-09 14:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Author: mpolacek
Date: Wed Oct  9 14:51:28 2013
New Revision: 203323

URL: http://gcc.gnu.org/viewcvs?rev=203323&root=gcc&view=rev
Log:
    PR c++/58635
cp/
    * semantics.c (finish_return_stmt): Return error_mark_node
    when error_operand_p of the expr is true.
    (build_transaction_expr): Check for EXPR_P before setting the
    expr location.
testsuite/
    * g++.dg/tm/pr58635-1.C: New test.
    * g++.dg/tm/pr58635-2.C: New test.


Added:
    trunk/gcc/testsuite/g++.dg/tm/pr58635-1.C
    trunk/gcc/testsuite/g++.dg/tm/pr58635-2.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/semantics.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/58635] [c++11] ICE with __transaction_atomic and noexcept(false)
  2013-10-05 21:20 [Bug c++/58635] New: [c++11] ICE with __transaction_atomic and noexcept(false) reichelt at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2013-10-09 14:51 ` mpolacek at gcc dot gnu.org
@ 2013-10-09 14:53 ` mpolacek at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-10-09 14:53 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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


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

end of thread, other threads:[~2013-10-09 14:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-05 21:20 [Bug c++/58635] New: [c++11] ICE with __transaction_atomic and noexcept(false) reichelt at gcc dot gnu.org
2013-10-07 12:34 ` [Bug c++/58635] " mpolacek at gcc dot gnu.org
2013-10-07 13:43 ` mpolacek at gcc dot gnu.org
2013-10-09 14:51 ` mpolacek at gcc dot gnu.org
2013-10-09 14:53 ` 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).