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: Unsure about a new warning in mainline


On 15/01/07, Roger Sayle <roger@eyesopen.com> wrote:


The second issue is that there are two different overflow related
warnings.  The first warning indicates that an overflow has occurred in an
expression, and the second is that the overflowed result is used in a
context required
to be a compile-time constant.  Apparently, the latter is more serious
than the first, as an expression that overflows isn't considered a
"constant" according to the/some standard.


int main() { wchar_t wc = ((wchar_t)1 << 31) - 1; }

Excuse me if I am wrong but, does the initialization of wc really
needs to be constant here?
This is not the pedwarn emitted by c-common.c
(constant_expression_warning). This is a warning emitted by c-common.c
(convert_and_check). I am not sure if you were referring to the
former or the latter.

The difference is that in convert_and_check, the call to convert
returns a tree with TREE_OVERFLOW set for C++ but not set for C.

Anyhow I still find it odd that we emit two warnings.

Cheers,

Manuel.


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