This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: New gcc 4.0.0 warnings seem spurious


Vincent Lefevre <vincent+gcc@vinc17.org> writes:

| On 2005-04-27 12:29:53 +0100, Andrew Haley wrote:
| > Vincent Lefevre writes:
| >  > The only two constraints in 6.6 are:
| >  > 
| >  >        [#3] Constant  expressions  shall  not  contain  assignment,
| >  >        increment,  decrement,  function-call,  or  comma operators,
| >  >        except when they are contained within a  subexpression  that
| >  >        is not evaluated.86)
| >  > 
| >  >        [#4] Each constant expression shall evaluate to  a  constant
| >  >        that is in the range of representable values for its type.
| >  > 
| >  > #3 doesn't include variables. #4 is OK if one considers that the
| >  > value cannot be modified.
| >  > 
| >  > #6 adds other requirements, but this is out of the scope of the
| >  > given diagnostic (which complained about an expression not being a
| >  > constant -- not because it wasn't an integer constant expression).
| > 
| > 6.7.8 Para 4.  All the expressions for an initializer for an object
| >     that has static storage duration shall be constant expressions ...
|                                                 ^^^^^^^^^^^^^^^^^^^^
| It is said "constant expressions", not "integer constant expressions".

And an integer constant expression is not a constant expression in
your copy of the C standard?

| > 6.6 Para 6.  An integer constant expression shall have integer type
|                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
| >   and shall only have operands that are inetger constants, enumeration
| >   constants, character constants, sizeof expressions whose results are
| >   integer constants, and floating-point constans that are the
| >   immediate operands of casts ...
| 
| #6 is about an *integer* constant expression.

And?

-- Gaby


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]