public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/64054] 27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc FAILs
  2014-11-24 14:59 [Bug libstdc++/64054] New: 27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc FAILs ro at gcc dot gnu.org
@ 2014-11-24 14:59 ` ro at gcc dot gnu.org
  2014-11-24 16:19 ` redi at gcc dot gnu.org
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: ro at gcc dot gnu.org @ 2014-11-24 14:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64054

Rainer Orth <ro at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |5.0


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug libstdc++/64054] New: 27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc FAILs
@ 2014-11-24 14:59 ro at gcc dot gnu.org
  2014-11-24 14:59 ` [Bug libstdc++/64054] " ro at gcc dot gnu.org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: ro at gcc dot gnu.org @ 2014-11-24 14:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64054

            Bug ID: 64054
           Summary: 27_io/basic_ostream/inserters_arithmetic/char/hexfloat
                    .cc FAILs
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ro at gcc dot gnu.org
                CC: redi at gcc dot gnu.org
              Host: *-*-solaris2.*
            Target: *-*-solaris2.*
             Build: *-*-solaris2.*

The new 27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc test FAILs on
Solaris (both SPARC and x86):

Assertion failed: os && std::stod(os.str()) == d, file
/vol/gcc/src/hg/trunk/local/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc,
line 52, function test01
FAIL: 27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc execution test

With TEST_NUMPUT_VERBOSE defined, I get

6
got: 0x1.1000000000000p+8

  Rainer


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug libstdc++/64054] 27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc FAILs
  2014-11-24 14:59 [Bug libstdc++/64054] New: 27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc FAILs ro at gcc dot gnu.org
  2014-11-24 14:59 ` [Bug libstdc++/64054] " ro at gcc dot gnu.org
@ 2014-11-24 16:19 ` redi at gcc dot gnu.org
  2014-11-24 16:48 ` schwab@linux-m68k.org
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu.org @ 2014-11-24 16:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64054

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Weird. Somehow the double variable 'd' is getting set to 6 after it is
(correctly) written to the stream, so converting "0x1.1000000000000p+8" back to
a double doesn't compare equal to it, because 272. != 6.

Smells like memory corruption of some kind.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug libstdc++/64054] 27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc FAILs
  2014-11-24 14:59 [Bug libstdc++/64054] New: 27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc FAILs ro at gcc dot gnu.org
  2014-11-24 14:59 ` [Bug libstdc++/64054] " ro at gcc dot gnu.org
  2014-11-24 16:19 ` redi at gcc dot gnu.org
@ 2014-11-24 16:48 ` schwab@linux-m68k.org
  2014-11-24 17:24 ` redi at gcc dot gnu.org
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: schwab@linux-m68k.org @ 2014-11-24 16:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64054

--- Comment #2 from Andreas Schwab <schwab@linux-m68k.org> ---
6 is the output from "cout << os.precision() << endl;", not the value of d.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug libstdc++/64054] 27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc FAILs
  2014-11-24 14:59 [Bug libstdc++/64054] New: 27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc FAILs ro at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2014-11-24 16:48 ` schwab@linux-m68k.org
@ 2014-11-24 17:24 ` redi at gcc dot gnu.org
  2014-11-25 15:20 ` redi at gcc dot gnu.org
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu.org @ 2014-11-24 17:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64054

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Doh, so it is, I misread the test code.

Rainer, what does this print (when compiled with -std=c++11)?

#include <string>
#include <stdio.h>

int main()
{
  auto d = std::stod("0x1.1000000000000p+8");
  printf("%f %a\n", d, d);
}


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug libstdc++/64054] 27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc FAILs
  2014-11-24 14:59 [Bug libstdc++/64054] New: 27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc FAILs ro at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2014-11-24 17:24 ` redi at gcc dot gnu.org
@ 2014-11-25 15:20 ` redi at gcc dot gnu.org
  2014-11-25 15:42 ` ro at CeBiTec dot Uni-Bielefeld.DE
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu.org @ 2014-11-25 15:20 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64054

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Thanks - so it looks as though the problem is in std::stod which is pretty
simple, and can be reduced to:

#include <errno.h>
#include <stdio.h>
#include <stdlib.h>

int main()
{
      double d;

      char* endptr;
      errno = 0;
      const char* str = "0x1.1000000000000p+8";
      const double tmp = strtod(str, &endptr);

      if (endptr == str) {
        puts("no characters consumed");
    return 1;
      }
      else if (errno == ERANGE) {
        puts("ERANGE");
    return 2;
      }
      else if (*endptr) {
        printf("stopped at '%c'\n", *endptr);
        return 3;
      }
      else
    d = tmp;

     printf("%f %a\n", d, d);
}

Maybe Solaris' strtod() doesn't support hex floats in C++ code, so it will
print "stopped at 'x'"


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug libstdc++/64054] 27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc FAILs
  2014-11-24 14:59 [Bug libstdc++/64054] New: 27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc FAILs ro at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2014-11-25 15:20 ` redi at gcc dot gnu.org
@ 2014-11-25 15:42 ` ro at CeBiTec dot Uni-Bielefeld.DE
  2014-11-25 16:11 ` redi at gcc dot gnu.org
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: ro at CeBiTec dot Uni-Bielefeld.DE @ 2014-11-25 15:42 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64054

--- Comment #6 from ro at CeBiTec dot Uni-Bielefeld.DE <ro at CeBiTec dot Uni-Bielefeld.DE> ---
> --- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
> Thanks - so it looks as though the problem is in std::stod which is pretty
> simple, and can be reduced to:
[...]
> Maybe Solaris' strtod() doesn't support hex floats in C++ code, so it will
> print "stopped at 'x'"

It does indeed.  When I compile the test with Studio 12.4 cc -std=c99, I
get

272.000000 0x1.1000000000000p+8

instead, which reminded me that gcc still doesn't link with
values-xpg6.o in C99 mode.  There was quite some controversy about this
in PR target/40411, and nothing has happened on this front for quite
some time.

It turns out that if I add values-xpg6.o to the link, gcc prints the
same output as cc.

    Rainer


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug libstdc++/64054] 27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc FAILs
  2014-11-24 14:59 [Bug libstdc++/64054] New: 27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc FAILs ro at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2014-11-25 15:42 ` ro at CeBiTec dot Uni-Bielefeld.DE
@ 2014-11-25 16:11 ` redi at gcc dot gnu.org
  2014-11-25 16:15 ` ro at CeBiTec dot Uni-Bielefeld.DE
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu.org @ 2014-11-25 16:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64054

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Aha, of course.

Maybe we should just add this to the test for now?

// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64054
// { dg-xfail-if "" { *-*-solaris* } { "*" } { "" } }

If 40411 gets fixed it will start XPASSing and we can remove it.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug libstdc++/64054] 27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc FAILs
  2014-11-24 14:59 [Bug libstdc++/64054] New: 27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc FAILs ro at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2014-11-25 16:11 ` redi at gcc dot gnu.org
@ 2014-11-25 16:15 ` ro at CeBiTec dot Uni-Bielefeld.DE
  2014-11-25 16:16 ` redi at gcc dot gnu.org
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: ro at CeBiTec dot Uni-Bielefeld.DE @ 2014-11-25 16:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64054

--- Comment #8 from ro at CeBiTec dot Uni-Bielefeld.DE <ro at CeBiTec dot Uni-Bielefeld.DE> ---
> --- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
> Aha, of course.
>
> Maybe we should just add this to the test for now?
>
> // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64054
> // { dg-xfail-if "" { *-*-solaris* } { "*" } { "" } }
>
> If 40411 gets fixed it will start XPASSing and we can remove it.

I guess that the best course for now, with two nits fixed:

* Instead of listing the URL, just add PR libstdc++/64054 in the comment
  field of dg-xfail if.

* Omit the default args to dg-xfail-if.

Thanks.
        Rainer


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug libstdc++/64054] 27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc FAILs
  2014-11-24 14:59 [Bug libstdc++/64054] New: 27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc FAILs ro at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2014-11-25 16:15 ` ro at CeBiTec dot Uni-Bielefeld.DE
@ 2014-11-25 16:16 ` redi at gcc dot gnu.org
  2014-11-26 13:40 ` ro at gcc dot gnu.org
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu.org @ 2014-11-25 16:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64054

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-11-25
     Ever confirmed|0                           |1

--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Yes, that's better, thanks :)

Pre-approved if you want to do that, otherwise I'll get to it later this week.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug libstdc++/64054] 27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc FAILs
  2014-11-24 14:59 [Bug libstdc++/64054] New: 27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc FAILs ro at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2014-11-25 16:16 ` redi at gcc dot gnu.org
@ 2014-11-26 13:40 ` ro at gcc dot gnu.org
  2014-12-12 22:46 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: ro at gcc dot gnu.org @ 2014-11-26 13:40 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64054

Rainer Orth <ro at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |https://gcc.gnu.org/ml/gcc-
                   |                            |patches/2014-11/msg03271.ht
                   |                            |ml
         Depends on|                            |40411

--- Comment #12 from Rainer Orth <ro at gcc dot gnu.org> ---
Done, thanks.

It turned out you need dg-xfail-run-if since it's the execution part of the
test
that fails.

  Rainer


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug libstdc++/64054] 27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc FAILs
  2014-11-24 14:59 [Bug libstdc++/64054] New: 27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc FAILs ro at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2014-11-26 13:40 ` ro at gcc dot gnu.org
@ 2014-12-12 22:46 ` redi at gcc dot gnu.org
  2014-12-15  9:44 ` ro at CeBiTec dot Uni-Bielefeld.DE
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu.org @ 2014-12-12 22:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64054

--- Comment #13 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Rainer, should we close this now?


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug libstdc++/64054] 27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc FAILs
  2014-11-24 14:59 [Bug libstdc++/64054] New: 27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc FAILs ro at gcc dot gnu.org
                   ` (10 preceding siblings ...)
  2014-12-12 22:46 ` redi at gcc dot gnu.org
@ 2014-12-15  9:44 ` ro at CeBiTec dot Uni-Bielefeld.DE
  2015-04-22 12:01 ` jakub at gcc dot gnu.org
  2015-07-16  9:20 ` rguenth at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: ro at CeBiTec dot Uni-Bielefeld.DE @ 2014-12-15  9:44 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64054

--- Comment #14 from ro at CeBiTec dot Uni-Bielefeld.DE <ro at CeBiTec dot Uni-Bielefeld.DE> ---
> --- Comment #13 from Jonathan Wakely <redi at gcc dot gnu.org> ---
> Rainer, should we close this now?

I'd rather keep it open or mark it suspended as a reminder.

    Rainer


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug libstdc++/64054] 27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc FAILs
  2014-11-24 14:59 [Bug libstdc++/64054] New: 27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc FAILs ro at gcc dot gnu.org
                   ` (11 preceding siblings ...)
  2014-12-15  9:44 ` ro at CeBiTec dot Uni-Bielefeld.DE
@ 2015-04-22 12:01 ` jakub at gcc dot gnu.org
  2015-07-16  9:20 ` rguenth at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-04-22 12:01 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64054

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|5.0                         |5.2

--- Comment #15 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 5.1 has been released.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug libstdc++/64054] 27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc FAILs
  2014-11-24 14:59 [Bug libstdc++/64054] New: 27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc FAILs ro at gcc dot gnu.org
                   ` (12 preceding siblings ...)
  2015-04-22 12:01 ` jakub at gcc dot gnu.org
@ 2015-07-16  9:20 ` rguenth at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-07-16  9:20 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64054

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|5.2                         |5.3

--- Comment #16 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 5.2 is being released, adjusting target milestone to 5.3.


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2015-07-16  9:14 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-24 14:59 [Bug libstdc++/64054] New: 27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc FAILs ro at gcc dot gnu.org
2014-11-24 14:59 ` [Bug libstdc++/64054] " ro at gcc dot gnu.org
2014-11-24 16:19 ` redi at gcc dot gnu.org
2014-11-24 16:48 ` schwab@linux-m68k.org
2014-11-24 17:24 ` redi at gcc dot gnu.org
2014-11-25 15:20 ` redi at gcc dot gnu.org
2014-11-25 15:42 ` ro at CeBiTec dot Uni-Bielefeld.DE
2014-11-25 16:11 ` redi at gcc dot gnu.org
2014-11-25 16:15 ` ro at CeBiTec dot Uni-Bielefeld.DE
2014-11-25 16:16 ` redi at gcc dot gnu.org
2014-11-26 13:40 ` ro at gcc dot gnu.org
2014-12-12 22:46 ` redi at gcc dot gnu.org
2014-12-15  9:44 ` ro at CeBiTec dot Uni-Bielefeld.DE
2015-04-22 12:01 ` jakub at gcc dot gnu.org
2015-07-16  9:20 ` rguenth at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).