Discussion:
[perl #37993] [BUG] optimized parrot behaves differently than non-optimized (win32-msvc)
(too old to reply)
Jerry Gay
2005-12-20 18:32:41 UTC
Permalink
# New Ticket Created by jerry gay
# Please include the string: [perl #37993]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/rt3/Ticket/Display.html?id=37993 >


compiling either with msvc 6.0 or 7.1 on win32, parrot behaves
differently wrt 0 vs -0 depending on whether optmizations are enabled.

nmake realclean && svn up && configure.pl && nmake smoke
## passes tests, which expect 0 and not -0

nmake realclean && svn up && configure.pl --optimize && nmake smoke
## fails tests

for example,
- t/op/arithmetics.t

# Failed test (t/op/arithmetics.t at line 213)
# got: '-0.000000
# -0.000000
# -123.456789
# 123.456789
# -0.000000
# -0.000000
# -123.456789
# 123.456789
# '
# expected: '-0.000000
# 0.000000
# -123.456789
# 123.456789
# -0.000000
# 0.000000
# -123.456789
# 123.456789
# '
# Looks like you failed 1 test of 26.

can't debug now as i'm off on holiday, but i'll be back in a week to
have a look if nobody's beaten me to it. please somebody, beat me to
it ;)

also, i thought -0 was correct, and 0 was broken as per the standard.
why are the tests expecting 0 and not -0? why is optimization changing
the results? this smells like a combination of bad tests and bad code
to me.
~jerry
Ron Blaschke
2005-12-22 19:23:32 UTC
Permalink
Post by Jerry Gay
compiling either with msvc 6.0 or 7.1 on win32, parrot behaves
differently wrt 0 vs -0 depending on whether optmizations are enabled.
nmake realclean && svn up && configure.pl && nmake smoke
## passes tests, which expect 0 and not -0
nmake realclean && svn up && configure.pl --optimize && nmake smoke
## fails tests
Quite interesting. Could you please post your CFLAGS and LINKFLAGS
for either configuration?

Thanks,
Ron
James Keenan via RT
2008-06-15 00:15:33 UTC
Permalink
Would it be possible to test Parrot on Win32 non-optimized and optimized
so as to see whether this is still a bug?

Thank you very much.
Jerry Gay
2009-02-05 18:59:36 UTC
Permalink
On Thu, Feb 5, 2009 at 10:44, Reini Urban via RT
Post by James Keenan via RT
Post by James Keenan via RT
Would it be possible to test Parrot on Win32 non-optimized and
optimized
Post by James Keenan via RT
so as to see whether this is still a bug?
This neg -0 => 0 error is observable on msvc and mingw.
It is caused by the msvcrt.dll (aka the libc) for windows and is
therefore parrot and compiler independent.
cygwin is not affected, since newlib has this correct.
We could work around it in the op for neg (DWIM) or keep it
as expected platform semantics.
I would vote for platform unity, and fix the neg -0 case.
+1 for fixing -0 to work the same everywhere.
~jerry

Loading...