From: Marek Polacek Date: Sat, 15 Nov 2014 20:20:05 +0000 (+0000) Subject: re PR middle-end/63884 (ICE: SIGSEGV in is_sec_implicit_index_fn with -fcilkplus... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8537a4a9f5701e82d7378ce434f265aafe8c9033;p=gcc.git re PR middle-end/63884 (ICE: SIGSEGV in is_sec_implicit_index_fn with -fcilkplus and __builtin_sadd_overflow()) PR middle-end/63884 c-family/ * array-notation-common.c (is_sec_implicit_index_fn): Return false for NULL fndecl. (extract_array_notation_exprs): Return for NULL node. testsuite/ * c-c++-common/cilk-plus/AN/pr63884.c: New test. From-SVN: r217612 --- diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 4eb90fc1b11..fa0518a63eb 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,10 @@ +2014-11-15 Marek Polacek + + PR middle-end/63884 + * array-notation-common.c (is_sec_implicit_index_fn): Return false + for NULL fndecl. + (extract_array_notation_exprs): Return for NULL node. + 2014-11-12 Joseph Myers * c-cppbuiltin.c (c_cpp_builtins_optimize_pragma): Define and diff --git a/gcc/c-family/array-notation-common.c b/gcc/c-family/array-notation-common.c index f8bce04bbc1..cb5708c27b2 100644 --- a/gcc/c-family/array-notation-common.c +++ b/gcc/c-family/array-notation-common.c @@ -35,6 +35,9 @@ along with GCC; see the file COPYING3. If not see bool is_sec_implicit_index_fn (tree fndecl) { + if (!fndecl) + return false; + if (TREE_CODE (fndecl) == ADDR_EXPR) fndecl = TREE_OPERAND (fndecl, 0); @@ -327,6 +330,9 @@ extract_array_notation_exprs (tree node, bool ignore_builtin_fn, vec **array_list) { size_t ii = 0; + + if (!node) + return; if (TREE_CODE (node) == ARRAY_NOTATION_REF) { vec_safe_push (*array_list, node); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9921fec1ef8..8a71250e354 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-11-15 Marek Polacek + + PR middle-end/63884 + * c-c++-common/cilk-plus/AN/pr63884.c: New test. + 2014-11-15 Francois-Xavier Coudert PR target/60104 diff --git a/gcc/testsuite/c-c++-common/cilk-plus/AN/pr63884.c b/gcc/testsuite/c-c++-common/cilk-plus/AN/pr63884.c new file mode 100644 index 00000000000..c876a8dec00 --- /dev/null +++ b/gcc/testsuite/c-c++-common/cilk-plus/AN/pr63884.c @@ -0,0 +1,10 @@ +/* PR middle-end/63884 */ +/* { dg-do compile } */ +/* { dg-options "-fcilkplus" } */ + +int +foo (int x, int y) +{ + int r; + return __builtin_sadd_overflow (x, y, &r); +}