* [Bug libstdc++/67932] Incorrect conversion to hexfloat
2015-10-12 12:50 [Bug libstdc++/67932] New: Incorrect conversion to hexfloat rcopley at gmail dot com
@ 2015-10-12 13:54 ` redi at gcc dot gnu.org
2015-10-12 17:20 ` rcopley at gmail dot com
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2015-10-12 13:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67932
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Your preprocessed source doesn't use std::hexfloat, so any problem comes from
std::printf, which is part of your C library not part of GCC.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libstdc++/67932] Incorrect conversion to hexfloat
2015-10-12 12:50 [Bug libstdc++/67932] New: Incorrect conversion to hexfloat rcopley at gmail dot com
2015-10-12 13:54 ` [Bug libstdc++/67932] " redi at gcc dot gnu.org
@ 2015-10-12 17:20 ` rcopley at gmail dot com
2015-10-12 20:59 ` redi at gcc dot gnu.org
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: rcopley at gmail dot com @ 2015-10-12 17:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67932
--- Comment #2 from R Copley <rcopley at gmail dot com> ---
Thanks Jonathan. It's clear enough from what I wrote that:
(1) The same kind of incorrect output is produced by (a) including <cstdio> and
using std::printf, and (b) using iostreams and std::hexfloat;
(2) The correct output is produced by including <stdio.h> and using ::printf.
I think (but I am by no means certain!) that (by (2)) my C library works, and
(by (1)) there is a problem with GCC's standard library implementation.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libstdc++/67932] Incorrect conversion to hexfloat
2015-10-12 12:50 [Bug libstdc++/67932] New: Incorrect conversion to hexfloat rcopley at gmail dot com
2015-10-12 13:54 ` [Bug libstdc++/67932] " redi at gcc dot gnu.org
2015-10-12 17:20 ` rcopley at gmail dot com
@ 2015-10-12 20:59 ` redi at gcc dot gnu.org
2015-10-12 21:41 ` rcopley at gmail dot com
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2015-10-12 20:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67932
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Libstdc++ has no implementation of printf, so ::printf and std::printf are
exactly the same function, with std::printf defined as:
namespace std
{
using ::printf;
}
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libstdc++/67932] Incorrect conversion to hexfloat
2015-10-12 12:50 [Bug libstdc++/67932] New: Incorrect conversion to hexfloat rcopley at gmail dot com
` (2 preceding siblings ...)
2015-10-12 20:59 ` redi at gcc dot gnu.org
@ 2015-10-12 21:41 ` rcopley at gmail dot com
2015-10-12 21:42 ` rcopley at gmail dot com
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: rcopley at gmail dot com @ 2015-10-12 21:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67932
--- Comment #4 from R Copley <rcopley at gmail dot com> ---
That's what I understood to be the case. Nevertheless, with the toolchain I am
using (see above for version; same command-line etc.), I get the results below.
Both testcases below give the correct results with g++-4.8 on Ubuntu (the idea
of installing 5.2 seems to confuse and infuriate the community there), so I
think I must report this to the MinGW-W64 maintainers instead. Thanks.
#include <stdio.h>
int main () { printf ("%a", 0x1.000008p+0); }
// Preprocessed source: see attachment "hexfloat-bug-2a.ii"
// Output: 0x1.000008p+0
#include <cstdio>
int main () { printf /*sic*/ ("%a", 0x1000008p+0); }
// Preprocessed source: see attachment "hexfloat-bug-2b.ii"
// Output: 0x0p-63
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libstdc++/67932] Incorrect conversion to hexfloat
2015-10-12 12:50 [Bug libstdc++/67932] New: Incorrect conversion to hexfloat rcopley at gmail dot com
` (3 preceding siblings ...)
2015-10-12 21:41 ` rcopley at gmail dot com
@ 2015-10-12 21:42 ` rcopley at gmail dot com
2015-10-12 21:42 ` rcopley at gmail dot com
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: rcopley at gmail dot com @ 2015-10-12 21:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67932
--- Comment #6 from R Copley <rcopley at gmail dot com> ---
Created attachment 36490
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36490&action=edit
hexfloat-bug-2b.ii (see Comment 4)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libstdc++/67932] Incorrect conversion to hexfloat
2015-10-12 12:50 [Bug libstdc++/67932] New: Incorrect conversion to hexfloat rcopley at gmail dot com
` (4 preceding siblings ...)
2015-10-12 21:42 ` rcopley at gmail dot com
@ 2015-10-12 21:42 ` rcopley at gmail dot com
2015-10-12 22:23 ` redi at gcc dot gnu.org
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: rcopley at gmail dot com @ 2015-10-12 21:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67932
--- Comment #5 from R Copley <rcopley at gmail dot com> ---
Created attachment 36489
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36489&action=edit
hexfloat-bug-2a.ii (see Comment 4)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libstdc++/67932] Incorrect conversion to hexfloat
2015-10-12 12:50 [Bug libstdc++/67932] New: Incorrect conversion to hexfloat rcopley at gmail dot com
` (5 preceding siblings ...)
2015-10-12 21:42 ` rcopley at gmail dot com
@ 2015-10-12 22:23 ` redi at gcc dot gnu.org
2015-10-12 23:29 ` rcopley at gmail dot com
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2015-10-12 22:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67932
--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The difference will probably be that when including libstdc++'s <cstdio> this
happens before mingw's <stdio.h> is included:
// Make sure that POSIX printf/scanf functions are activated. As
// libstdc++ depends on POSIX-definitions of those functions, we define
// it unconditionally.
#undef __USE_MINGW_ANSI_STDIO
#define __USE_MINGW_ANSI_STDIO 1
That alters what <stdio.h> declares, due to this in <stdio.h>
#if __USE_MINGW_ANSI_STDIO
/*
* User has expressed a preference for C99 conformance...
*/
That causes printf to be a wrapper around __mingw_vprintf, rather than calling
the MSVCRT version:
__mingw_ovr
__attribute__((__format__ (gnu_printf, 1, 2))) __MINGW_ATTRIB_NONNULL(1)
int printf (const char *__format, ...)
{
register int __retval;
__builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format );
__retval = __mingw_vprintf( __format, __local_argv );
__builtin_va_end( __local_argv );
return __retval;
}
So the incorrect output seems to come from __mingw_vprintf.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libstdc++/67932] Incorrect conversion to hexfloat
2015-10-12 12:50 [Bug libstdc++/67932] New: Incorrect conversion to hexfloat rcopley at gmail dot com
` (6 preceding siblings ...)
2015-10-12 22:23 ` redi at gcc dot gnu.org
@ 2015-10-12 23:29 ` rcopley at gmail dot com
2015-10-13 14:44 ` rcopley at gmail dot com
2015-10-13 14:55 ` redi at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: rcopley at gmail dot com @ 2015-10-12 23:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67932
--- Comment #8 from R Copley <rcopley at gmail dot com> ---
Thanks. I've emailed the mingw-w64 list at
http://sourceforge.net/p/mingw-w64/mailman/mingw-w64-public. (You expressed it
better but I hadn't seen your last comment.)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libstdc++/67932] Incorrect conversion to hexfloat
2015-10-12 12:50 [Bug libstdc++/67932] New: Incorrect conversion to hexfloat rcopley at gmail dot com
` (7 preceding siblings ...)
2015-10-12 23:29 ` rcopley at gmail dot com
@ 2015-10-13 14:44 ` rcopley at gmail dot com
2015-10-13 14:55 ` redi at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: rcopley at gmail dot com @ 2015-10-13 14:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67932
--- Comment #9 from R Copley <rcopley at gmail dot com> ---
For information, this has already been entered on the mingw-w64 issue tracker
(months ago) (see http://sourceforge.net/p/mingw-w64/bugs/459/).
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libstdc++/67932] Incorrect conversion to hexfloat
2015-10-12 12:50 [Bug libstdc++/67932] New: Incorrect conversion to hexfloat rcopley at gmail dot com
` (8 preceding siblings ...)
2015-10-13 14:44 ` rcopley at gmail dot com
@ 2015-10-13 14:55 ` redi at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2015-10-13 14:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67932
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
URL| |http://sourceforge.net/p/mi
| |ngw-w64/bugs/459/
Resolution|--- |MOVED
--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Thanks for the link.
^ permalink raw reply [flat|nested] 11+ messages in thread