[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#155835: libc6-dev: scanf a flag conflicts with C99



Hi,

At Sat, 18 Dec 2004 14:06:24 +0200,
Antti-Juhani Kaijanaho wrote:
> On 20041218T201450+0900, GOTO Masanori wrote:
> > Could you provide a sample test program for the latest sarge glibc/gcc?
> 
> I'm running sid, so this is tested on sid:
> 
> The following demonstrates that the bug is still valid:
> 
> ajk@kukkaruukku[13:43:18]:~$ dpkg -l libc6 gcc
> Desired=Unknown/Install/Remove/Purge/Hold
> | Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
> |/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
> ||/ Name                   Version                Description
> +++-======================-======================-============================================================
> ii  libc6                  2.3.2.ds1-19           GNU C Library: Shared libraries and Timezone data
> ii  gcc                    3.3.5-1                The GNU C compiler
> ajk@kukkaruukku[14:04:26]:~$ cat bug155835.c 
> #include <stdio.h>
> 
> int main(void)
> {
>         char *s;
>         scanf("%as", &s);
>         // if this echoes what you wrote,
>         // the bug is still valid (%as has GNU semantics)
>         printf("Read: %s\n", s); 
>         return 0;
> }
> ajk@kukkaruukku[14:04:30]:~$ gcc --std=c99 -Wall bug155835.c
> bug155835.c: In function `main':
> bug155835.c:6: warning: float format, pointer arg (arg 2)
> ajk@kukkaruukku[14:04:39]:~$ ./a.out 
> foo
> Read: foo
> ajk@kukkaruukku[14:04:43]:~$ 

This warning is come from gcc, not glibc.  Gcc parses the first
argument of scanf.  When gcc mets %as in C99 mode, GNU extension
should not be treated.  This is gcc's expected behavior, so this is
not bug.

(If you don't have complain about it, I'll close it)

Regards,
-- gotom





Reply to: