This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Fix gnat.dg/pack19.adb on some platforms
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: Jeff Law <law at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 10 Dec 2013 12:06 +0100
- Subject: Re: [patch] Fix gnat.dg/pack19.adb on some platforms
- Authentication-results: sourceware.org; auth=none
- References: <14008801 dot HoYYt5Iu7g at polaris> <9371992 dot rSspWPMAhM at polaris> <52A6AD5E dot 1080506 at redhat dot com>
> :-) 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)))