PIPS
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "genC.h"
#include "linear.h"
#include "ri.h"
#include "effects.h"
#include "alias_private.h"
#include "ri-util.h"
#include "prettyprint.h"
#include "effects-util.h"
#include "text-util.h"
#include "database.h"
#include "pipsdbm.h"
#include "resources.h"
#include "misc.h"
#include "control.h"
#include "properties.h"
#include "instrumentation.h"
Go to the source code of this file.
Data Structures | |
struct | array_dimension_bound_test |
As we create checks with stop error message who tell us there are bound violations for which array, on which dimension, which bound (lower or upper), the following typedef array_dimension_bound_test permits us to create a sequence of tests for each statement more easier. More... | |
struct | Index_range |
Data structure to support abc Implied DO. More... | |
struct | bottom_up_abc_context_t |
context data structure for bottom_up_abc newgen recursion More... | |
struct | checkfn |
Macros | |
#define | array_dimension_bound_test_undefined ((array_dimension_bound_test) {NIL,NIL,NIL,NIL} ) |
#define | Index_range_undefined ((Index_range) {NIL,NIL}) |
#define | cf_ge_expression(e1, e2) ( 1 ? binary_intrinsic_expression(">=", e1, e2) : ge_expression(e1, e2) ) |
#define | cf_gt_expression(e1, e2) ( 1 ? binary_intrinsic_expression(">", e1, e2) : gt_expression(e1, e2) ) |
#define | cf_lt_expression(e1, e2) ( 1 ? binary_intrinsic_expression("<", e1, e2) : lt_expression(e1, e2) ) |
#define | cf_and_expression(e1, e2) ( 1 ? binary_intrinsic_expression("&&", e1, e2) : and_expression(e1, e2) ) |
#define | cf_or_expression(e1, e2) ( 1 ? binary_intrinsic_expression("||", e1, e2) : or_expression(e1, e2) ) |
#define | make_add_expression(e1, e2) make_bin_expression("TOP-LEVEL:+", e1, e2) |
#define | make_sub_expression(e1, e2) make_bin_expression("TOP-LEVEL:-", e1, e2) |
#define | make_mul_expression(e1, e2) make_bin_expression("TOP-LEVEL:*", e1, e2) |
#define | CHECK_NARGS(n) if (nargs != (n)) return expression_undefined |
Typedefs | |
typedef struct array_dimension_bound_test | array_dimension_bound_test |
As we create checks with stop error message who tell us there are bound violations for which array, on which dimension, which bound (lower or upper), the following typedef array_dimension_bound_test permits us to create a sequence of tests for each statement more easier. More... | |
typedef struct Index_range | Index_range |
Data structure to support abc Implied DO. More... | |
typedef struct bottom_up_abc_context_t * | bottom_up_abc_context_p |
Variables | |
static int | number_of_bound_checks |
Statistic variables: More... | |
static int | number_of_added_checks |
static int | number_of_bound_violations |
static struct checkfn | checkfns [] |
#define array_dimension_bound_test_undefined ((array_dimension_bound_test) {NIL,NIL,NIL,NIL} ) |
Definition at line 119 of file array_bound_check_bottom_up.c.
#define cf_and_expression | ( | e1, | |
e2 | |||
) | ( 1 ? binary_intrinsic_expression("&&", e1, e2) : and_expression(e1, e2) ) |
Definition at line 1139 of file array_bound_check_bottom_up.c.
#define cf_ge_expression | ( | e1, | |
e2 | |||
) | ( 1 ? binary_intrinsic_expression(">=", e1, e2) : ge_expression(e1, e2) ) |
Definition at line 1130 of file array_bound_check_bottom_up.c.
#define cf_gt_expression | ( | e1, | |
e2 | |||
) | ( 1 ? binary_intrinsic_expression(">", e1, e2) : gt_expression(e1, e2) ) |
Definition at line 1133 of file array_bound_check_bottom_up.c.
#define cf_lt_expression | ( | e1, | |
e2 | |||
) | ( 1 ? binary_intrinsic_expression("<", e1, e2) : lt_expression(e1, e2) ) |
Definition at line 1136 of file array_bound_check_bottom_up.c.
#define cf_or_expression | ( | e1, | |
e2 | |||
) | ( 1 ? binary_intrinsic_expression("||", e1, e2) : or_expression(e1, e2) ) |
Definition at line 1142 of file array_bound_check_bottom_up.c.
#define CHECK_NARGS | ( | n | ) | if (nargs != (n)) return expression_undefined |
Definition at line 1446 of file array_bound_check_bottom_up.c.
#define Index_range_undefined ((Index_range) {NIL,NIL}) |
Definition at line 120 of file array_bound_check_bottom_up.c.
#define make_add_expression | ( | e1, | |
e2 | |||
) | make_bin_expression("TOP-LEVEL:+", e1, e2) |
Definition at line 1154 of file array_bound_check_bottom_up.c.
#define make_mul_expression | ( | e1, | |
e2 | |||
) | make_bin_expression("TOP-LEVEL:*", e1, e2) |
Definition at line 1156 of file array_bound_check_bottom_up.c.
#define make_sub_expression | ( | e1, | |
e2 | |||
) | make_bin_expression("TOP-LEVEL:-", e1, e2) |
Definition at line 1155 of file array_bound_check_bottom_up.c.
typedef struct array_dimension_bound_test array_dimension_bound_test |
As we create checks with stop error message who tell us there are bound violations for which array, on which dimension, which bound (lower or upper), the following typedef array_dimension_bound_test permits us to create a sequence of tests for each statement more easier.
BOTTOM-UP ARRAY BOUND CHECK VERSION
This program takes as input the current module, adds array range checks (lower and upper bound checks) to every statement that has one or more array accesses. The output is the module with those tests added.
Assumptions : there is no write effect on the array bound expression.
There was a test for write effect on bound here but I put it away (in effect_on_array_bound.c) because it takes time to calculate the effect but in fact this case is rare.
NN 20/03/2002: Attention: tests generated for array whose bounds are modified are not correct See Validation/ArrayBoundCheck/BU_Effect.f
Solution : reput the test effect_on_array_bound, instrument the code with SUBROUTINE EFFECT(A,N) REAL A(N) N_PIPS = N N = 2*N DO I =1,N IF (I. GT. N_PIPS .OR I. LT> 1) STOP A(I) = I ENNDO
Question : other analyses (regions,.. ) are correct ?
Version: change the structure of test: IF (I.LT.lower) THEN STOP "Bound violation ..." IF (I.GT.upper) THEN STOP "Bound violation ..." Add statistics Version : Modify the Implied-DO process
The functions bottom_up_abc_call, bottom_up_abc_reference, bottom_up_abc_expression return results of type array_dimension_bound_test
typedef struct bottom_up_abc_context_t * bottom_up_abc_context_p |
typedef struct Index_range Index_range |
Data structure to support abc Implied DO.
|
static |
The test is: 1 <= offset(e) + subscript_value(r) <= area_size(common)
divided by the element size
divided by the element size
f the ith subscript index is also an array reference, we must check this reference
Definition at line 334 of file array_bound_check_bottom_up.c.
References add_array_dimension_bound_test(), area_size, array_dimension_bound_test_undefined, bottom_up_abc_expression(), clean_all_normalized(), copy_expression(), entity_local_name(), entity_storage, entity_type, find_ith_argument(), gen_length(), gt_expression, ifdebug, int, int_to_expression(), lt_expression, make_array_dimension_bound_test(), make_true_array_dimension_bound_test(), number_of_added_checks, number_of_bound_checks, pips_debug, print_expression(), ram_offset, ram_section, reference_indices, reference_variable, SizeOfElements(), storage_ram, subscript_value(), trivial_expression_p(), type_area, type_variable, user_log(), and variable_basic.
Referenced by bottom_up_abc_reference().
|
static |
If in temp.exp, there are expressions that exist in retour.exp, we don't have to add those expressions to retour.exp If temp.exp is a true expression => add to list to debug several real bound violations
Definition at line 232 of file array_bound_check_bottom_up.c.
References array_dimension_bound_test::arr, array_dimension_bound_test_undefined_p(), BOOL, array_dimension_bound_test::bou, CAR, CDR, CONS, array_dimension_bound_test::dim, ENDP, ENTITY, entity_local_name(), exp, array_dimension_bound_test::exp, EXPRESSION, gen_nconc(), INT, NIL, number_of_added_checks, pips_debug, same_expression_in_list_p(), and true_expression_p().
Referenced by abc_with_allocation_size(), bottom_up_abc_base_reference_implied_do(), bottom_up_abc_call(), bottom_up_abc_expression_implied_do(), bottom_up_abc_reference(), and bottom_up_abc_reference_implied_do().
|
static |
Definition at line 1737 of file array_bound_check_bottom_up.c.
References call_arguments, call_function, CAR, CDR, entity_intrinsic(), entity_name, entity_size_uname(), entity_undefined, EXPRESSION, expression_call_p(), expression_reference_p(), expression_syntax, FindEntity(), gen_length(), make_assign_statement(), make_basic_int(), make_call_expression(), make_entity_expression(), make_scalar_entity(), MULTIPLY_OPERATOR_NAME, NIL, ref, reference_indices, reference_variable, statement_undefined, syntax_call, and syntax_reference.
Referenced by cstr_args_check().
bool array_bound_check_bottom_up | ( | const char * | module_name | ) |
Begin the dynamic array bound checking phase. Get the code from dbm (true resource)
Reorder the module, because the bound checks have been added
module_name | odule_name |
Definition at line 1093 of file array_bound_check_bottom_up.c.
References bottom_up_abc_statement(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug(), debug_off, debug_on, display_bottom_up_abc_statistics(), ifdebug, initialize_bottom_up_abc_statistics(), local_name_to_top_level_entity(), module_name(), module_reorder(), module_statement, pips_assert, reset_current_module_entity(), reset_current_module_statement(), reset_ordering_to_statement(), set_current_module_entity(), set_current_module_statement(), set_ordering_to_statement(), and statement_consistent_p().
|
static |
Definition at line 1436 of file array_bound_check_bottom_up.c.
References array_indices_check(), cf_and_expression, and expression_undefined.
Referenced by cstr_args_check().
|
static |
Definition at line 155 of file array_bound_check_bottom_up.c.
Referenced by add_array_dimension_bound_test(), and bottom_up_abc_statement_rwt().
|
static |
Definition at line 1377 of file array_bound_check_bottom_up.c.
References CAR, CDR, cf_and_expression, cf_lt_expression, DIMENSION, dimension_upper, ENDP, entity_type, EXPRESSION, expression_constant_p(), expression_reference_p(), expression_syntax, expression_to_int(), expression_undefined, int_to_expression(), make_add_expression, ref, reference_indices, reference_variable, syntax_reference, type_variable, type_variable_p, and variable_dimensions.
Referenced by array_check_add().
This function returns true, if the array needs bound checks false, otherwise.
If the arrays are not created by user, for example the arrays of Logical Units : LUNS, END_LUNS, ERR_LUNS, ... in the IO_EFFECTS_PACKAGE_NAME, we don't have to check array references for those arrays. Maybe we have to add other kinds of arrays, not only those in IO_EFFECTS
Definition at line 196 of file array_bound_check_bottom_up.c.
References entity_module_name(), and IO_EFFECTS_PACKAGE_NAME.
Referenced by bottom_up_abc_reference(), bottom_up_abc_reference_implied_do(), initial_code_abc_reference(), and top_down_abc_flt().
|
static |
Definition at line 1489 of file array_bound_check_bottom_up.c.
References CHECK_NARGS, and memcpy_check_expression().
|
static |
Definition at line 1476 of file array_bound_check_bottom_up.c.
References CHECK_NARGS, and memcpy_check_expression().
Referenced by memmove_check_expression().
|
static |
Definition at line 507 of file array_bound_check_bottom_up.c.
References add_array_dimension_bound_test(), array_dimension_bound_test_undefined, clean_all_normalized(), copy_dimension(), dimension_lower, dimension_upper, entity_local_name(), entity_type, expression_equal_p(), expression_undefined, find_ith_argument(), find_ith_dimension(), gen_length(), gt_expression, ifdebug, int, lt_expression, make_array_dimension_bound_test(), make_true_array_dimension_bound_test(), number_of_added_checks, number_of_bound_checks, pips_debug, print_expression(), range_lower, range_upper, reference_indices, reference_variable, trivial_expression_p(), type_variable, unbounded_dimension_p(), user_log(), and variable_dimensions.
Referenced by bottom_up_abc_reference_implied_do().
|
static |
We must check a special case: The call is a READ statement with array reference whose index is read in the same statement.
Example : READ *,N, A(N) or READ *,N,(A(I),I=1,N) (implied DO expression)
In these case, we have to put a dynamic check function such as : READ *,N,(A(abc_check(I,1,10)),I=1,N),M where abc_check is a function that does the range checking by using its parameters
Definition at line 779 of file array_bound_check_bottom_up.c.
References add_array_dimension_bound_test(), array_dimension_bound_test_undefined, bottom_up_abc_expression(), call_arguments, EXPRESSION, MAP, read_statement_with_write_effect_on_array_subscript(), and user_log().
Referenced by bottom_up_abc_expression(), and bottom_up_abc_statement_rwt().
|
static |
the syntax of an expression can be a reference, a range or a call
There is nothing to check here
Definition at line 685 of file array_bound_check_bottom_up.c.
References array_dimension_bound_test_undefined, bottom_up_abc_call(), bottom_up_abc_expression_implied_do(), bottom_up_abc_reference(), expression_implied_do_p(), expression_syntax, Index_range_undefined, is_syntax_call, is_syntax_range, is_syntax_reference, syntax_call, syntax_reference, and syntax_tag.
Referenced by abc_with_allocation_size(), bottom_up_abc_call(), bottom_up_abc_reference(), and bottom_up_abc_statement_rwt().
|
static |
An implied-DO is a call to an intrinsic function named IMPLIED-DO; the first argument is the implied-DO variable (loop index) the second one is a range the remaining arguments are expressions to be written or references to be read or another implied-DO (dlist, i=e1,e2,e3)
We treated only the case where e3=1 (or omitted), the bound tests is IF (e1.LT.lower.OR.e2.GT.upper) STOP Bound violation for statement READ *,(A(I),I=e1,e2)
An Implied-DO can be occurred in a DATA statement or an input/output statement. As DATA statement is in the declaration, not executable, we do not need to pay attention to it.
range e1,e2,e3
The increment is 1
Implied-DO index
normal expression
increment <> 1, we have to put a dynamic test function such as : WRITE *, A(checkA(I), e1,e2,e3) where checkA is a function that does the range checking for array A. because it is not integer, the bound tests :
if (e3.GT.0).AND.(e1.LT.lower.OR.e1+e3x[e2-e1/e3].GT.upper) STOP Bound violation if (e3.LT.0).AND.(e1.GT.upper.OR.e1+e3x[e1-e2/e3].LT.lower) STOP Bound violation
Definition at line 630 of file array_bound_check_bottom_up.c.
References add_array_dimension_bound_test(), array_dimension_bound_test_undefined, bottom_up_abc_reference_implied_do(), call_arguments, CAR, CDR, CONS, EXPRESSION, expression_implied_do_p(), expression_syntax, gen_nconc(), Index_range::ind, int_to_expression(), MAP, NIL, Index_range::ran, RANGE, range_increment, same_expression_p(), syntax_call, and syntax_range.
Referenced by bottom_up_abc_expression().
|
static |
If s is in an unstructured instruction, we must pay attention when inserting s1 before s.
take the control that has s as its statement
take the unstructured correspond to the control c
for a consistent unstructured, a test must have 2 successors, so if s1 is a test, we transform it into sequence in order to avoid this constraint. Then we create a new control for it, with the predecessors are those of c and the only one successor is c. The new predecessors of c are only the new control
if c is the entry node of the correspond unstructured u, the newc will become the new entry node of u
Definition at line 918 of file array_bound_check_bottom_up.c.
References apply_persistant_statement_to_control(), bound_persistant_statement_to_control_p(), CAR, CONS, CONTROL, CONTROL_, control_predecessors, control_successors, ifdebug, insert_statement(), instruction_to_statement(), is_instruction_sequence, make_control(), make_instruction(), make_sequence(), MAP, MAPL, NIL, pips_debug, print_statement(), s1, stack_head(), stack_size(), STATEMENT, statement_test_p(), and unstructured_entry.
Referenced by bottom_up_abc_statement_rwt().
|
static |
In practice, bound violations often occur with arrays in a common, with the reason that the allocated size of the common is not violated :-))) So this property helps dealing with this kind of bad programming practice
Call the function trivial_expression_p(check)
If the dimension is unbounded , for example T(*), we cannot check the upper bound
f the ith subscript index is also an array reference, we must check this reference
Definition at line 407 of file array_bound_check_bottom_up.c.
References abc_with_allocation_size(), add_array_dimension_bound_test(), array_dimension_bound_test_undefined, array_need_bound_check_p(), array_reference_p(), bottom_up_abc_expression(), clean_all_normalized(), copy_dimension(), copy_expression(), dimension_lower, dimension_undefined, dimension_upper, entity_local_name(), entity_type, expression_undefined, find_ith_argument(), find_ith_dimension(), gen_length(), get_bool_property(), gt_expression, ifdebug, int, lt_expression, make_array_dimension_bound_test(), make_true_array_dimension_bound_test(), number_of_added_checks, number_of_bound_checks, pips_debug, print_expression(), print_reference(), reference_indices, reference_variable, trivial_expression_p(), type_variable, unbounded_dimension_p(), user_log(), variable_dimensions, and variable_in_common_p().
Referenced by bottom_up_abc_expression().
|
static |
Treat array reference
For example, we have array reference A(I,J) with two indexes I and J and ranges 1:20 and 1:10, respectively
Definition at line 587 of file array_bound_check_bottom_up.c.
References add_array_dimension_bound_test(), array_dimension_bound_test_undefined, array_need_bound_check_p(), array_reference_p(), bottom_up_abc_base_reference_implied_do(), CAR, CDR, ENDP, EXPRESSION, expression_syntax, Index_range::ind, is_syntax_call, is_syntax_range, is_syntax_reference, Index_range::ran, RANGE, reference_variable, syntax_reference, and syntax_tag.
Referenced by bottom_up_abc_expression_implied_do().
|
static |
Definition at line 1077 of file array_bound_check_bottom_up.c.
References bottom_up_abc_statement_rwt(), control_domain, free_persistant_statement_to_control(), gen_context_multi_recurse(), gen_null(), gen_true(), make_persistant_statement_to_control(), module_statement, pop_uns(), push_uns(), stack_free(), stack_make(), statement_domain, store_mapping(), and unstructured_domain.
Referenced by array_bound_check_bottom_up().
|
static |
because we use gen_recurse with statement domain, we don't have to check unstructured instruction here
Definition at line 984 of file array_bound_check_bottom_up.c.
References array_dimension_bound_test_undefined_p(), bottom_up_abc_call(), bottom_up_abc_expression(), bottom_up_abc_insert_before_statement(), cstr_args_check(), ifdebug, instruction_call, instruction_tag, instruction_test, instruction_whileloop, is_instruction_call, is_instruction_forloop, is_instruction_loop, is_instruction_sequence, is_instruction_test, is_instruction_unstructured, is_instruction_whileloop, make_bottom_up_abc_tests(), pips_debug, pips_internal_error, print_statement(), printf(), statement_instruction, statement_undefined, test_condition, and whileloop_condition.
Referenced by bottom_up_abc_statement().
|
static |
Definition at line 1501 of file array_bound_check_bottom_up.c.
References cf_gt_expression, CHECK_NARGS, expression_try_find_size(), and expression_undefined.
Referenced by memset_check_expression().
forward declaration
Convert the arguments list into an array
Add malloc(), free(), etc. instrumentation
The target languague is unknown: C or Fortran, NL at the end or not? It will be up to the prettyprinter (FI). FI+LD 21-Oct-2009 : added NL, apparently needed in Fortran too.
Definition at line 1805 of file array_bound_check_bottom_up.c.
References alloc_instrumentation(), array_check_add(), call_arguments, call_function, CAR, CDR, checkfn::check_statement, checkfns, entity_name, entity_size_uname(), entity_type, entity_undefined, EXPRESSION, expression_reference_p(), expression_syntax, expression_undefined, FindEntity(), free(), checkfn::function, gen_length(), instruction_call, instruction_tag, int_to_expression(), is_instruction_call, make_assign_statement(), make_block_statement(), make_c_stop_statement(), make_entity_expression(), make_test(), malloc(), NIL, pips_assert, pips_debug, put_a_comment_on_a_statement(), reference_variable, statement_instruction, statement_undefined, strdup(), syntax_reference, test_to_statement, and type_variable_p.
Referenced by bottom_up_abc_statement_rwt().
|
static |
Definition at line 135 of file array_bound_check_bottom_up.c.
References number_of_added_checks, number_of_bound_checks, number_of_bound_violations, and user_log().
Referenced by array_bound_check_bottom_up().
Must be the C version
stop_message | top_message |
Definition at line 837 of file array_bound_check_bottom_up.c.
References fortran_module_p(), get_current_module_entity(), make_exit_statement(), make_stop_statement(), and statement_undefined.
Referenced by make_bottom_up_abc_tests(), and make_c_stop_statement().
Definition at line 1212 of file array_bound_check_bottom_up.c.
References basic_string, basic_string_p, constant_int, constant_int_p, entity_type, functional_result, type_functional, type_functional_p, type_variable, type_variable_p, value_constant, value_constant_p, and variable_basic.
Referenced by expression_try_find_size(), and expression_try_find_string_size().
Definition at line 1236 of file array_bound_check_bottom_up.c.
References entity_name, exit, malloc(), and prefix.
Referenced by alloc_instrumentation(), cstr_args_check(), and expression_try_find_size().
|
static |
We have to consider only the case of Implied DO if e is in the lower or upper bound of implied DO's range or not
range e1,e2,e3
Definition at line 714 of file array_bound_check_bottom_up.c.
References array_reference_p(), call_arguments, CAR, CDR, exp, EXPRESSION, expression_implied_do_p(), expression_syntax, fprintf(), ifdebug, is_syntax_call, is_syntax_range, is_syntax_reference, MAP, print_expression(), range_increment, range_lower, range_upper, ref, reference_indices, same_expression_in_list_p(), same_expression_p(), syntax_call, syntax_range, syntax_reference, and syntax_tag.
Referenced by read_statement_with_write_effect_on_array_subscript().
|
static |
The expression is a string constant
Definition at line 1263 of file array_bound_check_bottom_up.c.
References base, call_arguments, call_function, CAR, CDR, DIMENSION, dimension_upper, ENDP, entity_constant_string_size(), entity_name, entity_size_uname(), entity_type, entity_undefined, EXPRESSION, expression_call_p(), expression_constant_p(), expression_reference_p(), expression_syntax, expression_to_int(), expression_undefined, FindOrCreateEntity(), free(), int_to_expression(), make_add_expression, make_entity_expression(), make_sub_expression, NIL, ref, reference_indices, reference_variable, syntax_call, syntax_reference, type_variable, type_variable_p, variable_dimensions, and x.
Referenced by bzero_check_expression(), memcpy_check_expression(), strcat_check_expression(), strcpy_check_expression(), strncat_check_expression(), and strncpy_check_expression().
|
static |
Definition at line 1364 of file array_bound_check_bottom_up.c.
References entity_constant_string_size(), entity_undefined, expression_reference(), int_to_expression(), make_strlen_expression(), and reference_variable.
Referenced by strcat_check_expression(), strcpy_check_expression(), and strncat_check_expression().
|
static |
Definition at line 128 of file array_bound_check_bottom_up.c.
References number_of_added_checks, number_of_bound_checks, and number_of_bound_violations.
Referenced by array_bound_check_bottom_up().
Warning! Do not modify this file that is automatically generated!
Modify src/Libs/instrumentation/instrumentation-local.h instead, to add your own modifications. header file built by cproto instrumentation-local.h cproto-generated files array_bound_check_bottom_up.c
Definition at line 162 of file array_bound_check_bottom_up.c.
Referenced by make_bottom_up_abc_tests(), and top_down_abc_array().
|
static |
Definition at line 218 of file array_bound_check_bottom_up.c.
References array_dimension_bound_test::arr, array_dimension_bound_test_undefined, BOOL, array_dimension_bound_test::bou, CONS, array_dimension_bound_test::dim, ENTITY, exp, array_dimension_bound_test::exp, EXPRESSION, expression_undefined_p, INT, and NIL.
Referenced by abc_with_allocation_size(), bottom_up_abc_base_reference_implied_do(), and bottom_up_abc_reference().
|
static |
Definition at line 1146 of file array_bound_check_bottom_up.c.
References CONS, EXPRESSION, gen_find_entity(), make_call_expression(), and NIL.
|
static |
There is a bound violation, we can return a stop statement immediately, but for debugging purpose, it is better to display all bound violations
Definition at line 852 of file array_bound_check_bottom_up.c.
References array_dimension_bound_test::arr, BOOL, bool_to_bound(), array_dimension_bound_test::bou, CAR, CDR, concatenate(), copy_statement(), array_dimension_bound_test::dim, emit_message_and_stop(), ENDP, ENTITY, entity_user_name(), array_dimension_bound_test::exp, EXPRESSION, expression_to_string(), fortran_module_p(), get_bool_property(), get_current_module_entity(), ifdebug, insert_statement(), INT, int_to_dimension(), make_any_print_statement(), make_block_statement(), make_print_statement(), make_test(), NIL, number_of_bound_violations, pips_debug, print_statement(), print_variables(), statement_undefined, statement_undefined_p, strdup(), test_to_statement, and true_expression_p().
Referenced by bottom_up_abc_statement_rwt().
Definition at line 1168 of file array_bound_check_bottom_up.c.
References CONS, emit_message_and_stop(), entity_undefined, EXPRESSION, int_to_expression(), make_block_statement(), make_call_statement(), NIL, pips_assert, and STATEMENT.
Referenced by cstr_args_check().
|
static |
Definition at line 1159 of file array_bound_check_bottom_up.c.
References CONS, EXPRESSION, FindOrCreateTopLevelEntity(), make_call_expression(), and NIL.
Referenced by expression_try_find_string_size().
|
static |
Definition at line 206 of file array_bound_check_bottom_up.c.
References array_dimension_bound_test::arr, BOOL, array_dimension_bound_test::bou, CONS, array_dimension_bound_test::dim, ENTITY, exp, array_dimension_bound_test::exp, EXPRESSION, INT, make_true_expression(), and NIL.
Referenced by abc_with_allocation_size(), bottom_up_abc_base_reference_implied_do(), and bottom_up_abc_reference().
|
static |
Definition at line 1520 of file array_bound_check_bottom_up.c.
References CHECK_NARGS, and memcpy_check_expression().
|
static |
Definition at line 1454 of file array_bound_check_bottom_up.c.
References cf_gt_expression, cf_or_expression, CHECK_NARGS, expression_try_find_size(), and expression_undefined.
Referenced by bcmp_check_expression(), bcopy_check_expression(), and memcmp_check_expression().
|
static |
Convert memmove(dst, src, n) -> bcopy(src, dest, n)
Definition at line 1533 of file array_bound_check_bottom_up.c.
References bcopy_check_expression(), and CHECK_NARGS.
|
static |
Convert memset(dst, b, n) -> bzero(dst, n)
Definition at line 1551 of file array_bound_check_bottom_up.c.
References bzero_check_expression(), and CHECK_NARGS.
|
static |
Definition at line 1071 of file array_bound_check_bottom_up.c.
References pips_assert, and stack_pop().
Referenced by bottom_up_abc_statement().
string print_variables | ( | expression | e | ) |
Definition at line 804 of file array_bound_check_bottom_up.c.
References call_arguments, concatenate(), exp, EXPRESSION, expression_syntax, is_syntax_call, is_syntax_range, is_syntax_reference, MAP, pips_internal_error, ref, reference_to_string(), strdup(), syntax_call, syntax_reference, and syntax_tag.
Referenced by make_bottom_up_abc_tests(), and make_interprocedural_abc_tests().
|
static |
Definition at line 1065 of file array_bound_check_bottom_up.c.
References stack_push().
Referenced by bottom_up_abc_statement().
Definition at line 762 of file array_bound_check_bottom_up.c.
References call_arguments, call_function, CAR, CDR, ENDP, entity_local_name(), exp, EXPRESSION, expression_in_array_subscript(), and READ_FUNCTION_NAME.
Referenced by bottom_up_abc_call().
|
static |
Definition at line 1696 of file array_bound_check_bottom_up.c.
References expression_undefined, and strncpy_check_expression().
|
static |
Definition at line 1660 of file array_bound_check_bottom_up.c.
References cf_gt_expression, CONS, entity_undefined, EXPRESSION, expression_undefined, FindEntity(), int_to_expression(), make_basic_int(), make_call_expression(), make_entity_expression(), make_scalar_entity(), NIL, and TOP_LEVEL_MODULE_NAME.
|
static |
Definition at line 1058 of file array_bound_check_bottom_up.c.
References control_statement, and extend_persistant_statement_to_control().
Referenced by bottom_up_abc_statement().
|
static |
Definition at line 1616 of file array_bound_check_bottom_up.c.
References cf_ge_expression, CHECK_NARGS, expression_try_find_size(), expression_try_find_string_size(), expression_undefined, and make_add_expression.
|
static |
Definition at line 1566 of file array_bound_check_bottom_up.c.
References cf_ge_expression, CHECK_NARGS, expression_try_find_size(), expression_try_find_string_size(), and expression_undefined.
|
static |
Definition at line 1638 of file array_bound_check_bottom_up.c.
References cf_ge_expression, CHECK_NARGS, expression_try_find_size(), expression_try_find_string_size(), expression_undefined, and make_sub_expression.
|
static |
Definition at line 1597 of file array_bound_check_bottom_up.c.
References cf_ge_expression, CHECK_NARGS, expression_try_find_size(), and expression_undefined.
Referenced by snprintf_check_expression().
expression subscript_value | ( | entity | arr, |
list | l_inds | ||
) |
arr | rr |
l_inds | _inds |
Definition at line 276 of file array_bound_check_bottom_up.c.
References binary_intrinsic_expression, copy_expression(), dimension_lower, dimension_upper, ENDP, entity_type, expression_constant_p(), expression_to_int(), expression_undefined, expression_undefined_p, find_ith_argument(), find_ith_dimension(), gen_length(), ifdebug, int_to_expression(), MINUS_OPERATOR_NAME, MULTIPLY_OPERATOR_NAME, pips_debug, PLUS_OPERATOR_NAME, print_expression(), same_expression_p(), type_variable, and variable_dimensions.
Referenced by abc_with_allocation_size().
|
static |
Referenced by cstr_args_check().
|
static |
Definition at line 125 of file array_bound_check_bottom_up.c.
Referenced by abc_with_allocation_size(), add_array_dimension_bound_test(), bottom_up_abc_base_reference_implied_do(), bottom_up_abc_reference(), display_bottom_up_abc_statistics(), and initialize_bottom_up_abc_statistics().
|
static |
Statistic variables:
Definition at line 124 of file array_bound_check_bottom_up.c.
Referenced by abc_with_allocation_size(), bottom_up_abc_base_reference_implied_do(), bottom_up_abc_reference(), display_bottom_up_abc_statistics(), and initialize_bottom_up_abc_statistics().
|
static |
Definition at line 126 of file array_bound_check_bottom_up.c.
Referenced by display_bottom_up_abc_statistics(), initialize_bottom_up_abc_statistics(), and make_bottom_up_abc_tests().