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] Fix miscompilation of initializers with flexible array members (regression from 3.4, PR tree-optimization/22043, take 2)


On Mon, Jun 13, 2005 at 06:39:18PM -0400, Jakub Jelinek wrote:
> > I would put the test for "num_type_elements < -1" before the 
> > "num_ctor_elements < num_type_elements" test, as the -1 case is 
> > essentially an exception return from the counting function.
> > 
> > The patch is OK with that change for 4.0.1 and mainline.
> 
> Unfortunately, while the (modified according to your comments) patch
> bootstrapped and caused no regressions on HEAD/i386 and 4.0/ppc64,
> I'm seeing a bootstrap failure on 4.0/s390, where gnatlink gets an ICE
> when linking gnatchop (while gnatlink built without that patch works).
> I would have thought too that the patch is safe, so likely it is just
> triggering some other bug somewhere.
> I'll keep poking tomorrow.

store_constructor ignores clearing for variable sized types, and
Ada is apparently initializing variable-sized objects with constructors.
I did not manage to do that in C or C++, apparently initializers for
variable-sized types are forbidden there.
So, if we can hope that Ada makes sure there are no gaps when initializing
variable-sized types or doesn't care, attached are 2 improved patches
that only set cleared if num_type_elements < 0 for constant-sized objects.

The first one (shorter) has been bootstrapped/regtested on 4.0 branch
on ppc64-linux and s390-linux, the latter on HEAD on i386-linux.
Ok?

	Jakub

Attachment: R16
Description: Text document

Attachment: R3
Description: Text document


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