PIPS
used_before_set.c
Go to the documentation of this file.
1 /*
2 
3  $Id: used_before_set.c 23270 2016-11-02 09:18:27Z coelho $
4 
5  Copyright 1989-2016 MINES ParisTech
6 
7  This file is part of PIPS.
8 
9  PIPS is free software: you can redistribute it and/or modify it
10  under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  any later version.
13 
14  PIPS is distributed in the hope that it will be useful, but WITHOUT ANY
15  WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  FITNESS FOR A PARTICULAR PURPOSE.
17 
18  See the GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with PIPS. If not, see <http://www.gnu.org/licenses/>.
22 
23 */
24 #ifdef HAVE_CONFIG_H
25  #include "pips_config.h"
26 #endif
27 #include <stdio.h>
28 #include <stdlib.h>
29 #include <string.h>
30 #include "genC.h"
31 #include "linear.h"
32 #include "ri.h"
33 #include "effects.h"
34 #include "ri-util.h"
35 #include "prettyprint.h"
36 #include "effects-util.h"
37 #include "database.h"
38 #include "pipsdbm.h"
39 #include "resources.h"
40 #include "transformer.h"
41 #include "misc.h"
42 #include "properties.h"
43 #include "pipsmake.h"
44 #include "alias_private.h"
45 #include "instrumentation.h"
46 #include "ubs_private.h"
47 #include "effects-generic.h"
48 #include "effects-convex.h"
49 #include "effects-simple.h"
50 #include "conversion.h"
51 #include "text-util.h"
52 #include "alias-classes.h"
53 
54 /* This analysis checks if the program uses a variable or an array element
55  which has not been assigned a value. In this case, anything may happen:
56  the program may appear to run normally, or may crash, or may behave unpredictably.
57  We use IN regions that give a set of read variables not previously written.
58  Depending on the nature of the variable: local, formal or global, we have
59  different cases.
60  This is a top-down analysis that process a procedure before all its
61  callees. Information given by callers is used to verify if we have to
62  check for the formal parameters in the current module or not. In addition,
63  we produce information in the resource MODULE.ubs to tell if the formal
64  parameters of the called procedures have to be checked or not.
65  used_before_set > MODULE.ubs
66  < PROGRAM.entities
67  < MODULE.code
68  < MODULE.in_regions
69  < CALLERS.ubs
70  Algorithm: take the list of IN regions of the module statement (attention, the IN region
71  list contains the IN effect list and more exact, so always take the IN region list,
72  although it is heavier) and check for each variable in this list.
73  Case 1. Local variable
74  a. if MUST IN at module statement, insert STOP 'Variable is used before set'
75  b. else MAY IN at module statement,
76  - insert an INITIALIZE function
77  - insert a VERIFY function before each sub-statement with MUST IN region.
78  If the sub-statement is a call site and we only have MAY IN, then update UBS
79  resource of the current procedure with the name of the called procedure and
80  the offset of corresponding formal parameters (the actual variable may occur in
81  several places in the argument list) in order to check these formal variables
82  in the callee's frame.
83  Case 2. Formal variable
84  If no UBS resource for this variable is stored in the callers => no need to VERIFY
85  this variable. Otherwise, which means that there exists at least 1 actual argument
86  that may not defined (but already INITIALIZED), then :
87  - insert a VERIFY function before each sub-statement with MUST IN region.
88  If the sub-statement is a call site and we only have MAY IN, then update UBS
89  resource of the current procedure with the name of the called procedure and
90  the offset of corresponding formal parameters (the actual variable may occur in
91  several places in the argument list) in order to check these formal variables
92  in the callee's frame.
93  Case 3. Common variables, depend on if we have the main program or not.
94  a. if the current module is the main program, or in general, has no callers (maybe unreachable, or a
95  library case): for all kind of common variables (visible in the module or not), do like case 1.
96  Attention, for the invisible variable, we have to declare the common in its INITIALIZE function.
97  When updating the resource ubs, there are two possibilities:
98  - (called procedure, common variable)
99  - (called procedure, formal parameter) in case if the common variable is passed as actual argument.
100  b. if not, the current module has several callers, do like case 2.
101  If the sub-statement is a call site and we only have MAY IN => also update ubs resource
102  for the current procedure with two possibilities
103  - (called procedure, common variable)
104  - (called procedure, formal parameter) in case if the common variable is passed as actual argument.
105  ATTENTION : we have to treat variables initialized by a DATA statement and take care of variables in
106  an EQUIVALENCE statement. Current IN effects/regions do not take into account if an equivalenced variable
107  is defined, there no more IN effects/regions on the other :-) This must be its task in order to keep the
108  analysis conservative !!!
109 
110  Some possible improvements:
111  a.If V is a local variable/or common variable in module with no caller and
112  1.There is no WRITE on V in the current module => no need INITIALIZE + VERIFY, insert STOP before
113  each MUST IN
114  2.If before a MUST IN on V, there is no WRITE on V => no need VERIFY, insert STOP before this MUST IN
115  No no no, because we always VERIFY the formal variable => the actual variable may not be INITIALIZED
116  => false
117  We must have a mechanism to tell the called procedure if it have to insert a VERIFY or a STOP.
118  But with some call paths : VERIFY, the others : STOP => what to do ?
119  Safe way => INITIALIZE and VERIFY all.
120 
121  By using IN regions, we can limit the number of variables to be checked,
122  and code instrumentation is only used when we do not have enough information. Only array
123  elements in the MAY IN regions are initialized, and array elements in the EXACT IN
124  regions are verified, not the whole array.
125 
126  do i_pips = k,l
127  a(i_pips) = undef
128  enddo
129 
130  <A(PHI)-IN-MAY-{K<=PHI<=L}>
131  DO I = M,N
132  A(I) =I
133  ENDDO
134 
135  do i_pips = k,l
136  if (a(i_pips) == undef) stop "used before set"
137  enddo
138 
139  <A(PHI)-IN-EXACT-{K<=PHI<=L}>
140  DO I = K,L
141  X(I) = A(I)
142  ENDDO
143 
144  There are two possible implementations :
145  1. Put checks in an instrumented file and then use a script to insert them into the initial code
146  2. Insert checks directly in the code, but more complicated with gen_recurse, unstructured, and
147  for different variables */
148 
149 #define PREFIX1 "$UBS_CHECK"
150 #define PREFIX2 "$UBS_CHECK_END"
151 static FILE * out;
152 static FILE * out2;
158 //static int number_of_may_uninitialized_array_elements = 0;
163 static string file_name;
164 static string initialization_file;
167 
169 {
170  user_log("\n Number of uninitialized scalar variables : %d",
172  user_log("\n Number of uninitialized array variables : %d",
174  user_log("\n Number of may uninitialized scalar variables : %d",
176  user_log("\n Number of may uninitialized array variables : %d",
178  user_log("\n Number of added verifications : %d",
180  user_log("\n Number of processed modules : %d\n",
182 }
183 
185 {
186  list l_exp = NIL;
187  MAP(ENTITY,ent,
188  {
189  l_exp = gen_nconc(l_exp, CONS(EXPRESSION,entity_to_expression(ent),NIL));
190  },l_ent);
191  return(l_exp);
192 }
193 
194 static string print_list_of_entities(list l)
195 {
196  string retour = "";
197  MAP(ENTITY, e,
198  {
199  retour = strdup(concatenate(retour,",",entity_local_name(e),NULL));
200  }, l);
201  return retour;
202 }
203 
205 {
206  string retour = "";
207  MAP(EXPRESSION, exp,
208  {
209  retour = strdup(concatenate(retour,",",expression_to_string(exp),NULL));
210  }, l);
211  return retour;
212 }
213 
215 {
216  /* Check if a common variable, i.e SUB1:COM1, declared in a common block BLOCK1
217  is visible in a module SUB2 or not */
219  MAP(ENTITY,e,
220  {
221  if (strcmp(entity_local_name(e),entity_local_name(ent)) == 0)
222  {
223  ram r1 = storage_ram(entity_storage(e));
224  ram r2 = storage_ram(entity_storage(ent));
225  entity a1 = ram_section(r1);
226  entity a2 = ram_section(r2);
227  if (a1 == a2) return true;
228  }
229  },d);
230  return false;
231 }
232 
234 {
235  /* This is not true !!! We must follow the IN regions of the equivalent variables*/
236  storage s = entity_storage(ent);
237  list local_shared = ram_shared(storage_ram(s));
238  if (gen_length(local_shared)>0)
239  {
240  ifdebug(3)
241  {
242  pips_debug(3,"List of shared variables of %s \n",entity_name(ent));
243  print_entities(local_shared);
244  }
245  return true;
246  }
247  return false;
248 }
249 
251 {
252  /* Project all #init variables from the system ps,
253  there are 2 cases :
254  1. The result is not sure , there are over flow
255  Return the SC_UNDEFINED
256  2. The projection is exact */
257  if (!sc_empty_p(ps) && !sc_rn_p(ps))
258  {
259  Pvecteur pv_var = NULL;
260  Pbase b = ps->base;
261  for(; !VECTEUR_NUL_P(b);b = b->succ)
262  {
263  entity e = (entity) vecteur_var(b);
264  if (old_value_entity_p(e))
265  vect_add_elem(&pv_var, (Variable) e, VALUE_ONE);
266  }
267  return sc_system_projection_along_variables(ps, pv_var);
268  }
269  return ps;
270 }
271 
273 {
274  basic b = entity_basic(ent);
275  switch (basic_tag(b)) {
276  case 0: /*integer*/
277  return int_to_expression(1000000000);
278  case 1: /*float*/
279  switch (basic_float(b)) {
280  case 4:
281  return make_call_expression(make_constant_entity("r_signaling_nan()",is_basic_float,4),NIL);
282  case 8:
283  return make_call_expression(make_constant_entity("d_signaling_nan()",is_basic_float,8),NIL);
284  default:
285  user_log("\nInitialize floating number with more than 8 bytes ?");
286  return make_call_expression(MakeConstant("which_value",is_basic_float),NIL);
287  }
288  case 2: /*logical : false = 0, true = 1*/
289  return int_to_expression(2);
290  case 3: /*overloaded*/
291  user_log("\nInitialize overloaded ?");
293  case 4: /*complex*/
294  switch (basic_complex(b)) {
295  case 8:
296  return make_call_expression(make_constant_entity("CMPLX(r_signaling_nan(),r_signaling_nan())",
297  is_basic_complex,8),NIL);
298  case 16:
299  return make_call_expression(make_constant_entity("CMPLX(d_signaling_nan(),d_signaling_nan())",
300  is_basic_complex,16),NIL);
301  default:
302  user_log("\nInitialize complex number with more than 16 bytes ?");
303  return make_call_expression(MakeConstant("which_value",is_basic_complex),NIL);
304  }
305  case 5: /*string*/
306  return make_call_expression(MakeConstant("\'Nga Nguyen\'",is_basic_string),NIL);
307  default:
308  pips_internal_error("Unexpected basic tag");
309  return expression_undefined; // just to avoid gcc warning
310  }
311 }
312 
313 /* This function makes a test like X.EQ.100000 or id_nan(A(PHI1)) or ir_nan(A(I,B(J)) */
315 {
316  basic b = entity_basic(ent);
318  switch (basic_tag(b)) {
319  case 1: /*float*/
320  switch (basic_float(b)) {
321  case 4:
324  break;
325  case 8:
328  break;
329  default:
330  cond = eq_expression(exp,make_special_value(ent));
331  break;
332  }
333  break;
334  case 4:/*complex*/
335  switch (basic_complex(b)) {
336  case 8:
339  break;
340  case 16:
343  break;
344  default:
345  cond = eq_expression(exp,make_special_value(ent));
346  break;
347  }
348  break;
349  default:
350  cond = eq_expression(exp,make_special_value(ent));
351  break;
352  }
353  return cond;
354 }
355 
356 /* This function generates an assignment that initializes the scalar variable */
358 {
360  fprint_statement(out, s);
361 }
362 
363 /* This function generates code that initializes every array element in the array region
364  to a special value.
365  We use the algorithm_row_echelon(initial system, list of variables to scan,
366  return condition, returned enumeration system) to generate the nested loop.
367  The generated code will be like this:
368  IF (condition) THEN
369  DO PHI1 = low1,up1
370  DO PHI2 = low2,up2
371  A(PHI1,PHI2) = SNan
372  ENDDO
373  ENDDO
374  ENDIF
375  If bounds can not be computed from the region, we use bounds from the array declaration
376  DO PHI1 = dec_low1,dec_up1
377  DO PHI2 = dec_low2,dec_up2
378  A(PHI1,PHI2) = SNan
379  ENDDO
380  ENDDO
381  CURRENTLY: we cannot check if all lower/upper bounds can be generated for variables Phii
382  from region => use bounds from array declarations
383  ATTENTION: the initialization is expensive, it increases much execution time
384  (number of array variables * size of arrays :-)) */
385 
387 {
389  int n = gen_length(dims);
390  list l_phi = phi_entities_list(1,n);
391  /* Attention, this analysis uses PHI entities, static variables of region => init_regions*/
395  Psysteme row_echelon = entity_declaration_sc(ent);
396  /* The assumed-size case cannot happen, because formal variables are not initialized*/
397  smt = systeme_to_loop_nest(row_echelon,l_phi,smt,entity_intrinsic(DIVIDE_OPERATOR_NAME));
398  fprint_statement(out,smt);
399 }
400 
402 {
403  string message = strdup(concatenate("\'Scalar variable ",entity_name(ent)," is used before set\'",NULL));
405  test t = test_undefined;
407  basic b = entity_basic(ent);
408  if (get_bool_property("PROGRAM_VERIFICATION_WITH_PRINT_MESSAGE"))
409  {
411  /*To help debugging, reinitialize the integer and real variables by 0 in order to
412  avoid so much propagated NaN or 1000000 values. By doing this, we cannot
413  detect all uninitialized variables but it helps Corinne, with thousand lines of code */
414  if ((basic_tag(b)==0) || (basic_tag(b)==1))
415  {
417  /*insert the assignment after the PRINT statement*/
418  insert_statement(smt,s,false);
419  }
420  }
421  else
423  t = make_test(cond,smt,make_block_statement(NIL));
424  smt = test_to_statement(t);
425  print_statement(smt);
426  free(message), message = NULL;
427 }
428 
430 {
432  test t = test_undefined;
434  string stop_message = strdup(concatenate("\'Array ",entity_name(ent)," is used before set\'",NULL));
435  string print_message = strdup(concatenate("\'Array element ",entity_name(ent),"(\'",
436  print_list_of_expressions(args),",\') is used before set\'",NULL));
437  expression cond = make_test_condition(exp,ent);
438  basic b = entity_basic(ent);
439  ifdebug(3)
440  {
441  pips_debug(3,"Verify array element:");
443  }
444  if (get_bool_property("PROGRAM_VERIFICATION_WITH_PRINT_MESSAGE"))
445  {
446  smt = make_print_statement(print_message);
447  /*To help debugging, reinitialize the integer and real array elements by 0 in order to
448  avoid so much propagated NaN or 1000000 values. By doing this, we cannot
449  detect all uninitialized variables but it helps Corinne, with thousand lines of code */
450  if ((basic_tag(b)==0) || (basic_tag(b)==1))
451  {
453  /*insert the assignment after the PRINT statement*/
454  insert_statement(smt,s,false);
455  }
456  }
457  else
458  smt = make_stop_statement(stop_message);
459  t = make_test(cond,smt,make_block_statement(NIL));
460  smt = test_to_statement(t);
461  ifdebug(3)
462  {
463  fprintf(stderr,"\nGenerated statement:");
464  print_statement(smt);
465  }
466  print_statement(smt);
467  free(print_message), print_message = NULL;
468  free(stop_message), stop_message = NULL;
469 }
470 
471 /* This function generates code that verifies if all array elements in the array region
472  are initialized or not.
473  We use the algorithm_row_echelon(initial system, list of variables to scan,
474  return condition, returned enumeration system) to generate the nested loop.
475  The generated code will be like this:
476  IF (condition) THEN
477  DO PHI1 = low1,up1
478  DO PHI2 = low2,up2
479  IF (A(PHI1,PHI2).EQ.SNan) STOP "A is used before set"
480  ENDDO
481  ENDDO
482  ENDIF */
483 
484 static void verify_array_variable(entity ent, region reg)
485 {
488  test t = test_undefined;
490  int n = gen_length(dims);
491  list l_phi = phi_entities_list(1,n);
494  Pbase phi_variables = entity_list_to_base(l_phi);
495  Psysteme ps = region_system(reg);
496  Psysteme row_echelon = SC_UNDEFINED, condition = SC_UNDEFINED;
497  string stop_message = strdup(concatenate("\'Array ",entity_name(ent)," is used before set\'",NULL));
498  string print_message = strdup(concatenate("\'Array element ",entity_name(ent),"(\'",
499  print_list_of_entities(l_phi),",\') is used before set\'",NULL));
500  expression cond = make_test_condition(exp,ent);
501  basic b = entity_basic(ent);
502  ifdebug(3)
503  {
504  pips_debug(3,"Verify array region:");
505  print_region(reg);
506  }
507  if (get_bool_property("PROGRAM_VERIFICATION_WITH_PRINT_MESSAGE"))
508  {
509  smt = make_print_statement(print_message);
510  /*To help debugging, reinitialize the integer and real array elements by 0 in order to
511  avoid so much propagated NaN or 1000000 values. By doing this, we cannot
512  detect all uninitialized variables but it helps Corinne, with thousand lines of code */
513  if ((basic_tag(b)==0) || (basic_tag(b)==1))
514  {
516  /*insert the assignment after the PRINT statement*/
517  insert_statement(smt,s,false);
518  }
519  }
520  else
521  smt = make_stop_statement(stop_message);
522  t = make_test(cond,smt,make_block_statement(NIL));
523  smt = test_to_statement(t);
524  ps = remove_temporal_variables_from_system(ps); // remove I#init like variables
525 
526  /*to simplify the test condition, we have to remove preconditions from regions*/
527 
528  algorithm_row_echelon(ps,phi_variables, &condition, &row_echelon);
529  sc_find_equalities(&condition);
530  /* If no bound is found for a variable PHIi => it is not the case because the
531  region is MUST => TO PROVE*/
532  l = systeme_to_loop_nest(row_echelon,l_phi,smt,entity_intrinsic(DIVIDE_OPERATOR_NAME));
533  smt = generate_optional_if(condition,l);
534  ifdebug(3)
535  {
536  fprintf(stderr,"\nGenerated statement:");
537  print_statement(smt);
538  }
539  print_statement(smt);
540  free(print_message), print_message = NULL;
541  free(stop_message), stop_message = NULL;
542 }
543 
546 
548 {
549  entity fun = call_function(c);
550  list l_args = call_arguments(c);
551  if (entity_module_p(fun))
552  {
553  /* If c is a procedure call, we have to update UBS resource in order to check
554  for the corresponding variables in the frame of the called procedure.
555  There are two possibilities:
556  - if the current entity is passed as actual arguments
557  insert (called procedure,offset of actual argument)
558  - the current entity is a common variable and it has IN regions in the called
559  procedure => insert (called procedure,common variable)*/
560  int i = 0;
561  ifdebug(3)
562  fprintf(stderr,"\nCall to other module\n");
564  {
565  /* always add (called procedure,common variable) to ubs resource,
566  although current_entity may not in the IN regions of the called procedure */
569  }
570  ifdebug(3)
571  {
572  fprintf(stderr,"\nCall to %s with argument list:",entity_local_name(fun));
573  print_expressions(l_args);
574  }
576  {
578  i++;
579  MAP(REFERENCE,ref,
580  {
582  if (same_entity_p(var,current_entity))
583  {
585  ifdebug(4)
586  {
587  fprintf(stderr,"\nFound at %d-th argument:",i);
589  fprintf(stderr,"\nAdd ubs (%s,%d)\n",entity_local_name(fun),i);
590  }
592  break;
593  }
594  },l_refs);
595  },l_args);
596  }
597  else
598  {
599  /* The current statement is not a call to another routine, so an assignment,
600  or a READ, a WRITE, ...
601  We have go though the argument list and generate a verification for each
602  read (= IN region) of the current entity. This is really a redundant work
603  with region's computation :-(
604  So may be it is better to keep the list of regions, not a convex hull.
605 
606  Examples : A = C(J) + FOO(C(I)), X(A(I)) = A(J) + A(K)
607  READ *, A(B(I)), A(B(J))
608 
609  SO FOR THE MOMENT, I ONLY TREAT SOME FREQUENT CASES: assignment, WRITE*/
610  ifdebug(3)
611  fprintf(stderr,"\nMAY IN region of elementary statement\n");
613  {
615  },l_args);
616  }
617 }
618 
620 {
622  tag t = syntax_tag(syn);
623  ifdebug(4)
624  {
625  fprintf(stderr,"\nVerify expression\n");
627  }
628  switch (t){
629  case is_syntax_range:
630  break;
631  case is_syntax_reference:
632  {
635  if (same_entity_p(var,current_entity))
636  {
637  int order = statement_ordering(s);
638  ifdebug(3)
639  fprintf(stderr,"\nInsert a VERIFY function before a reference\n");
641  fprintf(out,"%s\t%s\t%s\t(%d,%d)\n",PREFIX1,file_name,module_local_name(current_mod),
642  ORDERING_NUMBER(order),ORDERING_STATEMENT(order));
643  if (entity_scalar_p(var)) /*exists ? MAY IN for a MUST IN?*/
645  else
647  fprintf(out,"%s\n",PREFIX2);
648  }
649  break;
650  }
651  case is_syntax_call:
652  {
653  call c = syntax_call(syn);
655  break;
656  }
657  default:
658  {
659  pips_internal_error("Unexpected expression tag %d ", t );
660  break;
661  }
662  }
663 }
664 
666 {
667  list l_in_regions = load_statement_in_regions(s);
668  ifdebug(3)
669  {
670  pips_debug(3,"Verify the current statement:");
671  print_statement(s);
672  fprintf(stderr,"with list of IN regions:");
673  print_inout_regions(l_in_regions);
674  }
675  MAP(REGION,reg,
676  {
677  /* there are IN regions like IN-EXACT-{0==-1} !!!*/
678  if (!region_empty_p(reg))
679  {
680  entity ent = region_entity(reg);
681  if (same_entity_p(ent,current_entity))
682  {
684  ifdebug(3)
685  fprintf(stderr,"\nFound variable %s in the IN region list\n",entity_name(ent));
686  if (approximation_exact_p(app) &&
690  {
691  /* MUST IN region and variable belonging to current module scope
692  (local, formal and visible global variable)*/
693  int order = statement_ordering(s);
694  ifdebug(3)
695  fprintf(stderr,"\nMUST IN region, variable in module scope\n");
697  fprintf(out,"%s\t%s\t%s\t(%d,%d)\n",PREFIX1,file_name,module_local_name(current_mod),
698  ORDERING_NUMBER(order),ORDERING_STATEMENT(order));
699  if (entity_scalar_p(ent))
701  else
702  verify_array_variable(ent,reg);
703  fprintf(out,"%s\n",PREFIX2);
704  return false;
705  }
706  else
707  {
708  /* MAY IN region or common variable not in current module scope
709  If the current statement is elementary, we have to treat it,
710  else, we continue to go down with gen_recurse */
712  tag t = instruction_tag(i);
713  ifdebug(3)
714  fprintf(stderr,"\nMAY IN region or common variable not in current module scope\n");
715  switch(t)
716  {
717  case is_instruction_call:
718  {
719  call c = statement_call(s);
721  return false;
722  }
724  {
728  break;
729  }
730  case is_instruction_test:
731  {
732  test it = instruction_test(i);
733  expression e = test_condition(it);
735  break;
736  }
738  case is_instruction_loop:
739  // suppose that there are only MUST IN region in loop's range
741  return true;
742  }
743  }
744  }
745  }
746  },l_in_regions);
747  return false;
748 }
749 
751 {
755  gen_null);
756 }
757 
759 {
760  bool check = false;
762  {
763  list l_caller_ubs = ubs_list((ubs)db_get_memory_resource(DBR_UBS,caller_name,true));
764  MAP(UBS_CHECK,fp,
765  {
766  entity mod = ubs_check_module(fp);
767  if (same_entity_p(mod,current_mod))
768  {
769  entity e = ubs_check_variable(fp);
770  int off;
771  if (integer_constant_p(e,&off))
772  {
773  if (formal_parameter_p(ent))
774  {
776  if (off == offset)
777  {
778  pips_debug(1,"Formal parameter %s must be verified\n",entity_name(ent));
779  check = true;
780  break;
781  }
782  }
783  }
784  else
785  {
786  if (entities_may_conflict_p(e,ent))
787  {
788  pips_debug(1,"Common variable %s must be verified\n",entity_name(ent));
789  check = true;
790  break;
791  }
792  }
793  }
794  },l_caller_ubs);
795  if (check) break;
796  },l_callers);
797  if (check)
798  {
799  current_entity = ent;
802  }
803 }
804 
805 /* This function prints a common variable with its numerical size, because
806  we do not want to generate the PARAMETER declarations
807  PARAMETER (NX=50)
808  COMMON W(5*NX)
809  => COMMON W(250)*/
810 
812 {
813  list pc = NIL;
814  expression low_exp = dimension_lower(obj);
815  expression up_exp = dimension_upper(obj);
816  normalized n_low = NORMALIZE_EXPRESSION(low_exp);
817  normalized n_up = NORMALIZE_EXPRESSION(up_exp);
818  int low,up;
819  if (EvalNormalized(n_low,&low))
820  {
821  if (low!=1)
822  {
823  pc = CHAIN_SWORD(pc,int2a(low));
824  pc = CHAIN_SWORD(pc,":");
825  }
826  }
827  else
828  {
829  pc = Words_Expression(low_exp);
830  pc = CHAIN_SWORD(pc,":");
831  }
832  if (EvalNormalized(n_up,&up))
833  pc = CHAIN_SWORD(pc,int2a(up));
834  else
835  pc = gen_nconc(pc, Words_Expression(up_exp));
836  return(pc);
837 }
838 
840 {
841  list pl = NIL;
844  {
846  {
848  pl = CHAIN_SWORD(pl, "(");
849  MAPL(pd,
850  {
852  if (CDR(pd) != NIL) pl = CHAIN_SWORD(pl, ",");
853  }, dims);
854  pl = CHAIN_SWORD(pl, ")");
855  }
856  }
857  return(pl);
858 }
859 
861 {
862  const char* mod_name = entity_module_name(ent);
863  entity mod = local_name_to_top_level_entity(mod_name);
864  list entities = common_members_of_module(sec,mod,true);
865  ifdebug(3)
866  {
867  fprintf(stderr,"\nList of entities in the common declaration");
869  }
870  if (!ENDP(entities))
871  {
872  const char* area_name = module_local_name(sec);
873  bool comma = false;
874  fprintf(out2," COMMON ");
875  if (strcmp(area_name, BLANK_COMMON_LOCAL_NAME) != 0)
876  fprintf(out2,"/%s/ ", area_name);
877  MAP(ENTITY, ee,
878  {
879  if (comma) fprintf(out2,",");
880  else comma = true;
882  }, entities);
883  fprintf(out2,"\n");
884  }
886 }
887 
889 {
890  if (entity_scalar_p(ent))
891  {
894  }
895  else
896  {
899  }
900 }
901 
903 {
904  /* Check if ent has already been initialized by a BLOCK DATA subprogram.
905  Check if ent can also be initialized by an EQUIVALENCE variable */
906  storage s = entity_storage(ent);
907  ram r = storage_ram(s);
908  entity sec = ram_section(r);
909  list l_layout = area_layout(type_area(entity_type(sec)));
911  /* ram_shared does not work so we use common layout*/
912  MAP(ENTITY,other,
913  {
914  if (entities_may_conflict_p(ent,other))
915  {
916  const char* mod_name = entity_module_name(other);
917  entity mod = local_name_to_top_level_entity(mod_name);
918  if (entity_blockdata_p(mod))
919  {
920  if (entity_scalar_p(ent))
921  user_log("\nCommon scalar variable %s is initialized by BLOCKDATA\n",entity_name(ent));
922  else
923  user_log("\nCommon array variable %s is fully initialized by BLOCKDATA???\n",
924  entity_name(ent));
925  return;
926  }
927  }
928  },l_layout);
929  if (approximation_exact_p(app))
930  {
931  pips_debug(2,"MUST IN at module statement\n");
932  user_log("\nCommon variable %s is used before set\n",entity_name(ent));
933  if (entity_scalar_p(ent))
935  else
937  fprintf(out,"%s\t%s\t%s\t(0,1)\n",PREFIX1,file_name,module_local_name(current_mod));
938  fprintf(out," STOP 'Variable %s is used before set'\n",entity_name(ent));
939  fprintf(out,"%s\n",PREFIX2);
940  }
941  else
942  {
943  pips_debug(2,"MAY IN at module statement\n");
944  user_log("\nCommon variable %s maybe used before set\n",entity_name(ent));
946  {
947  fprintf(out,"%s\t%s\t%s\t(0,1)\n",PREFIX1,file_name,module_local_name(current_mod));
948  insert_initialization(ent);
949  fprintf(out,"%s\n",PREFIX2);
950  }
951  else
952  {
953  /* ent is not in the main module scope.
954  Since there may be variables in different common blocks with the same name => it is safe
955  to add CALL INITIALIZATION_COMMONNAME for each common block, then add in subroutine
956  INITIALIZATION_COMMONNAME the common, type, parameter declaration + common variable
957  initializations */
959  const char* area_name = module_local_name(sec);
960  ifdebug(1)
961  fprintf(stderr,"\nCommon variable %s not in main module scope\n",entity_name(ent));
963  {
964  fprintf(out,"%s\t%s\t%s\t(0,1)\n",PREFIX1,file_name,module_local_name(current_mod));
965  if (strcmp(area_name, BLANK_COMMON_LOCAL_NAME) == 0)
966  {
967  fprintf(out," CALL INITIALIZE_BLANK\n");
968  fprintf(out2," SUBROUTINE INITIALIZE_BLANK\n");
969  }
970  else
971  {
972  fprintf(out," CALL INITIALIZE_%s\n",area_name);
973  fprintf(out2," SUBROUTINE INITIALIZE_%s\n",area_name);
974  }
975  fprintf(out,"%s\n",PREFIX2);
976  insert_common_declaration(ent,sec);
977  fprintf(out2,"C (0,1)\n");
978  fprintf(out2," END\n");
980  }
981  if (strcmp(area_name, BLANK_COMMON_LOCAL_NAME) == 0)
982  fprintf(out,"%s\t%s\tINITIALIZE_BLANK\t(0,1)\n",PREFIX1,initialization_file);
983  else
984  fprintf(out,"%s\t%s\tINITIALIZE_%s\t(0,1)\n",PREFIX1,initialization_file,area_name);
986  fprintf(out,"%s\n",PREFIX2);
987  }
988  /* TO BE IMPROVED, do not verify unvisible common variable*/
989  current_entity = ent;
992  }
993 }
994 
996 {
997  /* Check if ent has already been initialized by a DATA statement. There are 3 cases:
998  1. ent is not initialized by any DATA statement
999  2. ent is fully initialized by DATA statements
1000  3. ent is partially initialized, insert a sequence of assignments corresponding to
1001  the DATAs
1002  Check if ent can also be initialized by an EQUIVALENCE variable */
1003  if (variable_static_p(ent))
1004  {
1005  /* Local variable ent is in a DATA or SAVE statement (distinguish DATA vs SAVE ???) */
1006  if (entity_scalar_p(ent))
1007  user_log("\nLocal scalar variable %s is initialized by DATA\n",entity_name(ent));
1008  else
1009  user_log("\nLocal array variable %s is fully initialized by DATA???\n",entity_name(ent));
1010  }
1011  else
1012  {
1014  /* test to rewrite */
1015  user_log("\nLocal variable %s is initialized through EQUIVALENCE\n",entity_name(ent));
1016  else
1017  {
1019  if (approximation_exact_p(app))
1020  {
1021  pips_debug(2,"MUST IN at module statement\n");
1022  user_log("\nLocal variable %s is used before set\n",entity_name(ent));
1023  if (entity_scalar_p(ent))
1025  else
1027  fprintf(out,"%s\t%s\t%s\t(0,1)\n",PREFIX1,file_name,module_local_name(current_mod));
1028  fprintf(out," STOP 'Variable %s is used before set'\n",entity_name(ent));
1029  fprintf(out,"%s\n",PREFIX2);
1030  }
1031  else
1032  {
1033  pips_debug(2,"MAY IN at module statement\n");
1034  user_log("\nLocal variable %s maybe used before set\n",entity_name(ent));
1035  fprintf(out,"%s\t%s\t%s\t(0,1)\n",PREFIX1,file_name,module_local_name(current_mod));
1036  insert_initialization(ent);
1037  fprintf(out,"%s\n",PREFIX2);
1038  current_entity = ent;
1041  }
1042  }
1043  }
1044 }
1045 
1046 bool used_before_set(const char* module_name)
1047 {
1048  list l_in_regions = NIL;
1049  ubs module_ubs;
1050  string user_file = db_get_memory_resource(DBR_USER_FILE,module_name,true);
1051  string base_name = pips_basename(user_file, NULL);
1052  /* File instrument.out is used to store ubs checks*/
1053  string dir_name = db_get_current_workspace_directory();
1054  string instrument_file = strdup(concatenate(dir_name, "/instrument.out", NULL));
1055  out = safe_fopen(instrument_file, "a");
1057  "/",base_name,NULL));
1059  if (!same_string_p(rule_phase(find_rule_by_resource("REGIONS")),"MUST_REGIONS"))
1060  pips_user_warning("\nMUST REGIONS not selected - " "Do not expect wonderful results\n");
1061  /* Set and get the current properties concerning regions */
1062  set_bool_property("MUST_REGIONS", true);
1063  set_bool_property("EXACT_REGIONS", true);
1067  /* Get the code of the module */
1070  /* Get IN regions of the module */
1072  regions_init();
1074  debug_on("USED_BEFORE_SET_DEBUG_LEVEL");
1076  ifdebug(2)
1077  {
1078  pips_debug(2,"List of IN regions of module %s:",module_name);
1079  print_inout_regions(l_in_regions);
1080  }
1081  fprintf(out,"%s\t%s\t%s\t(0,1)\n",PREFIX1,file_name,module_name);
1082  fprintf(out," EXTERNAL ir_isnan,id_isnan\n");
1083  fprintf(out," LOGICAL*4 ir_isnan,id_isnan\n");
1084  fprintf(out,"%s\n",PREFIX2);
1086  {
1087  /* File xxx.database/Src/initialization.f contains all the initializations of
1088  global variables */
1089  initialization_file = strdup(concatenate(dir_name, "/Src/initialization.f", NULL));
1091  MAP(REGION,reg,
1092  {
1093  entity ent = region_entity(reg);
1094  if (strcmp(entity_module_name(ent),IO_EFFECTS_PACKAGE_NAME)!=0)
1095  {
1096  if (variable_in_common_p(ent))
1097  /* Common variable in main program */
1099  else
1100  {
1101  /* Local variable in main program, but attention,
1102  IN regions contain also static variables of other modules !!!*/
1105  }
1106  }
1107  },l_in_regions);
1110  }
1111  else
1112  {
1113  callees callers = (callees) db_get_memory_resource(DBR_CALLERS,module_name,true);
1114  list l_callers = callees_callees(callers);
1115  MAP(REGION,reg,
1116  {
1117  entity ent = region_entity(reg);
1118  if (strcmp(entity_module_name(ent),IO_EFFECTS_PACKAGE_NAME)!=0)
1119  {
1121  /* Formal or common variable */
1122  verify_formal_and_common_variables(ent,l_callers);
1123  else
1124  {
1125  /* Local variable */
1128  }
1129  }
1130  },l_in_regions);
1131  }
1132  module_ubs = make_ubs(l_ubs_checks);
1133  // message_assert("module ubs is consistent",ubs_consistent_p(module_ubs));
1134  /* save to resource */
1135  DB_PUT_MEMORY_RESOURCE(DBR_UBS,module_name,copy_ubs(module_ubs));
1137  debug_off();
1138  safe_fclose(out,instrument_file);
1139  free(instrument_file), instrument_file = NULL;
1140  free(dir_name), dir_name = NULL;
1143  regions_end();
1144  reset_in_effects();
1147  return true;
1148 }
1149 
1150 
1151 
1152 
1153 
1154 
void user_log(const char *format,...)
Definition: message.c:234
reference make_reference(entity a1, list a2)
Definition: ri.c:2083
test make_test(expression a1, statement a2, statement a3)
Definition: ri.c:2607
ubs copy_ubs(ubs p)
UBS.
Definition: ubs_private.c:58
ubs_check make_ubs_check(entity a1, entity a2)
Definition: ubs_private.c:52
ubs make_ubs(list a)
Definition: ubs_private.c:94
struct _newgen_struct_entity_ * entity
Definition: abc_private.h:14
static reference ref
Current stmt (an integer)
Definition: adg_read_paf.c:163
static const char * caller_name
Definition: alias_check.c:122
#define VALUE_ONE
struct _newgen_struct_statement_ * statement
Definition: cloning.h:21
entity make_constant_entity(string name, tag bt, size_t size)
For historical reason, call the Fortran version.
Definition: constant.c:301
bool integer_constant_p(entity ent, int *int_p)
Returns the double value associated to a PIPS constant.
Definition: constant.c:542
entity MakeConstant(string name, tag bt)
Make a Fortran constant.
Definition: constant.c:351
statement systeme_to_loop_nest(Psysteme, list, statement, entity)
sc is used to generate the loop nest bounds for variables vars.
statement generate_optional_if(Psysteme, statement)
statement generate_optional_if(sc, stat)
#define region_entity(reg)
#define region_system(reg)
#define region_empty_p(reg)
#define REGION
#define region
simulation of the type region
#define region_approximation(reg)
static Value offset
Definition: translation.c:283
void regions_end(void)
void regions_init(void)
list phi_entities_list(int, int)
void get_regions_properties(void)
Psysteme entity_declaration_sc(entity)
void print_inout_regions(list)
void set_in_effects(statement_effects)
void reset_in_effects(void)
list load_statement_in_regions(statement)
#define approximation_exact_p(x)
Definition: effects.h:369
const char * module_name(const char *s)
Return the module part of an entity name.
Definition: entity_names.c:296
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
char * pips_basename(char *fullpath, char *suffix)
Definition: file.c:822
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
#define STRING(x)
Definition: genC.h:87
#define gen_recurse(start, domain_number, flt, rwt)
Definition: genC.h:283
static FILE * user_file
These functions implements the writing of objects.
Definition: genClib.c:1485
void free(void *)
bool entities_may_conflict_p(entity e1, entity e2)
Check if two entities may conflict.
Definition: conflicts.c:984
statement make_block_statement(list)
Make a block statement from a list of statement.
Definition: statement.c:616
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
void gen_null(__attribute__((unused)) void *unused)
Ignore the argument.
Definition: genClib.c:2752
#define ENDP(l)
Test if a list is empty.
Definition: newgen_list.h:66
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
size_t gen_length(const list l)
Definition: list.c:150
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
Definition: newgen_list.h:150
list gen_nconc(list cp1, list cp2)
physically concatenates CP1 and CP2 but do not duplicates the elements
Definition: list.c:344
#define CAR(pcons)
Get the value of the first element of a list.
Definition: newgen_list.h:92
void gen_free_list(list l)
free the spine of the list
Definition: list.c:327
#define CDR(pcons)
Get the list less its first element.
Definition: newgen_list.h:111
#define MAPL(_map_list_cp, _code, _l)
Apply some code on the addresses of all the elements of a list.
Definition: newgen_list.h:203
#define MAP(_map_CASTER, _map_item, _map_code, _map_list)
Apply/map an instruction block on all the elements of a list (old fashioned)
Definition: newgen_list.h:226
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 DB_PUT_MEMORY_RESOURCE(res_name, own_name, res_val)
conform to old interface.
Definition: pipsdbm-local.h:66
call statement_call(statement)
Get the call of a statement.
Definition: statement.c:1406
statement make_assign_statement(expression, expression)
Definition: statement.c:583
statement make_print_statement(string)
Make a Fortran print statement.
Definition: statement.c:835
statement make_stop_statement(string)
This function returns a Fortran stop statement with an error message.
Definition: statement.c:908
void insert_statement(statement, statement, bool)
This is the normal entry point.
Definition: statement.c:2570
struct _newgen_struct_entities_ * entities
Definition: hpf_private.h:89
string db_get_directory_name_for_module(const char *name)
returns the allocated and mkdir'ed directory for module name
Definition: lowlevel.c:150
#define rule_phase(x)
Definition: makefile.h:244
#define debug_on(env)
Definition: misc-local.h:157
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
#define pips_user_warning
Definition: misc-local.h:146
#define pips_internal_error
Definition: misc-local.h:149
#define debug_off()
Definition: misc-local.h:160
#define BLANK_COMMON_LOCAL_NAME
Definition: naming-local.h:68
string concatenate(const char *,...)
Return the concatenation of the given strings.
Definition: string.c:183
#define same_string_p(s1, s2)
int tag
TAG.
Definition: newgen_types.h:92
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
bool EvalNormalized(normalized n, int *pv)
Definition: normalize.c:404
#define WORKSPACE_SRC_SPACE
Definition: pipsdbm-local.h:32
string db_get_current_workspace_directory(void)
Definition: workspace.c:96
rule find_rule_by_resource(const char *rname)
This function returns the active rule to produce resource rname.
Definition: pipsmake.c:694
void print_expressions(list le)
Definition: expression.c:98
void print_expression(expression e)
no file descriptor is passed to make is easier to use in a debugging stage.
Definition: expression.c:58
string expression_to_string(expression e)
Definition: expression.c:77
list Words_Expression(expression obj)
of string
Definition: misc.c:2616
#define print_region(x)
Definition: print.c:343
void fprint_statement(FILE *, statement)
Print statement "s" on file descriptor "fd".
Definition: statement.c:68
void print_statement(statement)
Print a statement on stderr.
Definition: statement.c:98
static hash_table pl
properties are stored in this hash table (string -> property) for fast accesses.
Definition: properties.c:783
void set_bool_property(const char *, bool)
#define IO_EFFECTS_PACKAGE_NAME
Implicit variables to handle IO effetcs.
#define ORDERING_NUMBER(o)
#define ORDERING_STATEMENT(o)
#define NORMALIZE_EXPRESSION(e)
#define test_to_statement(t)
#define eq_expression(e1, e2)
#define DIVIDE_OPERATOR_NAME
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
bool entity_in_list_p(entity ent, list ent_l)
look for ent in ent_l
Definition: entity.c:2221
bool same_entity_p(entity e1, entity e2)
predicates on entities
Definition: entity.c:1321
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
bool entity_main_module_p(entity e)
Definition: entity.c:700
basic entity_basic(entity e)
return the basic associated to entity e if it's a function/variable/constant basic_undefined otherwis...
Definition: entity.c:1380
const char * module_local_name(entity e)
Returns the module local user name.
Definition: entity.c:582
void print_entities(list l)
Definition: entity.c:167
bool entity_blockdata_p(entity e)
Definition: entity.c:712
bool entity_module_p(entity e)
Definition: entity.c:683
const char * entity_module_name(entity e)
See comments about module_name().
Definition: entity.c:1092
Pbase entity_list_to_base(list l)
Definition: entity.c:2860
entity entity_intrinsic(const char *name)
FI: I do not understand this function name (see next one!).
Definition: entity.c:1292
list common_members_of_module(entity common, entity module, bool only_primary)
returns the list of entity to appear in the common declaration.
Definition: entity.c:1741
expression reference_to_expression(reference r)
Definition: expression.c:196
expression make_call_expression(entity e, list l)
Build an expression that call an function entity with an argument list.
Definition: expression.c:321
expression entity_to_expression(entity e)
if v is a constant, returns a constant call.
Definition: expression.c:165
expression int_to_expression(_int i)
transform an int into an expression and generate the corresponding entity if necessary; it is not cle...
Definition: expression.c:1188
reference expression_reference(expression e)
Short cut, meaningful only if expression_reference_p(e) holds.
Definition: expression.c:1832
list expression_to_reference_list(expression e, list lr)
conversion of an expression into a list of references; references are appended to list lr as they are...
Definition: expression.c:1263
bool entity_scalar_p(entity)
The concrete type of e is a scalar type.
Definition: variable.c:1113
bool variable_in_common_p(entity)
true if v is in a common.
Definition: variable.c:1570
bool formal_parameter_p(entity)
Definition: variable.c:1489
bool variable_static_p(entity)
true if v appears in a SAVE statement, or in a DATA statement, or is declared static i C.
Definition: variable.c:1579
entity make_integer_constant_entity(_int)
entity make_integer_constant_entity(int c) make entity for integer constant c
Definition: variable.c:1345
#define formal_offset(x)
Definition: ri.h:1408
@ is_basic_string
Definition: ri.h:576
@ is_basic_float
Definition: ri.h:572
@ is_basic_overloaded
Definition: ri.h:574
@ is_basic_complex
Definition: ri.h:575
struct _newgen_struct_callees_ * callees
Definition: ri.h:55
#define REFERENCE(x)
REFERENCE.
Definition: ri.h:2296
#define syntax_reference(x)
Definition: ri.h:2730
#define syntax_tag(x)
Definition: ri.h:2727
#define call_function(x)
Definition: ri.h:709
#define callees_callees(x)
Definition: ri.h:675
#define reference_variable(x)
Definition: ri.h:2326
#define ENTITY(x)
ENTITY.
Definition: ri.h:2755
#define test_undefined
Definition: ri.h:2808
#define statement_ordering(x)
Definition: ri.h:2454
#define dimension_lower(x)
Definition: ri.h:980
#define basic_tag(x)
Definition: ri.h:613
#define type_variable(x)
Definition: ri.h:2949
#define entity_storage(x)
Definition: ri.h:2794
#define statement_domain
newgen_sizeofexpression_domain_defined
Definition: ri.h:362
#define code_declarations(x)
Definition: ri.h:784
@ is_syntax_range
Definition: ri.h:2692
@ is_syntax_call
Definition: ri.h:2693
@ is_syntax_reference
Definition: ri.h:2691
#define ram_section(x)
Definition: ri.h:2249
#define storage_formal(x)
Definition: ri.h:2524
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217
#define entity_undefined
Definition: ri.h:2761
#define expression_undefined
Definition: ri.h:1223
@ is_instruction_unstructured
Definition: ri.h:1475
@ is_instruction_whileloop
Definition: ri.h:1472
@ is_instruction_test
Definition: ri.h:1470
@ is_instruction_call
Definition: ri.h:1474
@ is_instruction_sequence
Definition: ri.h:1469
@ is_instruction_loop
Definition: ri.h:1471
#define instruction_tag(x)
Definition: ri.h:1511
#define entity_name(x)
Definition: ri.h:2790
#define area_layout(x)
Definition: ri.h:546
#define dimension_upper(x)
Definition: ri.h:982
#define reference_indices(x)
Definition: ri.h:2328
#define value_code(x)
Definition: ri.h:3067
#define syntax_call(x)
Definition: ri.h:2736
#define type_area(x)
Definition: ri.h:2946
#define basic_float(x)
Definition: ri.h:619
#define test_condition(x)
Definition: ri.h:2833
#define instruction_whileloop(x)
Definition: ri.h:1523
#define variable_dimensions(x)
Definition: ri.h:3122
#define statement_instruction(x)
Definition: ri.h:2458
#define storage_ram(x)
Definition: ri.h:2521
#define basic_complex(x)
Definition: ri.h:628
#define call_arguments(x)
Definition: ri.h:711
#define instruction_test(x)
Definition: ri.h:1517
#define whileloop_condition(x)
Definition: ri.h:3160
#define entity_type(x)
Definition: ri.h:2792
#define ram_shared(x)
Definition: ri.h:2253
#define expression_syntax(x)
Definition: ri.h:1247
#define type_variable_p(x)
Definition: ri.h:2947
#define statement_undefined
Definition: ri.h:2419
#define entity_initial(x)
Definition: ri.h:2796
bool sc_rn_p(Psysteme sc)
bool sc_rn_p(Psysteme sc): check if the set associated to sc is the whole space, rn
Definition: sc_alloc.c:369
bool sc_empty_p(Psysteme sc)
bool sc_empty_p(Psysteme sc): check if the set associated to sc is the constant sc_empty or not.
Definition: sc_alloc.c:350
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
char * strdup()
void algorithm_row_echelon(Psysteme scn, Pbase base_index, Psysteme *pcondition, Psysteme *penumeration)
see comments above.
void sc_find_equalities(Psysteme *ps)
#define ifdebug(n)
Definition: sg.c:47
Pbase base
Definition: sc-local.h:75
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89
struct Svecteur * succ
Definition: vecteur-local.h:92
The structure used to build lists in NewGen.
Definition: newgen_list.h:41
#define CHAIN_SWORD(l, s)
string words_to_string(cons *lw)
Definition: print.c:211
char * int2a(int)
util.c
Definition: util.c:42
bool old_value_entity_p(entity)
Definition: value.c:936
#define ubs_list(x)
Definition: ubs_private.h:99
#define UBS_CHECK(x)
newgen_ubs_domain_defined
Definition: ubs_private.h:35
#define ubs_check_module(x)
Definition: ubs_private.h:65
#define ubs_check_variable(x)
Definition: ubs_private.h:67
static bool initialized_by_equivalent_variable_p(entity ent)
static expression make_test_condition(expression exp, entity ent)
This function makes a test like X.EQ.100000 or id_nan(A(PHI1)) or ir_nan(A(I,B(J))
static list words_numerical_dimension(dimension obj)
This function prints a common variable with its numerical size, because we do not want to generate th...
static FILE * out
static void verify_array_variable(entity ent, region reg)
This function generates code that verifies if all array elements in the array region are initialized ...
static string initialization_file
static int number_of_uninitialized_scalar_variables
static int number_of_added_verifications
static void insert_initialization(entity ent)
static FILE * out2
static Psysteme remove_temporal_variables_from_system(Psysteme ps)
static void verify_array_element(entity ent, expression exp)
static int number_of_may_uninitialized_scalar_variables
static list l_ubs_checks
#define PREFIX1
This analysis checks if the program uses a variable or an array element which has not been assigned a...
static void verify_used_before_set_call(call c, statement s)
static string print_list_of_expressions(list l)
static string file_name
static list entities_to_expressions2(list l_ent)
static void verify_scalar_variable(entity ent)
static entity current_entity
static void display_used_before_set_statistics()
static list l_initialized_commons
static string print_list_of_entities(list l)
static void initialize_scalar_variable(entity ent)
This function generates an assignment that initializes the scalar variable.
static void verify_formal_and_common_variables(entity ent, list l_callers)
static int number_of_processed_modules
static void insert_common_declaration(entity ent, entity sec)
static statement module_statement
static int number_of_uninitialized_array_variables
#define PREFIX2
static bool common_variable_in_module_scope_p(entity ent, entity mod)
static void verify_used_before_set_statement()
static void initialize_array_variable(entity ent)
This function generates code that initializes every array element in the array region to a special va...
static void verify_used_before_set_expression(expression exp, statement s)
static expression make_special_value(entity ent)
static int number_of_may_uninitialized_array_variables
static entity current_mod
static void initialize_and_verify_local_variable(entity ent, region reg)
static list words_common_variable(entity e)
static void initialize_and_verify_common_variable(entity ent, region reg)
static bool verify_used_before_set_statement_flt(statement s)
bool used_before_set(const char *module_name)
used_before_set.c
#define exp
Avoid some warnings from "gcc -Wshadow".
Definition: vasnprintf.c:207
#define vecteur_var(v)
#define VECTEUR_NUL_P(v)
void * Variable
arithmetique is a requirement for vecteur, but I do not want to inforce it in all pips files....
Definition: vecteur-local.h:60
void vect_add_elem(Pvecteur *pvect, Variable var, Value val)
void vect_add_elem(Pvecteur * pvect, Variable var, Value val): addition d'un vecteur colineaire au ve...
Definition: unaires.c:72