Comment #2 on issue 1225 by [email protected]: src/runtime.cc:3951:5: error: comparison always false due to limited range of data type
http://code.google.com/p/v8/issues/detail?id=1225

I am experiencing the same issue with GCC 4.5.1

It is not actually an error but a warning, and it only appears when you compile with --O2 or -O3 optimization levels.

The line which seems to be causing the warning is the following one:
    strict_mode = static_cast<StrictModeFlag>(strict_unchecked);

If I replace it by:
strict_mode = strict_unchecked == kStrictMode ? kStrictMode : kNonStrictMode;
the compiler doesn't complain.

The static cast seems to be causing, under the mentioned optimization levels, a type inference that somehow converts strict_unchecked into an StrictModeFlag enum, and warns that the value of the condition in:
    RUNTIME_ASSERT(strict_unchecked == kStrictMode ||
                   strict_unchecked == kNonStrictMode);
is always true.

I guess this is related with some optimizations that were added to gcc in the 4.5 version: http://gcc.gnu.org/gcc-4.5/changes.html

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to