Bug 249723 - sscanf(str, "%as", &charptr) broken with --std=gnu99
sscanf(str, "%as", &charptr) broken with --std=gnu99
Product: Fedora
Classification: Fedora
Component: gcc (Show other bugs)
All Linux
low Severity low
: ---
: ---
Assigned To: Jakub Jelinek
Fedora Extras Quality Assurance
: Reopened
Depends On:
  Show dependency treegraph
Reported: 2007-07-26 13:31 EDT by Peter Jones
Modified: 2007-11-30 17:12 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2007-07-27 03:25:12 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
this is a fix. (534 bytes, patch)
2007-07-26 13:31 EDT, Peter Jones
no flags Details | Diff

  None (edit)
Description Peter Jones 2007-07-26 13:31:04 EDT
Description of problem:

the type checking for sscanf() doesn't allow "%as" when invoked with --std=gnu99.

Version-Release number of selected component (if applicable):

4.1.2-20070704 .

A patch is attached to this bug which I think correctly fixes this issue.
Comment 1 Peter Jones 2007-07-26 13:31:04 EDT
Created attachment 160047 [details]
this is a fix.
Comment 2 Jakub Jelinek 2007-07-26 13:48:31 EDT
That code is intentional, glibc violates the C99 standard by this.
The upcoming POSIX standard will use m modified instead (so %ms, %mS, %mls, %m[)
and glibc will soon implement it.  ATM I have a few questions about the exact
wording and unclear description of memory allocation failure handling case
(which will be different from glibc's %as/%aS/%a[ modifier handling), once
that's resolved we'll implement it in glibc and also in gcc format checking
(the m modifier letter has been cleared with ISO groups already).
Comment 3 Peter Jones 2007-07-26 19:47:19 EDT
Well, yeah, it's a gnu extension -- that's why --std is set to gnu99, not c99 or
similar.  The current behavior is directly contrary to the current documentation.
Comment 4 Jakub Jelinek 2007-07-27 03:25:12 EDT
But it is a GNU extension that violates the standard, -std=gnu99 generally
enables extensions to the standard that don't conflict with the standard.
The warning is still very useful to inform people about the extension conflict
with the standard.
When we implement the m modifier, the intent is for the strict modes to not
accept %as, %aS and %a[ any longer (have a separate set of *scanf entrypoints
for that mode) and people really should be aware of this.
Hopefully they will switch to using %ms, %mS, %m[ soon to get rid of the warning,
which is the intent.

Note You need to log in before you can comment on or make changes to this bug.