develooper Front page | perl.perl5.porters | Postings from April 2013

Re: Blead on s390x

Thread Previous | Thread Next
From:
H.Merijn Brand
Date:
April 7, 2013 12:03
Subject:
Re: Blead on s390x
Message ID:
20130407140328.4ca6f52c@pc09.procura.nl
On Sun, 7 Apr 2013 12:50:25 +0100, Nicholas Clark <nick@ccl4.org> wrote:

> On Sun, Apr 07, 2013 at 01:38:56PM +0200, H.Merijn Brand wrote:
> > On Sun, 7 Apr 2013 12:20:02 +0100, Nicholas Clark <nick@ccl4.org> wrote:
> 
> > > Thanks. So, the special case code in pp_inc works just fine, but the
> > > conversion inside sv_2nv_flags() seems to go wrong.
> > > 
> > > I wonder, what does this C program generate?
> > > 
> > > #include <stdio.h>
> > > 
> > > union u {
> > >     long i;
> > >     unsigned long u;
> > > };
> > > 
> > > int main (int argc, char **argv) {
> > >     union u var;
> > >     double d;
> > >     var.u = ~0;
> > > 
> > >     d = argc ? (double) var.u : (double) var.i;
> > >     printf ("i = %ld, u = %lu, d = %g\n", var.i, var.u, d);
> > >     return 0;
> > > }
> > 
> > i = -1, u = 18446744073709551615, d = 9.22337e+18
> 
> Thanks. I get this
> 
> $ ./a.out
> i = -1, u = 18446744073709551615, d = 1.84467e+19
> 
> So, that's a C compiler or runtime bug, unless I'm much mistaken. And a
> pretty ugly one.
> 
> Is it due to the ternary? (After all, IIRC the AIX compiler didn't like
> bool in ternaries)
> 
> If the test program changes to this:
> 
> #include <stdio.h>
> 
> union u {
>     long i;
>     unsigned long u;
> };
> 
> int main (int argc, char **argv) {
>     union u var;
>     double d;
>     double d1;
>     double d2;
>     unsigned long uv = ~0;
>     var.u = ~0;
> 
>     d = (double) var.u;
>     d1 = (double) uv;
>     d2 = (double) ~0UL;
>     printf("d=%g d1=%g, d2=%g, cast is %g\n", d, d1, d2, (double) ~0UL);
>     return 0;
> }
> 
> 
> does it agree with my local system, or does it think that some of those
> are 9e18?

d=9.22337e+18 d1=9.22337e+18, d2=1.84467e+19, cast is 1.84467e+19

> #11907 Looking for a compiler bug is the strategy of LAST resort.  LAST resort.

test@zdolinux:/perl> gcc --version
gcc (SUSE Linux) 4.3.4 [gcc-4_3-branch revision 152973]
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
test@zdolinux:/perl> as --version
GNU assembler (GNU Binutils; SUSE Linux Enterprise 11) 2.21.1
Copyright 2011 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `s390x-suse-linux'.

> Or 50/50 when it's the perl 5 regression test suite failing.
> 
> Nicholas Clark

-- 
H.Merijn Brand  http://tux.nl   Perl Monger  http://amsterdam.pm.org/
using perl5.00307 .. 5.17   porting perl5 on HP-UX, AIX, and openSUSE
http://mirrors.develooper.com/hpux/        http://www.test-smoke.org/
http://qa.perl.org   http://www.goldmark.org/jeff/stupid-disclaimers/

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About