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: [patch] Fix gnat.dg/pack19.adb on some platforms


> :-)  From a cleanup standpoint, I think the expansion code is ripe for
> someone to spend (condsiderable) time killing dead code.  I suspect
> there's still significant gcc-1.91 (or even older) bits in there that
> have been dead for at least a decade.

The existing test was added for Ada a decade ago:
  http://gcc.gnu.org/ml/gcc-patches/2003-10/msg00823.html
but I think that it's obsolete now (at least replacing it with an assert 
doesn't change anything) so I've installed the attached patch.

-- 
Eric Botcazou
Index: expr.c
===================================================================
--- expr.c	(revision 205848)
+++ expr.c	(working copy)
@@ -10157,6 +10157,8 @@ expand_expr_real_1 (tree exp, rtx target
 		if (target == 0)
 		  target = assign_temp (type, 1, 1);
 
+		/* ??? Unlike the similar test a few lines below, this one is
+		   very likely obsolete.  */
 		if (bitsize == 0)
 		  return target;
 
@@ -10177,6 +10179,13 @@ expand_expr_real_1 (tree exp, rtx target
 		return target;
 	      }
 
+	    /* If we have nothing to extract, the result will be 0 for targets
+	       with SHIFT_COUNT_TRUNCATED == 0 and garbage otherwise.  Always
+	       return 0 for the sake of consistency, as reading a zero-sized
+	       bitfield is valid in Ada and the value is fully specified.  */
+	    if (bitsize == 0)
+	      return const0_rtx;
+
 	    op0 = validize_mem (op0);
 
 	    if (MEM_P (op0) && REG_P (XEXP (op0, 0)))

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