PIPS
flint_check.c File Reference
#include "local.h"
+ Include dependency graph for flint_check.c:

Go to the source code of this file.

Macros

#define FATAL(msg, value)   {(void) fprintf(stderr,msg,value); exit(1); }
 
#define BOOL_UNDEF   -1
 some defines usefull to clean the code More...
 
#define param_ref_p(P)    (mode_reference_p(parameter_mode(P)))
 
#define arg_const_p(arg)
 
#define call_constant_p(C)    (value_constant_p(entity_initial(call_function(C))))
 
#define effect_may_or_must_p(my_effect)
 The following define may be replaced by #define ... More...
 
#define effect_to_name(the_effect)    entity_name(reference_variable(effect_any_reference(the_effect)))
 
#define entity_is_a_common_p(Ent)    (type_area_p(entity_type(Ent)))
 
#define special_common(Ent)
 

Functions

bool check_procedure (call c)
 extern char *current_module_name; unused and modified More...
 
bool check_the_call (call c)
 
bool check_call_intrinsic (list la, list __attribute__((unused)) lt, call c)
 
bool check_call_args_number (list la, list lt, call c)
 
bool check_call_types_compatibility (list la, list lt, call c)
 
bool check_call_one_type (expression exp, parameter param, call c, int i)
 
bool check_call_basic (basic be, basic bp, call c, int i)
 
bool check_call_dim (list de, list dp, call c, int i)
 loose version More...
 
bool check_call_basic_and_dim (expression exp, parameter param, call c, int i)
 
void check_the_reference (reference ref)
 
bool check_call_mode_consistency (list la, list lt, entity the_fnct)
 
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. More...
 
bool look_at_the_commons (entity module)
 
bool position_in_the_area (entity the_var, intptr_t *inf, intptr_t *sup)
 
bool check_commons (entity module)
 
void check_one_common (entity local, entity module)
 
bool check_overlap_in_common (entity the_common, entity e1, int inf1, int sup1, entity e2, int inf2, int sup2)
 

Macro Definition Documentation

◆ arg_const_p

#define arg_const_p (   arg)
Value:
value_constant_p(entity_initial(call_function( \
#define call_function(x)
Definition: ri.h:709
#define syntax_call_p(x)
Definition: ri.h:2734
#define syntax_call(x)
Definition: ri.h:2736
#define expression_syntax(x)
Definition: ri.h:1247
#define entity_initial(x)
Definition: ri.h:2796

Definition at line 46 of file flint_check.c.

◆ BOOL_UNDEF

#define BOOL_UNDEF   -1

some defines usefull to clean the code

Definition at line 42 of file flint_check.c.

◆ call_constant_p

#define call_constant_p (   C)     (value_constant_p(entity_initial(call_function(C))))

Definition at line 51 of file flint_check.c.

◆ effect_may_or_must_p

#define effect_may_or_must_p (   my_effect)
Value:
#define approximation_exact_p(x)
Definition: effects.h:369
#define approximation_may_p(x)
Definition: effects.h:363
#define effect_approximation(x)
Definition: effects.h:644

The following define may be replaced by #define ...

(true)

Definition at line 55 of file flint_check.c.

◆ effect_to_name

#define effect_to_name (   the_effect)     entity_name(reference_variable(effect_any_reference(the_effect)))

Definition at line 59 of file flint_check.c.

◆ entity_is_a_common_p

#define entity_is_a_common_p (   Ent)     (type_area_p(entity_type(Ent)))

Definition at line 62 of file flint_check.c.

◆ FATAL

#define FATAL (   msg,
  value 
)    {(void) fprintf(stderr,msg,value); exit(1); }

Definition at line 38 of file flint_check.c.

◆ param_ref_p

#define param_ref_p (   P)     (mode_reference_p(parameter_mode(P)))

Definition at line 43 of file flint_check.c.

◆ special_common

#define special_common (   Ent)
Value:
#define DYNAMIC_AREA_LOCAL_NAME
Definition: naming-local.h:69
#define STATIC_AREA_LOCAL_NAME
Definition: naming-local.h:70
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

Definition at line 65 of file flint_check.c.

Function Documentation

◆ check_call_args_number()

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

sometimes out...

Parameters
laa
ltlist of actual arguments
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 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  la,
list __attribute__((unused))  lt,
call  c 
)

check a call to the assign operator

other intrinsics

Definition at line 184 of file flint_check.c.

187 {
188  entity the_fnct = call_function(c);
189  bool ok1, ok2;
190  basic ba1, ba2;
191  list da1, da2;
192 
193  /* check a call to the assign operator */
194  if (ENTITY_ASSIGN_P(the_fnct)) {
195  ok1 = find_bd_expression(EXPRESSION(CAR(la)), &ba1, &da1);
196  ok2 = find_bd_expression(EXPRESSION(CAR(CDR(la))), &ba2, &da2);
197 
198  if (!(ok1 && ok2))
199  return (BOOL_UNDEF);
200 
201  if (basic_overloaded_p(ba1) || basic_overloaded_p(ba2))
202  return (BOOL_UNDEF);
203 
204  if (!check_call_basic(ba2, ba1, c, 0))
205  return (false);
206 
207  return (check_call_dim(da1, da2, c, 0) && check_call_dim(da2, da1, c, 0));
208  }
209  /* other intrinsics */
210  return (BOOL_UNDEF);
211 }
#define CDR(pcons)
Get the list less its first element.
Definition: newgen_list.h:111
#define ENTITY_ASSIGN_P(e)
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217

References basic_overloaded_p, BOOL_UNDEF, call_function, CAR, CDR, check_call_basic(), check_call_dim(), ENTITY_ASSIGN_P, EXPRESSION, and find_bd_expression().

Referenced by check_the_call().

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

◆ 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 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
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

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_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)

extern char *current_module_name; unused and modified

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:

◆ 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
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...

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:

◆ 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: