From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26481 invoked by alias); 1 Sep 2011 07:02:08 -0000 Received: (qmail 26467 invoked by uid 22791); 1 Sep 2011 07:02:07 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_TM X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 01 Sep 2011 07:01:52 +0000 From: "irar at il dot ibm.com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/50178] [4.6 regression] ICE with gfortran -O3, not with gfortran -02 Date: Thu, 01 Sep 2011 07:02: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-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: irar at il dot ibm.com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.6.2 X-Bugzilla-Changed-Fields: CC Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-09/txt/msg00012.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50178 Ira Rosen changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |irar at il dot ibm.com --- Comment #5 from Ira Rosen 2011-09-01 07:01:07 UTC --- The problem here is that in vectorizable_call we replace the original call with a dummy stmt and also remove its stmt_vec_info, which causes the segfault when we try to access it through related pattern stmt. I'm testing the following patch that updates related pattern stmt to be the dummy stmt: Index: tree-vect-stmts.c =================================================================== --- tree-vect-stmts.c (revision 178373) +++ tree-vect-stmts.c (working copy) @@ -1583,6 +1583,14 @@ vectorizable_call (gimple stmt, gimple_stmt_iterat new_stmt = gimple_build_assign (gimple_call_lhs (stmt), build_zero_cst (type)); set_vinfo_for_stmt (new_stmt, stmt_info); + /* For pattern statements make the related statement to point to + NEW_STMT in order to be able to retrieve the original statement + information later. */ + if (is_pattern_stmt_p (stmt_info)) + { + gimple related = STMT_VINFO_RELATED_STMT (stmt_info); + STMT_VINFO_RELATED_STMT (vinfo_for_stmt (related)) = new_stmt; + } set_vinfo_for_stmt (stmt, NULL); STMT_VINFO_STMT (stmt_info) = new_stmt; gsi_replace (gsi, new_stmt, false); @@ -4957,11 +4965,7 @@ vect_transform_stmt (gimple stmt, gimple_stmt_iter the stmt_info of ORIG_STMT_IN_PATTERN. See more details in the documentation of vect_pattern_recog. */ if (STMT_VINFO_IN_PATTERN_P (stmt_vinfo)) - { - gcc_assert (STMT_VINFO_RELATED_STMT (stmt_vinfo) - == orig_scalar_stmt); - STMT_VINFO_VEC_STMT (stmt_vinfo) = vec_stmt; - } + STMT_VINFO_VEC_STMT (stmt_vinfo) = vec_stmt; } } r175074 really fixed this problem since now we don't need to retrieve the original def stmt.