After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 652560 - Test for g_ascii_strtod is failing
Test for g_ascii_strtod is failing
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
2.29.x
Other Solaris
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2011-06-14 13:15 UTC by Dagobert Michelsen
Modified: 2011-11-30 17:25 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Don't abort if g_ascii_strtod tests fail (1.74 KB, patch)
2011-11-30 03:55 UTC, Matthias Clasen
committed Details | Review

Description Dagobert Michelsen 2011-06-14 13:15:05 UTC
Hi,

I am compiling glib 2.29.6 on Solaris 9 Sparc with Sun Studio 12 and get the following failing test:

...
  /strfuncs/strsplit-set:                                              OK
  /strfuncs/strv-length:                                               OK
  /strfuncs/strtod:                                                    
** ERROR **: g_ascii_strtod on "0xa.b" for locale sv_SE failed
expected 10.687500 (nan 0) actual 0.000000 (nan 0)

FAIL
GTester: last random seed: R02Se204602229b501ff9954ce78cae4da21
gmake[6]: *** [test-nonrecursive] Error 143
Comment 1 Matthias Clasen 2011-06-16 23:37:16 UTC
Looks like the strtod() in your libc does not support hex floats ?
Comment 2 Dagobert Michelsen 2011-08-22 14:44:43 UTC
This is correct for Solaris 9. There should be support in Solaris 10 (from strtod(3c)):

     The expected form of the subject  sequence  is  an  optional
     plus or minus sign, then one of the following:
...
       o  A 0x or 0X, then a non-empty  sequence  of  hexadecimal
          digits optionally containing a radix character, then an
          optional binary exponent part

However, the test is failing on Solaris 10 also.
Comment 3 Dagobert Michelsen 2011-08-22 15:03:49 UTC
Solaris 10 seems to need explicitly need -xc99 with Sun Studio 12.
Comment 4 Tim Mooney 2011-11-18 20:29:12 UTC
Although Dagobert is right, there are two problems here.

1) I don't think the test should abort().  It should *fail*, but it shouldn't abort.  The problem with abort() is that all the remaining tests are therefore skipped, which likely isn't the desired behavior.

2) If you configure glib with -xc99 (which is the same as -xc99=all) as part of CFLAGS, then configure actually fails:

checking for res_query... in -lresolv
checking number of arguments to statfs()... unknown
configure: error: unable to determine number of arguments to statfs()


From config.log:

configure:23525: checking number of arguments to statfs()
configure:23551: cc -c -Xa -xc99=all -xO3 -mt -features=extensions -KPIC -xtarget=native -m64 -xarch=native -I/local/gnu/include -I/local/gnu/include -I/local/include  -I/local/gnu/include -I/local/gnu/include -I/local/include -DG_DISABLE_SINGLE_INCLUDES conftest.c >&5
"/usr/include/sys/feature_tests.h", line 332: #error: "Compiler or options invalid for pre-UNIX 03 X/Open applications  and pre-2001 POSIX applications"
cc: acomp failed for conftest.c
configure:23551: $? = 2


The problem is that configure has this code in it:

case $host in
  *-*-solaris* )
     AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, Needed to get declarations for msg_control and msg_controllen on Solaris)
     AC_DEFINE(_XOPEN_SOURCE,          2, Needed to get declarations for msg_control and msg_controllen on Solaris)
     AC_DEFINE(__EXTENSIONS__,         1, Needed to get declarations for msg_control and msg_controllen on Solaris)
     ;;
esac


and at least one of those defines is incompatible with -xc99=all.  Based on my reading of the standards(5) man page on Solaris 10, it appears that for C99, we probably want _XOPEN_SOURCE_EXTENDED undefined, since that puts that system at XPG4v2, and we want _XOPEN_SOURCE=500 or _XOPEN_SOURCE=600, since that's SUSv2 or SUSv3, respectively.

I have a patch for that and with one other minor patch glib 2.28.8 will compile and the failing test now passes, but setting _XOPEN_SOURCE=600 also requires that -xc99=all be specified, and I don't know what that means for programs that link against glib, i.e. do they *also* need -xc99=all?
Comment 5 Matthias Clasen 2011-11-30 03:54:58 UTC
The following fix has been pushed:
b13e79d Don't abort if g_ascii_strtod tests fail
Comment 6 Matthias Clasen 2011-11-30 03:55:01 UTC
Created attachment 202421 [details] [review]
Don't abort if g_ascii_strtod tests fail
Comment 7 Tim Mooney 2011-11-30 17:25:11 UTC
Thanks Matthias.  Your work on this is appreciated.