Message ID | 20160204195058.GP3017@tucnak.redhat.com |
---|---|
State | New |
Headers | show |
On February 4, 2016 8:50:58 PM GMT+01:00, Jakub Jelinek <jakub@redhat.com> wrote: >Hi! > >As discussed on IRC and in the PR, get_ref_base_and_extent has >a big while (1) which can be only left with goto done;, so code >in between the end of that loop and the done: label is unreachable. >If the base is *MEM_REF, we already set maxsize to -1, and for decls >it really shouldn't be needed, plus we override it afterwards from >DECL_SIZE >anyway. >Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? OK. Thanks, Richard. >2016-02-04 Jakub Jelinek <jakub@redhat.com> > > PR fortran/69368 > * tree-dfa.c (get_ref_base_and_extent): Remove unreachable code. > >--- gcc/tree-dfa.c.jj 2016-01-21 08:58:44.000000000 +0100 >+++ gcc/tree-dfa.c 2016-02-04 12:40:10.514616640 +0100 >@@ -588,15 +588,6 @@ get_ref_base_and_extent (tree exp, HOST_ > exp = TREE_OPERAND (exp, 0); > } > >- /* We need to deal with variable arrays ending structures. */ >- if (seen_variable_array_ref >- && maxsize != -1 >- && (TYPE_SIZE (TREE_TYPE (exp)) == NULL_TREE >- || TREE_CODE (TYPE_SIZE (TREE_TYPE (exp))) != INTEGER_CST >- || (bit_offset + maxsize >- == wi::to_offset (TYPE_SIZE (TREE_TYPE (exp)))))) >- maxsize = -1; >- > done: > if (!wi::fits_shwi_p (bitsize) || wi::neg_p (bitsize)) > { > > Jakub
--- gcc/tree-dfa.c.jj 2016-01-21 08:58:44.000000000 +0100 +++ gcc/tree-dfa.c 2016-02-04 12:40:10.514616640 +0100 @@ -588,15 +588,6 @@ get_ref_base_and_extent (tree exp, HOST_ exp = TREE_OPERAND (exp, 0); } - /* We need to deal with variable arrays ending structures. */ - if (seen_variable_array_ref - && maxsize != -1 - && (TYPE_SIZE (TREE_TYPE (exp)) == NULL_TREE - || TREE_CODE (TYPE_SIZE (TREE_TYPE (exp))) != INTEGER_CST - || (bit_offset + maxsize - == wi::to_offset (TYPE_SIZE (TREE_TYPE (exp)))))) - maxsize = -1; - done: if (!wi::fits_shwi_p (bitsize) || wi::neg_p (bitsize)) {