This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Hi!
On Thu, 11 Apr 2013 10:40:00 +0200, Andreas Schwab <schwab@suse.de> wrote:
> This is what I've checked in.
> [BZ #13988]
> * stdio-common/vfscanf.c (_IO_vfwscanf): When parsing a float
> accept exponent character only when digits were seen.
> * stdio-common/Makefile (tests): Add bug26.
> * stdio-common/bug26.c: New file.
> --- /dev/null
> +++ b/stdio-common/bug26.c
> + double d;
> + char s[] = "+.e";
> +
> + f = fmemopen (s, strlen (s), "r");
> + /* This should fail to parse a float and leave 'e' in the input. */
> + lost |= (fscanf (f, "%f", &d) != 0);
gcc-4.7 bug26.c -c [...]
bug26.c: In function 'main':
bug26.c:32:3: warning: format '%f' expects argument of type 'float *', but argument 3 has type 'double *' [-Wformat]
Pushed as obvious as commit 528c24058fb100fb27fe5c211b92be84c67a6659:
* stdio-common/bug26.c (main): Correct fscanf template.
diff --git stdio-common/bug26.c stdio-common/bug26.c
index a4c6bce..cc54b96 100644
--- stdio-common/bug26.c
+++ stdio-common/bug26.c
@@ -28,8 +28,9 @@ main (void)
char s[] = "+.e";
f = fmemopen (s, strlen (s), "r");
- /* This should fail to parse a float and leave 'e' in the input. */
- lost |= (fscanf (f, "%f", &d) != 0);
+ /* This should fail to parse a floating-point number, and leave 'e' in the
+ input. */
+ lost |= (fscanf (f, "%lf", &d) != 0);
c = fgetc (f);
lost |= c != 'e';
puts (lost ? "Test FAILED!" : "Test succeeded.");
GrÃÃe,
Thomas
Attachment:
pgpex6CrQorXI.pgp
Description: PGP signature
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |