PIPS
flint.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bool flinter (const string)
 Routine of global module verification
More...
 
void flint_message (char *, char *,...)
 
void flint_message_2 (char *, char *,...)
 Same as flint_message but without the function name
More...
 
void raw_flint_message (bool, char *,...)
 Same as flint_message but a bare bones version
More...
 
void flint_cons_dimension (list)
 flint_walk.c More...
 
dimension flint_dimension (dimension)
 
call flint_call (call)
 This function checks the syntax of a call and recursively. More...
 
range flint_range (range)
 This function verifies that incremented or decremented
More...
 
reference flint_reference (reference)
 A reference is used when given a function the address of. More...
 
void flint_syntax (syntax)
 verification of syntaxes
More...
 
void flint_cons_expression (list)
 These two functions operate on the list of expressions
More...
 
void flint_cons_actual_argument (list)
 
expression flint_expression (expression)
 
loop flint_loop (loop)
 Recursive verification of a loop as (range)+(expression) More...
 
test flint_test (test)
 A test is taken as (expression)+(statement)+(statement)
More...
 
instruction flint_instruction (instruction)
 Verification of an instruction with branching according
More...
 
void flint_unstructured (unstructured)
 
void flint_cons_statement (list)
 
statement flint_statement (statement)
 
bool check_procedure (call)
 flint_check.c More...
 
bool check_the_call (call)
 
bool check_call_intrinsic (list, list, call)
 
bool check_call_args_number (list, list, call)
 
bool check_call_types_compatibility (list, list, call)
 
bool check_call_one_type (expression, parameter, call, int)
 
bool check_call_basic (basic, basic, call, int)
 
bool check_call_dim (list, list, call, int)
 loose version More...
 
bool check_call_basic_and_dim (expression, parameter, call, int)
 
void check_the_reference (reference)
 
bool check_call_mode_consistency (list, list, entity)
 
bool check_call_one_mode (expression, parameter, entity, list, int)
 This function checks that a reference to a constant in a call may not be modified, if it could happen, a message is broadcast. More...
 
bool look_at_the_commons (entity)
 
bool position_in_the_area (entity, intptr_t *, intptr_t *)
 
bool check_commons (entity)
 
void check_one_common (entity, entity)
 
bool check_overlap_in_common (entity, entity, int, int, entity, int, int)
 
bool number_of_elements (list, intptr_t *)
 flint_utils.c More...
 
bool size_of_dimension (dimension, intptr_t *)
 this function computes the size of a dimension. More...
 
bool control_type_in_expression (enum basic_utype, int, expression)
 
bool find_bd_parameter (parameter, basic *, list *)
 
bool find_bd_type_variable (type, basic *, list *)
 
bool find_bd_expression (expression, basic *, list *)
 
bool find_bd_reference (reference, basic *, list *)
 
bool find_bd_call (call, basic *, list *)
 
void flint_uninitialized_variables (graph, statement)
 uninitialized_variables.c More...
 

Variables

statement flint_current_statement
 Warning! Do not modify this file that is automatically generated! More...
 

Function Documentation

◆ check_call_args_number()

bool check_call_args_number ( list  la,
list  lt,
call  c 
)

sometimes out...

Parameters
laa
ltt
clist of parameters

Definition at line 222 of file flint_check.c.

226 {
227  int na = gen_length(la);
228  int nt = gen_length(lt);
229 
230  if (na == nt ||
231  (nt<=na && type_varargs_p(parameter_type(PARAMETER(CAR(gen_last(lt)))))))
232  return (true);
233 
234  if (call_intrinsic_p(c) && (nt == 0)) { /* sometimes out... */
235  return (BOOL_UNDEF);
236  }
237  flint_message("check call",
238  "too %s arguments (%d) in call to %s (%d)\n",
239  ((na > nt) ? "many" : "few"),
240  na,
242  nt);
243  return (false);
244 }
void flint_message(char *fun, char *fmt,...)
Definition: flint.c:147
#define BOOL_UNDEF
some defines usefull to clean the code
Definition: flint_check.c:42
size_t gen_length(const list l)
Definition: list.c:150
#define CAR(pcons)
Get the value of the first element of a list.
Definition: newgen_list.h:92
list gen_last(list l)
Return the last element of a list.
Definition: list.c:578
#define call_intrinsic_p(C)
#define parameter_type(x)
Definition: ri.h:1819
#define call_function(x)
Definition: ri.h:709
#define entity_name(x)
Definition: ri.h:2790
#define PARAMETER(x)
PARAMETER.
Definition: ri.h:1788
#define type_varargs_p(x)
Definition: ri.h:2953

References BOOL_UNDEF, call_function, call_intrinsic_p, CAR, entity_name, flint_message(), gen_last(), gen_length(), PARAMETER, parameter_type, and type_varargs_p.

Referenced by check_the_call().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ check_call_basic()

bool check_call_basic ( basic  be,
basic  bp,
call  c,
int  i 
)

Parameters
bee
bpp

Definition at line 305 of file flint_check.c.

309 {
310  if (basic_tag(be) == basic_tag(bp))
311  return (true);
312 
313  if (basic_overloaded_p(be))
314  flint_message("check_call: WARNING",
315  "may be incompatible basic type, %dth arg in call to %s\n",
316  i, entity_name(call_function(c)));
317  else
318  flint_message("check_call",
319  "incompatible basic type, %dth arg in call to %s, %s>%s\n",
320  i, entity_name(call_function(c)),
322  return (false);
323 }
string basic_to_string(basic)
Definition: type.c:87
#define basic_tag(x)
Definition: ri.h:613
#define basic_overloaded_p(x)
Definition: ri.h:623

References basic_overloaded_p, basic_tag, basic_to_string(), call_function, entity_name, and flint_message().

Referenced by check_call_basic_and_dim(), and check_call_intrinsic().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ check_call_basic_and_dim()

bool check_call_basic_and_dim ( expression  exp,
parameter  param,
call  c,
int  i 
)

else

else

Parameters
expxp
paramaram

Definition at line 367 of file flint_check.c.

372 {
373  basic bexp, bpar;
374  list dexp, dpar;
375  bool okexp = find_bd_expression(exp, &bexp, &dexp), okpar = find_bd_parameter(param, &bpar, &dpar);
376 
377  if (!(okexp && okpar))
378  return (BOOL_UNDEF);
379 
380  /* else */
381  if (!check_call_basic(bexp, bpar, c, i))
382  return (false);
383 
384  /* else */
385  return (check_call_dim(dexp, dpar, c, i));
386 }
bool find_bd_parameter(parameter, basic *, list *)
Definition: flint_utils.c:116
bool find_bd_expression(expression, basic *, list *)
Definition: flint_utils.c:141
bool check_call_basic(basic be, basic bp, call c, int i)
Definition: flint_check.c:305
bool check_call_dim(list de, list dp, call c, int i)
loose version
Definition: flint_check.c:336
The structure used to build lists in NewGen.
Definition: newgen_list.h:41
Definition: replace.c:135
#define exp
Avoid some warnings from "gcc -Wshadow".
Definition: vasnprintf.c:207

References BOOL_UNDEF, check_call_basic(), check_call_dim(), exp, find_bd_expression(), and find_bd_parameter().

Referenced by check_call_one_type().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ check_call_dim()

bool check_call_dim ( list  de,
list  dp,
call  c,
int  i 
)

loose version


else

else

Parameters
dee
dpp

Definition at line 336 of file flint_check.c.

337 {
338  intptr_t n_de, n_dp;
339  bool
340  ok_de = number_of_elements(de, &n_de),
341  ok_dp = number_of_elements(dp, &n_dp);
342 
343  if (!(ok_de && ok_dp))
344  return (BOOL_UNDEF);
345 
346  /* else */
347  if (n_de >= n_dp)
348  return (true);
349 
350  /* else */
351  flint_message("check_call",
352  "incompatible dim, %dth arg in call to %s, (%d<%d)\n",
353  i, entity_name(call_function(c)),
354  n_de, n_dp);
355  return (false);
356 }
bool number_of_elements(list, intptr_t *)
flint_utils.c
Definition: flint_utils.c:50
#define intptr_t
Definition: stdint.in.h:294

References BOOL_UNDEF, call_function, entity_name, flint_message(), intptr_t, and number_of_elements().

Referenced by check_call_basic_and_dim(), and check_call_intrinsic().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ check_call_intrinsic()

bool check_call_intrinsic ( list  ,
list  ,
call   
)

◆ check_call_mode_consistency()

bool check_call_mode_consistency ( list  la,
list  lt,
entity  the_fnct 
)

FI: the last argument should be pure=TRUE since summary effects should not be touched

Parameters
laa
ltt
the_fncthe_fnct

Definition at line 454 of file flint_check.c.

457 {
458  const char*module_name;
459  list
460  sefs_list = list_undefined;
461  expression
462  exp;
463  parameter
464  param;
465  bool
466  ok = true,
467  temp = -1;
468  int
469  i, len = gen_length(lt);
470 
471  module_name = module_local_name(the_fnct);
472 
473  /* FI: the last argument should be pure=TRUE
474  * since summary effects should not be touched
475  */
476  sefs_list = effects_to_list( (effects)
477  db_get_memory_resource(DBR_SUMMARY_EFFECTS, module_name, true));
478 
479  pips_debug(7, "summary effects list for %s (%p)\n",
480  module_name, sefs_list);
481 
482  for (i = 1; i <= len; i++) {
483  exp = EXPRESSION(CAR(la));
484  la = CDR(la);
485  param = PARAMETER(CAR(lt));
486  lt = CDR(lt);
487  temp = check_call_one_mode(exp, param, the_fnct, sefs_list, i);
488  ok = (ok && temp);
489  }
490 
491  return (ok);
492 }
list effects_to_list(effects)
Definition: effects.c:209
const char * module_name(const char *s)
Return the module part of an entity name.
Definition: entity_names.c:296
bool check_call_one_mode(expression exp, parameter param, entity the_fnct, list sefs_list, int i)
This function checks that a reference to a constant in a call may not be modified,...
Definition: flint_check.c:499
#define CDR(pcons)
Get the list less its first element.
Definition: newgen_list.h:111
#define list_undefined
Undefined list definition :-)
Definition: newgen_list.h:69
string db_get_memory_resource(const char *rname, const char *oname, bool pure)
Return the pointer to the resource, whatever it is.
Definition: database.c:755
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
const char * module_local_name(entity e)
Returns the module local user name.
Definition: entity.c:582
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217
static bool ok

References CAR, CDR, check_call_one_mode(), db_get_memory_resource(), effects_to_list(), exp, EXPRESSION, gen_length(), list_undefined, module_local_name(), module_name(), ok, PARAMETER, and pips_debug.

+ Here is the call graph for this function:

◆ check_call_one_mode()

bool check_call_one_mode ( expression  exp,
parameter  param,
entity  the_fnct,
list  sefs_list,
int  i 
)

This function checks that a reference to a constant in a call may not be modified, if it could happen, a message is broadcast.

locally

else : control

Parameters
expxp
paramaram
the_fncthe_fnct
sefs_listefs_list

Definition at line 499 of file flint_check.c.

504 {
505  list sefl = sefs_list; /* locally */
506  bool encountered = false;
507  effect the_effect;
508  entity the_ent;
509 
510  if (!(param_ref_p(param) && arg_const_p(exp)))
511  return (true);
512 
513  /* else : control */
514 
515  the_ent = find_ith_formal_parameter(the_fnct, i);
516 
517  while ((sefl != NULL) && (!encountered))
518  {
519  the_effect = EFFECT(CAR(sefl));
520  sefl = CDR(sefl);
521  encountered = (effect_write_p(the_effect) &&
522  effect_may_or_must_p(the_effect) &&
523  (!strcmp(entity_name(the_ent), effect_to_name(the_effect))));
524  }
525 
526  if (encountered)
527  flint_message("check call mode",
528  "modified reference to a constant, %dth argument in call to %s\n",
529  i, entity_name(the_fnct));
530 
531  return (!encountered);
532 }
#define effect_write_p(eff)
#define EFFECT(x)
EFFECT.
Definition: effects.h:608
#define effect_may_or_must_p(my_effect)
The following define may be replaced by #define ...
Definition: flint_check.c:55
#define effect_to_name(the_effect)
Definition: flint_check.c:59
#define arg_const_p(arg)
Definition: flint_check.c:46
#define param_ref_p(P)
Definition: flint_check.c:43
entity find_ith_formal_parameter(entity the_fnct, int rank)
This function gives back the ith formal parameter, which is found in the declarations of a call or a ...
Definition: entity.c:1863

References arg_const_p, CAR, CDR, EFFECT, effect_may_or_must_p, effect_to_name, effect_write_p, entity_name, exp, find_ith_formal_parameter(), flint_message(), and param_ref_p.

Referenced by check_call_mode_consistency().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ check_call_one_type()

bool check_call_one_type ( expression  exp,
parameter  param,
call  c,
int  i 
)

Parameters
expxp
paramaram

Definition at line 287 of file flint_check.c.

292 {
293  return (check_call_basic_and_dim(exp, param, c, i));
294 }
bool check_call_basic_and_dim(expression exp, parameter param, call c, int i)
Definition: flint_check.c:367

References check_call_basic_and_dim(), and exp.

Referenced by check_call_types_compatibility().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ check_call_types_compatibility()

bool check_call_types_compatibility ( list  la,
list  lt,
call  c 
)
Parameters
laa
ltt

Definition at line 254 of file flint_check.c.

257 {
258  expression exp;
260  bool ok = true;
261  int i, len = gen_length(lt);
262  list ca = la, ct = lt;
263 
264  for (i = 1; i <= len; i++) {
265  bool temp;
266  exp = EXPRESSION(CAR(ca));
267  POP(ca);
268  param = PARAMETER(CAR(ct));
269  POP(ct);
270  temp = check_call_one_type(exp, param, c, i);
271  ok = (ok && temp);
272  }
273 
274  return (ok);
275 }
bool check_call_one_type(expression exp, parameter param, call c, int i)
Definition: flint_check.c:287
#define POP(l)
Modify a list pointer to point on the next element of the list.
Definition: newgen_list.h:59

References CAR, check_call_one_type(), exp, EXPRESSION, gen_length(), ok, PARAMETER, and POP.

Referenced by check_the_call().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ check_commons()

bool check_commons ( entity  module)

Parameters
moduleodule

Definition at line 632 of file flint_check.c.

633 {
634  list
636  entity
637  local;
638 
639  while (ldecl != NULL)
640  {
641  local = ENTITY(CAR(ldecl));
642  ldecl = CDR(ldecl);
643 
644  if (entity_is_a_common_p(local) && (!special_common(local)))
645  check_one_common(local, module);
646  }
647 
648  return (true);
649 }
void check_one_common(entity local, entity module)
Definition: flint_check.c:660
#define special_common(Ent)
Definition: flint_check.c:65
#define entity_is_a_common_p(Ent)
Definition: flint_check.c:62
static char * module
Definition: pips.c:74
#define ENTITY(x)
ENTITY.
Definition: ri.h:2755
#define code_declarations(x)
Definition: ri.h:784
#define value_code(x)
Definition: ri.h:3067
#define entity_initial(x)
Definition: ri.h:2796

References CAR, CDR, check_one_common(), code_declarations, ENTITY, entity_initial, entity_is_a_common_p, module, special_common, and value_code.

Referenced by flinter().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ check_one_common()

void check_one_common ( entity  local,
entity  module 
)
Parameters
localocal
moduleodule

Definition at line 660 of file flint_check.c.

661 {
662  list
663  llayout_init = area_layout(type_area(entity_type(local))),
664  llayout = llayout_init;
665 
666  pips_debug(4, "checking common %s of module %s\n",
667  entity_local_name(local),
669 
670  while (!ENDP(llayout))
671  {
672  intptr_t
673  common_beginning_offset = -1,
674  common_ending_offset = -1,
675  other_beginning_offset = -1,
676  other_ending_offset = -1;
677  entity
678  current_variable = ENTITY(CAR(llayout));
679  list
680  lothers = llayout_init;
681 
682  llayout = CDR(llayout);
683 
684  if (strcmp(entity_module_name(current_variable),
686  continue;
687 
688  if (!position_in_the_area(current_variable,
689  &common_beginning_offset,
690  &common_ending_offset))
691  continue;
692 
693  while (lothers != NULL)
694  {
695  entity head = ENTITY(CAR(lothers));
696  int synonymous = 0;
697  lothers = CDR(lothers);
698 
699  if (!strcmp(entity_name(current_variable), entity_name(head)))
700  {
701  if (synonymous)
702  flint_message("check common",
703  "%s used twice in common %s\n",
704  entity_name(current_variable),
705  module_local_name(local));
706  synonymous++;
707  continue;
708  }
709  if (!position_in_the_area(head,
710  &other_beginning_offset,
711  &other_ending_offset))
712  continue;
713 
715  current_variable,
716  common_beginning_offset,
717  common_ending_offset,
718  head,
719  other_beginning_offset,
720  other_ending_offset);
721  }
722  }
723 }
bool check_overlap_in_common(entity the_common, entity e1, int inf1, int sup1, entity e2, int inf2, int sup2)
Definition: flint_check.c:735
bool position_in_the_area(entity the_var, intptr_t *inf, intptr_t *sup)
Definition: flint_check.c:580
#define ENDP(l)
Test if a list is empty.
Definition: newgen_list.h:66
const char * entity_local_name(entity e)
entity_local_name modified so that it does not core when used in vect_fprint, since someone thought t...
Definition: entity.c:453
const char * entity_module_name(entity e)
See comments about module_name().
Definition: entity.c:1092
#define area_layout(x)
Definition: ri.h:546
#define type_area(x)
Definition: ri.h:2946
#define entity_type(x)
Definition: ri.h:2792

References area_layout, CAR, CDR, check_overlap_in_common(), ENDP, ENTITY, entity_local_name(), entity_module_name(), entity_name, entity_type, flint_message(), intptr_t, module, module_local_name(), pips_debug, position_in_the_area(), and type_area.

Referenced by check_commons().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ check_overlap_in_common()

bool check_overlap_in_common ( entity  the_common,
entity  e1,
int  inf1,
int  sup1,
entity  e2,
int  inf2,
int  sup2 
)

unused

testing overlap

else I must check basic compatibility

benefice du doute!

Parameters
the_commonhe_common
e11
inf1nf1
sup1up1
e22
inf2nf2
sup2up2

Definition at line 735 of file flint_check.c.

741 {
742  basic b1, b2;
743  bool ok1, ok2;
744  list l1, l2; /* unused */
745 
746  /* testing overlap */
747  if ((sup1 < inf2) || (sup2 < inf1))
748  return (true);
749 
750  /* else I must check basic compatibility */
751  ok1 = find_bd_type_variable(entity_type(e1), &b1, &l1);
752  ok2 = find_bd_type_variable(entity_type(e2), &b2, &l2);
753 
754  if (!(ok1 && ok2))
755  return (true); /* benefice du doute! */
756 
757  if (basic_tag(b1) == basic_tag(b2))
758  return (true);
759 
760  if ((basic_float_p(b1) && (basic_complex_p(b2))) ||
762  return (true);
763 
764  flint_message_2("check common",
765  "overlap of incompatible variables (%s, %s) in common %s\n",
766  entity_name(e1),
767  entity_name(e2),
768  module_local_name(the_common));
769  return (false);
770 }
void flint_message_2(char *fun, char *fmt,...)
Same as flint_message but without the function name
Definition: flint.c:183
bool find_bd_type_variable(type, basic *, list *)
Definition: flint_utils.c:125
#define basic_complex_p(x)
Definition: ri.h:626
#define basic_float_p(x)
Definition: ri.h:617
Value b2
Definition: sc_gram.c:105
Value b1
booleen indiquant quel membre est en cours d'analyse
Definition: sc_gram.c:105

References b1, b2, basic_complex_p, basic_float_p, basic_tag, entity_name, entity_type, find_bd_type_variable(), flint_message_2(), and module_local_name().

Referenced by check_one_common().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ check_procedure()

bool check_procedure ( call  c)

flint_check.c

flint_check.c

Definition at line 88 of file flint_check.c.

90 {
91  entity the_fnct;
92  type the_tp;
93  functional ft;
94  type result;
95  bool tmpbool= BOOL_UNDEF;
96 
97  if (call_intrinsic_p(c))
98  tmpbool = BOOL_UNDEF;
99  else {
100  the_fnct = call_function(c);
101  the_tp = entity_type(the_fnct);
102  if (!type_functional_p(the_tp))
103  tmpbool = BOOL_UNDEF;
104  else {
105  ft = type_functional(the_tp);
106  result = functional_result(ft);
107  if (!type_void_p(result)) {
108  flint_message("check procedure",
109  "warning, function used as a procedure : %s\n",
110  entity_name(the_fnct));
111  tmpbool = false;
112  }
113  }
114  }
115  return (tmpbool);
116 }
#define type_functional_p(x)
Definition: ri.h:2950
#define functional_result(x)
Definition: ri.h:1444
#define type_functional(x)
Definition: ri.h:2952
#define type_void_p(x)
Definition: ri.h:2959

References BOOL_UNDEF, call_function, call_intrinsic_p, entity_name, entity_type, flint_message(), functional_result, type_functional, type_functional_p, and type_void_p.

Referenced by flint_instruction().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ check_the_call()

bool check_the_call ( call  c)

else

else

else

else

Errors in parameter modes are found out by effect computation. A second check, later, is meaningless.

return (check_call_mode_consistency(la, lt, the_fnct));

Definition at line 130 of file flint_check.c.

132 {
133  list la = call_arguments(c);
134  entity the_fnct = call_function(c);
135  type the_tp = entity_type(the_fnct);
136  functional ft;
137  list lt;
138 
139  if (!type_functional_p(the_tp))
140  return (BOOL_UNDEF);
141 
142  ft = type_functional(the_tp);
143  lt = functional_parameters(ft);
144 
145 
146  if (!check_call_args_number(la, lt, c))
147  return (false);
148 
149  /* else */
150  if (call_intrinsic_p(c))
151  return (check_call_intrinsic(la, lt, c));
152 
153  if ((int) gen_length(la) == 0)
154  return (true);
155 
156  /* else */
157  if (!check_call_types_compatibility(la, lt, c))
158  return (false);
159 
160  /* else */
161  if (call_constant_p(c))
162  return (true);
163 
164  /* else */
165  /* Errors in parameter modes are found out by effect computation.
166  * A second check, later, is meaningless.
167  */
168  /* return (check_call_mode_consistency(la, lt, the_fnct)); */
169 
170  return true;
171 }
bool check_call_args_number(list la, list lt, call c)
Definition: flint_check.c:222
bool check_call_types_compatibility(list la, list lt, call c)
Definition: flint_check.c:254
#define call_constant_p(C)
Definition: flint_check.c:51
bool check_call_intrinsic(list la, list __attribute__((unused)) lt, call c)
Definition: flint_check.c:184
#define functional_parameters(x)
Definition: ri.h:1442
#define call_arguments(x)
Definition: ri.h:711

References BOOL_UNDEF, call_arguments, call_constant_p, call_function, call_intrinsic_p, check_call_args_number(), check_call_intrinsic(), check_call_types_compatibility(), entity_type, functional_parameters, gen_length(), type_functional, and type_functional_p.

Referenced by flint_call().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ check_the_reference()

void check_the_reference ( reference  ref)
Parameters
refef

Definition at line 396 of file flint_check.c.

398 {
399  list the_indices = reference_indices(ref);
400  int i, len = gen_length(the_indices);
401  basic base;
402  list dims;
404  type tp = entity_type(var);
405  int len_ind = gen_length(the_indices), len_dim;
406  bool ok;
407 
408  ok = find_bd_type_variable(tp, &base, &dims);
409  if (!ok)
410  return;
411 
412  len_dim = gen_length(dims);
413 
414  if (len_dim < len_ind) {
415  flint_message("reference",
416  "too many indices (%d>%d) in reference to %s\n",
417  len_ind, len_dim, entity_local_name(var));
418  return;
419  }
420 
421  if (len_dim > len_ind) {
422  flint_message("reference",
423  "too few indices (%d<%d) in reference to %s\n",
424  len_ind, len_dim, entity_local_name(var));
425  return;
426  }
427 
429  return;
430 
431  for (i = 1; i <= len; i++) {
433  EXPRESSION(CAR(the_indices))))
434  flint_message("check reference: WARNING",
435  "the %dth index may not be a mere integer\n", i);
436  else
438  EXPRESSION(CAR(the_indices))))
439  flint_message("check reference",
440  "the %dth index is not a mere integer\n", i);
441 
442  the_indices = CDR(the_indices);
443  }
444 }
static reference ref
Current stmt (an integer)
Definition: adg_read_paf.c:163
bdt base
Current expression.
Definition: bdt_read_paf.c:100
bool control_type_in_expression(enum basic_utype, int, expression)
@ is_basic_overloaded
Definition: ri.h:574
@ is_basic_int
Definition: ri.h:571
#define reference_variable(x)
Definition: ri.h:2326
#define reference_indices(x)
Definition: ri.h:2328

References base, basic_overloaded_p, CAR, CDR, control_type_in_expression(), entity_local_name(), entity_type, EXPRESSION, find_bd_type_variable(), flint_message(), gen_length(), is_basic_int, is_basic_overloaded, ok, ref, reference_indices, and reference_variable.

Referenced by flint_reference().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ control_type_in_expression()

bool control_type_in_expression ( enum  basic_utype,
int  ,
expression   
)

Referenced by check_the_reference().

+ Here is the caller graph for this function:

◆ find_bd_call()

bool find_bd_call ( call  c,
basic base,
list dims 
)
Parameters
basease
dimsims

Definition at line 191 of file flint_utils.c.

195 {
196  entity fct = call_function(c);
197  type tp = entity_type(fct);
198 
199  if (!type_functional_p(tp)) {
200  flint_message("find_bd_call",
201  "very strange function encountered\n");
202  return (false);
203  }
205 }
bool find_bd_type_variable(type tp, basic *base, list *dims)
Definition: flint_utils.c:125

References base, call_function, entity_type, find_bd_type_variable(), flint_message(), functional_result, type_functional, and type_functional_p.

Referenced by find_bd_expression().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ find_bd_expression()

bool find_bd_expression ( expression  exp,
basic base,
list dims 
)
Parameters
expxp
basease
dimsims

Definition at line 141 of file flint_utils.c.

145 {
147  reference re;
148  call c;
149 
150  switch (syntax_tag(s)) {
151  case is_syntax_reference:
152  re = syntax_reference(s);
153  return (find_bd_reference(re, base, dims));
154  case is_syntax_range:
155  flint_message("find_bd_expression", "no basic in this expression\n");
156  return (false);
157  case is_syntax_call:
158  c = syntax_call(s);
159  return (find_bd_call(c, base, dims));
160  default:
161  FATAL("find_bd_expression : unexpected tag %u\n", syntax_tag(s));
162  }
163 
164  return (false);
165 }
#define FATAL(msg, value)
Print error message and exit from flint.
Definition: flint_utils.c:42
bool find_bd_call(call c, basic *base, list *dims)
Definition: flint_utils.c:191
bool find_bd_reference(reference ref, basic *base, list *dims)
Definition: flint_utils.c:167
#define syntax_reference(x)
Definition: ri.h:2730
#define syntax_tag(x)
Definition: ri.h:2727
@ is_syntax_range
Definition: ri.h:2692
@ is_syntax_call
Definition: ri.h:2693
@ is_syntax_reference
Definition: ri.h:2691
#define syntax_call(x)
Definition: ri.h:2736
#define expression_syntax(x)
Definition: ri.h:1247

References base, exp, expression_syntax, FATAL, find_bd_call(), find_bd_reference(), flint_message(), is_syntax_call, is_syntax_range, is_syntax_reference, syntax_call, syntax_reference, and syntax_tag.

Referenced by check_call_basic_and_dim(), check_call_intrinsic(), and control_type_in_expression().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ find_bd_parameter()

bool find_bd_parameter ( parameter  param,
basic base,
list dims 
)
Parameters
paramaram
basease
dimsims

Definition at line 116 of file flint_utils.c.

120 {
121  type tp = parameter_type(param);
122  return (find_bd_type_variable(tp, base, dims));
123 }

References base, find_bd_type_variable(), and parameter_type.

Referenced by check_call_basic_and_dim().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ find_bd_reference()

bool find_bd_reference ( reference  ref,
basic base,
list dims 
)
Parameters
refef
basease
dimsims

Definition at line 167 of file flint_utils.c.

171 {
173  list ind = reference_indices(ref);
174  type tp = entity_type(var);
175  int len_ind = gen_length(ind), len_dim, i;
176  bool ok;
177 
178  ok = find_bd_type_variable(tp, base, dims);
179  if (!ok)
180  return (false);
181 
182  len_dim = gen_length((*dims));
183  if (len_dim < len_ind)
184  return (false);
185 
186  for (i = 1; i <= len_ind; i++)
187  (*dims) = CDR(*dims);
188  return (true);
189 }

References base, CDR, entity_type, find_bd_type_variable(), gen_length(), ok, ref, reference_indices, and reference_variable.

Referenced by find_bd_expression().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ find_bd_type_variable()

bool find_bd_type_variable ( type  tp,
basic base,
list dims 
)
Parameters
tpp
basease
dimsims

Definition at line 125 of file flint_utils.c.

129 {
130  if (!type_variable_p(tp)) {
131  flint_message("find_bd_type_var",
132  "very strange type encountered, waiting for a variable\n");
133  return (false);
134  }
136  *dims = variable_dimensions(type_variable(tp));
137 
138  return (true);
139 }
#define type_variable(x)
Definition: ri.h:2949
#define variable_dimensions(x)
Definition: ri.h:3122
#define type_variable_p(x)
Definition: ri.h:2947
#define variable_basic(x)
Definition: ri.h:3120

References base, flint_message(), type_variable, type_variable_p, variable_basic, and variable_dimensions.

Referenced by check_overlap_in_common(), check_the_reference(), find_bd_call(), find_bd_parameter(), find_bd_reference(), and position_in_the_area().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ flint_call()

call flint_call ( call  c)

This function checks the syntax of a call and recursively.

verifies its arguments

Definition at line 74 of file flint_walk.c.

76 {
77  list la = call_arguments(c);
78 
79  check_the_call(c);
80 
82 
83  return (c);
84 }
bool check_the_call(call)
Definition: flint_check.c:130
void flint_cons_actual_argument(list pc)
Definition: flint_walk.c:158
void gen_mapl(gen_iter_func_t fp, const list l)
MAP.
Definition: list.c:165
void(* gen_iter_func_t)(void *)
Definition: newgen_types.h:116

References call_arguments, check_the_call(), flint_cons_actual_argument(), and gen_mapl().

Referenced by flint_instruction(), and flint_syntax().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ flint_cons_actual_argument()

void flint_cons_actual_argument ( list  pc)

An array actual argument may have no indices

Parameters
pcc

Definition at line 158 of file flint_walk.c.

159 {
160  expression e = EXPRESSION(CAR(pc));
161 
162  /* An array actual argument may have no indices */
163  if(expression_reference_p(e)) {
165 
166  if(gen_length(reference_indices(r))!=0)
167  flint_expression(e);
168  }
169  else {
170  flint_expression(e);
171  }
172 }
expression flint_expression(expression e)
Definition: flint_walk.c:174
bool expression_reference_p(expression e)
Test if an expression is a reference.
Definition: expression.c:528
reference expression_reference(expression e)
Short cut, meaningful only if expression_reference_p(e) holds.
Definition: expression.c:1832

References CAR, EXPRESSION, expression_reference(), expression_reference_p(), flint_expression(), gen_length(), and reference_indices.

Referenced by flint_call().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ flint_cons_dimension()

void flint_cons_dimension ( list  pc)

flint_walk.c

flint_walk.c

extern char *current_module_name; unused and changed These two functions deal with the boundaries of finite
arrays, verifying their definition as expressions

Parameters
pcc

Definition at line 52 of file flint_walk.c.

54 {
56 }
dimension flint_dimension(dimension d)
Definition: flint_walk.c:58

References CAR, DIMENSION, and flint_dimension().

+ Here is the call graph for this function:

◆ flint_cons_expression()

void flint_cons_expression ( list  pc)

These two functions operate on the list of expressions

Parameters
pcc

Definition at line 150 of file flint_walk.c.

152 {
154 }

References CAR, EXPRESSION, and flint_expression().

Referenced by flint_reference().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ flint_cons_statement()

void flint_cons_statement ( list  pc)
Parameters
pcc

Definition at line 269 of file flint_walk.c.

271 {
273 }
statement flint_statement(statement s)
Definition: flint_walk.c:278
#define STATEMENT(x)
STATEMENT.
Definition: ri.h:2413

References CAR, flint_statement(), and STATEMENT.

Referenced by flint_instruction().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ flint_dimension()

dimension flint_dimension ( dimension  d)

Definition at line 58 of file flint_walk.c.

60 {
63 
64  flint_expression(el);
65  flint_expression(eu);
66 
67  return (d);
68 }
#define dimension_lower(x)
Definition: ri.h:980
#define dimension_upper(x)
Definition: ri.h:982

References dimension_lower, dimension_upper, and flint_expression().

Referenced by flint_cons_dimension().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ flint_expression()

expression flint_expression ( expression  e)

Definition at line 174 of file flint_walk.c.

176 {
177  syntax s = expression_syntax(e);
178 
179  flint_syntax(s);
180 
181  return (e);
182 }
void flint_syntax(syntax s)
verification of syntaxes
Definition: flint_walk.c:121

References expression_syntax, and flint_syntax().

Referenced by flint_cons_actual_argument(), flint_cons_expression(), flint_dimension(), flint_range(), and flint_test().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ flint_instruction()

instruction flint_instruction ( instruction  i)

Verification of an instruction with branching according

to its subclass as defined in the data structure

Definition at line 217 of file flint_walk.c.

219 {
220  list pc;
221  test t;
222  loop l;
223  call c;
224  unstructured u;
225 
226  switch (instruction_tag(i)) {
228  pc = instruction_block(i);
230  break;
231  case is_instruction_test:
232  t = instruction_test(i);
233  flint_test(t);
234  break;
235  case is_instruction_loop:
236  l = instruction_loop(i);
237  flint_loop(l);
238  break;
239  case is_instruction_goto:
240  break;
244  break;
245  case is_instruction_call:
246  c = instruction_call(i);
247  (void) check_procedure(c);
248  flint_call(c);
249  break;
250  default:
251  FATAL("flint_instruction: unexpected tag %u\n", instruction_tag(i));
252  }
253 
254  return (i);
255 }
bool check_procedure(call)
flint_check.c
Definition: flint_check.c:88
loop flint_loop(loop l)
Recursive verification of a loop as (range)+(expression)
Definition: flint_walk.c:186
call flint_call(call c)
This function checks the syntax of a call and recursively.
Definition: flint_walk.c:74
test flint_test(test t)
A test is taken as (expression)+(statement)+(statement)
Definition: flint_walk.c:200
#define FATAL(msg, value)
This file contains a set of functions defined to walk through the internal representation of a module...
Definition: flint_walk.c:42
void flint_unstructured(unstructured u)
Definition: flint_walk.c:257
void flint_cons_statement(list pc)
Definition: flint_walk.c:269
#define is_instruction_block
soft block->sequence transition
#define instruction_block(i)
#define instruction_loop(x)
Definition: ri.h:1520
@ is_instruction_goto
Definition: ri.h:1473
@ is_instruction_unstructured
Definition: ri.h:1475
@ is_instruction_test
Definition: ri.h:1470
@ is_instruction_call
Definition: ri.h:1474
@ is_instruction_loop
Definition: ri.h:1471
#define instruction_tag(x)
Definition: ri.h:1511
#define instruction_call(x)
Definition: ri.h:1529
#define instruction_test(x)
Definition: ri.h:1517
#define instruction_unstructured(x)
Definition: ri.h:1532

References check_procedure(), FATAL, flint_call(), flint_cons_statement(), flint_loop(), flint_test(), flint_unstructured(), gen_mapl(), instruction_block, instruction_call, instruction_loop, instruction_tag, instruction_test, instruction_unstructured, is_instruction_block, is_instruction_call, is_instruction_goto, is_instruction_loop, is_instruction_test, and is_instruction_unstructured.

Referenced by flint_statement().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ flint_loop()

loop flint_loop ( loop  l)

Recursive verification of a loop as (range)+(expression)

Definition at line 186 of file flint_walk.c.

188 {
189  range r = loop_range(l);
190  statement s = loop_body(l);
191 
192  flint_range(r);
193  flint_statement(s);
194 
195  return (l);
196 }
range flint_range(range r)
This function verifies that incremented or decremented
Definition: flint_walk.c:90
#define loop_body(x)
Definition: ri.h:1644
#define loop_range(x)
Definition: ri.h:1642

References flint_range(), flint_statement(), loop_body, and loop_range.

Referenced by flint_instruction().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ flint_message()

void flint_message ( char *  fun,
char *  fmt,
  ... 
)

print out remainder of message

Parameters
funun
fmtmt

Definition at line 147 of file flint.c.

150 {
151  va_list args;
152  int order;
153 
154  va_start(args, fmt);
155 
156  /*
157  * print name of function causing message, and in which module it
158  * occured.
159  */
160 
161  no_message = false;
163 
165 
167  "flint message from %s, in module %s, in statement (%d.%d), number %td\n",
169  ORDERING_NUMBER(order), ORDERING_STATEMENT(order),
171 
172 
173  /* print out remainder of message */
174  (void) vfprintf(flint_messages_file, fmt, args);
175 
176  va_end(args);
177 
178 }
static bool no_message
Definition: flint.c:44
static FILE * flint_messages_file
internal variables
Definition: flint.c:43
static char * flint_current_module_name
name of module being flinted
Definition: flint.c:49
static int number_of_messages
Definition: flint.c:45
statement flint_current_statement
cproto-generated files
Definition: flint.c:46
#define ORDERING_NUMBER(o)
#define ORDERING_STATEMENT(o)
#define statement_ordering(x)
Definition: ri.h:2454
#define statement_number(x)
Definition: ri.h:2452
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...

References flint_current_module_name, flint_current_statement, flint_messages_file, fprintf(), no_message, number_of_messages, ORDERING_NUMBER, ORDERING_STATEMENT, statement_number, and statement_ordering.

Referenced by check_call_args_number(), check_call_basic(), check_call_dim(), check_call_one_mode(), check_one_common(), check_procedure(), check_the_reference(), control_type_in_expression(), find_bd_call(), find_bd_expression(), and find_bd_type_variable().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ flint_message_2()

void flint_message_2 ( char *  fun,
char *  fmt,
  ... 
)

Same as flint_message but without the function name

print out remainder of message

Parameters
funun
fmtmt

Definition at line 183 of file flint.c.

186 {
187  va_list args;
188 
189  va_start(args, fmt);
190 
191  no_message = false;
193 
195  "flint message from %s, in module %s\n",
197 
198  /* print out remainder of message */
199  (void) vfprintf(flint_messages_file, fmt, args);
200 
201  va_end(args);
202 
203 }

References flint_current_module_name, flint_messages_file, fprintf(), no_message, and number_of_messages.

Referenced by check_overlap_in_common().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ flint_range()

range flint_range ( range  r)

This function verifies that incremented or decremented

loop(for) indices do not overflow or underflow their
limits

Definition at line 90 of file flint_walk.c.

92 {
93  expression el = range_lower(r);
94  expression eu = range_upper(r);
96 
97  flint_expression(el);
98  flint_expression(eu);
99  flint_expression(ei);
100 
101  return (r);
102 }
#define range_upper(x)
Definition: ri.h:2290
#define range_increment(x)
Definition: ri.h:2292
#define range_lower(x)
Definition: ri.h:2288

References flint_expression(), range_increment, range_lower, and range_upper.

Referenced by flint_loop(), and flint_syntax().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ flint_reference()

reference flint_reference ( reference  r)

A reference is used when given a function the address of.

an element instead of its value.

Definition at line 107 of file flint_walk.c.

109 {
110  list pc = reference_indices(r);
111 
112  (void) check_the_reference(r);
113 
115 
116  return (r);
117 }
void check_the_reference(reference)
Definition: flint_check.c:396
void flint_cons_expression(list pc)
These two functions operate on the list of expressions
Definition: flint_walk.c:150

References check_the_reference(), flint_cons_expression(), gen_mapl(), and reference_indices.

Referenced by flint_syntax().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ flint_statement()

statement flint_statement ( statement  s)

Definition at line 278 of file flint_walk.c.

280 {
281  instruction
282  i = statement_instruction(s);
283  statement
284  saved = flint_current_statement;
285 
287 
289 
290  flint_current_statement = saved;
291  return (s);
292 }
instruction flint_instruction(instruction i)
Verification of an instruction with branching according
Definition: flint_walk.c:217
statement flint_current_statement
cproto-generated files
Definition: flint.c:46
#define statement_instruction(x)
Definition: ri.h:2458

References flint_current_statement, flint_instruction(), and statement_instruction.

Referenced by flint_cons_statement(), flint_loop(), flint_test(), flint_unstructured(), and flinter().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ flint_syntax()

void flint_syntax ( syntax  s)

verification of syntaxes

branch according to the syntax subclass

Definition at line 121 of file flint_walk.c.

123 {
124  reference re;
125  range ra;
126  call c;
127 
128  /* branch according to the syntax subclass */
129  switch (syntax_tag(s)) {
130  case is_syntax_reference:
131  re = syntax_reference(s);
132  flint_reference(re);
133  break;
134  case is_syntax_range:
135  ra = syntax_range(s);
136  flint_range(ra);
137  break;
138  case is_syntax_call:
139  c = syntax_call(s);
140  flint_call(c);
141  break;
142  default:
143  FATAL("flint_syntax: unexpected tag %u\n", syntax_tag(s));
144  }
145 }
reference flint_reference(reference r)
A reference is used when given a function the address of.
Definition: flint_walk.c:107
#define syntax_range(x)
Definition: ri.h:2733

References FATAL, flint_call(), flint_range(), flint_reference(), is_syntax_call, is_syntax_range, is_syntax_reference, syntax_call, syntax_range, syntax_reference, and syntax_tag.

Referenced by flint_expression().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ flint_test()

test flint_test ( test  t)

A test is taken as (expression)+(statement)+(statement)

Definition at line 200 of file flint_walk.c.

202 {
203  expression e = test_condition(t);
204  statement st = test_true(t);
205  statement sf = test_false(t);
206 
207  flint_expression(e);
208  flint_statement(st);
209  flint_statement(sf);
210 
211  return (t);
212 }
#define test_false(x)
Definition: ri.h:2837
#define test_true(x)
Definition: ri.h:2835
#define test_condition(x)
Definition: ri.h:2833

References flint_expression(), flint_statement(), test_condition, test_false, and test_true.

Referenced by flint_instruction().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ flint_uninitialized_variables()

void flint_uninitialized_variables ( graph  dependence_graph,
statement  module_stat 
)

uninitialized_variables.c

uninitialized_variables.c

Parameters
dependence_graphependence_graph
module_statodule_stat

Definition at line 210 of file uninitialized_variables.c.

212 {
215 
216  gen_recurse(module_stat,
219  gen_null);
220 
222  raw_flint_message(false,
223  "\n");
224 
226 }
static graph dependence_graph
Definition: delay.c:93
void raw_flint_message(bool count, char *fmt,...)
Same as flint_message but a bare bones version
Definition: flint.c:211
#define gen_recurse(start, domain_number, flt, rwt)
Definition: genC.h:283
void gen_null(__attribute__((unused)) void *unused)
Ignore the argument.
Definition: genClib.c:2752
#define statement_domain
newgen_sizeofexpression_domain_defined
Definition: ri.h:362
static void flint_initialize_statement_def_use_variables(graph dependence_graph)
Build the tables relating a statement with the variables it uses that have been initialized elsewhere...
static void flint_free_statement_def_use_variables()
Remove the flint_statement_def_use_variables data structure:
static bool flint_no_uninitialized_variable_ouput_yet
static bool flint_check_uninitialized_variables_in_statement(statement s)
Warn about uninitialized variables in this statement:

References dependence_graph, flint_check_uninitialized_variables_in_statement(), flint_free_statement_def_use_variables(), flint_initialize_statement_def_use_variables(), flint_no_uninitialized_variable_ouput_yet, gen_null(), gen_recurse, raw_flint_message(), and statement_domain.

Referenced by flinter().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ flint_unstructured()

void flint_unstructured ( unstructured  u)

Definition at line 257 of file flint_walk.c.

259 {
260  list blocs = NIL;
261 
262  CONTROL_MAP(c, {
264  }, unstructured_control(u), blocs);
265 
266  gen_free_list(blocs);
267 }
#define CONTROL_MAP(ctl, code, c, list)
Macro to walk through all the controls reachable from a given control node of an unstructured.
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
void gen_free_list(list l)
free the spine of the list
Definition: list.c:327
#define unstructured_control
After the modification in Newgen: unstructured = entry:control x exit:control we have create a macro ...
#define control_statement(x)
Definition: ri.h:941

References CONTROL_MAP, control_statement, flint_statement(), gen_free_list(), NIL, and unstructured_control.

Referenced by flint_instruction().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ flinter()

bool flinter ( const  string)

Routine of global module verification

user_error() is not used in flint, no need for an exception handler

Getting parsed code of module

the last parameter should be pure=true; the code should not be modified!

Resource to trace uninitialized variables:

what is done

checking commons

checking syntax

final message

Should have worked:

Parameters
stringodule_name

Definition at line 54 of file flint.c.

55 {
58  statement module_stat;
59  string localfilename = NULL;
60  string filename = NULL;
61 
62  /* user_error() is not used in flint, no need for an exception handler */
63 
64  debug_on("FLINT_DEBUG_LEVEL");
65 
69  no_message = true;
70 
71  debug(1, "flinter", "flinting module %s\n", module_name);
72 
73  /* Getting parsed code of module */
74  /* the last parameter should be pure=true; the code should not be modified! */
75  module_stat = (statement)
76  db_get_memory_resource(DBR_CODE, module_name, true);
77 
78  /* Resource to trace uninitialized variables: */
80  (graph) db_get_memory_resource(DBR_CHAINS, module_name, true);
81  set_ordering_to_statement(module_stat);
82 
84  db_get_memory_resource(DBR_PROPER_EFFECTS,
86  true));
87  set_current_module_statement(module_stat);
89 
90  localfilename = db_build_file_resource_name(DBR_FLINTED_FILE,
92  ".flinted");
94  "/", localfilename, NULL));
96  (FILE *) safe_fopen(filename, "w");
97 
98  /* what is done */
99  pips_debug(3, "checking uninitialized variables\n");
101 
102  debug(3, "flinter", "checking commons\n");
103  check_commons(module); /* checking commons */
104 
105  debug(3, "flinter", "checking statements\n");
106  flint_statement(module_stat); /* checking syntax */
107 
108  if (no_message) /* final message */
110  "%s has been flinted : everything is ok.\n",
111  module_name);
112  else
114  "number of messages from flint for %s : %d\n",
115  module_name,
117 
118  safe_fclose(flint_messages_file, filename);
119  DB_PUT_FILE_RESOURCE(DBR_FLINTED_FILE, strdup(module_name),
120  localfilename);
121  free(filename);
122 
125  number_of_messages = 0;
126  no_message = true;
127 
132 
133  debug_off();
134 
135  /* Should have worked: */
136  return true;
137 }
struct _newgen_struct_statement_ * statement
Definition: cloning.h:21
void reset_proper_rw_effects(void)
void set_proper_rw_effects(statement_effects)
FILE * safe_fopen(const char *filename, const char *what)
Definition: file.c:67
int safe_fclose(FILE *stream, const char *filename)
Definition: file.c:77
bool check_commons(entity)
Definition: flint_check.c:632
void flint_uninitialized_variables(graph, statement)
uninitialized_variables.c
statement flint_statement(statement)
Definition: flint_walk.c:278
void free(void *)
struct _newgen_struct_graph_ * graph
Definition: graph.h:31
void reset_current_module_entity(void)
Reset the current module entity.
Definition: static.c:97
void reset_current_module_statement(void)
Reset the current module statement.
Definition: static.c:221
statement set_current_module_statement(statement)
Set the current module statement.
Definition: static.c:165
entity set_current_module_entity(entity)
static.c
Definition: static.c:66
#define DB_PUT_FILE_RESOURCE
Put a file resource into the current workspace database.
Definition: pipsdbm-local.h:85
string db_build_file_resource_name(const char *rname, const char *oname, const char *suffix)
returns an allocated file name for a file resource.
Definition: lowlevel.c:169
#define debug_on(env)
Definition: misc-local.h:157
#define debug_off()
Definition: misc-local.h:160
void debug(const int the_expected_debug_level, const char *calling_function_name, const char *a_message_format,...)
ARARGS0.
Definition: debug.c:189
string concatenate(const char *,...)
Return the concatenation of the given strings.
Definition: string.c:183
hash_table set_ordering_to_statement(statement s)
To be used instead of initialize_ordering_to_statement() to make sure that the hash table ots is in s...
Definition: ordering.c:172
void reset_ordering_to_statement(void)
Reset the mapping from ordering to statement.
Definition: ordering.c:185
string db_get_current_workspace_directory(void)
Definition: workspace.c:96
entity local_name_to_top_level_entity(const char *n)
This function try to find a top-level entity from a local name.
Definition: entity.c:1450
#define statement_undefined
Definition: ri.h:2419
char * strdup()

References check_commons(), concatenate(), db_build_file_resource_name(), db_get_current_workspace_directory(), db_get_memory_resource(), DB_PUT_FILE_RESOURCE, debug(), debug_off, debug_on, dependence_graph, flint_current_module_name, flint_current_statement, flint_messages_file, flint_statement(), flint_uninitialized_variables(), fprintf(), free(), local_name_to_top_level_entity(), module, module_name(), no_message, number_of_messages, pips_debug, reset_current_module_entity(), reset_current_module_statement(), reset_ordering_to_statement(), reset_proper_rw_effects(), safe_fclose(), safe_fopen(), set_current_module_entity(), set_current_module_statement(), set_ordering_to_statement(), set_proper_rw_effects(), statement_undefined, and strdup().

+ Here is the call graph for this function:

◆ look_at_the_commons()

bool look_at_the_commons ( entity  module)

Parameters
moduleodule

Definition at line 543 of file flint_check.c.

544 {
546  entity local;
547 
548  while (ldecl != NULL) {
549  local = ENTITY(CAR(ldecl));
550  ldecl = CDR(ldecl);
551 
552  if (type_area_p(entity_type(local))) {
553  fprintf(stdout,
554  "common : %s, in module %s\n",
555  entity_name(local),
557  if (!special_common(local)) {
558  list llayout = area_layout(type_area(entity_type(local)));
559  while (llayout != NULL) {
560 
561  fprintf(stdout, "variable %s at offset %td\n",
562  entity_name(ENTITY(CAR(llayout))),
564  llayout = CDR(llayout);
565  }
566  }
567  }
568  }
569  return (true);
570 }
#define entity_storage(x)
Definition: ri.h:2794
#define storage_ram(x)
Definition: ri.h:2521
#define type_area_p(x)
Definition: ri.h:2944
#define ram_offset(x)
Definition: ri.h:2251

References area_layout, CAR, CDR, code_declarations, ENTITY, entity_initial, entity_name, entity_storage, entity_type, fprintf(), module, ram_offset, special_common, storage_ram, type_area, type_area_p, and value_code.

+ Here is the call graph for this function:

◆ number_of_elements()

bool number_of_elements ( list  ld,
intptr_t the_result 
)

flint_utils.c

Parameters
ldd
the_resulthe_result

Definition at line 50 of file flint_utils.c.

53 {
54  list pc;
55  intptr_t a_temp_int;
56  bool ok = true;
57 
58  (*the_result) = 1;
59 
60  for (pc = ld;
61  (pc != NULL) && (ok = size_of_dimension(DIMENSION(CAR(pc)), &a_temp_int));
62  pc = CDR(pc)) {
63  (*the_result) *= a_temp_int;
64  }
65 
66  return (ok);
67 }
bool size_of_dimension(dimension d, intptr_t *the_int)
this function computes the size of a dimension.
Definition: flint_utils.c:71

References CAR, CDR, DIMENSION, intptr_t, ok, and size_of_dimension().

Referenced by check_call_dim(), control_type_in_expression(), make_emulated_shared_variable(), and position_in_the_area().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ position_in_the_area()

bool position_in_the_area ( entity  the_var,
intptr_t inf,
intptr_t sup 
)

Parameters
the_varhe_var
infnf
supup

Definition at line 580 of file flint_check.c.

581 {
582  basic base;
583  list dims;
584  intptr_t len_unit = 0;
585  intptr_t nb_of_elements = 0;
586 
587  if (!find_bd_type_variable(entity_type(the_var), &base, &dims))
588  return (false);
589  if (!number_of_elements(dims, &nb_of_elements))
590  return (false);
591  if (!(basic_int_p(base) || basic_float_p(base) ||
593  return (false);
594 
595  switch (basic_tag(base)) {
596  case is_basic_int:{
597  len_unit = basic_int(base);
598  break;
599  }
600  case is_basic_float:{
601  len_unit = basic_float(base);
602  break;
603  }
604  case is_basic_logical:{
605  len_unit = basic_logical(base);
606  break;
607  }
608  case is_basic_complex:{
609  len_unit = basic_complex(base);
610  break;
611  }
612  default:
613  pips_internal_error("unknown basic tag %d", basic_tag(base));
614  }
615 
616  *inf = ram_offset(storage_ram(entity_storage(the_var)));
617  *sup = (*inf) + (nb_of_elements * len_unit) - 1;
618 
619  return (true);
620 }
#define pips_internal_error
Definition: misc-local.h:149
@ is_basic_float
Definition: ri.h:572
@ is_basic_logical
Definition: ri.h:573
@ is_basic_complex
Definition: ri.h:575
#define basic_int_p(x)
Definition: ri.h:614
#define basic_int(x)
Definition: ri.h:616
#define basic_logical(x)
Definition: ri.h:622
#define basic_float(x)
Definition: ri.h:619
#define basic_complex(x)
Definition: ri.h:628
#define basic_logical_p(x)
Definition: ri.h:620

References base, basic_complex, basic_complex_p, basic_float, basic_float_p, basic_int, basic_int_p, basic_logical, basic_logical_p, basic_tag, entity_storage, entity_type, find_bd_type_variable(), intptr_t, is_basic_complex, is_basic_float, is_basic_int, is_basic_logical, number_of_elements(), pips_internal_error, ram_offset, and storage_ram.

Referenced by check_one_common().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ raw_flint_message()

void raw_flint_message ( bool  count,
char *  fmt,
  ... 
)

Same as flint_message but a bare bones version

count is used to decide if we count tjis message or not.

Parameters
countount
fmtmt

Definition at line 211 of file flint.c.

214 {
215  va_list args;
216 
217  va_start(args, fmt);
218 
219  no_message = false;
220  if (count)
222 
223  (void) vfprintf(flint_messages_file, fmt, args);
224 
225  va_end(args);
226 }
static int count
Definition: SDG.c:519

References count, flint_messages_file, no_message, and number_of_messages.

Referenced by flint_check_uninitialized_variables_in_statement(), and flint_uninitialized_variables().

+ Here is the caller graph for this function:

◆ size_of_dimension()

bool size_of_dimension ( dimension  d,
intptr_t the_int 
)

this function computes the size of a dimension.

else

Parameters
the_inthe_int

Definition at line 71 of file flint_utils.c.

74 {
75  intptr_t upper_dim, lower_dim;
76 
77  if (expression_integer_value(dimension_upper(d), &upper_dim) &&
78  expression_integer_value(dimension_lower(d), &lower_dim)) {
79  (*the_int) = upper_dim - lower_dim + 1;
80  return (true);
81  }
82  /* else */
83  return (false);
84 }
bool expression_integer_value(expression e, intptr_t *pval)
Definition: eval.c:792

References dimension_lower, dimension_upper, expression_integer_value(), and intptr_t.

Referenced by number_of_elements().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ flint_current_statement

statement flint_current_statement
extern

Warning! Do not modify this file that is automatically generated!

cproto-generated files

Modify src/Libs/flint/flint-local.h instead, to add your own modifications. header file built by cproto flint-local.h

flint.c

Warning! Do not modify this file that is automatically generated!

flint.c

Definition at line 35 of file flint.h.