From 59b8926c6fe2f4320babf3fd7e7d1ca8731e3890 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Tue, 13 Jan 2015 20:22:32 +0000 Subject: [PATCH] re PR middle-end/64391 (ICE: SIGSEGV in get_attrs_for (trans-mem.c:179) with -fgnu-tm and #pragma GCC ivdep) 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 | 5 +++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/tm/pr64391.c | 10 ++++++++++ gcc/trans-mem.c | 9 ++++++--- 4 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/tm/pr64391.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 725d7a6ca67..bdc39030286 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-01-13 Marek Polacek + + PR middle-end/64391 + * trans-mem.c (get_attrs_for): Return NULL_TREE if X is NULL_TREE. + 2015-01-13 Jakub Jelinek PR rtl-optimization/64286 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9fbdbcce144..a40d625e1e2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-01-13 Marek Polacek + + PR middle-end/64391 + * gcc.dg/tm/pr64391.c: New test. + 2015-01-13 H.J. Lu * 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 index 00000000000..235118aa363 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tm/pr64391.c @@ -0,0 +1,10 @@ +/* PR middle-end/64391 */ +/* { dg-do compile } */ +/* { dg-options "-fgnu-tm" } */ + +void +foo (void) +{ +#pragma GCC ivdep + while (1); +} diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c index b4497600cc5..21fa497802e 100644 --- a/gcc/trans-mem.c +++ b/gcc/trans-mem.c @@ -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: -- 2.30.2