public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Remove unreachable code from get_ref_base_and_extent
@ 2016-02-04 19:51 Jakub Jelinek
  2016-02-04 21:56 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2016-02-04 19:51 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc-patches

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Remove unreachable code from get_ref_base_and_extent
  2016-02-04 19:51 [PATCH] Remove unreachable code from get_ref_base_and_extent Jakub Jelinek
@ 2016-02-04 21:56 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2016-02-04 21:56 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-02-04 21:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-04 19:51 [PATCH] Remove unreachable code from get_ref_base_and_extent Jakub Jelinek
2016-02-04 21:56 ` Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).