Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.95k stars 554 forks source link

Test suite failures in perl 5.6 on Cray T90 #1839

Closed p5pRT closed 20 years ago

p5pRT commented 24 years ago

Migrated from rt.perl.org#3102 (status was 'resolved')

Searchable as RT3102$

p5pRT commented 24 years ago

From tecmpl1@triton.ca.boeing.com

Created by tecmpl1@triton.ca.boeing.com

I have been trying to get perl 5.6 installed and tested on our Cray T916. I normally expect to have a few problems with a new version of perl because of the rarity of this machine\, but 5.6 has been much more difficult than previous versions.

I started by building perl 5.6 right out of the box with all the recommended defaults. The build ran fine. I did a make test and a perl harness. The summary from perl harness was as follows​:

Failed Test Status Wstat Total Fail Failed List of failed ------------------------------------------------------------------------------- lib/dprof.t 18 1 5.56% 18 op/64bitint.t 48 7 14.58% 23\, 28\, 31\, 34-37 op/bop.t 30 5 16.67% 8-12 op/misc.t 62 1 1.61% 3 op/pack.t 156 1 0.64% 10 op/runlevel.t 20 8 40.00% 2-7\, 10\, 14 pragma/utf8.t 1 256 ?? ?? % ?? pragma/warnings 370 1 0.27% 289 8 tests and 79 subtests skipped. Failed 8/236 test scripts\, 96.61% okay. 24/10025 subtests failed\, 99.76% okay.

That was a bit discouraging\, but I pressed on.

The failures in dprof.t\, runlevel\,t\, utf8.t\, and warnings.t all proved to be caused by a single problem in pp_ctl.c. There appears to be a bug in either the c compiler or the c library. In routine S_docatch\, the variable cursi is declared volatile and defined at line pp_ctl.c​:2566. cursi is then tested at line pp_ctl.c​:2586. It should still have the same value even if S_docatch has been re-entered via a longjmp. Well\, it doesn't. With normal optimization\, cursi is stored in a register. This register should be saved and restored across the setjmp/longjmp. Rather than reduce the optimization for all of perl or modify the makefile to do pp_ctl.c differently\, I fixed the problem by declaring cursi at the front of the module. This causes it to be stored in memory. I need to submit a problem report to Cray\, but I'm not optimistic I can reproduce the problem in a reasonably-sized test case.

Next I noticed that some of the 64-bit tests were failing because of precision problems related to converting to floating point and then back to integer. Adding use integer helped in some cases but caused other tests to be wildly wrong. This is because the otimization known as fastmd restricts integer values to 46 bits. Changing the compiler optimization from -O1 to -h nofastmd fixed this. I would like to recommend that the hints file be changed to reflect this.

After changing to nofastmd\, I was able to get all of 64bitint.t to run correctly by adding use integer to tests 23\, 24\, 28\, and 31. This seems entirely reasonable.

After making these changes\, I rebuilt perl and reran perl harness. The resulting summary was

Failed Test Status Wstat Total Fail Failed List of failed ------------------------------------------------------------------------------- op/bop.t 30 1 3.33% 12 op/misc.t 62 1 1.61% 3 op/pack.t 156 1 0.64% 10 8 tests and 79 subtests skipped. Failed 3/236 test scripts\, 98.73% okay. 3/10085 subtests failed\, 99.97% okay.

My analysis of the remaining failures is as follows​:

Test 12 in bop.t is

print ((($cusp >> 1) == ($cusp / 2) &&   do { use integer; $cusp >> 1 } == -($cusp / 2))   ? "ok 12\n" : "not ok 12\n");

($cusp is 1 \<\< 63)

All I can say about this is I got the test to run by extending the scope of use integer​:

print ((($cusp >> 1) == ($cusp / 2) &&   do { use integer; ($cusp >> 1) == -($cusp / 2)})   ? "ok 12\n" : "not ok 12\n");

Test 3 in misc.t is

use integer; $cusp = ~0 ^ (~0 >> 1); $\, = " "; print +($cusp - 1) % 8\, $cusp % 8\, -$cusp % 8\, ($cusp + 1) % 8\, "!\n";

This seems to be assuming sign extension; i.e.\, $cusp == 0. Well\, a Cray T90 doesn't do sign extension. Instead of the expected result of

-1 0 0 1

I get

7 0 0 -7

My suggestion is to rewrite the test so it doesn't assume sign extension. This may also have something to to with the failure of bop.t test 12.

Test 10 in pack.t is

# check 'w' my $test=10; my @​x = (5\,130\,256\,560\,32000\,3097152\,268435455\,1073741844\,   '4503599627365785'\,'23728385234614992549757750638446'); my $x = pack('w*'\, @​x); my $y = pack 'H*'\, '0581028200843081fa0081bd8440ffffff7f848080801487ffffffffffdb19caefe8e1eeeea0c2e1e3e8ede1ee6e';

print $x eq $y ? "ok $test\n" : "not ok $test\n"; $test++;

The problem concerns the 9th elemnt of @​x\, '4503599627365785'. This is getting converted to floating point and back to integer. The number is now 4503599627365776. The encoding is being done correctly\, but it has the wrong argument. The result is ....fffffdb10..... instead of .....fffffdb19..... Some code in pp_pack which caused the second branch of 'w' processing ('decimal string arithmetics') to be used has been removed. The first branch (pp.c​:4752 - 4763) is now being used instead. The test at pp.c​:4745 - 4751 needs to be modified somehow to reinstate the previous behavior.

As an aside\, I tried enabling long doubles. This resulted in many additional test failures. The precision in many cases seemed to be worse rather than better. I may tackle this problem at some point in the future.

Perl Info ``` Flags: category=core severity=medium Site configuration information for perl v5.6.0: Configured by tecmpl1 at Thu Apr 13 13:53:50 PDT 2000. Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration: Platform: osname=unicos, osvers=10.0.0.6, archname=CRAY_TS-unicos uname='sn7109 triton 10.0.0.6 tec.19 cray ts ' config_args='-Dprefix=/i/tec/tecmpl1 -des' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef useperlio=undef d_sfio=undef uselargefiles=define use64bitint=define use64bitall=define uselongdouble=undef usesocks=undef Compiler: cc='cc', optimize='-h nofastmd', gccversion= cppflags='' ccflags ='' stdchar='unsigned char', d_stdstdio=define, usevfork=false intsize=8, longsize=8, ptrsize=8, doublesize=8 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 ivtype='int', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, usemymalloc=n, prototype=define Linker and Libraries: ld='ld', ldflags ='' libpth=/lib /usr/lib libs=-lnsl -lmalloc -lc -lcrypt libc=/lib/libc.a, so=so, useshrplib=false, libperl=libperl.a Dynamic Linking: dlsrc=dl_none.xs, dlext=none, d_dlsymun=undef, ccdlflags='' cccdlflags='', lddlflags='' Locally applied patches: @INC for perl v5.6.0: /i/tec/tecmpl1/lib/perl5/5.6.0/CRAY_TS-unicos /i/tec/tecmpl1/lib/perl5/5.6.0 /i/tec/tecmpl1/lib/perl5/site_perl/5.6.0/CRAY_TS-unicos /i/tec/tecmpl1/lib/perl5/site_perl/5.6.0 /i/tec/tecmpl1/lib/perl5/site_perl/5.005/CRAY_TS-unicos /i/tec/tecmpl1/lib/perl5/site_perl/5.005 /i/tec/tecmpl1/lib/perl5/site_perl . Environment for perl v5.6.0: HOME=/i/tec/tecmpl1 LANG (unset) LANGUAGE (unset) LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/i/tec/tecmpl1/bin:/bin:/usr/bin:/usr/bin/X11:/usr/lbin:/usr/ucb:/usr/lib/msg:/local/bin:/local/usr/bin:/local/tools:/local/tec/bin:/i/tec/tecwjm1/bin:/i/tec/tecjbg1/nqsched:/i/tec/tecjbg1/bin:/u/help/psuplib/cmedit PERL_BADLANG (unset) SHELL=/bin/csh ```
p5pRT commented 24 years ago

From [Unknown Contact. See original ticket]

At 20​:21 +0000 2000-04-14\, Mark P Lutz wrote​:

Rather than reduce the optimization for all of perl or modify the makefile to do pp_ctl.c differently\, I fixed the problem by declaring cursi at the front of the module.

You can have Configure arrange for specific source files to get particular compile flags\, so you can reduce the amount of optimization only for problematic files​: see hints/machten.sh for an example of flags specific to malloc.c.

This is because the otimization known as fastmd restricts integer values to 46 bits. Changing the compiler optimization from -O1 to -h nofastmd fixed this. I would like to recommend that the hints file be changed to reflect this.

That too could be done with compile flags specific to the guilty source files\, but\, yes\, having the hints change the flag globally is probably a better idea because the problem's likely to affect add-on modules too.

Please feel free to submit a patch for the hints. While you're there\, I note that (the anonymously contributed) hints/unicos.sh says

'') # The perl malloc.c SHOULD work says Ilya.   # But for the time being (5.004_68)\, alas\, it doesn't.

You might want to try playing around with that as I did in hints/machten.sh​: it took some effort to make things work\, but when I did\, it was a big win. (Not that Unicos can possibly have as expensive a system malloc as Mac OS\, MachTen's host. Can it?)

p5pRT commented 20 years ago

From The RT System itself

all the difficulties should be fixed in the developer-only 5.7.0 release\, and hopefully will be fixed in the upcoming 5.6.1 release