From: Marek Polacek Date: Mon, 20 Feb 2017 15:05:53 +0000 (+0000) Subject: re PR middle-end/79537 (ICE in gimplify_expr, at gimplify.c:12009) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=80480ceee903c0f55d23995b7ae0a58fee2e7f43;p=gcc.git re PR middle-end/79537 (ICE in gimplify_expr, at gimplify.c:12009) PR middle-end/79537 * gimplify.c (gimplify_expr): Handle unused *&&L;. * gcc.dg/comp-goto-4.c: New. From-SVN: r245604 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a14d091a88d..ab2e544d6d2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2017-02-20 Marek Polacek + + PR middle-end/79537 + * gimplify.c (gimplify_expr): Handle unused *&&L;. + 2017-02-20 Jakub Jelinek PR target/79568 diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 1b9c8d23f1a..820459c4dd7 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -11976,8 +11976,11 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, if (fallback == fb_none && *expr_p && !is_gimple_stmt (*expr_p)) { /* We aren't looking for a value, and we don't have a valid - statement. If it doesn't have side-effects, throw it away. */ - if (!TREE_SIDE_EFFECTS (*expr_p)) + statement. If it doesn't have side-effects, throw it away. + We can also get here with code such as "*&&L;", where L is + a LABEL_DECL that is marked as FORCED_LABEL. */ + if (TREE_CODE (*expr_p) == LABEL_DECL + || !TREE_SIDE_EFFECTS (*expr_p)) *expr_p = NULL; else if (!TREE_THIS_VOLATILE (*expr_p)) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c821a842c73..bbe7ac9a4a4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-02-20 Marek Polacek + + PR middle-end/79537 + * gcc.dg/comp-goto-4.c: New test. + 2017-02-20 Jakub Jelinek PR target/79568 diff --git a/gcc/testsuite/gcc.dg/comp-goto-4.c b/gcc/testsuite/gcc.dg/comp-goto-4.c new file mode 100644 index 00000000000..51a6a867706 --- /dev/null +++ b/gcc/testsuite/gcc.dg/comp-goto-4.c @@ -0,0 +1,21 @@ +/* PR middle-end/79537 */ +/* { dg-do compile } */ +/* { dg-options "" } */ +/* { dg-require-effective-target indirect_jumps } */ +/* { dg-require-effective-target label_values } */ + +void +f (void) +{ +L: + *&&L; +} + +void +f2 (void) +{ + void *p; +L: + p = &&L; + *p; /* { dg-warning "dereferencing 'void \\*' pointer" } */ +}