public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/16833] New: -fno-builtin prevents automatic format checks for standard functions
@ 2004-07-30 12:34 timb at bluearc dot com
  2004-07-30 15:39 ` [Bug c/16833] " pinskia at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: timb at bluearc dot com @ 2004-07-30 12:34 UTC (permalink / raw)
  To: gcc-bugs

The documentation for the format function attribute says: "The compiler always
(unless -ffreestanding is used) checks formats for the standard library
functions ... whenever such warnings are requested". However, these implicit
attributes appear to be disabled also by -fno-builtin (which is implied by
-ffreestanding).

At the very least, the docs and the actual behaviour should match; but I think
the current behaviour is incorrect, as without -ffreestanding it is still a
hosted implementation, so printf etc. should be assumed to be standard.

Test case: compile this code with -Wformat and with/without -fno-builtin:

int printf(const char* format, ...);
void foo(void)
{
    printf("%s");
}

-- 
           Summary: -fno-builtin prevents automatic format checks for
                    standard functions
           Product: gcc
           Version: 3.3.3
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: timb at bluearc dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i486-linux
  GCC host triplet: i486-linux
GCC target triplet: i486-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16833


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

* [Bug c/16833] -fno-builtin prevents automatic format checks for standard functions
  2004-07-30 12:34 [Bug c/16833] New: -fno-builtin prevents automatic format checks for standard functions timb at bluearc dot com
@ 2004-07-30 15:39 ` pinskia at gcc dot gnu dot org
  2004-07-30 15:56 ` timb at bluearc dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-30 15:39 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-07-30 15:39 -------
The documentation changed:
-Wformat
Check calls to printf and scanf, etc., to make sure that the arguments supplied have types appropriate 
to the format string specified, and that the conversions specified in the format string make sense. This 
includes standard functions, and others specified by format  attributes (see Function Attributes), in the 
printf, scanf, strftime and strfmon (an X/Open extension, not in the C standard) families (or other 
target-specific families).
The formats are checked against the format features supported by GNU libc version 2.2. These include 
all ISO C90 and C99 features, as well  as features from the Single Unix Specification and some BSD and 
GNU extensions. Other library implementations may not support all these  features; GCC does not 
support warning about features that go beyond a particular library's limitations. However, if -pedantic  
is used with -Wformat, warnings will be given about format features not in the selected standard 
version (but not for strfmon formats, since those are not in any version of the C standard). See Options 
Controlling C Dialect .

Since -Wformat also checks for null format arguments for several functions, -Wformat also implies -
Wnonnull.

-Wformat is included in -Wall. For more control over some  aspects of format checking, the options -
Wformat-y2k, -Wno-format-extra-args, -Wno-format-zero-length, -Wformat-nonliteral, -Wformat-
security, and -Wformat=2 are available, but are not included in -Wall. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |documentation


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16833


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

* [Bug c/16833] -fno-builtin prevents automatic format checks for standard functions
  2004-07-30 12:34 [Bug c/16833] New: -fno-builtin prevents automatic format checks for standard functions timb at bluearc dot com
  2004-07-30 15:39 ` [Bug c/16833] " pinskia at gcc dot gnu dot org
@ 2004-07-30 15:56 ` timb at bluearc dot com
  2004-07-30 19:04 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: timb at bluearc dot com @ 2004-07-30 15:56 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From timb at bluearc dot com  2004-07-30 15:56 -------
The documentation you quote is from a different section of the manual; I don't
think it really adds anything.

IMHO this is not purely a documentation bug.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16833


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

* [Bug c/16833] -fno-builtin prevents automatic format checks for standard functions
  2004-07-30 12:34 [Bug c/16833] New: -fno-builtin prevents automatic format checks for standard functions timb at bluearc dot com
  2004-07-30 15:39 ` [Bug c/16833] " pinskia at gcc dot gnu dot org
  2004-07-30 15:56 ` timb at bluearc dot com
@ 2004-07-30 19:04 ` pinskia at gcc dot gnu dot org
  2004-07-31 22:30 ` jsm at polyomino dot org dot uk
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-30 19:04 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-07-30 19:04 -------
Found it and yes it is just a documenation error:
<http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html>

The problem is that -fno-builtin did not exist until later and then was added which is where the 
problem comes into play.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-07-30 19:04:38
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16833


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

* [Bug c/16833] -fno-builtin prevents automatic format checks for standard functions
  2004-07-30 12:34 [Bug c/16833] New: -fno-builtin prevents automatic format checks for standard functions timb at bluearc dot com
                   ` (2 preceding siblings ...)
  2004-07-30 19:04 ` pinskia at gcc dot gnu dot org
@ 2004-07-31 22:30 ` jsm at polyomino dot org dot uk
  2004-09-23 16:11 ` cvs-commit at gcc dot gnu dot org
  2004-09-23 16:35 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: jsm at polyomino dot org dot uk @ 2004-07-31 22:30 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jsm at polyomino dot org dot uk  2004-07-31 22:30 -------
Subject: Re:  New: -fno-builtin prevents automatic format checks
 for standard functions

On Fri, 30 Jul 2004, timb at bluearc dot com wrote:

> The documentation for the format function attribute says: "The compiler always
> (unless -ffreestanding is used) checks formats for the standard library
> functions ... whenever such warnings are requested". However, these implicit
> attributes appear to be disabled also by -fno-builtin (which is implied by
> -ffreestanding).

This would be a result of the changes to unify all the built-in attribute
handling under the auspices of built-in functions (rather than having some
handled one way and some handled the other way).  Thus, it is an intended
change and a documentation bug; -fno-builtin now disables all the special
handling of particular function names (except for that using the remaining
routes to such special handling, special_function_p and cp/cfns.gperf).  
You can of course use attributes in the headers declaring the standard
format functions to get these warnings even with -fno-builtin.



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16833


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

* [Bug c/16833] -fno-builtin prevents automatic format checks for standard functions
  2004-07-30 12:34 [Bug c/16833] New: -fno-builtin prevents automatic format checks for standard functions timb at bluearc dot com
                   ` (3 preceding siblings ...)
  2004-07-31 22:30 ` jsm at polyomino dot org dot uk
@ 2004-09-23 16:11 ` cvs-commit at gcc dot gnu dot org
  2004-09-23 16:35 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-09-23 16:11 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-09-23 16:11 -------
Subject: Bug 16833

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	jsm28@gcc.gnu.org	2004-09-23 16:11:24

Modified files:
	gcc            : ChangeLog 
	gcc/doc        : extend.texi invoke.texi 

Log message:
	PR c/16833
	* doc/extend.texi, doc/invoke.texi: Document interaction of
	-fno-builtin with format checks.  Note that built-in functions
	have effects beyond generating code that avoids calls to those
	functions.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.5586&r2=2.5587
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/doc/extend.texi.diff?cvsroot=gcc&r1=1.218&r2=1.219
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/doc/invoke.texi.diff?cvsroot=gcc&r1=1.539&r2=1.540



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16833


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

* [Bug c/16833] -fno-builtin prevents automatic format checks for standard functions
  2004-07-30 12:34 [Bug c/16833] New: -fno-builtin prevents automatic format checks for standard functions timb at bluearc dot com
                   ` (4 preceding siblings ...)
  2004-09-23 16:11 ` cvs-commit at gcc dot gnu dot org
@ 2004-09-23 16:35 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-23 16:35 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-09-23 16:35 -------
Fixed for 4.0.0.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.0.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16833


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

end of thread, other threads:[~2004-09-23 16:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-30 12:34 [Bug c/16833] New: -fno-builtin prevents automatic format checks for standard functions timb at bluearc dot com
2004-07-30 15:39 ` [Bug c/16833] " pinskia at gcc dot gnu dot org
2004-07-30 15:56 ` timb at bluearc dot com
2004-07-30 19:04 ` pinskia at gcc dot gnu dot org
2004-07-31 22:30 ` jsm at polyomino dot org dot uk
2004-09-23 16:11 ` cvs-commit at gcc dot gnu dot org
2004-09-23 16:35 ` pinskia at gcc dot gnu dot org

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