[Haskell-cafe] Maybe a compiler bug?
Rafael Gustavo da Cunha Pereira Pinto
RafaelGCPP.Linux at gmail.com
Tue Jan 6 05:08:29 EST 2009
Specifically for this code:
gTst3 right left = if (lr > ll) then False else True
where lr = length (right ! 2)
ll = length (left ! 2)
why don't you just negate the condition, like:
gTst3 right left = (lr <= ll)
where lr = length (right ! 2)
ll = length (left ! 2)
2009/1/5 Murray Gross <mgross21 at verizon.net>
>
>
> No unsafe perform (except what may be hidden in trace), nothing, fancy, no
> gimmicks (very pedestrian, even heavy-handed) code. Complete code is
> attached (I don't have smaller snippets, because I just discovered the
> problem).
>
>
>
> Best,
>
> Murray Gross
>
>
>
>
> On Mon, 5 Jan 2009, Luke Palmer wrote:
>
> On Mon, Jan 5, 2009 at 4:34 PM, Murray Gross <mgross21 at verizon.net>
>> wrote:
>>
>>
>>> When using any of -O, -O1, -O2 with the Debian binary build of GHC 6.6,
>>> trace shows that the expression
>>>
>>> if (lr > ll) then False else True
>>>
>>> is (at least partially) evaluated, but the value returned is always True,
>>> even though trace reports that (lr > ll) is True. When I use only the
>>> native
>>> code generator (without optimization), the correct value (False) is
>>> returned.
>>>
>>> Further detail and complete code on request.
>>>
>>
>>
>> Of course! This is obviously incorrect behavior. Are you doing any
>> unsafePerformIO? Please, complete code (minimal test case if possible,
>> but
>> don't let that stop you).
>>
>> Luke
>>
>>
>>
>>
>>
>>>
>>> Best,
>>>
>>> Murray Gross
>>> _______________________________________________
>>> Haskell-Cafe mailing list
>>> Haskell-Cafe at haskell.org
>>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>>
>>>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
--
Rafael Gustavo da Cunha Pereira Pinto
Electronic Engineer, MSc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090106/0d68d124/attachment.htm
More information about the Haskell-Cafe
mailing list