This is the mail archive of the gcc-patches@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]

[committed] Fix assert in gimple_phi_arg


Hi,

this patch makes an assert in gimple_phi_arg more strict.

The current assert allows 'index == phi_stmt->capacity', but 'phi_stmt->args[phi_stmt->capacity]' is out of bounds.

Bootstrapped and reg-tested on x86_64.

Committed as obvious.

Thanks,
- Tom
Fix assert in gimple_phi_arg

2017-07-19  Tom de Vries  <tom@codesourcery.com>

	* gimple.h (gimple_phi_arg): Make assert more strict.

---
 gcc/gimple.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/gimple.h b/gcc/gimple.h
index 575babe..e19cc1c 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -4341,7 +4341,7 @@ static inline struct phi_arg_d *
 gimple_phi_arg (gimple *gs, unsigned index)
 {
   gphi *phi_stmt = as_a <gphi *> (gs);
-  gcc_gimple_checking_assert (index <= phi_stmt->capacity);
+  gcc_gimple_checking_assert (index < phi_stmt->capacity);
   return &(phi_stmt->args[index]);
 }
 

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