Closed Bug 307589 Opened 19 years ago Closed 16 years ago

dtoa fails for OPT on AIX

Categories

(NSPR :: NSPR, defect)

4.6.1
Other
AIX
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: jason.m.reid, Assigned: wtc)

Details

dtoa only fails on OPT on AIX.
> grep dtoa *AIX*summary
hbombaix.1-AIX5.1_DBG.OBJ-.summary:dtoa                 Passed
hbombaix.2-AIX5.1_OPT.OBJ-.summary:dtoa                 FAILED
hbombaix.3-AIX5.1_64_DBG.OBJ-.summary:dtoa                      Passed
hbombaix.4-AIX5.1_64_OPT.OBJ-.summary:dtoa                      FAILED

> ./dtoa
Failed to convert numeric value
-18670000000000000620096553168400000000000000000000000000000000000000000000.000000
1.867e+73
Failed to convert numeric value -0.000000 1.867e-73
Failed to convert numeric value -INF Infinity
Failed to convert numeric value -0.000000 1.0000000001e-21
FAILED 

I surmise a compiler bug here. Compiler version is
" C for AIX, Version 5.0"
Jason, what version of NSPR is this?

mozilla/nsprpub/pr/src/misc/prdtoa.c used to contain
improper C code that breaks under compiler optimizations
that take advantage of C's strict aliasing rules.  I
fixed that in CVS revision 3.10 of that file (bug 175668),
or NSPR 4.3.  In CVS revision 4.1 (NSPR 4.6) of that file,
I upgraded it to the latest version (that file is third-party
code) (bug 108305).  The latest version of that file should
not have the pointer aliasing bug.

Philip, do you know what's the AIX compiler flag to disable
strict ANSI aliasing rules? Is it -qalias=noansi?  Is
  #pragma options noansialias
still supported?
NSPR 4.6.1 BETA is what I got from libnspr.so.
Because of this and many other issues, we have been building all of our 
optimized Mozilla builds with '-qalias=noansi' for a while. I remember there 
were table layout bugs and also crashes in JavaScript, NSPR, and the XPCOM 
xptcall code if we didn't disable strict aliasing.

It would be a good test to build NSPR with strict aliasing enabled, and try to 
run this test again on a more recent level of the compiler.
I checked out NSPR trunk and built it with --enable-optimize --disable-debug, 
and I am not getting the dtoa crash. This is with vacpp 6.0.0.3. I do get 
other failures in other testcases however.
Jason, if you don't know how to build NSPR, could you
ask Christophe to temporarily do NSPR optimized builds
on AIX with these configure options and see if dtoa will
pass?

--disable-debug --enable-optimize="-O --qalias=noansi"

The change is to add ="-O --qalias=noansi" to the
--enable-optimize option.

Philip, thanks for running the tests.  Note that the dtoa
problem reported in this bug is a test failure, not a crash.
Some of the NSPR tests are very picky on the environment or
are broken, so having a small number of test failures may be
okay.  You need to compare the test results with the test
results of a build in which -qalias=noansi was used.
Jason, I made a mistake.  The configure options should be

--disable-debug --enable-optimize="-O -qalias=noansi"

Note that there should be only one - before qalias.
Christophe, can you try this in the AIX build for NSPR?
Build:
xlc_r -o dtoa.o -c      -qro -qroconst -O -qalias=noansi   -UDEBUG  -DNDEBUG=1 -DXP_UNIX=1 -DAIX=1 -DSYSV=1 -DAIX_HAVE_ATOMIC_OP_H=1 -DAIX_TIMERS=1 -D_PR_HAVE_OFF64_T=1 -DAIX4_3_PLUS=1 -DHAVE_SOCKLEN_T=1 -DHAVE_FCNTL_FILE_LOCKING=1 -DHAVE_LCHOWN=1 -DHAVE_STRERROR=1 -DHAVE_POINTER_LOCALTIME_R=1 -D_PR_HAVE_THREADSAFE_GETHOST=1  -DFORCE_PR_LOG -D_PR_PTHREADS -UHAVE_CVAR_BUILT_ON_SEM -D_PR_INET6 -I/home/chravel/security/securitytip/ws/mozilla/security/nss/../../dist/AIX5.1_OPT.OBJ/include -I../../../pr/include -I../../../pr/include/private  /home/chravel/security/securitytip/ws/mozilla/nsprpub/AIX5.1_OPT.OBJ/pr/tests/../../../pr/tests/dtoa.c
xlc_r  dtoa.o -blibpath:/home/chravel/security/securitytip/ws/mozilla/security/nss/../../dist/AIX5.1_OPT.OBJ/lib:/usr/lib:/lib -brtl -L/home/chravel/security/securitytip/ws/mozilla/security/nss/../../dist/AIX5.1_OPT.OBJ/lib -lplc4 -L/home/chravel/security/securitytip/ws/mozilla/security/nss/../../dist/AIX5.1_OPT.OBJ/lib -lnspr4 -ldl -o dtoa

Test:

$ ./runtests.sh

NSPR Test Results - tests

BEGIN                   Fri Apr 21 15:45:57 PDT 2006
NSPR_TEST_LOGFILE       output.log

Test                    Result

accept                  Passed
acceptread                      Passed
acceptreademu                   Passed
affinity                        Passed
alarm                   Passed
anonfm                  Passed
atomic                  Passed
attach                  Passed
bigfile                 Passed
cleanup                 Passed
cltsrv                  Passed
concur                  Passed
cvar                    Passed
cvar2                   Passed
dlltest                 Passed
dtoa                    Passed
errcodes                        Passed
exit                    Passed
fdcach                  Passed
fileio                  Passed
foreign                 Passed
formattm                        Passed
fsync                   Passed
gethost                 Passed
getproto                        Passed
i2l                     Passed
initclk                 Passed
inrval                  Passed
instrumt                        Passed
intrio                  Passed
intrupt                 Passed
io_timeout                      Passed
ioconthr                        Passed
join                    Passed
joinkk                  Passed
joinku                  Passed
joinuk                  Passed
joinuu                  Passed
layer                   Passed
lazyinit                        Passed
libfilename                     Passed
lltest                  Passed
lock                    Passed
lockfile                        Passed
logger                  Passed
many_cv                 Passed
multiwait                       Passed
nameshm1                        FAILED
nblayer                 Passed
nonblock                        Passed
ntioto                  Passed
ntoh                    Passed
op_2long                        Passed
op_excl                 Passed
op_filnf                        Passed
op_filok                        Passed
op_nofil                        Passed
parent                  Passed
peek                    Passed
perf                    Passed
pipeping                        Passed
pipeping2                       Passed
pipeself                        Passed
poll_nm                 Passed
poll_to                 Passed
pollable                        Passed
prftest                 Passed
primblok                        Passed
provider                        Passed
prpollml                        Passed
ranfile                 Passed
randseed                        Passed
rwlocktest                      Passed
sel_spd                 Passed
selct_er                        Passed
selct_nm                        Passed
selct_to                        Passed
selintr                 Passed
sema                    Passed
semaerr                 Passed
semaping                        Passed
sendzlf                 Passed
server_test                     Passed
servr_kk                        Passed
servr_uk                        Passed
servr_ku                        Passed
servr_uu                        Passed
short_thread                    Passed
sigpipe                 Passed
socket                  FAILED
sockopt                 Passed
sockping                        Passed
sprintf                 Passed
stack                   Passed
stdio                   Passed
str2addr                        Passed
strod                   Passed
switch                  Passed
system                  Passed
testbit                 Passed
testfile                        Passed
threads                 Passed
timemac                 Passed
timetest                        Passed
tpd                     Passed
udpsrv                  Passed
vercheck                        Passed
version                 Passed
writev                  Passed
xnotify                 Passed
zerolen                 Passed
END                     Fri Apr 21 15:55:40 PDT 2006
QA Contact: wtchang → nspr
I don't have access to an AIX machine.  IBM compilers
are well-known for optimizing aggressively, so I guess
this bug is caused by the strict aliasing issues in
prdtoa.c that were recently uncovered by gcc 4.4.  They
have been fixed in bug 439144 comment 27.
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → WONTFIX
Target Milestone: --- → 4.8
You need to log in before you can comment on or make changes to this bug.