Index: src/deoptimizer.h |
diff --git a/src/deoptimizer.h b/src/deoptimizer.h |
index 706d1f0523eb026b96fc0f0011aaf6bafcdea170..4e9d281ea52f762305a3435b364b88674dd2f55f 100644 |
--- a/src/deoptimizer.h |
+++ b/src/deoptimizer.h |
@@ -506,7 +506,15 @@ class FrameDescription { |
void SetCallerFp(unsigned offset, intptr_t value); |
intptr_t GetRegister(unsigned n) const { |
- ASSERT(n < ARRAY_SIZE(registers_)); |
+#if DEBUG |
+ // This convoluted ASSERT is needed to work around a gcc problem that |
+ // improperly detects an array bounds overflow in optimized debug builds |
+ // when using a plain ASSERT. |
+ if (n >= ARRAY_SIZE(registers_)) { |
+ ASSERT(false); |
+ return 0; |
+ } |
+#endif |
return registers_[n]; |
} |