public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/57137] New: spurious "format string is not literal" when the format string is marked with __attribute__((format))
@ 2013-05-01 16:20 zbyszek at in dot waw.pl
  2013-05-01 18:00 ` [Bug c/57137] " pinskia at gcc dot gnu.org
  2013-05-02  2:02 ` zbyszek at in dot waw.pl
  0 siblings, 2 replies; 3+ messages in thread
From: zbyszek at in dot waw.pl @ 2013-05-01 16:20 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 57137
           Summary: spurious "format string is not literal" when the
                    format string is marked with __attribute__((format))
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: zbyszek@in.waw.pl


If the format string is marked as a printf format with an attribute
format((printf(...)) on the wrapper function, then gcc should know that it's
either a valid printf format, or will be warned about at the point
where it is passed to the wrapper function, and shouldn't warn that
the format string is not a literal.

Attached example gives:
unit.c: In function ‘unit_status_printf’:
unit.c:6:9: warning: format not a string literal, argument types not checked
[-Wformat-nonliteral]
         manager_status_printf(status, unit_status_msg_format, "xxx");
         ^

It is possible to work around by placing #pragma GCC diagnostic ignored
"-Wformat-nonliteral" before the function, but that feels like a kludge.
>From gcc-bugs-return-421349-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed May 01 16:20:55 2013
Return-Path: <gcc-bugs-return-421349-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 28898 invoked by alias); 1 May 2013 16:20:55 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 28880 invoked by uid 48); 1 May 2013 16:20:52 -0000
From: "zbyszek at in dot waw.pl" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/57137] spurious "format string is not literal" when the format string is marked with __attribute__((format))
Date: Wed, 01 May 2013 16:20:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: zbyszek at in dot waw.pl
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Changed-Fields:
Message-ID: <bug-57137-4-TMcY3p5IxG@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-57137-4@http.gcc.gnu.org/bugzilla/>
References: <bug-57137-4@http.gcc.gnu.org/bugzilla/>
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-SW-Source: 2013-05/txt/msg00022.txt.bz2
Content-length: 270


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

--- Comment #1 from Zbigniew Jędrzejewski-Szmek <zbyszek at in dot waw.pl> 2013-05-01 16:20:52 UTC ---
Created attachment 29988
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29988
preprocessed example
>From gcc-bugs-return-421350-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed May 01 16:22:11 2013
Return-Path: <gcc-bugs-return-421350-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 29903 invoked by alias); 1 May 2013 16:22:11 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 29868 invoked by uid 48); 1 May 2013 16:22:08 -0000
From: "zbyszek at in dot waw.pl" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/57137] spurious "format string is not literal" when the format string is marked with __attribute__((format))
Date: Wed, 01 May 2013 16:22:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: zbyszek at in dot waw.pl
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Changed-Fields:
Message-ID: <bug-57137-4-7PPd36VJ37@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-57137-4@http.gcc.gnu.org/bugzilla/>
References: <bug-57137-4@http.gcc.gnu.org/bugzilla/>
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-SW-Source: 2013-05/txt/msg00023.txt.bz2
Content-length: 219


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

--- Comment #2 from Zbigniew Jędrzejewski-Szmek <zbyszek at in dot waw.pl> 2013-05-01 16:22:08 UTC ---
Forgot to specify gcc version:
gcc-4.8.0-2.fc19.x86_64
>From gcc-bugs-return-421351-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed May 01 16:24:36 2013
Return-Path: <gcc-bugs-return-421351-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 32065 invoked by alias); 1 May 2013 16:24:36 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 31823 invoked by uid 48); 1 May 2013 16:24:33 -0000
From: "zbyszek at in dot waw.pl" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/57137] spurious "format string is not literal" when the format string is marked with __attribute__((format))
Date: Wed, 01 May 2013 16:24:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: zbyszek at in dot waw.pl
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Changed-Fields:
Message-ID: <bug-57137-4-4tSKt7NQGy@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-57137-4@http.gcc.gnu.org/bugzilla/>
References: <bug-57137-4@http.gcc.gnu.org/bugzilla/>
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-SW-Source: 2013-05/txt/msg00024.txt.bz2
Content-length: 265


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

--- Comment #3 from Zbigniew Jędrzejewski-Szmek <zbyszek at in dot waw.pl> 2013-05-01 16:24:32 UTC ---
Created attachment 29989
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29989
minimal example
>From gcc-bugs-return-421352-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed May 01 16:54:21 2013
Return-Path: <gcc-bugs-return-421352-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 26921 invoked by alias); 1 May 2013 16:54:21 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 26716 invoked by uid 48); 1 May 2013 16:54:18 -0000
From: "dominiq at lps dot ens.fr" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/57129] [4.7/4.8/4.9 Regression] ICE (segfault) in check_extended_derived_type
Date: Wed, 01 May 2013 16:54:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: fortran
X-Bugzilla-Keywords: error-recovery, ice-on-invalid-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: dominiq at lps dot ens.fr
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Changed-Fields: Status Last reconfirmed Summary Ever Confirmed
Message-ID: <bug-57129-4-7eKMVIN7Xd@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-57129-4@http.gcc.gnu.org/bugzilla/>
References: <bug-57129-4@http.gcc.gnu.org/bugzilla/>
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
Content-Type: text/plain; charset="UTF-8"
MIME-Version: 1.0
X-SW-Source: 2013-05/txt/msg00025.txt.bz2
Content-length: 1250


http://gcc.gnu.org/bugzilla/show_bug.cgi?idW129

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-05-01
            Summary|ICE (segfault) in           |[4.7/4.8/4.9 Regression]
                   |check_extended_derived_type |ICE (segfault) in
                   |                            |check_extended_derived_type
     Ever Confirmed|0                           |1

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2013-05-01 16:54:17 UTC ---
Revision 181424 gives the following errors

pr57129.f90:2.8:

  type t
        1
Error: PROCEDURE attribute of 't' conflicts with DERIVED attribute at (1)
pr57129.f90:3.5:

  end type t
     1
Error: Expecting END SUBROUTINE statement at (1)
pr57129.f90:4.18:

  type, extends(t) :: t2
                  1
Error: 't' in EXTENDS expression at (1) is not a derived type
pr57129.f90:5.5:

  end type t2
     1
Error: Expecting END SUBROUTINE statement at (1)

revision 181425 gives the ICE.


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

* [Bug c/57137] spurious "format string is not literal" when the format string is marked with __attribute__((format))
  2013-05-01 16:20 [Bug c/57137] New: spurious "format string is not literal" when the format string is marked with __attribute__((format)) zbyszek at in dot waw.pl
@ 2013-05-01 18:00 ` pinskia at gcc dot gnu.org
  2013-05-02  2:02 ` zbyszek at in dot waw.pl
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-05-01 18:00 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> 2013-05-01 18:00:31 UTC ---
What options are you using when calling gcc?


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

* [Bug c/57137] spurious "format string is not literal" when the format string is marked with __attribute__((format))
  2013-05-01 16:20 [Bug c/57137] New: spurious "format string is not literal" when the format string is marked with __attribute__((format)) zbyszek at in dot waw.pl
  2013-05-01 18:00 ` [Bug c/57137] " pinskia at gcc dot gnu.org
@ 2013-05-02  2:02 ` zbyszek at in dot waw.pl
  1 sibling, 0 replies; 3+ messages in thread
From: zbyszek at in dot waw.pl @ 2013-05-02  2:02 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #5 from Zbigniew Jędrzejewski-Szmek <zbyszek at in dot waw.pl> 2013-05-02 02:02:18 UTC ---
(In reply to comment #4)
> What options are you using when calling gcc?

Ah, I had it copied but forgot to paste...

gcc -pipe -Wall -Wextra -Wno-inline -Wundef -Wformat=2 -Wformat-security
-Wformat-nonliteral -Wlogical-op -Wsign-compare -Wmissing-include-dirs
-Wold-style-definition -Wpointer-arith -Winit-self
-Wdeclaration-after-statement -Wfloat-equal -Wmissing-prototypes
-Wstrict-prototypes -Wredundant-decls -Wmissing-declarations -Wmissing-noreturn
-Wshadow -Wendif-labels -Wcast-align -Wstrict-aliasing=2 -Wwrite-strings
-Wno-long-long -Wno-overlength-strings -Wno-unused-parameter
-Wno-missing-field-initializers -Wno-unused-result -Werror=overflow -ffast-math
-fno-common -fdiagnostics-show-option -fno-strict-aliasing -fvisibility=hidden
-ffunction-sections -fdata-sections -fstack-protector --param=ssp-buffer-size=4
-I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include       -pthread -O0 -g -c
unit.c -save-temps

or simpler:

gcc -Wformat-nonliteral -Wformat=2  -c unit.c -save-temps
>From gcc-bugs-return-421378-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu May 02 02:20:41 2013
Return-Path: <gcc-bugs-return-421378-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 13859 invoked by alias); 2 May 2013 02:20:41 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 13827 invoked by uid 48); 2 May 2013 02:20:37 -0000
From: "netravathi.muniraju at asia dot thalesgroup.com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug gcov-profile/57121] undefined reference to gcov_merge_init and gcov_merge_add
Date: Thu, 02 May 2013 02:20:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: gcov-profile
X-Bugzilla-Keywords: link-failure
X-Bugzilla-Severity: blocker
X-Bugzilla-Who: netravathi.muniraju at asia dot thalesgroup.com
X-Bugzilla-Status: WAITING
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Changed-Fields:
Message-ID: <bug-57121-4-fmeq9EcfyN@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-57121-4@http.gcc.gnu.org/bugzilla/>
References: <bug-57121-4@http.gcc.gnu.org/bugzilla/>
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
Content-Type: text/plain; charset="UTF-8"
MIME-Version: 1.0
X-SW-Source: 2013-05/txt/msg00051.txt.bz2
Content-length: 326


http://gcc.gnu.org/bugzilla/show_bug.cgi?idW121

--- Comment #8 from Netra <netravathi.muniraju at asia dot thalesgroup.com> 2013-05-02 02:20:37 UTC ---
I have a question,

are both the flags -fprofile-arcs -ftest-coverage required for the code
coverage?
 or is this -ftest-coverage flag enough for code coverage?


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

end of thread, other threads:[~2013-05-02  2:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-01 16:20 [Bug c/57137] New: spurious "format string is not literal" when the format string is marked with __attribute__((format)) zbyszek at in dot waw.pl
2013-05-01 18:00 ` [Bug c/57137] " pinskia at gcc dot gnu.org
2013-05-02  2:02 ` zbyszek at in dot waw.pl

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