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 PR 23402, ICE with zero sized structs



On Aug 25, 2005, at 6:38 PM, Alan Modra wrote:


On Thu, Aug 25, 2005 at 01:14:54AM -0700, Richard Henderson wrote:
On Thu, Aug 25, 2005 at 02:29:38PM +0930, Alan Modra wrote:
-  if (zero_sized_type (type))
+  if (!TREE_SIDE_EFFECTS (*from_p) && zero_sized_type (type))
     {
       *expr_p = NULL_TREE;

You can write


  if (zero_sized_type (type))
    {
      *expr_p = (TREE_SIDE_EFFECTS (*from_p) ? *from_p : NULL);

Um, this variation results in
va-arg-22.c:46: internal compiler error: in gimplify_expr, at gimplify.c:4441


Since this was caused by me and Alan did not know the gimplifier that
much, I was asked to fix this. There were two problems with my original
patch. First I put it in the wrong function; I should have put the check
in gimplify_modify_expr but I put it in gimplify_modify_expr_rhs. The second
issue is that I totally forgot about side effects, which I fixed by gimplifing
the left and right hand side as statements and then adding the result. I added
a new test to test that we don't remove the side effects.


OK? Bootstrapped and tested on both powerpc-linux-gnu and x86_64-linux-gnu
with no regressions and fixes va-arg-22.c on ppc-linux-gnu.


Thanks,
Andrew Pinski

ChangeLog:
PR middle-end/23463
* gimplify.c (gimplify_modify_expr_rhs): Remove check for zero sized types.
(gimplify_modify_expr): Check for zero sized types and gimplify the rhs and
lhs as statements.


testsuite/ChangeLog:
	PR middle-end/23463
	* gcc.c-torture/execute/zero-struct-1.c: New test.



Attachment: fixPR23463.diff.txt
Description: Text document


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