public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/21509] New: [3.3 regression] -Wformat=2 incorrectly warns about string literalness
@ 2005-05-11  9:53 rguenth at gcc dot gnu dot org
  2005-05-11 10:48 ` [Bug c++/21509] [3.4/4.0/4.1 " pinskia at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2005-05-11  9:53 UTC (permalink / raw)
  To: gcc-bugs

Consider

#include <stdio.h>

void foo(int i)
{
        printf("Hello World %d!\n", i);
        printf(&"Hello World %d!\n"[0], i);
        printf(&"Hello World %d!\n"[6], i);
}

> g++-3.3 -c c-format.C -Wformat=2
> g++-3.4 -c c-format.C -Wformat=2
c-format.C: In function `void foo(int)':
c-format.C:6: warning: format not a string literal, argument types not checked
> g++-4.0 -c c-format.C -Wformat=2
c-format.C: In function 'void foo(int)':
c-format.C:6: warning: format not a string literal, argument types not checked
c-format.C:7: warning: format not a string literal, argument types not checked
> g++-4.1 -c c-format.C -Wformat=2
c-format.C: In function 'void foo(int)':
c-format.C:6: warning: format not a string literal, argument types not checked
c-format.C:7: warning: format not a string literal, argument types not checked

so we're getting worse here.  The problem is that c-format.c:check_format_arg
does not handle string literals of the form ADDR_EXPR (ARRAY_REF ( ... )).

This blocks changing the C frontend to emit &a[0] for array-to-pointer decay.

-- 
           Summary: [3.3 regression] -Wformat=2 incorrectly warns about
                    string literalness
           Product: gcc
           Version: 3.4.4
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rguenth at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/21509] [3.4/4.0/4.1 regression] -Wformat=2 incorrectly warns about string literalness
  2005-05-11  9:53 [Bug c++/21509] New: [3.3 regression] -Wformat=2 incorrectly warns about string literalness rguenth at gcc dot gnu dot org
@ 2005-05-11 10:48 ` pinskia at gcc dot gnu dot org
  2005-05-11 11:19 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-11 10:48 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-11 10:48 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
      Known to fail|                            |3.4.0 4.0.0 4.1.0
      Known to work|                            |3.3.3
   Last reconfirmed|0000-00-00 00:00:00         |2005-05-11 10:48:40
               date|                            |
            Summary|[3.3 regression] -Wformat=2 |[3.4/4.0/4.1 regression] -
                   |incorrectly warns about     |Wformat=2 incorrectly warns
                   |string literalness          |about string literalness
   Target Milestone|---                         |3.4.4


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


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

* [Bug c++/21509] [3.4/4.0/4.1 regression] -Wformat=2 incorrectly warns about string literalness
  2005-05-11  9:53 [Bug c++/21509] New: [3.3 regression] -Wformat=2 incorrectly warns about string literalness rguenth at gcc dot gnu dot org
  2005-05-11 10:48 ` [Bug c++/21509] [3.4/4.0/4.1 " pinskia at gcc dot gnu dot org
@ 2005-05-11 11:19 ` pinskia at gcc dot gnu dot org
  2005-05-15 20:59 ` [Bug c++/21509] [3.4/4.0 " rguenth at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-11 11:19 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-11 11:19 -------
Patch posted here: <http://gcc.gnu.org/ml/gcc-patches/2005-05/msg00978.html>.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |http://gcc.gnu.org/ml/gcc-
                   |                            |patches/2005-
                   |                            |05/msg00978.html
           Keywords|                            |patch


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


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

* [Bug c++/21509] [3.4/4.0 regression] -Wformat=2 incorrectly warns about string literalness
  2005-05-11  9:53 [Bug c++/21509] New: [3.3 regression] -Wformat=2 incorrectly warns about string literalness rguenth at gcc dot gnu dot org
  2005-05-11 10:48 ` [Bug c++/21509] [3.4/4.0/4.1 " pinskia at gcc dot gnu dot org
  2005-05-11 11:19 ` pinskia at gcc dot gnu dot org
@ 2005-05-15 20:59 ` rguenth at gcc dot gnu dot org
  2005-05-19 17:39 ` mmitchel at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2005-05-15 20:59 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rguenth at gcc dot gnu dot org  2005-05-15 20:59 -------
Fixed on mainline.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|3.4.0 4.0.0 4.1.0           |3.4.0 4.0.0
      Known to work|3.3.3                       |3.3.3 4.1.0
            Summary|[3.4/4.0/4.1 regression] -  |[3.4/4.0 regression] -
                   |Wformat=2 incorrectly warns |Wformat=2 incorrectly warns
                   |about string literalness    |about string literalness


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


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

* [Bug c++/21509] [3.4/4.0 regression] -Wformat=2 incorrectly warns about string literalness
  2005-05-11  9:53 [Bug c++/21509] New: [3.3 regression] -Wformat=2 incorrectly warns about string literalness rguenth at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2005-05-15 20:59 ` [Bug c++/21509] [3.4/4.0 " rguenth at gcc dot gnu dot org
@ 2005-05-19 17:39 ` mmitchel at gcc dot gnu dot org
  2005-07-22 21:13 ` pinskia at gcc dot gnu dot org
  2005-09-27 16:20 ` mmitchel at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-05-19 17:39 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|3.4.4                       |3.4.5


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


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

* [Bug c++/21509] [3.4/4.0 regression] -Wformat=2 incorrectly warns about string literalness
  2005-05-11  9:53 [Bug c++/21509] New: [3.3 regression] -Wformat=2 incorrectly warns about string literalness rguenth at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2005-05-19 17:39 ` mmitchel at gcc dot gnu dot org
@ 2005-07-22 21:13 ` pinskia at gcc dot gnu dot org
  2005-09-27 16:20 ` mmitchel at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-22 21:13 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-22 21:12 -------
Moving to 4.0.2 pre Mark.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|3.4.5                       |4.0.2


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


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

* [Bug c++/21509] [3.4/4.0 regression] -Wformat=2 incorrectly warns about string literalness
  2005-05-11  9:53 [Bug c++/21509] New: [3.3 regression] -Wformat=2 incorrectly warns about string literalness rguenth at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2005-07-22 21:13 ` pinskia at gcc dot gnu dot org
@ 2005-09-27 16:20 ` mmitchel at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-09-27 16:20 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.0.2                       |4.0.3


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


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

end of thread, other threads:[~2005-09-27 16:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-11  9:53 [Bug c++/21509] New: [3.3 regression] -Wformat=2 incorrectly warns about string literalness rguenth at gcc dot gnu dot org
2005-05-11 10:48 ` [Bug c++/21509] [3.4/4.0/4.1 " pinskia at gcc dot gnu dot org
2005-05-11 11:19 ` pinskia at gcc dot gnu dot org
2005-05-15 20:59 ` [Bug c++/21509] [3.4/4.0 " rguenth at gcc dot gnu dot org
2005-05-19 17:39 ` mmitchel at gcc dot gnu dot org
2005-07-22 21:13 ` pinskia at gcc dot gnu dot org
2005-09-27 16:20 ` mmitchel 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).