This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Remove unreachable code from get_ref_base_and_extent
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Richard Biener <rguenther at suse dot de>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 4 Feb 2016 20:50:58 +0100
- Subject: [PATCH] Remove unreachable code from get_ref_base_and_extent
- Authentication-results: sourceware.org; auth=none
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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?
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