Fix mode checks in var-tracking.c

Richard Sandiford rdsandiford@googlemail.com
Thu Oct 22 21:40:00 GMT 2009


As Jakub pointed out, my recent wrap_constant pass removed some
XPASSes in the guality.exp testsuite.  This is a repost of the
patch I suggested there, having now bootstrapped & regression-tested
it on x86_64-linux-gnu.  The idea is to check the mode of the
original variable location (which is documented as being a
VALUE, MEM or REG) instead of the expanded version, which could
be a CONST_INT.  In the second hunk, I moved the mode check above
the call to vt_expand_loc, since it's far cheaper.

The "after" results for this patch were exactly the same as the "before"
results, which wasn't what I was hoping.  By rights, the XPASSes should
have reappeared.  I looked at the logs again, and it seems many of the
guality.exp tests are failing for me when run from a normal -j5 top-level
"make check".  E.g. I get:

FAIL: b is not computable, expected 3003
FAIL: ab is not computable, expected 6296328
FAIL: ac is not computable, expected 6296332
FAIL: msg is not computable, expected 4198085
FAIL: 0 PASS, 4 FAIL, 0 UNRESOLVED
XFAIL: gcc.dg/guality/inline-params.c  -Os  execution test

both before and after the patch.  (This is one of the tests that my
patch regressed.  The other regressing tests have similar output.)

I went back and looked at my logs for the wrap_constant patch,
and saw the same thing.  So I hadn't missed the dropped XPASSes
after all; they never were XPASSes in my results to begin with.
I had to run the guality.exp separately, which is what I did when
looking at Jakub's original bug report.  The tests do XPASS after
the patch when run individually, and do fail before the patch
when run in the same way.

My guess is that I'm hitting some problem that causes the underlying gdb
session to fail in some unreported way.  But some tests do XPASS for me
even in the normal results, and that list of XPASSes has been consistent
over several runs.  So it does seem to be deterministic.

OK to install?

Richard


gcc/
	* var-tracking.c (emit_note_insn_var_location): Get the mode of
	a variable part from its REG, MEM or VALUE.

Index: gcc/var-tracking.c
===================================================================
--- gcc/var-tracking.c	2009-10-22 19:20:19.000000000 +0100
+++ gcc/var-tracking.c	2009-10-22 19:20:54.000000000 +0100
@@ -6402,7 +6402,7 @@ emit_note_insn_var_location (void **varp
 	  continue;
 	}
       loc[n_var_parts] = loc2;
-      mode = GET_MODE (loc[n_var_parts]);
+      mode = GET_MODE (var->var_part[i].loc_chain->loc);
       initialized = var->var_part[i].loc_chain->init;
       last_limit = offsets[n_var_parts] + GET_MODE_SIZE (mode);
 
@@ -6413,9 +6413,9 @@ emit_note_insn_var_location (void **varp
 	  break;
       if (j < var->n_var_parts
 	  && wider_mode != VOIDmode
+	  && mode == GET_MODE (var->var_part[j].loc_chain->loc)
 	  && (loc2 = vt_expand_loc (var->var_part[j].loc_chain->loc, vars))
 	  && GET_CODE (loc[n_var_parts]) == GET_CODE (loc2)
-	  && mode == GET_MODE (loc2)
 	  && last_limit == var->var_part[j].offset)
 	{
 	  rtx new_loc = NULL;



More information about the Gcc-patches mailing list