public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/13507] New: spurious printf format warning
@ 2003-12-30  0:05 gcc-bugzilla at gcc dot gnu dot org
  2003-12-30  0:07 ` [Bug c++/13507] " pinskia at gcc dot gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: gcc-bugzilla at gcc dot gnu dot org @ 2003-12-30  0:05 UTC (permalink / raw)
  To: gcc-bugs


For the source below, gives a bogus warning when -Wall is used:

$ ./cc1plus -Wall -quiet x.i
x.i: In function `void foo(unsigned int)':
x.i:8: warning: format argument is not a pointer (arg 2)
$

This problem appears to have been introduced by this change:

2003-12-28  Roger Sayle  <roger@eyesopen.com>

	PR c++/13070
	* decl.c (duplicate_decls): When setting the type of an anticipated
	declaration, merge the existing type attributes.

If i revert that change, then the warning goes away.

Below is the dump of the attrs parameter at the entry
to check_function_format().  It contains _two_ format
attributes, one printf and one scanf.  check_format_info is being
called twice, once for each; the second time (the scanf one)
is when the warnings gets emitted.

 <tree_list 0x400eab40
    purpose <identifier_node 0x40026e40 format
    bindings <(nil)>
    local bindings <(nil)>>
    value <tree_list 0x40030ca8
        value <identifier_node 0x40026fc0 printf public
        bindings <0x4007a460>
        local bindings <(nil)>>
        chain <tree_list 0x40030b04
            value <integer_cst 0x40030a50 constant 1>
            chain <tree_list 0x40030a8c
                value <integer_cst 0x40030a78 constant 2>>>>
    chain <tree_list 0x4007a8fc
        purpose <identifier_node 0x40026f00 nonnull
        bindings <(nil)>
        local bindings <(nil)>>
        value <tree_list 0x40030a64 value <integer_cst 0x40030a50 1>>
        chain <tree_list 0x4007a8e8 purpose <identifier_node 0x40026e40 format>
            value <tree_list 0x40030d98
                value <identifier_node 0x40033140 scanf public
                bindings <0x4007a988>
                local bindings <(nil)>> chain <tree_list 0x40030b04>>>>>

Environment:
System: Linux karma 2.6.0 #9 Sun Dec 28 19:12:01 EST 2003 i686 i686 i386 GNU/Linux
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc/configure --prefix=/usr/local/gcc --enable-threads=posix --enable-long-long --enable-languages=c,c++,f77

How-To-Repeat:

Compile with -Wall:

-----------------------------------------------------------
extern "C" {
extern int printf (__const char *__restrict __format, ...) throw ();
extern int scanf (__const char *__restrict __format, ...) throw ();
}

void foo(unsigned int x)
{
  printf ("%d\n", x);
}
-----------------------------------------------------------

-- 
           Summary: spurious printf format warning
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: snyder at fnal dot gov
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug c++/13507] spurious printf format warning
  2003-12-30  0:05 [Bug c++/13507] New: spurious printf format warning gcc-bugzilla at gcc dot gnu dot org
@ 2003-12-30  0:07 ` pinskia at gcc dot gnu dot org
  2003-12-30  0:58 ` pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-30  0:07 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-12-30 00:05 -------
The problem was not introduced by that patch, that patch fixed -Wformat for C++.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|3.4                         |3.4.0


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


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

* [Bug c++/13507] spurious printf format warning
  2003-12-30  0:05 [Bug c++/13507] New: spurious printf format warning gcc-bugzilla at gcc dot gnu dot org
  2003-12-30  0:07 ` [Bug c++/13507] " pinskia at gcc dot gnu dot org
@ 2003-12-30  0:58 ` pinskia at gcc dot gnu dot org
  2003-12-30  9:49 ` [Bug c++/13507] [3.3/3.4 Regression] " pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-30  0:58 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-12-30 00:43 -------
This is another case of tree sharing.
Roger could look into this one, since you caused it.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |sayle at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|                            |1
           Keywords|                            |diagnostic
   Last reconfirmed|0000-00-00 00:00:00         |2003-12-30 00:43:00
               date|                            |
   Target Milestone|---                         |3.3.3


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


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

* [Bug c++/13507] [3.3/3.4 Regression] spurious printf format warning
  2003-12-30  0:05 [Bug c++/13507] New: spurious printf format warning gcc-bugzilla at gcc dot gnu dot org
  2003-12-30  0:07 ` [Bug c++/13507] " pinskia at gcc dot gnu dot org
  2003-12-30  0:58 ` pinskia at gcc dot gnu dot org
@ 2003-12-30  9:49 ` pinskia at gcc dot gnu dot org
  2003-12-30 11:53 ` nathan at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-30  9:49 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-12-30 07:00 -------
I posted a patch which should fix it: <http://gcc.gnu.org/ml/gcc-patches/2003-12/
msg02251.html> and not brake every thing else.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|sayle at gcc dot gnu dot org|pinskia at gcc dot gnu dot
                   |                            |org
           Keywords|                            |patch


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


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

* [Bug c++/13507] [3.3/3.4 Regression] spurious printf format warning
  2003-12-30  0:05 [Bug c++/13507] New: spurious printf format warning gcc-bugzilla at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2003-12-30  9:49 ` [Bug c++/13507] [3.3/3.4 Regression] " pinskia at gcc dot gnu dot org
@ 2003-12-30 11:53 ` nathan at gcc dot gnu dot org
  2003-12-30 12:28 ` cvs-commit at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: nathan at gcc dot gnu dot org @ 2003-12-30 11:53 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From nathan at gcc dot gnu dot org  2003-12-30 10:48 -------
Sorry, that patch cannot be right. I'm testing a patch that
correctly merges the attributes.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|pinskia at gcc dot gnu dot  |nathan at gcc dot gnu dot
                   |org                         |org


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


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

* [Bug c++/13507] [3.3/3.4 Regression] spurious printf format warning
  2003-12-30  0:05 [Bug c++/13507] New: spurious printf format warning gcc-bugzilla at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2003-12-30 11:53 ` nathan at gcc dot gnu dot org
@ 2003-12-30 12:28 ` cvs-commit at gcc dot gnu dot org
  2003-12-30 12:34 ` nathan at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2003-12-30 12:28 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2003-12-30 12:18 -------
Subject: Bug 13507

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	nathan@gcc.gnu.org	2003-12-30 12:18:28

Modified files:
	gcc/cp         : ChangeLog decl.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/ext: attrib11.C 

Log message:
	cp:
	PR c++/13507
	* decl.c (duplicate_decls): Use build_type_attribute_variant to
	merge attributes.
	testsuite:
	PR c++/13507
	* g++.dg/ext/attrib11.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3842&r2=1.3843
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.1169&r2=1.1170
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3322&r2=1.3323
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/attrib11.C.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug c++/13507] [3.3/3.4 Regression] spurious printf format warning
  2003-12-30  0:05 [Bug c++/13507] New: spurious printf format warning gcc-bugzilla at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2003-12-30 12:28 ` cvs-commit at gcc dot gnu dot org
@ 2003-12-30 12:34 ` nathan at gcc dot gnu dot org
  2003-12-30 17:21 ` [Bug c++/13507] [3.3 " pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: nathan at gcc dot gnu dot org @ 2003-12-30 12:34 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From nathan at gcc dot gnu dot org  2003-12-30 12:19 -------
2003-12-30  Nathan Sidwell  <nathan@codesourcery.com>

	PR c++/13507
	* decl.c (duplicate_decls): Use build_type_attribute_variant to
	merge attributes.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


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

* [Bug c++/13507] [3.3 Regression] spurious printf format warning
  2003-12-30  0:05 [Bug c++/13507] New: spurious printf format warning gcc-bugzilla at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2003-12-30 12:34 ` nathan at gcc dot gnu dot org
@ 2003-12-30 17:21 ` pinskia at gcc dot gnu dot org
  2003-12-31 17:41 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-30 17:21 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-12-30 17:02 -------
Should also be fixed for 3.3.3 also, right?

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |
            Summary|[3.3/3.4 Regression]        |[3.3 Regression] spurious
                   |spurious printf format      |printf format warning
                   |warning                     |


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


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

* [Bug c++/13507] [3.3 Regression] spurious printf format warning
  2003-12-30  0:05 [Bug c++/13507] New: spurious printf format warning gcc-bugzilla at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2003-12-30 17:21 ` [Bug c++/13507] [3.3 " pinskia at gcc dot gnu dot org
@ 2003-12-31 17:41 ` pinskia at gcc dot gnu dot org
  2004-01-01  3:32 ` cvs-commit at gcc dot gnu dot org
  2004-01-01  3:34 ` pinskia at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-31 17:41 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |ASSIGNED
   Last reconfirmed|2003-12-30 00:43:00         |2003-12-31 17:00:41
               date|                            |


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


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

* [Bug c++/13507] [3.3 Regression] spurious printf format warning
  2003-12-30  0:05 [Bug c++/13507] New: spurious printf format warning gcc-bugzilla at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2003-12-31 17:41 ` pinskia at gcc dot gnu dot org
@ 2004-01-01  3:32 ` cvs-commit at gcc dot gnu dot org
  2004-01-01  3:34 ` pinskia at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-01-01  3:32 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-01-01 03:32 -------
Subject: Bug 13507

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_3-branch
Changes by:	pinskia@gcc.gnu.org	2004-01-01 03:32:14

Modified files:
	gcc/cp         : ChangeLog decl.c 

Log message:
	2003-12-20  Andrew Pinski  <pinskia@physics.uc.edu>
	
	Backport from mainline:
	2003-12-30  Nathan Sidwell  <nathan@codesourcery.com>
	
	PR c++/13507
	* decl.c (duplicate_decls): Use build_type_attribute_variant to
	merge attributes.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.3076.2.233&r2=1.3076.2.234
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.965.2.68&r2=1.965.2.69



-- 


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


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

* [Bug c++/13507] [3.3 Regression] spurious printf format warning
  2003-12-30  0:05 [Bug c++/13507] New: spurious printf format warning gcc-bugzilla at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2004-01-01  3:32 ` cvs-commit at gcc dot gnu dot org
@ 2004-01-01  3:34 ` pinskia at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-01-01  3:34 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-01-01 03:34 -------
Fixed for 3.3.3 also.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2004-01-01  3:34 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-30  0:05 [Bug c++/13507] New: spurious printf format warning gcc-bugzilla at gcc dot gnu dot org
2003-12-30  0:07 ` [Bug c++/13507] " pinskia at gcc dot gnu dot org
2003-12-30  0:58 ` pinskia at gcc dot gnu dot org
2003-12-30  9:49 ` [Bug c++/13507] [3.3/3.4 Regression] " pinskia at gcc dot gnu dot org
2003-12-30 11:53 ` nathan at gcc dot gnu dot org
2003-12-30 12:28 ` cvs-commit at gcc dot gnu dot org
2003-12-30 12:34 ` nathan at gcc dot gnu dot org
2003-12-30 17:21 ` [Bug c++/13507] [3.3 " pinskia at gcc dot gnu dot org
2003-12-31 17:41 ` pinskia at gcc dot gnu dot org
2004-01-01  3:32 ` cvs-commit at gcc dot gnu dot org
2004-01-01  3:34 ` 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).