Front page | perl.perl5.porters |
Postings from April 2013
Re: Blead on s390x
Thread Previous
|
Thread Next
From:
Nicholas Clark
Date:
April 7, 2013 11:50
Subject:
Re: Blead on s390x
Message ID:
20130407115024.GL3729@plum.flirble.org
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?
#11907 Looking for a compiler bug is the strategy of LAST resort. LAST resort.
Or 50/50 when it's the perl 5 regression test suite failing.
Nicholas Clark
Thread Previous
|
Thread Next