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]

[PATCH] middle-end/23155 ICE with union cast and array subscriptting


The problem here is just like what was in PR 17855, in that C99 allows non lvalue array
subscripting but says assigning to it is undefined at runtime.  So we have an
union cast and that union has an array so we allow array subscriptting (as C99 says
it is allowed and having it not allowed in this case would be inconstaint even though
union cast is an extension).  So we just create a variable to hold the CONSTRUCTOR
if we need a lvalue in the gimplifier, just like PR 17855.


OK? Bootstrapped and tested on x86_64-pc-linux-gnu with no regressions.

I added three tests as we currently ICE in pedantic-error mode currently
also.

Thanks,
Andrew Pinski

ChangeLog:
	* gimplifier.c (gimplify_expr): Create a temporary for lvalue
	CONSTRUCTOR.

testsuite/ChangeLog:

	* gcc.dg/union-cast-1.c: New test.
	* gcc.dg/union-cast-2.c: New test.
	* gcc.dg/union-cast-3.c: New test.


Attachment: fixPR23155.diff.txt
Description: ASCII C program text


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