public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/38980] missing -Wformat warning on const char format string
       [not found] <bug-38980-4@http.gcc.gnu.org/bugzilla/>
@ 2011-09-28 22:06 ` paolo.carlini at oracle dot com
  2011-09-30  8:31 ` [Bug c++/38980] [4.4/4.5/4.6/4.7 Regression] " jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-09-28 22:06 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|gcc-bugs at gcc dot gnu.org |jakub at gcc dot gnu.org

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-09-28 21:58:03 UTC ---
Jakub, can you have a look to this?


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

* [Bug c++/38980] [4.4/4.5/4.6/4.7 Regression] missing -Wformat warning on const char format string
       [not found] <bug-38980-4@http.gcc.gnu.org/bugzilla/>
  2011-09-28 22:06 ` [Bug c++/38980] missing -Wformat warning on const char format string paolo.carlini at oracle dot com
@ 2011-09-30  8:31 ` jakub at gcc dot gnu.org
  2011-10-05 10:26 ` paolo.carlini at oracle dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-09-30  8:31 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011-09-30
                 CC|                            |jason at gcc dot gnu.org,
                   |                            |jsm28 at gcc dot gnu.org
   Target Milestone|---                         |4.4.7
            Summary|missing -Wformat warning on |[4.4/4.5/4.6/4.7
                   |const char format string    |Regression] missing
                   |                            |-Wformat warning on const
                   |                            |char format string
     Ever Confirmed|0                           |1

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-09-30 07:46:22 UTC ---
I think this has been caused by
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21089#c25
The c-format* stuff uses decl_constant_value, for C it will for
const array variable with STRING_CST DECL_INITIAL return the DECL_INITIAL, but
in C++ I think since the above commit it will not:
105256   mmitchel                /* Do not return an aggregate constant (of
which
105256   mmitchel                   string literals are a special case), as we
do not
106533       kazu                   want to make inadvertent copies of such
entities,
105256   mmitchel                   and we must be sure that their addresses
are the
105256   mmitchel                   same everywhere.  */
105256   mmitchel                || TREE_CODE (init) == CONSTRUCTOR
105256   mmitchel                || TREE_CODE (init) == STRING_CST)))

So, either we need a different function or an argument to decl_constant_value
to force returning STRING_CST in that case, because in c-format case making
inadvertent copies of such entities isn't a problem, c-format only wants to
check that literal.


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

* [Bug c++/38980] [4.4/4.5/4.6/4.7 Regression] missing -Wformat warning on const char format string
       [not found] <bug-38980-4@http.gcc.gnu.org/bugzilla/>
  2011-09-28 22:06 ` [Bug c++/38980] missing -Wformat warning on const char format string paolo.carlini at oracle dot com
  2011-09-30  8:31 ` [Bug c++/38980] [4.4/4.5/4.6/4.7 Regression] " jakub at gcc dot gnu.org
@ 2011-10-05 10:26 ` paolo.carlini at oracle dot com
  2011-10-09 23:21 ` paolo at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-10-05 10:26 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |paolo.carlini at oracle dot
                   |gnu.org                     |com


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

* [Bug c++/38980] [4.4/4.5/4.6/4.7 Regression] missing -Wformat warning on const char format string
       [not found] <bug-38980-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2011-10-05 10:26 ` paolo.carlini at oracle dot com
@ 2011-10-09 23:21 ` paolo at gcc dot gnu.org
  2011-10-09 23:24 ` [Bug c++/38980] [4.4/4.5/4.6 " paolo.carlini at oracle dot com
  2011-10-15 20:56 ` paolo.carlini at oracle dot com
  5 siblings, 0 replies; 6+ messages in thread
From: paolo at gcc dot gnu.org @ 2011-10-09 23:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> 2011-10-09 23:20:43 UTC ---
Author: paolo
Date: Sun Oct  9 23:20:39 2011
New Revision: 179731

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=179731
Log:
/cp
2011-10-09  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/38980
    * init.c (constant_value_1): Add bool parameter.
    (decl_constant_value_safe): Add.
    (integral_constant_value): Adjust.
    (decl_constant_value): Adjust.
    * cp-tree.h (decl_constant_value_safe): Declare.
    * typeck.c (decay_conversion): Use decl_constant_value_safe.
    * call.c (convert_like_real): Likewise.

/testsuite
2011-10-09  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/38980
    * g++.dg/warn/format5.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/warn/format5.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/call.c
    trunk/gcc/cp/cp-tree.h
    trunk/gcc/cp/init.c
    trunk/gcc/cp/typeck.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/38980] [4.4/4.5/4.6 Regression] missing -Wformat warning on const char format string
       [not found] <bug-38980-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2011-10-09 23:21 ` paolo at gcc dot gnu.org
@ 2011-10-09 23:24 ` paolo.carlini at oracle dot com
  2011-10-15 20:56 ` paolo.carlini at oracle dot com
  5 siblings, 0 replies; 6+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-10-09 23:24 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |NEW
         AssignedTo|paolo.carlini at oracle dot |unassigned at gcc dot
                   |com                         |gnu.org
            Summary|[4.4/4.5/4.6/4.7            |[4.4/4.5/4.6 Regression]
                   |Regression] missing         |missing -Wformat warning on
                   |-Wformat warning on const   |const char format string
                   |char format string          |

--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-10-09 23:22:57 UTC ---
Fixed for 4.7.0 so far.


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

* [Bug c++/38980] [4.4/4.5/4.6 Regression] missing -Wformat warning on const char format string
       [not found] <bug-38980-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2011-10-09 23:24 ` [Bug c++/38980] [4.4/4.5/4.6 " paolo.carlini at oracle dot com
@ 2011-10-15 20:56 ` paolo.carlini at oracle dot com
  5 siblings, 0 replies; 6+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-10-15 20:56 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

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

--- Comment #6 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-10-15 20:54:43 UTC ---
Fixed for 4.7.0, wontfix 4.4/4.5/4.6.


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

end of thread, other threads:[~2011-10-15 20:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-38980-4@http.gcc.gnu.org/bugzilla/>
2011-09-28 22:06 ` [Bug c++/38980] missing -Wformat warning on const char format string paolo.carlini at oracle dot com
2011-09-30  8:31 ` [Bug c++/38980] [4.4/4.5/4.6/4.7 Regression] " jakub at gcc dot gnu.org
2011-10-05 10:26 ` paolo.carlini at oracle dot com
2011-10-09 23:21 ` paolo at gcc dot gnu.org
2011-10-09 23:24 ` [Bug c++/38980] [4.4/4.5/4.6 " paolo.carlini at oracle dot com
2011-10-15 20:56 ` paolo.carlini at oracle dot com

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