This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [SFN] Bootstrap broken


On Dec 12, 2017, Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> wrote:

> Hi David,
>> Something in this series broke bootstrap on AIX, probably Power in general.

> I'm seeing the same in a sparc-sun-solaris2.11 bootstrap.

The AIX patch, that I've just emailed out in this thread, should fix
that as well.  As for the regression you reported, here's a fix.
Regstrapping; ok to install?


[SFN] don't assume BLOCK_FOR_INSN is set in var-tracking

There's no guarantee that BLOCK_FOR_INSN will be set before var-tracking.
So, keep track of whether we're in the first block header or inside a BB
explicitly, and apply the logic we meant to apply outside BBs only when
we are indeed outside a BB.

for  gcc/ChangeLog

	PR bootstrap/83396
	* var-tracking.c (vt_initialize): Keep track of BB boundaries.
---
 gcc/var-tracking.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c
index 8e500b144712..12158dbb1e0d 100644
--- a/gcc/var-tracking.c
+++ b/gcc/var-tracking.c
@@ -10156,12 +10156,16 @@ vt_initialize (void)
 	  /* If we are walking the first basic block, walk any HEADER
 	     insns that might be before it too.  Unfortunately,
 	     BB_HEADER and BB_FOOTER are not set while we run this
-	     pass.  */
+	     pass.  Unfortunately, BLOCK_FOR_INSN may not be set, so
+	     we can't assume that its being NULL implies we're outside
+	     the basic block.  */
 	  insn = get_first_insn (bb);
+	  bool outside_bb = insn != BB_HEAD (bb);
 	  for (rtx_insn *next;
 	       insn != BB_HEAD (bb->next_bb)
 		 ? next = NEXT_INSN (insn), true : false;
-	       insn = next)
+	       insn = next,
+		 outside_bb = outside_bb && next != BB_HEAD (bb))
 	    {
 	      if (INSN_P (insn))
 		{
@@ -10169,11 +10173,11 @@ vt_initialize (void)
 		  if (!BLOCK_FOR_INSN (insn))
 		    {
 		      BLOCK_FOR_INSN (insn) = bb;
-		      gcc_assert (DEBUG_INSN_P (insn));
+		      gcc_assert (!outside_bb || DEBUG_INSN_P (insn));
 		      /* Reset debug insns between basic blocks.
 			 Their location is not reliable, because they
 			 were probably not maintained up to date.  */
-		      if (DEBUG_BIND_INSN_P (insn))
+		      if (outside_bb && DEBUG_BIND_INSN_P (insn))
 			INSN_VAR_LOCATION_LOC (insn)
 			  = gen_rtx_UNKNOWN_VAR_LOC ();
 		    }


-- 
Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist|Red Hat Brasil GNU Toolchain Engineer


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]