[Bug c++/31843] -Wformat-nonliteral differs between gcc and g++

manu at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sun Feb 21 01:27:00 GMT 2010



------- Comment #2 from manu at gcc dot gnu dot org  2010-02-21 01:27 -------
Confirmed. The problem is that constant_value_1 has the following code:

      if (!init
          || !TREE_TYPE (init)
          || (integral_p
              ? !INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (init))
              : (!TREE_CONSTANT (init)
                 /* Do not return an aggregate constant (of which
                    string literals are a special case), as we do not
                    want to make inadvertent copies of such entities,
                    and we must be sure that their addresses are the
                    same everywhere.  */
=>               || TREE_CODE (init) == CONSTRUCTOR
                 || TREE_CODE (init) == STRING_CST)))


So it does not consider string constant as constant initializers. I think this
is probably breaking more than this warning.


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu dot org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-02-21 01:27:20
               date|                            |


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



More information about the Gcc-bugs mailing list