public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* gcc 4.8.2 runtime library error
@ 2014-05-28 17:13 Arthur Schwarz
  2014-06-16 17:28 ` Corinna Vinschen
  0 siblings, 1 reply; 2+ messages in thread
From: Arthur Schwarz @ 2014-05-28 17:13 UTC (permalink / raw)
  To: cygwin

Win 7 64-bit
gcc 4.8.2 (64-bit)

ret: http://stackoverflow.com/questions/23900921/c-scanf-la-returns-0

I don't know whether cygwin or gcc.org maintains the runtime library. If
this is the wrong location I'll redirect this e-mail.

sscanf() doesn't handle "%la" correctly and crashes on "%a". 

Sample code and output:
# include <stdio.h>
# include <ios>
# include <iostream>
# include <iomanip>

#include <cstdlib>

using namespace std;
int main(int argc, char** argv) {
   char buffer[30];
   double x = 5.0;
   sprintf(buffer, "%a", 1.2);
   sscanf(buffer, "%la", &x);
   cout << "    Example 1.2 buffer -> " << buffer << endl;
   cout << "    Example 1.2 scanf <- " << x << endl;

   return 0;
}
output 
 Example 1.2 buffer -> 0x1.3333333333333p+0
 Example 1.2 scanf <- 0



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

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

* Re: gcc 4.8.2 runtime library error
  2014-05-28 17:13 gcc 4.8.2 runtime library error Arthur Schwarz
@ 2014-06-16 17:28 ` Corinna Vinschen
  0 siblings, 0 replies; 2+ messages in thread
From: Corinna Vinschen @ 2014-06-16 17:28 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 809 bytes --]

On May 28 08:53, Arthur Schwarz wrote:
> Win 7 64-bit
> gcc 4.8.2 (64-bit)
> 
> ret: http://stackoverflow.com/questions/23900921/c-scanf-la-returns-0
> 
> I don't know whether cygwin or gcc.org maintains the runtime library. If
> this is the wrong location I'll redirect this e-mail.

We're using the stdio functions from the newlib library.

> sscanf() doesn't handle "%la" correctly and crashes on "%a". 

I can't reproduce the crash, but in general, reading hexadecimal
floating point numbers as created by the %a printf format is not
supported in newlib's scanf function family yet.  Nobody provided
a patch for this so far.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

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

end of thread, other threads:[~2014-06-16 17:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-28 17:13 gcc 4.8.2 runtime library error Arthur Schwarz
2014-06-16 17:28 ` Corinna Vinschen

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).