public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/59641] New: ICE with invalid expression in vector arithmetic
@ 2013-12-30 20:30 reichelt at gcc dot gnu.org
  2013-12-30 22:25 ` [Bug c++/59641] " glisse at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: reichelt at gcc dot gnu.org @ 2013-12-30 20:30 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 59641
           Summary: ICE with invalid expression in vector arithmetic
           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 (compiled with "-std=c++11")
triggers an ICE since GCC 4.8.0:

======================================================
typedef int T __attribute__((vector_size(8)));

T foo(const T& a, const T& b)
{
  constexpr T c = a < b;
  return c ? a : b;
}
======================================================

bug.cc: In function 'T foo(const T&, const T&)':
bug.cc:5:23: error: 'a' is not a constant expression
   constexpr T c = a < b;
                       ^
bug.cc:6:18: internal compiler error: tree check: expected vector_type, have
error_mark in build_conditional_expr_1, at cp/call.c:4495
   return c ? a : b;
                  ^
0xd8f084 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ../../gcc/gcc/tree.c:9192
0x58441c tree_check
        ../../gcc/gcc/tree.h:2707
0x58441c build_conditional_expr_1
        ../../gcc/gcc/cp/call.c:4495
0x5844bc build_conditional_expr(unsigned int, tree_node*, tree_node*,
tree_node*, int)
        ../../gcc/gcc/cp/call.c:4931
0x6a8e53 build_x_conditional_expr(unsigned int, tree_node*, tree_node*,
tree_node*, int)
        ../../gcc/gcc/cp/typeck.c:6017
0x682b2c cp_parser_question_colon_clause
        ../../gcc/gcc/cp/parser.c:8080
0x682b2c cp_parser_assignment_expression
        ../../gcc/gcc/cp/parser.c:8116
0x6847b4 cp_parser_expression
        ../../gcc/gcc/cp/parser.c:8274
0x67af3a cp_parser_expression
        ../../gcc/gcc/cp/parser.c:8313
0x67af3a cp_parser_jump_statement
        ../../gcc/gcc/cp/parser.c:10677
0x67af3a cp_parser_statement
        ../../gcc/gcc/cp/parser.c:9370
0x67b5c9 cp_parser_statement_seq_opt
        ../../gcc/gcc/cp/parser.c:9740
0x67b73e cp_parser_compound_statement
        ../../gcc/gcc/cp/parser.c:9694
0x68f15b cp_parser_function_body
        ../../gcc/gcc/cp/parser.c:18610
0x68f15b cp_parser_ctor_initializer_opt_and_function_body
        ../../gcc/gcc/cp/parser.c:18646
0x6934fe cp_parser_function_definition_after_declarator
        ../../gcc/gcc/cp/parser.c:22678
0x694394 cp_parser_function_definition_from_specifiers_and_declarator
        ../../gcc/gcc/cp/parser.c:22590
0x694394 cp_parser_init_declarator
        ../../gcc/gcc/cp/parser.c:16588
0x69562f cp_parser_simple_declaration
        ../../gcc/gcc/cp/parser.c:11200
0x679003 cp_parser_block_declaration
        ../../gcc/gcc/cp/parser.c:11081
Please submit a full bug report, [etc.]


Marc, vector arithmetic looks like your domain, would you mind having a look?


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

* [Bug c++/59641] ICE with invalid expression in vector arithmetic
  2013-12-30 20:30 [Bug c++/59641] New: ICE with invalid expression in vector arithmetic reichelt at gcc dot gnu.org
@ 2013-12-30 22:25 ` glisse at gcc dot gnu.org
  2014-01-02 22:43 ` glisse at gcc dot gnu.org
  2014-01-02 22:48 ` glisse at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: glisse at gcc dot gnu.org @ 2013-12-30 22:25 UTC (permalink / raw)
  To: gcc-bugs

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

Marc Glisse <glisse at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-12-30
   Target Milestone|---                         |4.9.0
     Ever confirmed|0                           |1

--- Comment #1 from Marc Glisse <glisse at gcc dot gnu.org> ---
In build_conditional_expr_1, we check error_operand_p (arg1) on the original
arguments, but we don't check it again after force_rvalue, which we probably
should do.


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

* [Bug c++/59641] ICE with invalid expression in vector arithmetic
  2013-12-30 20:30 [Bug c++/59641] New: ICE with invalid expression in vector arithmetic reichelt at gcc dot gnu.org
  2013-12-30 22:25 ` [Bug c++/59641] " glisse at gcc dot gnu.org
@ 2014-01-02 22:43 ` glisse at gcc dot gnu.org
  2014-01-02 22:48 ` glisse at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: glisse at gcc dot gnu.org @ 2014-01-02 22:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Marc Glisse <glisse at gcc dot gnu.org> ---
Author: glisse
Date: Thu Jan  2 22:43:24 2014
New Revision: 206303

URL: http://gcc.gnu.org/viewcvs?rev=206303&root=gcc&view=rev
Log:
2014-01-02  Marc Glisse  <marc.glisse@inria.fr>

    PR c++/59641
gcc/cp/
    * call.c (build_conditional_expr_1): Check the return value of
    force_rvalue.
gcc/testsuite/
    * g++.dg/cpp0x/pr59641.C: New file.


Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/pr59641.C   (with props)
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/call.c
    trunk/gcc/testsuite/ChangeLog

Propchange: trunk/gcc/testsuite/g++.dg/cpp0x/pr59641.C
            ('svn:eol-style' added)

Propchange: trunk/gcc/testsuite/g++.dg/cpp0x/pr59641.C
            ('svn:keywords' added)


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

* [Bug c++/59641] ICE with invalid expression in vector arithmetic
  2013-12-30 20:30 [Bug c++/59641] New: ICE with invalid expression in vector arithmetic reichelt at gcc dot gnu.org
  2013-12-30 22:25 ` [Bug c++/59641] " glisse at gcc dot gnu.org
  2014-01-02 22:43 ` glisse at gcc dot gnu.org
@ 2014-01-02 22:48 ` glisse at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: glisse at gcc dot gnu.org @ 2014-01-02 22:48 UTC (permalink / raw)
  To: gcc-bugs

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

Marc Glisse <glisse at gcc dot gnu.org> changed:

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

--- Comment #3 from Marc Glisse <glisse at gcc dot gnu.org> ---
Fixed on trunk, not worth backporting.


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

end of thread, other threads:[~2014-01-02 22:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-30 20:30 [Bug c++/59641] New: ICE with invalid expression in vector arithmetic reichelt at gcc dot gnu.org
2013-12-30 22:25 ` [Bug c++/59641] " glisse at gcc dot gnu.org
2014-01-02 22:43 ` glisse at gcc dot gnu.org
2014-01-02 22:48 ` glisse 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).