On Wed, 22 Jun 2005, Andy Dougherty wrote:

> On Wed, 22 Jun 2005, Paul Johnson wrote:
> 
> > On Tue, Jun 21, 2005 at 07:50:35PM +0200, Salvador Fandino wrote:
> > 
> > > I have not been able to reproduce the bug on any perl compiled by 
> > > myself, but anyway, I am sure the problem is caused by the nasty macro 
> > > SORTHINTS(hintsv), that relays on the evaluation order of something like
> > > 
> > >    result = (v = foo(), bar(v));
> > > 
> > > The patch attached breaks the macro in two: dSORTHINTS and SORTHINTS, 
> > > they do the same operation but in two steps.
> > 
> > I think the evaulation order here is quite well defined but, of course,
> > perl has a fine tradition of working around broken compilers.
> > 
> > > -    /*  Sun's Compiler (cc: WorkShop Compilers 4.2 30 Oct 1996 C 4.2) 
> > > used 
> > > - to miscompile this function under optimization -O.  If you get test 
> > > - errors related to picking the correct sort() function, try recompiling 
> > > - this file without optimiziation.  -- A.D.  4/2002.
> > > -    */
> > 
> > So yes, hopefully this is fixed too but it would be interesting to hear
> > from someone who can test under this compiler.
> 
> That'd be me.  What, precisely, would you like me to test?  I haven't had 
> any recent problems with that compiler under -O, so as far as I know, but 
> I haven't compiled bleadperl for a few weeks.

Ok, I've looked at the RT ticket now.  Yes, this patch works fine for me
with Sun's old compiler.  (It was also working fine without the patch, but 
that's ok.  The patch didn't break anything!)

My original problem also had to do with embedding SORTINTS(hintsv) inside 
an if() statement.  My solution back in 2002 was to break it out as two 
separate steps.  Then the optimizer didn't get confused.  (This is Change 
#15911.) 

     I32 hints = SORTHINTS(hintsv);
     if (hints & HINT_SORT_QUICKSORT)  ...

This patch looks similar in spirit to me and is probably fine.

-- 
    Andy Dougherty              [EMAIL PROTECTED]

Reply via email to