public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58845] New: Operator || and && broken for vectors
@ 2013-10-22 12:49 reichelt at gcc dot gnu.org
  2013-10-22 12:58 ` [Bug c++/58845] [4.8/4.9 Regression] " reichelt at gcc dot gnu.org
                   ` (24 more replies)
  0 siblings, 25 replies; 26+ messages in thread
From: reichelt at gcc dot gnu.org @ 2013-10-22 12:49 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58845
           Summary: Operator || and && broken for vectors
           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 (IMHO valid) code snippet triggers an ICE since GCC 4.8.0 when
compiled with "-O":

==========================================
void foo()
{
  int v __attribute__((vector_size(8)));
  v = v || v;
}
==========================================

bug.cc: In function 'void foo()':
bug.cc:4:12: internal compiler error: in build_int_cst_wide, at tree.c:1258
   v = v || v;
            ^
0xd213b3 build_int_cst_wide(tree_node*, unsigned long, long)
        ../../gcc/gcc/tree.c:1258
0xd216f0 double_int_to_tree(tree_node*, double_int)
        ../../gcc/gcc/tree.c:1112
0xd2173a build_int_cst(tree_node*, long)
        ../../gcc/gcc/tree.c:1089
0x9348c3 make_range(tree_node*, int*, tree_node**, tree_node**, bool*)
        ../../gcc/gcc/fold-const.c:4217
0x939952 fold_range_test
        ../../gcc/gcc/fold-const.c:4980
0x939952 fold_truth_andor
        ../../gcc/gcc/fold-const.c:8619
0x8fd0d8 fold_binary_loc(unsigned int, tree_code, tree_node*, tree_node*,
tree_node*)
        ../../gcc/gcc/fold-const.c:12769
0x93f57c fold(tree_node*)
        ../../gcc/gcc/fold-const.c:14648
0x68901a cp_build_binary_op(unsigned int, tree_code, tree_node*, tree_node*,
int)
        ../../gcc/gcc/cp/typeck.c:4920
0x556b5c build_new_op_1
        ../../gcc/gcc/cp/call.c:5468
0x5576a7 build_new_op(unsigned int, tree_code, int, tree_node*, tree_node*,
tree_node*, tree_node**, int)
        ../../gcc/gcc/cp/call.c:5513
0x677762 build_x_binary_op(unsigned int, tree_code, tree_node*, tree_code,
tree_node*, tree_code, tree_node**, int)
        ../../gcc/gcc/cp/typeck.c:3752
0x651545 cp_parser_binary_expression
        ../../gcc/gcc/cp/parser.c:7877
0x6517af cp_parser_assignment_expression
        ../../gcc/gcc/cp/parser.c:7996
0x651c04 cp_parser_assignment_expression
        ../../gcc/gcc/cp/parser.c:8046
0x651c04 cp_parser_constant_expression
        ../../gcc/gcc/cp/parser.c:8256
0x65193c cp_parser_assignment_expression
        ../../gcc/gcc/cp/parser.c:8015
0x653c93 cp_parser_expression
        ../../gcc/gcc/cp/parser.c:8158
0x65449e cp_parser_expression
        ../../gcc/gcc/cp/parser.c:8197
0x65449e cp_parser_expression_statement
        ../../gcc/gcc/cp/parser.c:9488
Please submit a full bug report, [etc.]

Without "-O" I get the following (IMHO bogus) error message:

bug.cc: In function 'void foo()':
bug.cc:4:5: error: cannot convert 'bool' to '__vector(2) int' in assignment
   v = v || v;
     ^

And in fact, if I modify the testcase according to the error message, I get
another ICE:

================================================
void foo()
{
  int v __attribute__((vector_size(8)));
  bool b = v || v;
}
================================================

bug.cc: In function 'void foo()':
bug.cc:1:6: error: vector comparison returning a boolean
 void foo()
      ^
vector(2) int
vector(2) int
if (v != { 0, 0 }) goto <D.2218>; else goto <D.2221>;
bug.cc:1:6: error: vector comparison returning a boolean
vector(2) int
vector(2) int
if (v != { 0, 0 }) goto <D.2218>; else goto <D.2219>;
bug.cc:1:6: internal compiler error: verify_gimple failed
0xb4007f verify_gimple_in_seq(gimple_statement_d*)
        ../../gcc/gcc/tree-cfg.c:4368
0x9854fc gimplify_body(tree_node*, bool)
        ../../gcc/gcc/gimplify.c:8799
0x985806 gimplify_function_tree(tree_node*)
        ../../gcc/gcc/gimplify.c:8884
0x81f4c7 analyze_function
        ../../gcc/gcc/cgraphunit.c:636
0x8207b4 analyze_functions
        ../../gcc/gcc/cgraphunit.c:1002
0x821ce9 finalize_compilation_unit()
        ../../gcc/gcc/cgraphunit.c:2260
0x625cc0 cp_write_global_declarations()
        ../../gcc/gcc/cp/decl2.c:4438
Please submit a full bug report, [etc.]

Btw, the same happens for the operator &&.


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

end of thread, other threads:[~2014-10-03 20:10 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-22 12:49 [Bug c++/58845] New: Operator || and && broken for vectors reichelt at gcc dot gnu.org
2013-10-22 12:58 ` [Bug c++/58845] [4.8/4.9 Regression] " reichelt at gcc dot gnu.org
2013-11-01 16:05 ` glisse at gcc dot gnu.org
2013-11-01 18:31 ` paolo.carlini at oracle dot com
2013-11-01 18:37 ` reichelt at gcc dot gnu.org
2013-11-04  9:38 ` rguenth at gcc dot gnu.org
2013-11-04  9:56 ` jakub at gcc dot gnu.org
2013-11-04 10:13 ` rguenther at suse dot de
2013-11-04 10:56 ` glisse at gcc dot gnu.org
2013-11-04 11:08 ` rguenther at suse dot de
2013-11-04 11:27 ` glisse at gcc dot gnu.org
2013-11-19  9:52 ` rguenth at gcc dot gnu.org
2013-11-19 10:26 ` rguenth at gcc dot gnu.org
2013-11-24 15:39 ` glisse at gcc dot gnu.org
2013-11-24 15:46 ` mpolacek at gcc dot gnu.org
2013-12-01 16:59 ` glisse at gcc dot gnu.org
2014-03-01 14:00 ` jason at gcc dot gnu.org
2014-03-01 14:15 ` jason at gcc dot gnu.org
2014-03-01 15:33 ` glisse at gcc dot gnu.org
2014-03-01 18:45 ` jason at gcc dot gnu.org
2014-03-01 18:46 ` [Bug c++/58845] " jason at gcc dot gnu.org
2014-03-12  5:14 ` pinskia at gcc dot gnu.org
2014-06-29  8:48 ` glisse at gcc dot gnu.org
2014-06-30 13:34 ` jason at gcc dot gnu.org
2014-10-03 19:57 ` glisse at gcc dot gnu.org
2014-10-03 20:10 ` 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).