From 02d472a2cb30a5692a57b2fc021b2fa043c84213 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 11 Mar 2016 13:05:58 +0100 Subject: [PATCH] re PR tree-optimization/70169 (ICE at -O1 and above on x86_64-linux-gnu in gen_lsm_tmp_name, at tree-ssa-loop.c:791) PR tree-optimization/70169 * tree-ssa-loop.c (gen_lsm_tmp_name): Handle FUNCTION_DECL and LABEL_DECL like VAR_DECL. Emit nothing instead of gcc_unreachable for unknown codes. * gcc.dg/pr70169.c: New test. From-SVN: r234136 --- gcc/ChangeLog | 7 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr70169.c | 40 ++++++++++++++++++++++++++++++++++ gcc/tree-ssa-loop.c | 6 ++--- 4 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pr70169.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9c92d9bb236a..171a52d1ec8c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-03-11 Jakub Jelinek + + PR tree-optimization/70169 + * tree-ssa-loop.c (gen_lsm_tmp_name): Handle FUNCTION_DECL and + LABEL_DECL like VAR_DECL. Emit nothing instead of gcc_unreachable + for unknown codes. + 2016-03-11 Ilya Enkovich Jakub Jelinek diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f850e462aab9..75fe4ac519b8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-03-11 Jakub Jelinek + + PR tree-optimization/70169 + * gcc.dg/pr70169.c: New test. + 2016-03-11 Ilya Enkovich PR target/70160 diff --git a/gcc/testsuite/gcc.dg/pr70169.c b/gcc/testsuite/gcc.dg/pr70169.c new file mode 100644 index 000000000000..8d08f5c64722 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr70169.c @@ -0,0 +1,40 @@ +/* PR tree-optimization/70169 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-strict-aliasing -fno-tree-dce" } */ + +int printf (const char *, ...); + +void +foo () +{ + unsigned char *p = (unsigned char *) &printf; + for (;;) + (*p)++; +} + +void +bar (int x) +{ + unsigned char *p = (unsigned char *) &printf; + int i; + for (i = 0; i < x; i++) + (*p)++; +} + +void +baz (int x, int y) +{ + unsigned char *p = (unsigned char *) &&lab; + int i; + if (y) + { + for (i = 0; i < x; i++) + (*p)++; + } + else + { + lab: + asm volatile (""); + foo (); + } +} diff --git a/gcc/tree-ssa-loop.c b/gcc/tree-ssa-loop.c index 4c39fbc8cc39..06354e39e78a 100644 --- a/gcc/tree-ssa-loop.c +++ b/gcc/tree-ssa-loop.c @@ -769,6 +769,8 @@ gen_lsm_tmp_name (tree ref) case SSA_NAME: case VAR_DECL: case PARM_DECL: + case FUNCTION_DECL: + case LABEL_DECL: name = get_name (ref); if (!name) name = "D"; @@ -784,11 +786,9 @@ gen_lsm_tmp_name (tree ref) break; case INTEGER_CST: + default: /* Nothing. */ break; - - default: - gcc_unreachable (); } }