diff mbox

[committed] Fix assert in gimple_phi_set_arg

Message ID 926f1bae-4952-1e69-a59d-dc192badf481@mentor.com
State New
Headers show

Commit Message

Tom de Vries July 19, 2017, 4:25 p.m. UTC
Hi,

this patch makes an assert in gimple_phi_set_arg more strict.

The current assert allows 'index == phi->nargs'. While it's true that 
there are access functions that currently use the nargs..(capacity-1) 
inclusive range, this is not one of them (and if it was, the condition 
should be 'index < phi->capacity').

Bootstrapped and reg-tested on x86_64.

Committed as obvious.

Thanks,
- Tom
diff mbox

Patch

Fix assert in gimple_phi_set_arg

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

	* gimple.h (gimple_phi_set_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 e19cc1c..aba7167 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -4351,7 +4351,7 @@  gimple_phi_arg (gimple *gs, unsigned index)
 static inline void
 gimple_phi_set_arg (gphi *phi, unsigned index, struct phi_arg_d * phiarg)
 {
-  gcc_gimple_checking_assert (index <= phi->nargs);
+  gcc_gimple_checking_assert (index < phi->nargs);
   phi->args[index] = *phiarg;
 }