re PR middle-end/63884 (ICE: SIGSEGV in is_sec_implicit_index_fn with -fcilkplus...
authorMarek Polacek <polacek@redhat.com>
Sat, 15 Nov 2014 20:20:05 +0000 (20:20 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Sat, 15 Nov 2014 20:20:05 +0000 (20:20 +0000)
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

gcc/c-family/ChangeLog
gcc/c-family/array-notation-common.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/cilk-plus/AN/pr63884.c [new file with mode: 0644]

index 4eb90fc1b117011931170d3518c97175c3ca75e3..fa0518a63ebc9370db7dff5a7d0c671a5195069f 100644 (file)
@@ -1,3 +1,10 @@
+2014-11-15  Marek Polacek  <polacek@redhat.com>
+
+       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  <joseph@codesourcery.com>
 
        * c-cppbuiltin.c (c_cpp_builtins_optimize_pragma): Define and
index f8bce04bbc1e7e7efa1d95793790abd12008564e..cb5708c27b22228587efa05fa8ebbcf95d0b4dc4 100644 (file)
@@ -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<tree, va_gc> **array_list)
 {
   size_t ii = 0;  
+
+  if (!node)
+    return;
   if (TREE_CODE (node) == ARRAY_NOTATION_REF)
     {
       vec_safe_push (*array_list, node);
index 9921fec1ef8581d943b5ec5f17ad37319cd9fe34..8a71250e3543be7af713250a20f6e3b33ee10a09 100644 (file)
@@ -1,3 +1,8 @@
+2014-11-15  Marek Polacek  <polacek@redhat.com>
+
+       PR middle-end/63884
+       * c-c++-common/cilk-plus/AN/pr63884.c: New test.
+
 2014-11-15  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
 
        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 (file)
index 0000000..c876a8d
--- /dev/null
@@ -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);
+}