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]

[vta, 4.4] terminate FOR_EACH_IMM_USE_FAST with NULL_USE_OPERAND_P in DEST


I've ran into various compare-debug failures, in the compiler proper
and in libjava, because tree-ssa-sink would move some stmts right
before debug stmts.

The reason was that the DEF had only DEBUG uses left at that point
(therefore, I thought, it would to be eliminated shortly), but
FOR_EACH_IMM_USE_FAST in statement_sink_location() would complete with
one_use == NULL_USE_OPERAND_P in the -g0 case, and with the debug stmt
in the -g case, because next_readonly_imm_use() inexplicably (to me)
returns the last use_operand_p twice, instead of following the example
of the various other next*imm* iterating functions and returning NULL.

Because the iteration variable holds the same value, it can't be used
to distinguish breaking out of the loop from reaching the end of the
sequence.  I couldn't find any code that cared about getting the same
final value for the two cases, so I figured I'd fix it.

I'm installing this in the vta branch.

for  gcc/ChangeLog.vta
from  Alexandre Oliva  <aoliva@redhat.com>

	* tree-flow-inline.h (next_readonly_imm_use): Return
	NULL_USE_OPERAND_P after the end.

Index: gcc/tree-flow-inline.h
===================================================================
--- gcc/tree-flow-inline.h.orig	2008-01-06 08:28:34.000000000 -0200
+++ gcc/tree-flow-inline.h	2008-01-07 06:08:47.000000000 -0200
@@ -516,7 +516,7 @@ next_readonly_imm_use (imm_use_iterator 
 
   imm->imm_use = old->next;
   if (end_readonly_imm_use_p (imm))
-    return old;
+    return NULL_USE_OPERAND_P;
   return imm->imm_use;
 }
 

-- 
Alexandre Oliva         http://www.lsd.ic.unicamp.br/~oliva/
FSF Latin America Board Member         http://www.fsfla.org/
Red Hat Compiler Engineer   aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist  oliva@{lsd.ic.unicamp.br, gnu.org}

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