From 19aec6b06c78510df5f5b81ece17881fd793d439 Mon Sep 17 00:00:00 2001 From: Ira Rosen Date: Thu, 10 Apr 2008 05:51:59 +0000 Subject: [PATCH] re PR tree-optimization/35821 (Internal compiler error: segmentation fault) PR tree-optimization/35821 * tree-vect-transform.c (vect_create_data_ref_ptr): Add check that NEW_STMT_LIST is not NULL. From-SVN: r134162 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gcc.dg/vect/pr35821-altivec.c | 24 +++++++++++++++++++++ gcc/testsuite/gcc.dg/vect/pr35821-spu.c | 22 +++++++++++++++++++ gcc/tree-vect-transform.c | 8 +++++-- 5 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/vect/pr35821-altivec.c create mode 100644 gcc/testsuite/gcc.dg/vect/pr35821-spu.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ce31ffd6d87..8daa7669679 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2008-04-10 Ira Rosen + + PR tree-optimization/35821 + * tree-vect-transform.c (vect_create_data_ref_ptr): Add check that + NEW_STMT_LIST is not NULL. + 2008-04-09 David Edelsohn PR libstdc++/35597 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c82950a3382..1eab06bf778 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2008-04-10 Ira Rosen + + PR tree-optimization/35821 + * gcc.dg/vect/pr35821-altivec.c: New. + * gcc.dg/vect/pr35821-spu.c: New. + 2008-04-09 Andy Hutchinson PR testsuite/34894 diff --git a/gcc/testsuite/gcc.dg/vect/pr35821-altivec.c b/gcc/testsuite/gcc.dg/vect/pr35821-altivec.c new file mode 100644 index 00000000000..79fa926ec67 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr35821-altivec.c @@ -0,0 +1,24 @@ +/* { dg-do compile { target { powerpc_altivec_ok } } } */ + +#include "altivec.h" + +void +foo (float f_gain1, int n_tail, float * __restrict__ f_in_hptr, + float * __restrict__ f_out_hptr) +{ + int i; + vector float *v_f_in_hptr, *v_f_out_hptr; + + f_in_hptr = ( float* )v_f_in_hptr; + f_out_hptr = ( float* )v_f_out_hptr; + + for( i = 0 ; i < n_tail ; i++ ) { + f_out_hptr[0] = f_in_hptr[0] * f_gain1; + f_in_hptr++; + f_out_hptr++; + } +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/pr35821-spu.c b/gcc/testsuite/gcc.dg/vect/pr35821-spu.c new file mode 100644 index 00000000000..4cc255f07ee --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr35821-spu.c @@ -0,0 +1,22 @@ +/* { dg-do compile { target { spu-*-* } } } */ + +void +foo (float f_gain1, int n_tail, float * __restrict__ f_in_hptr, + float * __restrict__ f_out_hptr) +{ + int i; + __attribute__((__spu_vector__)) float *v_f_in_hptr, *v_f_out_hptr; + + f_in_hptr = ( float* )v_f_in_hptr; + f_out_hptr = ( float* )v_f_out_hptr; + + for( i = 0 ; i < n_tail ; i++ ) { + f_out_hptr[0] = f_in_hptr[0] * f_gain1; + f_in_hptr++; + f_out_hptr++; + } +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ + diff --git a/gcc/tree-vect-transform.c b/gcc/tree-vect-transform.c index 59fa6d5de80..6168fdab74d 100644 --- a/gcc/tree-vect-transform.c +++ b/gcc/tree-vect-transform.c @@ -1102,8 +1102,12 @@ vect_create_data_ref_ptr (tree stmt, struct loop *at_loop, new_temp = vect_create_addr_base_for_vector_ref (stmt, &new_stmt_list, offset, loop); pe = loop_preheader_edge (loop); - new_bb = bsi_insert_on_edge_immediate (pe, new_stmt_list); - gcc_assert (!new_bb); + if (new_stmt_list) + { + new_bb = bsi_insert_on_edge_immediate (pe, new_stmt_list); + gcc_assert (!new_bb); + } + *initial_address = new_temp; /* Create: p = (vectype *) initial_base */ -- 2.30.2