bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] Memory corruption after asort() in gawk 4.1.0 on Solaris


From: Joakim Östlund XO
Subject: Re: [bug-gawk] Memory corruption after asort() in gawk 4.1.0 on Solaris 10
Date: Wed, 7 Aug 2013 07:28:57 +0000

Hi,

I should have checked the compiler optimizations, sorry about that.

We are using gcc 3.4.6 on both Solaris and Linux targets, and the build works 
fine for Linux.
I did some checking of the optimization flags, and setting -O1 made the problem 
go away.

Further checking of individual flags in the delta between -O1 and -O2 showed 
that it was -fschedule-insns2 that caused the problem.
Building with -O2 -fno-schedule-insns2 works as expected.
For some reason, manually running -O1 and -fschedule-insns2 causes a compile 
error stating that there are no registers available to be used for scheduling:

io.c:2564: error: unable to find a register to spill in class `AREG'

This is present even when running -O1 + all flags added by -O2, so it seems 
that gcc silently fails on -O2 and generates invalid code.
I have looked for existing bug reports on gcc for this, but they all seem to 
come down to either incorrect code (aliasing violations) or an ARM specific bug 
in the 4.x series.

I would have liked to test with a newer gcc version on Solaris, but 
unfortunately that will not be possible in the near future.

I guess we will have to use -fno-schedule-insns2 as a workaround for now.

// J

-----Original Message-----
From: Aharon Robbins [mailto:address@hidden 
Sent: den 7 augusti 2013 06:02
To: Joakim Östlund XO; address@hidden
Cc: address@hidden
Subject: Re: [bug-gawk] Memory corruption after asort() in gawk 4.1.0 on 
Solaris 10

Hi.

Andy's questions are all on target.  I agree there should be no
difference between the two statements.

Please let us know more details.

Thanks,

Arnold

> Date: Tue, 6 Aug 2013 14:28:55 -0400
> From: "Andrew J. Schorr" <address@hidden>
> To: Joakim ?stlund XO <address@hidden>
> Cc: "address@hidden" <address@hidden>
> Subject: Re: [bug-gawk] Memory corruption after asort() in gawk 4.1.0 on
>  Solaris 10
>
> Hi,
>
> On Tue, Aug 06, 2013 at 07:55:43AM +0000, Joakim ?stlund XO wrote:
> > After some experimentation, we managed to narrow the issue down to line 919 
> > of array.c:
> > 
> > *array = *result; /* copy result into array */
> > 
> > If this line is replaced with "memcpy(array, result, sizeof(NODE));", the 
> > problem disappears.
> > I have looked at the source for gawk 4.0.1, and this part of the code is 
> > identical, but I also noticed that the implementation of freenode() has 
> > been changed, which might be the root cause here.
>
> Perhaps I am being idiotic, but it appears to me that those statements should
> do the same thing.  The only reasons I can imagine for an error when using the
> direct assignment vs memcpy are an alignment problem, or a compiler bug.  Are
> you using gcc on Solaris?  Is it the same version that works OK on Linux?  Do
> you have the same problem if you disable all compiler optimizations?
>
> Regards,
> Andy



reply via email to

[Prev in Thread] Current Thread [Next in Thread]