On Sat, Aug 2, 2008 at 11:05 AM, Roland Mainz <[EMAIL PROTECTED]> wrote:
> Dennis Clarke wrote:
>> On Fri, Aug 1, 2008 at 11:27 PM, Ming Kin Lai <[EMAIL PROTECTED]> wrote:
>> > I have a feeling that Sun has abandoned maintaining Solaris, and shifted 
>> > its resources to OpenSolaris.  Well, that's good news to people here, I 
>> > guess.
>> > So, can I discuss things about Solaris 10 here?  How about something about 
>> > Solaris 10's C library?  Can I ask a question why a certain library 
>> > function does not work properly?  Can I report a bug here?  Currently 
>> > there does not appear to be a way to report Solaris' bugs in Sun's website 
>> > anymore.
>> >
>>
>> just a guess, are you referring to an issue with strtod(3C) in
>> C99/SUSv3 mode NOT being able to handle hexadecimal strings ?
>
> Erm... the hexfloat format, e.g. ...
> -- snip --
> $ printf "%a\n" 0.1
> 0x1.999999999999999999999999999ap-04
> -- snip --
> ... is AFAIK part of C99 standard and should work on Solaris. If it does
> not work then this is a bug...

It doesn't and it is because of a bug in the m4 makefiles ... I think.
Let me drag out the email about this from a few days ago.

ah yes .. from the m4 project :

>
> According to Dennis Clarke on 7/29/2008 7:48 PM:
> | not too sure what the issue is here.
>
> | test-strtod.c:738: assertion failed
> ...
> | FAIL: test-strtod
>
> The issue is well-known.

Thank you for the quick reply. I did a little bit of research and have
seen many other posts about this. I should do some research before I
file a bug report next time.

> Your libc is buggy when it comes to C99 strtod(3) compliance

I am surprised to see that in Solaris 10. The Sun folks tend to be
fascists about compliance to specs and standards and that is why I
love them.

see : http://www.blastwave.org/man/s10/standards_5.html

where I see :

Compilation
    A POSIX.1 (1988-1996)-,  XPG4-,  SUS-,  or  SUSv2-conforming
    implementation  must  include  an  ANSI  X3.159-1989 (ANSI C
    Language) standard-conforming compilation system and the  cc
    and  c89  utilities.  A  POSIX.1-2001-  or  SUSv3-conforming
    implementation must include an ISO/IEC 99899:1999 (1999  ISO
    C  Language)  standard-conforming compilation system and the
    c99 utility. Solaris 10 was tested with the cc, c89, and c99
    utilities  and  the  compilation environment provided by Sun
    Studio C Compiler 5.6.

At the very bottom of that page I also see :

Similar SUSv3-conforming LP64 applications should  be  built
    with command lines of the form:

      c99 $(getconf POSIX_V6_LP64_OFF64_CFLAGS) -D_XOPEN_SOURCE=600 \
         $(getconf POSIX_V6_LP64_OFF64_LDFLAGS) foo.c -o foo \
         $(getconf POSIX_V6_LP64_OFF64_LIBS) -lxnet

 SUSv3
    c99                         _XOPEN_SOURCE=600


OKay ... so I'll go back and rebuild m4 1.4.11 with this :

bash-3.2$ uname -a
SunOS mercury 5.10 Generic_127128-11 i86pc i386 i86pc
bash-3.2$ c99 -V
cc: Sun C 5.9 SunOS_i386 Patch 124868-01 2007/07/12
usage: c99 [ options] files.  Use 'c99 -flags' for details

Also, I am going to have a hard look at the Sunsolve bug reports and
patches released and see if there is anything filed about this. If
there is a real concern about C99 compliance in libc then the Sun
folks will know about it.

> but the configure check in m4 1.4.11 didn't check
> for all the known bugs in various libc's.  You can use './configure
> gl_cv_func_strtod_works=no' to work around it; or use the latest snapshot:
>
> http://home.comcast.net/~ericblake/m4-1.5.89a.31-d9538d.tar.gz
> http://home.comcast.net/~ericblake/m4-1.5.89a.31-d9538d.tar.gz.asc
> http://home.comcast.net/~ericblake/m4-1.5.89a.31-d9538d.tar.bz2
> http://home.comcast.net/~ericblake/m4-1.5.89a.31-d9538d.tar.bz2.asc
> http://home.comcast.net/~ericblake/m4-1.5.89a.31-d9538d.tar.lzma
> http://home.comcast.net/~ericblake/m4-1.5.89a.31-d9538d.tar.lzma.asc

Oh well, thank you very much. I'll drag down one of those promptly and
then see what  happens after a build with c99 and after libc is
patched.

Oh, and I'll circle around and  give you my progress report of that is okay.

Dennis Clarke
http://www.blastwave.org

-----------

I found that the m4 1.4.11 release will fail the strtod test every
time unless I specify that we should skip it, of course.

The newer releases ( or CVS ) does not fail but also will not link
because of some problems with makefiles.

I was able to get a nice 64-bit m4 but I don't know if I trust it :

$ file /export/home/dclarke/local/bin/m4
/export/home/dclarke/local/bin/m4: ELF 64-bit LSB executable AMD64
Version 1 [SSE2 SSE FXSR CMOV FPU], dynamically linked, not stripped
$ m4 --version
m4 (GNU M4) 1.4.11
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Rene' Seindal.

I had to manually compile and link the strtod code or it would fail
and I'd have an assertion message every time.

>From test-strtod.c in the m4 tests directory :

  /* Hex.  */
  {
    const char input[] = "0xa";
    char *ptr;
    double result;
    errno = 0;
    result = strtod (input, &ptr);
    ASSERT (result == 10.0);            /* NetBSD 3.0, OpenBSD 4.0,
AIX 5.1, HP-UX 11.11, IRIX 6.5, OSF/1 5.1, Solaris 10, mingw */
    ASSERT (ptr == input + 3);          /* NetBSD 3.0, OpenBSD 4.0,
AIX 5.1, HP-UX 11.11, IRIX 6.5, OSF/1 5.1, Solaris 10, mingw */
    ASSERT (errno == 0);
  }

that would fail every time.

Let me rebuild :

test-strtod.c:738: assertion failed
test-strtod.c:739: assertion failed
test-strtod.c:748: assertion failed
test-strtod.c:749: assertion failed
test-strtod.c:758: assertion failed
test-strtod.c:759: assertion failed
test-strtod.c:768: assertion failed
test-strtod.c:769: assertion failed
test-strtod.c:778: assertion failed
test-strtod.c:779: assertion failed
test-strtod.c:788: assertion failed
test-strtod.c:789: assertion failed

okay .. the code that fails ...

$ cat -n test-strtod.c | head -792  | tail -63 |  cut -c1-44
   730
   731    /* Hex.  */
   732    {
   733      const char input[] = "0xa";
   734      char *ptr;
   735      double result;
   736      errno = 0;
   737      result = strtod (input, &ptr);
   738      ASSERT (result == 10.0);
   739      ASSERT (ptr == input + 3);
   740      ASSERT (errno == 0);
   741    }
   742    {
   743      const char input[] = "0XA";
   744      char *ptr;
   745      double result;
   746      errno = 0;
   747      result = strtod (input, &ptr);
   748      ASSERT (result == 10.0);
   749      ASSERT (ptr == input + 3);
   750      ASSERT (errno == 0);
   751    }
   752    {
   753      const char input[] = "0x1p";
   754      char *ptr;
   755      double result;
   756      errno = 0;
   757      result = strtod (input, &ptr);
   758      ASSERT (result == 1.0);
   759      ASSERT (ptr == input + 3);
   760      ASSERT (errno == 0);
   761    }
   762    {
   763      const char input[] = "0x1p+";
   764      char *ptr;
   765      double result;
   766      errno = 0;
   767      result = strtod (input, &ptr);
   768      ASSERT (result == 1.0);
   769      ASSERT (ptr == input + 3);
   770      ASSERT (errno == 0);
   771    }
   772    {
   773      const char input[] = "0x1p+1";
   774      char *ptr;
   775      double result;
   776      errno = 0;
   777      result = strtod (input, &ptr);
   778      ASSERT (result == 2.0);
   779      ASSERT (ptr == input + 6);
   780      ASSERT (errno == 0);
   781    }
   782    {
   783      const char input[] = "0x1p+1a";
   784      char *ptr;
   785      double result;
   786      errno = 0;
   787      result = strtod (input, &ptr);
   788      ASSERT (result == 2.0);
   789      ASSERT (ptr == input + 6);
   790      ASSERT (errno == 0);
   791    }
   792

Here comes a compile with cc :

$ cc -g -m64 -xO1 -Qy -Xa -xbuiltin=%none -xdebugformat=dwarf
-xmodel=medium -xnolibmil -xnolibmopt -xregs=no%frameptr -xs
-xstrconst -xtarget=opteron -xtemp=/tmp/dclarke -I../lib -H -o
test-strtod_assert_fail test-strtod.c
../lib/config.h
../lib/stdlib.h
        /usr/include/stdlib.h
                /usr/include/iso/stdlib_iso.h
                        /usr/include/sys/feature_tests.h
                                /usr/include/sys/ccompile.h
                                /usr/include/sys/isa_defs.h
                /usr/include/iso/stdlib_c99.h
                /usr/include/sys/wait.h
                        /usr/include/sys/types.h
                                /usr/include/sys/machtypes.h
                                        /usr/include/ia32/sys/machtypes.h
                                /usr/include/sys/int_types.h
                                /usr/include/sys/select.h
                                        /usr/include/sys/time_impl.h
                                        /usr/include/sys/time.h
                                                /usr/include/sys/types.h
                                                /usr/include/time.h

/usr/include/iso/time_iso.h
                                                /usr/include/sys/select.h
                        /usr/include/sys/resource.h
                        /usr/include/sys/siginfo.h
                                /usr/include/sys/machsig.h
                                        /usr/include/vm/faultcode.h
                        /usr/include/sys/procset.h
                                /usr/include/sys/signal.h
                                        /usr/include/sys/iso/signal_iso.h
                                                /usr/include/sys/unistd.h
        ../lib/unistd.h
                /usr/include/unistd.h
                ../lib/stdlib.h
/usr/include/errno.h
        /usr/include/sys/errno.h
/usr/include/float.h
../lib/math.h
        /usr/include/math.h
                /usr/include/iso/math_iso.h
                /usr/include/iso/math_c99.h
                /usr/include/floatingpoint.h
                        /usr/include/stdio_tag.h
                        /usr/include/sys/ieeefp.h
../lib/stdio.h
        /usr/include/stdio.h
                /usr/include/iso/stdio_iso.h
                        /usr/include/sys/va_list.h
                        /usr/include/stdio_impl.h
                /usr/include/iso/stdio_c99.h
        /usr/include/stdarg.h
                /usr/include/iso/stdarg_iso.h
                        /usr/include/sys/va_impl.h
                /usr/include/iso/stdarg_c99.h
        /usr/include/stddef.h
                /usr/include/iso/stddef_iso.h
../lib/string.h
        /usr/include/string.h
                /usr/include/iso/string_iso.h
$ file test-strtod_assert_fail
test-strtod_assert_fail: ELF 64-bit LSB executable AMD64 Version 1
[SSE2 SSE FXSR CMOV FPU], dynamically linked, not stripped
$ ./test-strtod_assert_fail
test-strtod.c:738: assertion failed
test-strtod.c:739: assertion failed
test-strtod.c:748: assertion failed
test-strtod.c:749: assertion failed
test-strtod.c:758: assertion failed
test-strtod.c:759: assertion failed
test-strtod.c:768: assertion failed
test-strtod.c:769: assertion failed
test-strtod.c:778: assertion failed
test-strtod.c:779: assertion failed
test-strtod.c:788: assertion failed
test-strtod.c:789: assertion failed


Here we go with c99 :

$ c99 -g -m64 -xO1 -Qy -Xa -xbuiltin=%none -xdebugformat=dwarf
-xmodel=medium -xnolibmil -xnolibmopt -xregs=no%frameptr -xs
-xstrconst -xtarget=opteron -xtemp=/tmp/dclarke -I../lib -H -o
test-strtod_assert_fail test-strtod.c
../lib/config.h
../lib/stdlib.h
        /usr/include/stdlib.h
                /usr/include/iso/stdlib_iso.h
                        /usr/include/sys/feature_tests.h
                                /usr/include/sys/ccompile.h
                                /usr/include/sys/isa_defs.h
                /usr/include/iso/stdlib_c99.h
                /usr/include/sys/wait.h
                        /usr/include/sys/types.h
                                /usr/include/sys/machtypes.h
                                        /usr/include/ia32/sys/machtypes.h
                                /usr/include/sys/int_types.h
                                /usr/include/sys/select.h
                                        /usr/include/sys/time_impl.h
                                        /usr/include/sys/time.h
                                                /usr/include/sys/types.h
                                                /usr/include/time.h

/usr/include/iso/time_iso.h
                                                /usr/include/sys/select.h
                        /usr/include/sys/resource.h
                        /usr/include/sys/siginfo.h
                                /usr/include/sys/machsig.h
                                        /usr/include/vm/faultcode.h
                        /usr/include/sys/procset.h
                                /usr/include/sys/signal.h
                                        /usr/include/sys/iso/signal_iso.h
                                                /usr/include/sys/unistd.h
        ../lib/unistd.h
                /usr/include/unistd.h
                ../lib/stdlib.h
/usr/include/errno.h
        /usr/include/sys/errno.h
/usr/include/float.h
../lib/math.h
        /usr/include/math.h
                /usr/include/iso/math_iso.h
                /usr/include/iso/math_c99.h
                /usr/include/floatingpoint.h
                        /usr/include/stdio_tag.h
                        /usr/include/sys/ieeefp.h
../lib/stdio.h
        /usr/include/stdio.h
                /usr/include/iso/stdio_iso.h
                        /usr/include/sys/va_list.h
                        /usr/include/stdio_impl.h
                /usr/include/iso/stdio_c99.h
        /usr/include/stdarg.h
                /usr/include/iso/stdarg_iso.h
                        /usr/include/sys/va_impl.h
                /usr/include/iso/stdarg_c99.h
        /usr/include/stddef.h
                /usr/include/iso/stddef_iso.h
../lib/string.h
        /usr/include/string.h
                /usr/include/iso/string_iso.h
$ file test-strtod_assert_fail
test-strtod_assert_fail: ELF 64-bit LSB executable AMD64 Version 1
[SSE2 SSE FXSR CMOV FPU], dynamically linked, not stripped
$ ./test-strtod_assert_fail

works fine with c99  :-)   ( that rhymes )

so ... its a funny looking failure in the m4 code because the strtod
manpage says that "In C99/SUSv3 mode, hexadecimal strings are also
recognized." and thus the stuff fails when I use plain jane[1] cc but
works with c99.

Dennis

[1] I knew a Jane and she was not plain
_______________________________________________
opensolaris-code mailing list
opensolaris-code@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to