Status: Accepted
Owner: [email protected]
Labels: Type-Bug Priority-Medium

New issue 830 by [email protected]: Avoid using enums as opaque types, it confuses GCC value range propagation.
http://code.google.com/p/v8/issues/detail?id=830

We define StackFrame::Id as

  enum Id { NO_ID = 0 };

according to section 7.2/6 of C++ Standard range of values for this enumeration contains a single value: 0.

GCC exploits this fact when Value Range Propagation optimization is enabled and optimizes away certain functions, e.g.

static Smi* WrapFrameId(StackFrame::Id id) {
  return Smi::FromInt(id >> 2);
}

becomes

static Smi* WrapFrameId(StackFrame::Id id) {
  return 0;
}

which leads to incorrect behavior because we use StackFrame::Id to store values outside of it's range.

Currently we disable VRP optimization to make V8 work when compiled with GCC 4.4. Instead we should comply with Standard and fix our usage of enumeration types.

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

Reply via email to