public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/68001] New: [cilkplus] ICE in cp_gimplify_expr, at cp/cp-gimplify.c:760
@ 2015-10-17  7:31 ryan.burn at gmail dot com
  0 siblings, 0 replies; only message in thread
From: ryan.burn at gmail dot com @ 2015-10-17  7:31 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 68001
           Summary: [cilkplus] ICE in cp_gimplify_expr, at
                    cp/cp-gimplify.c:760
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

The below code causes the following ICE

rnburn@localhost ~/test/gcc_cilk $ c++17 -fcilkplus -lcilkrts t.cpp 
t.cpp: In function ‘void compute_cilk()’:
t.cpp:21:33: error: ‘do_not_optimize_away’ was not declared in this scope
   do_not_optimize_away(v1.data());
                                 ^
cc1plus: error: invalid use of ‘_Cilk_spawn’
t.cpp:18:26: error: invalid use of ‘_Cilk_spawn’
   auto v1 = cilk_spawn f();
                          ^
t.cpp:18:26: internal compiler error: tree check: expected call_expr or
aggr_init_expr, have target_expr in cp_gimplify_expr, at cp/cp-gimplify.c:760
0xf2508c tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ../../gcc/gcc/tree.c:9512
0x7fc015 tree_check2(tree_node*, char const*, int, char const*, tree_code,
tree_code)
        ../../gcc/gcc/tree.h:2877
0x7fc015 cp_gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**)
        ../../gcc/gcc/cp/cp-gimplify.c:760
0xa965c2 gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**, bool (*)(tree_node*), int)
        ../../gcc/gcc/gimplify.c:8025
0xaa80b1 gimplify_addr_expr
        ../../gcc/gcc/gimplify.c:4985
0xa97f09 gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**, bool (*)(tree_node*), int)
        ../../gcc/gcc/gimplify.c:8162
0xaa386b gimplify_call_expr
        ../../gcc/gcc/gimplify.c:2452
0xa97dda gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**, bool (*)(tree_node*), int)
        ../../gcc/gcc/gimplify.c:8087
0xa9bb96 gimplify_stmt(tree_node**, gimple_statement_base**)
        ../../gcc/gcc/gimplify.c:5526
0xa97e58 gimplify_cleanup_point_expr
        ../../gcc/gcc/gimplify.c:5302
0xa97e58 gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**, bool (*)(tree_node*), int)
        ../../gcc/gcc/gimplify.c:8479
0xa9bb96 gimplify_stmt(tree_node**, gimple_statement_base**)
        ../../gcc/gcc/gimplify.c:5526
0xa993bb gimplify_statement_list
        ../../gcc/gcc/gimplify.c:1462
0xa993bb gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**, bool (*)(tree_node*), int)
        ../../gcc/gcc/gimplify.c:8531
0xa9bb96 gimplify_stmt(tree_node**, gimple_statement_base**)
        ../../gcc/gcc/gimplify.c:5526
0xa99209 gimplify_and_add(tree_node*, gimple_statement_base**)
        ../../gcc/gcc/gimplify.c:398
0xa99209 gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**, bool (*)(tree_node*), int)
        ../../gcc/gcc/gimplify.c:8453
0xa9bb96 gimplify_stmt(tree_node**, gimple_statement_base**)
        ../../gcc/gcc/gimplify.c:5526
0xa993bb gimplify_statement_list
        ../../gcc/gcc/gimplify.c:1462
0xa993bb gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**, bool (*)(tree_node*), int)
        ../../gcc/gcc/gimplify.c:8531
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

//////////////////////////////////////////////////////////////
#include <cilk/cilk.h>                                                          
#include <cilk/cilk_api.h>                                                      
#include <vector>                                                               
#include <random>                                                               
#include <cmath>                                                                

const int N = 100'000'000;                                                      

auto f() {                                                                      
  std::vector<double> v(N);                                                     
  auto rng = std::mt19937{std::random_device{}()};                              
  std::uniform_real_distribution<double> dist(0, 1);                            
  for (int i = 0; i < N; ++i) v[i] = std::log(std::sqrt(dist(rng)));            
  return v;                                                                     
}                                                                               

void compute_cilk() {                                                           
  auto v1 = cilk_spawn f();                                                     
  auto v2 = f();                                                                
  cilk_sync;                                                                    
  do_not_optimize_away(v1.data());                                              
  do_not_optimize_away(v2.data());                                              
}                                                                               

int main() {                                                                    
  compute_cilk();                                                               
  return 0;                                                                     
}  
//////////////////////////////////////////////////////////////
>From gcc-bugs-return-499808-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Oct 17 07:58:18 2015
Return-Path: <gcc-bugs-return-499808-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 87535 invoked by alias); 17 Oct 2015 07:58:17 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 87514 invoked by uid 48); 17 Oct 2015 07:58:14 -0000
From: "glisse at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/67998] redundant test for 0 when also checking inequality
Date: Sat, 17 Oct 2015 07:58:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: tree-optimization
X-Bugzilla-Version: 5.1.0
X-Bugzilla-Keywords: missed-optimization
X-Bugzilla-Severity: enhancement
X-Bugzilla-Who: glisse at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: keywords bug_status cf_reconfirmed_on everconfirmed
Message-ID: <bug-67998-4-eCmNkFLSEk@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-67998-4@http.gcc.gnu.org/bugzilla/>
References: <bug-67998-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-10/txt/msg01363.txt.bz2
Content-length: 851

https://gcc.gnu.org/bugzilla/show_bug.cgi?idg998

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-10-17
     Ever confirmed|0                           |1

--- Comment #1 from Marc Glisse <glisse at gcc dot gnu.org> ---
Indeed. We might want to be careful about the case:

unsigned b = long_computation_without_side_effects();
if(!a || b>=a) ...

where it might be better to sink the computation if a is often 0:
if(!a) ...
else {
  unsigned b = long_computation_without_side_effects();
  if(b>=a) ...
}

(or maybe we can just ignore it)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-10-17  7:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-17  7:31 [Bug c++/68001] New: [cilkplus] ICE in cp_gimplify_expr, at cp/cp-gimplify.c:760 ryan.burn at gmail dot com

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).