lilypond-devel
[Top][All Lists]
Advanced

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

Re: Lilypond miscompiled on Fedora 17


From: David Kastrup
Subject: Re: Lilypond miscompiled on Fedora 17
Date: Sat, 05 May 2012 07:53:08 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux)

Pavel Roskin <address@hidden> writes:

> Quoting David Kastrup <address@hidden>:
>
>> Pavel Roskin <address@hidden> writes:
>>
>>> Quoting David Kastrup <address@hidden>:
>>>
>>>> That would have been my most likely guess.  Probably the "min" function
>>>> call.
>>>
>>> You are absolultely right!  I was able to work around the gcc bug by
>>> making a separate function for Moment comparison and using it instead
>>> of min():
>>>
>>> Moment
>>> min_moment (Moment m1, Moment m2)
>>> {
>>>   return min (m1, m2);
>>> }
>>
>> What happens if you declare this
>>
>> (Moment const &m1, Moment const &m2)
>
> The bug is present ("moving back in time")
>
> I tried all combinations:
>
> (Moment m1, Moment m2) - OK
> (Moment m1, Moment const &m2) - OK
> (Moment const &m1, Moment m2) - Bad
> (Moment const &m1, Moment const &m2) - Bad

It would seem like a lifetime problem: maybe GCC gives up on the
existence of the first Moment underlying the reference parameter once it
has done the comparison.  I don't think that's a valid optimization.
And the generated code certainly makes no sense.

> Maybe the produced code is not interested in the result because the
> original value of next is infinite and gcc think that the comparison
> only happens once per call?  But then it would not call the compare
> method.
>
> Let me try to find the exact optimization flag responsible for the
> breakage.

-- 
David Kastrup




reply via email to

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