re PR middle-end/64391 (ICE: SIGSEGV in get_attrs_for (trans-mem.c:179) with -fgnu...
authorMarek Polacek <polacek@redhat.com>
Tue, 13 Jan 2015 20:22:32 +0000 (20:22 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Tue, 13 Jan 2015 20:22:32 +0000 (20:22 +0000)
PR middle-end/64391
* trans-mem.c (get_attrs_for): Return NULL_TREE if X is NULL_TREE.

* gcc.dg/tm/pr64391.c: New test.

From-SVN: r219555

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tm/pr64391.c [new file with mode: 0644]
gcc/trans-mem.c

index 725d7a6ca67d0824c9cdf529f4ac27020c29c117..bdc390302866aa24b1a9d8570e324f21cbc25bd6 100644 (file)
@@ -1,3 +1,8 @@
+2015-01-13  Marek Polacek  <polacek@redhat.com>
+
+       PR middle-end/64391
+       * trans-mem.c (get_attrs_for): Return NULL_TREE if X is NULL_TREE.
+
 2015-01-13  Jakub Jelinek  <jakub@redhat.com>
 
        PR rtl-optimization/64286
index 9fbdbcce144d272364c2c01310d2be978176b059..a40d625e1e2b94d7e89e9799d8322598963300c4 100644 (file)
@@ -1,3 +1,8 @@
+2015-01-13  Marek Polacek  <polacek@redhat.com>
+
+       PR middle-end/64391
+       * gcc.dg/tm/pr64391.c: New test.
+
 2015-01-13  H.J. Lu  <hongjiu.lu@intel.com>
 
        * gcc.dg/tree-ssa/ssa-store-ccp-3.c: Exclude pie when nonpic is
diff --git a/gcc/testsuite/gcc.dg/tm/pr64391.c b/gcc/testsuite/gcc.dg/tm/pr64391.c
new file mode 100644 (file)
index 0000000..235118a
--- /dev/null
@@ -0,0 +1,10 @@
+/* PR middle-end/64391 */
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm" } */
+
+void
+foo (void)
+{
+#pragma GCC ivdep
+  while (1);
+}
index b4497600cc52277adeedf2a303b80d9a99d15d82..21fa497802eab8dc91cc8b40ef649b99613721ae 100644 (file)
@@ -183,6 +183,9 @@ static void *expand_regions (struct tm_region *,
 static tree
 get_attrs_for (const_tree x)
 {
+  if (x == NULL_TREE)
+    return NULL_TREE;
+
   switch (TREE_CODE (x))
     {
     case FUNCTION_DECL:
@@ -191,16 +194,16 @@ get_attrs_for (const_tree x)
 
     default:
       if (TYPE_P (x))
-       return NULL;
+       return NULL_TREE;
       x = TREE_TYPE (x);
       if (TREE_CODE (x) != POINTER_TYPE)
-       return NULL;
+       return NULL_TREE;
       /* FALLTHRU */
 
     case POINTER_TYPE:
       x = TREE_TYPE (x);
       if (TREE_CODE (x) != FUNCTION_TYPE && TREE_CODE (x) != METHOD_TYPE)
-       return NULL;
+       return NULL_TREE;
       /* FALLTHRU */
 
     case FUNCTION_TYPE: