From: Justin Seyster Date: Mon, 16 Aug 2010 00:06:21 +0000 (-0400) Subject: Fixed assertion failure when geting block index for a function param. X-Git-Tag: release-v1.0~67 X-Git-Url: https://git.fsl.cs.stonybrook.edu/?a=commitdiff_plain;h=5d9f4f023fd155e6dec755fbf5f1f4c152a24fa3;p=interaspect.git Fixed assertion failure when geting block index for a function param. --- diff --git a/src/aop-pc-assign.c b/src/aop-pc-assign.c index e73aa30..69bb345 100644 --- a/src/aop-pc-assign.c +++ b/src/aop-pc-assign.c @@ -475,7 +475,6 @@ aop_capture_lhs_var_scope (struct aop_joinpoint *jp) { tree lhs; tree function_block; - int var_index = 0; lhs = get_lhs_var (jp); if (lhs != NULL_TREE) @@ -493,11 +492,21 @@ aop_capture_lhs_var_scope (struct aop_joinpoint *jp) } else if (TREE_CODE (DECL_CONTEXT (lhs)) == FUNCTION_DECL) { - function_block = DECL_INITIAL (current_function_decl); - bool retval = false; - retval = find_lexical_block (lhs, function_block, &var_index); + bool retval; + int var_index = 0; + + if (TREE_CODE (lhs) == PARM_DECL) + { + /* Function parameters get block index 0.*/ + var_index = 0; + } + else + { + function_block = DECL_INITIAL (current_function_decl); + retval = find_lexical_block (lhs, function_block, &var_index); + aop_assert (retval == true); + } - aop_assert (retval == true); return var_index; } else