00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048 static char USMID[] = "\n@(#)5.0_pl/sources/s_dcls.c 5.7 09/29/99 17:38:13\n";
00049
00050 # include "defines.h"
00051
00052 # include "host.m"
00053 # include "host.h"
00054 # include "target.m"
00055 # include "target.h"
00056
00057 # include "globals.m"
00058 # include "tokens.m"
00059 # include "sytb.m"
00060 # include "s_globals.m"
00061 # include "debug.m"
00062
00063 # include "globals.h"
00064 # include "tokens.h"
00065 # include "sytb.h"
00066 # include "s_globals.h"
00067
00068
00069
00070
00071
00072
00073 int allocatable_list_idx;
00074 int alt_entry_equiv_blk;
00075 int alt_entry_equiv_grp;
00076 int init_sh_start_idx;
00077 int init_sh_end_idx;
00078 int namelist_list_idx;
00079 int number_of_allocatables;
00080 int pointee_based_blk;
00081 int reshape_array_list;
00082
00083
00084
00085
00086
00087
00088 static void assign_offsets_for_equiv_groups(void);
00089 static void attr_semantics(int, boolean);
00090 static void bound_resolution(int);
00091 static boolean compare_darg_or_rslt_types(int, int);
00092 static void compare_duplicate_interface_bodies(int);
00093 static void compare_entry_to_func_rslt(int, int);
00094 static boolean darg_in_entry_list(int, int);
00095 static void deallocate_local_allocatables(void);
00096 static void distribution_resolution(int);
00097 static void equivalence_semantics(void);
00098 static void gen_assumed_shape_copy(opnd_type *);
00099 static int gen_auto_length(int, opnd_type *);
00100 static void gen_branch_around_ir(int, int, int);
00101 static int gen_darg_branch_test(int);
00102 static boolean gen_ir_at_this_entry(int, int);
00103 #ifndef KEY
00104 static void gen_present_ir(int, int, int);
00105 #endif
00106 static void gen_single_automatic_allocate(int);
00107 static void gen_tmp_eq_zero_ir(int);
00108 static void insert_argchck_calls(int, int);
00109 static void insert_sh_after_entries(int, int, int, boolean, boolean);
00110 static void linearize_list_for_equiv(int);
00111 static int merge_entry_lists(int, int);
00112 static int merge_entry_list_count(int, int);
00113 static void merge_equivalence_groups1(void);
00114 static void merge_equivalence_groups2(void);
00115 static boolean must_reassign_XT_temp(opnd_type *);
00116 static void namelist_resolution(int);
00117 static int ntr_bnds_sh_tmp_list(opnd_type *, int, int, boolean, int);
00118 static void reshape_array_semantics(void);
00119 static void tmp_il_resolution(int);
00120 static void tmp_ir_resolution(int);
00121 static void verify_interface (int);
00122 static void gen_allocatable_ptr_ptee(int);
00123 static int set_up_bd_tmps(int, int, int, int, boolean);
00124
00125 # if defined(_TARGET_WORD_ADDRESS) || \
00126 (defined(_HEAP_REQUEST_IN_WORDS) && defined(_TARGET_BYTE_ADDRESS))
00127 static void gen_word_align_byte_length_ir(opnd_type *);
00128 # endif
00129
00130 # if !defined(_SINGLE_ALLOCS_FOR_AUTOMATIC)
00131 static void gen_multiple_automatic_allocate(int);
00132 # endif
00133
00134 # if (defined(_TARGET_OS_IRIX) || defined(_TARGET_OS_LINUX) || defined(_TARGET_OS_DARWIN))
00135 # pragma inline create_equiv_stor_blk
00136 # else
00137 # pragma _CRI inline create_equiv_stor_blk
00138 # endif
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156 static void equivalence_semantics(void)
00157 {
00158
00159 int attr_idx;
00160 boolean automatic;
00161 int common_attr_idx;
00162 int common_sb_idx;
00163 boolean default_numeric_sequence;
00164 boolean default_numeric_type;
00165 boolean default_character_sequence;
00166 boolean default_character_type;
00167 int group;
00168 int il_idx;
00169 int ir_idx;
00170 boolean is_volatile;
00171 int item;
00172 int list_idx;
00173 int new_idx;
00174 int nondefault_sequence_type;
00175 int nondefault_intrinsic_type;
00176 int offset_idx;
00177 boolean ok;
00178 opnd_type opnd;
00179 expr_arg_type opnd_desc;
00180 long_type result[MAX_WORDS_FOR_INTEGER];
00181 cif_usage_code_type save_xref_state;
00182 int sb_idx;
00183 int subscript_count;
00184 int substring_list;
00185 int type_idx;
00186
00187
00188 TRACE (Func_Entry, "equivalence_semantics", NULL);
00189
00190 group = SCP_FIRST_EQUIV_GRP(curr_scp_idx);
00191
00192 while (group != NULL_IDX) {
00193 item = group;
00194 common_attr_idx = NULL_IDX;
00195 common_sb_idx = NULL_IDX;
00196
00197 while (item != NULL_IDX) {
00198
00199 if (ATD_IN_COMMON(EQ_ATTR_IDX(item))) {
00200
00201 if (common_sb_idx == NULL_IDX) {
00202 common_attr_idx = EQ_ATTR_IDX(item);
00203 common_sb_idx = ATD_STOR_BLK_IDX(common_attr_idx);
00204 }
00205 else if (common_sb_idx != ATD_STOR_BLK_IDX(common_attr_idx)) {
00206
00207
00208
00209
00210 PRINTMSG(EQ_LINE_NUM(item), 826, Error, EQ_COLUMN_NUM(item),
00211 AT_OBJ_NAME_PTR(EQ_ATTR_IDX(item)),
00212 AT_OBJ_NAME_PTR(common_attr_idx));
00213 }
00214
00215 if (SB_BLK_HAS_NPES(common_sb_idx)) {
00216 PRINTMSG(EQ_LINE_NUM(item), 1228, Error, EQ_COLUMN_NUM(item),
00217 AT_OBJ_NAME_PTR(EQ_ATTR_IDX(item)),
00218 SB_BLANK_COMMON(common_sb_idx) ?
00219 "" : SB_NAME_PTR(common_sb_idx));
00220 AT_DCL_ERR(EQ_ATTR_IDX(item)) = TRUE;
00221 }
00222
00223 # if 0
00224 if (SB_ALIGN_SYMBOL(common_sb_idx) ||
00225 SB_FILL_SYMBOL(common_sb_idx)) {
00226 AT_DCL_ERR(EQ_ATTR_IDX(item)) = TRUE;
00227 PRINTMSG(EQ_LINE_NUM(item), 1488, Error, EQ_COLUMN_NUM(item),
00228 AT_OBJ_NAME_PTR(EQ_ATTR_IDX(item)),
00229 SB_NAME_PTR(common_sb_idx),
00230 SB_ALIGN_SYMBOL(common_sb_idx) ? "ALIGN_SYMBOL" :
00231 "FILL_SYMBOL");
00232 }
00233 # endif
00234 }
00235 # if 0
00236 else if (SB_MODULE(ATD_STOR_BLK_IDX(EQ_ATTR_IDX(item))) &&
00237 (SB_ALIGN_SYMBOL(ATD_STOR_BLK_IDX(EQ_ATTR_IDX(item))) ||
00238 SB_FILL_SYMBOL(ATD_STOR_BLK_IDX(EQ_ATTR_IDX(item))))) {
00239 AT_DCL_ERR(EQ_ATTR_IDX(item)) = TRUE;
00240 PRINTMSG(EQ_LINE_NUM(item), 1489, Error, EQ_COLUMN_NUM(item),
00241 AT_OBJ_NAME_PTR(EQ_ATTR_IDX(item)),
00242 AT_OBJ_NAME_PTR(SCP_ATTR_IDX(curr_scp_idx)),
00243 SB_ALIGN_SYMBOL(ATD_STOR_BLK_IDX(EQ_ATTR_IDX(item))) ?
00244 "ALIGN_SYMBOL" : "FILL_SYMBOL");
00245 }
00246 # endif
00247
00248 if (EQ_OPND_FLD(item) == NO_Tbl_Idx) {
00249
00250
00251
00252 NTR_IR_LIST_TBL(new_idx);
00253 EQ_LIST_IDX(item) = new_idx;
00254 IL_FLD(new_idx) = CN_Tbl_Idx;
00255 IL_IDX(new_idx) = CN_INTEGER_ZERO_IDX;
00256 IL_LINE_NUM(new_idx) = 1;
00257 IL_COL_NUM(new_idx) = 0;
00258 }
00259 else if ((!EQ_SUBSTRINGED(item) &&
00260 ATD_ARRAY_IDX(EQ_ATTR_IDX(item)) == NULL_IDX) ||
00261 (EQ_SUBSTRINGED(item) &&
00262 TYP_TYPE(ATD_TYPE_IDX(EQ_ATTR_IDX(item))) != Character)) {
00263 AT_DCL_ERR(EQ_ATTR_IDX(item)) = TRUE;
00264 PRINTMSG(EQ_LINE_NUM(item), 840, Error,
00265 EQ_COLUMN_NUM(item),
00266 AT_OBJ_NAME_PTR(EQ_ATTR_IDX(item)));
00267 NTR_IR_LIST_TBL(new_idx);
00268 EQ_LIST_IDX(item) = new_idx;
00269 IL_FLD(new_idx) = CN_Tbl_Idx;
00270 IL_IDX(new_idx) = CN_INTEGER_ZERO_IDX;
00271 IL_LINE_NUM(new_idx) = 1;
00272 IL_COL_NUM(new_idx) = 0;
00273 }
00274 else {
00275
00276
00277
00278
00279 OPND_FLD(opnd) = EQ_OPND_FLD(item);
00280 OPND_IDX(opnd) = EQ_OPND_IDX(item);
00281 OPND_LINE_NUM(opnd) = EQ_LINE_NUM(item);
00282 OPND_COL_NUM(opnd) = EQ_COLUMN_NUM(item);
00283 opnd_desc.rank = 0;
00284 expr_mode = Initialization_Expr;
00285 save_xref_state = xref_state;
00286 xref_state = CIF_Symbol_Reference;
00287 attr_idx = find_left_attr(&opnd);
00288 ATD_PARENT_OBJECT(attr_idx) = TRUE;
00289 ok = expr_semantics(&opnd, &opnd_desc);
00290 xref_state = save_xref_state;
00291 expr_mode = Regular_Expr;
00292 ATD_PARENT_OBJECT(attr_idx) = FALSE;
00293
00294 if (!ok) {
00295 EQ_LIST_IDX(item)= NULL_IDX;
00296 EQ_ERROR(item) = TRUE;
00297 item = EQ_NEXT_EQUIV_OBJ(item);
00298 continue;
00299 }
00300
00301
00302
00303 subscript_count = 0;
00304 substring_list = NULL_IDX;
00305
00306 ir_idx = (OPND_FLD(opnd) == IR_Tbl_Idx) ? OPND_IDX(opnd): NULL_IDX;
00307
00308 if (ir_idx != NULL_IDX &&
00309 (IR_OPR(ir_idx) == Substring_Opr ||
00310 IR_OPR(ir_idx) == Whole_Substring_Opr)) {
00311 EQ_SUBSTRINGED(item) = TRUE;
00312 substring_list = IR_IDX_R(ir_idx);
00313 ir_idx = (IR_FLD_L(ir_idx) == IR_Tbl_Idx) ? IR_IDX_L(ir_idx) :
00314 NULL_IDX;
00315 }
00316
00317 if (ir_idx != NULL_IDX &&
00318 IR_OPR(ir_idx) == Whole_Subscript_Opr) {
00319 ir_idx = (IR_FLD_L(ir_idx) == IR_Tbl_Idx) ? IR_IDX_L(ir_idx) :
00320 NULL_IDX;
00321 }
00322
00323 if (ir_idx != NULL_IDX &&
00324 (IR_OPR(ir_idx) == Section_Subscript_Opr ||
00325 IR_OPR(ir_idx) == Struct_Opr)) {
00326
00327 if (IR_OPR(ir_idx) == Section_Subscript_Opr) {
00328 PRINTMSG(EQ_LINE_NUM(item), 250, Error, EQ_COLUMN_NUM(item));
00329 }
00330 else {
00331 PRINTMSG(EQ_LINE_NUM(item), 1537, Error, EQ_COLUMN_NUM(item));
00332 }
00333
00334
00335 EQ_LIST_IDX(item) = NULL_IDX;
00336 EQ_ERROR(item) = TRUE;
00337 item = EQ_NEXT_EQUIV_OBJ(item);
00338 continue;
00339 }
00340
00341 if (ir_idx != NULL_IDX &&
00342 (IR_OPR(ir_idx) == Subscript_Opr ||
00343 IR_OPR(ir_idx) == Whole_Subscript_Opr ||
00344 IR_OPR(ir_idx) == Section_Subscript_Opr)) {
00345 subscript_count = IR_LIST_CNT_R(ir_idx);
00346 EQ_LIST_IDX(item) = IR_IDX_R(ir_idx);
00347 }
00348
00349 if (substring_list != NULL_IDX) {
00350
00351 if (EQ_LIST_IDX(item) == NULL_IDX) {
00352 EQ_LIST_IDX(item) = substring_list;
00353 }
00354 else {
00355 il_idx = EQ_LIST_IDX(item);
00356
00357 while (IL_NEXT_LIST_IDX(il_idx) != NULL_IDX) {
00358 il_idx = IL_NEXT_LIST_IDX(il_idx);
00359 }
00360 IL_NEXT_LIST_IDX(il_idx) = substring_list;
00361 }
00362
00363 il_idx = IL_NEXT_LIST_IDX(substring_list);
00364 il_idx = IL_NEXT_LIST_IDX(il_idx);
00365
00366
00367
00368
00369
00370 if (IL_FLD(il_idx) == CN_Tbl_Idx) {
00371 type_idx = CG_LOGICAL_DEFAULT_TYPE;
00372
00373 folder_driver((char *) &CN_CONST(IL_IDX(il_idx)),
00374 CN_TYPE_IDX(IL_IDX(il_idx)),
00375 (char *) &CN_CONST(CN_INTEGER_ZERO_IDX),
00376 CN_TYPE_IDX(CN_INTEGER_ZERO_IDX),
00377 result,
00378 &type_idx,
00379 EQ_LINE_NUM(item),
00380 EQ_COLUMN_NUM(item),
00381 2,
00382 Le_Opr);
00383
00384 if (THIS_IS_TRUE(result, type_idx)) {
00385 PRINTMSG(EQ_LINE_NUM(item), 1627,Error,EQ_COLUMN_NUM(item));
00386 }
00387 }
00388 IL_OPND(il_idx) = null_opnd;
00389 }
00390 else if (EQ_LIST_IDX(item) != NULL_IDX) {
00391
00392
00393
00394 il_idx = EQ_LIST_IDX(item);
00395
00396 while (IL_NEXT_LIST_IDX(il_idx) != NULL_IDX) {
00397 il_idx = IL_NEXT_LIST_IDX(il_idx);
00398 }
00399 NTR_IR_LIST_TBL(new_idx);
00400 IL_NEXT_LIST_IDX(il_idx) = new_idx;
00401 IL_OPND(new_idx) = null_opnd;
00402 IL_LINE_NUM(new_idx) = EQ_LINE_NUM(item);
00403 IL_COL_NUM(new_idx) = EQ_COLUMN_NUM(item);
00404 }
00405
00406 EQ_OPND_FLD(item) = NO_Tbl_Idx;
00407 EQ_OPND_IDX(item) = NULL_IDX;
00408
00409 if (ATD_ARRAY_IDX(EQ_ATTR_IDX(item)) > 0) {
00410
00411 if (! dump_flags.no_dimension_padding &&
00412 subscript_count < BD_RANK(ATD_ARRAY_IDX(EQ_ATTR_IDX(item)))){
00413 PRINTMSG(EQ_LINE_NUM(item), 375, Warning,
00414 EQ_COLUMN_NUM(item));
00415 }
00416 else if (subscript_count >
00417 BD_RANK(ATD_ARRAY_IDX(EQ_ATTR_IDX(item)))) {
00418 PRINTMSG(EQ_LINE_NUM(item), 204, Error,
00419 EQ_COLUMN_NUM(item));
00420
00421
00422
00423
00424 item = EQ_NEXT_EQUIV_OBJ(item);
00425 continue;
00426 }
00427 }
00428
00429 linearize_list_for_equiv(item);
00430 }
00431
00432 item = EQ_NEXT_EQUIV_OBJ(item);
00433 }
00434 group = EQ_NEXT_EQUIV_GRP(group);
00435 }
00436
00437 merge_equivalence_groups1();
00438
00439 assign_offsets_for_equiv_groups();
00440
00441 merge_equivalence_groups2();
00442
00443 group = SCP_FIRST_EQUIV_GRP(curr_scp_idx);
00444
00445 while (group != NULL_IDX) {
00446 item = group;
00447 sb_idx = NULL_IDX;
00448 automatic = FALSE;
00449 is_volatile = FALSE;
00450
00451 while (item != NULL_IDX) {
00452
00453 if (EQ_ERROR(item)) {
00454 item = EQ_NEXT_EQUIV_OBJ(item);
00455 continue;
00456 }
00457
00458 attr_idx = EQ_ATTR_IDX(item);
00459
00460 if (!EQ_SEARCH_DONE(item) &&
00461 (ATD_CLASS(EQ_ATTR_IDX(item)) == Variable &&
00462 ATD_EQUIV_LIST(EQ_ATTR_IDX(item)) != NULL_IDX)) {
00463
00464
00465
00466
00467
00468
00469
00470 list_idx = ATD_EQUIV_LIST(EQ_ATTR_IDX(item));
00471 offset_idx = EQ_OFFSET_IDX(item);
00472 EQ_SEARCH_DONE(item) = TRUE;
00473
00474 while (list_idx != NULL_IDX) {
00475
00476 if (fold_relationals(EQ_OFFSET_IDX(AL_EQ_IDX(list_idx)),
00477 offset_idx,
00478 Ne_Opr)) {
00479
00480 PRINTMSG(EQ_LINE_NUM(item), 528, Error,
00481 EQ_COLUMN_NUM(item),
00482 AT_OBJ_NAME_PTR(attr_idx));
00483 }
00484
00485 list_idx = AL_NEXT_IDX(list_idx);
00486 }
00487 }
00488
00489 if (sb_idx != NULL_IDX && sb_idx != ATD_STOR_BLK_IDX(attr_idx) &&
00490 SB_IS_COMMON(ATD_STOR_BLK_IDX(attr_idx)) &&
00491 SB_IS_COMMON(sb_idx)) {
00492 PRINTMSG(EQ_LINE_NUM(item), 823, Error,
00493 EQ_COLUMN_NUM(item),
00494 SB_BLANK_COMMON(sb_idx) ?
00495 "" : SB_NAME_PTR(sb_idx),
00496 SB_BLANK_COMMON(ATD_STOR_BLK_IDX(attr_idx)) ?
00497 "" : SB_NAME_PTR(ATD_STOR_BLK_IDX(attr_idx)));
00498 }
00499
00500 automatic |= ATD_STACK(attr_idx);
00501 is_volatile |= ATD_VOLATILE(attr_idx);
00502
00503
00504
00505 if (SB_IS_COMMON(ATD_STOR_BLK_IDX(attr_idx))) {
00506 sb_idx = ATD_STOR_BLK_IDX(attr_idx);
00507
00508
00509
00510
00511
00512 EQ_DO_NOT_DALIGN(group) = !cmd_line_flags.dalign;
00513 }
00514 else if (SB_HOSTED_STATIC(ATD_STOR_BLK_IDX(attr_idx))) {
00515
00516 if (sb_idx == NULL_IDX || !SB_IS_COMMON(sb_idx)) {
00517 sb_idx = ATD_STOR_BLK_IDX(attr_idx);
00518 }
00519 }
00520 else if (SB_HOSTED_STACK(ATD_STOR_BLK_IDX(attr_idx))) {
00521
00522 if (sb_idx == NULL_IDX ||
00523 (!SB_IS_COMMON(sb_idx) && !SB_HOSTED_STATIC(sb_idx))) {
00524 sb_idx = ATD_STOR_BLK_IDX(attr_idx);
00525 }
00526 }
00527 else if (SB_BLK_TYPE(ATD_STOR_BLK_IDX(attr_idx)) == Static ||
00528 SB_BLK_TYPE(ATD_STOR_BLK_IDX(attr_idx)) == Static_Named ||
00529 SB_BLK_TYPE(ATD_STOR_BLK_IDX(attr_idx)) == Static_Local) {
00530
00531 if (sb_idx == NULL_IDX) {
00532
00533
00534
00535
00536 sb_idx = ATD_STOR_BLK_IDX(attr_idx);
00537 }
00538 }
00539
00540 if (TYP_TYPE(ATD_TYPE_IDX(attr_idx)) == Structure &&
00541 !cmd_line_flags.dalign &&
00542 ATT_DCL_NUMERIC_SEQ(TYP_IDX(ATD_TYPE_IDX(attr_idx)))) {
00543 EQ_DO_NOT_DALIGN(group) = TRUE;
00544 }
00545
00546 item = EQ_NEXT_EQUIV_OBJ(item);
00547 }
00548
00549 if (sb_idx == NULL_IDX) {
00550 sb_idx = create_equiv_stor_blk(EQ_ATTR_IDX(group), Stack);
00551 }
00552
00553 # if defined(_SEPARATE_NONCOMMON_EQUIV_GROUPS)
00554
00555 else if (SB_HOSTED_STATIC(sb_idx)) {
00556 sb_idx = create_equiv_stor_blk(EQ_ATTR_IDX(group), Static);
00557 SB_HOSTED_STATIC(sb_idx) = TRUE;
00558 }
00559 else if (SB_HOSTED_STACK(sb_idx)) {
00560 sb_idx = create_equiv_stor_blk(EQ_ATTR_IDX(group), Stack);
00561 SB_HOSTED_STACK(sb_idx) = TRUE;
00562 }
00563 else if ((SB_BLK_TYPE(sb_idx) == Static ||
00564 SB_BLK_TYPE(sb_idx) == Static_Named ||
00565 SB_BLK_TYPE(sb_idx) == Static_Local) &&
00566 !SB_MODULE(sb_idx)) {
00567 sb_idx = create_equiv_stor_blk(EQ_ATTR_IDX(group),SB_BLK_TYPE(sb_idx));
00568 }
00569 # endif
00570
00571 SB_EQUIVALENCED(sb_idx) = TRUE;
00572
00573 if (SB_PAD_BLK(sb_idx) && !SB_IS_COMMON(sb_idx)) {
00574 PRINTMSG(EQ_LINE_NUM(group), 1352, Warning, EQ_COLUMN_NUM(group));
00575 }
00576
00577 item = group;
00578 default_numeric_sequence = FALSE;
00579 default_numeric_type = FALSE;
00580 default_character_sequence = FALSE;
00581 default_character_type = FALSE;
00582 nondefault_sequence_type = NULL_IDX;
00583 nondefault_intrinsic_type = NULL_IDX;
00584
00585
00586
00587
00588
00589
00590
00591
00592
00593
00594
00595
00596
00597
00598
00599
00600
00601
00602
00603
00604 while (item != NULL_IDX) {
00605
00606 if (EQ_ERROR(item)) {
00607 item = EQ_NEXT_EQUIV_OBJ(item);
00608 continue;
00609 }
00610
00611 ATD_VOLATILE(EQ_ATTR_IDX(item)) = is_volatile;
00612
00613 if (SB_IS_COMMON(sb_idx)) {
00614
00615 if (ATD_SAVED(EQ_ATTR_IDX(item))) {
00616
00617
00618
00619
00620 PRINTMSG(EQ_LINE_NUM(item), 1256, Error, EQ_COLUMN_NUM(item),
00621 AT_OBJ_NAME_PTR(EQ_ATTR_IDX(item)),
00622 "SAVE");
00623 }
00624
00625 if (ATD_STACK(EQ_ATTR_IDX(item))) {
00626
00627
00628
00629
00630 PRINTMSG(EQ_LINE_NUM(item), 1256, Error, EQ_COLUMN_NUM(item),
00631 AT_OBJ_NAME_PTR(EQ_ATTR_IDX(item)),
00632 "AUTOMATIC");
00633 }
00634
00635 if (TYP_TYPE(ATD_TYPE_IDX(EQ_ATTR_IDX(item))) == Structure &&
00636 ATT_DEFAULT_INITIALIZED(TYP_IDX(
00637 ATD_TYPE_IDX(EQ_ATTR_IDX(item))))) {
00638 PRINTMSG(EQ_LINE_NUM(item), 1591, Error, EQ_COLUMN_NUM(item),
00639 AT_OBJ_NAME_PTR(EQ_ATTR_IDX(item)),
00640 AT_OBJ_NAME_PTR(TYP_IDX(
00641 ATD_TYPE_IDX(EQ_ATTR_IDX(item)))));
00642 }
00643 }
00644 else if (automatic && !ATD_STACK(EQ_ATTR_IDX(item))) {
00645
00646
00647
00648 PRINTMSG(EQ_LINE_NUM(item), 1257, Error, EQ_COLUMN_NUM(item),
00649 AT_OBJ_NAME_PTR(EQ_ATTR_IDX(item)),
00650 "AUTOMATIC", "AUTOMATIC");
00651 }
00652
00653 ATD_STOR_BLK_IDX(EQ_ATTR_IDX(item)) = sb_idx;
00654 type_idx = ATD_TYPE_IDX(EQ_ATTR_IDX(item));
00655
00656 if (TYP_TYPE(type_idx) == Structure) {
00657
00658 if (!ATT_SEQUENCE_SET(TYP_IDX(type_idx))) {
00659 PRINTMSG(EQ_LINE_NUM(item), 294, Error,
00660 EQ_COLUMN_NUM(item),
00661 AT_OBJ_NAME_PTR(EQ_ATTR_IDX(item)));
00662 }
00663
00664 if (ATT_POINTER_CPNT(TYP_IDX(type_idx))
00665 #ifdef KEY
00666 || ATT_ALLOCATABLE_CPNT(TYP_IDX(type_idx))
00667 #endif
00668 ) {
00669 PRINTMSG(EQ_LINE_NUM(item), 354, Error,
00670 EQ_COLUMN_NUM(item),
00671 AT_OBJ_NAME_PTR(EQ_ATTR_IDX(item)));
00672 }
00673
00674 if (ATT_CHAR_SEQ(TYP_IDX(type_idx))) {
00675
00676
00677
00678 if (default_numeric_sequence || default_numeric_type) {
00679 PRINTMSG(EQ_LINE_NUM(item), 1239, Error,
00680 EQ_COLUMN_NUM(item),
00681 AT_OBJ_NAME_PTR(EQ_ATTR_IDX(item)));
00682 }
00683 else if (nondefault_sequence_type != NULL_IDX) {
00684 PRINTMSG(EQ_LINE_NUM(nondefault_sequence_type), 1242, Error,
00685 EQ_COLUMN_NUM(nondefault_sequence_type),
00686 AT_OBJ_NAME_PTR(EQ_ATTR_IDX(
00687 nondefault_sequence_type)));
00688 }
00689 else if (nondefault_intrinsic_type != NULL_IDX) {
00690 PRINTMSG(EQ_LINE_NUM(nondefault_intrinsic_type), 1241, Error,
00691 EQ_COLUMN_NUM(nondefault_intrinsic_type),
00692 AT_OBJ_NAME_PTR(EQ_ATTR_IDX(
00693 nondefault_intrinsic_type)));
00694 }
00695 else {
00696 default_character_sequence = TRUE;
00697 }
00698 }
00699 else if (!ATT_NON_DEFAULT_CPNT(TYP_IDX(type_idx)) &&
00700 ATT_DCL_NUMERIC_SEQ(TYP_IDX(type_idx))) {
00701
00702
00703
00704 if (default_character_sequence || default_character_type) {
00705 PRINTMSG(EQ_LINE_NUM(item), 1240, Error,
00706 EQ_COLUMN_NUM(item),
00707 AT_OBJ_NAME_PTR(EQ_ATTR_IDX(item)));
00708 }
00709 else if (nondefault_sequence_type != NULL_IDX) {
00710 PRINTMSG(EQ_LINE_NUM(nondefault_sequence_type), 1242, Error,
00711 EQ_COLUMN_NUM(nondefault_sequence_type),
00712 AT_OBJ_NAME_PTR(EQ_ATTR_IDX(
00713 nondefault_sequence_type)));
00714 }
00715 else if (nondefault_intrinsic_type != NULL_IDX) {
00716 PRINTMSG(EQ_LINE_NUM(nondefault_intrinsic_type), 1241, Error,
00717 EQ_COLUMN_NUM(nondefault_intrinsic_type),
00718 AT_OBJ_NAME_PTR(EQ_ATTR_IDX(
00719 nondefault_intrinsic_type)));
00720 }
00721
00722 else {
00723
00724 # if defined(_ACCEPT_CMD_s_32)
00725 if (cmd_line_flags.s_default32) {
00726 PRINTMSG(EQ_LINE_NUM(item), 1244, Warning,
00727 EQ_COLUMN_NUM(item),
00728 AT_OBJ_NAME_PTR(EQ_ATTR_IDX(item)),
00729 AT_OBJ_NAME_PTR(TYP_IDX(type_idx)));
00730 }
00731 # endif
00732 default_numeric_sequence = TRUE;
00733 }
00734 }
00735 else {
00736
00737 if (default_character_sequence || default_character_type) {
00738 PRINTMSG(EQ_LINE_NUM(item), 1240, Error,
00739 EQ_COLUMN_NUM(item),
00740 AT_OBJ_NAME_PTR(EQ_ATTR_IDX(item)));
00741 }
00742 else if (default_numeric_sequence || default_numeric_type) {
00743 PRINTMSG(EQ_LINE_NUM(item), 1239, Error,
00744 EQ_COLUMN_NUM(item),
00745 AT_OBJ_NAME_PTR(EQ_ATTR_IDX(item)));
00746 }
00747 else if (nondefault_intrinsic_type != NULL_IDX) {
00748 PRINTMSG(EQ_LINE_NUM(nondefault_intrinsic_type), 1241, Error,
00749 EQ_COLUMN_NUM(nondefault_intrinsic_type),
00750 AT_OBJ_NAME_PTR(EQ_ATTR_IDX(
00751 nondefault_intrinsic_type)));
00752 }
00753 #if 0
00754
00755 else if (nondefault_sequence_type != NULL_IDX &&
00756 !compare_derived_types(type_idx,
00757 ATD_TYPE_IDX(EQ_ATTR_IDX(nondefault_sequence_type)))) {
00758 PRINTMSG(EQ_LINE_NUM(nondefault_sequence_type), 1242, Error,
00759 EQ_COLUMN_NUM(nondefault_sequence_type),
00760 AT_OBJ_NAME_PTR(
00761 EQ_ATTR_IDX(nondefault_sequence_type)));
00762 }
00763 #endif
00764 else {
00765 nondefault_sequence_type = item;
00766 }
00767 }
00768 }
00769 else if (TYP_TYPE(type_idx) == Character) {
00770
00771 if (default_numeric_sequence) {
00772 PRINTMSG(EQ_LINE_NUM(item), 1239, Error,
00773 EQ_COLUMN_NUM(item),
00774 AT_OBJ_NAME_PTR(EQ_ATTR_IDX(item)));
00775 }
00776 else if (default_numeric_type) {
00777 PRINTMSG(EQ_LINE_NUM(item), 522, Ansi,
00778 EQ_COLUMN_NUM(item));
00779 default_character_type = TRUE;
00780 }
00781 else if (nondefault_sequence_type != NULL_IDX) {
00782 PRINTMSG(EQ_LINE_NUM(nondefault_sequence_type), 1242, Error,
00783 EQ_COLUMN_NUM(nondefault_sequence_type),
00784 AT_OBJ_NAME_PTR(EQ_ATTR_IDX(nondefault_sequence_type)));
00785 }
00786 else if (nondefault_intrinsic_type != NULL_IDX) {
00787 # if 0
00788 PRINTMSG(EQ_LINE_NUM(nondefault_intrinsic_type), 1241, Error,
00789 EQ_COLUMN_NUM(nondefault_intrinsic_type),
00790 AT_OBJ_NAME_PTR(EQ_ATTR_IDX(nondefault_intrinsic_type)));
00791 # endif
00792 PRINTMSG(EQ_LINE_NUM(nondefault_intrinsic_type), 522, Ansi,
00793 EQ_COLUMN_NUM(nondefault_intrinsic_type));
00794 default_character_type = TRUE;
00795 }
00796 else {
00797 default_character_type = TRUE;
00798 }
00799 }
00800 else if (TYP_DESC(type_idx) == Default_Typed ||
00801 TYP_LINEAR(type_idx) == INTEGER_DEFAULT_TYPE ||
00802 TYP_LINEAR(type_idx) == LOGICAL_DEFAULT_TYPE ||
00803 TYP_LINEAR(type_idx) == REAL_DEFAULT_TYPE ||
00804 TYP_LINEAR(type_idx) == DOUBLE_DEFAULT_TYPE ||
00805 TYP_LINEAR(type_idx) == COMPLEX_DEFAULT_TYPE) {
00806
00807 if (default_character_sequence) {
00808 PRINTMSG(EQ_LINE_NUM(item), 1240, Error,
00809 EQ_COLUMN_NUM(item),
00810 AT_OBJ_NAME_PTR(EQ_ATTR_IDX(item)));
00811 }
00812 else if (default_character_type) {
00813 PRINTMSG(EQ_LINE_NUM(item), 522, Ansi,
00814 EQ_COLUMN_NUM(item));
00815 default_numeric_type = TRUE;
00816 }
00817 else if (nondefault_sequence_type != NULL_IDX) {
00818 PRINTMSG(EQ_LINE_NUM(nondefault_sequence_type), 1242, Error,
00819 EQ_COLUMN_NUM(nondefault_sequence_type),
00820 AT_OBJ_NAME_PTR(EQ_ATTR_IDX(nondefault_sequence_type)));
00821 }
00822 else if (nondefault_intrinsic_type != NULL_IDX) {
00823 # if 0
00824 PRINTMSG(EQ_LINE_NUM(nondefault_intrinsic_type), 1241, Error,
00825 EQ_COLUMN_NUM(nondefault_intrinsic_type),
00826 AT_OBJ_NAME_PTR(EQ_ATTR_IDX(nondefault_intrinsic_type)));
00827 # endif
00828 PRINTMSG(EQ_LINE_NUM(nondefault_intrinsic_type), 1097, Ansi,
00829 EQ_COLUMN_NUM(nondefault_intrinsic_type));
00830 default_numeric_type = TRUE;
00831 }
00832 else {
00833 default_numeric_type = TRUE;
00834 }
00835 }
00836 else {
00837
00838 if (default_character_sequence) {
00839 PRINTMSG(EQ_LINE_NUM(item), 1240, Error,
00840 EQ_COLUMN_NUM(item),
00841 AT_OBJ_NAME_PTR(EQ_ATTR_IDX(item)));
00842 }
00843 else if (default_character_type) {
00844 PRINTMSG(EQ_LINE_NUM(item), 522, Ansi, EQ_COLUMN_NUM(item));
00845 nondefault_intrinsic_type = item;
00846 }
00847 else if (default_numeric_type) {
00848 # if 0
00849 PRINTMSG(EQ_LINE_NUM(item), 1239, Error,
00850 EQ_COLUMN_NUM(item),
00851 AT_OBJ_NAME_PTR(EQ_ATTR_IDX(item)));
00852 # endif
00853 PRINTMSG(EQ_LINE_NUM(item), 1097, Ansi, EQ_COLUMN_NUM(item));
00854 nondefault_intrinsic_type = item;
00855 }
00856 else if (default_numeric_sequence) {
00857 PRINTMSG(EQ_LINE_NUM(item), 1239, Error,
00858 EQ_COLUMN_NUM(item),
00859 AT_OBJ_NAME_PTR(EQ_ATTR_IDX(item)));
00860 }
00861 #if 0
00862
00863 else if (nondefault_sequence_type != NULL_IDX) {
00864 PRINTMSG(EQ_LINE_NUM(nondefault_sequence_type), 1242, Error,
00865 EQ_COLUMN_NUM(nondefault_sequence_type),
00866 AT_OBJ_NAME_PTR(EQ_ATTR_IDX(nondefault_sequence_type)));
00867 }
00868 #endif
00869 else if (nondefault_intrinsic_type != NULL_IDX &&
00870 TYP_LINEAR(ATD_TYPE_IDX(
00871 EQ_ATTR_IDX(nondefault_intrinsic_type))) !=
00872 TYP_LINEAR(type_idx)) {
00873 # if 0
00874 PRINTMSG(EQ_LINE_NUM(nondefault_intrinsic_type), 1241, Error,
00875 EQ_COLUMN_NUM(nondefault_intrinsic_type),
00876 AT_OBJ_NAME_PTR(EQ_ATTR_IDX(nondefault_intrinsic_type)));
00877 # endif
00878 PRINTMSG(EQ_LINE_NUM(item), 1097, Ansi, EQ_COLUMN_NUM(item));
00879 nondefault_intrinsic_type = item;
00880 }
00881 else {
00882 nondefault_intrinsic_type = item;
00883 }
00884 }
00885
00886 item = EQ_NEXT_EQUIV_OBJ(item);
00887 }
00888
00889 group = EQ_NEXT_EQUIV_GRP(group);
00890 }
00891
00892 TRACE (Func_Exit, "equivalence_semantics", NULL);
00893
00894 return;
00895
00896 }
00897
00898
00899
00900
00901
00902
00903
00904
00905
00906
00907
00908
00909
00910
00911
00912
00913 static void linearize_list_for_equiv(int item)
00914 {
00915 int attr_idx;
00916 int bd_idx;
00917 size_offset_type bit_offset;
00918 int dim;
00919 int l_idx;
00920 int list_idx;
00921 size_offset_type left;
00922 size_offset_type result;
00923 size_offset_type right;
00924 int start_expr_idx;
00925 #ifdef KEY
00926 int trail_l_idx = 0;
00927 #else
00928 int trail_l_idx;
00929 #endif
00930
00931
00932 TRACE (Func_Entry, "linearize_list_for_equiv", NULL);
00933
00934 attr_idx = EQ_ATTR_IDX(item);
00935 list_idx = EQ_LIST_IDX(item);
00936 bit_offset.fld = CN_Tbl_Idx;
00937 bit_offset.idx = CN_INTEGER_ZERO_IDX;
00938
00939 if (list_idx != NULL_IDX) {
00940
00941 if (!EQ_SUBSTRINGED(item)) {
00942
00943 if (ATD_ARRAY_IDX(attr_idx) != NULL_IDX) {
00944 bd_idx = ATD_ARRAY_IDX(attr_idx);
00945 dim = 1;
00946 l_idx = list_idx;
00947
00948 while (l_idx != NULL_IDX && IL_FLD(l_idx) != NO_Tbl_Idx) {
00949 right.fld = BD_LB_FLD(bd_idx,dim);
00950 right.idx = BD_LB_IDX(bd_idx,dim);
00951 left.fld = IL_FLD(l_idx);
00952 left.idx = IL_IDX(l_idx);
00953
00954 if (!size_offset_binary_calc(&left, &right, Minus_Opr, &result)){
00955 break;
00956 }
00957
00958 left.fld = BD_SM_FLD(bd_idx,dim);
00959 left.idx = BD_SM_IDX(bd_idx,dim);
00960
00961 if (!size_offset_binary_calc(&left, &result, Mult_Opr, &result)){
00962 break;
00963 }
00964
00965 if (!size_offset_binary_calc(&bit_offset,
00966 &result,
00967 Plus_Opr,
00968 &bit_offset)) {
00969 break;
00970 }
00971
00972 l_idx = IL_NEXT_LIST_IDX(l_idx);
00973 dim++;
00974 }
00975 }
00976 }
00977 else {
00978
00979 if (TYP_TYPE(ATD_TYPE_IDX(attr_idx)) == Character) {
00980 l_idx = list_idx;
00981
00982 while (l_idx != NULL_IDX && IL_FLD(l_idx) != NO_Tbl_Idx) {
00983 trail_l_idx = l_idx;
00984 l_idx = IL_NEXT_LIST_IDX(l_idx);
00985 }
00986
00987 start_expr_idx = IL_PREV_LIST_IDX(trail_l_idx);
00988
00989 left.fld = IL_FLD(start_expr_idx);
00990 left.idx = IL_IDX(start_expr_idx);
00991 right.fld = CN_Tbl_Idx;
00992 right.idx = CN_INTEGER_ONE_IDX;
00993
00994 size_offset_binary_calc(&left, &right, Minus_Opr, &bit_offset);
00995
00996 IL_FLD(start_expr_idx) = NO_Tbl_Idx;
00997
00998 if (ATD_ARRAY_IDX(attr_idx) != NULL_IDX) {
00999
01000 if (IL_FLD(list_idx) == NO_Tbl_Idx) {
01001 AT_DCL_ERR(attr_idx) = TRUE;
01002 PRINTMSG(IL_LINE_NUM(list_idx), 250, Error,
01003 IL_COL_NUM(list_idx));
01004 }
01005
01006 bd_idx = ATD_ARRAY_IDX(attr_idx);
01007 dim = 1;
01008 l_idx = list_idx;
01009
01010 while (l_idx != NULL_IDX && IL_FLD(l_idx) != NO_Tbl_Idx) {
01011
01012 left.fld = IL_FLD(l_idx);
01013 left.idx = IL_IDX(l_idx);
01014 right.fld = BD_LB_FLD(bd_idx, dim);
01015 right.idx = BD_LB_IDX(bd_idx, dim);
01016
01017 if (!size_offset_binary_calc(&left,
01018 &right,
01019 Minus_Opr,
01020 &result)) {
01021 break;
01022 }
01023
01024 left.fld = BD_SM_FLD(bd_idx, dim);
01025 left.idx = BD_SM_IDX(bd_idx, dim);
01026
01027 if (!size_offset_binary_calc(&left,
01028 &result,
01029 Mult_Opr,
01030 &result)) {
01031 break;
01032 }
01033
01034 if (!size_offset_binary_calc(&bit_offset,
01035 &result,
01036 Plus_Opr,
01037 &bit_offset)) {
01038 break;
01039 }
01040
01041 l_idx = IL_NEXT_LIST_IDX(l_idx);
01042 dim = dim + 1;
01043 }
01044 }
01045 }
01046 }
01047 }
01048
01049 if (TYP_TYPE(ATD_TYPE_IDX(attr_idx)) == Character) {
01050 result.fld = CN_Tbl_Idx;
01051 result.idx = CN_INTEGER_CHAR_BIT_IDX;
01052 }
01053 else {
01054 result.fld = CN_Tbl_Idx;
01055 result.idx = CN_INTEGER_BITS_PER_WORD_IDX;
01056
01057 # if defined(_TARGET_OS_MAX) || defined(_WHIRL_HOST64_TARGET64)
01058
01059
01060
01061
01062
01063 if (PACK_HALF_WORD_TEST_CONDITION(ATD_TYPE_IDX(attr_idx))) {
01064 C_TO_F_INT(result.constant,
01065 TARGET_BITS_PER_WORD / 2,
01066 CG_INTEGER_DEFAULT_TYPE);
01067 result.fld = NO_Tbl_Idx;
01068 result.type_idx = CG_INTEGER_DEFAULT_TYPE;
01069 }
01070 # endif
01071
01072 # if defined(_INTEGER_1_AND_2)
01073
01074 if (on_off_flags.integer_1_and_2) {
01075
01076 if (PACK_8_BIT_TEST_CONDITION(ATD_TYPE_IDX(attr_idx))) {
01077 C_TO_F_INT(result.constant, 8, CG_INTEGER_DEFAULT_TYPE);
01078 result.fld = NO_Tbl_Idx;
01079 result.type_idx = CG_INTEGER_DEFAULT_TYPE;
01080 }
01081 else if (PACK_16_BIT_TEST_CONDITION(ATD_TYPE_IDX(attr_idx))) {
01082 C_TO_F_INT(result.constant, 16, CG_INTEGER_DEFAULT_TYPE);
01083 result.fld = NO_Tbl_Idx;
01084 result.type_idx = CG_INTEGER_DEFAULT_TYPE;
01085 }
01086 }
01087
01088 # endif
01089 }
01090
01091 size_offset_binary_calc(&bit_offset, &result, Mult_Opr, &bit_offset);
01092
01093 if (bit_offset.fld == NO_Tbl_Idx) {
01094 IL_FLD(list_idx) = CN_Tbl_Idx;
01095 IL_IDX(list_idx) = ntr_const_tbl(bit_offset.type_idx,
01096 FALSE,
01097 bit_offset.constant);
01098 }
01099 else {
01100 IL_FLD(list_idx) = bit_offset.fld;
01101 IL_IDX(list_idx) = bit_offset.idx;
01102 }
01103
01104 IL_LINE_NUM(list_idx) = 1;
01105 IL_COL_NUM(list_idx) = 0;
01106
01107 TRACE (Func_Exit, "linearize_list_for_equiv", NULL);
01108
01109 return;
01110
01111 }
01112
01113
01114
01115
01116
01117
01118
01119
01120
01121
01122
01123
01124
01125
01126
01127
01128
01129
01130
01131
01132
01133
01134
01135 static void merge_equivalence_groups1(void)
01136 {
01137
01138 int group;
01139 int group_end;
01140 int item;
01141 int list_idx;
01142 int list_item;
01143 #ifdef KEY
01144 int prev_group = 0;
01145 #else
01146 int prev_group;
01147 #endif
01148
01149
01150 TRACE (Func_Entry, "merge_equivalence_groups1", NULL);
01151
01152 group = SCP_FIRST_EQUIV_GRP(curr_scp_idx);
01153
01154 while (group != NULL_IDX) {
01155
01156 if (EQ_MERGED(group)) {
01157
01158
01159
01160
01161 EQ_NEXT_EQUIV_GRP(prev_group) = EQ_NEXT_EQUIV_GRP(group);
01162 }
01163 else {
01164 group_end = EQ_GRP_END_IDX(group);
01165 item = group;
01166
01167 while (item != NULL_IDX) {
01168
01169 if (EQ_ERROR(item)) {
01170 item = EQ_NEXT_EQUIV_OBJ(item);
01171 continue;
01172 }
01173
01174 if (EQ_SEARCH_DONE(item)) {
01175
01176
01177
01178
01179
01180
01181
01182
01183
01184
01185 EQ_SEARCH_DONE(item) = FALSE;
01186 }
01187 else if (ATD_CLASS(EQ_ATTR_IDX(item)) == Variable &&
01188 ATD_EQUIV_LIST(EQ_ATTR_IDX(item)) != NULL_IDX) {
01189
01190
01191
01192 list_idx = ATD_EQUIV_LIST(EQ_ATTR_IDX(item));
01193
01194 while (list_idx != NULL_IDX) {
01195 list_item = AL_EQ_IDX(list_idx);
01196
01197 if (list_item != item && EQ_GRP_IDX(list_item) != group &&
01198 (IL_IDX(EQ_LIST_IDX(list_item)) ==
01199 IL_IDX(EQ_LIST_IDX(item)))) {
01200
01201
01202
01203
01204
01205
01206
01207
01208
01209
01210 EQ_SEARCH_DONE(list_item) = TRUE;
01211 EQ_NEXT_EQUIV_OBJ(group_end) = EQ_GRP_IDX(list_item);
01212 EQ_MERGED(EQ_GRP_IDX(list_item)) = TRUE;
01213
01214 group_end = EQ_GRP_END_IDX(EQ_GRP_IDX(list_item));
01215 list_item = EQ_GRP_IDX(list_item);
01216
01217 while (list_item != NULL_IDX) {
01218 EQ_GRP_IDX(list_item) = group;
01219 list_item = EQ_NEXT_EQUIV_OBJ(list_item);
01220 }
01221 }
01222 list_idx = AL_NEXT_IDX(list_idx);
01223 }
01224 }
01225 item = EQ_NEXT_EQUIV_OBJ(item);
01226 }
01227 EQ_GRP_END_IDX(group) = group_end;
01228 prev_group = group;
01229 }
01230 group = EQ_NEXT_EQUIV_GRP(group);
01231 }
01232
01233 TRACE (Func_Exit, "merge_equivalence_groups1", NULL);
01234
01235 return;
01236
01237 }
01238
01239
01240
01241
01242
01243
01244
01245
01246
01247
01248
01249
01250
01251
01252
01253
01254
01255
01256
01257
01258
01259
01260
01261 static void merge_equivalence_groups2(void)
01262 {
01263 boolean adjust;
01264 size_offset_type adjust_by;
01265 int group;
01266 int group_end;
01267 int item;
01268 size_offset_type left;
01269 int list_idx;
01270 int list_item;
01271 #ifdef KEY
01272 int prev_group = 0;
01273 #else
01274 int prev_group;
01275 #endif
01276 size_offset_type result;
01277 size_offset_type right;
01278
01279
01280 TRACE (Func_Entry, "merge_equivalence_groups2", NULL);
01281
01282 group = SCP_FIRST_EQUIV_GRP(curr_scp_idx);
01283
01284 while (group != NULL_IDX) {
01285
01286 if (EQ_MERGED(group)) {
01287
01288
01289
01290
01291 EQ_NEXT_EQUIV_GRP(prev_group) = EQ_NEXT_EQUIV_GRP(group);
01292 }
01293 else {
01294 group_end = EQ_GRP_END_IDX(group);
01295 item = group;
01296
01297 while (item != NULL_IDX) {
01298
01299 if (EQ_ERROR(item)) {
01300 item = EQ_NEXT_EQUIV_OBJ(item);
01301 continue;
01302 }
01303
01304 if (ATD_CLASS(EQ_ATTR_IDX(item)) == Variable &&
01305 ATD_EQUIV_LIST(EQ_ATTR_IDX(item)) != NULL_IDX) {
01306
01307
01308
01309 list_idx = ATD_EQUIV_LIST(EQ_ATTR_IDX(item));
01310
01311 while (list_idx != NULL_IDX) {
01312 list_item = AL_EQ_IDX(list_idx);
01313
01314 if (list_item != item && EQ_GRP_IDX(list_item) != group) {
01315
01316
01317
01318
01319
01320
01321
01322
01323
01324 if (EQ_OFFSET_IDX(list_item) != EQ_OFFSET_IDX(item) ||
01325 EQ_OFFSET_FLD(list_item) != EQ_OFFSET_FLD(item)) {
01326 left.fld = EQ_OFFSET_FLD(list_item);
01327 left.idx = EQ_OFFSET_IDX(list_item);
01328 right.fld = EQ_OFFSET_FLD(item);
01329 right.idx = EQ_OFFSET_IDX(item);
01330
01331 if (!size_offset_binary_calc(&left,
01332 &right,
01333 Minus_Opr,
01334 &adjust_by)) {
01335 adjust = FALSE;
01336 break;
01337 }
01338 adjust = TRUE;
01339 }
01340 else {
01341 adjust = FALSE;
01342 }
01343
01344 EQ_NEXT_EQUIV_OBJ(group_end) = EQ_GRP_IDX(list_item);
01345 EQ_MERGED(EQ_GRP_IDX(list_item)) = TRUE;
01346
01347 group_end = EQ_GRP_END_IDX(EQ_GRP_IDX(list_item));
01348 list_item = EQ_GRP_IDX(list_item);
01349
01350 if (adjust) {
01351
01352 while (list_item != NULL_IDX) {
01353 EQ_GRP_IDX(list_item)= group;
01354 left.fld = EQ_OFFSET_FLD(list_item);
01355 left.idx = EQ_OFFSET_IDX(list_item);
01356
01357 if (!size_offset_binary_calc(&left,
01358 &adjust_by,
01359 Minus_Opr,
01360 &result)) {
01361 break;
01362 }
01363
01364 if (result.fld == NO_Tbl_Idx) {
01365 EQ_OFFSET_FLD(list_item) = CN_Tbl_Idx;
01366 EQ_OFFSET_IDX(list_item) = ntr_const_tbl(
01367 result.type_idx,
01368 FALSE,
01369 result.constant);
01370 }
01371 else {
01372 EQ_OFFSET_FLD(list_item) = result.fld;
01373 EQ_OFFSET_IDX(list_item) = result.idx;
01374 }
01375
01376 list_item = EQ_NEXT_EQUIV_OBJ(list_item);
01377 }
01378 }
01379 else {
01380 while (list_item != NULL_IDX) {
01381 EQ_GRP_IDX(list_item) = group;
01382 list_item = EQ_NEXT_EQUIV_OBJ(list_item);
01383 }
01384 }
01385 }
01386 list_idx = AL_NEXT_IDX(list_idx);
01387 }
01388 }
01389 item = EQ_NEXT_EQUIV_OBJ(item);
01390 }
01391 EQ_GRP_END_IDX(group) = group_end;
01392 prev_group = group;
01393 }
01394 group = EQ_NEXT_EQUIV_GRP(group);
01395 }
01396
01397 TRACE (Func_Exit, "merge_equivalence_groups2", NULL);
01398
01399 return;
01400
01401 }
01402
01403
01404
01405
01406
01407
01408
01409
01410
01411
01412
01413
01414
01415
01416
01417
01418 static void assign_offsets_for_equiv_groups(void)
01419 {
01420 int group;
01421 int item;
01422 size_offset_type largest_offset;
01423 size_offset_type result;
01424
01425
01426 TRACE (Func_Entry, "assign_offsets_for_equiv_groups", NULL);
01427
01428 group = SCP_FIRST_EQUIV_GRP(curr_scp_idx);
01429
01430 while (group != NULL_IDX) {
01431
01432 item = group;
01433 largest_offset.idx = CN_INTEGER_ZERO_IDX;
01434 largest_offset.fld = CN_Tbl_Idx;
01435
01436 while (item != NULL_IDX) {
01437
01438 if (!EQ_ERROR(item) &&
01439 IL_IDX(EQ_LIST_IDX(item)) != CN_INTEGER_ZERO_IDX &&
01440 fold_relationals(IL_IDX(EQ_LIST_IDX(item)),
01441 largest_offset.idx,
01442 Ge_Opr)) {
01443 largest_offset.fld = IL_FLD(EQ_LIST_IDX(item));
01444 largest_offset.idx = IL_IDX(EQ_LIST_IDX(item));
01445 }
01446
01447 item = EQ_NEXT_EQUIV_OBJ(item);
01448 }
01449
01450 if (largest_offset.idx != CN_INTEGER_ZERO_IDX) {
01451
01452
01453
01454
01455 item = group;
01456
01457 while (item != NULL_IDX) {
01458
01459 if (EQ_ERROR(item)) {
01460 item = EQ_NEXT_EQUIV_OBJ(item);
01461 continue;
01462 }
01463
01464
01465
01466 if (fold_relationals(IL_IDX(EQ_LIST_IDX(item)),
01467 CN_INTEGER_ZERO_IDX,
01468 Eq_Opr)) {
01469 EQ_OFFSET_FLD(item) = largest_offset.fld;
01470 EQ_OFFSET_IDX(item) = largest_offset.idx;
01471 }
01472 else {
01473 result.fld = IL_FLD(EQ_LIST_IDX(item));
01474 result.idx = IL_IDX(EQ_LIST_IDX(item));
01475
01476 if (size_offset_binary_calc(&largest_offset,
01477 &result,
01478 Minus_Opr,
01479 &result)) {
01480
01481 if (result.fld == NO_Tbl_Idx) {
01482 EQ_OFFSET_FLD(item) = CN_Tbl_Idx;
01483 EQ_OFFSET_IDX(item) = ntr_const_tbl(result.type_idx,
01484 FALSE,
01485 result.constant);
01486 }
01487 else {
01488 EQ_OFFSET_FLD(item) = result.fld;
01489 EQ_OFFSET_IDX(item) = result.idx;
01490 }
01491 }
01492 else {
01493 break;
01494 }
01495 }
01496 item = EQ_NEXT_EQUIV_OBJ(item);
01497 }
01498 }
01499
01500 group = EQ_NEXT_EQUIV_GRP(group);
01501 }
01502
01503
01504 TRACE (Func_Exit, "assign_offsets_for_equiv_groups", NULL);
01505
01506 return;
01507
01508 }
01509
01510
01511
01512
01513
01514
01515
01516
01517
01518
01519
01520
01521
01522
01523
01524
01525
01526 void array_dim_resolution(int attr_idx,
01527 boolean need_const_array)
01528 {
01529 bd_array_size_type array_size_type;
01530 int at_idx;
01531 int bd_idx;
01532 int column;
01533 int cvrt_idx;
01534 int dim;
01535 int entry_count;
01536 int entry_list;
01537 expr_arg_type expr_desc;
01538 int extent_entry_idx = NULL_IDX;
01539 fld_type extent_fld;
01540 int extent_idx;
01541 int ir_idx;
01542 boolean is_interface;
01543 int len_ir_idx;
01544 int length_idx;
01545 int length_entry_idx = NULL_IDX;
01546 int line;
01547 int mult_idx;
01548 int new_bd_idx;
01549 int next_ir_idx;
01550 opnd_type opnd;
01551 int sh_idx;
01552 int stride_entry_idx = NULL_IDX;
01553 int stride_entry_count;
01554 size_offset_type stride;
01555 #ifdef KEY
01556 int type = 0;
01557 #else
01558 int type;
01559 #endif
01560
01561
01562 TRACE (Func_Entry, "array_dim_resolution", NULL);
01563
01564 is_interface = SCP_IS_INTERFACE(curr_scp_idx);
01565 bd_idx = ATD_ARRAY_IDX(attr_idx);
01566
01567 if (ATD_CLASS(attr_idx) == Function_Result) {
01568 entry_list = ATP_NO_ENTRY_LIST(ATD_FUNC_IDX(attr_idx));
01569 }
01570 else {
01571 entry_list = ATD_NO_ENTRY_LIST(attr_idx);
01572 }
01573
01574 if (BD_ARRAY_CLASS(bd_idx) == Deferred_Shape) {
01575
01576
01577
01578
01579
01580
01581 if (need_const_array) {
01582 goto EXIT;
01583 }
01584
01585 if (ATD_CLASS(attr_idx) == Compiler_Tmp && ATD_IM_A_DOPE(attr_idx)) {
01586 goto EXIT;
01587 }
01588
01589 ATD_IM_A_DOPE(attr_idx) = TRUE;
01590
01591 #ifdef KEY
01592 if (ATD_CLASS(attr_idx) == Dummy_Argument &&
01593 !(ATD_POINTER(attr_idx) || ATD_ALLOCATABLE(attr_idx)))
01594 #else
01595 if (ATD_CLASS(attr_idx) == Dummy_Argument && !ATD_POINTER(attr_idx))
01596 #endif
01597 {
01598
01599
01600
01601 if (ATD_INTRIN_DARG(attr_idx)) {
01602 goto EXIT;
01603 }
01604
01605 new_bd_idx = reserve_array_ntry(BD_RANK(bd_idx));
01606 BD_RANK(new_bd_idx) = BD_RANK(bd_idx);
01607 BD_DCL_ERR(new_bd_idx) = BD_DCL_ERR(bd_idx);
01608 BD_ARRAY_CLASS(new_bd_idx) = Assumed_Shape;
01609 BD_ARRAY_SIZE(new_bd_idx) = Constant_Size;
01610 BD_LINE_NUM(new_bd_idx) = BD_LINE_NUM(bd_idx);
01611 BD_COLUMN_NUM(new_bd_idx) = BD_COLUMN_NUM(bd_idx);
01612
01613 for (dim = 1; dim <= BD_RANK(new_bd_idx); dim++) {
01614 BD_LB_FLD(new_bd_idx, dim) = CN_Tbl_Idx;
01615 BD_LB_IDX(new_bd_idx, dim) = CN_INTEGER_ONE_IDX;
01616 }
01617
01618 bd_idx = ntr_array_in_bd_tbl(new_bd_idx);
01619 BD_ARRAY_SIZE(bd_idx) = Constant_Size;
01620 BD_RESOLVED(bd_idx) = TRUE;
01621 ATD_ARRAY_IDX(attr_idx) = bd_idx;
01622
01623 if (ATD_IGNORE_TKR(attr_idx)) {
01624 AT_DCL_ERR(attr_idx) = TRUE;
01625 #ifdef KEY
01626 PRINTMSG(AT_DEF_LINE(attr_idx), 1459, Error,
01627 AT_DEF_COLUMN(attr_idx),
01628 AT_OBJ_NAME_PTR(attr_idx),
01629 "IGNORE_TKR",
01630 "assumed-shape DIMENSION",
01631 AT_DEF_LINE(attr_idx));
01632 #else
01633 PRINTMSG(AT_DEF_LINE(attr_idx), 1459, Error,
01634 AT_DEF_COLUMN(attr_idx),
01635 AT_OBJ_NAME_PTR(attr_idx),
01636 "IGNORE_TKR",
01637 "assumed-shape DIMENSION");
01638 #endif
01639 }
01640
01641 # if defined(_TARGET_OS_MAX)
01642 if (ATD_PE_ARRAY_IDX(attr_idx) != NULL_IDX) {
01643 AT_DCL_ERR(attr_idx) = TRUE;
01644 PRINTMSG(BD_LINE_NUM(ATD_PE_ARRAY_IDX(attr_idx)), 1583, Error,
01645 BD_COLUMN_NUM(ATD_PE_ARRAY_IDX(attr_idx)),
01646 "co-array dimensions",
01647 "assumed-shape arrays");
01648 }
01649 # endif
01650 }
01651 else if (!ATD_POINTER(attr_idx) && !ATD_ALLOCATABLE(attr_idx)) {
01652 AT_DCL_ERR(attr_idx) = TRUE;
01653
01654 if (ATD_CLASS(attr_idx) == Function_Result) {
01655 PRINTMSG(AT_DEF_LINE(attr_idx), 571, Error,
01656 AT_DEF_COLUMN(attr_idx),
01657 AT_OBJ_NAME_PTR(attr_idx));
01658 }
01659 else {
01660 PRINTMSG(AT_DEF_LINE(attr_idx), 353, Error,
01661 AT_DEF_COLUMN(attr_idx),
01662 AT_OBJ_NAME_PTR(attr_idx));
01663 }
01664 }
01665 else if (TYP_TYPE(ATD_TYPE_IDX(attr_idx)) == Character &&
01666 TYP_CHAR_CLASS(ATD_TYPE_IDX(attr_idx)) == Var_Len_Char) {
01667 entry_list = merge_entry_lists(entry_list,
01668 ATD_NO_ENTRY_LIST(TYP_IDX(ATD_TYPE_IDX(attr_idx))));
01669
01670 if (entry_list != NULL_IDX &&
01671 (SCP_ALT_ENTRY_CNT(curr_scp_idx)+1) == AL_ENTRY_COUNT(entry_list)){
01672 PRINTMSG(AT_DEF_LINE(attr_idx), 662, Error,
01673 AT_DEF_COLUMN(attr_idx),
01674 AT_OBJ_NAME_PTR(attr_idx));
01675 AT_DCL_ERR(attr_idx) = TRUE;
01676 }
01677 }
01678 goto EXIT;
01679 }
01680
01681 if (BD_ARRAY_CLASS(bd_idx) == Assumed_Shape) {
01682
01683
01684
01685
01686
01687
01688 if (need_const_array) {
01689 goto EXIT;
01690 }
01691
01692
01693
01694 ATD_IM_A_DOPE(attr_idx) = TRUE;
01695
01696 if (!BD_RESOLVED(bd_idx)) {
01697 BD_RESOLVED(bd_idx) = TRUE;
01698 array_size_type = Constant_Size;
01699 length_entry_idx = NULL_IDX;
01700
01701 for (dim = 1; dim <= BD_RANK(bd_idx); dim++) {
01702
01703 if (BD_LB_FLD(bd_idx, dim) == AT_Tbl_Idx) {
01704 at_idx = BD_LB_IDX(bd_idx, dim);
01705
01706 if (ATD_CLASS(at_idx) == Constant) {
01707 BD_LB_FLD(bd_idx, dim) = CN_Tbl_Idx;
01708 BD_LB_IDX(bd_idx, dim) = ATD_CONST_IDX(at_idx);
01709 }
01710 else if (ATD_SYMBOLIC_CONSTANT(at_idx)) {
01711 array_size_type = Symbolic_Constant_Size;
01712 }
01713 else {
01714 length_entry_idx = merge_entry_lists(
01715 length_entry_idx,
01716 ATD_NO_ENTRY_LIST(BD_LB_IDX(bd_idx,dim)));
01717 array_size_type = Var_Len_Array;
01718 }
01719 }
01720 }
01721
01722 BD_ARRAY_SIZE(bd_idx) = array_size_type;
01723
01724 if (length_entry_idx != NULL_IDX) {
01725 entry_count = SCP_ALT_ENTRY_CNT(curr_scp_idx) + 1;
01726
01727 if (entry_count == AL_ENTRY_COUNT(length_entry_idx)) {
01728
01729
01730
01731
01732
01733
01734 PRINTMSG(AT_DEF_LINE(attr_idx), 660, Error,
01735 AT_DEF_COLUMN(attr_idx),
01736 AT_OBJ_NAME_PTR(attr_idx));
01737 AT_DCL_ERR(attr_idx) = TRUE;
01738 }
01739 else {
01740
01741 if (TYP_TYPE(ATD_TYPE_IDX(attr_idx)) == Character &&
01742 TYP_FLD(ATD_TYPE_IDX(attr_idx)) == AT_Tbl_Idx) {
01743
01744 length_entry_idx = merge_entry_lists(length_entry_idx,
01745 ATD_NO_ENTRY_LIST(TYP_IDX(ATD_TYPE_IDX(attr_idx))));
01746
01747 if (entry_count == AL_ENTRY_COUNT(length_entry_idx)) {
01748
01749
01750
01751
01752
01753 PRINTMSG(AT_DEF_LINE(attr_idx), 661, Error,
01754 AT_DEF_COLUMN(attr_idx),
01755 AT_OBJ_NAME_PTR(attr_idx));
01756 AT_DCL_ERR(attr_idx) = TRUE;
01757 }
01758 }
01759
01760 if (!AT_DCL_ERR(attr_idx) && entry_list != NULL_IDX) {
01761 length_entry_idx = merge_entry_lists(length_entry_idx,
01762 entry_list);
01763
01764 if (length_entry_idx != NULL_IDX &&
01765 entry_count == AL_ENTRY_COUNT(length_entry_idx)) {
01766
01767
01768
01769
01770 PRINTMSG(AT_DEF_LINE(attr_idx), 662, Error,
01771 AT_DEF_COLUMN(attr_idx),
01772 AT_OBJ_NAME_PTR(attr_idx));
01773 AT_DCL_ERR(attr_idx) = TRUE;
01774 }
01775 }
01776 }
01777 }
01778 }
01779
01780 if (ATD_CLASS(attr_idx) != Dummy_Argument || ATD_POINTER(attr_idx)) {
01781 AT_DCL_ERR(attr_idx) = TRUE;
01782 PRINTMSG(AT_DEF_LINE(attr_idx), 351, Error,
01783 AT_DEF_COLUMN(attr_idx),
01784 AT_OBJ_NAME_PTR(attr_idx));
01785 }
01786
01787 goto EXIT;
01788 }
01789
01790
01791
01792
01793
01794
01795 if (BD_RESOLVED(bd_idx)) {
01796 goto NEXT;
01797 }
01798
01799 array_size_type = Constant_Size;
01800
01801 for (dim = 1; dim <= BD_RANK(bd_idx); dim++) {
01802
01803 if (BD_LB_FLD(bd_idx, dim) == AT_Tbl_Idx) {
01804
01805 if (ATD_CLASS(BD_LB_IDX(bd_idx, dim)) == Constant) {
01806 BD_LB_FLD(bd_idx, dim) = CN_Tbl_Idx;
01807 BD_LB_IDX(bd_idx, dim) = ATD_CONST_IDX(BD_LB_IDX(bd_idx, dim));
01808 }
01809 else if (ATD_SYMBOLIC_CONSTANT(BD_LB_IDX(bd_idx, dim))) {
01810 array_size_type = Symbolic_Constant_Size;
01811 }
01812 else {
01813 array_size_type = Var_Len_Array;
01814 OPND_FLD(opnd) = BD_LB_FLD(bd_idx, dim);
01815 OPND_IDX(opnd) = BD_LB_IDX(bd_idx, dim);
01816 OPND_LINE_NUM(opnd) = BD_LINE_NUM(bd_idx);
01817 OPND_COL_NUM(opnd) = BD_COLUMN_NUM(bd_idx);
01818 }
01819 }
01820
01821 if (BD_UB_FLD(bd_idx, dim) == AT_Tbl_Idx) {
01822
01823 if (ATD_CLASS(BD_UB_IDX(bd_idx, dim)) == Constant) {
01824 BD_UB_FLD(bd_idx, dim) = CN_Tbl_Idx;
01825 BD_UB_IDX(bd_idx, dim) = ATD_CONST_IDX(BD_UB_IDX(bd_idx, dim));
01826 }
01827 else if (ATD_SYMBOLIC_CONSTANT(BD_UB_IDX(bd_idx, dim))) {
01828
01829 if (array_size_type != Var_Len_Array) {
01830 array_size_type = Symbolic_Constant_Size;
01831 }
01832 }
01833 else {
01834 array_size_type = Var_Len_Array;
01835 OPND_FLD(opnd) = BD_UB_FLD(bd_idx, dim);
01836 OPND_IDX(opnd) = BD_UB_IDX(bd_idx, dim);
01837 OPND_LINE_NUM(opnd) = BD_LINE_NUM(bd_idx);
01838 OPND_COL_NUM(opnd) = BD_COLUMN_NUM(bd_idx);
01839 }
01840 }
01841 }
01842
01843 if (BD_ARRAY_CLASS(bd_idx) == Assumed_Size) {
01844
01845
01846
01847
01848
01849
01850 if (need_const_array) {
01851 goto EXIT;
01852 }
01853
01854 BD_ARRAY_SIZE(bd_idx) = array_size_type;
01855 }
01856 else {
01857 BD_ARRAY_SIZE(bd_idx) = array_size_type;
01858
01859 if (array_size_type == Var_Len_Array) {
01860
01861 BD_ARRAY_SIZE(bd_idx) = Var_Len_Array;
01862
01863
01864
01865
01866
01867
01868 if (need_const_array) {
01869 goto EXIT;
01870 }
01871
01872 if (ATP_PGM_UNIT(SCP_ATTR_IDX(curr_scp_idx)) != Function &&
01873 ATP_PGM_UNIT(SCP_ATTR_IDX(curr_scp_idx)) != Subroutine) {
01874 PRINTMSG(AT_DEF_LINE(attr_idx), 131, Error,
01875 AT_DEF_COLUMN(attr_idx),
01876 AT_OBJ_NAME_PTR(attr_idx));
01877 BD_DCL_ERR(bd_idx) = TRUE;
01878 }
01879 }
01880 }
01881
01882 BD_RESOLVED(bd_idx) = TRUE;
01883
01884 set_stride_for_first_dim(ATD_TYPE_IDX(attr_idx), &stride);
01885
01886 if (TYP_TYPE(ATD_TYPE_IDX(attr_idx)) == Character &&
01887 stride.fld == AT_Tbl_Idx &&
01888 ATD_NO_ENTRY_LIST(stride.idx) != NULL_IDX) {
01889 stride_entry_idx = merge_entry_lists(NULL_IDX,
01890 ATD_NO_ENTRY_LIST(stride.idx));
01891 }
01892 else {
01893 stride_entry_idx = NULL_IDX;
01894 }
01895
01896 NTR_IR_TBL(len_ir_idx);
01897 IR_TYPE_IDX(len_ir_idx) = SA_INTEGER_DEFAULT_TYPE;
01898
01899 BD_LEN_IDX(bd_idx) = len_ir_idx;
01900 BD_LEN_FLD(bd_idx) = IR_Tbl_Idx;
01901 length_entry_idx = NULL_IDX;
01902 line = BD_LINE_NUM(bd_idx);
01903 column = BD_COLUMN_NUM(bd_idx);
01904
01905 for (dim = 1; dim <= BD_RANK(bd_idx); dim++) {
01906 BD_SM_FLD(bd_idx, dim) = stride.fld;
01907 BD_SM_IDX(bd_idx, dim) = stride.idx;
01908
01909 if (extent_entry_idx != NULL_IDX) {
01910 free_attr_list(extent_entry_idx);
01911 extent_entry_idx = NULL_IDX;
01912 }
01913
01914 if (BD_LB_FLD(bd_idx, dim) == AT_Tbl_Idx) {
01915 at_idx = BD_LB_IDX(bd_idx, dim);
01916
01917 if (ATD_NO_ENTRY_LIST(at_idx) != NULL_IDX) {
01918 extent_entry_idx = merge_entry_lists(NULL_IDX,
01919 ATD_NO_ENTRY_LIST(at_idx));
01920 }
01921 }
01922
01923 if (BD_UB_FLD(bd_idx, dim) == AT_Tbl_Idx) {
01924 at_idx = BD_UB_IDX(bd_idx, dim);
01925
01926 if (ATD_NO_ENTRY_LIST(at_idx) != NULL_IDX) {
01927 extent_entry_idx = merge_entry_lists(extent_entry_idx,
01928 ATD_NO_ENTRY_LIST(at_idx));
01929 }
01930 }
01931
01932 if (BD_LB_FLD(bd_idx, dim) == CN_Tbl_Idx &&
01933 fold_relationals(BD_LB_IDX(bd_idx, dim),
01934 CN_INTEGER_ONE_IDX,
01935 Eq_Opr)) {
01936
01937
01938
01939 extent_fld = BD_UB_FLD(bd_idx, dim);
01940 extent_idx = BD_UB_IDX(bd_idx, dim);
01941 }
01942 else {
01943 NTR_IR_TBL(ir_idx);
01944 IR_OPR(ir_idx) = Minus_Opr;
01945 IR_TYPE_IDX(ir_idx) = SA_INTEGER_DEFAULT_TYPE;
01946 IR_FLD_L(ir_idx) = CN_Tbl_Idx;
01947 IR_IDX_L(ir_idx) = CN_INTEGER_ONE_IDX;
01948 IR_LINE_NUM_L(ir_idx) = line;
01949 IR_COL_NUM_L(ir_idx) = column;
01950 IR_FLD_R(ir_idx) = BD_LB_FLD(bd_idx, dim);
01951 IR_IDX_R(ir_idx) = BD_LB_IDX(bd_idx, dim);
01952 IR_LINE_NUM_R(ir_idx) = line;
01953 IR_COL_NUM_R(ir_idx) = column;
01954 IR_LINE_NUM(ir_idx) = line;
01955 IR_COL_NUM(ir_idx) = column;
01956
01957 NTR_IR_TBL(next_ir_idx);
01958 IR_OPR(next_ir_idx) = Plus_Opr;
01959 IR_TYPE_IDX(next_ir_idx) = SA_INTEGER_DEFAULT_TYPE;
01960 IR_IDX_L(next_ir_idx) = BD_UB_IDX(bd_idx, dim);
01961 IR_FLD_L(next_ir_idx) = BD_UB_FLD(bd_idx, dim);
01962 IR_LINE_NUM_L(next_ir_idx) = line;
01963 IR_COL_NUM_L(next_ir_idx) = column;
01964 IR_FLD_R(next_ir_idx) = IR_Tbl_Idx;
01965 IR_IDX_R(next_ir_idx) = ir_idx;
01966 IR_LINE_NUM_R(next_ir_idx) = line;
01967 IR_COL_NUM_R(next_ir_idx) = column;
01968 IR_LINE_NUM(next_ir_idx) = line;
01969 IR_COL_NUM(next_ir_idx) = column;
01970
01971 if (BD_ARRAY_SIZE(bd_idx) == Symbolic_Constant_Size) {
01972 IR_OPR(next_ir_idx) = Symbolic_Plus_Opr;
01973 IR_OPR(ir_idx) = Symbolic_Minus_Opr;
01974 extent_idx = gen_compiler_tmp(line, column, Priv, TRUE);
01975 extent_fld = AT_Tbl_Idx;
01976
01977 ATD_SYMBOLIC_CONSTANT(extent_idx) = TRUE;
01978 ATD_TYPE_IDX(extent_idx) = SA_INTEGER_DEFAULT_TYPE;
01979 ATD_FLD(extent_idx) = IR_Tbl_Idx;
01980 ATD_TMP_IDX(extent_idx) = next_ir_idx;
01981
01982
01983
01984
01985 }
01986 else {
01987
01988 OPND_FLD(opnd) = IR_Tbl_Idx;
01989 OPND_IDX(opnd) = next_ir_idx;
01990 OPND_LINE_NUM(opnd) = stmt_start_line;
01991 OPND_COL_NUM(opnd) = stmt_start_col;
01992
01993 sh_idx = ntr_sh_tbl();
01994 SH_GLB_LINE(sh_idx) = stmt_start_line;
01995 SH_COL_NUM(sh_idx) = stmt_start_col;
01996 SH_STMT_TYPE(sh_idx) = Automatic_Base_Size_Stmt;
01997 SH_COMPILER_GEN(sh_idx) = TRUE;
01998 SH_P2_SKIP_ME(sh_idx) = TRUE;
01999
02000 expr_desc.rank = 0;
02001 xref_state = CIF_No_Usage_Rec;
02002
02003
02004
02005
02006 issue_overflow_msg_719 = FALSE;
02007
02008 if (!expr_semantics(&opnd, &expr_desc)) {
02009
02010 if (need_to_issue_719) {
02011
02012 need_to_issue_719 = FALSE;
02013 PRINTMSG(AT_DEF_LINE(attr_idx), 951, Error,
02014 AT_DEF_COLUMN(attr_idx),
02015 dim,
02016 AT_OBJ_NAME_PTR(attr_idx));
02017 }
02018 AT_DCL_ERR(attr_idx) = TRUE;
02019 }
02020
02021 if (OPND_FLD(opnd) == CN_Tbl_Idx) {
02022 extent_fld = CN_Tbl_Idx;
02023 extent_idx = OPND_IDX(opnd);
02024 FREE_SH_NODE(sh_idx);
02025 }
02026 else {
02027 extent_fld = AT_Tbl_Idx;
02028 extent_idx = ntr_bnds_sh_tmp_list(&opnd,
02029 extent_entry_idx,
02030 is_interface ? NULL_IDX:sh_idx,
02031 FALSE,
02032 SA_INTEGER_DEFAULT_TYPE);
02033 }
02034 }
02035 }
02036
02037 if (extent_fld == CN_Tbl_Idx) {
02038
02039 if (compare_cn_and_value(extent_idx, 0, Lt_Opr)) {
02040 extent_idx = CN_INTEGER_ZERO_IDX;
02041 }
02042 }
02043 else {
02044
02045 OPND_FLD(opnd) = extent_fld;
02046 OPND_IDX(opnd) = extent_idx;
02047 OPND_LINE_NUM(opnd) = line;
02048 OPND_COL_NUM(opnd) = column;
02049
02050 gen_tmp_equal_max_zero(&opnd,
02051 SA_INTEGER_DEFAULT_TYPE,
02052 extent_entry_idx,
02053 (BD_ARRAY_SIZE(bd_idx)==Symbolic_Constant_Size),
02054 is_interface);
02055 extent_fld = OPND_FLD(opnd);
02056 extent_idx = OPND_IDX(opnd);
02057 }
02058
02059 BD_XT_FLD(bd_idx, dim) = extent_fld;
02060 BD_XT_IDX(bd_idx, dim) = extent_idx;
02061
02062
02063
02064
02065
02066 if (dim < BD_RANK(bd_idx)) {
02067 NTR_IR_TBL(ir_idx);
02068 IR_OPR(ir_idx) = Mult_Opr;
02069 IR_TYPE_IDX(ir_idx) = SA_INTEGER_DEFAULT_TYPE;
02070 IR_LINE_NUM(ir_idx) = BD_LINE_NUM(bd_idx);
02071 IR_COL_NUM(ir_idx) = BD_COLUMN_NUM(bd_idx);
02072 IR_FLD_L(ir_idx) = stride.fld;
02073 IR_IDX_L(ir_idx) = stride.idx;
02074 IR_LINE_NUM_L(ir_idx) = BD_LINE_NUM(bd_idx);
02075 IR_COL_NUM_L(ir_idx) = BD_COLUMN_NUM(bd_idx);
02076 IR_FLD_R(ir_idx) = extent_fld;
02077 IR_IDX_R(ir_idx) = extent_idx;
02078 IR_LINE_NUM_R(ir_idx) = BD_LINE_NUM(bd_idx);
02079 IR_COL_NUM_R(ir_idx) = BD_COLUMN_NUM(bd_idx);
02080
02081 if (BD_ARRAY_SIZE(bd_idx) == Symbolic_Constant_Size) {
02082 IR_OPR(ir_idx) = Symbolic_Mult_Opr;
02083 stride.fld = AT_Tbl_Idx;
02084 stride.idx = gen_compiler_tmp(line, column, Priv, TRUE);
02085
02086 ATD_TYPE_IDX(stride.idx) = SA_INTEGER_DEFAULT_TYPE;
02087 ATD_FLD(stride.idx) = IR_Tbl_Idx;
02088 ATD_TMP_IDX(stride.idx) = ir_idx;
02089 ATD_SYMBOLIC_CONSTANT(stride.idx) = TRUE;
02090 }
02091 else {
02092 OPND_FLD(opnd) = IR_Tbl_Idx;
02093 OPND_IDX(opnd) = ir_idx;
02094 OPND_LINE_NUM(opnd) = stmt_start_line;
02095 OPND_COL_NUM(opnd) = stmt_start_col;
02096
02097 sh_idx = ntr_sh_tbl();
02098 SH_STMT_TYPE(sh_idx) = Automatic_Base_Size_Stmt;
02099 SH_COMPILER_GEN(sh_idx) = TRUE;
02100 SH_P2_SKIP_ME(sh_idx) = TRUE;
02101 SH_GLB_LINE(sh_idx) = stmt_start_line;
02102 SH_COL_NUM(sh_idx) = stmt_start_col;
02103
02104 expr_desc.rank = 0;
02105 xref_state = CIF_No_Usage_Rec;
02106
02107 expr_semantics(&opnd, &expr_desc);
02108
02109 if (OPND_FLD(opnd) == CN_Tbl_Idx) {
02110 stride.fld = CN_Tbl_Idx;
02111 stride.idx = OPND_IDX(opnd);
02112 FREE_SH_NODE(sh_idx);
02113 }
02114 else {
02115
02116 if (!is_interface) {
02117
02118
02119
02120 if (extent_entry_idx != NULL_IDX) {
02121 stride_entry_idx = merge_entry_lists(stride_entry_idx,
02122 extent_entry_idx);
02123 length_entry_idx = merge_entry_lists(length_entry_idx,
02124 extent_entry_idx);
02125 }
02126 }
02127
02128 stride.fld = AT_Tbl_Idx;
02129 stride.idx = ntr_bnds_sh_tmp_list(&opnd,
02130 stride_entry_idx,
02131 (is_interface) ? NULL_IDX: sh_idx,
02132 FALSE,
02133 SA_INTEGER_DEFAULT_TYPE);
02134 }
02135 }
02136
02137 NTR_IR_TBL(mult_idx);
02138 IR_LINE_NUM(mult_idx) = BD_LINE_NUM(bd_idx);
02139 IR_COL_NUM(mult_idx) = BD_COLUMN_NUM(bd_idx);
02140
02141 if (BD_ARRAY_SIZE(bd_idx) == Symbolic_Constant_Size) {
02142 IR_OPR(mult_idx) = Symbolic_Mult_Opr;
02143 }
02144 else {
02145 IR_OPR(mult_idx) = Mult_Opr;
02146 }
02147
02148 IR_TYPE_IDX(mult_idx) = SA_INTEGER_DEFAULT_TYPE;
02149 IR_IDX_R(len_ir_idx) = mult_idx;
02150 IR_FLD_R(len_ir_idx) = IR_Tbl_Idx;
02151 IR_LINE_NUM_R(len_ir_idx) = BD_LINE_NUM(bd_idx);
02152 IR_COL_NUM_R(len_ir_idx) = BD_COLUMN_NUM(bd_idx);
02153 IR_IDX_L(mult_idx) = extent_idx;
02154 IR_FLD_L(mult_idx) = extent_fld;
02155 IR_LINE_NUM_L(mult_idx) = BD_LINE_NUM(bd_idx);
02156 IR_COL_NUM_L(mult_idx) = BD_COLUMN_NUM(bd_idx);
02157 len_ir_idx = mult_idx;
02158 }
02159 else if (dim == 1) {
02160
02161
02162
02163 BD_LEN_FLD(bd_idx) = extent_fld;
02164 BD_LEN_IDX(bd_idx) = extent_idx;
02165 length_entry_idx = extent_entry_idx;
02166 stride_entry_idx = merge_entry_lists(stride_entry_idx,
02167 extent_entry_idx);
02168 extent_entry_idx = NULL_IDX;
02169
02170 if (length_entry_idx != NULL_IDX) {
02171 gen_tmp_eq_zero_ir(extent_idx);
02172 }
02173 }
02174
02175
02176
02177 else if (BD_ARRAY_SIZE(bd_idx) == Symbolic_Constant_Size) {
02178 IR_IDX_R(len_ir_idx) = extent_idx;
02179 IR_FLD_R(len_ir_idx) = extent_fld;
02180 IR_LINE_NUM_R(len_ir_idx) = BD_LINE_NUM(bd_idx);
02181 IR_COL_NUM_R(len_ir_idx) = BD_COLUMN_NUM(bd_idx);
02182 OPND_FLD(opnd) = IR_FLD_R(BD_LEN_IDX(bd_idx));
02183 OPND_IDX(opnd) = IR_IDX_R(BD_LEN_IDX(bd_idx));
02184
02185 BD_LEN_FLD(bd_idx) = AT_Tbl_Idx;
02186 BD_LEN_IDX(bd_idx) = gen_compiler_tmp(line, column, Priv, TRUE);
02187
02188 ATD_TYPE_IDX(BD_LEN_IDX(bd_idx)) = SA_INTEGER_DEFAULT_TYPE;
02189 ATD_FLD(BD_LEN_IDX(bd_idx)) = OPND_FLD(opnd);
02190 ATD_TMP_IDX(BD_LEN_IDX(bd_idx)) = OPND_IDX(opnd);
02191
02192 ATD_SYMBOLIC_CONSTANT(BD_LEN_IDX(bd_idx)) = TRUE;
02193 }
02194 else {
02195 IR_IDX_R(len_ir_idx) = extent_idx;
02196 IR_FLD_R(len_ir_idx) = extent_fld;
02197 IR_LINE_NUM_R(len_ir_idx) = BD_LINE_NUM(bd_idx);
02198 IR_COL_NUM_R(len_ir_idx) = BD_COLUMN_NUM(bd_idx);
02199 OPND_FLD(opnd) = IR_FLD_R(BD_LEN_IDX(bd_idx));
02200 OPND_IDX(opnd) = IR_IDX_R(BD_LEN_IDX(bd_idx));
02201 OPND_LINE_NUM(opnd) = BD_LINE_NUM(bd_idx);
02202 OPND_COL_NUM(opnd) = BD_COLUMN_NUM(bd_idx);
02203
02204 sh_idx = ntr_sh_tbl();
02205 SH_STMT_TYPE(sh_idx) = Automatic_Base_Size_Stmt;
02206 SH_COMPILER_GEN(sh_idx) = TRUE;
02207 SH_P2_SKIP_ME(sh_idx) = TRUE;
02208 SH_GLB_LINE(sh_idx) = stmt_start_line;
02209 SH_COL_NUM(sh_idx) = stmt_start_col;
02210
02211
02212
02213
02214 expr_desc.rank = 0;
02215 xref_state = CIF_No_Usage_Rec;
02216
02217 # if defined(_CHECK_MAX_MEMORY)
02218
02219 if (!target_t3e) {
02220 issue_overflow_msg_719 = FALSE;
02221 }
02222 # endif
02223
02224 if (!expr_semantics(&opnd, &expr_desc)) {
02225
02226 if (need_to_issue_719) {
02227
02228
02229
02230 if (OPND_FLD(opnd) == IR_Tbl_Idx) {
02231 IR_TYPE_IDX(OPND_IDX(opnd)) = SA_INTEGER_DEFAULT_TYPE;
02232
02233 switch (IR_FLD_L(OPND_IDX(opnd))) {
02234 case AT_Tbl_Idx:
02235 type = TYP_LINEAR(ATD_TYPE_IDX(IR_IDX_L(OPND_IDX(opnd))));
02236 break;
02237
02238 case IR_Tbl_Idx:
02239 type = TYP_LINEAR(IR_TYPE_IDX(IR_IDX_L(OPND_IDX(opnd))));
02240 break;
02241
02242 case CN_Tbl_Idx:
02243 type = TYP_LINEAR(CN_TYPE_IDX(IR_IDX_L(OPND_IDX(opnd))));
02244 break;
02245 }
02246
02247 if (type < SA_INTEGER_DEFAULT_TYPE) {
02248 NTR_IR_TBL(cvrt_idx);
02249 IR_OPR(cvrt_idx) = Cvrt_Opr;
02250 IR_TYPE_IDX(cvrt_idx) = SA_INTEGER_DEFAULT_TYPE;
02251 IR_LINE_NUM(cvrt_idx) = BD_LINE_NUM(bd_idx);
02252 IR_COL_NUM(cvrt_idx) = BD_COLUMN_NUM(bd_idx);
02253 COPY_OPND(IR_OPND_L(cvrt_idx), IR_OPND_L(OPND_IDX(opnd)));
02254 IR_FLD_L(OPND_IDX(opnd)) = IR_Tbl_Idx;
02255 IR_IDX_L(OPND_IDX(opnd)) = cvrt_idx;
02256 }
02257
02258 switch (IR_FLD_R(OPND_IDX(opnd))) {
02259 case AT_Tbl_Idx:
02260 type = TYP_LINEAR(ATD_TYPE_IDX(IR_IDX_R(OPND_IDX(opnd))));
02261 break;
02262
02263 case IR_Tbl_Idx:
02264 type = TYP_LINEAR(IR_TYPE_IDX(IR_IDX_R(OPND_IDX(opnd))));
02265 break;
02266
02267 case CN_Tbl_Idx:
02268 type = TYP_LINEAR(CN_TYPE_IDX(IR_IDX_R(OPND_IDX(opnd))));
02269 break;
02270 }
02271
02272 if (type < SA_INTEGER_DEFAULT_TYPE) {
02273 NTR_IR_TBL(cvrt_idx);
02274 IR_OPR(cvrt_idx) = Cvrt_Opr;
02275 IR_TYPE_IDX(cvrt_idx) = SA_INTEGER_DEFAULT_TYPE;
02276 IR_LINE_NUM(cvrt_idx) = BD_LINE_NUM(bd_idx);
02277 IR_COL_NUM(cvrt_idx) = BD_COLUMN_NUM(bd_idx);
02278 COPY_OPND(IR_OPND_L(cvrt_idx), IR_OPND_R(OPND_IDX(opnd)));
02279 IR_FLD_R(OPND_IDX(opnd)) = IR_Tbl_Idx;
02280 IR_IDX_R(OPND_IDX(opnd)) = cvrt_idx;
02281 }
02282 need_to_issue_719 = FALSE;
02283 }
02284
02285 if (!expr_semantics(&opnd, &expr_desc)) {
02286
02287 if (!target_t3e) {
02288 AT_DCL_ERR(attr_idx) = TRUE;
02289 }
02290 }
02291 }
02292 else if (!target_t3e) {
02293 AT_DCL_ERR(attr_idx) = TRUE;
02294 }
02295
02296 if (need_to_issue_719) {
02297 need_to_issue_719 = FALSE;
02298 AT_DCL_ERR(attr_idx) = TRUE;
02299 ISSUE_STORAGE_SIZE_EXCEEDED_MSG(attr_idx, Error);
02300 }
02301 }
02302
02303 if (OPND_FLD(opnd) == CN_Tbl_Idx) {
02304 BD_LEN_FLD(bd_idx) = CN_Tbl_Idx;
02305 BD_LEN_IDX(bd_idx) = OPND_IDX(opnd);
02306 FREE_SH_NODE(sh_idx);
02307 }
02308 else {
02309
02310 if (!is_interface) {
02311
02312 if (extent_entry_idx != NULL_IDX) {
02313 stride_entry_idx = merge_entry_lists(stride_entry_idx,
02314 extent_entry_idx);
02315 length_entry_idx = merge_entry_lists(length_entry_idx,
02316 extent_entry_idx);
02317 }
02318 }
02319
02320 length_idx = ntr_bnds_sh_tmp_list(&opnd,
02321 length_entry_idx,
02322 (is_interface) ? NULL_IDX:sh_idx,
02323 TRUE,
02324 SA_INTEGER_DEFAULT_TYPE);
02325 BD_LEN_IDX(bd_idx) = length_idx;
02326 BD_LEN_FLD(bd_idx) = AT_Tbl_Idx;
02327 }
02328 }
02329 }
02330
02331
02332
02333
02334
02335
02336
02337
02338 if (stride_entry_idx != NULL_IDX) {
02339 entry_count = SCP_ALT_ENTRY_CNT(curr_scp_idx) + 1;
02340
02341 if (length_entry_idx != NULL_IDX &&
02342 entry_count == AL_ENTRY_COUNT(length_entry_idx)) {
02343
02344
02345
02346
02347
02348
02349 PRINTMSG(AT_DEF_LINE(attr_idx), 660, Error,
02350 AT_DEF_COLUMN(attr_idx),
02351 AT_OBJ_NAME_PTR(attr_idx));
02352 AT_DCL_ERR(attr_idx) = TRUE;
02353 }
02354 else if (entry_count == AL_ENTRY_COUNT(stride_entry_idx)) {
02355
02356
02357
02358
02359
02360
02361
02362
02363 PRINTMSG(AT_DEF_LINE(attr_idx), 661, Error,
02364 AT_DEF_COLUMN(attr_idx),
02365 AT_OBJ_NAME_PTR(attr_idx));
02366 AT_DCL_ERR(attr_idx) = TRUE;
02367 }
02368 else if (entry_list != NULL_IDX) {
02369 stride_entry_count = merge_entry_list_count(stride_entry_idx,
02370 entry_list);
02371
02372 if (entry_count == stride_entry_count) {
02373
02374
02375
02376
02377 PRINTMSG(AT_DEF_LINE(attr_idx), 662, Error,
02378 AT_DEF_COLUMN(attr_idx),
02379 AT_OBJ_NAME_PTR(attr_idx));
02380 AT_DCL_ERR(attr_idx) = TRUE;
02381 }
02382 }
02383 }
02384
02385 NEXT:
02386
02387
02388
02389
02390
02391 if (BD_ARRAY_CLASS(bd_idx) == Explicit_Shape &&
02392 BD_ARRAY_SIZE(bd_idx) == Constant_Size) {
02393
02394
02395
02396
02397
02398
02399 stor_bit_size_of(attr_idx, TRUE, TRUE);
02400 }
02401 else if (need_const_array) {
02402
02403
02404
02405
02406
02407
02408 }
02409 else {
02410
02411 if (BD_ARRAY_SIZE(bd_idx) == Symbolic_Constant_Size) {
02412 fnd_semantic_err(Obj_Sym_Constant_Arr,
02413 AT_DEF_LINE(attr_idx),
02414 AT_DEF_COLUMN(attr_idx),
02415 attr_idx,
02416 TRUE);
02417
02418 if (ATD_STOR_BLK_IDX(attr_idx) != NULL_IDX) {
02419 SB_BLK_HAS_NPES(ATD_STOR_BLK_IDX(attr_idx)) = TRUE;
02420 }
02421
02422 if (cmd_line_flags.malleable) {
02423 PRINTMSG(AT_DEF_LINE(attr_idx), 1232, Error,
02424 AT_DEF_COLUMN(attr_idx));
02425 }
02426 }
02427
02428 if (BD_ARRAY_CLASS(bd_idx) == Assumed_Size) {
02429
02430
02431
02432
02433
02434
02435 if (ATD_CLASS(attr_idx) == CRI__Pointee) {
02436
02437 if (ATP_PGM_UNIT(SCP_ATTR_IDX(curr_scp_idx)) == Module) {
02438 AT_DCL_ERR(attr_idx) = TRUE;
02439 PRINTMSG(AT_DEF_LINE(attr_idx), 1419, Error,
02440 AT_DEF_COLUMN(attr_idx),
02441 AT_OBJ_NAME_PTR(attr_idx));
02442 }
02443 }
02444 else if (ATD_CLASS(attr_idx) != Dummy_Argument) {
02445
02446
02447
02448 if (TYP_TYPE(ATD_TYPE_IDX(attr_idx)) == Character) {
02449 AT_DCL_ERR(attr_idx) = TRUE;
02450 PRINTMSG(AT_DEF_LINE(attr_idx), 501, Error,
02451 AT_DEF_COLUMN(attr_idx),
02452 AT_OBJ_NAME_PTR(attr_idx));
02453 }
02454 else {
02455 AT_DCL_ERR(attr_idx) = TRUE;
02456 PRINTMSG(AT_DEF_LINE(attr_idx), 500, Error,
02457 AT_DEF_COLUMN(attr_idx),
02458 AT_OBJ_NAME_PTR(attr_idx));
02459 }
02460 }
02461
02462 # if defined(_TARGET_OS_MAX)
02463 if (ATD_PE_ARRAY_IDX(attr_idx) != NULL_IDX) {
02464 AT_DCL_ERR(attr_idx) = TRUE;
02465 PRINTMSG(BD_LINE_NUM(ATD_PE_ARRAY_IDX(attr_idx)), 1583, Error,
02466 BD_COLUMN_NUM(ATD_PE_ARRAY_IDX(attr_idx)),
02467 "co-array dimensions",
02468 "assumed-size arrays");
02469 }
02470 # endif
02471 }
02472 else if (BD_ARRAY_SIZE(bd_idx) == Var_Len_Array) {
02473 fnd_semantic_err(Obj_Var_Len_Arr,
02474 AT_DEF_LINE(attr_idx),
02475 AT_DEF_COLUMN(attr_idx),
02476 attr_idx,
02477 TRUE);
02478
02479 if (ATD_CLASS(attr_idx) == Variable) {
02480
02481 if (ATD_PE_ARRAY_IDX(attr_idx) != NULL_IDX) {
02482 AT_DCL_ERR(attr_idx) = TRUE;
02483 PRINTMSG(AT_DEF_LINE(attr_idx), 1577, Error,
02484 AT_DEF_COLUMN(attr_idx),
02485 AT_OBJ_NAME_PTR(attr_idx));
02486 }
02487 else {
02488 ATD_AUTOMATIC(attr_idx) = TRUE;
02489 }
02490
02491 if (stride_entry_idx != NULL_IDX) {
02492 PRINTMSG(AT_DEF_LINE(attr_idx), 1046, Caution,
02493 AT_DEF_COLUMN(attr_idx),
02494 AT_OBJ_NAME_PTR(attr_idx));
02495 }
02496 }
02497 }
02498 }
02499
02500
02501 EXIT:
02502
02503 if (stride_entry_idx != NULL_IDX) {
02504 free_attr_list(stride_entry_idx);
02505 }
02506
02507 if (length_entry_idx != NULL_IDX) {
02508 free_attr_list(length_entry_idx);
02509 }
02510
02511 if (ATD_CLASS(attr_idx) == Function_Result) {
02512 ATP_NO_ENTRY_LIST(ATD_FUNC_IDX(attr_idx)) = entry_list;
02513 }
02514 else {
02515 ATD_NO_ENTRY_LIST(attr_idx) = entry_list;
02516 }
02517
02518 TRACE (Func_Exit, "array_dim_resolution", NULL);
02519
02520 return;
02521
02522 }
02523
02524
02525
02526
02527
02528
02529
02530
02531
02532
02533
02534
02535
02536
02537
02538
02539
02540
02541 void pe_array_dim_resolution(int attr_idx)
02542
02543 {
02544 bd_array_size_type array_size_type;
02545 int at_idx;
02546 int bd_idx;
02547 int dim;
02548 int entry_count;
02549 int entry_list;
02550 expr_arg_type expr_desc;
02551 int extent_entry_idx = NULL_IDX;
02552 fld_type extent_fld;
02553 int extent_idx;
02554 int ir_idx;
02555 boolean is_interface;
02556 int len_ir_idx;
02557 int length_idx;
02558 int length_entry_idx = NULL_IDX;
02559 int mult_idx;
02560 int next_ir_idx;
02561 opnd_type opnd;
02562 int sh_idx;
02563 int stride_entry_idx = NULL_IDX;
02564 int stride_entry_count;
02565 size_offset_type stride;
02566
02567
02568 TRACE (Func_Entry, "pe_array_dim_resolution", NULL);
02569
02570 is_interface = SCP_IS_INTERFACE(curr_scp_idx);
02571 bd_idx = ATD_PE_ARRAY_IDX(attr_idx);
02572
02573 if (ATD_CLASS(attr_idx) == Function_Result) {
02574 entry_list = ATP_NO_ENTRY_LIST(ATD_FUNC_IDX(attr_idx));
02575 }
02576 else {
02577 entry_list = ATD_NO_ENTRY_LIST(attr_idx);
02578 }
02579
02580 if (BD_ARRAY_CLASS(bd_idx) == Deferred_Shape) {
02581
02582 if (! ATD_ALLOCATABLE(attr_idx)) {
02583 PRINTMSG(AT_DEF_LINE(attr_idx), 1587, Error, AT_DEF_COLUMN(attr_idx),
02584 AT_OBJ_NAME_PTR(attr_idx));
02585 BD_DCL_ERR(bd_idx) = TRUE;
02586 AT_DCL_ERR(attr_idx) = TRUE;
02587 }
02588
02589 goto EXIT;
02590 }
02591
02592
02593
02594
02595
02596
02597 if (BD_RESOLVED(bd_idx)) {
02598 goto NEXT;
02599 }
02600
02601 array_size_type = Constant_Size;
02602
02603 for (dim = 1; dim <= BD_RANK(bd_idx); dim++) {
02604
02605 if (BD_LB_FLD(bd_idx, dim) == AT_Tbl_Idx) {
02606
02607 if (ATD_CLASS(BD_LB_IDX(bd_idx, dim)) == Constant) {
02608 BD_LB_FLD(bd_idx, dim) = CN_Tbl_Idx;
02609 BD_LB_IDX(bd_idx, dim) = ATD_CONST_IDX(BD_LB_IDX(bd_idx, dim));
02610 }
02611 else if (ATD_SYMBOLIC_CONSTANT(BD_LB_IDX(bd_idx, dim))) {
02612 array_size_type = Symbolic_Constant_Size;
02613 }
02614 else {
02615 array_size_type = Var_Len_Array;
02616 }
02617 }
02618
02619 if (BD_UB_FLD(bd_idx, dim) == AT_Tbl_Idx) {
02620
02621 if (ATD_CLASS(BD_UB_IDX(bd_idx, dim)) == Constant) {
02622 BD_UB_FLD(bd_idx, dim) = CN_Tbl_Idx;
02623 BD_UB_IDX(bd_idx, dim) = ATD_CONST_IDX(BD_UB_IDX(bd_idx, dim));
02624 }
02625 else if (ATD_SYMBOLIC_CONSTANT(BD_UB_IDX(bd_idx, dim))) {
02626
02627 if (array_size_type != Var_Len_Array) {
02628 array_size_type = Symbolic_Constant_Size;
02629 }
02630 }
02631 else {
02632 array_size_type = Var_Len_Array;
02633 }
02634 }
02635 }
02636
02637 if (BD_ARRAY_CLASS(bd_idx) == Assumed_Size) {
02638
02639
02640
02641
02642
02643
02644 BD_ARRAY_SIZE(bd_idx) = array_size_type;
02645 }
02646 else {
02647 BD_ARRAY_SIZE(bd_idx) = array_size_type;
02648
02649 if (array_size_type == Var_Len_Array) {
02650
02651 BD_ARRAY_SIZE(bd_idx) = Var_Len_Array;
02652
02653
02654
02655
02656
02657
02658 if (ATP_PGM_UNIT(SCP_ATTR_IDX(curr_scp_idx)) != Function &&
02659 ATP_PGM_UNIT(SCP_ATTR_IDX(curr_scp_idx)) != Subroutine) {
02660 PRINTMSG(AT_DEF_LINE(attr_idx), 131, Error,
02661 AT_DEF_COLUMN(attr_idx),
02662 AT_OBJ_NAME_PTR(attr_idx));
02663 BD_DCL_ERR(bd_idx) = TRUE;
02664 }
02665 }
02666 }
02667
02668 BD_RESOLVED(bd_idx) = TRUE;
02669
02670
02671
02672 stride.fld = CN_Tbl_Idx;
02673 stride.idx = CN_INTEGER_ONE_IDX;
02674
02675 stride_entry_idx = NULL_IDX;
02676
02677 NTR_IR_TBL(len_ir_idx);
02678 IR_TYPE_IDX(len_ir_idx) = INTEGER_DEFAULT_TYPE;
02679
02680 BD_LEN_IDX(bd_idx) = len_ir_idx;
02681 BD_LEN_FLD(bd_idx) = IR_Tbl_Idx;
02682 length_entry_idx = NULL_IDX;
02683
02684 for (dim = 1; dim <= BD_RANK(bd_idx); dim++) {
02685 BD_SM_FLD(bd_idx, dim) = stride.fld;
02686 BD_SM_IDX(bd_idx, dim) = stride.idx;
02687
02688 if (extent_entry_idx != NULL_IDX) {
02689 free_attr_list(extent_entry_idx);
02690 extent_entry_idx = NULL_IDX;
02691 }
02692
02693 if (BD_LB_FLD(bd_idx, dim) == AT_Tbl_Idx) {
02694 at_idx = BD_LB_IDX(bd_idx, dim);
02695
02696 if (ATD_NO_ENTRY_LIST(at_idx) != NULL_IDX) {
02697 extent_entry_idx = merge_entry_lists(NULL_IDX,
02698 ATD_NO_ENTRY_LIST(at_idx));
02699 }
02700 }
02701
02702 if (BD_UB_FLD(bd_idx, dim) == AT_Tbl_Idx) {
02703 at_idx = BD_UB_IDX(bd_idx, dim);
02704
02705 if (ATD_NO_ENTRY_LIST(at_idx) != NULL_IDX) {
02706 extent_entry_idx = merge_entry_lists(extent_entry_idx,
02707 ATD_NO_ENTRY_LIST(at_idx));
02708 }
02709 }
02710
02711 if (BD_LB_FLD(bd_idx, dim) == CN_Tbl_Idx &&
02712 fold_relationals(BD_LB_IDX(bd_idx, dim),
02713 CN_INTEGER_ONE_IDX,
02714 Eq_Opr)) {
02715
02716
02717
02718 extent_fld = BD_UB_FLD(bd_idx, dim);
02719 extent_idx = BD_UB_IDX(bd_idx, dim);
02720 }
02721 else {
02722 NTR_IR_TBL(ir_idx);
02723 IR_OPR(ir_idx) = Minus_Opr;
02724 IR_TYPE_IDX(ir_idx) = INTEGER_DEFAULT_TYPE;
02725 IR_FLD_L(ir_idx) = CN_Tbl_Idx;
02726 IR_IDX_L(ir_idx) = CN_INTEGER_ONE_IDX;
02727 IR_LINE_NUM_L(ir_idx) = BD_LINE_NUM(bd_idx);
02728 IR_COL_NUM_L(ir_idx) = BD_COLUMN_NUM(bd_idx);
02729 IR_FLD_R(ir_idx) = BD_LB_FLD(bd_idx, dim);
02730 IR_IDX_R(ir_idx) = BD_LB_IDX(bd_idx, dim);
02731 IR_LINE_NUM_R(ir_idx) = BD_LINE_NUM(bd_idx);
02732 IR_COL_NUM_R(ir_idx) = BD_COLUMN_NUM(bd_idx);
02733 IR_LINE_NUM(ir_idx) = BD_LINE_NUM(bd_idx);
02734 IR_COL_NUM(ir_idx) = BD_COLUMN_NUM(bd_idx);
02735
02736 NTR_IR_TBL(next_ir_idx);
02737 IR_OPR(next_ir_idx) = Plus_Opr;
02738 IR_TYPE_IDX(next_ir_idx) = INTEGER_DEFAULT_TYPE;
02739 IR_IDX_L(next_ir_idx) = BD_UB_IDX(bd_idx, dim);
02740 IR_FLD_L(next_ir_idx) = BD_UB_FLD(bd_idx, dim);
02741 IR_LINE_NUM_L(next_ir_idx) = BD_LINE_NUM(bd_idx);
02742 IR_COL_NUM_L(next_ir_idx) = BD_COLUMN_NUM(bd_idx);
02743 IR_FLD_R(next_ir_idx) = IR_Tbl_Idx;
02744 IR_IDX_R(next_ir_idx) = ir_idx;
02745 IR_LINE_NUM_R(next_ir_idx) = BD_LINE_NUM(bd_idx);
02746 IR_COL_NUM_R(next_ir_idx) = BD_COLUMN_NUM(bd_idx);
02747 IR_LINE_NUM(next_ir_idx) = BD_LINE_NUM(bd_idx);
02748 IR_COL_NUM(next_ir_idx) = BD_COLUMN_NUM(bd_idx);
02749
02750 if (BD_ARRAY_SIZE(bd_idx) == Symbolic_Constant_Size) {
02751 IR_OPR(next_ir_idx) = Symbolic_Plus_Opr;
02752 IR_OPR(ir_idx) = Symbolic_Minus_Opr;
02753 extent_idx = gen_compiler_tmp(BD_LINE_NUM(bd_idx),
02754 BD_COLUMN_NUM(bd_idx),
02755 Priv, TRUE);
02756 extent_fld = AT_Tbl_Idx;
02757
02758 ATD_SYMBOLIC_CONSTANT(extent_idx) = TRUE;
02759 ATD_TYPE_IDX(extent_idx) = CG_INTEGER_DEFAULT_TYPE;
02760 ATD_FLD(extent_idx) = IR_Tbl_Idx;
02761 ATD_TMP_IDX(extent_idx) = next_ir_idx;
02762
02763
02764
02765
02766 }
02767 else {
02768
02769 OPND_FLD(opnd) = IR_Tbl_Idx;
02770 OPND_IDX(opnd) = next_ir_idx;
02771 OPND_LINE_NUM(opnd) = stmt_start_line;
02772 OPND_COL_NUM(opnd) = stmt_start_col;
02773
02774 sh_idx = ntr_sh_tbl();
02775 SH_GLB_LINE(sh_idx) = stmt_start_line;
02776 SH_COL_NUM(sh_idx) = stmt_start_col;
02777 SH_STMT_TYPE(sh_idx) = Automatic_Base_Size_Stmt;
02778 SH_COMPILER_GEN(sh_idx) = TRUE;
02779 SH_P2_SKIP_ME(sh_idx) = TRUE;
02780
02781 expr_desc.rank = 0;
02782 xref_state = CIF_No_Usage_Rec;
02783
02784
02785
02786
02787 if (!expr_semantics(&opnd, &expr_desc)) {
02788 PRINTMSG(AT_DEF_LINE(attr_idx), 951, Error,
02789 AT_DEF_COLUMN(attr_idx),
02790 dim,
02791 AT_OBJ_NAME_PTR(attr_idx));
02792 AT_DCL_ERR(attr_idx) = TRUE;
02793 }
02794
02795 if (OPND_FLD(opnd) == CN_Tbl_Idx) {
02796 extent_fld = CN_Tbl_Idx;
02797 extent_idx = OPND_IDX(opnd);
02798 FREE_SH_NODE(sh_idx);
02799 }
02800 else {
02801 extent_fld = AT_Tbl_Idx;
02802 extent_idx = ntr_bnds_sh_tmp_list(&opnd,
02803 extent_entry_idx,
02804 (is_interface) ? NULL_IDX:sh_idx,
02805 FALSE,
02806 SA_INTEGER_DEFAULT_TYPE);
02807 }
02808 }
02809 }
02810
02811 if (extent_fld == CN_Tbl_Idx) {
02812
02813 if (compare_cn_and_value(extent_idx, 0, Lt_Opr)) {
02814 extent_idx = CN_INTEGER_ZERO_IDX;
02815 }
02816 }
02817 else {
02818
02819 OPND_FLD(opnd) = extent_fld;
02820 OPND_IDX(opnd) = extent_idx;
02821 OPND_LINE_NUM(opnd) = BD_LINE_NUM(bd_idx);
02822 OPND_COL_NUM(opnd) = BD_COLUMN_NUM(bd_idx);
02823
02824 gen_tmp_equal_max_zero(&opnd,
02825 INTEGER_DEFAULT_TYPE,
02826 extent_entry_idx,
02827 (BD_ARRAY_SIZE(bd_idx)==Symbolic_Constant_Size),
02828 is_interface);
02829
02830 extent_fld = OPND_FLD(opnd);
02831 extent_idx = OPND_IDX(opnd);
02832 }
02833
02834 BD_XT_FLD(bd_idx, dim) = extent_fld;
02835 BD_XT_IDX(bd_idx, dim) = extent_idx;
02836
02837
02838
02839
02840
02841 if (dim < BD_RANK(bd_idx)) {
02842 NTR_IR_TBL(ir_idx);
02843 IR_OPR(ir_idx) = Mult_Opr;
02844 IR_TYPE_IDX(ir_idx) = INTEGER_DEFAULT_TYPE;
02845 IR_LINE_NUM(ir_idx) = BD_LINE_NUM(bd_idx);
02846 IR_COL_NUM(ir_idx) = BD_COLUMN_NUM(bd_idx);
02847 IR_FLD_L(ir_idx) = stride.fld;
02848 IR_IDX_L(ir_idx) = stride.idx;
02849 IR_LINE_NUM_L(ir_idx) = BD_LINE_NUM(bd_idx);
02850 IR_COL_NUM_L(ir_idx) = BD_COLUMN_NUM(bd_idx);
02851 IR_FLD_R(ir_idx) = extent_fld;
02852 IR_IDX_R(ir_idx) = extent_idx;
02853 IR_LINE_NUM_R(ir_idx) = BD_LINE_NUM(bd_idx);
02854 IR_COL_NUM_R(ir_idx) = BD_COLUMN_NUM(bd_idx);
02855
02856 if ((extent_fld == AT_Tbl_Idx && ATD_SYMBOLIC_CONSTANT(extent_idx)) ||
02857 (stride.fld == AT_Tbl_Idx && ATD_SYMBOLIC_CONSTANT(stride.idx))) {
02858 IR_OPR(ir_idx) = Symbolic_Mult_Opr;
02859 stride.fld = AT_Tbl_Idx;
02860 stride.idx = gen_compiler_tmp(BD_LINE_NUM(bd_idx),
02861 BD_COLUMN_NUM(bd_idx),
02862 Priv, TRUE);
02863
02864 ATD_TYPE_IDX(stride.idx) = CG_INTEGER_DEFAULT_TYPE;
02865 ATD_FLD(stride.idx) = IR_Tbl_Idx;
02866 ATD_TMP_IDX(stride.idx) = ir_idx;
02867 ATD_SYMBOLIC_CONSTANT(stride.idx) = TRUE;
02868 }
02869 else {
02870 OPND_FLD(opnd) = IR_Tbl_Idx;
02871 OPND_IDX(opnd) = ir_idx;
02872 OPND_LINE_NUM(opnd) = stmt_start_line;
02873 OPND_COL_NUM(opnd) = stmt_start_col;
02874
02875 sh_idx = ntr_sh_tbl();
02876 SH_STMT_TYPE(sh_idx) = Automatic_Base_Size_Stmt;
02877 SH_COMPILER_GEN(sh_idx) = TRUE;
02878 SH_P2_SKIP_ME(sh_idx) = TRUE;
02879 SH_GLB_LINE(sh_idx) = stmt_start_line;
02880 SH_COL_NUM(sh_idx) = stmt_start_col;
02881
02882 expr_desc.rank = 0;
02883 xref_state = CIF_No_Usage_Rec;
02884
02885 expr_semantics(&opnd, &expr_desc);
02886
02887 if (OPND_FLD(opnd) == CN_Tbl_Idx) {
02888 stride.fld = CN_Tbl_Idx;
02889 stride.idx = OPND_IDX(opnd);
02890 FREE_SH_NODE(sh_idx);
02891 }
02892 else {
02893
02894 if (!is_interface) {
02895
02896
02897
02898 if (extent_entry_idx != NULL_IDX) {
02899 stride_entry_idx = merge_entry_lists(stride_entry_idx,
02900 extent_entry_idx);
02901 length_entry_idx = merge_entry_lists(length_entry_idx,
02902 extent_entry_idx);
02903 }
02904 }
02905
02906 stride.fld = AT_Tbl_Idx;
02907 stride.idx = ntr_bnds_sh_tmp_list(&opnd,
02908 stride_entry_idx,
02909 is_interface ? NULL_IDX:sh_idx,
02910 FALSE,
02911 SA_INTEGER_DEFAULT_TYPE);
02912 }
02913 }
02914
02915 NTR_IR_TBL(mult_idx);
02916 IR_LINE_NUM(mult_idx) = BD_LINE_NUM(bd_idx);
02917 IR_COL_NUM(mult_idx) = BD_COLUMN_NUM(bd_idx);
02918 IR_OPR(mult_idx) = (extent_fld == AT_Tbl_Idx &&
02919 ATD_SYMBOLIC_CONSTANT(extent_idx)) ?
02920 Symbolic_Mult_Opr : Mult_Opr;
02921 IR_TYPE_IDX(mult_idx) = INTEGER_DEFAULT_TYPE;
02922 IR_IDX_R(len_ir_idx) = mult_idx;
02923 IR_FLD_R(len_ir_idx) = IR_Tbl_Idx;
02924 IR_LINE_NUM_R(len_ir_idx) = BD_LINE_NUM(bd_idx);
02925 IR_COL_NUM_R(len_ir_idx) = BD_COLUMN_NUM(bd_idx);
02926 IR_IDX_L(mult_idx) = extent_idx;
02927 IR_FLD_L(mult_idx) = extent_fld;
02928 IR_LINE_NUM_L(mult_idx) = BD_LINE_NUM(bd_idx);
02929 IR_COL_NUM_L(mult_idx) = BD_COLUMN_NUM(bd_idx);
02930 len_ir_idx = mult_idx;
02931 }
02932 else if (dim == 1) {
02933
02934
02935
02936 BD_LEN_FLD(bd_idx) = extent_fld;
02937 BD_LEN_IDX(bd_idx) = extent_idx;
02938 length_entry_idx = extent_entry_idx;
02939 stride_entry_idx = merge_entry_lists(stride_entry_idx,
02940 extent_entry_idx);
02941
02942 extent_entry_idx = NULL_IDX;
02943
02944 if (length_entry_idx != NULL_IDX) {
02945 gen_tmp_eq_zero_ir(extent_idx);
02946 }
02947 }
02948
02949
02950
02951 else if (BD_ARRAY_SIZE(bd_idx) == Symbolic_Constant_Size) {
02952 IR_IDX_R(len_ir_idx) = extent_idx;
02953 IR_FLD_R(len_ir_idx) = extent_fld;
02954 IR_LINE_NUM_R(len_ir_idx) = BD_LINE_NUM(bd_idx);
02955 IR_COL_NUM_R(len_ir_idx) = BD_COLUMN_NUM(bd_idx);
02956
02957 BD_LEN_FLD(bd_idx) = AT_Tbl_Idx;
02958 BD_LEN_IDX(bd_idx) = gen_compiler_tmp(BD_LINE_NUM(bd_idx),
02959 BD_COLUMN_NUM(bd_idx),
02960 Priv, TRUE);
02961 ATD_TYPE_IDX(BD_LEN_IDX(bd_idx)) = CG_INTEGER_DEFAULT_TYPE;
02962 ATD_FLD(BD_LEN_IDX(bd_idx)) = IR_FLD_R(BD_LEN_IDX(bd_idx));
02963 ATD_TMP_IDX(BD_LEN_IDX(bd_idx)) = IR_IDX_R(BD_LEN_IDX(bd_idx));
02964
02965 ATD_SYMBOLIC_CONSTANT(BD_LEN_IDX(bd_idx)) = TRUE;
02966 }
02967 else {
02968 IR_IDX_R(len_ir_idx) = extent_idx;
02969 IR_FLD_R(len_ir_idx) = extent_fld;
02970 IR_LINE_NUM_R(len_ir_idx) = BD_LINE_NUM(bd_idx);
02971 IR_COL_NUM_R(len_ir_idx) = BD_COLUMN_NUM(bd_idx);
02972 OPND_FLD(opnd) = IR_FLD_R(BD_LEN_IDX(bd_idx));
02973 OPND_IDX(opnd) = IR_IDX_R(BD_LEN_IDX(bd_idx));
02974 OPND_LINE_NUM(opnd) = BD_LINE_NUM(bd_idx);
02975 OPND_COL_NUM(opnd) = BD_COLUMN_NUM(bd_idx);
02976
02977 sh_idx = ntr_sh_tbl();
02978 SH_STMT_TYPE(sh_idx) = Automatic_Base_Size_Stmt;
02979 SH_COMPILER_GEN(sh_idx) = TRUE;
02980 SH_P2_SKIP_ME(sh_idx) = TRUE;
02981 SH_GLB_LINE(sh_idx) = stmt_start_line;
02982 SH_COL_NUM(sh_idx) = stmt_start_col;
02983
02984
02985
02986
02987 expr_desc.rank = 0;
02988 xref_state = CIF_No_Usage_Rec;
02989
02990 if (!expr_semantics(&opnd, &expr_desc)) {
02991
02992 # if defined(_CHECK_MAX_MEMORY)
02993
02994 if (!target_t3e) {
02995 AT_DCL_ERR(attr_idx) = TRUE;
02996 }
02997 # endif
02998 }
02999
03000 if (OPND_FLD(opnd) == CN_Tbl_Idx) {
03001 BD_LEN_FLD(bd_idx) = CN_Tbl_Idx;
03002 BD_LEN_IDX(bd_idx) = OPND_IDX(opnd);
03003 FREE_SH_NODE(sh_idx);
03004 }
03005 else {
03006
03007 if (!is_interface) {
03008
03009 if (extent_entry_idx != NULL_IDX) {
03010 stride_entry_idx = merge_entry_lists(stride_entry_idx,
03011 extent_entry_idx);
03012 length_entry_idx = merge_entry_lists(length_entry_idx,
03013 extent_entry_idx);
03014 }
03015 }
03016
03017 length_idx = ntr_bnds_sh_tmp_list(&opnd,
03018 length_entry_idx,
03019 (is_interface) ? NULL_IDX:sh_idx,
03020 TRUE,
03021 SA_INTEGER_DEFAULT_TYPE);
03022 BD_LEN_IDX(bd_idx) = length_idx;
03023 BD_LEN_FLD(bd_idx) = AT_Tbl_Idx;
03024 }
03025 }
03026 }
03027
03028
03029
03030
03031
03032
03033
03034
03035 if (stride_entry_idx != NULL_IDX) {
03036 entry_count = SCP_ALT_ENTRY_CNT(curr_scp_idx) + 1;
03037
03038 if (length_entry_idx != NULL_IDX &&
03039 entry_count == AL_ENTRY_COUNT(length_entry_idx)) {
03040
03041
03042
03043
03044
03045
03046 PRINTMSG(AT_DEF_LINE(attr_idx), 660, Error,
03047 AT_DEF_COLUMN(attr_idx),
03048 AT_OBJ_NAME_PTR(attr_idx));
03049 AT_DCL_ERR(attr_idx) = TRUE;
03050 }
03051 else if (entry_count == AL_ENTRY_COUNT(stride_entry_idx)) {
03052
03053
03054
03055
03056
03057
03058
03059
03060 PRINTMSG(AT_DEF_LINE(attr_idx), 661, Error,
03061 AT_DEF_COLUMN(attr_idx),
03062 AT_OBJ_NAME_PTR(attr_idx));
03063 AT_DCL_ERR(attr_idx) = TRUE;
03064 }
03065 else if (entry_list != NULL_IDX) {
03066 stride_entry_count = merge_entry_list_count(stride_entry_idx,
03067 entry_list);
03068
03069 if (entry_count == stride_entry_count) {
03070
03071
03072
03073
03074 PRINTMSG(AT_DEF_LINE(attr_idx), 662, Error,
03075 AT_DEF_COLUMN(attr_idx),
03076 AT_OBJ_NAME_PTR(attr_idx));
03077 AT_DCL_ERR(attr_idx) = TRUE;
03078 }
03079 }
03080 }
03081
03082 NEXT:
03083
03084
03085
03086
03087
03088 # if 0
03089 if (BD_ARRAY_CLASS(bd_idx) != Assumed_Size) {
03090 PRINTMSG(AT_DEF_LINE(attr_idx), 1576, Error,
03091 AT_DEF_COLUMN(attr_idx));
03092 AT_DCL_ERR(attr_idx) = TRUE;
03093 }
03094 # endif
03095
03096 EXIT:
03097
03098 if (stride_entry_idx != NULL_IDX) {
03099 free_attr_list(stride_entry_idx);
03100 }
03101
03102 if (length_entry_idx != NULL_IDX) {
03103 free_attr_list(length_entry_idx);
03104 }
03105
03106 if (ATD_CLASS(attr_idx) == Function_Result) {
03107 ATP_NO_ENTRY_LIST(ATD_FUNC_IDX(attr_idx)) = entry_list;
03108 }
03109 else {
03110 ATD_NO_ENTRY_LIST(attr_idx) = entry_list;
03111 }
03112
03113 TRACE (Func_Exit, "pe_array_dim_resolution", NULL);
03114
03115 return;
03116
03117 }
03118
03119
03120
03121
03122
03123
03124
03125
03126
03127
03128
03129
03130
03131
03132
03133
03134
03135
03136
03137
03138
03139
03140
03141
03142
03143
03144
03145
03146
03147
03148 static void bound_resolution(int attr_idx)
03149
03150 {
03151 boolean ansi;
03152 msg_lvl_type save_msg_level;
03153 int start_sh_idx;
03154
03155
03156 TRACE (Func_Entry, "bound_resolution", NULL);
03157
03158 if (ATD_CLASS(attr_idx) == Constant) {
03159
03160
03161 }
03162 else if (AT_REFERENCED(attr_idx) == Not_Referenced) {
03163
03164
03165
03166
03167
03168
03169 xref_state = CIF_Symbol_Reference;
03170 cif_tmp_so_no_msg = TRUE;
03171 no_func_expansion = TRUE;
03172 save_msg_level = cmd_line_flags.msg_lvl_suppressed;
03173 ansi = on_off_flags.issue_ansi_messages;
03174 cmd_line_flags.msg_lvl_suppressed = Error_Lvl;
03175
03176 bound_semantics(attr_idx, FALSE);
03177
03178 if (ATD_CLASS(attr_idx) != Constant) {
03179 ATD_TMP_IDX(attr_idx) = NULL_IDX;
03180 ATD_FLD(attr_idx) = NO_Tbl_Idx;
03181 }
03182
03183 AT_REFERENCED(attr_idx) = Not_Referenced;
03184 AT_DEFINED(attr_idx) = FALSE;
03185 no_func_expansion = FALSE;
03186 cmd_line_flags.msg_lvl_suppressed = save_msg_level;
03187 on_off_flags.issue_ansi_messages = ansi;
03188 cif_tmp_so_no_msg = FALSE;
03189 }
03190 else {
03191
03192 if (ATD_TMP_SEMANTICS_DONE(attr_idx)) {
03193
03194
03195
03196
03197
03198
03199
03200
03201 save_msg_level = cmd_line_flags.msg_lvl_suppressed;
03202 ansi = on_off_flags.issue_ansi_messages;
03203 cmd_line_flags.msg_lvl_suppressed = Error_Lvl;
03204
03205
03206
03207
03208 start_sh_idx = bound_semantics(attr_idx,
03209 !SCP_IS_INTERFACE(curr_scp_idx));
03210
03211 cmd_line_flags.msg_lvl_suppressed = save_msg_level;
03212 on_off_flags.issue_ansi_messages = ansi;
03213 }
03214 else {
03215
03216
03217
03218
03219 xref_state = CIF_Symbol_Reference;
03220 start_sh_idx = bound_semantics(attr_idx,
03221 !SCP_IS_INTERFACE(curr_scp_idx));
03222 }
03223
03224 if (ATD_CLASS(attr_idx) != Constant &&
03225 !ATD_SYMBOLIC_CONSTANT(attr_idx) &&
03226 SCP_ENTRY_IDX(curr_scp_idx) != NULL_IDX) {
03227
03228
03229
03230
03231
03232
03233
03234
03235
03236 insert_sh_after_entries(attr_idx,
03237 SH_PREV_IDX(start_sh_idx),
03238 curr_stmt_sh_idx,
03239 TRUE,
03240 TRUE);
03241 }
03242 }
03243
03244 TRACE (Func_Exit, "bound_resolution", NULL);
03245
03246 return;
03247
03248 }
03249
03250
03251
03252
03253
03254
03255
03256
03257
03258
03259
03260
03261
03262
03263
03264
03265
03266
03267
03268
03269
03270
03271
03272
03273 int bound_semantics(int attr_idx,
03274 boolean insert_in_SH_stream)
03275
03276 {
03277 int bound_sh_idx;
03278 expr_arg_type expr_desc;
03279 int list_idx;
03280 fld_type new_fld;
03281 int new_ir_idx;
03282 opnd_type opnd;
03283 int save_sh_idx;
03284 int type_idx;
03285
03286
03287 TRACE (Func_Entry, "bound_semantics", NULL);
03288
03289 if (AT_OBJ_CLASS(attr_idx) != Data_Obj ||
03290 ATD_CLASS(attr_idx) != Compiler_Tmp) {
03291 return(NULL_IDX);
03292 }
03293
03294 expr_mode = Specification_Expr;
03295 expr_desc.rank = 0;
03296 ATD_TMP_SEMANTICS_DONE(attr_idx) = TRUE;
03297
03298
03299
03300
03301
03302
03303 gen_opnd(&opnd, ATD_TMP_IDX(attr_idx), (fld_type) ATD_FLD(attr_idx),
03304 stmt_start_line, stmt_start_col);
03305 copy_subtree(&opnd, &opnd);
03306 new_ir_idx = OPND_IDX(opnd);
03307 new_fld = OPND_FLD(opnd);
03308
03309
03310
03311
03312 bound_sh_idx = ntr_sh_tbl();
03313 SH_IR_IDX(bound_sh_idx) = ATD_TMP_IDX(attr_idx);
03314 SH_STMT_TYPE(bound_sh_idx) = Automatic_Base_Size_Stmt;
03315 SH_COMPILER_GEN(bound_sh_idx) = TRUE;
03316 SH_P2_SKIP_ME(bound_sh_idx) = TRUE;
03317 SH_GLB_LINE(bound_sh_idx) = stmt_start_line;
03318 SH_COL_NUM(bound_sh_idx) = stmt_start_col;
03319 save_sh_idx = curr_stmt_sh_idx;
03320 curr_stmt_sh_idx = bound_sh_idx;
03321
03322 # if (defined(_TARGET_OS_IRIX) || defined(_TARGET_OS_LINUX) || defined(_TARGET_OS_DARWIN))
03323
03324 if (ATD_TMP_HAS_CVRT_OPR(attr_idx)) {
03325
03326
03327
03328 COPY_OPND(opnd, IR_OPND_L(IR_IDX_R(ATD_TMP_IDX(attr_idx))));
03329 }
03330 else {
03331 COPY_OPND(opnd, IR_OPND_R(ATD_TMP_IDX(attr_idx)));
03332 }
03333 # else
03334
03335 COPY_OPND(opnd, IR_OPND_R(ATD_TMP_IDX(attr_idx)));
03336 # endif
03337
03338 if (!expr_semantics(&opnd, &expr_desc)) {
03339
03340
03341
03342
03343 OPND_IDX(opnd) = CN_INTEGER_ONE_IDX;
03344 OPND_FLD(opnd) = CN_Tbl_Idx;
03345 OPND_LINE_NUM(opnd) = stmt_start_line;
03346 OPND_COL_NUM(opnd) = stmt_start_col;
03347
03348
03349
03350
03351 free_attr_list(SCP_TMP_LIST(curr_scp_idx));
03352 SCP_TMP_LIST(curr_scp_idx) = NULL_IDX;
03353 }
03354 else if (expr_desc.rank != 0) {
03355 PRINTMSG(AT_DEF_LINE(attr_idx), 907, Error,
03356 AT_DEF_COLUMN(attr_idx));
03357 AT_DCL_ERR(attr_idx) = TRUE;
03358 }
03359 else if (expr_desc.type != Integer) {
03360
03361
03362
03363
03364 if (expr_desc.linear_type == Typeless_4 ||
03365 expr_desc.linear_type == Typeless_8) {
03366 PRINTMSG(AT_DEF_LINE(attr_idx), 221, Ansi,
03367 AT_DEF_COLUMN(attr_idx));
03368 }
03369 else if (expr_desc.linear_type == Short_Typeless_Const) {
03370 PRINTMSG(AT_DEF_LINE(attr_idx), 221, Ansi,
03371 AT_DEF_COLUMN(attr_idx));
03372 OPND_IDX(opnd) = cast_typeless_constant(OPND_IDX(opnd),
03373 INTEGER_DEFAULT_TYPE,
03374 OPND_LINE_NUM(opnd),
03375 OPND_COL_NUM(opnd));
03376 expr_desc.type_idx = INTEGER_DEFAULT_TYPE;
03377 expr_desc.type = Integer;
03378 expr_desc.linear_type = INTEGER_DEFAULT_TYPE;
03379
03380 }
03381 else {
03382
03383 if (!AT_DCL_ERR(attr_idx)) {
03384
03385 if (expr_desc.linear_type == Long_Typeless) {
03386
03387
03388
03389 PRINTMSG(AT_DEF_LINE(attr_idx), 1133, Error,
03390 AT_DEF_COLUMN(attr_idx));
03391 }
03392 else {
03393 PRINTMSG(AT_DEF_LINE(attr_idx), 488, Error,
03394 AT_DEF_COLUMN(attr_idx),
03395 get_basic_type_str(expr_desc.type_idx));
03396 }
03397 AT_DCL_ERR(attr_idx) = TRUE;
03398 }
03399
03400
03401
03402 OPND_IDX(opnd) = CN_INTEGER_ONE_IDX;
03403 OPND_FLD(opnd) = CN_Tbl_Idx;
03404 OPND_LINE_NUM(opnd) = AT_DEF_LINE(attr_idx);
03405 OPND_COL_NUM(opnd) = AT_DEF_COLUMN(attr_idx);
03406
03407
03408
03409
03410 free_attr_list(SCP_TMP_LIST(curr_scp_idx));
03411 SCP_TMP_LIST(curr_scp_idx) = NULL_IDX;
03412 }
03413 }
03414 else if (expr_desc.has_symbolic) {
03415
03416
03417
03418
03419
03420
03421
03422 ATD_SYMBOLIC_CONSTANT(attr_idx) = expr_is_symbolic_constant(&opnd);
03423 }
03424
03425 # if (defined(_TARGET_OS_IRIX) || defined(_TARGET_OS_LINUX) || defined(_TARGET_OS_DARWIN))
03426
03427 else if (ATD_TMP_HAS_CVRT_OPR(attr_idx)) {
03428 COPY_OPND(IR_OPND_L(IR_IDX_R(ATD_TMP_IDX(attr_idx))), opnd);
03429
03430 if (OPND_FLD(opnd) == CN_Tbl_Idx) {
03431 COPY_OPND(opnd, IR_OPND_R(ATD_TMP_IDX(attr_idx)));
03432 expr_semantics(&opnd, &expr_desc);
03433 }
03434 else {
03435 COPY_OPND(opnd, IR_OPND_R(ATD_TMP_IDX(attr_idx)));
03436 }
03437 }
03438 # endif
03439
03440 if (OPND_FLD(opnd) == CN_Tbl_Idx) {
03441
03442
03443
03444
03445
03446
03447
03448
03449
03450
03451
03452 CLEAR_VARIANT_ATTR_INFO(attr_idx, Data_Obj);
03453
03454 ATD_CLASS(attr_idx) = Constant;
03455 AT_TYPED(attr_idx) = TRUE;
03456 ATD_TYPE_IDX(attr_idx) = CN_TYPE_IDX(OPND_IDX(opnd));
03457 AT_REFERENCED(attr_idx) = Not_Referenced;
03458 AT_DEFINED(attr_idx) = FALSE;
03459 ATD_CONST_IDX(attr_idx) = OPND_IDX(opnd);
03460 ATD_FLD(attr_idx) = CN_Tbl_Idx;
03461 curr_stmt_sh_idx = save_sh_idx;
03462 FREE_SH_NODE(bound_sh_idx);
03463 bound_sh_idx = NULL_IDX;
03464 }
03465 else if (ATD_SYMBOLIC_CONSTANT(attr_idx)) {
03466
03467
03468
03469 curr_stmt_sh_idx = save_sh_idx;
03470 FREE_SH_NODE(bound_sh_idx);
03471 bound_sh_idx = NULL_IDX;
03472 ATD_FLD(attr_idx) = OPND_FLD(opnd);
03473 ATD_TMP_IDX(attr_idx) = OPND_IDX(opnd);
03474 }
03475 else {
03476
03477 if (OPND_FLD(opnd) == AT_Tbl_Idx) {
03478
03479 if (AT_IS_DARG(OPND_IDX(opnd))) {
03480
03481
03482
03483
03484
03485 AT_CIF_USE_IN_BND(OPND_IDX(opnd)) = TRUE;
03486 }
03487
03488
03489
03490
03491 ATD_DEFINING_ATTR_IDX(attr_idx) = OPND_IDX(opnd);
03492 }
03493
03494
03495
03496 type_idx = check_type_for_size_address(&opnd);
03497
03498 COPY_OPND(IR_OPND_R(ATD_TMP_IDX(attr_idx)), opnd);
03499
03500
03501
03502 ATD_TYPE_IDX(attr_idx) = type_idx;
03503 IR_TYPE_IDX(ATD_TMP_IDX(attr_idx)) = type_idx;
03504
03505
03506
03507
03508
03509 if (SCP_TMP_LIST(curr_scp_idx) != NULL_IDX) {
03510
03511
03512
03513
03514
03515 list_idx = SCP_TMP_LIST(curr_scp_idx);
03516
03517 while (list_idx != NULL_IDX) {
03518 ATD_NO_ENTRY_LIST(attr_idx) =
03519 merge_entry_lists(ATD_NO_ENTRY_LIST(attr_idx),
03520 (AT_OBJ_CLASS(AL_ATTR_IDX(list_idx)) == Data_Obj) ?
03521 ATD_NO_ENTRY_LIST(AL_ATTR_IDX(list_idx)) :
03522 ATP_NO_ENTRY_LIST(AL_ATTR_IDX(list_idx)));
03523 list_idx = AL_NEXT_IDX(list_idx);
03524 }
03525
03526 free_attr_list(SCP_TMP_LIST(curr_scp_idx));
03527 SCP_TMP_LIST(curr_scp_idx) = NULL_IDX;
03528 }
03529
03530 if (!insert_in_SH_stream) {
03531
03532
03533
03534
03535
03536
03537
03538 AT_REFERENCED(attr_idx) = Not_Referenced;
03539 AT_DEFINED(attr_idx) = FALSE;
03540
03541 while (curr_stmt_sh_idx != NULL_IDX) {
03542 bound_sh_idx = curr_stmt_sh_idx;
03543 curr_stmt_sh_idx = SH_PREV_IDX(curr_stmt_sh_idx);
03544 FREE_SH_NODE(bound_sh_idx);
03545 }
03546 bound_sh_idx = NULL_IDX;
03547 curr_stmt_sh_idx = save_sh_idx;
03548 }
03549 else {
03550
03551
03552
03553 if (SH_NEXT_IDX(save_sh_idx) != NULL_IDX) {
03554 while (SH_NEXT_IDX(bound_sh_idx) != NULL_IDX) {
03555 bound_sh_idx = SH_NEXT_IDX(bound_sh_idx);
03556 }
03557 SH_NEXT_IDX(bound_sh_idx) = SH_NEXT_IDX(save_sh_idx);
03558 if (SH_NEXT_IDX(bound_sh_idx)) {
03559 SH_PREV_IDX(SH_NEXT_IDX(bound_sh_idx)) = bound_sh_idx;
03560 }
03561 }
03562
03563 while (SH_PREV_IDX(bound_sh_idx) != NULL_IDX) {
03564 bound_sh_idx = SH_PREV_IDX(bound_sh_idx);
03565 }
03566
03567 SH_PREV_IDX(bound_sh_idx) = save_sh_idx;
03568 SH_NEXT_IDX(save_sh_idx) = bound_sh_idx;
03569 AT_DEFINED(attr_idx) = TRUE;
03570 AT_REFERENCED(attr_idx) = Referenced;
03571 }
03572
03573
03574
03575
03576
03577
03578 OPND_FLD(opnd) = new_fld;
03579 OPND_IDX(opnd) = new_ir_idx;
03580 OPND_LINE_NUM(opnd) = AT_DEF_LINE(attr_idx);
03581 OPND_COL_NUM(opnd) = AT_DEF_COLUMN(attr_idx);
03582
03583 type_idx = check_type_for_size_address(&opnd);
03584
03585 ATD_FLD(attr_idx) = OPND_FLD(opnd);
03586 ATD_TMP_IDX(attr_idx) = OPND_IDX(opnd);
03587 }
03588
03589 expr_mode = Regular_Expr;
03590
03591 TRACE (Func_Exit, "bound_semantics", NULL);
03592
03593 return(bound_sh_idx);
03594
03595 }
03596
03597
03598
03599
03600
03601
03602
03603
03604
03605
03606
03607
03608
03609
03610
03611
03612
03613
03614 void char_len_resolution(int attr_idx,
03615 boolean must_be_const_array)
03616
03617 {
03618 int column;
03619 int entry_count;
03620 int ir_idx;
03621 boolean is_interface;
03622 int len_entry_count;
03623 int len_idx;
03624 int line;
03625 int list_idx;
03626 int max_idx;
03627 int new_len_idx;
03628 opnd_type opnd;
03629 #ifdef KEY
03630 int sh_idx = 0;
03631 #else
03632 int sh_idx;
03633 #endif
03634 int tmp_attr_idx;
03635 int t_idx;
03636 int type_idx;
03637 int zero_idx;
03638
03639
03640 TRACE (Func_Entry, "char_len_resolution", NULL);
03641
03642 is_interface = SCP_IS_INTERFACE(curr_scp_idx);
03643 type_idx = ATD_TYPE_IDX(attr_idx);
03644
03645 if (TYP_CHAR_CLASS(type_idx) == Unknown_Char) {
03646
03647 if (AT_OBJ_CLASS(TYP_IDX(type_idx)) == Data_Obj &&
03648 ATD_CLASS(TYP_IDX(type_idx)) == Constant) {
03649 TYP_IDX(type_idx) = ATD_CONST_IDX(TYP_IDX(type_idx));
03650 TYP_FLD(type_idx) = CN_Tbl_Idx;
03651 TYP_CHAR_CLASS(type_idx) = Const_Len_Char;
03652 }
03653 else if (AT_OBJ_CLASS(TYP_IDX(type_idx)) == Data_Obj &&
03654 ATD_SYMBOLIC_CONSTANT(TYP_IDX(type_idx))) {
03655
03656 PRINTMSG(AT_DEF_LINE(attr_idx), 1211, Error,
03657 AT_DEF_COLUMN(attr_idx),
03658 AT_OBJ_NAME_PTR(attr_idx));
03659 AT_DCL_ERR(attr_idx) = TRUE;
03660 ATD_TYPE_IDX(attr_idx) = CHARACTER_DEFAULT_TYPE;
03661 }
03662 else {
03663 TYP_CHAR_CLASS(type_idx) = Var_Len_Char;
03664 TYP_ORIG_LEN_IDX(type_idx) = TYP_IDX(type_idx);
03665 }
03666 }
03667
03668 if (TYP_CHAR_CLASS(type_idx) == Var_Len_Char) {
03669
03670
03671
03672
03673
03674 if (must_be_const_array) {
03675 goto EXIT;
03676 }
03677
03678 if (fnd_semantic_err(Obj_Var_Len_Ch,
03679 AT_DEF_LINE(attr_idx),
03680 AT_DEF_COLUMN(attr_idx),
03681 attr_idx,
03682 TRUE)) {
03683 ATD_TYPE_IDX(attr_idx) = CHARACTER_DEFAULT_TYPE;
03684 }
03685 else if (ATD_CLASS(attr_idx) == Function_Result &&
03686 !ATP_EXPL_ITRFC(ATD_FUNC_IDX(attr_idx))) {
03687 PRINTMSG(AT_DEF_LINE(attr_idx), 916, Error,
03688 AT_DEF_COLUMN(attr_idx),
03689 AT_OBJ_NAME_PTR(ATD_FUNC_IDX(attr_idx)));
03690 AT_DCL_ERR(attr_idx) = TRUE;
03691 ATD_TYPE_IDX(attr_idx) = CHARACTER_DEFAULT_TYPE;
03692 }
03693 else {
03694
03695 if (!TYP_RESOLVED(type_idx)) {
03696
03697
03698
03699 NTR_IR_TBL(max_idx);
03700 IR_OPR(max_idx) = Max_Opr;
03701 IR_LINE_NUM(max_idx) = AT_DEF_LINE(attr_idx);
03702 IR_COL_NUM(max_idx) = AT_DEF_COLUMN(attr_idx);
03703 IR_LIST_CNT_L(max_idx) = 2;
03704
03705 NTR_IR_LIST_TBL(list_idx);
03706 IR_FLD_L(max_idx) = IL_Tbl_Idx;
03707 IR_IDX_L(max_idx) = list_idx;
03708
03709 OPND_FLD(opnd) = TYP_FLD(type_idx);
03710 OPND_IDX(opnd) = TYP_IDX(type_idx);
03711 OPND_LINE_NUM(opnd) = AT_DEF_LINE(attr_idx);
03712 OPND_COL_NUM(opnd) = AT_DEF_COLUMN(attr_idx);
03713 t_idx = check_type_for_size_address(&opnd);
03714
03715 COPY_OPND(IL_OPND(list_idx), opnd);
03716
03717 IR_TYPE_IDX(max_idx) = t_idx;
03718
03719 NTR_IR_LIST_TBL(zero_idx);
03720 IL_NEXT_LIST_IDX(list_idx) = zero_idx;
03721 IL_PREV_LIST_IDX(zero_idx) = list_idx;
03722 IL_FLD(zero_idx) = CN_Tbl_Idx;
03723 IL_IDX(zero_idx) = CN_INTEGER_ZERO_IDX;
03724 IL_LINE_NUM(zero_idx) = AT_DEF_LINE(attr_idx);
03725 IL_COL_NUM(zero_idx) = AT_DEF_COLUMN(attr_idx);
03726
03727 if (!is_interface) {
03728 sh_idx = ntr_sh_tbl();
03729 SH_STMT_TYPE(sh_idx) = Automatic_Base_Size_Stmt;
03730 SH_P2_SKIP_ME(sh_idx) = TRUE;
03731 SH_COMPILER_GEN(sh_idx) = TRUE;
03732 SH_GLB_LINE(sh_idx) = stmt_start_line;
03733 SH_COL_NUM(sh_idx) = stmt_start_col;
03734 }
03735
03736 OPND_FLD(opnd) = IR_Tbl_Idx;
03737 OPND_IDX(opnd) = max_idx;
03738 OPND_LINE_NUM(opnd) = stmt_start_line;
03739 OPND_COL_NUM(opnd) = stmt_start_col;
03740 new_len_idx = ntr_bnds_sh_tmp_list(
03741 &opnd,
03742 ATD_NO_ENTRY_LIST(TYP_IDX(type_idx)),
03743 (is_interface) ? NULL_IDX : sh_idx,
03744 TRUE,
03745 t_idx);
03746
03747 TYP_FLD(type_idx) = AT_Tbl_Idx;
03748 TYP_IDX(type_idx) = new_len_idx;
03749
03750 if (ATD_NO_ENTRY_LIST(new_len_idx) != NULL_IDX) {
03751 entry_count = SCP_ALT_ENTRY_CNT(curr_scp_idx) + 1;
03752
03753 if (entry_count==AL_ENTRY_COUNT(ATD_NO_ENTRY_LIST(new_len_idx))){
03754
03755
03756
03757
03758
03759 PRINTMSG(AT_DEF_LINE(attr_idx), 659, Error,
03760 AT_DEF_COLUMN(attr_idx),
03761 AT_OBJ_NAME_PTR(attr_idx));
03762 AT_DCL_ERR(attr_idx) = TRUE;
03763 }
03764 else if (ATD_ARRAY_IDX(attr_idx) == NULL_IDX) {
03765 len_entry_count =
03766 merge_entry_list_count(ATD_NO_ENTRY_LIST(new_len_idx),
03767 ((ATD_CLASS(attr_idx) == Function_Result) ?
03768 ATP_NO_ENTRY_LIST(ATD_FUNC_IDX(attr_idx)) :
03769 ATD_NO_ENTRY_LIST(attr_idx)));
03770
03771 if (entry_count == len_entry_count) {
03772 PRINTMSG(AT_DEF_LINE(attr_idx), 662, Error,
03773 AT_DEF_COLUMN(attr_idx),
03774 AT_OBJ_NAME_PTR(attr_idx));
03775 AT_DCL_ERR(attr_idx) = TRUE;
03776 }
03777 else if (AT_OBJ_CLASS(attr_idx) == Data_Obj &&
03778 ATD_CLASS(attr_idx) == Variable) {
03779 PRINTMSG(AT_DEF_LINE(attr_idx), 1046, Caution,
03780 AT_DEF_COLUMN(attr_idx),
03781 AT_OBJ_NAME_PTR(attr_idx));
03782 }
03783 }
03784 }
03785 }
03786
03787 if (AT_OBJ_CLASS(attr_idx) == Data_Obj) {
03788
03789 if (ATD_CLASS(attr_idx) != Function_Result &&
03790 ATP_PGM_UNIT(SCP_ATTR_IDX(curr_scp_idx)) != Function &&
03791 ATP_PGM_UNIT(SCP_ATTR_IDX(curr_scp_idx)) != Subroutine) {
03792 PRINTMSG(AT_DEF_LINE(attr_idx), 1014, Error,
03793 AT_DEF_COLUMN(attr_idx),
03794 AT_OBJ_NAME_PTR(attr_idx));
03795 AT_DCL_ERR(attr_idx) = TRUE;
03796 }
03797 if (ATD_PE_ARRAY_IDX(attr_idx) != NULL_IDX) {
03798 PRINTMSG(AT_DEF_LINE(attr_idx), 1577, Error,
03799 AT_DEF_COLUMN(attr_idx),
03800 AT_OBJ_NAME_PTR(attr_idx));
03801 AT_DCL_ERR(attr_idx) = TRUE;
03802 }
03803 else if (ATD_CLASS(attr_idx) == Variable) {
03804 ATD_AUTOMATIC(attr_idx) = TRUE;
03805 }
03806 }
03807 }
03808 }
03809 else if (TYP_CHAR_CLASS(type_idx) == Assumed_Size_Char) {
03810
03811
03812
03813
03814
03815 if (must_be_const_array) {
03816 goto EXIT;
03817 }
03818
03819 if (AT_OBJ_CLASS(attr_idx) == Stmt_Func) {
03820 ATD_TYPE_IDX(attr_idx) = CHARACTER_DEFAULT_TYPE;
03821 }
03822 else {
03823
03824 switch (ATD_CLASS(attr_idx)) {
03825 case Function_Result:
03826
03827 if (ATD_ARRAY_IDX(attr_idx) != NULL_IDX || ATD_POINTER(attr_idx)) {
03828 PRINTMSG(AT_DEF_LINE(attr_idx), 507, Error,
03829 AT_DEF_COLUMN(attr_idx),
03830 AT_OBJ_NAME_PTR(attr_idx));
03831 AT_DCL_ERR(attr_idx) = TRUE;
03832 AT_DCL_ERR(ATD_FUNC_IDX(attr_idx)) = TRUE;
03833 break;
03834 }
03835
03836 if (ATD_FUNC_IDX(attr_idx) != SCP_ATTR_IDX(curr_scp_idx) &&
03837 !ATP_ALT_ENTRY(ATD_FUNC_IDX(attr_idx)) &&
03838 ATP_PROC(ATD_FUNC_IDX(attr_idx)) != Dummy_Proc) {
03839 PRINTMSG(AT_DEF_LINE(attr_idx), 1107, Error,
03840 AT_DEF_COLUMN(attr_idx),
03841 AT_OBJ_NAME_PTR(ATD_FUNC_IDX(attr_idx)));
03842 AT_DCL_ERR(attr_idx) = TRUE;
03843 AT_DCL_ERR(ATD_FUNC_IDX(attr_idx)) = TRUE;
03844 break;
03845 }
03846
03847
03848
03849
03850
03851 case Dummy_Argument:
03852
03853
03854
03855
03856 NTR_IR_TBL(len_idx);
03857 IR_OPR(len_idx) = Clen_Opr;
03858 IR_TYPE_IDX(len_idx) = SA_INTEGER_DEFAULT_TYPE;
03859 IR_LINE_NUM(len_idx) = AT_DEF_LINE(attr_idx);
03860 IR_COL_NUM(len_idx) = AT_DEF_COLUMN(attr_idx);
03861
03862 if (ATD_CLASS(attr_idx) == Function_Result &&
03863 ATP_PROC(ATD_FUNC_IDX(attr_idx)) == Dummy_Proc) {
03864 IR_IDX_L(len_idx) = ATD_FUNC_IDX(attr_idx);
03865 }
03866 else {
03867 IR_IDX_L(len_idx) = attr_idx;
03868 }
03869
03870 IR_FLD_L(len_idx) = AT_Tbl_Idx;
03871 IR_LINE_NUM_L(len_idx) = AT_DEF_LINE(attr_idx);
03872 IR_COL_NUM_L(len_idx) = AT_DEF_COLUMN(attr_idx);
03873
03874 OPND_FLD(opnd) = IR_Tbl_Idx;
03875 OPND_IDX(opnd) = len_idx;
03876 OPND_LINE_NUM(opnd) = AT_DEF_LINE(attr_idx);
03877 OPND_COL_NUM(opnd) = AT_DEF_COLUMN(attr_idx);
03878
03879 {
03880 expr_arg_type exp_desc;
03881 fold_clen_opr(&opnd, &exp_desc);
03882 }
03883
03884 gen_sh(After,
03885 Automatic_Base_Size_Stmt,
03886 stmt_start_line,
03887 stmt_start_col,
03888 FALSE,
03889 FALSE,
03890 TRUE);
03891
03892 find_opnd_line_and_column(&opnd, &line, &column);
03893 GEN_COMPILER_TMP_ASG(ir_idx,
03894 tmp_attr_idx,
03895 TRUE,
03896 line,
03897 column,
03898 SA_INTEGER_DEFAULT_TYPE,
03899 Priv);
03900
03901 COPY_OPND(IR_OPND_R(ir_idx), opnd);
03902
03903 SH_P2_SKIP_ME(curr_stmt_sh_idx) = TRUE;
03904 SH_IR_IDX(curr_stmt_sh_idx) = ir_idx;
03905 ATD_TMP_IDX(tmp_attr_idx) = ir_idx;
03906 ATD_FLD(tmp_attr_idx) = IR_Tbl_Idx;
03907
03908
03909
03910
03911 type_tbl[TYP_WORK_IDX] = type_tbl[ATD_TYPE_IDX(attr_idx)];
03912 TYP_FLD(TYP_WORK_IDX) = AT_Tbl_Idx;
03913 TYP_IDX(TYP_WORK_IDX) = tmp_attr_idx;
03914
03915 ATD_TYPE_IDX(attr_idx) = ntr_type_tbl();
03916
03917
03918
03919
03920
03921 insert_sh_after_entries(attr_idx,
03922 SH_PREV_IDX(curr_stmt_sh_idx),
03923 curr_stmt_sh_idx,
03924 FALSE,
03925 TRUE);
03926 break;
03927
03928 case CRI__Pointee:
03929
03930
03931
03932
03933 type_tbl[TYP_WORK_IDX] = type_tbl[ATD_TYPE_IDX(attr_idx)];
03934 TYP_FLD(TYP_WORK_IDX) = AT_Tbl_Idx;
03935 TYP_IDX(TYP_WORK_IDX) = ATD_PTR_IDX(attr_idx);
03936
03937 ATD_TYPE_IDX(attr_idx) = ntr_type_tbl();
03938 break;
03939
03940 case Constant:
03941 break;
03942
03943 default:
03944 PRINTMSG(AT_DEF_LINE(attr_idx), 350, Error,
03945 AT_DEF_COLUMN(attr_idx),
03946 AT_OBJ_NAME_PTR(attr_idx));
03947 AT_DCL_ERR(attr_idx) = TRUE;
03948 break;
03949 }
03950 }
03951 }
03952 else if (TYP_CHAR_CLASS(type_idx) == Const_Len_Char) {
03953
03954 if (compare_cn_and_value(TYP_IDX(type_idx), 0, Lt_Opr)) {
03955 type_tbl[TYP_WORK_IDX] = type_tbl[type_idx];
03956 TYP_IDX(TYP_WORK_IDX) = CN_INTEGER_ZERO_IDX;
03957 ATD_TYPE_IDX(attr_idx) = ntr_type_tbl();
03958 }
03959 else if (compare_cn_and_value(TYP_IDX(type_idx),
03960 max_character_length,
03961 Gt_Opr) &&
03962 TYP_TYPE(CN_TYPE_IDX(TYP_IDX(type_idx))) == Integer) {
03963
03964 PRINTMSG(AT_DEF_LINE(attr_idx), 35, Error,
03965 AT_DEF_COLUMN(attr_idx),
03966 AT_OBJ_NAME_PTR(attr_idx),
03967 max_character_length);
03968
03969 type_tbl[TYP_WORK_IDX] = type_tbl[type_idx];
03970 TYP_IDX(TYP_WORK_IDX) = C_INT_TO_CN(CN_TYPE_IDX(TYP_IDX(type_idx)),
03971 max_character_length);
03972 ATD_TYPE_IDX(attr_idx) = ntr_type_tbl();
03973 AT_DCL_ERR(attr_idx) = TRUE;
03974 }
03975 }
03976
03977 EXIT:
03978
03979 TYP_RESOLVED(ATD_TYPE_IDX(attr_idx)) = TRUE;
03980
03981 TRACE (Func_Exit, "char_len_resolution", NULL);
03982
03983 return;
03984
03985 }
03986
03987
03988
03989
03990
03991
03992
03993
03994
03995
03996
03997
03998
03999
04000
04001
04002
04003
04004 boolean compare_dummy_arguments(int idx1,
04005 int idx2)
04006
04007 {
04008 int i;
04009 boolean same = TRUE;
04010
04011
04012 TRACE (Func_Entry, "compare_dummy_arguments", NULL);
04013
04014 if (AT_OBJ_CLASS(idx1) == AT_OBJ_CLASS(idx2)) {
04015
04016 if (AT_OBJ_CLASS(idx1) == Pgm_Unit) {
04017
04018 if (!ATP_EXPL_ITRFC(idx1) || !ATP_EXPL_ITRFC(idx2)) {
04019
04020
04021
04022
04023 same = FALSE;
04024 }
04025 else if (ATP_PGM_UNIT(idx1) != ATP_PGM_UNIT(idx2) &&
04026 ATP_PGM_UNIT(idx1) != Pgm_Unknown &&
04027 ATP_PGM_UNIT(idx2) != Pgm_Unknown) {
04028 same = FALSE;
04029 }
04030 else {
04031
04032 if (ATP_PGM_UNIT(idx1) == ATP_PGM_UNIT(idx2) &&
04033 ATP_PGM_UNIT(idx2) == Function) {
04034
04035
04036
04037 same = compare_darg_or_rslt_types(ATP_RSLT_IDX(idx1),
04038 ATP_RSLT_IDX(idx2));
04039 }
04040
04041 if (same) {
04042
04043 if (ATP_NUM_DARGS(idx1) != ATP_NUM_DARGS(idx2)) {
04044 same = FALSE;
04045 }
04046 else {
04047
04048
04049
04050
04051 for (i = (ATP_EXTRA_DARG(idx1) ? 1 : 0);
04052 i < ATP_NUM_DARGS(idx1); i++) {
04053 same = compare_dummy_arguments(
04054 SN_ATTR_IDX((ATP_FIRST_IDX(idx1)+i)),
04055 SN_ATTR_IDX((ATP_FIRST_IDX(idx2)+i)));
04056
04057 if (!same) break;
04058 }
04059 }
04060 }
04061 }
04062 }
04063 else if (AT_OBJ_CLASS(idx1) == Data_Obj) {
04064
04065 if (ATD_CLASS(idx1) == ATD_CLASS(idx2)) {
04066
04067
04068
04069 if (ATD_CLASS(idx1) == Dummy_Argument &&
04070 !ATD_IGNORE_TKR(idx1) && !ATD_IGNORE_TKR(idx2)) {
04071 same = compare_darg_or_rslt_types(idx1, idx2);
04072 }
04073 }
04074 else {
04075 same = FALSE;
04076 }
04077 }
04078 }
04079 else {
04080 same = FALSE;
04081 }
04082
04083 TRACE (Func_Exit, "compare_dummy_arguments", NULL);
04084
04085 return(same);
04086
04087 }
04088
04089
04090
04091
04092
04093
04094
04095
04096
04097
04098
04099
04100
04101
04102
04103
04104
04105
04106 static void compare_entry_to_func_rslt(int attr_idx,
04107 int pgm_rslt_idx)
04108 {
04109 int column;
04110 int idx;
04111 int line;
04112 int loop;
04113 #ifdef KEY
04114 boolean not_a_match = FALSE;
04115 #else
04116 boolean not_a_match;
04117 #endif
04118 int pgm_type_idx;
04119 int rslt_idx;
04120 int rslt_type_idx;
04121
04122
04123 TRACE (Func_Entry, "compare_entry_to_func_rslt", NULL);
04124
04125 line = AT_DEF_LINE(attr_idx);
04126 column = AT_DEF_COLUMN(attr_idx);
04127 rslt_idx = ATP_RSLT_IDX(attr_idx);
04128 rslt_type_idx= ATD_TYPE_IDX(rslt_idx);
04129 pgm_type_idx = ATD_TYPE_IDX(pgm_rslt_idx);
04130
04131
04132 if (ATD_ARRAY_IDX(rslt_idx) != NULL_IDX &&
04133 BD_ARRAY_SIZE(ATD_ARRAY_IDX(rslt_idx)) == Symbolic_Constant_Size) {
04134 PRINTMSG(line, 1230, Error, column, AT_OBJ_NAME_PTR(attr_idx));
04135 }
04136 else if (ATD_ARRAY_IDX(rslt_idx) != ATD_ARRAY_IDX(pgm_rslt_idx) &&
04137 !compare_array_entries(ATD_ARRAY_IDX(rslt_idx),
04138 ATD_ARRAY_IDX(pgm_rslt_idx))) {
04139 PRINTMSG(line, 673, Error, column, AT_OBJ_NAME_PTR(pgm_rslt_idx),
04140 AT_OBJ_NAME_PTR(rslt_idx));
04141 }
04142 else if (ATD_POINTER(pgm_rslt_idx) != ATD_POINTER(rslt_idx)) {
04143 PRINTMSG(line, 674, Error, column, AT_OBJ_NAME_PTR(pgm_rslt_idx),
04144 AT_OBJ_NAME_PTR(rslt_idx));
04145 }
04146 else if (TYP_TYPE(ATD_TYPE_IDX(rslt_idx)) !=
04147 TYP_TYPE(ATD_TYPE_IDX(pgm_rslt_idx))) {
04148
04149 if (TYP_TYPE(rslt_type_idx) > Complex ||
04150 TYP_TYPE(pgm_type_idx) > Complex) {
04151 PRINTMSG(line, 21, Error, column, AT_OBJ_NAME_PTR(pgm_rslt_idx),
04152 AT_OBJ_NAME_PTR(rslt_idx));
04153 }
04154 # if defined(_TARGET_OS_MAX)
04155
04156 else if (cmd_line_flags.integer_32 &&
04157 !cmd_line_flags.s_default32 &&
04158 ((TYP_TYPE(rslt_type_idx) == Integer &&
04159 TYP_DESC(rslt_type_idx) == Default_Typed) ||
04160 (TYP_TYPE(pgm_type_idx) == Integer &&
04161 TYP_DESC(pgm_type_idx) == Default_Typed))) {
04162
04163 if (TYP_TYPE(rslt_type_idx) == Integer) {
04164 PRINTMSG(line, 1195, Warning, column,
04165 AT_OBJ_NAME_PTR(rslt_idx),
04166 AT_OBJ_NAME_PTR(pgm_rslt_idx));
04167 }
04168 else {
04169 PRINTMSG(line, 1195, Warning, column,
04170 AT_OBJ_NAME_PTR(pgm_rslt_idx),
04171 AT_OBJ_NAME_PTR(rslt_idx));
04172 }
04173 }
04174 # endif
04175 else if (on_off_flags.issue_ansi_messages ||
04176 GET_MESSAGE_TBL(message_warning_tbl, 22) ||
04177 GET_MESSAGE_TBL(message_error_tbl, 22)) {
04178
04179
04180
04181
04182
04183
04184 idx = rslt_idx;
04185
04186 for (loop = 1; loop <=2; loop++) {
04187
04188 switch (TYP_TYPE(ATD_TYPE_IDX(idx))) {
04189 case Logical:
04190 not_a_match = TYP_LINEAR(ATD_TYPE_IDX(idx)) !=
04191 LOGICAL_DEFAULT_TYPE;
04192 break;
04193
04194 case Complex:
04195 not_a_match = TYP_LINEAR(ATD_TYPE_IDX(idx)) !=
04196 COMPLEX_DEFAULT_TYPE;
04197 break;
04198
04199 case Integer:
04200 not_a_match = TYP_LINEAR(ATD_TYPE_IDX(idx)) !=
04201 INTEGER_DEFAULT_TYPE;
04202 break;
04203
04204 case Real:
04205 not_a_match = (TYP_LINEAR(ATD_TYPE_IDX(idx)) !=
04206 REAL_DEFAULT_TYPE &&
04207 TYP_LINEAR(ATD_TYPE_IDX(idx)) !=
04208 DOUBLE_DEFAULT_TYPE);
04209 break;
04210 }
04211
04212 if (not_a_match) {
04213 PRINTMSG(line, 22, Ansi, column, AT_OBJ_NAME_PTR(idx));
04214 }
04215
04216 idx = pgm_rslt_idx;
04217 }
04218 }
04219 }
04220 else if (TYP_LINEAR(rslt_type_idx) == TYP_LINEAR(pgm_type_idx) &&
04221 TYP_IDX(rslt_type_idx) == TYP_IDX(pgm_type_idx)) {
04222
04223
04224
04225 }
04226 else if (TYP_TYPE(rslt_type_idx) == Character) {
04227
04228
04229
04230
04231 if (TYP_CHAR_CLASS(rslt_type_idx) == Const_Len_Char &&
04232 TYP_CHAR_CLASS(pgm_type_idx) == Const_Len_Char &&
04233 fold_relationals(TYP_IDX(rslt_type_idx),
04234 TYP_IDX(pgm_type_idx), Ne_Opr)) {
04235 PRINTMSG(line, 21, Error, column, AT_OBJ_NAME_PTR(pgm_rslt_idx),
04236 AT_OBJ_NAME_PTR(rslt_idx));
04237 }
04238 }
04239 else if (TYP_TYPE(rslt_type_idx) == Structure) {
04240
04241
04242
04243
04244 if (!compare_derived_types(rslt_type_idx, pgm_type_idx)) {
04245 PRINTMSG(line, 21, Error, column, AT_OBJ_NAME_PTR(pgm_rslt_idx),
04246 AT_OBJ_NAME_PTR(rslt_idx));
04247 }
04248 }
04249 else if (on_off_flags.issue_ansi_messages ||
04250 GET_MESSAGE_TBL(message_warning_tbl, 13) ||
04251 GET_MESSAGE_TBL(message_error_tbl, 13)) {
04252
04253
04254
04255
04256
04257
04258 if ((TYP_TYPE(rslt_type_idx) == Real) &&
04259 (TYP_LINEAR(rslt_type_idx) == REAL_DEFAULT_TYPE ||
04260 TYP_LINEAR(rslt_type_idx) == DOUBLE_DEFAULT_TYPE) &&
04261 (TYP_LINEAR(pgm_type_idx) == REAL_DEFAULT_TYPE ||
04262 TYP_LINEAR(pgm_type_idx) == DOUBLE_DEFAULT_TYPE)) {
04263
04264 }
04265 else {
04266 PRINTMSG(line, 13, Ansi, column, AT_OBJ_NAME_PTR(pgm_rslt_idx),
04267 AT_OBJ_NAME_PTR(rslt_idx));
04268 }
04269 }
04270
04271 TRACE (Func_Exit, "compare_entry_to_func_rslt", NULL);
04272
04273 return;
04274
04275 }
04276
04277
04278
04279
04280
04281
04282
04283
04284
04285
04286
04287
04288
04289
04290
04291
04292 void decl_semantics(void)
04293
04294 {
04295 int al_idx;
04296 int attr_idx;
04297 int count;
04298 int darg_idx;
04299 int darg_list_idx;
04300 int eq_idx;
04301 int entry_attr_idx;
04302 int entry_idx;
04303 int entry_list_idx;
04304 int group;
04305 int idx;
04306 int label_sh_idx;
04307 int line;
04308 int list_idx;
04309 int list_idx2;
04310 int name_idx;
04311 opnd_type opnd;
04312 int pgm_attr_idx;
04313 int prev_idx;
04314 boolean recursive;
04315 int rslt_idx;
04316 int save_curr_stmt_sh_idx;
04317 int sh_after_entry_idx;
04318
04319
04320 TRACE (Func_Entry, "decl_semantics", NULL);
04321
04322 pgm_attr_idx = SCP_ATTR_IDX(curr_scp_idx);
04323
04324
04325
04326 if (on_off_flags.save_all_vars) {
04327
04328 if (ATP_RECURSIVE(pgm_attr_idx)) {
04329 PRINTMSG(AT_DEF_LINE(pgm_attr_idx), 1103, Caution,
04330 AT_DEF_COLUMN(pgm_attr_idx),
04331 AT_OBJ_NAME_PTR(pgm_attr_idx));
04332 }
04333 else if (SCP_PARENT_IDX(curr_scp_idx) != NULL_IDX) {
04334
04335
04336
04337 idx = SCP_PARENT_IDX(curr_scp_idx);
04338 recursive = FALSE;
04339
04340 do {
04341
04342 if (ATP_RECURSIVE(SCP_ATTR_IDX(idx))) {
04343 recursive = TRUE;
04344 break;
04345 }
04346 idx = SCP_PARENT_IDX(idx);
04347 }
04348 while (idx != NULL_IDX);
04349
04350 if (!recursive) {
04351 ATP_SAVE_ALL(pgm_attr_idx) = TRUE;
04352 }
04353 }
04354 else {
04355 ATP_SAVE_ALL(pgm_attr_idx) = TRUE;
04356 }
04357 }
04358
04359
04360
04361 if (ATP_PGM_UNIT(pgm_attr_idx) == Module) {
04362 SCP_DEFAULT_STORAGE(curr_scp_idx) = Static;
04363 }
04364 else if (!ATP_SAVE_ALL(pgm_attr_idx) ||
04365 ATP_STACK_DIR(pgm_attr_idx) ||
04366 ATP_RECURSIVE(pgm_attr_idx) ||
04367 (on_off_flags.recursive &&
04368 (ATP_PGM_UNIT(pgm_attr_idx) == Function ||
04369 ATP_PGM_UNIT(pgm_attr_idx) == Subroutine))) {
04370 SCP_DEFAULT_STORAGE(curr_scp_idx) = Stack;
04371 }
04372 else {
04373 SCP_DEFAULT_STORAGE(curr_scp_idx) = Static;
04374 }
04375
04376
04377
04378 allocatable_list_idx = NULL_IDX;
04379 namelist_list_idx = NULL_IDX;
04380 number_of_allocatables = 0;
04381 pointee_based_blk = NULL_IDX;
04382 alt_entry_equiv_blk = NULL_IDX;
04383 alt_entry_equiv_grp = NULL_IDX;
04384 reshape_array_list = NULL_IDX;
04385 init_sh_start_idx = NULL_IDX;
04386 init_sh_end_idx = NULL_IDX;
04387
04388
04389
04390
04391
04392
04393 sh_after_entry_idx = SH_NEXT_IDX(curr_stmt_sh_idx);
04394 SH_NEXT_IDX(curr_stmt_sh_idx) = NULL_IDX;
04395 SH_PREV_IDX(sh_after_entry_idx) = NULL_IDX;
04396
04397 if (cmd_line_flags.debug_lvl <= Debug_Lvl_1 &&
04398 ATP_PGM_UNIT(pgm_attr_idx) <= Program) {
04399
04400
04401
04402
04403
04404
04405
04406 idx = SH_NEXT_IDX(sh_after_entry_idx);
04407 label_sh_idx = sh_after_entry_idx;
04408
04409 while (SH_STMT_TYPE(idx) == Type_Init_Stmt ||
04410 SH_STMT_TYPE(idx) == Data_Stmt) {
04411 idx = SH_NEXT_IDX(idx);
04412 }
04413
04414 if (idx != SH_NEXT_IDX(sh_after_entry_idx)) {
04415
04416
04417
04418
04419
04420 sh_after_entry_idx = SH_NEXT_IDX(label_sh_idx);
04421 SH_PREV_IDX(sh_after_entry_idx) = NULL_IDX;
04422
04423 SH_NEXT_IDX(label_sh_idx) = idx;
04424
04425 if (SH_PREV_IDX(idx)) {
04426 SH_NEXT_IDX(SH_PREV_IDX(idx)) = label_sh_idx;
04427 }
04428 SH_PREV_IDX(label_sh_idx) = SH_PREV_IDX(idx);
04429 SH_PREV_IDX(idx) = label_sh_idx;
04430 }
04431
04432 line = SH_GLB_LINE(idx);
04433 SH_GLB_LINE(label_sh_idx) = line;
04434 IR_LINE_NUM(SH_IR_IDX(label_sh_idx)) = line;
04435 IR_LINE_NUM_L(SH_IR_IDX(label_sh_idx)) = line;
04436 AT_DEF_LINE(IR_IDX_L(SH_IR_IDX(label_sh_idx))) = line;
04437 }
04438
04439 if (SCP_ALT_ENTRY_CNT(curr_scp_idx) > 0) {
04440
04441 if (ATP_PGM_UNIT(pgm_attr_idx) == Function &&
04442 (TYP_TYPE(ATD_TYPE_IDX(ATP_RSLT_IDX(pgm_attr_idx))) == Character ||
04443 ATD_ARRAY_IDX(ATP_RSLT_IDX(pgm_attr_idx)) != NULL_IDX)) {
04444 entry_idx = SCP_ENTRY_IDX(curr_scp_idx);
04445
04446
04447
04448
04449
04450 while (entry_idx != NULL_IDX) {
04451
04452
04453
04454 NTR_ATTR_LIST_TBL(list_idx);
04455 AL_ATTR_IDX(list_idx) = pgm_attr_idx;
04456 entry_attr_idx = AL_ATTR_IDX(entry_idx);
04457
04458 if (ATP_NO_ENTRY_LIST(entry_attr_idx) != NULL_IDX) {
04459 AL_NEXT_IDX(list_idx) = ATP_NO_ENTRY_LIST(entry_attr_idx);
04460 AL_ENTRY_COUNT(list_idx) =
04461 AL_ENTRY_COUNT(AL_NEXT_IDX(list_idx))+ 1;
04462 }
04463 else {
04464 AL_ENTRY_COUNT(list_idx) = 1;
04465 }
04466
04467 ATP_NO_ENTRY_LIST(entry_attr_idx) = list_idx;
04468
04469
04470
04471 NTR_ATTR_LIST_TBL(list_idx);
04472 AL_ATTR_IDX(list_idx) = entry_attr_idx;
04473
04474 if (ATP_NO_ENTRY_LIST(pgm_attr_idx) != NULL_IDX) {
04475 AL_NEXT_IDX(list_idx) = ATP_NO_ENTRY_LIST(pgm_attr_idx);
04476 AL_ENTRY_COUNT(list_idx) =
04477 AL_ENTRY_COUNT(AL_NEXT_IDX(list_idx)) + 1;
04478 }
04479 else {
04480 AL_ENTRY_COUNT(list_idx) = 1;
04481 }
04482
04483 ATP_NO_ENTRY_LIST(pgm_attr_idx) = list_idx;
04484
04485 entry_list_idx = SCP_ENTRY_IDX(curr_scp_idx);
04486
04487 while (entry_list_idx != NULL_IDX) {
04488
04489 if (entry_attr_idx != AL_ATTR_IDX(entry_list_idx)) {
04490 NTR_ATTR_LIST_TBL(list_idx);
04491 AL_ATTR_IDX(list_idx) = entry_attr_idx;
04492
04493 if (ATP_NO_ENTRY_LIST(AL_ATTR_IDX(entry_list_idx)) !=
04494 NULL_IDX) {
04495 AL_NEXT_IDX(list_idx) =
04496 ATP_NO_ENTRY_LIST(AL_ATTR_IDX(entry_list_idx));
04497 AL_ENTRY_COUNT(list_idx) =
04498 AL_ENTRY_COUNT(AL_NEXT_IDX(list_idx)) + 1;
04499 }
04500 else {
04501 AL_ENTRY_COUNT(list_idx) = 1;
04502 }
04503 ATP_NO_ENTRY_LIST(AL_ATTR_IDX(entry_list_idx)) = list_idx;
04504 }
04505 entry_list_idx = AL_NEXT_IDX(entry_list_idx);
04506 }
04507 entry_idx = AL_NEXT_IDX(entry_idx);
04508 }
04509 }
04510
04511
04512
04513
04514
04515
04516 darg_list_idx = SCP_DARG_LIST(curr_scp_idx);
04517
04518 while (darg_list_idx != NULL_IDX) {
04519 darg_idx = AL_ATTR_IDX(darg_list_idx);
04520 darg_list_idx = AL_NEXT_IDX(darg_list_idx);
04521 list_idx = NULL_IDX;
04522
04523
04524 if (SCP_IGNORE_TKR(curr_scp_idx) &&
04525 AT_OBJ_CLASS(darg_idx) == Data_Obj) {
04526
04527 if (!fnd_semantic_err(Obj_Ignore_TKR,
04528 AT_DEF_LINE(darg_idx),
04529 AT_DEF_COLUMN(darg_idx),
04530 darg_idx,
04531 TRUE)) {
04532 ATD_IGNORE_TKR(darg_idx) = TRUE;
04533 }
04534 }
04535
04536 if (!darg_in_entry_list(darg_idx, pgm_attr_idx)) {
04537 NTR_ATTR_LIST_TBL(list_idx);
04538 AL_ATTR_IDX(list_idx) = pgm_attr_idx;
04539 AT_ALT_DARG(darg_idx) = TRUE;
04540 AL_ENTRY_COUNT(list_idx) = 1;
04541
04542 if (AT_OBJ_CLASS(darg_idx) == Data_Obj) {
04543 ATD_NO_ENTRY_LIST(darg_idx) = list_idx;
04544 }
04545 else {
04546 ATP_NO_ENTRY_LIST(darg_idx) = list_idx;
04547 }
04548 }
04549
04550 entry_list_idx = SCP_ENTRY_IDX(curr_scp_idx);
04551
04552 while(entry_list_idx != NULL_IDX) {
04553 entry_attr_idx = AL_ATTR_IDX(entry_list_idx);
04554 entry_list_idx = AL_NEXT_IDX(entry_list_idx);
04555
04556 if (!darg_in_entry_list(darg_idx, entry_attr_idx)) {
04557 prev_idx = list_idx;
04558 NTR_ATTR_LIST_TBL(list_idx);
04559
04560 if (prev_idx == NULL_IDX) {
04561 AL_ENTRY_COUNT(list_idx) = 1;
04562
04563 if (AT_OBJ_CLASS(darg_idx) == Data_Obj) {
04564 ATD_NO_ENTRY_LIST(darg_idx) = list_idx;
04565 }
04566 else {
04567 ATP_NO_ENTRY_LIST(darg_idx) = list_idx;
04568 }
04569 }
04570 else {
04571 AL_NEXT_IDX(prev_idx) = list_idx;
04572
04573 if (AT_OBJ_CLASS(darg_idx) == Data_Obj) {
04574 AL_ENTRY_COUNT(ATD_NO_ENTRY_LIST(darg_idx))+=1;
04575 }
04576 else {
04577 AL_ENTRY_COUNT(ATP_NO_ENTRY_LIST(darg_idx))+=1;
04578 }
04579 }
04580 AL_ATTR_IDX(list_idx) = entry_attr_idx;
04581 AT_ALT_DARG(darg_idx) = TRUE;
04582 }
04583 }
04584 }
04585 }
04586 else {
04587 darg_list_idx = SCP_DARG_LIST(curr_scp_idx);
04588
04589 while (darg_list_idx != NULL_IDX) {
04590 darg_idx = AL_ATTR_IDX(darg_list_idx);
04591 darg_list_idx = AL_NEXT_IDX(darg_list_idx);
04592
04593 if (SCP_IGNORE_TKR(curr_scp_idx) &&
04594 AT_OBJ_CLASS(darg_idx) == Data_Obj) {
04595
04596 if (!fnd_semantic_err(Obj_Ignore_TKR,
04597 AT_DEF_LINE(darg_idx),
04598 AT_DEF_COLUMN(darg_idx),
04599 darg_idx,
04600 TRUE)) {
04601 ATD_IGNORE_TKR(darg_idx) = TRUE;
04602 }
04603 }
04604 }
04605 }
04606
04607 if (opt_flags.reshape) {
04608
04609
04610
04611
04612 reshape_array_semantics();
04613
04614 }
04615
04616
04617
04618
04619
04620 for (idx = 0; idx < MAX_IMPL_CHS; idx++) {
04621
04622 if (IM_SET(curr_scp_idx, idx) &&
04623 TYP_TYPE(IM_TYPE_IDX(curr_scp_idx, idx)) == Character &&
04624 TYP_FLD(IM_TYPE_IDX(curr_scp_idx, idx)) == AT_Tbl_Idx) {
04625 attr_semantics(TYP_IDX(IM_TYPE_IDX(curr_scp_idx, idx)), TRUE);
04626 }
04627 }
04628
04629
04630
04631
04632 attr_semantics(pgm_attr_idx, FALSE);
04633
04634
04635
04636
04637
04638
04639
04640
04641
04642
04643 for (name_idx = SCP_LN_FW_IDX(curr_scp_idx) + 1;
04644 name_idx < SCP_LN_LW_IDX(curr_scp_idx); name_idx++) {
04645
04646 attr_idx = LN_ATTR_IDX(name_idx);
04647 attr_semantics(attr_idx, FALSE);
04648 }
04649
04650 al_idx = SCP_ATTR_LIST(curr_scp_idx);
04651
04652 while (al_idx != NULL_IDX) {
04653 attr_idx = AL_ATTR_IDX(al_idx);
04654 al_idx = AL_NEXT_IDX(al_idx);
04655
04656 attr_semantics(attr_idx, FALSE);
04657 }
04658
04659 # if !defined(_SINGLE_ALLOCS_FOR_AUTOMATIC)
04660
04661
04662
04663 gen_multiple_automatic_allocate(NULL_IDX);
04664
04665 # endif
04666
04667
04668
04669
04670 while (SH_PREV_IDX(sh_after_entry_idx) != NULL_IDX) {
04671 sh_after_entry_idx = SH_PREV_IDX(sh_after_entry_idx);
04672 }
04673
04674
04675
04676
04677 while (SH_NEXT_IDX(curr_stmt_sh_idx) != NULL_IDX) {
04678 curr_stmt_sh_idx = SH_NEXT_IDX(curr_stmt_sh_idx);
04679 }
04680
04681 if (init_sh_start_idx != NULL_IDX) {
04682
04683
04684
04685 SH_NEXT_IDX(init_sh_end_idx) = SH_NEXT_IDX(curr_stmt_sh_idx);
04686 SH_NEXT_IDX(curr_stmt_sh_idx) = init_sh_start_idx;
04687 SH_PREV_IDX(init_sh_start_idx) = curr_stmt_sh_idx;
04688 SH_PREV_IDX(SH_NEXT_IDX(init_sh_end_idx)) = init_sh_end_idx;
04689 curr_stmt_sh_idx = init_sh_end_idx;
04690 }
04691
04692 SH_NEXT_IDX(curr_stmt_sh_idx) = sh_after_entry_idx;
04693 SH_PREV_IDX(sh_after_entry_idx) = curr_stmt_sh_idx;
04694
04695 if (ATP_PGM_UNIT(pgm_attr_idx) == Function &&
04696 SCP_ENTRY_IDX(curr_scp_idx) != NULL_IDX &&
04697 TYP_TYPE(ATD_TYPE_IDX(ATP_RSLT_IDX(pgm_attr_idx))) == Character) {
04698
04699
04700
04701
04702
04703
04704
04705
04706 count = 0;
04707 al_idx = SCP_ENTRY_IDX(curr_scp_idx);
04708
04709 while (al_idx != NULL_IDX) {
04710 rslt_idx = ATP_RSLT_IDX(AL_ATTR_IDX(al_idx));
04711
04712 if (TYP_FLD(ATD_TYPE_IDX(rslt_idx)) == AT_Tbl_Idx) {
04713 NTR_EQ_TBL(eq_idx);
04714 EQ_LINE_NUM(eq_idx) = AT_DEF_LINE(rslt_idx);
04715 EQ_COLUMN_NUM(eq_idx) = AT_DEF_COLUMN(rslt_idx);
04716 EQ_ATTR_IDX(eq_idx) = TYP_IDX(ATD_TYPE_IDX(rslt_idx));
04717 ATD_EQUIV(EQ_ATTR_IDX(eq_idx)) = TRUE;
04718 group = SCP_FIRST_EQUIV_GRP(curr_scp_idx);
04719
04720 if (count == 0) {
04721 EQ_NEXT_EQUIV_GRP(eq_idx) = group;
04722 SCP_FIRST_EQUIV_GRP(curr_scp_idx) = eq_idx;
04723 group = eq_idx;
04724 }
04725 else {
04726 EQ_NEXT_EQUIV_OBJ(EQ_GRP_END_IDX(group)) = eq_idx;
04727 }
04728 EQ_GRP_END_IDX(group) = eq_idx;
04729 EQ_GRP_IDX(eq_idx) = group;
04730 count++;
04731 }
04732 al_idx = AL_NEXT_IDX(al_idx);
04733 }
04734
04735 if (count > 0 &&
04736 TYP_FLD(ATD_TYPE_IDX(ATP_RSLT_IDX(pgm_attr_idx))) == AT_Tbl_Idx) {
04737 NTR_EQ_TBL(eq_idx);
04738 rslt_idx = ATP_RSLT_IDX(pgm_attr_idx);
04739 EQ_LINE_NUM(eq_idx) = AT_DEF_LINE(rslt_idx);
04740 EQ_COLUMN_NUM(eq_idx) = AT_DEF_COLUMN(rslt_idx);
04741 EQ_ATTR_IDX(eq_idx) = TYP_IDX(ATD_TYPE_IDX(rslt_idx));
04742 ATD_EQUIV(EQ_ATTR_IDX(eq_idx)) = TRUE;
04743 group = SCP_FIRST_EQUIV_GRP(curr_scp_idx);
04744 EQ_NEXT_EQUIV_OBJ(EQ_GRP_END_IDX(group)) = eq_idx;
04745 EQ_GRP_END_IDX(group) = eq_idx;
04746 EQ_GRP_IDX(eq_idx) = group;
04747 }
04748 else if (count == 1) {
04749 SCP_FIRST_EQUIV_GRP(curr_scp_idx) =
04750 EQ_NEXT_EQUIV_GRP(SCP_FIRST_EQUIV_GRP(curr_scp_idx));
04751 }
04752 }
04753
04754 if (ATP_ARGCHCK_ENTRY(pgm_attr_idx)) {
04755 insert_argchck_calls(sh_after_entry_idx, pgm_attr_idx);
04756
04757 if (SCP_ALT_ENTRY_CNT(curr_scp_idx) != 0) {
04758 entry_list_idx = SCP_ENTRY_IDX(curr_scp_idx);
04759
04760 while (entry_list_idx != NULL_IDX) {
04761 insert_argchck_calls(ATP_ENTRY_LABEL_SH_IDX(AL_ATTR_IDX(
04762 entry_list_idx)),
04763 AL_ATTR_IDX(entry_list_idx));
04764 entry_list_idx = AL_NEXT_IDX(entry_list_idx);
04765 }
04766 }
04767 }
04768
04769 if (SCP_FIRST_EQUIV_GRP(curr_scp_idx) != NULL_IDX &&
04770 num_prog_unit_errors == 0) {
04771 equivalence_semantics();
04772 }
04773
04774
04775
04776
04777 if (alt_entry_equiv_grp != NULL_IDX) {
04778 EQ_NEXT_EQUIV_GRP(alt_entry_equiv_grp)= SCP_FIRST_EQUIV_GRP(curr_scp_idx);
04779 EQ_SEMANTICS_DONE(alt_entry_equiv_grp)= TRUE;
04780 SCP_FIRST_EQUIV_GRP(curr_scp_idx) = alt_entry_equiv_grp;
04781 }
04782
04783 if (namelist_list_idx != NULL_IDX) {
04784 namelist_resolution(namelist_list_idx);
04785 }
04786
04787 if (allocatable_list_idx != NULL_IDX) {
04788 deallocate_local_allocatables();
04789 }
04790
04791 if (ATP_PGM_UNIT(pgm_attr_idx) == Function ||
04792 ATP_PGM_UNIT(pgm_attr_idx) == Subroutine) {
04793
04794 if (SCP_COPY_ASSUMED_SHAPE(curr_scp_idx) &&
04795 SCP_COPY_ASSUMED_LIST(curr_scp_idx) != NULL_IDX &&
04796 IL_FLD(SCP_COPY_ASSUMED_LIST(curr_scp_idx)) != NO_Tbl_Idx) {
04797
04798
04799 PRINTMSG(IL_LINE_NUM(IL_IDX(SCP_COPY_ASSUMED_LIST(curr_scp_idx))),
04800 1281, Error,
04801 IL_COL_NUM(IL_IDX(SCP_COPY_ASSUMED_LIST(curr_scp_idx))));
04802 }
04803 else if (SCP_COPY_ASSUMED_SHAPE(curr_scp_idx)) {
04804
04805 idx = SCP_DARG_LIST(curr_scp_idx);
04806
04807 list_idx = NULL_IDX;
04808 OPND_IDX(opnd) = NULL_IDX;
04809
04810 while (idx != NULL_IDX) {
04811
04812 attr_idx = AL_ATTR_IDX(idx);
04813
04814 if (AT_OBJ_CLASS(attr_idx) == Data_Obj &&
04815 ATD_ARRAY_IDX(attr_idx) != NULL_IDX &&
04816 BD_ARRAY_CLASS(ATD_ARRAY_IDX(attr_idx)) == Assumed_Shape) {
04817
04818 if (list_idx == NULL_IDX) {
04819 NTR_IR_LIST_TBL(list_idx);
04820 OPND_FLD(opnd) = IL_Tbl_Idx;
04821 OPND_IDX(opnd) = list_idx;
04822 OPND_LIST_CNT(opnd) = 1;
04823 }
04824 else {
04825 NTR_IR_LIST_TBL(IL_NEXT_LIST_IDX(list_idx));
04826 IL_PREV_LIST_IDX(IL_NEXT_LIST_IDX(list_idx)) = list_idx;
04827 list_idx = IL_NEXT_LIST_IDX(list_idx);
04828 OPND_LIST_CNT(opnd) += 1;
04829 }
04830
04831 IL_FLD(list_idx) = AT_Tbl_Idx;
04832 IL_IDX(list_idx) = attr_idx;
04833 IL_LINE_NUM(list_idx) =
04834 IL_LINE_NUM(SCP_COPY_ASSUMED_LIST(curr_scp_idx));
04835 IL_COL_NUM(list_idx) =
04836 IL_COL_NUM(SCP_COPY_ASSUMED_LIST(curr_scp_idx));
04837 }
04838
04839 idx = AL_NEXT_IDX(idx);
04840 }
04841
04842 if (OPND_IDX(opnd) != NULL_IDX) {
04843 reassign_XT_temps = must_reassign_XT_temp(&opnd);
04844 shared_bd_idx = -1;
04845 list_idx = OPND_IDX(opnd);
04846
04847 while (list_idx != NULL_IDX) {
04848 curr_stmt_sh_idx = sh_after_entry_idx;
04849 gen_assumed_shape_copy(&IL_OPND(list_idx));
04850 list_idx = IL_NEXT_LIST_IDX(list_idx);
04851 }
04852 }
04853 else {
04854 PRINTMSG(IL_LINE_NUM(SCP_COPY_ASSUMED_LIST(curr_scp_idx)),
04855 1304, Caution,
04856 IL_COL_NUM(SCP_COPY_ASSUMED_LIST(curr_scp_idx)));
04857 }
04858 }
04859 else if (SCP_COPY_ASSUMED_LIST(curr_scp_idx) != NULL_IDX) {
04860 list_idx = SCP_COPY_ASSUMED_LIST(curr_scp_idx);
04861
04862 while (list_idx) {
04863 shared_bd_idx = -1;
04864 COPY_OPND(opnd, IL_OPND(list_idx));
04865 reassign_XT_temps = must_reassign_XT_temp(&opnd);
04866 list_idx2 = OPND_IDX(opnd);
04867
04868 while (list_idx2) {
04869 if (AT_DCL_ERR(IL_IDX(list_idx2))) {
04870
04871 }
04872 else if (AT_OBJ_CLASS(IL_IDX(list_idx2)) != Data_Obj ||
04873 ATD_ARRAY_IDX(IL_IDX(list_idx2)) == NULL_IDX ||
04874 BD_ARRAY_CLASS(ATD_ARRAY_IDX(IL_IDX(list_idx2))) !=
04875 Assumed_Shape) {
04876
04877 PRINTMSG(IL_LINE_NUM(list_idx2), 1303, Error,
04878 IL_COL_NUM(list_idx2));
04879 }
04880 else {
04881 curr_stmt_sh_idx = sh_after_entry_idx;
04882 gen_assumed_shape_copy(&IL_OPND(list_idx2));
04883 }
04884
04885 list_idx2 = IL_NEXT_LIST_IDX(list_idx2);
04886 }
04887
04888 list_idx = IL_NEXT_LIST_IDX(list_idx);
04889 }
04890 }
04891
04892 shared_bd_idx = NULL_IDX;
04893 }
04894 else {
04895
04896 if (SCP_COPY_ASSUMED_LIST(curr_scp_idx) != NULL_IDX) {
04897 list_idx = SCP_COPY_ASSUMED_LIST(curr_scp_idx);
04898
04899 while (list_idx) {
04900 COPY_OPND(opnd, IL_OPND(list_idx));
04901 list_idx2 = OPND_IDX(opnd);
04902
04903 while (list_idx2) {
04904
04905 if (AT_DCL_ERR(IL_IDX(list_idx2))) {
04906
04907 }
04908 else {
04909 PRINTMSG(IL_LINE_NUM(list_idx2), 1303, Error,
04910 IL_COL_NUM(list_idx2));
04911 }
04912 list_idx2 = IL_NEXT_LIST_IDX(list_idx2);
04913 }
04914
04915 list_idx = IL_NEXT_LIST_IDX(list_idx);
04916 }
04917 }
04918 }
04919
04920 # ifdef _F_MINUS_MINUS
04921
04922 # if ! defined(_TARGET_OS_MAX)
04923
04924 if (cmd_line_flags.co_array_fortran &&
04925 ATP_PGM_UNIT(pgm_attr_idx) == Program) {
04926
04927 save_curr_stmt_sh_idx = curr_stmt_sh_idx;
04928 curr_stmt_sh_idx = SCP_FIRST_SH_IDX(curr_scp_idx);
04929
04930 OPND_FLD(opnd) = CN_Tbl_Idx;
04931 OPND_IDX(opnd) = CN_INTEGER_ZERO_IDX;
04932 OPND_LINE_NUM(opnd) = AT_DEF_LINE(pgm_attr_idx);
04933 OPND_COL_NUM(opnd) = AT_DEF_COLUMN(pgm_attr_idx);
04934
04935 gen_internal_call_stmt(START_PES_LIB_ENTRY,
04936 &opnd,
04937 After);
04938
04939 PRINTMSG(AT_DEF_LINE(pgm_attr_idx), 1460, Warning,
04940 AT_DEF_COLUMN(pgm_attr_idx));
04941
04942 curr_stmt_sh_idx = save_curr_stmt_sh_idx;
04943 }
04944 # endif
04945 # endif
04946
04947 if (SCP_DARG_LIST(curr_scp_idx) != NULL_IDX) {
04948 free_attr_list(SCP_DARG_LIST(curr_scp_idx));
04949 SCP_DARG_LIST(curr_scp_idx) = NULL_IDX;
04950 }
04951
04952 SCP_RESHAPE_ARRAY_LIST(curr_scp_idx) = reshape_array_list;
04953 reshape_array_list = NULL_IDX;
04954
04955 TRACE (Func_Exit, "decl_semantics", NULL);
04956
04957 return;
04958
04959 }
04960
04961 #ifdef KEY
04962
04963 static long
04964 lazy_create_dealloc(int line, int col) {
04965 if (glb_tbl_idx[Dealloc_Attr_Idx] == NULL_IDX) {
04966 glb_tbl_idx[Dealloc_Attr_Idx] = create_lib_entry_attr(DEALLOC_LIB_ENTRY,
04967 DEALLOC_NAME_LEN, line, col);
04968 }
04969 return glb_tbl_idx[Dealloc_Attr_Idx];
04970 }
04971
04972
04973
04974
04975
04976
04977
04978
04979
04980
04981
04982
04983
04984
04985
04986 int
04987 help_dealloc(int line, int col, fld_type fld, int idx,
04988 boolean has_pe_ref, boolean do_gen_sh, boolean optional) {
04989
04990 if (do_gen_sh) {
04991 gen_sh(After, Assignment_Stmt, line, col, FALSE, FALSE, TRUE);
04992 SH_P2_SKIP_ME(curr_stmt_sh_idx) = TRUE;
04993 }
04994
04995 int list_idx;
04996 NTR_IR_LIST_TBL(list_idx);
04997 IL_FLD(list_idx) = IR_Tbl_Idx;
04998 IL_IDX(list_idx) = gen_ir(fld, idx, Aloc_Opr, CRI_Ptr_8,
04999 line, col, NO_Tbl_Idx, NULL_IDX);
05000
05001 int asg_idx = SH_IR_IDX(curr_stmt_sh_idx) = gen_ir(IL_Tbl_Idx, list_idx,
05002 Deallocate_Opr, TYPELESS_DEFAULT_TYPE, line, col, NO_Tbl_Idx, NULL_IDX);
05003
05004 int cn_idx;
05005 IR_FLD_R(asg_idx) = IL_Tbl_Idx;
05006 IR_LIST_CNT_R(asg_idx) = 3;
05007 IR_IDX_R(asg_idx) = gen_il(3, FALSE, line, col, AT_Tbl_Idx,
05008 lazy_create_dealloc(line, col), CN_Tbl_Idx,
05009 gen_alloc_header_const(Integer_8, 1, has_pe_ref, &cn_idx), CN_Tbl_Idx,
05010 CN_INTEGER_ZERO_IDX);
05011
05012 if (optional) {
05013 curr_stmt_sh_idx = gen_present_ir(idx, curr_stmt_sh_idx,
05014 curr_stmt_sh_idx);
05015 }
05016
05017 return curr_stmt_sh_idx;
05018 }
05019
05020
05021
05022
05023
05024
05025
05026
05027 int
05028 do_make_struct_opr(int line, int col, int attr_idx, fld_type attr_fld,
05029 int cpnt_attr_idx) {
05030 int cpnt_ir_idx;
05031 NTR_IR_TBL(cpnt_ir_idx);
05032 IR_OPR(cpnt_ir_idx) = Struct_Opr;
05033 IR_TYPE_IDX(cpnt_ir_idx) = ATD_TYPE_IDX(cpnt_attr_idx);
05034 IR_LINE_NUM(cpnt_ir_idx) = line;
05035 IR_COL_NUM(cpnt_ir_idx) = col;
05036 IR_FLD_L(cpnt_ir_idx) = attr_fld;
05037 IR_IDX_L(cpnt_ir_idx) = attr_idx;
05038 IR_FLD_R(cpnt_ir_idx) = AT_Tbl_Idx;
05039 IR_IDX_R(cpnt_ir_idx) = cpnt_attr_idx;
05040 IR_LINE_NUM_L(cpnt_ir_idx) = IR_LINE_NUM_R(cpnt_ir_idx) = line;
05041 IR_COL_NUM_L(cpnt_ir_idx) = IR_COL_NUM_R(cpnt_ir_idx) = col;
05042 return cpnt_ir_idx;
05043 }
05044
05045 static void help_dealloc_components(int, int, fld_type, int, boolean,
05046 boolean *);
05047 static void dealloc_allocatables(int, int, int, fld_type, int, boolean, boolean *);
05048
05049
05050
05051
05052
05053
05054
05055
05056
05057
05058
05059
05060
05061
05062
05063
05064 static void
05065 help_dealloc_array_of_struct(int line, int col, fld_type fld, int idx,
05066 boolean has_pe_ref, boolean *first) {
05067 opnd_type opnd;
05068 expr_arg_type exp_desc;
05069 int next_sh_idx = NULL_IDX;
05070 int placeholder_sh_idx = pre_gen_loops(line, col, &next_sh_idx);
05071 OPND_FLD(opnd) = fld;
05072 OPND_IDX(opnd) = idx;
05073 OPND_LINE_NUM(opnd) = line;
05074 OPND_COL_NUM(opnd) = col;
05075 gen_whole_subscript(&opnd, &exp_desc);
05076 gen_loops(&opnd, 0, TRUE);
05077 help_dealloc_components(line, col, OPND_FLD(opnd), OPND_IDX(opnd),
05078 has_pe_ref, first);
05079 post_gen_loops(placeholder_sh_idx, next_sh_idx);
05080 }
05081
05082
05083
05084
05085
05086
05087 int
05088 allocatable_structure_component(int cpnt_attr_idx) {
05089 if (ATD_POINTER(cpnt_attr_idx)) {
05090 return 0;
05091 }
05092 int type_idx = ATD_TYPE_IDX(cpnt_attr_idx);
05093 return Structure == TYP_TYPE(type_idx) &&
05094 ATT_ALLOCATABLE_CPNT(TYP_IDX(type_idx));
05095 }
05096
05097
05098
05099
05100
05101
05102
05103
05104
05105
05106
05107
05108
05109 static void
05110 help_dealloc_components(int line, int col, fld_type fld, int idx,
05111 boolean has_pe_ref, boolean *first) {
05112 int struct_idx = (fld == IR_Tbl_Idx) ? IR_TYPE_IDX(idx) : ATD_TYPE_IDX(idx);
05113 for (int sn_idx = ATT_FIRST_CPNT_IDX(TYP_IDX(struct_idx));
05114 sn_idx != NULL_IDX;
05115 sn_idx = SN_SIBLING_LINK(sn_idx)) {
05116 int cpnt_attr_idx = SN_ATTR_IDX(sn_idx);
05117 int type_idx = ATD_TYPE_IDX(cpnt_attr_idx);
05118
05119 if (ATD_ALLOCATABLE(cpnt_attr_idx) ||
05120 allocatable_structure_component(cpnt_attr_idx)) {
05121 dealloc_allocatables(line, col, cpnt_attr_idx, IR_Tbl_Idx,
05122 do_make_struct_opr(line, col, idx, fld, cpnt_attr_idx), has_pe_ref,
05123 first);
05124 }
05125 }
05126 }
05127
05128
05129
05130
05131
05132
05133
05134
05135
05136
05137
05138
05139
05140
05141 static void
05142 dealloc_allocatables(int line, int col, int attr_idx, fld_type fld, int idx,
05143 boolean has_pe_ref, boolean *first) {
05144 int type_idx = ATD_TYPE_IDX(attr_idx);
05145
05146
05147 if (ATD_ALLOCATABLE(attr_idx)) {
05148 help_dealloc(line, col, fld, idx, has_pe_ref,
05149 first ? (!*first) : TRUE, AT_OPTIONAL(attr_idx));
05150 if (first) {
05151 *first = FALSE;
05152 }
05153 }
05154
05155 else if (allocatable_structure_component(attr_idx)) {
05156 int line = SH_GLB_LINE(curr_stmt_sh_idx);
05157 int col = SH_COL_NUM(curr_stmt_sh_idx);
05158
05159
05160
05161 if (ATD_ARRAY_IDX(attr_idx) != NULL_IDX) {
05162 help_dealloc_array_of_struct(line, col, fld, idx, has_pe_ref,
05163 first);
05164 }
05165
05166
05167
05168 else {
05169 help_dealloc_components(line, col, fld, idx, has_pe_ref, first);
05170 }
05171 }
05172 }
05173
05174 #endif
05175 #ifdef KEY
05176
05177
05178
05179
05180
05181 static void
05182 threadprivate_check(int attr_idx) {
05183
05184
05185
05186
05187
05188
05189
05190
05191
05192 if (AT_OBJ_CLASS(attr_idx) != Data_Obj) {
05193 return;
05194 }
05195 int sb_idx = ATD_STOR_BLK_IDX(attr_idx);
05196 char *msg_str = 0;
05197 if (sb_idx != NULL_IDX && SB_BLK_TYPE(sb_idx) == Threadprivate) {
05198
05199
05200
05201
05202 if (ATD_IN_COMMON(attr_idx)) {
05203 return;
05204 }
05205 if (ATD_EQUIV(attr_idx)) {
05206 msg_str = "EQUIVALENCED";
05207 }
05208 if (msg_str) {
05209 PRINTMSG(AT_DEF_LINE(attr_idx), 1441, Error, AT_DEF_COLUMN(attr_idx),
05210 AT_OBJ_NAME_PTR(attr_idx),
05211 msg_str,
05212 "THREADPRIVATE",
05213 AT_DEF_LINE(attr_idx));
05214 }
05215
05216 else {
05217 int scp_attr_idx = SCP_ATTR_IDX(curr_scp_idx);
05218 if (!(ATD_SAVED(attr_idx) ||
05219 ATP_SAVE_ALL(scp_attr_idx) ||
05220 (AT_OBJ_CLASS(scp_attr_idx) == Pgm_Unit &&
05221 ATP_PGM_UNIT(scp_attr_idx) == Program) ||
05222 AT_MODULE_OBJECT(attr_idx))) {
05223 PRINTMSG(AT_DEF_LINE(attr_idx), 1687, Warning, AT_DEF_COLUMN(attr_idx),
05224 AT_OBJ_NAME_PTR(attr_idx));
05225 }
05226 }
05227 }
05228 }
05229 #endif
05230 #ifdef KEY
05231
05232
05233
05234
05235
05236
05237 static void
05238 error_not_darg(int attr_idx) {
05239 char *problem = 0;
05240 int err_number = 352;
05241 if (AT_IS_DARG(attr_idx)) {
05242 return;
05243 }
05244 if (AT_OPTIONAL(attr_idx)) {
05245 problem = "OPTIONAL";
05246 }
05247 else if (ATD_VALUE_ATTR(attr_idx)) {
05248 problem = "VALUE";
05249 }
05250 else if (ATD_INTENT(attr_idx) > Intent_Unseen) {
05251 problem = "INTENT";
05252 }
05253 else if (ATD_IGNORE_TKR(attr_idx)) {
05254 problem = "IGNORE_TKR";
05255 err_number = 1505;
05256 }
05257 AT_DCL_ERR(attr_idx) = TRUE;
05258 PRINTMSG(AT_DEF_LINE(attr_idx), err_number, Error,
05259 AT_DEF_COLUMN(attr_idx),
05260 AT_OBJ_NAME_PTR(attr_idx), problem);
05261 }
05262 #endif
05263
05264
05265
05266
05267
05268
05269
05270
05271
05272
05273
05274
05275
05276
05277
05278
05279 static void attr_semantics(int attr_idx,
05280 boolean bound_attr)
05281
05282 {
05283 int al_idx;
05284 int bd_idx;
05285 int column;
05286 int count;
05287 int curr_fwd_ref_idx;
05288 int darg_idx;
05289 int dim;
05290 int dt_idx;
05291 int end_entry_sh_idx;
05292 int entry_sh_idx;
05293 int eq_idx;
05294 expr_arg_type expr_desc;
05295 int first_idx;
05296 int i;
05297 int ir_idx;
05298 boolean is_interface;
05299 int line;
05300 int link_idx;
05301 int name_idx;
05302 int new_bd_idx;
05303 int old_fwd_ref_idx;
05304 opnd_type opnd;
05305 int pgm_attr_idx;
05306 int pgm_idx;
05307 int pointer_idx;
05308 int proc_idx;
05309 char *pure_str;
05310 #ifdef KEY
05311 int rslt_idx = 0;
05312 #else
05313 int rslt_idx;
05314 #endif
05315 int scp_idx;
05316 int sf_attr_idx;
05317 int sn_attr_idx;
05318 int sn_idx;
05319 id_str_type storage_name;
05320 int tmp_ir_idx;
05321 #ifdef KEY
05322 int type_idx = 0;
05323 #else
05324 int type_idx;
05325 #endif
05326 boolean type_resolved;
05327 size_offset_type storage_size;
05328
05329 # if defined(_TARGET_OS_MAX) || (defined(_TARGET_OS_IRIX) || defined(_TARGET_OS_LINUX) || defined(_TARGET_OS_DARWIN))
05330 int tmp_idx;
05331 # endif
05332
05333
05334 TRACE (Func_Entry, "attr_semantics", NULL);
05335
05336 is_interface = SCP_IS_INTERFACE(curr_scp_idx);
05337
05338 if (AT_SEMANTICS_DONE(attr_idx) ||
05339 AT_DCL_ERR(attr_idx) ||
05340 AT_ATTR_LINK(attr_idx) != NULL_IDX) {
05341 AT_SEMANTICS_DONE(attr_idx) = TRUE;
05342
05343 if (AT_OBJ_CLASS(attr_idx) != Interface ||
05344 AT_DCL_ERR(attr_idx) ||
05345 AT_ATTR_LINK(attr_idx) == NULL_IDX) {
05346
05347 if (is_interface) {
05348
05349 switch(AT_OBJ_CLASS(attr_idx)) {
05350 case Pgm_Unit:
05351 ATP_SCP_IDX(attr_idx) = SCP_PARENT_IDX(curr_scp_idx);
05352 break;
05353
05354 case Derived_Type:
05355 ATT_SCP_IDX(attr_idx) = SCP_PARENT_IDX(curr_scp_idx);
05356 break;
05357 }
05358 }
05359
05360 return;
05361 }
05362 }
05363
05364 pgm_attr_idx = SCP_ATTR_IDX(curr_scp_idx);
05365
05366
05367
05368
05369
05370
05371
05372
05373
05374
05375
05376
05377
05378
05379
05380 if (ATP_PGM_UNIT(pgm_attr_idx) == Module && !AT_USE_ASSOCIATED(attr_idx)) {
05381 AT_MODULE_OBJECT(attr_idx) = TRUE;
05382 }
05383
05384 switch(AT_OBJ_CLASS(attr_idx)) {
05385 case Data_Obj:
05386
05387 switch (ATD_CLASS(attr_idx)) {
05388 case Atd_Unknown:
05389
05390
05391
05392 ATD_CLASS(attr_idx) = Variable;
05393 break;
05394
05395 case Function_Result:
05396
05397
05398
05399
05400 attr_semantics(ATD_FUNC_IDX(attr_idx), FALSE);
05401
05402 return;
05403
05404 case Compiler_Tmp:
05405
05406 if (AT_REFERENCED(attr_idx) == Not_Referenced) {
05407
05408
05409
05410
05411
05412
05413 if ((cif_flags & XREF_RECS) != 0) {
05414 bound_attr = TRUE;
05415 }
05416 else {
05417 goto EXIT;
05418 }
05419 }
05420 break;
05421
05422 case Constant:
05423
05424 if (ATP_PGM_UNIT(pgm_attr_idx) == Module &&
05425 ATD_FLD(attr_idx) == AT_Tbl_Idx &&
05426 AT_OBJ_CLASS(ATD_CONST_IDX(attr_idx)) == Data_Obj &&
05427 ATD_CLASS(ATD_CONST_IDX(attr_idx)) == Compiler_Tmp &&
05428 ATD_TMP_INIT_NOT_DONE(ATD_CONST_IDX(attr_idx))) {
05429
05430
05431
05432 insert_init_stmt_for_tmp(ATD_CONST_IDX(attr_idx));
05433 }
05434 break;
05435
05436 }
05437
05438 type_idx = ATD_TYPE_IDX(attr_idx);
05439
05440 if (TYP_TYPE(type_idx) == Structure) {
05441
05442 if (AT_ATTR_LINK(TYP_IDX(type_idx)) != NULL_IDX) {
05443
05444
05445
05446
05447
05448
05449 link_idx = TYP_IDX(type_idx);
05450
05451 while (AT_ATTR_LINK(link_idx) != NULL_IDX) {
05452 link_idx = AT_ATTR_LINK(link_idx);
05453 }
05454
05455 TYP_IDX(type_idx) = link_idx;
05456 }
05457
05458 attr_semantics(TYP_IDX(type_idx), FALSE);
05459 }
05460
05461 if (ATP_PGM_UNIT(pgm_attr_idx) == Module &&
05462 ATD_CLASS(attr_idx) != Struct_Component) {
05463
05464 if (TYP_TYPE(type_idx) == Structure &&
05465 !AT_PRIVATE(attr_idx) &&
05466 AT_PRIVATE(TYP_IDX(type_idx)) &&
05467 !AT_USE_ASSOCIATED(TYP_IDX(type_idx))) {
05468 PRINTMSG(AT_DEF_LINE(attr_idx), 598, Error,
05469 AT_DEF_COLUMN(attr_idx),
05470 AT_OBJ_NAME_PTR(attr_idx),
05471 AT_OBJ_NAME_PTR(TYP_IDX(type_idx)));
05472 }
05473
05474 if (ATD_CLASS(attr_idx) == CRI__Pointee) {
05475 attr_semantics(ATD_PTR_IDX(attr_idx), FALSE);
05476
05477 if (AT_PRIVATE(attr_idx) != AT_PRIVATE(ATD_PTR_IDX(attr_idx))) {
05478 PRINTMSG(AT_DEF_LINE(attr_idx), 697, Error,
05479 AT_DEF_COLUMN(attr_idx),
05480 AT_OBJ_NAME_PTR(ATD_PTR_IDX(attr_idx)),
05481 AT_OBJ_NAME_PTR(attr_idx));
05482 }
05483 }
05484 }
05485
05486 if (ATP_PURE(pgm_attr_idx) || ATP_ELEMENTAL(pgm_attr_idx)) {
05487
05488 if (ATD_IN_COMMON(attr_idx) ||
05489 AT_USE_ASSOCIATED(attr_idx) ||
05490 AT_HOST_ASSOCIATED(attr_idx) ||
05491 (ATD_CLASS(attr_idx) == Dummy_Argument &&
05492 (ATP_PGM_UNIT(pgm_attr_idx) == Function ||
05493 (ATP_PGM_UNIT(pgm_attr_idx) == Subroutine &&
05494 ATD_INTENT(attr_idx) == Intent_In)))) {
05495
05496
05497
05498 ATD_PURE(attr_idx) = TRUE;
05499 }
05500
05501 if (ATD_PE_ARRAY_IDX(attr_idx) != NULL_IDX) {
05502 PRINTMSG(BD_LINE_NUM(ATD_PE_ARRAY_IDX(attr_idx)), 1580, Error,
05503 BD_COLUMN_NUM(ATD_PE_ARRAY_IDX(attr_idx)),
05504 AT_OBJ_NAME_PTR(pgm_attr_idx),
05505 AT_OBJ_NAME_PTR(attr_idx));
05506 }
05507 }
05508
05509 if (AT_USE_ASSOCIATED(attr_idx)) {
05510 goto EXIT;
05511 }
05512
05513 if (bound_attr && ATD_CLASS(attr_idx) == Compiler_Tmp) {
05514
05515 if (ATD_FLD(attr_idx) == AT_Tbl_Idx) {
05516 attr_semantics(ATD_TMP_IDX(attr_idx), FALSE);
05517 }
05518 else if (ATD_FLD(attr_idx) == IR_Tbl_Idx) {
05519 ir_idx = ATD_TMP_IDX(attr_idx);
05520
05521 switch (IR_FLD_R(ir_idx)) {
05522 case AT_Tbl_Idx:
05523 attr_semantics(IR_IDX_R(ir_idx), FALSE);
05524 break;
05525
05526 case IR_Tbl_Idx:
05527 tmp_ir_resolution(IR_IDX_R(ir_idx));
05528 break;
05529
05530 case IL_Tbl_Idx:
05531 tmp_il_resolution(IR_IDX_R(ir_idx));
05532 break;
05533 }
05534 }
05535
05536 #ifdef KEY
05537
05538
05539
05540
05541
05542
05543
05544
05545
05546
05547
05548
05549
05550
05551
05552
05553
05554
05555
05556
05557
05558
05559
05560
05561
05562 int save_next_stmt_sh_idx = SH_NEXT_IDX(curr_stmt_sh_idx);
05563 bound_resolution(attr_idx);
05564 for (;
05565 curr_stmt_sh_idx != NULL_IDX &&
05566 SH_NEXT_IDX(curr_stmt_sh_idx) != save_next_stmt_sh_idx &&
05567 SH_P2_SKIP_ME(curr_stmt_sh_idx);
05568 curr_stmt_sh_idx = SH_NEXT_IDX(curr_stmt_sh_idx))
05569 ;
05570 #else
05571 bound_resolution(attr_idx);
05572 #endif
05573 }
05574
05575
05576 if (TYP_TYPE(type_idx) == Character) {
05577
05578 if (TYP_FLD(type_idx) == AT_Tbl_Idx) {
05579 attr_semantics(TYP_IDX(type_idx), TRUE);
05580 }
05581 }
05582
05583 bd_idx = ATD_ARRAY_IDX(attr_idx);
05584
05585 if (bd_idx != NULL_IDX && BD_ARRAY_CLASS(bd_idx) != Deferred_Shape) {
05586
05587 for (dim = 1; dim <= BD_RANK(bd_idx); dim++) {
05588
05589 if (BD_LB_FLD(bd_idx, dim) == AT_Tbl_Idx) {
05590 attr_semantics(BD_LB_IDX(bd_idx, dim), TRUE);
05591 }
05592
05593 if (BD_UB_FLD(bd_idx, dim) == AT_Tbl_Idx) {
05594 attr_semantics(BD_UB_IDX(bd_idx, dim), TRUE);
05595 }
05596 }
05597 }
05598
05599 bd_idx = ATD_PE_ARRAY_IDX(attr_idx);
05600
05601 if (bd_idx != NULL_IDX && BD_ARRAY_CLASS(bd_idx) != Deferred_Shape) {
05602
05603 # if 0
05604
05605
05606 if (! ATD_IN_COMMON(attr_idx)) {
05607 PRINTMSG(BD_LINE_NUM(bd_idx), 1365, Error,
05608 BD_COLUMN_NUM(bd_idx),
05609 AT_OBJ_NAME_PTR(attr_idx));
05610 AT_DCL_ERR(attr_idx) = TRUE;
05611 }
05612 # endif
05613
05614 for (dim = 1; dim <= BD_RANK(bd_idx); dim++) {
05615
05616 if (BD_LB_FLD(bd_idx, dim) == AT_Tbl_Idx) {
05617 attr_semantics(BD_LB_IDX(bd_idx, dim), TRUE);
05618 }
05619
05620 if (BD_UB_FLD(bd_idx, dim) == AT_Tbl_Idx) {
05621 attr_semantics(BD_UB_IDX(bd_idx, dim), TRUE);
05622 }
05623 }
05624 }
05625
05626
05627 if (!AT_TYPED(attr_idx)) {
05628
05629 if (SCP_IMPL_NONE(curr_scp_idx)) {
05630 AT_DCL_ERR(attr_idx) = TRUE;
05631 PRINTMSG(AT_DEF_LINE(attr_idx), 113, Error,
05632 AT_DEF_COLUMN(attr_idx),
05633 AT_OBJ_NAME_PTR(attr_idx));
05634 }
05635 else if (!IM_SET(curr_scp_idx, IMPL_IDX(AT_OBJ_NAME(attr_idx)))) {
05636
05637 if (SCP_PARENT_NONE(curr_scp_idx)) {
05638 AT_DCL_ERR(attr_idx) = TRUE;
05639 PRINTMSG(AT_DEF_LINE(attr_idx), 297, Error,
05640 AT_DEF_COLUMN(attr_idx),
05641 AT_OBJ_NAME_PTR(attr_idx));
05642 }
05643 else if (on_off_flags.implicit_none) {
05644 AT_DCL_ERR(attr_idx) = TRUE;
05645 PRINTMSG(AT_DEF_LINE(attr_idx), 1171, Error,
05646 AT_DEF_COLUMN(attr_idx),
05647 AT_OBJ_NAME_PTR(attr_idx));
05648 }
05649 }
05650 }
05651
05652
05653
05654
05655
05656 if (TYP_TYPE(type_idx) == Character) {
05657 char_len_resolution(attr_idx, FALSE);
05658
05659
05660
05661 type_idx = ATD_TYPE_IDX(attr_idx);
05662 }
05663
05664 if (AT_DCL_ERR(attr_idx)) {
05665 goto EXIT;
05666 }
05667
05668 if (ATD_ALLOCATABLE(attr_idx)) {
05669 ATD_IM_A_DOPE(attr_idx) = TRUE;
05670
05671 if (ATD_ARRAY_IDX(attr_idx) == NULL_IDX ||
05672 BD_ARRAY_CLASS(ATD_ARRAY_IDX(attr_idx)) != Deferred_Shape) {
05673 AT_DCL_ERR(attr_idx) = TRUE;
05674 PRINTMSG(AT_DEF_LINE(attr_idx), 570, Error,
05675 AT_DEF_COLUMN(attr_idx),
05676 AT_OBJ_NAME_PTR(attr_idx));
05677 }
05678
05679 # ifdef _F_MINUS_MINUS
05680 if (ATD_PE_ARRAY_IDX(attr_idx) != NULL_IDX &&
05681 BD_ARRAY_CLASS(ATD_PE_ARRAY_IDX(attr_idx)) != Deferred_Shape) {
05682 AT_DCL_ERR(attr_idx) = TRUE;
05683 PRINTMSG(AT_DEF_LINE(attr_idx), 1552, Error,
05684 AT_DEF_COLUMN(attr_idx),
05685 AT_OBJ_NAME_PTR(attr_idx));
05686 }
05687 # endif
05688 }
05689
05690 if (ATD_ARRAY_IDX(attr_idx) != NULL_IDX) {
05691
05692
05693
05694
05695
05696 if (opt_flags.reshape_all_arrays &&
05697 BD_RANK(ATD_ARRAY_IDX(attr_idx)) > 1 &&
05698 BD_ARRAY_CLASS(ATD_ARRAY_IDX(attr_idx)) == Explicit_Shape &&
05699 (ATD_CLASS(attr_idx) != CRI__Pointee &&
05700 ATD_CLASS(attr_idx) != Constant) &&
05701 BD_LB_FLD(ATD_ARRAY_IDX(attr_idx),
05702 BD_RANK(ATD_ARRAY_IDX(attr_idx))) == CN_Tbl_Idx &&
05703 compare_cn_and_value(BD_LB_IDX(ATD_ARRAY_IDX(attr_idx),
05704 BD_RANK(ATD_ARRAY_IDX(attr_idx))),
05705 1,
05706 Eq_Opr) &&
05707 BD_UB_FLD(ATD_ARRAY_IDX(attr_idx),
05708 BD_RANK(ATD_ARRAY_IDX(attr_idx))) == CN_Tbl_Idx &&
05709 compare_cn_and_value(BD_UB_IDX(ATD_ARRAY_IDX(attr_idx),
05710 BD_RANK(ATD_ARRAY_IDX(attr_idx))),
05711 16,
05712 Lt_Opr) &&
05713 !ATD_RESHAPE_ARRAY_OPT(attr_idx)) {
05714
05715 if (ATD_DATA_INIT(attr_idx)) {
05716 PRINTMSG(AT_DEF_LINE(attr_idx), 1644, Error,
05717 AT_DEF_COLUMN(attr_idx),
05718 AT_OBJ_NAME_PTR(attr_idx));
05719 }
05720 ATD_RESHAPE_ARRAY_OPT(attr_idx) = TRUE;
05721 NTR_ATTR_LIST_TBL(al_idx);
05722 AL_ATTR_IDX(al_idx) = attr_idx;
05723 AL_NEXT_IDX(al_idx) = reshape_array_list;
05724 reshape_array_list = al_idx;
05725 }
05726
05727 if (ATD_RESHAPE_ARRAY_OPT(attr_idx)) {
05728
05729 PRINTMSG(AT_DEF_LINE(attr_idx), 1637, Optimization, 0,
05730 "-O reshape",
05731 AT_OBJ_NAME_PTR(attr_idx));
05732
05733
05734
05735 bd_idx = ATD_ARRAY_IDX(attr_idx);
05736
05737 new_bd_idx = reserve_array_ntry(BD_RANK(bd_idx));
05738 BD_RANK(new_bd_idx) = BD_RANK(bd_idx);
05739 BD_LINE_NUM(new_bd_idx) = BD_LINE_NUM(bd_idx);
05740 BD_COLUMN_NUM(new_bd_idx) = BD_COLUMN_NUM(bd_idx);
05741 BD_ARRAY_CLASS(new_bd_idx) = BD_ARRAY_CLASS(bd_idx);
05742 BD_RESOLVED(new_bd_idx) = FALSE;
05743
05744 dim = 1;
05745
05746 BD_LB_FLD(new_bd_idx,dim) = BD_LB_FLD(bd_idx,BD_RANK(bd_idx));
05747 BD_LB_IDX(new_bd_idx,dim) = BD_LB_IDX(bd_idx,BD_RANK(bd_idx));
05748
05749 BD_UB_FLD(new_bd_idx,dim) = BD_UB_FLD(bd_idx,BD_RANK(bd_idx));
05750 BD_UB_IDX(new_bd_idx,dim) = BD_UB_IDX(bd_idx,BD_RANK(bd_idx));
05751
05752 for (i = 1; i < BD_RANK(bd_idx); i++) {
05753 dim++;
05754 BD_LB_FLD(new_bd_idx,dim) = BD_LB_FLD(bd_idx,i);
05755 BD_LB_IDX(new_bd_idx,dim) = BD_LB_IDX(bd_idx,i);
05756
05757 BD_UB_FLD(new_bd_idx,dim) = BD_UB_FLD(bd_idx,i);
05758 BD_UB_IDX(new_bd_idx,dim) = BD_UB_IDX(bd_idx,i);
05759 }
05760
05761 new_bd_idx = ntr_array_in_bd_tbl(new_bd_idx);
05762
05763 array_dim_resolution(attr_idx, FALSE);
05764 bd_idx = ATD_ARRAY_IDX(attr_idx);
05765
05766 if (! AT_DCL_ERR(attr_idx) &&
05767 ! BD_DCL_ERR(bd_idx)) {
05768
05769 ATD_ARRAY_IDX(attr_idx) = new_bd_idx;
05770 array_dim_resolution(attr_idx, FALSE);
05771 ATD_RESHAPE_ARRAY_IDX(attr_idx) = ATD_ARRAY_IDX(attr_idx);
05772 ATD_ARRAY_IDX(attr_idx) = bd_idx;
05773 }
05774 }
05775 else {
05776 array_dim_resolution(attr_idx, FALSE);
05777 }
05778 }
05779
05780 if (ATD_PE_ARRAY_IDX(attr_idx) != NULL_IDX) {
05781 pe_array_dim_resolution(attr_idx);
05782 }
05783
05784 if (ATD_DISTRIBUTION_IDX(attr_idx) != NULL_IDX) {
05785 distribution_resolution(attr_idx);
05786 }
05787
05788 if (ATD_POINTER(attr_idx) && ATD_CLASS(attr_idx) != Dummy_Argument) {
05789 ATD_IM_A_DOPE(attr_idx) = TRUE;
05790 }
05791
05792 # if 0
05793
05794
05795
05796 if (ATD_TARGET(attr_idx) && ATD_CLASS(attr_idx) == Dummy_Argument) {
05797 ATD_IM_A_DOPE(attr_idx) = TRUE;
05798 }
05799 # endif
05800
05801 if (ATD_AUTOMATIC(attr_idx)) {
05802
05803 if (ATD_IM_A_DOPE(attr_idx)) {
05804 ATD_NO_ENTRY_LIST(attr_idx) = NULL_IDX;
05805 ATD_AUTOMATIC(attr_idx) = FALSE;
05806 }
05807 else if (!is_interface) {
05808
05809 if (ATP_SYMMETRIC(pgm_attr_idx)) {
05810
05811
05812
05813
05814
05815 if (ATD_TARGET(attr_idx)) {
05816 PRINTMSG(AT_DEF_LINE(attr_idx), 1234, Caution,
05817 AT_DEF_COLUMN(attr_idx),
05818 AT_OBJ_NAME_PTR(attr_idx),
05819 "TARGET");
05820 }
05821 else {
05822 ATD_SYMMETRIC(attr_idx) = TRUE;
05823 }
05824 }
05825
05826 # if defined(_SINGLE_ALLOCS_FOR_AUTOMATIC)
05827 gen_single_automatic_allocate(attr_idx);
05828 # else
05829
05830 if (TYP_TYPE(type_idx) == Character ||
05831 (TYP_TYPE(type_idx) == Structure &&
05832 ATT_CHAR_SEQ(TYP_IDX(type_idx)))) {
05833 gen_single_automatic_allocate(attr_idx);
05834 }
05835 else {
05836 gen_multiple_automatic_allocate(attr_idx);
05837 }
05838 # endif
05839 }
05840 }
05841
05842 if (TYP_TYPE(type_idx) == Character &&
05843 ATD_CLASS(attr_idx) != CRI__Pointee &&
05844 TYP_CHAR_CLASS(type_idx) == Assumed_Size_Char &&
05845 TYP_FLD(type_idx) == AT_Tbl_Idx &&
05846 AT_OBJ_CLASS(TYP_IDX(type_idx)) == Data_Obj) {
05847
05848 tmp_ir_idx = ATD_TMP_IDX(TYP_IDX(type_idx));
05849
05850 COPY_OPND(opnd, IR_OPND_R(tmp_ir_idx));
05851 fold_clen_opr(&opnd, &expr_desc);
05852 COPY_OPND(IR_OPND_R(tmp_ir_idx), opnd);
05853 }
05854
05855 if (TYP_TYPE(type_idx) == Structure &&
05856 ATT_DEFAULT_INITIALIZED(TYP_IDX(type_idx))) {
05857
05858 if (ATD_IN_COMMON(attr_idx)) {
05859 AT_DCL_ERR(attr_idx) = TRUE;
05860 PRINTMSG(AT_DEF_LINE(attr_idx), 1600, Error,
05861 AT_DEF_COLUMN(attr_idx),
05862 AT_OBJ_NAME_PTR(attr_idx),
05863 AT_OBJ_NAME_PTR(TYP_IDX(ATD_TYPE_IDX(attr_idx))));
05864 }
05865 else if (ATD_CLASS(attr_idx) == CRI__Pointee) {
05866 PRINTMSG(AT_DEF_LINE(attr_idx), 1647, Warning,
05867 AT_DEF_COLUMN(attr_idx),
05868 AT_OBJ_NAME_PTR(attr_idx));
05869 }
05870 }
05871
05872 #ifdef KEY
05873
05874
05875 if (Dummy_Argument == ATD_CLASS(attr_idx)) {
05876 if ((!is_interface) && Intent_Out == ATD_INTENT(attr_idx)) {
05877 dealloc_allocatables(SH_GLB_LINE(curr_stmt_sh_idx),
05878 SH_COL_NUM(curr_stmt_sh_idx), attr_idx, AT_Tbl_Idx, attr_idx,
05879 FALSE, 0);
05880 }
05881
05882 if (ATD_ALLOCATABLE(attr_idx)) {
05883 PRINTMSG(AT_DEF_LINE(attr_idx), 1679, Ansi, AT_DEF_COLUMN(attr_idx));
05884 }
05885 }
05886 #endif
05887
05888
05889 # if 0
05890
05891
05892
05893
05894 if (!is_interface &&
05895 (ATD_IM_A_DOPE(attr_idx) &&
05896 (ATD_CLASS(attr_idx) != Dummy_Argument ||
05897 (ATD_ARRAY_IDX(attr_idx) &&
05898 BD_ARRAY_CLASS(ATD_ARRAY_IDX(attr_idx)) == Assumed_Shape) ||
05899 (ATD_TARGET(attr_idx)))) ||
05900
05901 (TYP_TYPE(type_idx) == Structure &&
05902 ATD_CLASS(attr_idx) != Constant &&
05903 (ATD_CLASS(attr_idx) != Dummy_Argument ||
05904 ATD_INTENT(attr_idx) == Intent_Out) &&
05905 ATD_CLASS(attr_idx) != CRI__Pointee &&
05906 ((ATT_POINTER_CPNT(TYP_IDX(type_idx)) ||
05907 ATT_DEFAULT_INITIALIZED(TYP_IDX(type_idx))) &&
05908 !ATD_DATA_INIT(attr_idx))))
05909 # else
05910 # ifdef KEY
05911
05912
05913
05914
05915
05916
05917
05918
05919
05920
05921
05922
05923
05924
05925
05926
05927
05928 if (!is_interface &&
05929
05930 (ATD_IM_A_DOPE(attr_idx) &&
05931 (ATD_CLASS(attr_idx) != Dummy_Argument ||
05932 (ATD_ARRAY_IDX(attr_idx) &&
05933 BD_ARRAY_CLASS(ATD_ARRAY_IDX(attr_idx)) == Assumed_Shape))) ||
05934
05935
05936
05937 (TYP_TYPE(type_idx) == Structure &&
05938 ATD_CLASS(attr_idx) != Constant &&
05939 (ATD_CLASS(attr_idx) != Dummy_Argument ||
05940 ATD_INTENT(attr_idx) == Intent_Out) &&
05941 ATD_CLASS(attr_idx) != CRI__Pointee &&
05942 ((ATT_POINTER_CPNT(TYP_IDX(type_idx)) ||
05943 #ifdef KEY
05944 ATT_ALLOCATABLE_CPNT(TYP_IDX(type_idx)) ||
05945 #endif
05946 ATT_DEFAULT_INITIALIZED(TYP_IDX(type_idx))) &&
05947 !ATD_DATA_INIT(attr_idx))))
05948 # else
05949 if (!is_interface &&
05950
05951 (ATD_IM_A_DOPE(attr_idx) &&
05952 (ATD_CLASS(attr_idx) != Dummy_Argument ||
05953 (ATD_ARRAY_IDX(attr_idx) &&
05954 BD_ARRAY_CLASS(ATD_ARRAY_IDX(attr_idx)) == Assumed_Shape))) ||
05955
05956
05957
05958 (TYP_TYPE(type_idx) == Structure &&
05959 ATD_CLASS(attr_idx) != Constant &&
05960 (ATD_CLASS(attr_idx) != Dummy_Argument ||
05961 ATD_INTENT(attr_idx) == Intent_Out) &&
05962 ATD_CLASS(attr_idx) != CRI__Pointee &&
05963 (ATT_POINTER_CPNT(TYP_IDX(type_idx)) ||
05964 (ATT_DEFAULT_INITIALIZED(TYP_IDX(type_idx)) &&
05965 !ATD_DATA_INIT(attr_idx)))))
05966 # endif
05967 # endif
05968 {
05969
05970 entry_sh_idx = curr_stmt_sh_idx;
05971 end_entry_sh_idx = SH_NEXT_IDX(curr_stmt_sh_idx);
05972
05973 if (ATD_IM_A_DOPE(attr_idx) &&
05974 ATD_CLASS(attr_idx) == Dummy_Argument &&
05975 ATD_ARRAY_IDX(attr_idx) &&
05976 BD_ARRAY_CLASS(ATD_ARRAY_IDX(attr_idx)) == Assumed_Shape) {
05977
05978
05979
05980
05981 for (i = 1; i <= BD_RANK(ATD_ARRAY_IDX(attr_idx)); i++) {
05982
05983 NTR_IR_TBL(ir_idx);
05984 IR_OPR(ir_idx) = Dv_Set_Low_Bound;
05985 IR_TYPE_IDX(ir_idx) = CG_INTEGER_DEFAULT_TYPE;
05986 IR_LINE_NUM(ir_idx) = SH_GLB_LINE(curr_stmt_sh_idx);
05987 IR_COL_NUM(ir_idx) = SH_COL_NUM(curr_stmt_sh_idx);
05988 IR_FLD_L(ir_idx) = AT_Tbl_Idx;
05989 IR_IDX_L(ir_idx) = attr_idx;
05990 IR_LINE_NUM_L(ir_idx) = SH_GLB_LINE(curr_stmt_sh_idx);
05991 IR_COL_NUM_L(ir_idx) = SH_COL_NUM(curr_stmt_sh_idx);
05992
05993 IR_FLD_R(ir_idx) = BD_LB_FLD(ATD_ARRAY_IDX(attr_idx), i);
05994 IR_IDX_R(ir_idx) = BD_LB_IDX(ATD_ARRAY_IDX(attr_idx), i);
05995 IR_LINE_NUM_R(ir_idx) = SH_GLB_LINE(curr_stmt_sh_idx);
05996 IR_COL_NUM_R(ir_idx) = SH_COL_NUM(curr_stmt_sh_idx);
05997
05998 IR_DV_DIM(ir_idx) = i;
05999
06000 gen_sh(After, Assignment_Stmt, SH_GLB_LINE(curr_stmt_sh_idx),
06001 SH_COL_NUM(curr_stmt_sh_idx), FALSE, FALSE, TRUE);
06002
06003 SH_IR_IDX(curr_stmt_sh_idx) = ir_idx;
06004 SH_P2_SKIP_ME(curr_stmt_sh_idx) = TRUE;
06005 }
06006
06007 # if (defined(_TARGET_OS_IRIX) || defined(_TARGET_OS_LINUX) || defined(_TARGET_OS_DARWIN))
06008 # if 0
06009 if (! ATD_COPY_ASSUMED_SHAPE(attr_idx)) {
06010
06011
06012 tmp_idx = gen_compiler_tmp(SH_GLB_LINE(curr_stmt_sh_idx),
06013 SH_COL_NUM(curr_stmt_sh_idx),
06014 Shared, TRUE);
06015
06016 COPY_ATTR_NTRY(tmp_idx, attr_idx);
06017
06018 ATD_CLASS(tmp_idx) = Compiler_Tmp;
06019 ATD_STOR_BLK_IDX(tmp_idx) = SCP_SB_STACK_IDX(curr_scp_idx);
06020 AT_SEMANTICS_DONE(tmp_idx) = TRUE;
06021
06022 NTR_IR_TBL(ir_idx);
06023 IR_OPR(ir_idx) = Dv_Whole_Copy_Opr;
06024 IR_TYPE_IDX(ir_idx) = TYPELESS_DEFAULT_TYPE;
06025 IR_LINE_NUM(ir_idx) = SH_GLB_LINE(curr_stmt_sh_idx);
06026 IR_COL_NUM(ir_idx) = SH_COL_NUM(curr_stmt_sh_idx);
06027
06028 IR_FLD_L(ir_idx) = AT_Tbl_Idx;
06029 IR_IDX_L(ir_idx) = tmp_idx;
06030 IR_LINE_NUM_L(ir_idx) = SH_GLB_LINE(curr_stmt_sh_idx);
06031 IR_COL_NUM_L(ir_idx) = SH_COL_NUM(curr_stmt_sh_idx);
06032
06033 IR_FLD_R(ir_idx) = AT_Tbl_Idx;
06034 IR_IDX_R(ir_idx) = attr_idx;
06035 IR_LINE_NUM_R(ir_idx) = SH_GLB_LINE(curr_stmt_sh_idx);
06036 IR_COL_NUM_R(ir_idx) = SH_COL_NUM(curr_stmt_sh_idx);
06037
06038 gen_sh(After, Assignment_Stmt, SH_GLB_LINE(curr_stmt_sh_idx),
06039 SH_COL_NUM(curr_stmt_sh_idx), FALSE, FALSE, TRUE);
06040
06041 SH_IR_IDX(curr_stmt_sh_idx) = ir_idx;
06042 SH_P2_SKIP_ME(curr_stmt_sh_idx) = TRUE;
06043
06044 ATD_SF_ARG_IDX(attr_idx) = tmp_idx;
06045 }
06046 # endif
06047
06048 # endif
06049 }
06050 else if (ATP_PGM_UNIT(pgm_attr_idx) != Blockdata &&
06051 (ATD_CLASS(attr_idx) != Dummy_Argument ||
06052 (ATD_INTENT(attr_idx) == Intent_Out &&
06053 ATT_DEFAULT_INITIALIZED(TYP_IDX(type_idx))))) {
06054
06055
06056
06057
06058 gen_entry_dope_code(attr_idx);
06059 }
06060
06061 if (end_entry_sh_idx == NULL_IDX) {
06062
06063
06064
06065 end_entry_sh_idx = entry_sh_idx;
06066
06067 while (SH_NEXT_IDX(end_entry_sh_idx) != NULL_IDX) {
06068 end_entry_sh_idx = SH_NEXT_IDX(end_entry_sh_idx);
06069 }
06070 }
06071 else {
06072 end_entry_sh_idx = SH_PREV_IDX(end_entry_sh_idx);
06073 }
06074
06075 if (ATD_AUTOMATIC(attr_idx)) {
06076
06077
06078
06079 curr_stmt_sh_idx = entry_sh_idx;
06080 }
06081
06082 if (
06083 #ifdef KEY
06084
06085 (ATD_ALLOCATABLE(attr_idx) ||
06086
06087
06088 (Structure == TYP_TYPE(ATD_TYPE_IDX(attr_idx)) &&
06089 ATT_ALLOCATABLE_CPNT(TYP_IDX(ATD_TYPE_IDX(attr_idx))) &&
06090 !ATD_POINTER(attr_idx))) &&
06091
06092 ATD_CLASS(attr_idx) != Dummy_Argument &&
06093 #else
06094 ATD_ALLOCATABLE(attr_idx) &&
06095 #endif
06096 ATP_PGM_UNIT(pgm_attr_idx) != Module &&
06097 ! ATP_SAVE_ALL(pgm_attr_idx) &&
06098 ! ATD_DATA_INIT(attr_idx) &&
06099 ! ATD_SAVED(attr_idx)) {
06100
06101 NTR_SN_TBL(sn_idx);
06102
06103 SN_SIBLING_LINK(sn_idx) = allocatable_list_idx;
06104 allocatable_list_idx = sn_idx;
06105 SN_ATTR_IDX(sn_idx) = attr_idx;
06106 number_of_allocatables++;
06107 }
06108
06109 insert_sh_after_entries(attr_idx,
06110 entry_sh_idx,
06111 end_entry_sh_idx,
06112 FALSE,
06113 (ATD_AUTOMATIC(attr_idx) ? FALSE : TRUE));
06114
06115 }
06116
06117 if (ATD_AUXILIARY(attr_idx)) {
06118
06119 if (ATP_PGM_UNIT(pgm_attr_idx) == Module && !ATD_IN_COMMON(attr_idx)) {
06120
06121
06122
06123 PRINTMSG(AT_DEF_LINE(attr_idx), 876, Error,
06124 AT_DEF_COLUMN(attr_idx),
06125 AT_OBJ_NAME_PTR(attr_idx));
06126 AT_DCL_ERR(attr_idx) = TRUE;
06127 }
06128 else if (TYP_TYPE(type_idx) == Character) {
06129 PRINTMSG(AT_DEF_LINE(attr_idx), 535, Error,
06130 AT_DEF_COLUMN(attr_idx),
06131 AT_OBJ_NAME_PTR(attr_idx));
06132 AT_DCL_ERR(attr_idx) = TRUE;
06133 }
06134 else if (TYP_TYPE(type_idx) == Structure &&
06135 (ATT_POINTER_CPNT(TYP_IDX(type_idx)) ||
06136 #ifdef KEY
06137 ATT_ALLOCATABLE_CPNT(TYP_IDX(type_idx)) ||
06138 #endif
06139 ATT_CHAR_CPNT(TYP_IDX(type_idx))) ) {
06140 PRINTMSG(AT_DEF_LINE(attr_idx), 536, Error,
06141 AT_DEF_COLUMN(attr_idx),
06142 AT_OBJ_NAME_PTR(attr_idx),
06143 AT_OBJ_NAME_PTR(TYP_IDX(type_idx)));
06144 AT_DCL_ERR(attr_idx) = TRUE;
06145 }
06146 }
06147
06148 if (ATD_PERMUTATION(attr_idx)) {
06149
06150 if (ATD_ARRAY_IDX(attr_idx) == NULL_IDX ||
06151 TYP_TYPE(ATD_TYPE_IDX(attr_idx)) != Integer) {
06152 PRINTMSG(AT_DEF_LINE(attr_idx), 1126, Error,
06153 AT_DEF_COLUMN(attr_idx),
06154 AT_OBJ_NAME_PTR(attr_idx));
06155 AT_DCL_ERR(attr_idx) = TRUE;
06156 }
06157 }
06158
06159 switch (ATD_CLASS(attr_idx)) {
06160 case Variable:
06161
06162 #ifdef KEY
06163 threadprivate_check(attr_idx);
06164 #endif
06165 if (ATD_EQUIV(attr_idx) &&
06166 AL_NEXT_IDX(ATD_EQUIV_LIST(attr_idx)) == NULL_IDX) {
06167
06168
06169
06170 ATD_EQUIV_LIST(attr_idx) = NULL_IDX;
06171 }
06172
06173
06174
06175 case Compiler_Tmp:
06176
06177 if (ATD_IN_COMMON(attr_idx)) {
06178
06179 if (TYP_TYPE(type_idx) == Structure &&
06180 #ifdef KEY
06181 !(ATT_SEQUENCE_SET(TYP_IDX(type_idx)) ||
06182 AT_BIND_ATTR(TYP_IDX(type_idx)))
06183 #else
06184 !ATT_SEQUENCE_SET(TYP_IDX(type_idx))
06185 #endif
06186 ) {
06187 AT_DCL_ERR(attr_idx) = TRUE;
06188 PRINTMSG(AT_DEF_LINE(attr_idx), 373, Error,
06189 AT_DEF_COLUMN(attr_idx),
06190 AT_OBJ_NAME_PTR(attr_idx),
06191 AT_OBJ_NAME_PTR(TYP_IDX(type_idx)));
06192 }
06193 #ifdef KEY
06194 if (TYP_TYPE(type_idx) == Structure &&
06195 ATT_ALLOCATABLE_CPNT(TYP_IDX(type_idx))) {
06196 AT_DCL_ERR(attr_idx) = TRUE;
06197 PRINTMSG(AT_DEF_LINE(attr_idx), 691, Error,
06198 AT_DEF_COLUMN(attr_idx),
06199 AT_OBJ_NAME_PTR(attr_idx));
06200 }
06201 #endif
06202
06203 if (SB_BLK_HAS_NPES(ATD_STOR_BLK_IDX(attr_idx)) &&
06204 ATD_DATA_INIT(attr_idx)) {
06205 PRINTMSG(AT_DEF_LINE(attr_idx), 1227, Error,
06206 AT_DEF_COLUMN(attr_idx),
06207 AT_OBJ_NAME_PTR(attr_idx),
06208 SB_BLANK_COMMON(ATD_STOR_BLK_IDX(attr_idx)) ?
06209 "" : SB_NAME_PTR(ATD_STOR_BLK_IDX(attr_idx)));
06210 AT_DCL_ERR(attr_idx) = TRUE;
06211 }
06212 }
06213 else {
06214
06215 if (ATD_SYMMETRIC(attr_idx)) {
06216
06217 if (AT_HOST_ASSOCIATED(attr_idx)) {
06218 PRINTMSG(AT_DEF_LINE(attr_idx), 1235, Error,
06219 AT_DEF_COLUMN(attr_idx),
06220 AT_OBJ_NAME_PTR(attr_idx));
06221
06222 ATD_SYMMETRIC(attr_idx) = FALSE;
06223 }
06224 }
06225 else if (ATP_SYMMETRIC(pgm_attr_idx)) {
06226
06227
06228
06229 if (fnd_semantic_err(Obj_Symmetric,
06230 AT_DEF_LINE(attr_idx),
06231 AT_DEF_COLUMN(attr_idx),
06232 attr_idx,
06233 FALSE)) {
06234
06235
06236
06237 if (AT_HOST_ASSOCIATED(attr_idx)) {
06238 PRINTMSG(AT_DEF_LINE(attr_idx), 1236, Caution,
06239 AT_DEF_COLUMN(attr_idx),
06240 AT_OBJ_NAME_PTR(attr_idx));
06241 }
06242 else {
06243
06244 if (ATD_TARGET(attr_idx)) {
06245 PRINTMSG(AT_DEF_LINE(attr_idx), 1234, Caution,
06246 AT_DEF_COLUMN(attr_idx),
06247 AT_OBJ_NAME_PTR(attr_idx),
06248 "TARGET");
06249 }
06250 else if (ATD_DATA_INIT(attr_idx)) {
06251 PRINTMSG(AT_DEF_LINE(attr_idx), 1234, Caution,
06252 AT_DEF_COLUMN(attr_idx),
06253 AT_OBJ_NAME_PTR(attr_idx),
06254 "DATA initialized");
06255 }
06256 else if (ATD_SAVED(attr_idx)) {
06257 PRINTMSG(AT_DEF_LINE(attr_idx), 1234, Caution,
06258 AT_DEF_COLUMN(attr_idx),
06259 AT_OBJ_NAME_PTR(attr_idx),
06260 "SAVE");
06261 }
06262 else if (ATD_POINTER(attr_idx)) {
06263 PRINTMSG(AT_DEF_LINE(attr_idx), 1234, Caution,
06264 AT_DEF_COLUMN(attr_idx),
06265 AT_OBJ_NAME_PTR(attr_idx),
06266 "POINTER");
06267 }
06268 else if (ATD_EQUIV(attr_idx)) {
06269 PRINTMSG(AT_DEF_LINE(attr_idx), 1234, Caution,
06270 AT_DEF_COLUMN(attr_idx),
06271 AT_OBJ_NAME_PTR(attr_idx),
06272 "EQUIVALENCE");
06273 }
06274 else if (ATD_ALLOCATABLE(attr_idx)) {
06275 PRINTMSG(AT_DEF_LINE(attr_idx), 1234, Caution,
06276 AT_DEF_COLUMN(attr_idx),
06277 AT_OBJ_NAME_PTR(attr_idx),
06278 "ALLOCATABLE");
06279 }
06280 else if (ATD_ARRAY_IDX(attr_idx) != NULL_IDX &&
06281 BD_ARRAY_CLASS(attr_idx) == Deferred_Shape) {
06282 PRINTMSG(AT_DEF_LINE(attr_idx), 1234, Caution,
06283 AT_DEF_COLUMN(attr_idx),
06284 AT_OBJ_NAME_PTR(attr_idx),
06285 "deferred-shape DIMENSION");
06286 }
06287 }
06288 }
06289 else {
06290 ATD_SYMMETRIC(attr_idx) = TRUE;
06291 }
06292 }
06293
06294 if (ATD_STOR_BLK_IDX(attr_idx) == NULL_IDX) {
06295 assign_storage_blk(attr_idx);
06296 }
06297 }
06298
06299 break;
06300
06301 case Dummy_Argument:
06302 ATD_STOR_BLK_IDX(attr_idx) = SCP_SB_DARG_IDX(curr_scp_idx);
06303
06304 if (ATD_AUXILIARY(attr_idx)) {
06305 SB_AUXILIARY(ATD_STOR_BLK_IDX(attr_idx)) = TRUE;
06306 }
06307
06308 if (!AT_IS_DARG(attr_idx)) {
06309 #ifdef KEY
06310 error_not_darg(attr_idx);
06311 #endif
06312 }
06313 else if (TYP_TYPE(type_idx) == Structure &&
06314 ATT_DEFAULT_INITIALIZED(TYP_IDX(type_idx)) &&
06315 ATD_INTENT(attr_idx) == Intent_Out &&
06316 ATD_ARRAY_IDX(attr_idx) != NULL_IDX &&
06317 BD_ARRAY_CLASS(ATD_ARRAY_IDX(attr_idx)) == Assumed_Size) {
06318 AT_DCL_ERR(attr_idx) = TRUE;
06319 PRINTMSG(AT_DEF_LINE(attr_idx), 1590, Error,
06320 AT_DEF_COLUMN(attr_idx),
06321 AT_OBJ_NAME_PTR(attr_idx),
06322 AT_OBJ_NAME_PTR(TYP_IDX(type_idx)));
06323 }
06324 #ifdef KEY
06325 else if (ATD_VALUE_ATTR(attr_idx) &&
06326 !length_type_param_is_one(attr_idx)) {
06327 PRINTMSG(AT_DEF_LINE(attr_idx), 1695, Error,
06328 AT_DEF_COLUMN(attr_idx), AT_OBJ_NAME_PTR(attr_idx));
06329 }
06330 break;
06331 #endif
06332
06333 break;
06334
06335 case CRI__Pointee:
06336
06337 if (pointee_based_blk == NULL_IDX) {
06338
06339
06340
06341 CREATE_ID(storage_name, sb_name[Pointee_Blk], sb_len[Pointee_Blk]);
06342 pointee_based_blk = ntr_stor_blk_tbl(storage_name.string,
06343 sb_len[Pointee_Blk],
06344 AT_DEF_LINE(attr_idx),
06345 AT_DEF_COLUMN(attr_idx),
06346 Based);
06347 }
06348
06349 ATD_STOR_BLK_IDX(attr_idx) = pointee_based_blk;
06350 pointer_idx = ATD_PTR_IDX(attr_idx);
06351
06352 if (TYP_TYPE(ATD_TYPE_IDX(attr_idx)) == Character) {
06353
06354 if (ATD_PTR_TYPE_SET(pointer_idx)) {
06355
06356 if (TYP_LINEAR(ATD_TYPE_IDX(pointer_idx)) != CRI_Ch_Ptr_8) {
06357
06358
06359
06360 AT_DCL_ERR(attr_idx) = TRUE;
06361 AT_DCL_ERR(pointer_idx) = TRUE;
06362 PRINTMSG(AT_DEF_LINE(attr_idx), 1428, Error,
06363 AT_DEF_COLUMN(attr_idx),
06364 AT_OBJ_NAME_PTR(pointer_idx),
06365 AT_OBJ_NAME_PTR(attr_idx));
06366 }
06367 }
06368 else {
06369 ATD_PTR_TYPE_SET(pointer_idx) = TRUE;
06370 ATD_TYPE_IDX(pointer_idx) = CRI_Ch_Ptr_8;
06371 }
06372 break;
06373 }
06374 else if (ATD_PTR_TYPE_SET(pointer_idx)) {
06375
06376 if (TYP_LINEAR(ATD_TYPE_IDX(pointer_idx)) == CRI_Ch_Ptr_8) {
06377
06378
06379
06380 AT_DCL_ERR(attr_idx) = TRUE;
06381 AT_DCL_ERR(pointer_idx) = TRUE;
06382 PRINTMSG(AT_DEF_LINE(attr_idx), 1427, Error,
06383 AT_DEF_COLUMN(attr_idx),
06384 AT_OBJ_NAME_PTR(pointer_idx),
06385 AT_OBJ_NAME_PTR(attr_idx));
06386 }
06387 }
06388
06389
06390 # if defined(_TARGET_OS_MAX)
06391
06392 if (PACK_HALF_WORD_TEST_CONDITION(ATD_TYPE_IDX(attr_idx))) {
06393
06394 if (ATD_PTR_TYPE_SET(pointer_idx)) {
06395
06396 if (TYP_PTR_INCREMENT(ATD_TYPE_IDX(pointer_idx)) != 32) {
06397 PRINTMSG(AT_DEF_LINE(pointer_idx), 1092, Error,
06398 AT_DEF_COLUMN(pointer_idx),
06399 AT_OBJ_NAME_PTR(pointer_idx));
06400 }
06401 }
06402 else {
06403 CLEAR_TBL_NTRY(type_tbl, TYP_WORK_IDX);
06404 TYP_TYPE(TYP_WORK_IDX) = CRI_Ptr;
06405 TYP_LINEAR(TYP_WORK_IDX) = CRI_Ptr_8;
06406 TYP_PTR_INCREMENT(TYP_WORK_IDX) = 32;
06407 ATD_TYPE_IDX(pointer_idx) = ntr_type_tbl();
06408 }
06409 }
06410 else if (ATD_PTR_TYPE_SET(pointer_idx)) {
06411
06412 if (TYP_PTR_INCREMENT(ATD_TYPE_IDX(pointer_idx)) != 64) {
06413 PRINTMSG(AT_DEF_LINE(pointer_idx), 1092, Error,
06414 AT_DEF_COLUMN(pointer_idx),
06415 AT_OBJ_NAME_PTR(pointer_idx));
06416 }
06417 }
06418
06419 # elif defined(_TARGET_OS_UNICOS)
06420
06421
06422
06423
06424 if (TARGET_MAX_HALF_WORD_STORAGE_TYPE(ATD_TYPE_IDX(attr_idx))) {
06425
06426 if (ATD_PTR_TYPE_SET(pointer_idx)) {
06427
06428 if (!ATD_PTR_HALF_WORD(pointer_idx)) {
06429 PRINTMSG(AT_DEF_LINE(pointer_idx), 1102, Caution,
06430 AT_DEF_COLUMN(pointer_idx),
06431 AT_OBJ_NAME_PTR(pointer_idx));
06432 }
06433 }
06434 else {
06435 ATD_PTR_HALF_WORD(pointer_idx) = TRUE;
06436 }
06437 }
06438 else if (ATD_PTR_TYPE_SET(pointer_idx)) {
06439
06440 if (ATD_PTR_HALF_WORD(pointer_idx)) {
06441 PRINTMSG(AT_DEF_LINE(pointer_idx), 1102, Caution,
06442 AT_DEF_COLUMN(pointer_idx),
06443 AT_OBJ_NAME_PTR(pointer_idx));
06444 }
06445 }
06446
06447 # elif defined(_TARGET_OS_SOLARIS) || (defined(_TARGET_OS_IRIX) || defined(_TARGET_OS_LINUX) || defined(_TARGET_OS_DARWIN))
06448
06449 #ifdef KEY
06450
06451 #else
06452 if (TARGET_32BIT_DOUBLE_WORD_STORAGE_TYPE(ATD_TYPE_IDX(attr_idx))) {
06453
06454 if (ATD_PTR_TYPE_SET(pointer_idx)) {
06455
06456 if (TYP_PTR_INCREMENT(ATD_TYPE_IDX(pointer_idx)) != 64) {
06457 PRINTMSG(AT_DEF_LINE(pointer_idx), 1092, Error,
06458 AT_DEF_COLUMN(pointer_idx),
06459 AT_OBJ_NAME_PTR(pointer_idx));
06460 }
06461 }
06462 else {
06463 CLEAR_TBL_NTRY(type_tbl, TYP_WORK_IDX);
06464 TYP_TYPE(TYP_WORK_IDX) = CRI_Ptr;
06465 TYP_LINEAR(TYP_WORK_IDX) = CRI_Ptr_8;
06466 TYP_PTR_INCREMENT(TYP_WORK_IDX) = 64;
06467 ATD_TYPE_IDX(pointer_idx) = ntr_type_tbl();
06468 }
06469 }
06470 else if (ATD_PTR_TYPE_SET(pointer_idx)) {
06471
06472 if (TYP_PTR_INCREMENT(ATD_TYPE_IDX(pointer_idx)) != 32) {
06473 PRINTMSG(AT_DEF_LINE(pointer_idx), 1092, Error,
06474 AT_DEF_COLUMN(pointer_idx),
06475 AT_OBJ_NAME_PTR(pointer_idx));
06476 }
06477 }
06478 #endif
06479
06480 # endif
06481 ATD_PTR_TYPE_SET(pointer_idx) = TRUE;
06482 break;
06483
06484 }
06485
06486 if (ATP_PURE(pgm_attr_idx) || ATP_ELEMENTAL(pgm_attr_idx)) {
06487 pure_str = ATP_PURE(pgm_attr_idx) ? "PURE" : "ELEMENTAL";
06488
06489 if (ATD_SAVED(attr_idx)) {
06490 PRINTMSG(AT_DEF_LINE(attr_idx), 1264, Error,
06491 AT_DEF_COLUMN(attr_idx),
06492 AT_OBJ_NAME_PTR(attr_idx),
06493 pure_str,
06494 AT_OBJ_NAME_PTR(pgm_attr_idx),
06495 "SAVE");
06496 }
06497
06498 if (ATD_DATA_INIT(attr_idx)) {
06499 PRINTMSG(AT_DEF_LINE(attr_idx), 1264, Error,
06500 AT_DEF_COLUMN(attr_idx),
06501 AT_OBJ_NAME_PTR(attr_idx),
06502 pure_str,
06503 AT_OBJ_NAME_PTR(pgm_attr_idx),
06504 "DATA initialized");
06505 }
06506
06507 if (ATD_CLASS(attr_idx) == Dummy_Argument) {
06508
06509 if (!ATD_POINTER(attr_idx) && ATD_INTENT(attr_idx) != Intent_In) {
06510
06511 if (ATP_PGM_UNIT(pgm_attr_idx) == Function) {
06512 PRINTMSG(AT_DEF_LINE(attr_idx), 1265, Error,
06513 AT_DEF_COLUMN(attr_idx),
06514 AT_OBJ_NAME_PTR(attr_idx),
06515 pure_str,
06516 AT_OBJ_NAME_PTR(pgm_attr_idx));
06517 }
06518 else if (ATP_PGM_UNIT(pgm_attr_idx) == Subroutine &&
06519 ATD_INTENT(attr_idx) == Intent_Unseen) {
06520 PRINTMSG(AT_DEF_LINE(attr_idx), 1266, Error,
06521 AT_DEF_COLUMN(attr_idx),
06522 AT_OBJ_NAME_PTR(attr_idx),
06523 pure_str,
06524 AT_OBJ_NAME_PTR(pgm_attr_idx));
06525 }
06526 }
06527
06528 if (ATP_ELEMENTAL(pgm_attr_idx) &&
06529 (ATD_POINTER(attr_idx) || ATD_ARRAY_IDX(attr_idx) != NULL_IDX)){
06530 PRINTMSG(AT_DEF_LINE(attr_idx), 1267, Error,
06531 AT_DEF_COLUMN(attr_idx),
06532 AT_OBJ_NAME_PTR(attr_idx),
06533 AT_OBJ_NAME_PTR(pgm_attr_idx));
06534 }
06535 }
06536 }
06537
06538 if (ATP_PGM_UNIT(pgm_attr_idx) == Module &&
06539 TYP_TYPE(type_idx) == Structure &&
06540 ATT_DEFAULT_INITIALIZED(TYP_IDX(type_idx)) &&
06541 !ATD_IN_COMMON(attr_idx) &&
06542 (ATD_CLASS(attr_idx) == Atd_Unknown ||
06543 ATD_CLASS(attr_idx) == Variable) &&
06544 !ATD_POINTER(attr_idx) &&
06545 !ATD_ALLOCATABLE(attr_idx) &&
06546 #ifdef KEY
06547
06548 !(ATD_SAVED(attr_idx) || ATP_SAVE_ALL(pgm_attr_idx))
06549 #else
06550 !ATD_SAVED(attr_idx)
06551 #endif
06552 ) {
06553 PRINTMSG(AT_DEF_LINE(attr_idx), 1641, Ansi,
06554 AT_DEF_COLUMN(attr_idx),
06555 AT_OBJ_NAME_PTR(attr_idx),
06556 AT_OBJ_NAME_PTR(TYP_IDX(type_idx)));
06557 }
06558 break;
06559
06560
06561 case Pgm_Unit:
06562
06563
06564
06565
06566 AT_SEMANTICS_DONE(attr_idx) = TRUE;
06567
06568 if (ATP_PROC(attr_idx) == Intern_Proc ||
06569 ATP_PROC(attr_idx) == Module_Proc) {
06570
06571 if (ATP_SCP_IDX(attr_idx) != curr_scp_idx) {
06572
06573
06574
06575
06576 AT_SEMANTICS_DONE(attr_idx) = FALSE;
06577 return;
06578 }
06579
06580
06581
06582
06583 if (ATP_PROC(attr_idx) == Intern_Proc &&
06584 (!ATP_PURE(attr_idx) || !ATP_ELEMENTAL(attr_idx))) {
06585 scp_idx = SCP_PARENT_IDX(curr_scp_idx);
06586
06587 while (scp_idx != NULL_IDX) {
06588
06589
06590
06591 if (ATP_PURE(SCP_ATTR_IDX(scp_idx)) &&
06592 !ATP_PURE(attr_idx) && !ATP_ELEMENTAL(attr_idx)) {
06593 PRINTMSG(AT_DEF_LINE(attr_idx), 1272, Error,
06594 AT_DEF_COLUMN(attr_idx),
06595 AT_OBJ_NAME_PTR(attr_idx),
06596 ATP_PURE(SCP_ATTR_IDX(scp_idx))?"pure":"elemental",
06597 AT_OBJ_NAME_PTR(SCP_ATTR_IDX(scp_idx)),
06598 ATP_PURE(SCP_ATTR_IDX(scp_idx))?"PURE":"ELEMENTAL");
06599 }
06600
06601 if (ATP_ELEMENTAL(SCP_ATTR_IDX(scp_idx)) &&
06602 !ATP_ELEMENTAL(attr_idx)) {
06603 PRINTMSG(AT_DEF_LINE(attr_idx), 1272, Error,
06604 AT_DEF_COLUMN(attr_idx),
06605 AT_OBJ_NAME_PTR(attr_idx),
06606 "elemental",
06607 AT_OBJ_NAME_PTR(SCP_ATTR_IDX(scp_idx)),
06608 "ELEMENTAL");
06609 }
06610 scp_idx = SCP_PARENT_IDX(scp_idx);
06611 }
06612 }
06613 }
06614
06615 if (ATP_PGM_UNIT(attr_idx) == Function) {
06616 rslt_idx = ATP_RSLT_IDX(attr_idx);
06617 type_idx = ATD_TYPE_IDX(rslt_idx);
06618
06619 if (TYP_TYPE(type_idx) == Structure) {
06620
06621 #ifdef KEY
06622
06623
06624
06625
06626
06627
06628
06629
06630
06631
06632
06633
06634
06635
06636
06637
06638 int type_attr = TYP_IDX(type_idx);
06639 if ((!AT_DEFINED(type_attr)) && ATP_IN_INTERFACE_BLK(attr_idx) &&
06640 SCP_IMPORT(curr_scp_idx)) {
06641
06642 token_type t = initial_token;
06643 char *name = AT_OBJ_NAME_PTR(type_attr);
06644 int name_len = strlen(name);
06645 memcpy(TOKEN_STR(t), name, name_len);
06646 import_from_host(TOKEN_STR(t), name_len, 0, type_attr);
06647 }
06648 #endif
06649
06650 if (AT_ATTR_LINK(TYP_IDX(type_idx)) != NULL_IDX) {
06651
06652
06653
06654
06655
06656
06657 link_idx = TYP_IDX(type_idx);
06658
06659 while (AT_ATTR_LINK(link_idx) != NULL_IDX) {
06660 link_idx = AT_ATTR_LINK(link_idx);
06661 }
06662
06663 TYP_IDX(type_idx) = link_idx;
06664 }
06665 attr_semantics(TYP_IDX(type_idx), FALSE);
06666 }
06667
06668 bd_idx = ATD_ARRAY_IDX(rslt_idx);
06669
06670 if (TYP_TYPE(type_idx) == Character) {
06671
06672 if (TYP_FLD(type_idx) == AT_Tbl_Idx) {
06673 attr_semantics(TYP_IDX(type_idx), TRUE);
06674 }
06675
06676 if (TYP_CHAR_CLASS(type_idx) == Assumed_Size_Char) {
06677
06678 if (ATP_ELEMENTAL(attr_idx)) {
06679 PRINTMSG(AT_DEF_LINE(rslt_idx), 1564, Error,
06680 AT_DEF_COLUMN(rslt_idx),
06681 AT_OBJ_NAME_PTR(rslt_idx), "ELEMENTAL");
06682 }
06683 else if (ATP_PURE(attr_idx)) {
06684 PRINTMSG(AT_DEF_LINE(rslt_idx), 1564, Error,
06685 AT_DEF_COLUMN(rslt_idx),
06686 AT_OBJ_NAME_PTR(rslt_idx), "PURE");
06687 }
06688 }
06689 }
06690
06691 if (bd_idx != NULL_IDX && BD_ARRAY_CLASS(bd_idx) != Deferred_Shape) {
06692
06693 for (dim = 1; dim <= BD_RANK(bd_idx); dim++) {
06694
06695 if (BD_LB_FLD(bd_idx, dim) == AT_Tbl_Idx) {
06696 attr_semantics(BD_LB_IDX(bd_idx, dim), TRUE);
06697 }
06698
06699 if (BD_UB_FLD(bd_idx, dim) == AT_Tbl_Idx) {
06700 attr_semantics(BD_UB_IDX(bd_idx, dim), TRUE);
06701 }
06702 }
06703 }
06704 #ifdef KEY
06705
06706
06707
06708
06709
06710
06711
06712
06713 if (TYP_TYPE(type_idx) == Structure &&
06714 ATT_DEFAULT_INITIALIZED(TYP_IDX(type_idx))) {
06715 #ifdef KEY
06716
06717
06718
06719
06720
06721
06722 if (bd_idx != NULL_IDX) {
06723 array_dim_resolution(rslt_idx, FALSE);
06724 }
06725 #endif
06726 gen_entry_dope_code(rslt_idx);
06727 }
06728 #endif
06729 AT_SEMANTICS_DONE(rslt_idx) = TRUE;
06730 }
06731
06732 # if defined(_TARGET_OS_SOLARIS) || (defined(_TARGET_OS_IRIX) || defined(_TARGET_OS_LINUX) || defined(_TARGET_OS_DARWIN))
06733
06734
06735
06736 if (ATP_PROC(attr_idx) != Intrin_Proc ||
06737 AT_OBJ_NAME(attr_idx) != '_' ||
06738 (!(strcmp(AT_OBJ_NAME_PTR(attr_idx), "_DATE") == 0)) &&
06739 # ifdef KEY
06740 (!(strcmp(AT_OBJ_NAME_PTR(attr_idx), "_FDATE") == 0)) &&
06741 # endif
06742 (!(strcmp(AT_OBJ_NAME_PTR(attr_idx), "_JDATE") == 0)) &&
06743 (!(strcmp(AT_OBJ_NAME_PTR(attr_idx), "_CLOCK") == 0))) {
06744 # endif
06745
06746 if (AT_USE_ASSOCIATED(attr_idx) || AT_IS_INTRIN(attr_idx)) {
06747 goto EXIT;
06748 }
06749
06750 # if defined(_TARGET_OS_SOLARIS) || (defined(_TARGET_OS_IRIX) || defined(_TARGET_OS_LINUX) || defined(_TARGET_OS_DARWIN))
06751 }
06752 else {
06753 CLEAR_TBL_NTRY(type_tbl, TYP_WORK_IDX);
06754 TYP_TYPE(TYP_WORK_IDX) = Character;
06755 TYP_LINEAR(TYP_WORK_IDX) = CHARACTER_DEFAULT_TYPE;
06756 TYP_CHAR_CLASS(TYP_WORK_IDX) = Const_Len_Char;
06757 TYP_FLD(TYP_WORK_IDX) = CN_Tbl_Idx;
06758 TYP_IDX(TYP_WORK_IDX) = C_INT_TO_CN(SA_INTEGER_DEFAULT_TYPE,
06759 8);
06760 ATD_TYPE_IDX(rslt_idx) = ntr_type_tbl();
06761 }
06762 # endif
06763
06764 if (ATP_PGM_UNIT(attr_idx) == Function) {
06765
06766 if (!AT_TYPED(rslt_idx) && ATP_PROC(attr_idx) != Intrin_Proc) {
06767
06768 if (SCP_IMPL_NONE(curr_scp_idx)) {
06769 AT_DCL_ERR(rslt_idx) = TRUE;
06770 PRINTMSG(AT_DEF_LINE(rslt_idx), 232, Error,
06771 AT_DEF_COLUMN(rslt_idx),
06772 AT_OBJ_NAME_PTR(rslt_idx));
06773 }
06774 else if (!IM_SET(curr_scp_idx, IMPL_IDX(AT_OBJ_NAME(rslt_idx)))) {
06775
06776 if (SCP_PARENT_NONE(curr_scp_idx)) {
06777 AT_DCL_ERR(rslt_idx) = TRUE;
06778 PRINTMSG(AT_DEF_LINE(rslt_idx), 233, Error,
06779 AT_DEF_COLUMN(rslt_idx),
06780 AT_OBJ_NAME_PTR(rslt_idx));
06781 }
06782 else if (is_interface && attr_idx == pgm_attr_idx &&
06783 SCP_IMPL_NONE(SCP_PARENT_IDX(curr_scp_idx))) {
06784 AT_DCL_ERR(rslt_idx) = TRUE;
06785 PRINTMSG(AT_DEF_LINE(rslt_idx), 233, Error,
06786 AT_DEF_COLUMN(rslt_idx),
06787 AT_OBJ_NAME_PTR(rslt_idx));
06788 }
06789 else if (on_off_flags.implicit_none) {
06790 AT_DCL_ERR(attr_idx) = TRUE;
06791 PRINTMSG(AT_DEF_LINE(rslt_idx), 1171, Error,
06792 AT_DEF_COLUMN(rslt_idx),
06793 AT_OBJ_NAME_PTR(rslt_idx));
06794 }
06795 }
06796 }
06797
06798 if (TYP_TYPE(type_idx) == Character) {
06799 char_len_resolution(rslt_idx, FALSE);
06800
06801
06802
06803 type_idx = ATD_TYPE_IDX(rslt_idx);
06804 }
06805
06806 if (ATD_ARRAY_IDX(rslt_idx) != NULL_IDX) {
06807 array_dim_resolution(rslt_idx, FALSE);
06808
06809 if (!ATP_EXPL_ITRFC(attr_idx) && !AT_DCL_ERR(rslt_idx)) {
06810 PRINTMSG(AT_DEF_LINE(rslt_idx), 914, Error,
06811 AT_DEF_COLUMN(rslt_idx),
06812 AT_OBJ_NAME_PTR(attr_idx));
06813 AT_DCL_ERR(rslt_idx) = TRUE;
06814 }
06815 }
06816
06817 if (ATD_POINTER(rslt_idx) && !ATP_EXPL_ITRFC(attr_idx)) {
06818 PRINTMSG(AT_DEF_LINE(rslt_idx), 915, Error,
06819 AT_DEF_COLUMN(rslt_idx),
06820 AT_OBJ_NAME_PTR(attr_idx));
06821 AT_DCL_ERR(rslt_idx) = TRUE;
06822 }
06823
06824 if (ATD_AUTOMATIC(rslt_idx) &&
06825 (ATD_ARRAY_IDX(rslt_idx) != NULL_IDX ||
06826 ATD_POINTER(rslt_idx) ||
06827 TYP_TYPE(type_idx) == Structure ||
06828 TYP_TYPE(type_idx) == Character)) {
06829 PRINTMSG(AT_DEF_LINE(rslt_idx), 1255, Error,
06830 AT_DEF_COLUMN(rslt_idx),
06831 AT_OBJ_NAME_PTR(rslt_idx));
06832 AT_DCL_ERR(rslt_idx) = TRUE;
06833 }
06834
06835 if (AT_DCL_ERR(rslt_idx)) {
06836 AT_DCL_ERR(attr_idx) = TRUE;
06837 }
06838
06839 if (TYP_TYPE(type_idx) == Character &&
06840 TYP_CHAR_CLASS(type_idx) == Assumed_Size_Char &&
06841 TYP_FLD(type_idx) == AT_Tbl_Idx &&
06842 AT_OBJ_CLASS(TYP_IDX(type_idx)) == Data_Obj) {
06843
06844 tmp_ir_idx = ATD_TMP_IDX(TYP_IDX(type_idx));
06845
06846 COPY_OPND(opnd, IR_OPND_R(tmp_ir_idx));
06847 fold_clen_opr(&opnd, &expr_desc);
06848 COPY_OPND(IR_OPND_R(tmp_ir_idx), opnd);
06849 }
06850
06851
06852
06853
06854
06855
06856 #ifdef KEY
06857 if (FUNCTION_MUST_BE_SUBROUTINE(attr_idx, rslt_idx))
06858 #else
06859 if (FUNCTION_MUST_BE_SUBROUTINE(rslt_idx))
06860 #endif
06861 {
06862
06863 ATP_EXTRA_DARG(attr_idx) = TRUE;
06864
06865 if (ATP_EXPL_ITRFC(attr_idx)) {
06866 ATD_STOR_BLK_IDX(rslt_idx) = SCP_SB_DARG_IDX(curr_scp_idx);
06867
06868
06869
06870 if (ATP_FIRST_IDX(attr_idx) == NULL_IDX) {
06871 NTR_SN_TBL(sn_idx);
06872 }
06873 else {
06874 sn_idx = ATP_FIRST_IDX(attr_idx) - 1;
06875 }
06876 ATP_FIRST_IDX(attr_idx) = sn_idx;
06877 ATP_NUM_DARGS(attr_idx) += 1;
06878 SN_NAME_LEN(sn_idx) = AT_NAME_LEN(rslt_idx);
06879 SN_NAME_IDX(sn_idx) = AT_NAME_IDX(rslt_idx);
06880 SN_ATTR_IDX(sn_idx) = rslt_idx;
06881 SN_LINE_NUM(sn_idx) = AT_DEF_LINE(rslt_idx);
06882 SN_COLUMN_NUM(sn_idx) = AT_DEF_COLUMN(rslt_idx);
06883 }
06884 }
06885 else if (SCP_ALT_ENTRY_CNT(curr_scp_idx) > 0 &&
06886 (attr_idx == pgm_attr_idx || ATP_ALT_ENTRY(attr_idx))) {
06887
06888 if (alt_entry_equiv_blk == NULL_IDX) {
06889
06890
06891
06892
06893 alt_entry_equiv_blk = create_equiv_stor_blk(attr_idx, Stack);
06894 }
06895
06896 if (ATP_RSLT_IDX(attr_idx) != NULL_IDX) {
06897 storage_size = stor_bit_size_of(ATP_RSLT_IDX(attr_idx),
06898 TRUE,
06899 FALSE);
06900
06901
06902
06903 if (storage_size.fld == NO_Tbl_Idx) {
06904 storage_size.fld = CN_Tbl_Idx;
06905 storage_size.idx = ntr_const_tbl(storage_size.type_idx,
06906 FALSE,
06907 storage_size.constant);
06908 }
06909
06910 # if defined(_TARGET_OS_MAX)
06911
06912 else if (storage_size.fld == IR_Tbl_Idx ||
06913 storage_size.fld == IL_Tbl_Idx) {
06914 tmp_idx = gen_compiler_tmp(SB_DEF_LINE(alt_entry_equiv_blk),
06915 SB_DEF_COLUMN(alt_entry_equiv_blk),
06916 Priv, TRUE);
06917 ATD_TYPE_IDX(tmp_idx) = INTEGER_DEFAULT_TYPE;
06918 ATD_TMP_IDX(tmp_idx) = storage_size.idx;
06919 ATD_FLD(tmp_idx) = storage_size.fld;
06920 ATD_SYMBOLIC_CONSTANT(tmp_idx) = TRUE;
06921 storage_size.fld = AT_Tbl_Idx;
06922 storage_size.idx = tmp_idx;
06923 }
06924
06925 if (attr_idx == pgm_attr_idx &&
06926 ATD_ARRAY_IDX(rslt_idx) != NULL_IDX &&
06927 BD_ARRAY_SIZE(ATD_ARRAY_IDX(rslt_idx)) ==
06928 Symbolic_Constant_Size){
06929 PRINTMSG(AT_DEF_LINE(rslt_idx), 1230, Error,
06930 AT_DEF_COLUMN(rslt_idx),
06931 AT_OBJ_NAME_PTR(attr_idx));
06932 AT_DCL_ERR(rslt_idx) = TRUE;
06933 }
06934 # endif
06935
06936 SB_LEN_FLD(alt_entry_equiv_blk) = storage_size.fld;
06937 SB_LEN_IDX(alt_entry_equiv_blk) = storage_size.idx;
06938 }
06939
06940 ATD_STOR_BLK_IDX(rslt_idx) = alt_entry_equiv_blk;
06941 ATD_EQUIV(rslt_idx) = TRUE;
06942 ATD_OFFSET_ASSIGNED(rslt_idx) = TRUE;
06943 ATD_OFFSET_FLD(rslt_idx) = CN_Tbl_Idx;
06944 ATD_OFFSET_IDX(rslt_idx) = CN_INTEGER_ZERO_IDX;
06945
06946 if (alt_entry_equiv_grp == NULL_IDX) {
06947 NTR_EQ_TBL(alt_entry_equiv_grp);
06948 EQ_GRP_END_IDX(alt_entry_equiv_grp) = alt_entry_equiv_grp;
06949 eq_idx = alt_entry_equiv_grp;
06950 EQ_GRP_IDX(eq_idx) = alt_entry_equiv_grp;
06951 }
06952 else {
06953 NTR_EQ_TBL(eq_idx);
06954 EQ_NEXT_EQUIV_OBJ(EQ_GRP_END_IDX(alt_entry_equiv_grp)) = eq_idx;
06955 EQ_GRP_END_IDX(alt_entry_equiv_grp) = eq_idx;
06956 EQ_GRP_IDX(eq_idx) = alt_entry_equiv_grp;
06957 }
06958
06959 EQ_LINE_NUM(eq_idx) = AT_DEF_LINE(rslt_idx);
06960 EQ_COLUMN_NUM(eq_idx) = AT_DEF_COLUMN(rslt_idx);
06961 EQ_ATTR_IDX(eq_idx) = rslt_idx;
06962 }
06963 else {
06964 ATD_STOR_BLK_IDX(rslt_idx) = SCP_SB_STACK_IDX(curr_scp_idx);
06965 }
06966
06967 if (ATP_ALT_ENTRY(attr_idx)) {
06968 compare_entry_to_func_rslt(attr_idx, ATP_RSLT_IDX(pgm_attr_idx));
06969 }
06970
06971 if (ATP_ELEMENTAL(attr_idx) &&
06972 (ATD_POINTER(rslt_idx) || ATD_ARRAY_IDX(rslt_idx) != NULL_IDX)) {
06973 PRINTMSG(AT_DEF_LINE(rslt_idx), 1268, Error,
06974 AT_DEF_COLUMN(rslt_idx),
06975 AT_OBJ_NAME_PTR(attr_idx),
06976 AT_OBJ_NAME_PTR(rslt_idx));
06977 AT_DCL_ERR(rslt_idx) = TRUE;
06978 }
06979 }
06980 else if (ATP_PGM_UNIT(attr_idx) == Subroutine) {
06981
06982 if (ATP_HAS_ALT_RETURN(attr_idx)) {
06983
06984 if (ATP_ELEMENTAL(pgm_attr_idx)) {
06985
06986
06987
06988
06989 for (sn_idx = ATP_FIRST_IDX(pgm_attr_idx);
06990 sn_idx <= ATP_FIRST_IDX(pgm_attr_idx) +
06991 ATP_NUM_DARGS(pgm_attr_idx);
06992 sn_idx++) {
06993
06994 if (AT_OBJ_CLASS(SN_ATTR_IDX(sn_idx)) == Data_Obj &&
06995 ATD_CLASS(SN_ATTR_IDX(sn_idx)) == Dummy_Argument &&
06996 AT_COMPILER_GEND(SN_ATTR_IDX(sn_idx))) {
06997 PRINTMSG(AT_DEF_LINE(SN_ATTR_IDX(sn_idx)), 1269, Error,
06998 AT_DEF_COLUMN(SN_ATTR_IDX(sn_idx)),
06999 AT_OBJ_NAME_PTR(pgm_attr_idx));
07000 AT_DCL_ERR(pgm_attr_idx) = TRUE;
07001 }
07002 }
07003 }
07004
07005
07006
07007
07008 CREATE_FUNC_RSLT(attr_idx, rslt_idx);
07009 AT_DEFINED(rslt_idx) = TRUE;
07010 ATD_TYPE_IDX(rslt_idx) = CG_INTEGER_DEFAULT_TYPE;
07011 ATD_STOR_BLK_IDX(rslt_idx) = SCP_SB_STACK_IDX(curr_scp_idx);
07012
07013 if (ATP_ALT_ENTRY(attr_idx)) {
07014
07015 if (alt_entry_equiv_blk == NULL_IDX) {
07016
07017
07018
07019
07020 alt_entry_equiv_blk = create_equiv_stor_blk(attr_idx, Stack);
07021 }
07022
07023 if (alt_entry_equiv_grp == NULL_IDX) {
07024 NTR_EQ_TBL(alt_entry_equiv_grp);
07025 EQ_GRP_END_IDX(alt_entry_equiv_grp) = alt_entry_equiv_grp;
07026 eq_idx = alt_entry_equiv_grp;
07027 EQ_GRP_IDX(eq_idx) = alt_entry_equiv_grp;
07028 }
07029 else {
07030 NTR_EQ_TBL(eq_idx);
07031 EQ_NEXT_EQUIV_OBJ(EQ_GRP_END_IDX(alt_entry_equiv_grp))=eq_idx;
07032 EQ_GRP_END_IDX(alt_entry_equiv_grp) = eq_idx;
07033 EQ_GRP_IDX(eq_idx) = alt_entry_equiv_grp;
07034 }
07035
07036 EQ_LINE_NUM(eq_idx) = AT_DEF_LINE(rslt_idx);
07037 EQ_COLUMN_NUM(eq_idx) = AT_DEF_COLUMN(rslt_idx);
07038 EQ_ATTR_IDX(eq_idx) = rslt_idx;
07039 ATD_STOR_BLK_IDX(rslt_idx) = alt_entry_equiv_blk;
07040 }
07041 }
07042 }
07043 else if (ATP_PGM_UNIT(attr_idx) == Pgm_Unknown) {
07044
07045 if (ATP_PROC(attr_idx) == Module_Proc) {
07046
07047
07048
07049
07050 AT_DCL_ERR(attr_idx) = TRUE;
07051 PRINTMSG(AT_DEF_LINE(attr_idx), 368, Error,
07052 AT_DEF_COLUMN(attr_idx),
07053 AT_OBJ_NAME_PTR(attr_idx));
07054 }
07055 else if (ATP_PROC(attr_idx) == Dummy_Proc) {
07056
07057
07058
07059
07060
07061
07062
07063 CREATE_FUNC_RSLT(attr_idx, rslt_idx);
07064 SET_IMPL_TYPE(rslt_idx);
07065 }
07066 }
07067
07068 if (ATP_PGM_UNIT(attr_idx) != Module &&
07069 ATP_FIRST_IDX(attr_idx) != NULL_IDX) {
07070
07071 for (i = (ATP_EXTRA_DARG(attr_idx) ? 1 : 0);
07072 i < ATP_NUM_DARGS(attr_idx); i++) {
07073 darg_idx = SN_ATTR_IDX(ATP_FIRST_IDX(attr_idx) + i);
07074 attr_semantics(darg_idx, FALSE);
07075 }
07076 }
07077
07078
07079
07080 ATP_NOSIDE_EFFECTS(attr_idx) = ATP_NOSIDE_EFFECTS(attr_idx) |
07081 ATP_VFUNCTION(attr_idx);
07082
07083
07084
07085
07086
07087 if (is_interface) {
07088 ATP_SCP_IDX(attr_idx) = SCP_PARENT_IDX(curr_scp_idx);
07089 }
07090
07091 if (ATP_PROC(attr_idx) == Dummy_Proc) {
07092
07093 #ifdef KEY
07094 if (!AT_IS_DARG(attr_idx)) {
07095 error_not_darg(attr_idx);
07096 }
07097 #endif
07098
07099
07100
07101
07102
07103 proc_idx = is_interface ? SCP_ATTR_IDX(SCP_PARENT_IDX(curr_scp_idx)) :
07104 pgm_attr_idx;
07105
07106 if (ATP_ELEMENTAL(proc_idx)) {
07107 PRINTMSG(AT_DEF_LINE(attr_idx), 1267, Error,
07108 AT_DEF_COLUMN(attr_idx),
07109 AT_OBJ_NAME_PTR(attr_idx),
07110 AT_OBJ_NAME_PTR(proc_idx));
07111 }
07112 else if (ATP_PURE(proc_idx) && !ATP_PURE(attr_idx)) {
07113
07114
07115
07116 PRINTMSG(AT_DEF_LINE(attr_idx), 1271, Error,
07117 AT_DEF_COLUMN(attr_idx),
07118 AT_OBJ_NAME_PTR(attr_idx),
07119 AT_OBJ_NAME_PTR(proc_idx));
07120 }
07121 }
07122
07123 if (ATP_DUPLICATE_INTERFACE_IDX(attr_idx) != NULL_IDX) {
07124
07125
07126
07127
07128
07129 compare_duplicate_interface_bodies(attr_idx);
07130 }
07131
07132
07133 break;
07134
07135 case Label:
07136
07137 if (!AT_DEFINED(attr_idx)) {
07138 # ifdef _DEBUG
07139 if (ATL_FWD_REF_IDX(attr_idx) == NULL_IDX &&
07140 (ATL_CLASS(attr_idx) == Lbl_User ||
07141 ATL_CLASS(attr_idx) == Lbl_Format)) {
07142 PRINTMSG(stmt_start_line, 9, Internal,
07143 stmt_start_col, AT_OBJ_NAME_PTR(attr_idx));
07144 }
07145 # endif
07146 curr_fwd_ref_idx = ATL_FWD_REF_IDX(attr_idx);
07147
07148 while (curr_fwd_ref_idx != NULL_IDX) {
07149 if (IL_FLD(curr_fwd_ref_idx) == IL_Tbl_Idx) {
07150 line = IL_LINE_NUM(IL_IDX(curr_fwd_ref_idx));
07151 column = IL_COL_NUM(IL_IDX(curr_fwd_ref_idx));
07152 }
07153 else {
07154 line = IL_LINE_NUM(curr_fwd_ref_idx);
07155 column = IL_COL_NUM(curr_fwd_ref_idx);
07156 }
07157 PRINTMSG(line, 23, Error, column,
07158 AT_OBJ_NAME_PTR(attr_idx));
07159 old_fwd_ref_idx = curr_fwd_ref_idx;
07160 curr_fwd_ref_idx = IL_NEXT_LIST_IDX(curr_fwd_ref_idx);
07161 FREE_IR_LIST_NODE(old_fwd_ref_idx);
07162 }
07163
07164 ATL_FWD_REF_IDX(attr_idx) = NULL_IDX;
07165 }
07166 break;
07167
07168 case Derived_Type:
07169
07170
07171
07172 AT_SEMANTICS_DONE(attr_idx) = TRUE;
07173 sn_idx = ATT_FIRST_CPNT_IDX(attr_idx);
07174
07175 while (sn_idx != NULL_IDX) {
07176 type_idx = ATD_TYPE_IDX(SN_ATTR_IDX(sn_idx));
07177
07178 if (TYP_TYPE(type_idx) == Structure) {
07179 dt_idx = TYP_IDX(type_idx);
07180 attr_semantics(dt_idx, FALSE);
07181
07182 if (ATP_PGM_UNIT(SCP_ATTR_IDX(curr_scp_idx)) == Module &&
07183 !AT_PRIVATE(attr_idx) &&
07184 !ATT_PRIVATE_CPNT(attr_idx) &&
07185 AT_PRIVATE(dt_idx) &&
07186 !AT_USE_ASSOCIATED(dt_idx)) {
07187 PRINTMSG(AT_DEF_LINE(SN_ATTR_IDX(sn_idx)), 45, Error,
07188 AT_DEF_COLUMN(SN_ATTR_IDX(sn_idx)),
07189 AT_OBJ_NAME_PTR(SN_ATTR_IDX(sn_idx)),
07190 AT_OBJ_NAME_PTR(dt_idx),
07191 AT_OBJ_NAME_PTR(attr_idx));
07192 }
07193
07194 if (!AT_USE_ASSOCIATED(attr_idx) &&
07195 ATT_SEQUENCE_SET(attr_idx) && !ATT_SEQUENCE_SET(dt_idx)) {
07196 PRINTMSG(AT_DEF_LINE(attr_idx), 140, Error,
07197 AT_DEF_COLUMN(attr_idx));
07198 }
07199
07200 }
07201
07202 if (!AT_USE_ASSOCIATED(attr_idx) &&
07203 ATD_CPNT_INIT_IDX(SN_ATTR_IDX(sn_idx)) != NULL_IDX) {
07204 #ifdef KEY
07205 int cpnt_idx = SN_ATTR_IDX(sn_idx);
07206 if (ATD_ALLOCATABLE(cpnt_idx)) {
07207 PRINTMSG(AT_DEF_LINE(cpnt_idx), 1680, Error,
07208 AT_DEF_COLUMN(cpnt_idx), AT_OBJ_NAME_PTR(cpnt_idx));
07209 }
07210 else {
07211 default_init_semantics(SN_ATTR_IDX(sn_idx));
07212 }
07213 #else
07214 default_init_semantics(SN_ATTR_IDX(sn_idx));
07215 #endif
07216 }
07217 sn_idx = SN_SIBLING_LINK(sn_idx);
07218 }
07219
07220 if (!AT_DEFINED(attr_idx)) {
07221 issue_undefined_type_msg(attr_idx,
07222 AT_DEF_LINE(attr_idx),
07223 AT_DEF_COLUMN(attr_idx));
07224 }
07225
07226 if (is_interface) {
07227 ATT_SCP_IDX(attr_idx) = SCP_PARENT_IDX(curr_scp_idx);
07228 }
07229
07230 if (ATT_LABEL_LIST_IDX(attr_idx) != NULL_IDX) {
07231
07232
07233
07234 free_attr_list(ATT_LABEL_LIST_IDX(attr_idx));
07235 ATT_LABEL_LIST_IDX(attr_idx) = NULL_IDX;
07236 }
07237
07238 break;
07239
07240 case Interface:
07241
07242 if (!ATI_UNNAMED_INTERFACE(attr_idx)) {
07243
07244 if (!AT_IS_INTRIN(attr_idx)) {
07245
07246
07247
07248
07249 pgm_idx = ATI_PROC_IDX(attr_idx);
07250
07251 if (pgm_idx != NULL_IDX && ATP_PROC(pgm_idx) == Module_Proc) {
07252
07253 if (ATP_PGM_UNIT(pgm_idx) == Pgm_Unknown) {
07254
07255
07256
07257 sn_attr_idx = srch_host_sym_tbl(AT_OBJ_NAME_PTR(pgm_idx),
07258 AT_NAME_LEN(pgm_idx),
07259 &name_idx,
07260 FALSE);
07261
07262 if (sn_attr_idx != NULL_IDX &&
07263 AT_OBJ_CLASS(sn_attr_idx) == Interface &&
07264 ATI_PROC_IDX(sn_attr_idx) != NULL_IDX) {
07265 AT_ATTR_LINK(pgm_idx) = ATI_PROC_IDX(sn_attr_idx);
07266 ATI_PROC_IDX(attr_idx) = ATI_PROC_IDX(sn_attr_idx);
07267 }
07268 else if (sn_attr_idx != NULL_IDX &&
07269 AT_OBJ_CLASS(sn_attr_idx) == Pgm_Unit &&
07270 ATP_PROC(sn_attr_idx) == Module_Proc) {
07271 ATI_PROC_IDX(attr_idx) = sn_attr_idx;
07272 AT_ATTR_LINK(pgm_idx) = sn_attr_idx;
07273 }
07274 else if (!AT_DCL_ERR(pgm_idx)) {
07275 PRINTMSG(AT_DEF_LINE(pgm_idx), 368, Error,
07276 AT_DEF_COLUMN(pgm_idx),
07277 AT_OBJ_NAME_PTR(pgm_idx));
07278 AT_DCL_ERR(pgm_idx) = TRUE;
07279 AT_DCL_ERR(attr_idx) = TRUE;
07280 }
07281 }
07282
07283 sn_idx = ATI_FIRST_SPECIFIC_IDX(attr_idx);
07284 sn_attr_idx = srch_linked_sn(AT_OBJ_NAME_PTR(attr_idx),
07285 AT_NAME_LEN(attr_idx),
07286 &sn_idx);
07287
07288 if (sn_attr_idx == NULL_IDX) {
07289 AT_DCL_ERR(attr_idx) = TRUE;
07290 PRINTMSG(AT_DEF_LINE(ATI_PROC_IDX(attr_idx)), 712, Error,
07291 AT_DEF_COLUMN(ATI_PROC_IDX(attr_idx)),
07292 AT_OBJ_NAME_PTR(attr_idx),
07293 (ATP_PGM_UNIT(ATI_PROC_IDX(attr_idx)) == Function) ?
07294 "FUNCTION" : "SUBROUTINE",
07295 AT_OBJ_NAME_PTR(attr_idx));
07296 }
07297 else {
07298
07299
07300
07301
07302
07303 if ((cif_flags & XREF_RECS) != 0) {
07304 cif_usage_rec(attr_idx,
07305 AT_Tbl_Idx,
07306 SN_LINE_NUM(sn_attr_idx),
07307 SN_COLUMN_NUM(sn_attr_idx),
07308 CIF_Symbol_Declaration);
07309 }
07310 }
07311 }
07312
07313 if (AT_TYPED(attr_idx)) {
07314 AT_DCL_ERR(attr_idx) = TRUE;
07315 PRINTMSG(AT_DEF_LINE(attr_idx), 949, Error,
07316 AT_DEF_COLUMN(attr_idx),
07317 AT_OBJ_NAME_PTR(attr_idx));
07318 }
07319 }
07320 else if (AT_TYPED(attr_idx)) {
07321
07322 PRINTMSG(AT_DEF_LINE(attr_idx), 711, Caution,
07323 AT_DEF_COLUMN(attr_idx),
07324 AT_OBJ_NAME_PTR(attr_idx));
07325
07326 type_idx = ATD_TYPE_IDX(attr_idx);
07327
07328 if (TYP_TYPE(type_idx) == Structure) {
07329
07330 if (AT_ATTR_LINK(TYP_IDX(type_idx)) != NULL_IDX) {
07331
07332
07333
07334
07335
07336
07337 link_idx = TYP_IDX(type_idx);
07338
07339 while (AT_ATTR_LINK(link_idx) != NULL_IDX) {
07340 link_idx = AT_ATTR_LINK(link_idx);
07341 }
07342
07343 TYP_IDX(type_idx) = link_idx;
07344 }
07345
07346 attr_semantics(TYP_IDX(type_idx), FALSE);
07347 }
07348
07349 if (AT_USE_ASSOCIATED(attr_idx)) {
07350 goto EXIT;
07351 }
07352
07353 if (TYP_TYPE(type_idx) == Character) {
07354
07355 if (TYP_FLD(type_idx) == AT_Tbl_Idx) {
07356 attr_semantics(TYP_IDX(type_idx), TRUE);
07357 }
07358 }
07359
07360 if (AT_DCL_ERR(attr_idx)) {
07361 goto EXIT;
07362 }
07363 }
07364
07365
07366
07367
07368
07369
07370 if (ATI_INLINE_ALWAYS(attr_idx) ||
07371 ATI_INLINE_NEVER(attr_idx) ||
07372 ATI_SGI_ROUTINE_INLINE(attr_idx) ||
07373 ATI_SGI_ROUTINE_NOINLINE(attr_idx)) {
07374
07375 if (AT_IS_INTRIN(attr_idx) && !ATI_USER_SPECIFIED(attr_idx)) {
07376
07377 if (ATI_IPA_DIR_SPECIFIED(attr_idx)) {
07378 PRINTMSG(AT_DEF_LINE(attr_idx), 1655, Error,
07379 AT_DEF_COLUMN(attr_idx),
07380 AT_OBJ_NAME_PTR(attr_idx),
07381 "IPA");
07382 }
07383 else {
07384 PRINTMSG(AT_DEF_LINE(attr_idx), 1655, Error,
07385 AT_DEF_COLUMN(attr_idx),
07386 AT_OBJ_NAME_PTR(attr_idx),
07387 "INLINE");
07388 }
07389 }
07390 else {
07391 sn_idx = ATI_FIRST_SPECIFIC_IDX(attr_idx);
07392
07393 while (sn_idx != NULL_IDX) {
07394
07395 if (!AT_IS_INTRIN(SN_ATTR_IDX(sn_idx))) {
07396 ATP_INLINE_ALWAYS(SN_ATTR_IDX(sn_idx)) =
07397 ATI_INLINE_ALWAYS(attr_idx);
07398 ATP_INLINE_NEVER(SN_ATTR_IDX(sn_idx)) =
07399 ATI_INLINE_NEVER(attr_idx);
07400 ATP_SGI_ROUTINE_INLINE(SN_ATTR_IDX(sn_idx)) =
07401 ATI_SGI_ROUTINE_INLINE(attr_idx);
07402 ATP_SGI_ROUTINE_NOINLINE(SN_ATTR_IDX(sn_idx)) =
07403 ATI_SGI_ROUTINE_NOINLINE(attr_idx);
07404 }
07405 sn_idx = SN_SIBLING_LINK(sn_idx);
07406 }
07407 }
07408 }
07409
07410 verify_interface(attr_idx);
07411 }
07412 break;
07413
07414 case Namelist_Grp:
07415
07416 NTR_SN_TBL(sn_idx);
07417
07418 SN_SIBLING_LINK(sn_idx) = namelist_list_idx;
07419 namelist_list_idx = sn_idx;
07420 SN_ATTR_IDX(sn_idx) = attr_idx;
07421
07422 break;
07423
07424 case Stmt_Func:
07425
07426 if (AT_COMPILER_GEND(attr_idx)) {
07427 break;
07428 }
07429
07430 type_idx = ATD_TYPE_IDX(attr_idx);
07431
07432 if (TYP_TYPE(type_idx) == Structure) {
07433
07434 if (AT_ATTR_LINK(TYP_IDX(type_idx)) != NULL_IDX) {
07435
07436
07437
07438
07439
07440
07441 link_idx = TYP_IDX(type_idx);
07442
07443 while (AT_ATTR_LINK(link_idx) != NULL_IDX) {
07444 link_idx = AT_ATTR_LINK(link_idx);
07445 }
07446
07447 TYP_IDX(type_idx) = link_idx;
07448 }
07449
07450 attr_semantics(TYP_IDX(type_idx), FALSE);
07451 }
07452
07453 if (ATP_PGM_UNIT(pgm_attr_idx) == Module) {
07454
07455 if (TYP_TYPE(type_idx) == Structure &&
07456 !AT_PRIVATE(attr_idx) &&
07457 AT_PRIVATE(TYP_IDX(type_idx)) &&
07458 !AT_USE_ASSOCIATED(TYP_IDX(type_idx))) {
07459 PRINTMSG(AT_DEF_LINE(attr_idx), 598, Error,
07460 AT_DEF_COLUMN(attr_idx),
07461 AT_OBJ_NAME_PTR(attr_idx),
07462 AT_OBJ_NAME_PTR(TYP_IDX(type_idx)));
07463 }
07464 }
07465
07466 if (AT_USE_ASSOCIATED(attr_idx)) {
07467 goto EXIT;
07468 }
07469
07470 if (TYP_TYPE(type_idx) == Character) {
07471
07472 if (TYP_FLD(type_idx) == AT_Tbl_Idx) {
07473 attr_semantics(TYP_IDX(type_idx), TRUE);
07474 }
07475 }
07476
07477 if (AT_DCL_ERR(attr_idx)) {
07478 goto EXIT;
07479 }
07480
07481 if (!AT_TYPED(attr_idx)) {
07482
07483 if (SCP_IMPL_NONE(curr_scp_idx)) {
07484 AT_DCL_ERR(attr_idx) = TRUE;
07485 PRINTMSG(AT_DEF_LINE(attr_idx), 740, Error,
07486 AT_DEF_COLUMN(attr_idx),
07487 AT_OBJ_NAME_PTR(attr_idx));
07488 }
07489 else if (!IM_SET(curr_scp_idx, IMPL_IDX(AT_OBJ_NAME(attr_idx)))) {
07490
07491 if (SCP_PARENT_NONE(curr_scp_idx)) {
07492 AT_DCL_ERR(attr_idx) = TRUE;
07493 PRINTMSG(AT_DEF_LINE(attr_idx), 742, Error,
07494 AT_DEF_COLUMN(attr_idx),
07495 AT_OBJ_NAME_PTR(attr_idx));
07496 }
07497 else if (on_off_flags.implicit_none) {
07498 AT_DCL_ERR(attr_idx) = TRUE;
07499 PRINTMSG(AT_DEF_LINE(attr_idx), 1171, Error,
07500 AT_DEF_COLUMN(attr_idx),
07501 AT_OBJ_NAME_PTR(attr_idx));
07502 }
07503 }
07504 }
07505
07506 if (TYP_TYPE(ATD_TYPE_IDX(attr_idx)) == Character) {
07507 char_len_resolution(attr_idx, FALSE);
07508 type_idx = ATD_TYPE_IDX(attr_idx);
07509 }
07510
07511
07512
07513 first_idx = ATP_FIRST_IDX(attr_idx);
07514 count = ATP_NUM_DARGS(attr_idx);
07515
07516 for (i = first_idx; i < (first_idx + count); i++) {
07517 sf_attr_idx = SN_ATTR_IDX(i);
07518
07519 if (TYP_TYPE(ATD_TYPE_IDX(sf_attr_idx)) == Character) {
07520
07521 if (TYP_TYPE(ATD_TYPE_IDX(sf_attr_idx)) == Character) {
07522
07523 if (TYP_FLD(ATD_TYPE_IDX(sf_attr_idx)) == AT_Tbl_Idx) {
07524 attr_semantics(TYP_IDX(ATD_TYPE_IDX(sf_attr_idx)), TRUE);
07525 }
07526 }
07527
07528 type_resolved = TYP_RESOLVED(ATD_TYPE_IDX(sf_attr_idx));
07529 char_len_resolution(sf_attr_idx, TRUE);
07530
07531 if (TYP_CHAR_CLASS(ATD_TYPE_IDX(sf_attr_idx)) != Const_Len_Char) {
07532
07533 if (!AT_DCL_ERR(sf_attr_idx)) {
07534 PRINTMSG(AT_DEF_LINE(sf_attr_idx), 215, Error,
07535 AT_DEF_COLUMN(sf_attr_idx),
07536 AT_OBJ_NAME_PTR(sf_attr_idx),
07537 AT_OBJ_NAME_PTR(attr_idx));
07538 AT_DCL_ERR(sf_attr_idx) = TRUE;
07539 }
07540
07541
07542
07543
07544 TYP_RESOLVED(ATD_TYPE_IDX(sf_attr_idx)) = type_resolved;
07545 ATD_TYPE_IDX(sf_attr_idx) = CHARACTER_DEFAULT_TYPE;
07546 }
07547 }
07548
07549 if (!AT_TYPED(sf_attr_idx)) {
07550
07551 if (SCP_IMPL_NONE(curr_scp_idx)) {
07552 AT_DCL_ERR(sf_attr_idx) = TRUE;
07553 PRINTMSG(AT_DEF_LINE(sf_attr_idx), 741, Error,
07554 AT_DEF_COLUMN(sf_attr_idx),
07555 AT_OBJ_NAME_PTR(sf_attr_idx));
07556 }
07557 else if (!IM_SET(curr_scp_idx, IMPL_IDX(AT_OBJ_NAME(sf_attr_idx)))){
07558
07559 if (SCP_PARENT_NONE(curr_scp_idx)) {
07560 AT_DCL_ERR(sf_attr_idx) = TRUE;
07561 PRINTMSG(AT_DEF_LINE(sf_attr_idx), 743, Error,
07562 AT_DEF_COLUMN(sf_attr_idx),
07563 AT_OBJ_NAME_PTR(sf_attr_idx));
07564 }
07565 else if (on_off_flags.implicit_none) {
07566 AT_DCL_ERR(attr_idx) = TRUE;
07567 PRINTMSG(AT_DEF_LINE(sf_attr_idx), 1171, Error,
07568 AT_DEF_COLUMN(sf_attr_idx),
07569 AT_OBJ_NAME_PTR(sf_attr_idx));
07570 }
07571 }
07572 }
07573
07574 darg_idx = srch_sym_tbl(AT_OBJ_NAME_PTR(sf_attr_idx),
07575 AT_NAME_LEN(sf_attr_idx),
07576 &name_idx);
07577
07578 if (darg_idx != NULL_IDX && AT_OBJ_CLASS(darg_idx) == Data_Obj &&
07579 TYP_TYPE(ATD_TYPE_IDX(darg_idx)) !=
07580 TYP_TYPE(ATD_TYPE_IDX(sf_attr_idx))) {
07581
07582 PRINTMSG(AT_DEF_LINE(sf_attr_idx), 940, Ansi,
07583 AT_DEF_COLUMN(sf_attr_idx),
07584 AT_OBJ_NAME_PTR(sf_attr_idx));
07585 }
07586 }
07587 break;
07588
07589 }
07590
07591 # ifdef _F_MINUS_MINUS
07592 if (AT_OBJ_CLASS(attr_idx) == Data_Obj &&
07593 ATD_CLASS(attr_idx) == Variable &&
07594 ATD_ALLOCATABLE(attr_idx) &&
07595 ATD_PE_ARRAY_IDX(attr_idx) != NULL_IDX &&
07596 ATD_VARIABLE_TMP_IDX(attr_idx) == NULL_IDX &&
07597 ! AT_DCL_ERR(attr_idx)) {
07598
07599
07600
07601 gen_allocatable_ptr_ptee(attr_idx);
07602 }
07603 # endif
07604 #ifdef KEY
07605 check_interoperable_constraints(attr_idx);
07606 #endif
07607
07608 EXIT:
07609
07610 AT_SEMANTICS_DONE(attr_idx) = TRUE;
07611
07612 TRACE (Func_Exit, "attr_semantics", NULL);
07613
07614 return;
07615
07616 }
07617
07618
07619
07620
07621
07622
07623
07624
07625
07626
07627
07628
07629
07630
07631
07632
07633 static void namelist_resolution(int namelist_idx)
07634 {
07635
07636 int attr_idx;
07637 int entry_idx;
07638 boolean namelist_err;
07639 int namelist_grp_attr;
07640 int scp_idx;
07641 int sn_idx;
07642 boolean taskcommon;
07643
07644
07645 TRACE (Func_Entry, "namelist_resolution", NULL);
07646
07647 taskcommon = cmd_line_flags.taskcommon;
07648
07649 while (namelist_idx != NULL_IDX) {
07650 namelist_grp_attr = SN_ATTR_IDX(namelist_idx);
07651 sn_idx = ATN_FIRST_NAMELIST_IDX(namelist_grp_attr);
07652
07653 if (!AT_USE_ASSOCIATED(namelist_grp_attr)) {
07654 namelist_err = FALSE;
07655
07656 while (sn_idx != NULL_IDX) {
07657 attr_idx = SN_ATTR_IDX(sn_idx);
07658
07659 while (AT_ATTR_LINK(attr_idx) != NULL_IDX) {
07660 attr_idx = AT_ATTR_LINK(attr_idx);
07661 }
07662
07663
07664
07665 if (AT_OBJ_CLASS(attr_idx) == Pgm_Unit &&
07666 ATP_PGM_UNIT(attr_idx) == Function &&
07667 ATP_PROC(attr_idx) != Intrin_Proc) {
07668
07669 if (attr_idx == SCP_ATTR_IDX(curr_scp_idx) ||
07670 (ATP_ALT_ENTRY(attr_idx) &&
07671 SCP_PARENT_IDX(curr_scp_idx) == NULL_IDX)) {
07672 goto FOUND;
07673 }
07674
07675 scp_idx = curr_scp_idx;
07676
07677 while (scp_idx != NULL_IDX) {
07678
07679 if (attr_idx == SCP_ATTR_IDX(scp_idx)) {
07680 goto FOUND;
07681 }
07682
07683 entry_idx = SCP_ENTRY_IDX(scp_idx);
07684
07685 while (entry_idx != NULL_IDX) {
07686
07687 if (attr_idx == AL_ATTR_IDX(entry_idx)) {
07688 goto FOUND;
07689 }
07690 entry_idx = AL_NEXT_IDX(entry_idx);
07691 }
07692 scp_idx = SCP_PARENT_IDX(scp_idx);
07693 }
07694
07695 PRINTMSG(SN_LINE_NUM(sn_idx), 657, Error, SN_COLUMN_NUM(sn_idx),
07696 AT_OBJ_NAME_PTR(attr_idx));
07697 AT_DCL_ERR(attr_idx) = TRUE;
07698 AT_DCL_ERR(ATP_RSLT_IDX(attr_idx)) = TRUE;
07699 namelist_err = TRUE;
07700
07701 FOUND:
07702 if (!ATP_RSLT_NAME(attr_idx)) {
07703
07704
07705
07706
07707
07708 attr_idx = ATP_RSLT_IDX(attr_idx);
07709 }
07710 }
07711
07712 AT_NAMELIST_OBJ(attr_idx) = TRUE;
07713 SN_ATTR_IDX(sn_idx) = attr_idx;
07714
07715 if (!AT_DCL_ERR(attr_idx) &&
07716 !fnd_semantic_err(Obj_Namelist_Obj,
07717 SN_LINE_NUM(sn_idx),
07718 SN_COLUMN_NUM(sn_idx),
07719 attr_idx,
07720 TRUE)) {
07721
07722 if (ATD_STOR_BLK_IDX(attr_idx) != NULL_IDX &&
07723 SB_BLK_TYPE(ATD_STOR_BLK_IDX(attr_idx)) == Task_Common) {
07724
07725 taskcommon = TRUE;
07726 }
07727
07728 if (ATD_STOR_BLK_IDX(attr_idx) != NULL_IDX &&
07729 SB_IS_COMMON(ATD_STOR_BLK_IDX(attr_idx)) &&
07730 SB_AUXILIARY(ATD_STOR_BLK_IDX(attr_idx))) {
07731 PRINTMSG(SN_LINE_NUM(sn_idx), 663, Error,
07732 SN_COLUMN_NUM(sn_idx),
07733 AT_OBJ_NAME_PTR(attr_idx),
07734 SB_NAME_PTR(ATD_STOR_BLK_IDX(attr_idx)));
07735 AT_DCL_ERR(attr_idx) = TRUE;
07736 namelist_err = TRUE;
07737 }
07738
07739 if (TYP_TYPE(ATD_TYPE_IDX(attr_idx)) == Structure &&
07740 #ifdef KEY
07741 (ATT_ALLOCATABLE_CPNT(TYP_IDX(ATD_TYPE_IDX(attr_idx))) ||
07742 ATT_POINTER_CPNT(TYP_IDX(ATD_TYPE_IDX(attr_idx))))
07743 #else
07744 ATT_POINTER_CPNT(TYP_IDX(ATD_TYPE_IDX(attr_idx)))
07745 #endif
07746 ) {
07747 PRINTMSG(SN_LINE_NUM(sn_idx), 484, Error,
07748 SN_COLUMN_NUM(sn_idx),
07749 AT_OBJ_NAME_PTR(attr_idx));
07750 namelist_err = TRUE;
07751 }
07752
07753 if (ATP_PGM_UNIT(SCP_ATTR_IDX(curr_scp_idx)) == Module &&
07754 !AT_PRIVATE(namelist_grp_attr) && AT_PRIVATE(attr_idx) &&
07755 !AT_USE_ASSOCIATED(attr_idx)) {
07756
07757 PRINTMSG(SN_LINE_NUM(sn_idx), 438, Error,
07758 SN_COLUMN_NUM(sn_idx),
07759 AT_OBJ_NAME_PTR(namelist_grp_attr),
07760 AT_OBJ_NAME_PTR(attr_idx));
07761 namelist_err = TRUE;
07762 }
07763 else if (ATP_PGM_UNIT(SCP_ATTR_IDX(curr_scp_idx)) == Module &&
07764 !AT_PRIVATE(namelist_grp_attr) &&
07765 TYP_TYPE(ATD_TYPE_IDX(attr_idx)) == Structure &&
07766 ATT_PRIVATE_CPNT(TYP_IDX(ATD_TYPE_IDX(attr_idx)))) {
07767
07768 PRINTMSG(SN_LINE_NUM(sn_idx), 1085, Error,
07769 SN_COLUMN_NUM(sn_idx),
07770 AT_OBJ_NAME_PTR(namelist_grp_attr),
07771 AT_OBJ_NAME_PTR(attr_idx));
07772 namelist_err = TRUE;
07773 }
07774 }
07775 else {
07776 namelist_err = TRUE;
07777 }
07778
07779 sn_idx = SN_SIBLING_LINK(sn_idx);
07780 }
07781
07782 if (namelist_err) {
07783 AT_DCL_ERR(namelist_grp_attr) = TRUE;
07784 }
07785 else if (ATP_PGM_UNIT(SCP_ATTR_IDX(curr_scp_idx)) != Module ||
07786 ! taskcommon) {
07787
07788
07789 create_namelist_descriptor(namelist_grp_attr);
07790 }
07791 }
07792 else if (ATN_NAMELIST_DESC(namelist_grp_attr)) {
07793 AT_REFERENCED(ATN_NAMELIST_DESC(namelist_grp_attr)) = Referenced;
07794 ADD_ATTR_TO_LOCAL_LIST(ATN_NAMELIST_DESC(namelist_grp_attr));
07795
07796 }
07797
07798 namelist_idx = SN_SIBLING_LINK(namelist_idx);
07799
07800 }
07801
07802 TRACE (Func_Exit, "namelist_resolution", NULL);
07803
07804 return;
07805
07806 }
07807
07808
07809
07810
07811
07812
07813
07814
07815
07816
07817
07818
07819
07820
07821
07822
07823
07824
07825
07826
07827
07828
07829
07830
07831
07832
07833
07834
07835
07836 static int ntr_bnds_sh_tmp_list(opnd_type *opnd,
07837 int no_entry_list,
07838 int sh_idx,
07839 boolean gen_tmp_eq_0,
07840 int type_idx)
07841
07842 {
07843 int al_idx;
07844 #ifdef KEY
07845 int attr_idx = 0;
07846 #else
07847 int attr_idx;
07848 #endif
07849 int column;
07850 int ir_idx;
07851 int line;
07852 int prev_al = NULL_IDX;
07853
07854
07855 TRACE (Func_Entry, "ntr_bnds_sh_tmp_list", NULL);
07856
07857 find_opnd_line_and_column(opnd, &line, &column);
07858
07859 if (SCP_IS_INTERFACE(curr_scp_idx)) {
07860
07861
07862
07863 GEN_COMPILER_TMP_ASG(ir_idx,
07864 attr_idx,
07865 TRUE,
07866 line,
07867 column,
07868 type_idx,
07869 Priv);
07870
07871 IR_IDX_R(ATD_TMP_IDX(attr_idx)) = OPND_IDX((*opnd));
07872 IR_FLD_R(ATD_TMP_IDX(attr_idx)) = OPND_FLD((*opnd));
07873 IR_LINE_NUM_R(ATD_TMP_IDX(attr_idx)) = line;
07874 IR_COL_NUM_R(ATD_TMP_IDX(attr_idx)) = column;
07875
07876 AT_REFERENCED(attr_idx) = Not_Referenced;
07877 goto EXIT;
07878 }
07879
07880 al_idx = SCP_TMP_FW_IDX2(curr_scp_idx);
07881
07882 while (al_idx != NULL_IDX) {
07883 attr_idx = AL_ATTR_IDX(al_idx);
07884
07885
07886
07887
07888 if (compare_opnds(opnd, &(IR_OPND_R((ATD_TMP_IDX(attr_idx)))))) {
07889 break;
07890 }
07891 prev_al = al_idx;
07892 al_idx = AL_NEXT_IDX(al_idx);
07893 }
07894
07895 if (al_idx == NULL_IDX) {
07896 GEN_COMPILER_TMP_ASG(ir_idx,
07897 attr_idx,
07898 TRUE,
07899 line,
07900 column,
07901 type_idx,
07902 Priv);
07903
07904 COPY_OPND(IR_OPND_R(ir_idx), (*opnd));
07905 SH_IR_IDX(sh_idx) = ir_idx;
07906
07907
07908
07909
07910 if (SH_NEXT_IDX(curr_stmt_sh_idx) != NULL_IDX) {
07911 SH_NEXT_IDX(sh_idx) = SH_NEXT_IDX(curr_stmt_sh_idx);
07912 SH_PREV_IDX(SH_NEXT_IDX(sh_idx)) = sh_idx;
07913 }
07914
07915 SH_NEXT_IDX(curr_stmt_sh_idx) = sh_idx;
07916 SH_PREV_IDX(sh_idx) = curr_stmt_sh_idx;
07917 curr_stmt_sh_idx = sh_idx;
07918
07919 NTR_ATTR_LIST_TBL(al_idx);
07920 AL_ATTR_IDX(al_idx) = attr_idx;
07921
07922
07923
07924 if (prev_al == NULL_IDX) {
07925 SCP_TMP_FW_IDX2(curr_scp_idx) = al_idx;
07926 }
07927 else {
07928 AL_NEXT_IDX(prev_al) = al_idx;
07929 }
07930
07931 if (SCP_ENTRY_IDX(curr_scp_idx) != NULL_IDX) {
07932 ATD_NO_ENTRY_LIST(attr_idx) = merge_entry_lists(NULL_IDX,
07933 no_entry_list);
07934 insert_sh_after_entries(attr_idx,
07935 SH_PREV_IDX(curr_stmt_sh_idx),
07936 curr_stmt_sh_idx,
07937 gen_tmp_eq_0,
07938 TRUE);
07939 }
07940 }
07941 else {
07942
07943
07944
07945
07946
07947
07948 if (no_entry_list != NULL_IDX && !ATD_TMP_GEN_ZERO(attr_idx)) {
07949 gen_tmp_eq_zero_ir(attr_idx);
07950 }
07951
07952 FREE_SH_NODE(sh_idx);
07953 }
07954
07955 EXIT:
07956
07957 TRACE (Func_Exit, "ntr_bnds_sh_tmp_list", NULL);
07958
07959 return (attr_idx);
07960
07961 }
07962
07963
07964
07965
07966
07967
07968
07969
07970
07971
07972
07973
07974
07975
07976
07977
07978
07979
07980 static int merge_entry_lists(int merged_list,
07981 int new_list)
07982
07983 {
07984 int list_idx = NULL_IDX;
07985 int merged_list_start;
07986 #ifdef KEY
07987 int prev_idx = 0;
07988 #else
07989 int prev_idx;
07990 #endif
07991
07992
07993 TRACE (Func_Entry, "merge_entry_lists", NULL);
07994
07995 merged_list_start = merged_list;
07996
07997 if (merged_list == NULL_IDX) {
07998
07999 while (new_list != NULL_IDX) {
08000 prev_idx = list_idx;
08001 NTR_ATTR_LIST_TBL(list_idx);
08002
08003 if (prev_idx == NULL_IDX) {
08004 merged_list_start = list_idx;
08005 AL_ENTRY_COUNT(merged_list_start) = AL_ENTRY_COUNT(new_list);
08006 }
08007 else {
08008 AL_NEXT_IDX(prev_idx) = list_idx;
08009 }
08010
08011 AL_ATTR_IDX(list_idx) = AL_ATTR_IDX(new_list);
08012 new_list = AL_NEXT_IDX(new_list);
08013 }
08014 }
08015 else {
08016
08017 while (new_list != NULL_IDX) {
08018
08019 list_idx = merged_list;
08020
08021 while (list_idx != NULL_IDX &&
08022 AL_ATTR_IDX(new_list) != AL_ATTR_IDX(list_idx)) {
08023 prev_idx = list_idx;
08024 list_idx = AL_NEXT_IDX(list_idx);
08025 }
08026
08027
08028
08029
08030
08031 if (list_idx == NULL_IDX) {
08032 NTR_ATTR_LIST_TBL(list_idx);
08033 AL_NEXT_IDX(prev_idx) = list_idx;
08034 AL_ATTR_IDX(list_idx) = AL_ATTR_IDX(new_list);
08035 AL_ENTRY_COUNT(merged_list) += 1;
08036 }
08037
08038 new_list = AL_NEXT_IDX(new_list);
08039 }
08040 }
08041
08042 TRACE (Func_Exit, "merge_entry_lists", NULL);
08043
08044 return(merged_list_start);
08045
08046 }
08047
08048
08049
08050
08051
08052
08053
08054
08055
08056
08057
08058
08059
08060
08061
08062
08063
08064
08065 static int merge_entry_list_count(int merged_list,
08066 int new_list)
08067
08068 {
08069 int count;
08070 int list_idx = NULL_IDX;
08071
08072
08073 TRACE (Func_Entry, "merge_entry_list_count", NULL);
08074
08075 if (merged_list == NULL_IDX) {
08076 count = (new_list != NULL_IDX) ? AL_ENTRY_COUNT(new_list) : 0;
08077 }
08078 else {
08079
08080
08081
08082 count = AL_ENTRY_COUNT(merged_list);
08083
08084 while (new_list != NULL_IDX) {
08085 list_idx = merged_list;
08086
08087 while (list_idx != NULL_IDX &&
08088 AL_ATTR_IDX(new_list) != AL_ATTR_IDX(list_idx)) {
08089 list_idx = AL_NEXT_IDX(list_idx);
08090 }
08091
08092
08093
08094
08095
08096 if (list_idx == NULL_IDX) {
08097 count++;
08098 }
08099
08100 new_list = AL_NEXT_IDX(new_list);
08101 }
08102 }
08103
08104 TRACE (Func_Exit, "merge_entry_list_count", NULL);
08105
08106 return(count);
08107
08108 }
08109
08110
08111
08112
08113
08114
08115
08116
08117
08118
08119
08120
08121
08122
08123
08124
08125
08126
08127 static boolean gen_ir_at_this_entry(int entry_attr,
08128 int attr_idx)
08129
08130 {
08131 boolean not_in_list = TRUE;
08132 int list_idx;
08133
08134
08135 TRACE (Func_Entry, "gen_ir_at_this_entry", NULL);
08136
08137 list_idx = (ATD_CLASS(attr_idx) == Function_Result) ?
08138 ATP_NO_ENTRY_LIST(ATD_FUNC_IDX(attr_idx)) :
08139 ATD_NO_ENTRY_LIST(attr_idx);
08140
08141 while (list_idx != NULL_IDX) {
08142
08143 if (AL_ATTR_IDX(list_idx) == entry_attr) {
08144 not_in_list = FALSE;
08145 break;
08146 }
08147
08148 list_idx = AL_NEXT_IDX(list_idx);
08149 }
08150
08151 TRACE (Func_Exit, "gen_ir_at_this_entry", NULL);
08152
08153 return(not_in_list);
08154
08155 }
08156
08157
08158
08159
08160
08161
08162
08163
08164
08165
08166
08167
08168
08169
08170
08171
08172
08173
08174
08175
08176
08177
08178
08179
08180
08181
08182
08183 static void insert_sh_after_entries(int attr_idx,
08184 int start_sh_idx,
08185 int end_sh_idx,
08186 boolean gen_tmp_eq_0,
08187 boolean advance_first_sh)
08188 {
08189 boolean bump_curr_sh;
08190 int entry_attr_idx;
08191 int entry_list_idx;
08192 int entry_sh_idx;
08193 int ir_idx;
08194 int new_start_sh_idx;
08195 int new_end_sh_idx;
08196 int next_sh_idx;
08197 int no_entry_list;
08198 int save_curr_sh_idx;
08199 int sh_idx;
08200
08201
08202 TRACE (Func_Entry, "insert_sh_after_entries", NULL);
08203
08204 if (SH_NEXT_IDX(start_sh_idx) == NULL_IDX) {
08205 return;
08206 }
08207
08208 entry_list_idx = SCP_ENTRY_IDX(curr_scp_idx);
08209
08210 no_entry_list = (ATD_CLASS(attr_idx) == Function_Result) ?
08211 ATP_NO_ENTRY_LIST(ATD_FUNC_IDX(attr_idx)) :
08212 ATD_NO_ENTRY_LIST(attr_idx);
08213
08214 while (entry_list_idx != NULL_IDX) {
08215 entry_attr_idx = AL_ATTR_IDX(entry_list_idx);
08216
08217 if (no_entry_list == NULL_IDX ||
08218 gen_ir_at_this_entry(entry_attr_idx, attr_idx)) {
08219 entry_sh_idx = ATP_FIRST_SH_IDX(entry_attr_idx);
08220 next_sh_idx = SH_NEXT_IDX(entry_sh_idx);
08221
08222 copy_entry_exit_sh_list(SH_NEXT_IDX(start_sh_idx),
08223 end_sh_idx,
08224 &new_start_sh_idx,
08225 &new_end_sh_idx);
08226
08227 if (new_start_sh_idx != NULL_IDX) {
08228 SH_NEXT_IDX(entry_sh_idx) = new_start_sh_idx;
08229 SH_PREV_IDX(new_start_sh_idx) = entry_sh_idx;
08230
08231 entry_sh_idx = new_end_sh_idx;
08232
08233 SH_PREV_IDX(next_sh_idx) = entry_sh_idx;
08234 SH_NEXT_IDX(entry_sh_idx) = next_sh_idx;
08235
08236 if (AT_OPTIONAL(attr_idx)) {
08237 gen_present_ir(attr_idx,
08238 SH_NEXT_IDX(ATP_FIRST_SH_IDX(entry_attr_idx)),
08239 entry_sh_idx);
08240 entry_sh_idx = SH_NEXT_IDX(entry_sh_idx);
08241 }
08242
08243 if (advance_first_sh) {
08244 ATP_FIRST_SH_IDX(entry_attr_idx) = entry_sh_idx;
08245 }
08246 }
08247 }
08248
08249 else if (gen_tmp_eq_0) {
08250
08251
08252
08253
08254 save_curr_sh_idx = curr_stmt_sh_idx;
08255 curr_stmt_sh_idx = ATP_FIRST_SH_IDX(entry_attr_idx);
08256
08257
08258
08259 while (IR_OPR(SH_IR_IDX(curr_stmt_sh_idx)) != Entry_Opr) {
08260 curr_stmt_sh_idx = SH_PREV_IDX(curr_stmt_sh_idx);
08261 }
08262
08263 gen_sh(After,
08264 Assignment_Stmt,
08265 SH_GLB_LINE(curr_stmt_sh_idx),
08266 SH_COL_NUM(curr_stmt_sh_idx),
08267 FALSE,
08268 FALSE,
08269 TRUE);
08270
08271 NTR_IR_TBL(ir_idx);
08272 SH_IR_IDX(curr_stmt_sh_idx) = ir_idx;
08273
08274 COPY_TBL_NTRY(ir_tbl, ir_idx, ATD_TMP_IDX(attr_idx));
08275
08276 IR_FLD_R(ir_idx) = CN_Tbl_Idx;
08277 IR_IDX_R(ir_idx) = CN_INTEGER_ZERO_IDX;
08278 IR_LINE_NUM_R(ir_idx) = SH_GLB_LINE(curr_stmt_sh_idx);
08279 IR_COL_NUM_R(ir_idx) = SH_COL_NUM(curr_stmt_sh_idx);
08280
08281 ATD_TMP_GEN_ZERO(attr_idx) = TRUE;
08282
08283
08284
08285 if (IR_OPR(SH_IR_IDX(ATP_FIRST_SH_IDX(entry_attr_idx))) == Entry_Opr) {
08286 ATP_FIRST_SH_IDX(entry_attr_idx) = curr_stmt_sh_idx;
08287 }
08288
08289 curr_stmt_sh_idx = save_curr_sh_idx;
08290 }
08291 entry_list_idx = AL_NEXT_IDX(entry_list_idx);
08292 }
08293
08294 end_sh_idx = SH_NEXT_IDX(end_sh_idx);
08295
08296 if (no_entry_list != NULL_IDX &&
08297 !gen_ir_at_this_entry(SCP_ATTR_IDX(curr_scp_idx), attr_idx)) {
08298
08299
08300
08301
08302
08303
08304
08305 sh_idx = SH_NEXT_IDX(start_sh_idx);
08306 curr_stmt_sh_idx = start_sh_idx;
08307
08308 do {
08309 next_sh_idx = SH_NEXT_IDX(sh_idx);
08310 FREE_SH_NODE(sh_idx);
08311 sh_idx = next_sh_idx;
08312 }
08313 while (sh_idx != end_sh_idx);
08314
08315 SH_NEXT_IDX(start_sh_idx) = end_sh_idx;
08316
08317 if (end_sh_idx != NULL_IDX) {
08318 SH_PREV_IDX(end_sh_idx) = start_sh_idx;
08319 }
08320
08321 if (gen_tmp_eq_0) {
08322
08323
08324
08325
08326
08327
08328
08329 save_curr_sh_idx = curr_stmt_sh_idx;
08330 bump_curr_sh = TRUE;
08331
08332
08333
08334 while (IR_OPR(SH_IR_IDX(curr_stmt_sh_idx)) != Entry_Opr) {
08335 curr_stmt_sh_idx = SH_PREV_IDX(curr_stmt_sh_idx);
08336 bump_curr_sh = FALSE;
08337 }
08338
08339 gen_sh(After,
08340 Assignment_Stmt,
08341 SH_GLB_LINE(curr_stmt_sh_idx),
08342 SH_COL_NUM(curr_stmt_sh_idx),
08343 FALSE,
08344 FALSE,
08345 TRUE);
08346
08347 NTR_IR_TBL(ir_idx);
08348 SH_IR_IDX(curr_stmt_sh_idx) = ir_idx;
08349 IR_OPR(ir_idx) = Asg_Opr;
08350 IR_TYPE_IDX(ir_idx) = ATD_TYPE_IDX(attr_idx);
08351 IR_LINE_NUM(ir_idx) = AT_DEF_LINE(attr_idx);
08352 IR_COL_NUM(ir_idx) = AT_DEF_COLUMN(attr_idx);
08353 IR_FLD_L(ir_idx) = AT_Tbl_Idx;
08354 IR_IDX_L(ir_idx) = attr_idx;
08355 IR_LINE_NUM_L(ir_idx) = AT_DEF_LINE(attr_idx);
08356 IR_COL_NUM_L(ir_idx) = AT_DEF_COLUMN(attr_idx);
08357 IR_LINE_NUM_R(ir_idx) = AT_DEF_LINE(attr_idx);
08358 IR_COL_NUM_R(ir_idx) = AT_DEF_COLUMN(attr_idx);
08359 IR_FLD_R(ir_idx) = CN_Tbl_Idx;
08360 IR_IDX_R(ir_idx) = CN_INTEGER_ZERO_IDX;
08361 ATD_TMP_GEN_ZERO(attr_idx) = TRUE;
08362
08363 curr_stmt_sh_idx = (bump_curr_sh) ? SH_NEXT_IDX(save_curr_sh_idx) :
08364 save_curr_sh_idx;
08365 }
08366 }
08367 else if (AT_OPTIONAL(attr_idx)) {
08368 gen_present_ir(attr_idx,
08369 SH_NEXT_IDX(start_sh_idx),
08370 curr_stmt_sh_idx);
08371 curr_stmt_sh_idx = SH_NEXT_IDX(curr_stmt_sh_idx);
08372 }
08373
08374 TRACE (Func_Exit, "insert_sh_after_entries", NULL);
08375
08376 return;
08377
08378 }
08379
08380
08381
08382
08383
08384
08385
08386
08387
08388
08389
08390
08391
08392
08393
08394
08395
08396 static void gen_tmp_eq_zero_ir(int attr_idx)
08397 {
08398 int entry_attr_idx;
08399 int entry_list_idx;
08400 int entry_sh_idx;
08401 int ir_idx;
08402 int next_sh_idx;
08403 int new_sh_idx;
08404
08405
08406 TRACE (Func_Entry, "gen_tmp_eq_zero_ir", NULL);
08407
08408 entry_list_idx = SCP_ENTRY_IDX(curr_scp_idx);
08409
08410 while (entry_list_idx != NULL_IDX) {
08411 entry_attr_idx = AL_ATTR_IDX(entry_list_idx);
08412
08413 if (!gen_ir_at_this_entry(entry_attr_idx, attr_idx)) {
08414 entry_sh_idx = ATP_FIRST_SH_IDX(entry_attr_idx);
08415 next_sh_idx = SH_NEXT_IDX(entry_sh_idx);
08416 new_sh_idx = ntr_sh_tbl();
08417 SH_NEXT_IDX(entry_sh_idx) = new_sh_idx;
08418 SH_NEXT_IDX(new_sh_idx) = next_sh_idx;
08419 SH_PREV_IDX(new_sh_idx) = entry_sh_idx;
08420 SH_PREV_IDX(next_sh_idx) = new_sh_idx;
08421 SH_STMT_TYPE(new_sh_idx) = Automatic_Base_Size_Stmt;
08422 SH_GLB_LINE(new_sh_idx) = AT_DEF_LINE(attr_idx);
08423 SH_COL_NUM(new_sh_idx) = AT_DEF_COLUMN(attr_idx);
08424 SH_COMPILER_GEN(new_sh_idx) = TRUE;
08425 SH_P2_SKIP_ME(new_sh_idx) = TRUE;
08426 NTR_IR_TBL(ir_idx);
08427 SH_IR_IDX(new_sh_idx) = ir_idx;
08428 IR_OPR(ir_idx) = Asg_Opr;
08429 IR_TYPE_IDX(ir_idx) = ATD_TYPE_IDX(attr_idx);
08430 IR_FLD_L(ir_idx) = AT_Tbl_Idx;
08431 IR_IDX_L(ir_idx) = attr_idx;
08432 IR_FLD_R(ir_idx) = CN_Tbl_Idx;
08433 IR_IDX_R(ir_idx) = CN_INTEGER_ZERO_IDX;
08434 IR_LINE_NUM_L(ir_idx) = AT_DEF_LINE(attr_idx);
08435 IR_LINE_NUM_R(ir_idx) = AT_DEF_LINE(attr_idx);
08436 IR_LINE_NUM(ir_idx) = AT_DEF_LINE(attr_idx);
08437 IR_COL_NUM_L(ir_idx) = AT_DEF_COLUMN(attr_idx);
08438 IR_COL_NUM_R(ir_idx) = AT_DEF_COLUMN(attr_idx);
08439 IR_COL_NUM(ir_idx) = AT_DEF_COLUMN(attr_idx);
08440 ATD_TMP_GEN_ZERO(attr_idx) = TRUE;
08441 ATP_FIRST_SH_IDX(entry_attr_idx) = new_sh_idx;
08442 ATD_TMP_GEN_ZERO(attr_idx) = TRUE;
08443 }
08444 entry_list_idx = AL_NEXT_IDX(entry_list_idx);
08445 }
08446
08447 if (!gen_ir_at_this_entry(SCP_ATTR_IDX(curr_scp_idx), attr_idx)) {
08448 new_sh_idx = ntr_sh_tbl();
08449 SH_NEXT_IDX(curr_stmt_sh_idx) = new_sh_idx;
08450 SH_PREV_IDX(new_sh_idx) = curr_stmt_sh_idx;
08451 SH_STMT_TYPE(new_sh_idx) = Automatic_Base_Size_Stmt;
08452 SH_GLB_LINE(new_sh_idx) = AT_DEF_LINE(attr_idx);
08453 SH_COL_NUM(new_sh_idx) = AT_DEF_COLUMN(attr_idx);
08454 SH_COMPILER_GEN(new_sh_idx) = TRUE;
08455 SH_P2_SKIP_ME(new_sh_idx) = TRUE;
08456 NTR_IR_TBL(ir_idx);
08457 SH_IR_IDX(new_sh_idx) = ir_idx;
08458 IR_OPR(ir_idx) = Asg_Opr;
08459 IR_TYPE_IDX(ir_idx) = ATD_TYPE_IDX(attr_idx);
08460 IR_FLD_L(ir_idx) = AT_Tbl_Idx;
08461 IR_IDX_L(ir_idx) = attr_idx;
08462 IR_FLD_R(ir_idx) = CN_Tbl_Idx;
08463 IR_IDX_R(ir_idx) = CN_INTEGER_ZERO_IDX;
08464 IR_LINE_NUM_L(ir_idx) = AT_DEF_LINE(attr_idx);
08465 IR_LINE_NUM_R(ir_idx) = AT_DEF_LINE(attr_idx);
08466 IR_LINE_NUM(ir_idx) = AT_DEF_LINE(attr_idx);
08467 IR_COL_NUM_L(ir_idx) = AT_DEF_COLUMN(attr_idx);
08468 IR_COL_NUM_R(ir_idx) = AT_DEF_COLUMN(attr_idx);
08469 IR_COL_NUM(ir_idx) = AT_DEF_COLUMN(attr_idx);
08470 ATD_TMP_GEN_ZERO(attr_idx) = TRUE;
08471 curr_stmt_sh_idx = new_sh_idx;
08472 }
08473
08474 TRACE (Func_Exit, "gen_tmp_eq_zero_ir", NULL);
08475
08476 return;
08477
08478 }
08479
08480
08481
08482
08483
08484
08485
08486
08487
08488
08489
08490
08491
08492
08493
08494
08495
08496
08497
08498 #ifdef KEY
08499
08500 int gen_present_ir(int attr_idx,
08501 int start_sh_idx,
08502 int end_sh_idx)
08503 #else
08504 static void gen_present_ir(int attr_idx,
08505 int start_sh_idx,
08506 int end_sh_idx)
08507 #endif
08508 {
08509 int br_around_opt;
08510 int br_idx;
08511 int cont_idx;
08512 int present_idx;
08513 int not_idx;
08514 int save_sh_idx;
08515
08516
08517 TRACE (Func_Entry, "gen_present_ir", NULL);
08518
08519 save_sh_idx = curr_stmt_sh_idx;
08520 curr_stmt_sh_idx = start_sh_idx;
08521
08522 gen_sh(Before,
08523 Goto_Stmt,
08524 SH_GLB_LINE(start_sh_idx),
08525 SH_COL_NUM(start_sh_idx),
08526 FALSE,
08527 FALSE,
08528 TRUE);
08529
08530 SH_P2_SKIP_ME(SH_PREV_IDX(start_sh_idx)) = TRUE;
08531
08532 br_around_opt = gen_internal_lbl(stmt_start_line);
08533
08534 NTR_IR_TBL(br_idx);
08535 NTR_IR_TBL(present_idx);
08536 NTR_IR_TBL(not_idx);
08537
08538 IR_OPR(br_idx) = Br_True_Opr;
08539 IR_OPR(not_idx) = Not_Opr;
08540 IR_OPR(present_idx) = Present_Opr;
08541 IR_TYPE_IDX(present_idx) = LOGICAL_DEFAULT_TYPE;
08542 IR_TYPE_IDX(br_idx) = LOGICAL_DEFAULT_TYPE;
08543 IR_TYPE_IDX(not_idx) = LOGICAL_DEFAULT_TYPE;
08544
08545 SH_IR_IDX(SH_PREV_IDX(start_sh_idx)) = br_idx;
08546 IR_LINE_NUM(br_idx) = AT_DEF_LINE(attr_idx);
08547 IR_COL_NUM(br_idx) = AT_DEF_COLUMN(attr_idx);
08548 IR_LINE_NUM(not_idx) = AT_DEF_LINE(attr_idx);
08549 IR_COL_NUM(not_idx) = AT_DEF_COLUMN(attr_idx);
08550 IR_LINE_NUM(present_idx) = AT_DEF_LINE(attr_idx);
08551 IR_COL_NUM(present_idx) = AT_DEF_COLUMN(attr_idx);
08552
08553 IR_FLD_R(br_idx) = AT_Tbl_Idx;
08554 IR_IDX_R(br_idx) = br_around_opt;
08555 IR_COL_NUM_R(br_idx) = AT_DEF_COLUMN(attr_idx);
08556 IR_LINE_NUM_R(br_idx) = AT_DEF_LINE(attr_idx);
08557
08558 IR_FLD_L(br_idx) = IR_Tbl_Idx;
08559 IR_IDX_L(br_idx) = not_idx;
08560
08561 IR_FLD_L(not_idx) = IR_Tbl_Idx;
08562 IR_IDX_L(not_idx) = present_idx;
08563
08564 IR_FLD_L(present_idx) = AT_Tbl_Idx;
08565 IR_IDX_L(present_idx) = attr_idx;
08566 IR_COL_NUM_L(present_idx) = AT_DEF_COLUMN(attr_idx);
08567 IR_LINE_NUM_L(present_idx) = AT_DEF_LINE(attr_idx);
08568
08569 NTR_IR_TBL(cont_idx);
08570 IR_OPR(cont_idx) = Label_Opr;
08571 IR_TYPE_IDX(cont_idx) = TYPELESS_DEFAULT_TYPE;
08572 IR_LINE_NUM(cont_idx) = AT_DEF_LINE(attr_idx);
08573 IR_COL_NUM(cont_idx) = AT_DEF_COLUMN(attr_idx);
08574 IR_IDX_L(cont_idx) = br_around_opt;
08575 IR_FLD_L(cont_idx) = AT_Tbl_Idx;
08576 IR_LINE_NUM_L(cont_idx) = AT_DEF_LINE(attr_idx);
08577 IR_COL_NUM_L(cont_idx) = AT_DEF_COLUMN(attr_idx);
08578 curr_stmt_sh_idx = end_sh_idx;
08579
08580 gen_sh(After,
08581 Continue_Stmt,
08582 SH_GLB_LINE(end_sh_idx),
08583 SH_COL_NUM(end_sh_idx),
08584 FALSE,
08585 TRUE,
08586 TRUE);
08587
08588 SH_P2_SKIP_ME(curr_stmt_sh_idx) = TRUE;
08589 SH_IR_IDX(curr_stmt_sh_idx) = cont_idx;
08590 #ifdef KEY
08591 int last_idx = curr_stmt_sh_idx;
08592 #endif
08593 curr_stmt_sh_idx = save_sh_idx;
08594
08595 TRACE (Func_Exit, "gen_present_ir", NULL);
08596
08597 #ifdef KEY
08598 return last_idx;
08599 #else
08600 return;
08601 #endif
08602
08603 }
08604
08605
08606
08607
08608
08609
08610
08611
08612
08613
08614
08615
08616
08617
08618
08619 static void tmp_ir_resolution(int ir_idx)
08620 {
08621
08622 TRACE (Func_Entry, "tmp_ir_resolution", NULL);
08623
08624
08625 switch (IR_FLD_L(ir_idx)) {
08626
08627 case AT_Tbl_Idx:
08628 attr_semantics(IR_IDX_L(ir_idx), FALSE);
08629 break;
08630
08631 case IR_Tbl_Idx:
08632 tmp_ir_resolution(IR_IDX_L(ir_idx));
08633 break;
08634
08635 case IL_Tbl_Idx:
08636 tmp_il_resolution(IR_IDX_L(ir_idx));
08637 break;
08638 }
08639
08640
08641 switch (IR_FLD_R(ir_idx)) {
08642
08643 case AT_Tbl_Idx:
08644 attr_semantics(IR_IDX_R(ir_idx), FALSE);
08645 break;
08646
08647 case IR_Tbl_Idx:
08648 tmp_ir_resolution(IR_IDX_R(ir_idx));
08649 break;
08650
08651 case IL_Tbl_Idx:
08652 tmp_il_resolution(IR_IDX_R(ir_idx));
08653 break;
08654 }
08655
08656 TRACE (Func_Exit, "tmp_ir_resolution", NULL);
08657
08658 return;
08659
08660 }
08661
08662
08663
08664
08665
08666
08667
08668
08669
08670
08671
08672
08673
08674
08675
08676 static void tmp_il_resolution(int list_idx)
08677 {
08678
08679 TRACE (Func_Entry, "tmp_il_resolution", NULL);
08680
08681 while (list_idx != NULL_IDX) {
08682
08683 switch (IL_FLD(list_idx)) {
08684
08685 case AT_Tbl_Idx:
08686 attr_semantics(IL_IDX(list_idx), FALSE);
08687 break;
08688
08689 case IR_Tbl_Idx:
08690 tmp_ir_resolution(IL_IDX(list_idx));
08691 break;
08692
08693 case IL_Tbl_Idx:
08694 tmp_il_resolution(IL_IDX(list_idx));
08695 break;
08696
08697 }
08698 list_idx = IL_NEXT_LIST_IDX(list_idx);
08699 }
08700
08701 TRACE (Func_Exit, "tmp_il_resolution", NULL);
08702
08703 return;
08704
08705 }
08706
08707
08708
08709
08710
08711
08712
08713
08714
08715
08716
08717
08718
08719
08720
08721
08722
08723 #ifdef KEY
08724 static void deallocate_local_allocatables(void)
08725
08726 {
08727
08728
08729
08730
08731 TRACE (Func_Entry, "deallocate_local_allocatables", NULL);
08732
08733 int line = stmt_start_line;
08734 int col = stmt_start_col;
08735 int save_curr_stmt_sh_idx = curr_stmt_sh_idx;
08736
08737 ADD_ATTR_TO_LOCAL_LIST(lazy_create_dealloc(line, col));
08738
08739 boolean first = TRUE;
08740 int start_sh_idx = ntr_sh_tbl();
08741 curr_stmt_sh_idx = start_sh_idx;
08742 SH_STMT_TYPE(curr_stmt_sh_idx) = Assignment_Stmt;
08743 SH_GLB_LINE(curr_stmt_sh_idx) = line;
08744 SH_COL_NUM(curr_stmt_sh_idx) = col;
08745 SH_COMPILER_GEN(curr_stmt_sh_idx) = TRUE;
08746 SH_P2_SKIP_ME(curr_stmt_sh_idx) = TRUE;
08747
08748 for (int sn_idx = allocatable_list_idx;
08749 sn_idx;
08750 sn_idx = SN_SIBLING_LINK(sn_idx)) {
08751 int sn_attr_idx = SN_ATTR_IDX(sn_idx);
08752 int has_pe_ref = (ATD_ALLOCATABLE(sn_attr_idx) &&
08753 ATD_PE_ARRAY_IDX(sn_attr_idx) != NULL_IDX);
08754 dealloc_allocatables(line, col, sn_attr_idx, AT_Tbl_Idx, sn_attr_idx,
08755 has_pe_ref, &first);
08756 }
08757
08758 while (SH_PREV_IDX(start_sh_idx)) {
08759 start_sh_idx = SH_PREV_IDX(start_sh_idx);
08760 }
08761
08762 if (SH_NEXT_IDX(curr_stmt_sh_idx)) {
08763 curr_stmt_sh_idx = SH_NEXT_IDX(curr_stmt_sh_idx);
08764 }
08765
08766 if (SCP_EXIT_IR_SH_IDX(curr_scp_idx) != NULL_IDX) {
08767 SH_NEXT_IDX(curr_stmt_sh_idx) = SCP_EXIT_IR_SH_IDX(curr_scp_idx);
08768 SCP_EXIT_IR_SH_IDX(curr_scp_idx) = start_sh_idx;
08769 }
08770 else {
08771 SCP_EXIT_IR_SH_IDX(curr_scp_idx) = start_sh_idx;
08772 }
08773
08774 curr_stmt_sh_idx = save_curr_stmt_sh_idx;
08775
08776 TRACE (Func_Exit, "deallocate_local_allocatables", NULL);
08777
08778 return;
08779
08780 }
08781
08782 #else
08783 static void deallocate_local_allocatables(void)
08784
08785 {
08786 int asg_idx;
08787 int cn_idx;
08788 int col;
08789 boolean has_normal_ref = FALSE;
08790 boolean has_pe_ref = FALSE;
08791 int line;
08792 int list_idx;
08793 int loc_idx;
08794 int save_curr_stmt_sh_idx;
08795 int sn_idx;
08796 int start_sh_idx;
08797
08798
08799 TRACE (Func_Entry, "deallocate_local_allocatables", NULL);
08800
08801 line = stmt_start_line;
08802 col = stmt_start_col;
08803 save_curr_stmt_sh_idx = curr_stmt_sh_idx;
08804
08805 ADD_ATTR_TO_LOCAL_LIST(glb_tbl_idx[Dealloc_Attr_Idx]);
08806
08807 # ifdef _SEPARATE_DEALLOCATES
08808 sn_idx = allocatable_list_idx;
08809
08810 start_sh_idx = ntr_sh_tbl();
08811 curr_stmt_sh_idx = start_sh_idx;
08812
08813 SH_STMT_TYPE(curr_stmt_sh_idx) = Assignment_Stmt;
08814 SH_GLB_LINE(curr_stmt_sh_idx) = line;
08815 SH_COL_NUM(curr_stmt_sh_idx) = col;
08816 SH_COMPILER_GEN(curr_stmt_sh_idx) = TRUE;
08817 SH_P2_SKIP_ME(curr_stmt_sh_idx) = TRUE;
08818
08819 while (sn_idx) {
08820
08821 if (ATD_ALLOCATABLE(SN_ATTR_IDX(sn_idx)) &&
08822 ATD_PE_ARRAY_IDX(SN_ATTR_IDX(sn_idx)) != NULL_IDX) {
08823 has_pe_ref = TRUE;
08824 }
08825 else {
08826 has_pe_ref = FALSE;
08827 }
08828
08829 NTR_IR_LIST_TBL(list_idx);
08830 asg_idx = gen_ir(IL_Tbl_Idx, list_idx,
08831 Deallocate_Opr, TYPELESS_DEFAULT_TYPE, line, col,
08832 NO_Tbl_Idx, NULL_IDX);
08833
08834 loc_idx = gen_ir(AT_Tbl_Idx, SN_ATTR_IDX(sn_idx),
08835 Aloc_Opr, CRI_Ptr_8, line, col,
08836 NO_Tbl_Idx, NULL_IDX);
08837
08838 IL_FLD(list_idx) = IR_Tbl_Idx;
08839 IL_IDX(list_idx) = loc_idx;
08840
08841 SH_IR_IDX(curr_stmt_sh_idx) = asg_idx;
08842
08843 # ifdef _ALLOCATE_IS_CALL
08844 set_up_allocate_as_call(asg_idx,
08845 glb_tbl_idx[Dealloc_Attr_Idx],
08846 NULL_IDX,
08847 has_pe_ref);
08848 # else
08849
08850 list_idx = gen_il(3, FALSE, line, col,
08851 AT_Tbl_Idx, glb_tbl_idx[Dealloc_Attr_Idx],
08852 CN_Tbl_Idx, gen_alloc_header_const(Integer_8,
08853 1,
08854 has_pe_ref,
08855 &cn_idx),
08856 CN_Tbl_Idx, CN_INTEGER_ZERO_IDX);
08857 IR_FLD_R(asg_idx) = IL_Tbl_Idx;
08858 IR_IDX_R(asg_idx) = list_idx;
08859 IR_LIST_CNT_R(asg_idx) = 3;
08860 # endif
08861
08862
08863 sn_idx = SN_SIBLING_LINK(sn_idx);
08864
08865 if (sn_idx) {
08866 gen_sh(After, Assignment_Stmt, line, col, FALSE, FALSE, TRUE);
08867 }
08868 }
08869
08870 # else
08871
08872 NTR_IR_TBL(asg_idx);
08873 IR_OPR(asg_idx) = Deallocate_Opr;
08874 IR_TYPE_IDX(asg_idx) = TYPELESS_DEFAULT_TYPE;
08875 IR_LINE_NUM(asg_idx) = line;
08876 IR_COL_NUM(asg_idx) = col;
08877
08878 NTR_IR_LIST_TBL(list_idx);
08879 IR_FLD_L(asg_idx) = IL_Tbl_Idx;
08880 IR_IDX_L(asg_idx) = list_idx;
08881 IR_LIST_CNT_L(asg_idx) = number_of_allocatables;
08882
08883 sn_idx = allocatable_list_idx;
08884
08885 while (sn_idx) {
08886
08887 if (ATD_ALLOCATABLE(SN_ATTR_IDX(sn_idx)) &&
08888 ATD_PE_ARRAY_IDX(SN_ATTR_IDX(sn_idx)) != NULL_IDX) {
08889 has_pe_ref = TRUE;
08890 }
08891 else {
08892 has_normal_ref = TRUE;
08893 }
08894
08895 NTR_IR_TBL(loc_idx);
08896 IR_OPR(loc_idx) = Aloc_Opr;
08897 IR_TYPE_IDX(loc_idx) = CRI_Ptr_8;
08898 IR_FLD_L(loc_idx) = AT_Tbl_Idx;
08899 IR_IDX_L(loc_idx) = SN_ATTR_IDX(sn_idx);
08900 IR_LINE_NUM(loc_idx) = line;
08901 IR_COL_NUM(loc_idx) = col;
08902 IR_LINE_NUM_L(loc_idx) = line;
08903 IR_COL_NUM_L(loc_idx) = col;
08904 IL_FLD(list_idx) = IR_Tbl_Idx;
08905 IL_IDX(list_idx) = loc_idx;
08906
08907 sn_idx = SN_SIBLING_LINK(sn_idx);
08908
08909 if (sn_idx) {
08910 NTR_IR_LIST_TBL(IL_NEXT_LIST_IDX(list_idx));
08911 IL_PREV_LIST_IDX(IL_NEXT_LIST_IDX(list_idx)) = list_idx;
08912 list_idx = IL_NEXT_LIST_IDX(list_idx);
08913 }
08914 }
08915
08916 start_sh_idx = ntr_sh_tbl();
08917 curr_stmt_sh_idx = start_sh_idx;
08918
08919 SH_STMT_TYPE(curr_stmt_sh_idx) = Assignment_Stmt;
08920 SH_GLB_LINE(curr_stmt_sh_idx) = line;
08921 SH_COL_NUM(curr_stmt_sh_idx) = col;
08922 SH_COMPILER_GEN(curr_stmt_sh_idx) = TRUE;
08923 SH_P2_SKIP_ME(curr_stmt_sh_idx) = TRUE;
08924
08925 SH_IR_IDX(curr_stmt_sh_idx) = asg_idx;
08926
08927 if (has_pe_ref && has_normal_ref) {
08928
08929 gen_split_alloc(asg_idx,
08930 glb_tbl_idx[Dealloc_Attr_Idx],
08931 NULL_IDX);
08932 }
08933
08934
08935 # ifdef _ALLOCATE_IS_CALL
08936 set_up_allocate_as_call(asg_idx,
08937 glb_tbl_idx[Dealloc_Attr_Idx],
08938 NULL_IDX,
08939 has_pe_ref);
08940 # else
08941 list_idx = gen_il(3, FALSE, line, col,
08942 AT_Tbl_Idx, glb_tbl_idx[Dealloc_Attr_Idx],
08943 CN_Tbl_Idx,
08944 gen_alloc_header_const(Integer_8,
08945 number_of_allocatables,
08946 has_pe_ref,
08947 &cn_idx),
08948 CN_Tbl_Idx, CN_INTEGER_ZERO_IDX);
08949 IR_FLD_R(asg_idx) = IL_Tbl_Idx;
08950 IR_IDX_R(asg_idx) = list_idx;
08951 IR_LIST_CNT_R(asg_idx) = 3;
08952
08953 # endif
08954 # endif
08955
08956 while (SH_PREV_IDX(start_sh_idx)) {
08957 start_sh_idx = SH_PREV_IDX(start_sh_idx);
08958 }
08959
08960 if (SH_NEXT_IDX(curr_stmt_sh_idx)) {
08961 curr_stmt_sh_idx = SH_NEXT_IDX(curr_stmt_sh_idx);
08962 }
08963
08964 if (SCP_EXIT_IR_SH_IDX(curr_scp_idx) != NULL_IDX) {
08965 SH_NEXT_IDX(curr_stmt_sh_idx) = SCP_EXIT_IR_SH_IDX(curr_scp_idx);
08966 SCP_EXIT_IR_SH_IDX(curr_scp_idx) = start_sh_idx;
08967 }
08968 else {
08969 SCP_EXIT_IR_SH_IDX(curr_scp_idx) = start_sh_idx;
08970 }
08971
08972 curr_stmt_sh_idx = save_curr_stmt_sh_idx;
08973
08974 TRACE (Func_Exit, "deallocate_local_allocatables", NULL);
08975
08976 return;
08977
08978 }
08979 #endif
08980
08981
08982
08983
08984
08985
08986
08987
08988
08989
08990
08991
08992
08993
08994
08995
08996
08997
08998
08999
09000 static boolean darg_in_entry_list (int srch_idx,
09001 int entry_idx)
09002 {
09003 register int i;
09004 register boolean matched = FALSE;
09005 register int member_cnt;
09006 register long *sn_tbl_base;
09007
09008
09009 TRACE (Func_Entry, "darg_in_entry_list", NULL);
09010
09011 member_cnt = ATP_NUM_DARGS(entry_idx);
09012
09013 #ifdef _HOST_LITTLE_ENDIAN
09014
09015
09016 for (i = ATP_FIRST_IDX(entry_idx);
09017 i < ATP_FIRST_IDX(entry_idx) + member_cnt;
09018 i++) {
09019 if (SN_ATTR_IDX(i) == srch_idx) {
09020 matched = TRUE;
09021 break;
09022 }
09023 }
09024 #else
09025
09026 sn_tbl_base = (long *) (sec_name_tbl + ATP_FIRST_IDX(entry_idx)) +
09027 (NUM_SN_WDS - 1);
09028
09029 # pragma _CRI ivdep
09030
09031 for (i = 0; i < member_cnt; i++) {
09032
09033 if ((sn_tbl_base[0] & 077777777) == srch_idx) {
09034 matched = TRUE;
09035 break;
09036 }
09037 sn_tbl_base = sn_tbl_base + NUM_SN_WDS;
09038 }
09039
09040 #endif
09041
09042 TRACE (Func_Exit, "darg_in_entry_list", NULL);
09043
09044 return (matched);
09045
09046 }
09047
09048
09049
09050
09051
09052
09053
09054
09055
09056
09057
09058
09059
09060
09061
09062
09063
09064
09065
09066 # if defined(_TARGET_WORD_ADDRESS) || \
09067 (defined(_HEAP_REQUEST_IN_WORDS) && defined(_TARGET_BYTE_ADDRESS))
09068 static void gen_word_align_byte_length_ir(opnd_type *len_opnd)
09069 {
09070 int column;
09071 int div_idx;
09072 int line;
09073 int paren_idx;
09074 int plus_idx;
09075 int type_idx;
09076
09077
09078 TRACE (Func_Entry, "gen_word_align_byte_length_ir", NULL);
09079
09080 line = OPND_LINE_NUM((*len_opnd));
09081 column = OPND_COL_NUM((*len_opnd));
09082
09083 NTR_IR_TBL(div_idx);
09084 NTR_IR_TBL(paren_idx);
09085 NTR_IR_TBL(plus_idx);
09086 IR_LINE_NUM(div_idx) = line;
09087 IR_COL_NUM(div_idx) = column;
09088 IR_LINE_NUM(paren_idx) = line;
09089 IR_COL_NUM(paren_idx) = column;
09090 IR_LINE_NUM(plus_idx) = line;
09091 IR_COL_NUM(plus_idx) = column;
09092
09093 type_idx = check_type_for_size_address(len_opnd);
09094
09095 COPY_OPND(IR_OPND_L(plus_idx), (*len_opnd));
09096
09097
09098
09099 IR_OPR(div_idx) = Div_Opr;
09100 IR_TYPE_IDX(div_idx) = type_idx;
09101 IR_FLD_L(div_idx) = IR_Tbl_Idx;
09102 IR_IDX_L(div_idx) = paren_idx;
09103 IR_FLD_R(div_idx) = CN_Tbl_Idx;
09104 IR_IDX_R(div_idx) = C_INT_TO_CN(CG_INTEGER_DEFAULT_TYPE,
09105 TARGET_BYTES_PER_WORD);
09106 IR_LINE_NUM_R(div_idx) = line;
09107 IR_COL_NUM_R(div_idx) = column;
09108
09109
09110
09111 IR_OPR(paren_idx) = Paren_Opr;
09112 IR_TYPE_IDX(div_idx) = type_idx;
09113 IR_TYPE_IDX(paren_idx) = type_idx;
09114 IR_FLD_L(paren_idx) = IR_Tbl_Idx;
09115 IR_IDX_L(paren_idx) = plus_idx;
09116 IR_LINE_NUM_L(paren_idx) = line;
09117 IR_COL_NUM_L(paren_idx) = column;
09118
09119
09120
09121 IR_OPR(plus_idx) = Plus_Opr;
09122 IR_TYPE_IDX(div_idx) = type_idx;
09123 IR_LINE_NUM_R(plus_idx) = line;
09124 IR_COL_NUM_R(plus_idx) = column;
09125 IR_FLD_R(plus_idx) = CN_Tbl_Idx;
09126 IR_IDX_R(plus_idx) = C_INT_TO_CN(CG_INTEGER_DEFAULT_TYPE,
09127 TARGET_BYTES_PER_WORD - 1);
09128 OPND_FLD((*len_opnd)) = IR_Tbl_Idx;
09129 OPND_IDX((*len_opnd)) = div_idx;
09130
09131 TRACE (Func_Exit, "gen_word_align_byte_length_ir", NULL);
09132
09133 return;
09134
09135 }
09136 # endif
09137
09138
09139
09140
09141
09142
09143
09144
09145
09146
09147
09148
09149
09150 int create_equiv_stor_blk(int attr_idx,
09151 sb_type_type sb_type)
09152 {
09153
09154 static char equivblk[8];
09155 static int ceb = 64;
09156 id_str_type storage_name;
09157 int sb_idx;
09158
09159
09160 TRACE (Func_Entry, "create_equiv_stor_blk", NULL);
09161
09162 ceb = ceb + 1;
09163
09164 if (ceb == 91) {
09165 ceb = 65;
09166 }
09167
09168 # if defined(_NO_AT_SIGN_IN_NAMES)
09169 equivblk[0] = '.';
09170 # else
09171 equivblk[0] = '@';
09172 # endif
09173 equivblk[1] = 'E';
09174 equivblk[2] = 'Q';
09175 equivblk[3] = 'U';
09176 equivblk[4] = 'I';
09177 equivblk[5] = 'V';
09178 equivblk[6] = (char)ceb;
09179
09180 CREATE_ID(storage_name, equivblk, 7);
09181
09182 if (sb_type == Stack) {
09183 sb_type = Equivalenced;
09184 }
09185
09186 sb_idx = ntr_stor_blk_tbl(storage_name.string, 7,
09187 AT_DEF_LINE(attr_idx),
09188 AT_DEF_COLUMN(attr_idx),
09189 sb_type);
09190
09191 SB_EQUIVALENCED(sb_idx) = TRUE;
09192
09193 TRACE (Func_Exit, "create_equiv_stor_blk", NULL);
09194
09195 return(sb_idx);
09196
09197 }
09198
09199
09200
09201
09202
09203
09204
09205
09206
09207
09208
09209
09210
09211
09212
09213
09214
09215 static void insert_argchck_calls(int sh_idx,
09216 int pgm_attr_idx)
09217
09218 {
09219 int argchck_darg_idx;
09220 int br_true_idx;
09221 int col;
09222 int ir_idx;
09223 int label_idx;
09224 int line;
09225 int list_idx;
09226 int loc_idx;
09227 int not_idx;
09228 opnd_type opnd;
09229 int save_curr_stmt_sh_idx;
09230
09231 # if 0
09232 int cn_idx;
09233 long_type the_constant;
09234 # endif
09235
09236
09237 TRACE (Func_Entry, "insert_argchck_calls", NULL);
09238
09239 line = SH_GLB_LINE(curr_stmt_sh_idx);
09240 col = SH_COL_NUM(curr_stmt_sh_idx);
09241
09242 save_curr_stmt_sh_idx = curr_stmt_sh_idx;
09243 curr_stmt_sh_idx = sh_idx;
09244
09245
09246
09247 label_idx = gen_internal_lbl(line);
09248
09249 # if 1
09250 NTR_IR_TBL(ir_idx);
09251 IR_TYPE_IDX(ir_idx) = LOGICAL_DEFAULT_TYPE;
09252 IR_OPR(ir_idx) = Argchck_Present_Opr;
09253 IR_LINE_NUM(ir_idx) = line;
09254 IR_COL_NUM(ir_idx) = col;
09255
09256 NTR_IR_TBL(not_idx);
09257 IR_TYPE_IDX(not_idx) = LOGICAL_DEFAULT_TYPE;
09258 IR_OPR(not_idx) = Not_Opr;
09259 IR_LINE_NUM(not_idx) = line;
09260 IR_COL_NUM(not_idx) = col;
09261
09262 IR_FLD_L(not_idx) = IR_Tbl_Idx;
09263 IR_IDX_L(not_idx) = ir_idx;
09264 # else
09265 cn_idx = set_up_logical_constant(&the_constant,
09266 CG_LOGICAL_DEFAULT_TYPE,
09267 TRUE_VALUE,
09268 TRUE);
09269 NTR_IR_TBL(not_idx);
09270 IR_TYPE_IDX(not_idx) = LOGICAL_DEFAULT_TYPE;
09271 IR_OPR(not_idx) = Not_Opr;
09272 IR_LINE_NUM(not_idx) = line;
09273 IR_COL_NUM(not_idx) = col;
09274
09275 IR_FLD_L(not_idx) = CN_Tbl_Idx;
09276 IR_IDX_L(not_idx) = cn_idx;
09277 IR_LINE_NUM_L(not_idx) = line;
09278 IR_COL_NUM_L(not_idx) = col;
09279 # endif
09280
09281 NTR_IR_TBL(br_true_idx);
09282 IR_OPR(br_true_idx) = Br_True_Opr;
09283 IR_TYPE_IDX(br_true_idx) = LOGICAL_DEFAULT_TYPE;
09284 IR_LINE_NUM(br_true_idx) = line;
09285 IR_COL_NUM(br_true_idx) = col;
09286 IR_FLD_R(br_true_idx) = AT_Tbl_Idx;
09287 IR_IDX_R(br_true_idx) = label_idx;
09288 IR_LINE_NUM_R(br_true_idx) = line;
09289 IR_COL_NUM_R(br_true_idx) = col;
09290
09291 IR_FLD_L(br_true_idx) = IR_Tbl_Idx;
09292 IR_IDX_L(br_true_idx) = not_idx;
09293
09294 gen_sh(Before, If_Stmt, line, col, FALSE, FALSE, TRUE);
09295 SH_IR_IDX(SH_PREV_IDX(curr_stmt_sh_idx)) = br_true_idx;
09296 SH_P2_SKIP_ME(SH_PREV_IDX(curr_stmt_sh_idx)) = TRUE;
09297
09298
09299
09300 OPND_FLD(opnd) = AT_Tbl_Idx;
09301 OPND_IDX(opnd) = pgm_attr_idx;
09302 OPND_LINE_NUM(opnd) = line;
09303 OPND_COL_NUM(opnd) = col;
09304 argchck_darg_idx = create_argchck_descriptor(&opnd);
09305
09306 NTR_IR_TBL(ir_idx);
09307 IR_OPR(ir_idx) = Call_Opr;
09308 IR_TYPE_IDX(ir_idx) = TYPELESS_DEFAULT_TYPE;
09309 IR_LINE_NUM(ir_idx) = line;
09310 IR_COL_NUM(ir_idx) = col;
09311
09312 if (glb_tbl_idx[Argchck_Attr_Idx] == NULL_IDX) {
09313 glb_tbl_idx[Argchck_Attr_Idx] = create_lib_entry_attr(ARGCHCK_LIB_ENTRY,
09314 ARGCHCK_NAME_LEN,
09315 line,
09316 col);
09317 }
09318
09319 ADD_ATTR_TO_LOCAL_LIST(glb_tbl_idx[Argchck_Attr_Idx]);
09320
09321 IR_FLD_L(ir_idx) = AT_Tbl_Idx;
09322 IR_IDX_L(ir_idx) = glb_tbl_idx[Argchck_Attr_Idx];
09323 IR_LINE_NUM_L(ir_idx) = line;
09324 IR_COL_NUM_L(ir_idx) = col;
09325
09326 NTR_IR_LIST_TBL(list_idx);
09327 IR_FLD_R(ir_idx) = IL_Tbl_Idx;
09328 IR_IDX_R(ir_idx) = list_idx;
09329 IR_LIST_CNT_R(ir_idx) = 2;
09330
09331 NTR_IR_TBL(loc_idx);
09332 IR_OPR(loc_idx) = Argchck_Loc_Opr;
09333 IR_TYPE_IDX(loc_idx) = CRI_Ptr_8;
09334 IR_LINE_NUM(loc_idx) = line;
09335 IR_COL_NUM(loc_idx) = col;
09336 IL_FLD(list_idx) = IR_Tbl_Idx;
09337 IL_IDX(list_idx) = loc_idx;
09338
09339 NTR_IR_LIST_TBL(IL_NEXT_LIST_IDX(list_idx));
09340 IL_PREV_LIST_IDX(IL_NEXT_LIST_IDX(list_idx)) = list_idx;
09341 list_idx = IL_NEXT_LIST_IDX(list_idx);
09342
09343 NTR_IR_TBL(loc_idx);
09344 IR_OPR(loc_idx) = Aloc_Opr;
09345 IR_TYPE_IDX(loc_idx) = CRI_Ptr_8;
09346 IR_LINE_NUM(loc_idx) = line;
09347 IR_COL_NUM(loc_idx) = col;
09348 IR_FLD_L(loc_idx) = AT_Tbl_Idx;
09349 IR_IDX_L(loc_idx) = argchck_darg_idx;
09350 IR_LINE_NUM_L(loc_idx) = line;
09351 IR_COL_NUM_L(loc_idx) = col;
09352 IL_FLD(list_idx) = IR_Tbl_Idx;
09353 IL_IDX(list_idx) = loc_idx;
09354
09355 gen_sh(Before, Call_Stmt, line, col, FALSE, FALSE, TRUE);
09356 SH_IR_IDX(SH_PREV_IDX(curr_stmt_sh_idx)) = ir_idx;
09357 SH_P2_SKIP_ME(SH_PREV_IDX(curr_stmt_sh_idx)) = TRUE;
09358
09359
09360
09361
09362 NTR_IR_TBL(ir_idx);
09363 IR_OPR(ir_idx) = Label_Opr;
09364 IR_TYPE_IDX(ir_idx) = TYPELESS_DEFAULT_TYPE;
09365 IR_LINE_NUM(ir_idx) = line;
09366 IR_COL_NUM(ir_idx) = col;
09367 IR_FLD_L(ir_idx) = AT_Tbl_Idx;
09368 IR_IDX_L(ir_idx) = label_idx;
09369 IR_COL_NUM_L(ir_idx) = col;
09370 IR_LINE_NUM_L(ir_idx) = line;
09371
09372 AT_DEFINED(label_idx) = TRUE;
09373
09374 gen_sh(Before, Continue_Stmt, line, col, FALSE, FALSE, TRUE);
09375 SH_P2_SKIP_ME(SH_PREV_IDX(curr_stmt_sh_idx)) = TRUE;
09376 SH_IR_IDX(SH_PREV_IDX(curr_stmt_sh_idx)) = ir_idx;
09377
09378 curr_stmt_sh_idx = save_curr_stmt_sh_idx;
09379
09380 TRACE (Func_Exit, "insert_argchck_calls", NULL);
09381
09382 return;
09383
09384 }
09385
09386
09387
09388
09389
09390
09391
09392
09393
09394
09395
09396
09397
09398
09399
09400
09401
09402 static void gen_assumed_shape_copy(opnd_type *top_opnd)
09403
09404 {
09405 int addr_asg_idx;
09406 int addr_tmp_idx;
09407 int asg_idx;
09408 int attr_idx;
09409 int br_true_idx;
09410 int cn_idx;
09411 int col;
09412 opnd_type dv_opnd;
09413 int entry_attr_idx;
09414 int entry_list_idx;
09415 expr_arg_type exp_desc;
09416 int i;
09417 int intent;
09418 int ir_idx;
09419 int label_idx1;
09420 int label_idx2;
09421 int label_idx3;
09422 expr_arg_type l_exp_desc;
09423 opnd_type left_opnd;
09424 int line;
09425 int ne_idx;
09426 int new_end_idx;
09427 int new_start_idx;
09428 opnd_type opnd;
09429 int place_holder_sh_idx;
09430 expr_arg_type r_exp_desc;
09431 opnd_type right_opnd;
09432 int save_curr_stmt_sh_idx;
09433 cif_usage_code_type save_xref_state;
09434 int save_sh;
09435 int sh_idx;
09436 int tmp_idx;
09437
09438
09439 TRACE (Func_Entry, "gen_assumed_shape_copy", NULL);
09440
09441 save_curr_stmt_sh_idx = curr_stmt_sh_idx;
09442 attr_idx = OPND_IDX((*top_opnd));
09443 line = OPND_LINE_NUM((*top_opnd));
09444 col = OPND_COL_NUM((*top_opnd));
09445
09446 set_up_which_entry_tmp();
09447
09448
09449
09450 curr_stmt_sh_idx = ntr_sh_tbl();
09451 SH_STMT_TYPE(curr_stmt_sh_idx) = Assignment_Stmt;
09452 SH_GLB_LINE(curr_stmt_sh_idx) = line;
09453 SH_COL_NUM(curr_stmt_sh_idx) = col;
09454
09455 place_holder_sh_idx = curr_stmt_sh_idx;
09456
09457 OPND_FLD(right_opnd) = AT_Tbl_Idx;
09458 OPND_IDX(right_opnd) = attr_idx;
09459 OPND_LINE_NUM(right_opnd) = line;
09460 OPND_COL_NUM(right_opnd) = col;
09461
09462 exp_desc = init_exp_desc;
09463 exp_desc.rank = 0;
09464
09465 save_xref_state = xref_state;
09466 xref_state = CIF_No_Usage_Rec;
09467 expr_semantics(&right_opnd, &exp_desc);
09468 xref_state = save_xref_state;
09469
09470 label_idx1 = gen_internal_lbl(line);
09471 label_idx2 = gen_internal_lbl(line);
09472 label_idx3 = gen_internal_lbl(line);
09473
09474
09475
09476 OPND_FLD(dv_opnd) = AT_Tbl_Idx;
09477 OPND_IDX(dv_opnd) = attr_idx;
09478 OPND_LINE_NUM(dv_opnd) = line;
09479 OPND_COL_NUM(dv_opnd) = col;
09480
09481
09482
09483 NTR_IR_TBL(ir_idx);
09484 IR_OPR(ir_idx) = Dv_Access_A_Contig;
09485 IR_TYPE_IDX(ir_idx) = CG_INTEGER_DEFAULT_TYPE;
09486 IR_LINE_NUM(ir_idx) = line;
09487 IR_COL_NUM(ir_idx) = col;
09488
09489 COPY_OPND(IR_OPND_L(ir_idx), dv_opnd);
09490
09491 NTR_IR_TBL(ne_idx);
09492 IR_OPR(ne_idx) = Ne_Opr;
09493 IR_TYPE_IDX(ne_idx) = LOGICAL_DEFAULT_TYPE;
09494
09495 IR_LINE_NUM(ne_idx) = line;
09496 IR_COL_NUM(ne_idx) = col;
09497
09498 IR_FLD_L(ne_idx) = IR_Tbl_Idx;
09499 IR_IDX_L(ne_idx) = ir_idx;
09500
09501 IR_FLD_R(ne_idx) = CN_Tbl_Idx;
09502 IR_IDX_R(ne_idx) = CN_INTEGER_ONE_IDX;
09503 IR_LINE_NUM_R(ne_idx) = line;
09504 IR_COL_NUM_R(ne_idx) = col;
09505
09506 br_true_idx = gen_ir(IR_Tbl_Idx, ne_idx,
09507 Br_True_Opr, LOGICAL_DEFAULT_TYPE, line, col,
09508 AT_Tbl_Idx, label_idx1);
09509
09510 gen_opnd(&opnd, ne_idx, IR_Tbl_Idx, line, col);
09511 copy_subtree(&opnd, &opnd);
09512 IR_OPR(OPND_IDX(opnd)) = Eq_Opr;
09513
09514 contig_test_ir_idx = OPND_IDX(opnd);
09515
09516
09517
09518 NTR_IR_TBL(ir_idx);
09519 IR_OPR(ir_idx) = Label_Opr;
09520 IR_TYPE_IDX(ir_idx) = TYPELESS_DEFAULT_TYPE;
09521 IR_LINE_NUM(ir_idx) = line;
09522 IR_COL_NUM(ir_idx) = col;
09523 IR_FLD_L(ir_idx) = AT_Tbl_Idx;
09524 IR_IDX_L(ir_idx) = label_idx3;
09525 IR_COL_NUM_L(ir_idx) = col;
09526 IR_LINE_NUM_L(ir_idx) = line;
09527
09528 AT_DEFINED(label_idx3) = TRUE;
09529
09530 gen_sh(After, Continue_Stmt, line, col, FALSE, FALSE, TRUE);
09531 SH_P2_SKIP_ME(curr_stmt_sh_idx) = TRUE;
09532 SH_IR_IDX(curr_stmt_sh_idx) = ir_idx;
09533
09534 ATL_DEF_STMT_IDX(label_idx3) = curr_stmt_sh_idx;
09535
09536 curr_stmt_sh_idx = SH_PREV_IDX(curr_stmt_sh_idx);
09537
09538
09539
09540 intent = Intent_Inout;
09541
09542 if (ATD_INTENT(attr_idx) == Intent_Out) {
09543 intent = Intent_Out;
09544 }
09545 else if (ATD_INTENT(attr_idx) == Intent_In) {
09546 intent = Intent_In;
09547 }
09548
09549 tmp_idx = create_tmp_asg(&right_opnd,
09550 &exp_desc,
09551 &left_opnd,
09552 intent,
09553 FALSE,
09554 FALSE);
09555
09556 addr_tmp_idx = ATD_AUTO_BASE_IDX(tmp_idx);
09557
09558 sh_idx = SH_PREV_IDX(curr_stmt_sh_idx);
09559
09560 while (sh_idx) {
09561
09562 if (IR_OPR(SH_IR_IDX(sh_idx)) == Asg_Opr &&
09563 IR_FLD_R(SH_IR_IDX(sh_idx)) == IR_Tbl_Idx &&
09564 IR_OPR(IR_IDX_R(SH_IR_IDX(sh_idx))) == Alloc_Opr) {
09565
09566 break;
09567 }
09568
09569 sh_idx = SH_PREV_IDX(sh_idx);
09570
09571 # ifdef _DEBUG
09572 if (sh_idx == NULL_IDX) {
09573 PRINTMSG(line, 626, Internal, col,
09574 "Alloc_Opr", "gen_assumed_shape_copy");
09575 }
09576 # endif
09577 }
09578
09579 curr_stmt_sh_idx = sh_idx;
09580
09581
09582
09583 gen_sh(Before, If_Stmt, line, col, FALSE, FALSE, TRUE);
09584 SH_IR_IDX(SH_PREV_IDX(curr_stmt_sh_idx)) = br_true_idx;
09585 SH_P2_SKIP_ME(SH_PREV_IDX(curr_stmt_sh_idx)) = TRUE;
09586
09587 contig_test_ir_idx = NULL_IDX;
09588
09589
09590
09591
09592 if (cmd_line_flags.runtime_conformance) {
09593 get_shape_from_attr(&l_exp_desc,
09594 tmp_idx,
09595 BD_RANK(ATD_ARRAY_IDX(tmp_idx)),
09596 line,
09597 col);
09598 l_exp_desc.rank = BD_RANK(ATD_ARRAY_IDX(tmp_idx));
09599
09600 get_shape_from_attr(&r_exp_desc,
09601 attr_idx,
09602 BD_RANK(ATD_ARRAY_IDX(attr_idx)),
09603 line,
09604 col);
09605 r_exp_desc.rank = BD_RANK(ATD_ARRAY_IDX(attr_idx));
09606
09607 OPND_FLD(opnd) = AT_Tbl_Idx;
09608 OPND_IDX(opnd) = tmp_idx;
09609 OPND_LINE_NUM(opnd) = line;
09610 OPND_COL_NUM(opnd) = col;
09611
09612 gen_runtime_conformance(&opnd,
09613 &l_exp_desc,
09614 &right_opnd,
09615 &r_exp_desc);
09616
09617 }
09618
09619 NTR_IR_TBL(addr_asg_idx);
09620 IR_OPR(addr_asg_idx) = Asg_Opr;
09621 IR_FLD_L(addr_asg_idx) = AT_Tbl_Idx;
09622 IR_IDX_L(addr_asg_idx) = addr_tmp_idx;
09623 IR_TYPE_IDX(addr_asg_idx) = ATD_TYPE_IDX(addr_tmp_idx);
09624
09625 IR_LINE_NUM(addr_asg_idx) = line;
09626 IR_COL_NUM(addr_asg_idx) = col;
09627 IR_LINE_NUM_L(addr_asg_idx) = line;
09628 IR_COL_NUM_L(addr_asg_idx) = col;
09629
09630 NTR_IR_TBL(ir_idx);
09631 IR_OPR(ir_idx) = Dv_Access_Base_Addr;
09632 IR_TYPE_IDX(ir_idx) = SA_INTEGER_DEFAULT_TYPE;
09633 IR_LINE_NUM(ir_idx) = line;
09634 IR_COL_NUM(ir_idx) = col;
09635
09636 COPY_OPND(IR_OPND_L(ir_idx), dv_opnd);
09637
09638 IR_FLD_R(addr_asg_idx) = IR_Tbl_Idx;
09639 IR_IDX_R(addr_asg_idx) = ir_idx;
09640
09641 gen_sh(Before, Assignment_Stmt, line, col, FALSE, FALSE, TRUE);
09642
09643 SH_IR_IDX(SH_PREV_IDX(curr_stmt_sh_idx)) = addr_asg_idx;
09644 SH_P2_SKIP_ME(SH_PREV_IDX(curr_stmt_sh_idx)) = TRUE;
09645
09646
09647
09648 NTR_IR_TBL(ir_idx);
09649 IR_OPR(ir_idx) = Br_Uncond_Opr;
09650 IR_TYPE_IDX(ir_idx) = TYPELESS_DEFAULT_TYPE;
09651 IR_LINE_NUM(ir_idx) = line;
09652 IR_COL_NUM(ir_idx) = col;
09653 IR_FLD_R(ir_idx) = AT_Tbl_Idx;
09654 IR_IDX_R(ir_idx) = label_idx2;
09655 IR_LINE_NUM_R(ir_idx) = line;
09656 IR_COL_NUM_R(ir_idx) = col;
09657
09658 gen_sh(Before, Goto_Stmt, line, col, FALSE, FALSE, TRUE);
09659
09660 SH_IR_IDX(SH_PREV_IDX(curr_stmt_sh_idx)) = ir_idx;
09661 SH_P2_SKIP_ME(SH_PREV_IDX(curr_stmt_sh_idx)) = TRUE;
09662
09663
09664
09665 NTR_IR_TBL(ir_idx);
09666 IR_OPR(ir_idx) = Label_Opr;
09667 IR_TYPE_IDX(ir_idx) = TYPELESS_DEFAULT_TYPE;
09668 IR_LINE_NUM(ir_idx) = line;
09669 IR_COL_NUM(ir_idx) = col;
09670 IR_FLD_L(ir_idx) = AT_Tbl_Idx;
09671 IR_IDX_L(ir_idx) = label_idx1;
09672 IR_COL_NUM_L(ir_idx) = col;
09673 IR_LINE_NUM_L(ir_idx) = line;
09674
09675 AT_DEFINED(label_idx1) = TRUE;
09676
09677 gen_sh(Before, Continue_Stmt, line, col, FALSE, FALSE, TRUE);
09678 SH_P2_SKIP_ME(SH_PREV_IDX(curr_stmt_sh_idx)) = TRUE;
09679 SH_IR_IDX(SH_PREV_IDX(curr_stmt_sh_idx)) = ir_idx;
09680
09681 ATL_DEF_STMT_IDX(label_idx1) = SH_PREV_IDX(curr_stmt_sh_idx);
09682
09683 curr_stmt_sh_idx = place_holder_sh_idx;
09684
09685
09686
09687 NTR_IR_TBL(ir_idx);
09688 IR_OPR(ir_idx) = Label_Opr;
09689 IR_TYPE_IDX(ir_idx) = TYPELESS_DEFAULT_TYPE;
09690 IR_LINE_NUM(ir_idx) = line;
09691 IR_COL_NUM(ir_idx) = col;
09692 IR_FLD_L(ir_idx) = AT_Tbl_Idx;
09693 IR_IDX_L(ir_idx) = label_idx2;
09694 IR_COL_NUM_L(ir_idx) = col;
09695 IR_LINE_NUM_L(ir_idx) = line;
09696
09697 AT_DEFINED(label_idx2) = TRUE;
09698
09699 gen_sh(Before, Continue_Stmt, line, col, FALSE, FALSE, TRUE);
09700 SH_P2_SKIP_ME(SH_PREV_IDX(curr_stmt_sh_idx)) = TRUE;
09701 SH_IR_IDX(SH_PREV_IDX(curr_stmt_sh_idx)) = ir_idx;
09702
09703 ATL_DEF_STMT_IDX(label_idx2) = SH_PREV_IDX(curr_stmt_sh_idx);
09704
09705
09706
09707
09708
09709 NTR_IR_TBL(ir_idx);
09710 IR_OPR(ir_idx) = Dv_Access_A_Contig;
09711 IR_TYPE_IDX(ir_idx) = CG_INTEGER_DEFAULT_TYPE;
09712 IR_LINE_NUM(ir_idx) = line;
09713 IR_COL_NUM(ir_idx) = col;
09714
09715 COPY_OPND(IR_OPND_L(ir_idx), dv_opnd);
09716
09717 NTR_IR_TBL(ne_idx);
09718 IR_OPR(ne_idx) = Eq_Opr;
09719 IR_TYPE_IDX(ne_idx) = LOGICAL_DEFAULT_TYPE;
09720
09721 IR_LINE_NUM(ne_idx) = line;
09722 IR_COL_NUM(ne_idx) = col;
09723
09724 IR_FLD_L(ne_idx) = IR_Tbl_Idx;
09725 IR_IDX_L(ne_idx) = ir_idx;
09726
09727 IR_FLD_R(ne_idx) = CN_Tbl_Idx;
09728 IR_IDX_R(ne_idx) = CN_INTEGER_ONE_IDX;
09729 IR_LINE_NUM_R(ne_idx) = line;
09730 IR_COL_NUM_R(ne_idx) = col;
09731
09732 NTR_IR_TBL(ir_idx);
09733 IR_OPR(ir_idx) = Br_True_Opr;
09734 IR_TYPE_IDX(ir_idx) = LOGICAL_DEFAULT_TYPE;
09735 IR_LINE_NUM(ir_idx) = line;
09736 IR_COL_NUM(ir_idx) = col;
09737 IR_FLD_R(ir_idx) = AT_Tbl_Idx;
09738 IR_IDX_R(ir_idx) = label_idx3;
09739 IR_LINE_NUM_R(ir_idx) = line;
09740 IR_COL_NUM_R(ir_idx) = col;
09741
09742 IR_FLD_L(ir_idx) = IR_Tbl_Idx;
09743 IR_IDX_L(ir_idx) = ne_idx;
09744
09745 gen_sh(After, If_Stmt, line, col, FALSE, FALSE, TRUE);
09746 SH_IR_IDX(curr_stmt_sh_idx) = ir_idx;
09747 SH_P2_SKIP_ME(curr_stmt_sh_idx) = TRUE;
09748
09749 curr_stmt_sh_idx = SH_PREV_IDX(curr_stmt_sh_idx);
09750
09751 ATD_SF_ARG_IDX(attr_idx) = tmp_idx;
09752 ATD_COPY_ASSUMED_SHAPE(attr_idx) = TRUE;
09753
09754 ATD_TMP_IDX(tmp_idx) = attr_idx;
09755 ATD_FLD(tmp_idx) = AT_Tbl_Idx;
09756
09757 ATD_COPY_ASSUMED_SHAPE(tmp_idx) = TRUE;
09758
09759
09760
09761 sh_idx = SH_PREV_IDX(curr_stmt_sh_idx);
09762
09763 while(SH_PREV_IDX(sh_idx)) {
09764 sh_idx = SH_PREV_IDX(sh_idx);
09765 }
09766
09767
09768
09769 if (AT_OPTIONAL(attr_idx)) {
09770 gen_present_ir(attr_idx, sh_idx, SH_PREV_IDX(curr_stmt_sh_idx));
09771
09772 sh_idx = SH_PREV_IDX(curr_stmt_sh_idx);
09773
09774 while(SH_PREV_IDX(sh_idx)) {
09775 sh_idx = SH_PREV_IDX(sh_idx);
09776 }
09777 }
09778
09779 if (shared_bd_idx < 0) {
09780 shared_bd_idx = ATD_ARRAY_IDX(tmp_idx);
09781
09782 if (reassign_XT_temps) {
09783
09784 save_sh = curr_stmt_sh_idx;
09785 curr_stmt_sh_idx = sh_idx;
09786
09787 cn_idx = CN_INTEGER_NEG_ONE_IDX;
09788
09789 for (i = 1; i <= BD_RANK(shared_bd_idx); i++) {
09790 NTR_IR_TBL(asg_idx);
09791 IR_OPR(asg_idx) = Asg_Opr;
09792 IR_TYPE_IDX(asg_idx) = ATD_TYPE_IDX(BD_XT_IDX(shared_bd_idx,i));
09793 IR_LINE_NUM(asg_idx) = line;
09794 IR_COL_NUM(asg_idx) = col;
09795 IR_FLD_L(asg_idx) = AT_Tbl_Idx;
09796 IR_IDX_L(asg_idx) = BD_XT_IDX(shared_bd_idx,i);
09797 IR_LINE_NUM_L(asg_idx) = line;
09798 IR_COL_NUM_L(asg_idx) = col;
09799 IR_FLD_R(asg_idx) = CN_Tbl_Idx;
09800 IR_IDX_R(asg_idx) = cn_idx;
09801 IR_LINE_NUM_R(asg_idx) = line;
09802 IR_COL_NUM_R(asg_idx) = col;
09803
09804 gen_sh(Before, Assignment_Stmt, line, col, FALSE, FALSE, TRUE);
09805 SH_P2_SKIP_ME(SH_PREV_IDX(curr_stmt_sh_idx)) = TRUE;
09806 SH_IR_IDX(SH_PREV_IDX(curr_stmt_sh_idx)) = asg_idx;
09807 }
09808
09809 curr_stmt_sh_idx = save_sh;
09810
09811 sh_idx = SH_PREV_IDX(curr_stmt_sh_idx);
09812
09813 while(SH_PREV_IDX(sh_idx)) {
09814 sh_idx = SH_PREV_IDX(sh_idx);
09815 }
09816 }
09817 }
09818
09819 if (gen_ir_at_this_entry(SCP_ATTR_IDX(curr_scp_idx), attr_idx)) {
09820 SH_PREV_IDX(sh_idx) = SH_PREV_IDX(save_curr_stmt_sh_idx);
09821 SH_NEXT_IDX(SH_PREV_IDX(sh_idx)) = sh_idx;
09822 SH_PREV_IDX(save_curr_stmt_sh_idx) = SH_PREV_IDX(curr_stmt_sh_idx);
09823 SH_NEXT_IDX(SH_PREV_IDX(curr_stmt_sh_idx)) = save_curr_stmt_sh_idx;
09824 }
09825
09826
09827 entry_list_idx = SCP_ENTRY_IDX(curr_scp_idx);
09828
09829 while (entry_list_idx != NULL_IDX) {
09830 entry_attr_idx = AL_ATTR_IDX(entry_list_idx);
09831
09832 if (gen_ir_at_this_entry(entry_attr_idx, attr_idx)) {
09833 copy_entry_exit_sh_list(sh_idx, SH_PREV_IDX(curr_stmt_sh_idx),
09834 &new_start_idx, &new_end_idx);
09835
09836
09837
09838 SH_PREV_IDX(new_start_idx) =
09839 SH_PREV_IDX(ATP_ENTRY_LABEL_SH_IDX(entry_attr_idx));
09840 SH_NEXT_IDX(SH_PREV_IDX(new_start_idx)) = new_start_idx;
09841 SH_NEXT_IDX(new_end_idx) = ATP_ENTRY_LABEL_SH_IDX(entry_attr_idx);
09842 SH_PREV_IDX(ATP_ENTRY_LABEL_SH_IDX(entry_attr_idx)) = new_end_idx;
09843
09844 }
09845
09846 entry_list_idx = AL_NEXT_IDX(entry_list_idx);
09847 }
09848
09849
09850
09851 sh_idx = SH_NEXT_IDX(curr_stmt_sh_idx);
09852
09853 while(SH_NEXT_IDX(sh_idx)) {
09854 sh_idx = SH_NEXT_IDX(sh_idx);
09855 }
09856
09857
09858
09859 if (AT_OPTIONAL(attr_idx)) {
09860 gen_present_ir(attr_idx, SH_NEXT_IDX(curr_stmt_sh_idx), sh_idx);
09861
09862 sh_idx = SH_NEXT_IDX(curr_stmt_sh_idx);
09863
09864 while(SH_NEXT_IDX(sh_idx)) {
09865 sh_idx = SH_NEXT_IDX(sh_idx);
09866 }
09867 }
09868
09869 if (SCP_ENTRY_IDX(curr_scp_idx) != NULL_IDX) {
09870 gen_branch_around_ir(gen_darg_branch_test(attr_idx),
09871 SH_NEXT_IDX(curr_stmt_sh_idx), sh_idx);
09872
09873 sh_idx = SH_NEXT_IDX(curr_stmt_sh_idx);
09874
09875 while(SH_NEXT_IDX(sh_idx)) {
09876 sh_idx = SH_NEXT_IDX(sh_idx);
09877 }
09878 }
09879
09880 if (sh_idx) {
09881 if (SCP_EXIT_IR_SH_IDX(curr_scp_idx) != NULL_IDX) {
09882 SH_NEXT_IDX(sh_idx) = SCP_EXIT_IR_SH_IDX(curr_scp_idx);
09883 SCP_EXIT_IR_SH_IDX(curr_scp_idx) = SH_NEXT_IDX(curr_stmt_sh_idx);
09884 }
09885 else {
09886 SCP_EXIT_IR_SH_IDX(curr_scp_idx) = SH_NEXT_IDX(curr_stmt_sh_idx);
09887 }
09888 }
09889
09890 FREE_SH_NODE(curr_stmt_sh_idx);
09891 curr_stmt_sh_idx = save_curr_stmt_sh_idx;
09892
09893 TRACE (Func_Exit, "gen_assumed_shape_copy", NULL);
09894
09895 return;
09896
09897 }
09898
09899
09900
09901
09902
09903
09904
09905
09906
09907
09908
09909
09910
09911
09912
09913
09914
09915 static int gen_darg_branch_test(int attr_idx)
09916
09917 {
09918 int al_idx;
09919 int col;
09920 int entry_al_idx;
09921 int i;
09922 int ir_idx;
09923 int line;
09924 opnd_type opnd;
09925 int or_idx;
09926 int pgm_idx;
09927 long_type the_constant;
09928
09929 TRACE (Func_Entry, "gen_darg_branch_test", NULL);
09930
09931 the_constant = 1;
09932 pgm_idx = SCP_ATTR_IDX(curr_scp_idx);
09933 line = AT_DEF_LINE(pgm_idx);
09934 col = AT_DEF_COLUMN(pgm_idx);
09935
09936 gen_opnd(&opnd, NULL_IDX, NO_Tbl_Idx, line, col);
09937
09938 al_idx = ATD_NO_ENTRY_LIST(attr_idx);
09939
09940 while (al_idx) {
09941
09942 if (pgm_idx == AL_ATTR_IDX(al_idx)) {
09943
09944
09945 NTR_IR_TBL(ir_idx);
09946 IR_OPR(ir_idx) = Eq_Opr;
09947 IR_TYPE_IDX(ir_idx) = CG_LOGICAL_DEFAULT_TYPE;
09948 IR_LINE_NUM(ir_idx) = line;
09949 IR_COL_NUM(ir_idx) = col;
09950 IR_FLD_L(ir_idx) = AT_Tbl_Idx;
09951 IR_IDX_L(ir_idx) = SCP_WHICH_ENTRY_TMP(curr_scp_idx);
09952 IR_LINE_NUM_L(ir_idx) = line;
09953 IR_COL_NUM_L(ir_idx) = col;
09954
09955 IR_FLD_R(ir_idx) = CN_Tbl_Idx;
09956 IR_IDX_R(ir_idx) = C_INT_TO_CN(CG_INTEGER_DEFAULT_TYPE,
09957 the_constant);
09958 IR_LINE_NUM_R(ir_idx) = line;
09959 IR_COL_NUM_R(ir_idx) = col;
09960
09961 if (OPND_FLD(opnd) == NO_Tbl_Idx) {
09962 OPND_FLD(opnd) = IR_Tbl_Idx;
09963 OPND_IDX(opnd) = ir_idx;
09964 }
09965 else {
09966 NTR_IR_TBL(or_idx);
09967 IR_OPR(or_idx) = Or_Opr;
09968 IR_TYPE_IDX(or_idx) = CG_LOGICAL_DEFAULT_TYPE;
09969 IR_LINE_NUM(or_idx) = line;
09970 IR_COL_NUM(or_idx) = col;
09971
09972 IR_FLD_R(or_idx) = IR_Tbl_Idx;
09973 IR_IDX_R(or_idx) = ir_idx;
09974
09975 COPY_OPND(IR_OPND_L(or_idx), opnd);
09976 OPND_FLD(opnd) = IR_Tbl_Idx;
09977 OPND_IDX(opnd) = or_idx;
09978 }
09979
09980 break;
09981 }
09982 al_idx = AL_NEXT_IDX(al_idx);
09983 }
09984
09985 entry_al_idx = SCP_ENTRY_IDX(curr_scp_idx);
09986
09987 for (i = 0; i < SCP_ALT_ENTRY_CNT(curr_scp_idx); i++) {
09988 the_constant++;
09989 pgm_idx = AL_ATTR_IDX(entry_al_idx);
09990
09991 al_idx = ATD_NO_ENTRY_LIST(attr_idx);
09992
09993 while (al_idx) {
09994 if (pgm_idx == AL_ATTR_IDX(al_idx)) {
09995
09996 NTR_IR_TBL(ir_idx);
09997 IR_OPR(ir_idx) = Eq_Opr;
09998 IR_TYPE_IDX(ir_idx) = CG_LOGICAL_DEFAULT_TYPE;
09999 IR_LINE_NUM(ir_idx) = line;
10000 IR_COL_NUM(ir_idx) = col;
10001 IR_FLD_L(ir_idx) = AT_Tbl_Idx;
10002 IR_IDX_L(ir_idx) = SCP_WHICH_ENTRY_TMP(curr_scp_idx);
10003 IR_LINE_NUM_L(ir_idx) = line;
10004 IR_COL_NUM_L(ir_idx) = col;
10005
10006 IR_FLD_R(ir_idx) = CN_Tbl_Idx;
10007 IR_IDX_R(ir_idx) = C_INT_TO_CN(CG_INTEGER_DEFAULT_TYPE,
10008 the_constant);
10009 IR_LINE_NUM_R(ir_idx) = line;
10010 IR_COL_NUM_R(ir_idx) = col;
10011
10012 if (OPND_FLD(opnd) == NO_Tbl_Idx) {
10013 OPND_FLD(opnd) = IR_Tbl_Idx;
10014 OPND_IDX(opnd) = ir_idx;
10015 }
10016 else {
10017 NTR_IR_TBL(or_idx);
10018 IR_OPR(or_idx) = Or_Opr;
10019 IR_TYPE_IDX(or_idx) = CG_LOGICAL_DEFAULT_TYPE;
10020 IR_LINE_NUM(or_idx) = line;
10021 IR_COL_NUM(or_idx) = col;
10022
10023 IR_FLD_R(or_idx) = IR_Tbl_Idx;
10024 IR_IDX_R(or_idx) = ir_idx;
10025
10026 COPY_OPND(IR_OPND_L(or_idx), opnd);
10027 OPND_FLD(opnd) = IR_Tbl_Idx;
10028 OPND_IDX(opnd) = or_idx;
10029 }
10030
10031 break;
10032 }
10033 al_idx = AL_NEXT_IDX(al_idx);
10034 }
10035
10036 entry_al_idx = AL_NEXT_IDX(entry_al_idx);
10037 }
10038
10039
10040 TRACE (Func_Exit, "gen_darg_branch_test", NULL);
10041
10042 return(OPND_IDX(opnd));
10043
10044 }
10045
10046
10047
10048
10049
10050
10051
10052
10053
10054
10055
10056
10057
10058
10059
10060
10061
10062
10063
10064 static void gen_branch_around_ir(int condition_idx,
10065 int start_sh_idx,
10066 int end_sh_idx)
10067 {
10068 int br_around_opt;
10069 int br_idx;
10070 int col;
10071 int cont_idx;
10072 int line;
10073 int save_sh_idx;
10074
10075
10076 TRACE (Func_Entry, "gen_branch_around_ir", NULL);
10077
10078 save_sh_idx = curr_stmt_sh_idx;
10079 curr_stmt_sh_idx = start_sh_idx;
10080 line = SH_GLB_LINE(start_sh_idx);
10081 col = SH_COL_NUM(start_sh_idx);
10082
10083 gen_sh(Before,
10084 Goto_Stmt,
10085 line,
10086 col,
10087 FALSE,
10088 FALSE,
10089 TRUE);
10090
10091 SH_P2_SKIP_ME(SH_PREV_IDX(start_sh_idx)) = TRUE;
10092
10093 br_around_opt = gen_internal_lbl(line);
10094
10095 NTR_IR_TBL(br_idx);
10096
10097 IR_OPR(br_idx) = Br_True_Opr;
10098 IR_TYPE_IDX(br_idx) = LOGICAL_DEFAULT_TYPE;
10099
10100 SH_IR_IDX(SH_PREV_IDX(start_sh_idx)) = br_idx;
10101 IR_LINE_NUM(br_idx) = line;
10102 IR_COL_NUM(br_idx) = col;
10103
10104 IR_FLD_R(br_idx) = AT_Tbl_Idx;
10105 IR_IDX_R(br_idx) = br_around_opt;
10106 IR_COL_NUM_R(br_idx) = col;
10107 IR_LINE_NUM_R(br_idx) = line;
10108
10109 IR_FLD_L(br_idx) = IR_Tbl_Idx;
10110 IR_IDX_L(br_idx) = condition_idx;
10111
10112 NTR_IR_TBL(cont_idx);
10113 IR_OPR(cont_idx) = Label_Opr;
10114 IR_TYPE_IDX(cont_idx) = TYPELESS_DEFAULT_TYPE;
10115 IR_LINE_NUM(cont_idx) = line;
10116 IR_COL_NUM(cont_idx) = col;
10117 IR_IDX_L(cont_idx) = br_around_opt;
10118 IR_FLD_L(cont_idx) = AT_Tbl_Idx;
10119 IR_LINE_NUM_L(cont_idx) = line;
10120 IR_COL_NUM_L(cont_idx) = col;
10121 curr_stmt_sh_idx = end_sh_idx;
10122
10123 gen_sh(After,
10124 Continue_Stmt,
10125 line,
10126 col,
10127 FALSE,
10128 TRUE,
10129 TRUE);
10130
10131 SH_P2_SKIP_ME(curr_stmt_sh_idx) = TRUE;
10132 SH_IR_IDX(curr_stmt_sh_idx) = cont_idx;
10133 curr_stmt_sh_idx = save_sh_idx;
10134
10135 TRACE (Func_Exit, "gen_branch_around_ir", NULL);
10136
10137 return;
10138
10139 }
10140
10141
10142
10143
10144
10145
10146
10147
10148
10149
10150
10151
10152
10153
10154
10155
10156
10157
10158
10159
10160
10161 static boolean must_reassign_XT_temp(opnd_type *top_opnd)
10162
10163 {
10164 boolean all_optional = TRUE;
10165 int list_idx;
10166
10167 TRACE (Func_Entry, "must_reassign_XT_temp", NULL);
10168
10169 list_idx = OPND_IDX((*top_opnd));
10170
10171 if (! AT_OPTIONAL(IL_IDX(list_idx))) {
10172 all_optional = FALSE;
10173 }
10174 else {
10175 while (list_idx) {
10176 if (! AT_OPTIONAL(IL_IDX(list_idx))) {
10177 all_optional = FALSE;
10178 break;
10179 }
10180
10181 list_idx = IL_NEXT_LIST_IDX(list_idx);
10182 }
10183
10184 if (! all_optional) {
10185
10186
10187 if (IL_PREV_LIST_IDX(list_idx) != NULL_IDX) {
10188 IL_NEXT_LIST_IDX(IL_PREV_LIST_IDX(list_idx)) =
10189 IL_NEXT_LIST_IDX(list_idx);
10190 }
10191
10192 if (IL_NEXT_LIST_IDX(list_idx) != NULL_IDX) {
10193 IL_PREV_LIST_IDX(IL_NEXT_LIST_IDX(list_idx)) =
10194 IL_PREV_LIST_IDX(list_idx);
10195 }
10196
10197 IL_NEXT_LIST_IDX(list_idx) = OPND_IDX((*top_opnd));
10198 if (OPND_IDX((*top_opnd)) != NULL_IDX) {
10199 IL_PREV_LIST_IDX(OPND_IDX((*top_opnd))) = list_idx;
10200 }
10201
10202 OPND_IDX((*top_opnd)) = list_idx;
10203
10204 }
10205 }
10206
10207 TRACE (Func_Exit, "must_reassign_XT_temp", NULL);
10208
10209 return(all_optional);
10210
10211 }
10212
10213
10214
10215
10216
10217
10218
10219
10220
10221
10222
10223
10224
10225
10226
10227 static int gen_auto_length(int attr_idx,
10228 opnd_type *len_opnd)
10229
10230 {
10231 int bd_idx;
10232 int column;
10233 expr_arg_type expr_desc;
10234 int len_idx;
10235 int line;
10236
10237 opnd_type opnd1;
10238 opnd_type opnd2;
10239 int result_type_idx;
10240 int type_idx;
10241 int type1_idx;
10242 int type2_idx;
10243
10244 # if !defined(_TARGET_WORD_ADDRESS)
10245 int mult_idx;
10246 long word_byte_size;
10247 # endif
10248
10249
10250 TRACE (Func_Entry, "gen_auto_length", NULL);
10251
10252 bd_idx = ATD_ARRAY_IDX(attr_idx);
10253 type_idx = ATD_TYPE_IDX(attr_idx);
10254 line = AT_DEF_LINE(attr_idx);
10255 column = AT_DEF_COLUMN(attr_idx);
10256
10257 if (TYP_TYPE(type_idx) == Character ||
10258 (TYP_TYPE(type_idx) == Structure && ATT_CHAR_SEQ(TYP_IDX(type_idx)) ) ) {
10259
10260
10261
10262
10263
10264
10265
10266
10267
10268
10269
10270
10271
10272
10273
10274
10275 OPND_LINE_NUM((*len_opnd))= line;
10276 OPND_COL_NUM((*len_opnd)) = column;
10277
10278 if (TYP_TYPE(type_idx) == Structure) {
10279 OPND_FLD(opnd1) = BD_LEN_FLD(bd_idx);
10280 OPND_IDX(opnd1) = BD_LEN_IDX(bd_idx);
10281 OPND_LINE_NUM(opnd1) = line;
10282 OPND_COL_NUM(opnd1) = column;
10283
10284 type1_idx = check_type_for_size_address(&opnd1);
10285
10286 OPND_FLD(opnd2) = BD_SM_FLD(bd_idx,1);
10287 OPND_IDX(opnd2) = BD_SM_IDX(bd_idx,1);
10288 OPND_LINE_NUM(opnd2) = line;
10289 OPND_COL_NUM(opnd2) = column;
10290
10291 type2_idx = check_type_for_size_address(&opnd2);
10292
10293 result_type_idx = TYP_LINEAR(type1_idx) > TYP_LINEAR(type2_idx)?
10294 type1_idx : type2_idx;
10295
10296
10297
10298
10299
10300
10301 NTR_IR_TBL(len_idx);
10302 IR_OPR(len_idx) = Mult_Opr;
10303 IR_TYPE_IDX(len_idx) = result_type_idx;
10304 IR_LINE_NUM(len_idx) = line;
10305 IR_COL_NUM(len_idx) = column;
10306 COPY_OPND(IR_OPND_L(len_idx), opnd2);
10307 COPY_OPND(IR_OPND_R(len_idx), opnd1);
10308
10309 OPND_FLD((*len_opnd)) = IR_Tbl_Idx;
10310 OPND_IDX((*len_opnd)) = len_idx;
10311 }
10312 else if (bd_idx == NULL_IDX) {
10313 OPND_FLD((*len_opnd)) = AT_Tbl_Idx;
10314 OPND_IDX((*len_opnd)) = TYP_IDX(type_idx);
10315 result_type_idx = check_type_for_size_address(&(*len_opnd));
10316 }
10317 else {
10318 OPND_FLD(opnd1) = BD_LEN_FLD(bd_idx);
10319 OPND_IDX(opnd1) = BD_LEN_IDX(bd_idx);
10320 OPND_LINE_NUM(opnd1) = line;
10321 OPND_COL_NUM(opnd1) = column;
10322
10323 type1_idx = check_type_for_size_address(&opnd1);
10324
10325 OPND_FLD(opnd2) = TYP_FLD(type_idx);
10326 OPND_IDX(opnd2) = TYP_IDX(type_idx);
10327 OPND_LINE_NUM(opnd2) = line;
10328 OPND_COL_NUM(opnd2) = column;
10329
10330 type2_idx = check_type_for_size_address(&opnd2);
10331
10332 result_type_idx = TYP_LINEAR(type1_idx) > TYP_LINEAR(type2_idx)?
10333 type1_idx : type2_idx;
10334 NTR_IR_TBL(len_idx);
10335 IR_OPR(len_idx) = Mult_Opr;
10336 IR_TYPE_IDX(len_idx) = result_type_idx;
10337 IR_LINE_NUM(len_idx) = line;
10338 IR_COL_NUM(len_idx) = column;
10339
10340 COPY_OPND(IR_OPND_L(len_idx), opnd2);
10341 COPY_OPND(IR_OPND_R(len_idx), opnd1);
10342
10343 OPND_FLD((*len_opnd)) = IR_Tbl_Idx;
10344 OPND_IDX((*len_opnd)) = len_idx;
10345 }
10346
10347 # ifdef _TARGET_WORD_ADDRESS
10348
10349
10350
10351
10352
10353
10354
10355 gen_word_align_byte_length_ir(len_opnd);
10356
10357 # endif
10358
10359 }
10360 else {
10361 OPND_FLD(opnd1) = BD_LEN_FLD(bd_idx);
10362 OPND_IDX(opnd1) = BD_LEN_IDX(bd_idx);
10363 OPND_LINE_NUM(opnd1) = line;
10364 OPND_COL_NUM(opnd1) = column;
10365
10366 type1_idx = check_type_for_size_address(&opnd1);
10367
10368 OPND_FLD(opnd2) = BD_SM_FLD(bd_idx,1);
10369 OPND_IDX(opnd2) = BD_SM_IDX(bd_idx,1);
10370 OPND_LINE_NUM(opnd2) = line;
10371 OPND_COL_NUM(opnd2) = column;
10372
10373 type2_idx = check_type_for_size_address(&opnd2);
10374
10375 result_type_idx = TYP_LINEAR(type1_idx) > TYP_LINEAR(type2_idx)?
10376 type1_idx : type2_idx;
10377
10378
10379
10380 NTR_IR_TBL(len_idx);
10381 IR_OPR(len_idx) = Mult_Opr;
10382 IR_TYPE_IDX(len_idx) = result_type_idx;
10383 IR_LINE_NUM(len_idx) = line;
10384 IR_COL_NUM(len_idx) = column;
10385
10386 COPY_OPND(IR_OPND_L(len_idx), opnd2);
10387 COPY_OPND(IR_OPND_R(len_idx), opnd1);
10388
10389 # ifdef _TARGET_WORD_ADDRESS
10390
10391
10392
10393 OPND_FLD((*len_opnd)) = IR_Tbl_Idx;
10394 OPND_IDX((*len_opnd)) = len_idx;
10395 # else
10396
10397
10398
10399 NTR_IR_TBL(mult_idx);
10400 IR_OPR(mult_idx) = Mult_Opr;
10401 IR_TYPE_IDX(mult_idx) = result_type_idx;
10402 IR_LINE_NUM(mult_idx) = line;
10403 IR_COL_NUM(mult_idx) = column;
10404 IR_LINE_NUM_L(mult_idx) = line;
10405 IR_COL_NUM_L(mult_idx) = column;
10406
10407 IR_FLD_L(mult_idx) = CN_Tbl_Idx;
10408
10409 #if defined(_TARGET_PACK_HALF_WORD_TYPES)
10410
10411
10412
10413
10414 if (TARGET_MAX_HALF_WORD_STORAGE_TYPE(type_idx)) {
10415 word_byte_size = TARGET_BYTES_PER_WORD / 2;
10416 }
10417 else {
10418 word_byte_size = TARGET_BYTES_PER_WORD;
10419 }
10420 # else
10421 word_byte_size = TARGET_BYTES_PER_WORD;
10422 # endif
10423
10424 IR_IDX_L(mult_idx) = C_INT_TO_CN(CG_INTEGER_DEFAULT_TYPE,
10425 word_byte_size);
10426
10427 IR_LINE_NUM_R(mult_idx) = line;
10428 IR_COL_NUM_R(mult_idx) = column;
10429 IR_FLD_R(mult_idx) = IR_Tbl_Idx;
10430 IR_IDX_R(mult_idx) = len_idx;
10431
10432 OPND_FLD((*len_opnd)) = IR_Tbl_Idx;
10433 OPND_IDX((*len_opnd)) = mult_idx;
10434
10435 # endif
10436
10437 }
10438
10439 expr_desc.rank = 0;
10440 xref_state = CIF_No_Usage_Rec;
10441
10442 if (!expr_semantics(&(*len_opnd), &expr_desc)) {
10443
10444 # if defined(_CHECK_MAX_MEMORY)
10445
10446 if (!target_t3e) {
10447 AT_DCL_ERR(attr_idx) = TRUE;
10448 }
10449 # endif
10450 }
10451
10452 TRACE (Func_Exit, "gen_auto_length", NULL);
10453
10454 return(result_type_idx);
10455
10456 }
10457
10458
10459
10460
10461
10462
10463
10464
10465
10466
10467
10468
10469
10470
10471
10472
10473
10474
10475
10476
10477
10478
10479
10480 static void gen_single_automatic_allocate(int attr_idx)
10481 {
10482 int alloc_idx;
10483 int base_ir_idx;
10484 int base_tmp_idx;
10485 int base_tmp_type_idx;
10486 int column;
10487 int dealloc_idx;
10488 int line;
10489 opnd_type opnd;
10490 int save_next_sh_idx;
10491 int sh_idx;
10492 int start_sh_idx;
10493
10494 # if defined(_HEAP_REQUEST_IN_WORDS) && defined(_TARGET_BYTE_ADDRESS)
10495 expr_arg_type expr_desc;
10496 # endif
10497
10498
10499 TRACE (Func_Entry, "gen_single_automatic_allocate", NULL);
10500
10501 save_next_sh_idx = SH_NEXT_IDX(curr_stmt_sh_idx);
10502 start_sh_idx = curr_stmt_sh_idx;
10503
10504 base_tmp_type_idx = gen_auto_length(attr_idx, &opnd);
10505
10506
10507
10508 if (ATD_CLASS(attr_idx) == CRI__Pointee) {
10509 goto EXIT;
10510 }
10511
10512 line = AT_DEF_LINE(attr_idx);
10513 column = AT_DEF_COLUMN(attr_idx);
10514
10515 # if (defined(_TARGET_OS_IRIX) || defined(_TARGET_OS_LINUX) || defined(_TARGET_OS_DARWIN))
10516 if (TYP_TYPE(ATD_TYPE_IDX(attr_idx)) == Character ||
10517 (TYP_TYPE(ATD_TYPE_IDX(attr_idx)) == Structure &&
10518 ATT_CHAR_SEQ(TYP_IDX(ATD_TYPE_IDX(attr_idx))))) {
10519 base_tmp_type_idx = CRI_Ch_Ptr_8;
10520 }
10521 else {
10522 base_tmp_type_idx = CRI_Ptr_8;
10523 }
10524 # endif
10525
10526 NTR_IR_TBL(alloc_idx);
10527 IR_TYPE_IDX(alloc_idx) = TYPELESS_DEFAULT_TYPE;
10528 IR_LINE_NUM(alloc_idx) = line;
10529 IR_COL_NUM(alloc_idx) = column;
10530 COPY_OPND(IR_OPND_L(alloc_idx), opnd);
10531
10532 NTR_IR_TBL(dealloc_idx);
10533 IR_TYPE_IDX(dealloc_idx) = TYPELESS_DEFAULT_TYPE;
10534 IR_LINE_NUM(dealloc_idx) = line;
10535 IR_COL_NUM(dealloc_idx) = column;
10536
10537 if (ATD_AUXILIARY(attr_idx)) {
10538 IR_OPR(alloc_idx) = SSD_Alloc_Opr;
10539 IR_OPR(dealloc_idx) = SSD_Dealloc_Opr;
10540 }
10541 else if (ATD_SYMMETRIC(attr_idx)) {
10542 IR_OPR(alloc_idx) = Symmetric_Alloc_Opr;
10543 IR_OPR(dealloc_idx) = Symmetric_Dealloc_Opr;
10544 }
10545 else {
10546 IR_OPR(alloc_idx) = Alloc_Opr;
10547 IR_OPR(dealloc_idx) = Dealloc_Opr;
10548 }
10549
10550 GEN_COMPILER_TMP_ASG(base_ir_idx,
10551 base_tmp_idx,
10552 TRUE,
10553 stmt_start_line,
10554 stmt_start_col,
10555 base_tmp_type_idx,
10556 Priv);
10557
10558 AT_SEMANTICS_DONE(base_tmp_idx) = TRUE;
10559
10560 ATD_STOR_BLK_IDX(base_tmp_idx) = SCP_SB_STACK_IDX(curr_scp_idx);
10561 ATD_AUTO_BASE_IDX(attr_idx) = base_tmp_idx;
10562
10563 IR_FLD_R(base_ir_idx) = IR_Tbl_Idx;
10564 IR_IDX_R(base_ir_idx) = alloc_idx;
10565 IR_LINE_NUM_R(base_ir_idx) = line;
10566 IR_COL_NUM_R(base_ir_idx) = column;
10567
10568
10569
10570
10571
10572
10573
10574
10575 # if defined(_HEAP_REQUEST_IN_WORDS) && defined(_TARGET_BYTE_ADDRESS)
10576
10577 COPY_OPND(opnd, IR_OPND_L(alloc_idx));
10578 gen_word_align_byte_length_ir(&opnd);
10579
10580 expr_desc.rank = 0;
10581 xref_state = CIF_No_Usage_Rec;
10582
10583 expr_semantics(&opnd, &expr_desc);
10584
10585 COPY_OPND(IR_OPND_L(alloc_idx), opnd);
10586 # endif
10587
10588 sh_idx = curr_stmt_sh_idx;
10589
10590 gen_sh(After,
10591 Automatic_Base_Calc_Stmt,
10592 AT_DEF_LINE(base_tmp_idx),
10593 AT_DEF_COLUMN(base_tmp_idx),
10594 FALSE,
10595 FALSE,
10596 TRUE);
10597
10598 SH_IR_IDX(curr_stmt_sh_idx) = base_ir_idx;
10599 SH_P2_SKIP_ME(curr_stmt_sh_idx) = TRUE;
10600
10601 if (SCP_ENTRY_IDX(curr_scp_idx) != NULL_IDX) {
10602
10603 if (save_next_sh_idx != NULL_IDX) {
10604 sh_idx = SH_PREV_IDX(save_next_sh_idx);
10605 }
10606 else {
10607
10608 sh_idx = curr_stmt_sh_idx;
10609
10610 while (SH_NEXT_IDX(sh_idx) != NULL_IDX) {
10611 sh_idx = SH_NEXT_IDX(sh_idx);
10612 }
10613 }
10614
10615 insert_sh_after_entries(attr_idx,
10616 start_sh_idx,
10617 sh_idx,
10618 FALSE,
10619 TRUE);
10620 }
10621
10622
10623
10624 IR_FLD_L(dealloc_idx) = AT_Tbl_Idx;
10625 IR_IDX_L(dealloc_idx) = base_tmp_idx;
10626 IR_LINE_NUM_L(dealloc_idx) = line;
10627 IR_COL_NUM_L(dealloc_idx) = column;
10628
10629 sh_idx = ntr_sh_tbl();
10630 SH_COMPILER_GEN(sh_idx) = TRUE;
10631 SH_P2_SKIP_ME(sh_idx) = TRUE;
10632 SH_GLB_LINE(sh_idx) = stmt_start_line;
10633 SH_COL_NUM(sh_idx) = stmt_start_col;
10634 SH_IR_IDX(sh_idx) = dealloc_idx;
10635
10636 if (SCP_EXIT_IR_SH_IDX(curr_scp_idx) != NULL_IDX) {
10637 SH_NEXT_IDX(sh_idx) = SCP_EXIT_IR_SH_IDX(curr_scp_idx);
10638 SH_PREV_IDX(SCP_EXIT_IR_SH_IDX(curr_scp_idx)) = sh_idx;
10639 }
10640
10641 SCP_EXIT_IR_SH_IDX(curr_scp_idx) = sh_idx;
10642
10643 EXIT:
10644
10645 TRACE (Func_Exit, "gen_single_automatic_allocate", NULL);
10646
10647 return;
10648
10649 }
10650
10651
10652
10653
10654
10655
10656
10657
10658
10659
10660
10661
10662
10663
10664
10665
10666
10667
10668
10669
10670
10671
10672
10673 # if !defined(_SINGLE_ALLOCS_FOR_AUTOMATIC)
10674 static void gen_multiple_automatic_allocate(int attr_idx)
10675 {
10676
10677 boolean adjust = FALSE;
10678 int al_idx;
10679 int alloc_idx;
10680 static int auto_aux_base_ir_idx = NULL_IDX;
10681 static int auto_aux_base_len_idx = NULL_IDX;
10682 static int auto_aux_base_tmp_idx = NULL_IDX;
10683 static boolean auto_aux_base_word_align= FALSE;
10684 static int auto_base_ir_idx = NULL_IDX;
10685 static int auto_base_len_idx = NULL_IDX;
10686 static int auto_base_list_end = NULL_IDX;
10687 static int auto_base_list_start = NULL_IDX;
10688 static int auto_base_tmp_idx = NULL_IDX;
10689 static boolean auto_base_word_align = FALSE;
10690 static int auto_sym_base_ir_idx = NULL_IDX;
10691 static int auto_sym_base_len_idx = NULL_IDX;
10692 static int auto_sym_base_tmp_idx = NULL_IDX;
10693 static boolean auto_sym_base_word_align= FALSE;
10694 int base_ir_idx;
10695 fld_type base_len_fld;
10696 int base_len_idx;
10697 int base_tmp_idx;
10698 boolean base_word_align;
10699 int column;
10700 int div_idx;
10701 # if defined(_HEAP_REQUEST_IN_WORDS) && defined(_TARGET_BYTE_ADDRESS)
10702 expr_arg_type expr_desc;
10703 # endif
10704 int ir_idx;
10705 int len_ir_idx;
10706 int line;
10707 int mult_idx;
10708 int new_len_idx;
10709 int new_base_attr_idx;
10710 int new_base_ir_idx;
10711 opnd_type opnd;
10712 operator_type opr;
10713 int plus_idx;
10714 int result_type_idx;
10715 int save_next_sh_idx;
10716 int sh_idx;
10717 int start_sh_idx;
10718 int type_idx;
10719 int tmp_ir_idx;
10720 long word_byte_size = TARGET_BYTES_PER_WORD;
10721 int word_byte_size_idx;
10722
10723
10724 TRACE (Func_Entry, "gen_multiple_automatic_allocate", NULL);
10725
10726 if (attr_idx == NULL_IDX) {
10727 goto FINISH;
10728 }
10729
10730 save_next_sh_idx = SH_NEXT_IDX(curr_stmt_sh_idx);
10731 start_sh_idx = curr_stmt_sh_idx;
10732 line = AT_DEF_LINE(attr_idx);
10733 column = AT_DEF_COLUMN(attr_idx);
10734 type_idx = ATD_TYPE_IDX(attr_idx);
10735
10736 result_type_idx = gen_auto_length(attr_idx, &opnd);
10737
10738
10739
10740 if (ATD_CLASS(attr_idx) == CRI__Pointee) {
10741 goto EXIT;
10742 }
10743
10744 if (ATD_AUXILIARY(attr_idx)) {
10745 base_tmp_idx = auto_aux_base_tmp_idx;
10746 base_len_idx = auto_aux_base_len_idx;
10747 base_ir_idx = auto_aux_base_ir_idx;
10748 base_word_align = auto_aux_base_word_align;
10749 opr = SSD_Alloc_Opr;
10750 }
10751 else if (ATD_SYMMETRIC(attr_idx)) {
10752 base_tmp_idx = auto_sym_base_tmp_idx;
10753 base_len_idx = auto_sym_base_len_idx;
10754 base_ir_idx = auto_sym_base_ir_idx;
10755 base_word_align = auto_sym_base_word_align;
10756 opr = Symmetric_Alloc_Opr;
10757 }
10758 else {
10759 base_tmp_idx = auto_base_tmp_idx;
10760 base_len_idx = auto_base_len_idx;
10761 base_ir_idx = auto_base_ir_idx;
10762 base_word_align = auto_base_word_align;
10763 opr = Alloc_Opr;
10764 }
10765
10766
10767
10768
10769
10770
10771
10772
10773
10774
10775 if (base_tmp_idx == NULL_IDX) {
10776
10777
10778
10779
10780 base_len_fld = CN_Tbl_Idx;
10781 base_len_idx = CN_INTEGER_ZERO_IDX;
10782
10783 GEN_COMPILER_TMP_ASG(base_ir_idx,
10784 base_tmp_idx,
10785 TRUE,
10786 stmt_start_line,
10787 stmt_start_col,
10788 CG_INTEGER_DEFAULT_TYPE,
10789 Priv);
10790
10791 AT_SEMANTICS_DONE(base_tmp_idx) = TRUE;
10792 ATD_STOR_BLK_IDX(base_tmp_idx) = SCP_SB_STACK_IDX(curr_scp_idx);
10793
10794 NTR_IR_TBL(alloc_idx);
10795 IR_OPR(alloc_idx) = opr;
10796 IR_TYPE_IDX(alloc_idx) = TYPELESS_DEFAULT_TYPE;
10797 IR_LINE_NUM(alloc_idx) = line;
10798 IR_COL_NUM(alloc_idx) = column;
10799 IR_LINE_NUM_L(alloc_idx) = line;
10800 IR_COL_NUM_L(alloc_idx) = column;
10801 IR_LINE_NUM_R(alloc_idx) = line;
10802 IR_COL_NUM_R(alloc_idx) = column;
10803
10804
10805
10806
10807
10808 IR_FLD_R(base_ir_idx) = IR_Tbl_Idx;
10809 IR_IDX_R(base_ir_idx) = alloc_idx;
10810 IR_LINE_NUM_R(base_ir_idx)= line;
10811 IR_COL_NUM_R(base_ir_idx) = column;
10812 base_ir_idx = alloc_idx;
10813
10814 NTR_ATTR_LIST_TBL(al_idx);
10815 AL_ATTR_IDX(al_idx) = base_tmp_idx;
10816
10817 if (auto_base_list_start == NULL_IDX) {
10818 auto_base_list_start = al_idx;
10819 auto_base_list_end = al_idx;
10820 }
10821 else {
10822 AL_NEXT_IDX(auto_base_list_end) = al_idx;
10823 auto_base_list_end = al_idx;
10824 }
10825
10826
10827
10828 NTR_IR_TBL(ir_idx);
10829
10830 if (ATD_AUXILIARY(attr_idx)) {
10831 IR_OPR(ir_idx) = SSD_Dealloc_Opr;
10832 }
10833 else if (ATD_SYMMETRIC(attr_idx)) {
10834 IR_OPR(ir_idx) = Symmetric_Dealloc_Opr;
10835 }
10836 else {
10837 IR_OPR(ir_idx) = Dealloc_Opr;
10838 }
10839 IR_TYPE_IDX(ir_idx) = TYPELESS_DEFAULT_TYPE;
10840 IR_LINE_NUM(ir_idx) = line;
10841 IR_COL_NUM(ir_idx) = column;
10842 IR_FLD_L(ir_idx) = AT_Tbl_Idx;
10843 IR_IDX_L(ir_idx) = base_tmp_idx;
10844 IR_LINE_NUM_L(ir_idx) = line;
10845 IR_COL_NUM_L(ir_idx) = column;
10846 sh_idx = ntr_sh_tbl();
10847 SH_COMPILER_GEN(sh_idx) = TRUE;
10848 SH_P2_SKIP_ME(sh_idx) = TRUE;
10849 SH_GLB_LINE(sh_idx) = stmt_start_line;
10850 SH_COL_NUM(sh_idx) = stmt_start_col;
10851 SH_IR_IDX(sh_idx) = ir_idx;
10852
10853 if (SCP_EXIT_IR_SH_IDX(curr_scp_idx) != NULL_IDX) {
10854 SH_NEXT_IDX(sh_idx) = SCP_EXIT_IR_SH_IDX(curr_scp_idx);
10855 SH_PREV_IDX(SCP_EXIT_IR_SH_IDX(curr_scp_idx)) = sh_idx;
10856 }
10857
10858 SCP_EXIT_IR_SH_IDX(curr_scp_idx) = sh_idx;
10859
10860
10861
10862 # if defined(_TARGET_BYTE_ADDRESS)
10863
10864 if (TYP_TYPE(type_idx) == Character ||
10865 (TYP_TYPE(type_idx) == Structure &&
10866 ATT_CHAR_SEQ(TYP_IDX(type_idx)) ) ) {
10867 base_word_align = FALSE;
10868 }
10869 else {
10870
10871 # if defined(_TARGET_OS_MAX)
10872 base_word_align = !(PACK_HALF_WORD_TEST_CONDITION(type_idx));
10873 # else
10874 base_word_align = TRUE;
10875 # endif
10876 }
10877 # endif
10878 }
10879 else {
10880 base_len_fld = AT_Tbl_Idx;
10881 adjust = FALSE;
10882
10883 # if defined(_TARGET_BYTE_ADDRESS)
10884
10885
10886
10887
10888 if (TYP_TYPE(type_idx) == Character ||
10889 (TYP_TYPE(type_idx) == Structure &&
10890 ATT_CHAR_SEQ(TYP_IDX(type_idx)) ) ) {
10891
10892
10893
10894 base_word_align = FALSE;
10895 }
10896 else {
10897
10898 if (!base_word_align) {
10899 adjust = TRUE;
10900 }
10901
10902 # if defined(_TARGET_OS_MAX)
10903
10904
10905
10906
10907
10908 if (PACK_HALF_WORD_TEST_CONDITION(type_idx)) {
10909 word_byte_size = TARGET_BYTES_PER_WORD / 2;
10910 base_word_align = FALSE;
10911 }
10912 else {
10913 word_byte_size = TARGET_BYTES_PER_WORD;
10914 base_word_align = TRUE;
10915 }
10916 # else
10917 word_byte_size = TARGET_BYTES_PER_WORD;
10918 base_word_align = TRUE;
10919 # endif
10920
10921 }
10922
10923 # endif
10924
10925 # if defined(_TARGET_DOUBLE_ALIGN)
10926
10927
10928
10929
10930 if (DALIGN_TEST_CONDITION(type_idx)) {
10931 word_byte_size = (2 * TARGET_BYTES_PER_WORD);
10932 adjust = TRUE;
10933 base_word_align = TRUE;
10934 }
10935 # endif
10936
10937 if (adjust) {
10938 NTR_IR_TBL(ir_idx);
10939 IR_OPR(ir_idx) = Plus_Opr;
10940 IR_TYPE_IDX(ir_idx) = result_type_idx;
10941 IR_LINE_NUM(ir_idx) = line;
10942 IR_COL_NUM(ir_idx) = column;
10943 IR_LINE_NUM_L(ir_idx) = line;
10944 IR_COL_NUM_L(ir_idx) = column;
10945 IR_LINE_NUM_R(ir_idx) = line;
10946 IR_COL_NUM_R(ir_idx) = column;
10947 IR_FLD_L(ir_idx) = CN_Tbl_Idx;
10948 IR_IDX_L(ir_idx) = C_INT_TO_CN(CG_INTEGER_DEFAULT_TYPE,
10949 (word_byte_size - 1));
10950 IR_FLD_R(ir_idx) = AT_Tbl_Idx;
10951 IR_IDX_R(ir_idx) = base_len_idx;
10952
10953 NTR_IR_TBL(div_idx);
10954 IR_OPR(div_idx) = Div_Opr;
10955 IR_TYPE_IDX(div_idx) = result_type_idx;
10956 IR_LINE_NUM(div_idx) = line;
10957 IR_COL_NUM(div_idx) = column;
10958 IR_LINE_NUM_L(div_idx) = line;
10959 IR_COL_NUM_L(div_idx) = column;
10960 IR_LINE_NUM_R(div_idx) = line;
10961 IR_COL_NUM_R(div_idx) = column;
10962 IR_FLD_R(div_idx) = CN_Tbl_Idx;
10963 word_byte_size_idx = C_INT_TO_CN(CG_INTEGER_DEFAULT_TYPE,
10964 word_byte_size);
10965 IR_IDX_R(div_idx) = word_byte_size_idx;
10966 IR_FLD_L(div_idx) = IR_Tbl_Idx;
10967 IR_IDX_L(div_idx) = ir_idx;
10968
10969 NTR_IR_TBL(mult_idx);
10970 IR_OPR(mult_idx) = Mult_Opr;
10971 IR_TYPE_IDX(mult_idx) = result_type_idx;
10972 IR_LINE_NUM(mult_idx) = line;
10973 IR_COL_NUM(mult_idx) = column;
10974 IR_LINE_NUM_L(mult_idx)= line;
10975 IR_COL_NUM_L(mult_idx) = column;
10976 IR_LINE_NUM_R(mult_idx)= line;
10977 IR_COL_NUM_R(mult_idx) = column;
10978 IR_FLD_R(mult_idx) = CN_Tbl_Idx;
10979 IR_IDX_R(mult_idx) = word_byte_size_idx;
10980 IR_FLD_L(mult_idx) = IR_Tbl_Idx;
10981 IR_IDX_L(mult_idx) = div_idx;
10982
10983 GEN_COMPILER_TMP_ASG(tmp_ir_idx,
10984 base_len_idx,
10985 TRUE,
10986 stmt_start_line,
10987 stmt_start_col,
10988 result_type_idx,
10989 Priv);
10990
10991 IR_FLD_R(tmp_ir_idx) = IR_Tbl_Idx;
10992 IR_IDX_R(tmp_ir_idx) = mult_idx;
10993
10994 gen_sh(After,
10995 Automatic_Base_Size_Stmt,
10996 line,
10997 column,
10998 FALSE,
10999 FALSE,
11000 TRUE);
11001
11002 base_len_fld = AT_Tbl_Idx;
11003 SH_IR_IDX(curr_stmt_sh_idx) = tmp_ir_idx;
11004 SH_P2_SKIP_ME(curr_stmt_sh_idx) = TRUE;
11005 }
11006 }
11007
11008
11009
11010
11011
11012
11013 GEN_COMPILER_TMP_ASG(new_base_ir_idx,
11014 new_base_attr_idx,
11015 TRUE,
11016 line,
11017 column,
11018 result_type_idx,
11019 Priv);
11020
11021 NTR_IR_TBL(plus_idx);
11022
11023 IR_IDX_R(new_base_ir_idx) = plus_idx;
11024 IR_FLD_R(new_base_ir_idx) = IR_Tbl_Idx;
11025 IR_LINE_NUM_R(new_base_ir_idx) = line;
11026 IR_COL_NUM_R(new_base_ir_idx) = column;
11027 ATD_AUTO_BASE_IDX(attr_idx) = new_base_attr_idx;
11028
11029 IR_OPR(plus_idx) = Plus_Opr;
11030 IR_TYPE_IDX(plus_idx) = result_type_idx;
11031 IR_IDX_L(plus_idx) = base_tmp_idx;
11032 IR_FLD_L(plus_idx) = AT_Tbl_Idx;
11033 IR_IDX_R(plus_idx) = base_len_idx;
11034 IR_FLD_R(plus_idx) = base_len_fld;
11035 IR_LINE_NUM(plus_idx) = line;
11036 IR_COL_NUM(plus_idx) = column;
11037 IR_LINE_NUM_L(plus_idx) = line;
11038 IR_COL_NUM_L(plus_idx) = column;
11039 IR_LINE_NUM_R(plus_idx) = line;
11040 IR_COL_NUM_R(plus_idx) = column;
11041
11042 NTR_ATTR_LIST_TBL(al_idx);
11043 AL_ATTR_IDX(al_idx) = new_base_attr_idx;
11044 AL_NEXT_IDX(auto_base_list_end) = al_idx;
11045 auto_base_list_end = al_idx;
11046
11047
11048
11049
11050 NTR_IR_TBL(new_len_idx);
11051 IR_OPR(new_len_idx) = Plus_Opr;
11052 IR_TYPE_IDX(new_len_idx) = result_type_idx;
11053 IR_IDX_L(new_len_idx) = base_len_idx;
11054 IR_FLD_L(new_len_idx) = base_len_fld;
11055 IR_LINE_NUM(new_len_idx) = line;
11056 IR_COL_NUM(new_len_idx) = column;
11057 IR_LINE_NUM_L(new_len_idx) = line;
11058 IR_COL_NUM_L(new_len_idx) = column;
11059 IR_LINE_NUM_R(new_len_idx) = line;
11060 IR_COL_NUM_R(new_len_idx) = column;
11061
11062
11063
11064
11065 COPY_OPND(IR_OPND_R(new_len_idx), opnd);
11066
11067 gen_sh(After,
11068 Automatic_Base_Size_Stmt,
11069 line,
11070 column,
11071 FALSE,
11072 FALSE,
11073 TRUE);
11074
11075 GEN_COMPILER_TMP_ASG(len_ir_idx,
11076 base_len_idx,
11077 TRUE,
11078 line,
11079 column,
11080 result_type_idx,
11081 Priv);
11082
11083 base_len_fld = AT_Tbl_Idx;
11084 SH_IR_IDX(curr_stmt_sh_idx) = len_ir_idx;
11085 SH_P2_SKIP_ME(curr_stmt_sh_idx) = TRUE;
11086 IR_FLD_R(len_ir_idx) = IR_Tbl_Idx;
11087 IR_IDX_R(len_ir_idx) = new_len_idx;
11088 IR_LINE_NUM_R(len_ir_idx) = line;
11089 IR_COL_NUM_R(len_ir_idx) = column;
11090
11091
11092
11093 IR_IDX_L(base_ir_idx) = base_len_idx;
11094 IR_FLD_L(base_ir_idx) = base_len_fld;
11095
11096 if (SCP_ENTRY_IDX(curr_scp_idx) != NULL_IDX) {
11097
11098 if (save_next_sh_idx != NULL_IDX) {
11099 sh_idx = SH_PREV_IDX(save_next_sh_idx);
11100 }
11101 else {
11102
11103 sh_idx = curr_stmt_sh_idx;
11104
11105 while (SH_NEXT_IDX(sh_idx) != NULL_IDX) {
11106 sh_idx = SH_NEXT_IDX(sh_idx);
11107 }
11108 }
11109
11110 insert_sh_after_entries(attr_idx,
11111 start_sh_idx,
11112 sh_idx,
11113 FALSE,
11114 TRUE);
11115 }
11116
11117 if (ATD_AUXILIARY(attr_idx)) {
11118 auto_aux_base_tmp_idx = base_tmp_idx;
11119 auto_aux_base_len_idx = base_len_idx;
11120 auto_aux_base_ir_idx = base_ir_idx;
11121 auto_aux_base_word_align = base_word_align;
11122 }
11123 else if (ATD_SYMMETRIC(attr_idx)) {
11124 auto_sym_base_tmp_idx = base_tmp_idx;
11125 auto_sym_base_len_idx = base_len_idx;
11126 auto_sym_base_ir_idx = base_ir_idx;
11127 auto_sym_base_word_align = base_word_align;
11128 }
11129 else {
11130 auto_base_tmp_idx = base_tmp_idx;
11131 auto_base_len_idx = base_len_idx;
11132 auto_base_ir_idx = base_ir_idx;
11133 auto_base_word_align = base_word_align;
11134 }
11135
11136 FINISH:
11137
11138 if (attr_idx == NULL_IDX) {
11139
11140
11141
11142
11143
11144
11145
11146
11147
11148
11149
11150
11151 # if defined(_HEAP_REQUEST_IN_WORDS) && defined(_TARGET_BYTE_ADDRESS)
11152
11153 if (auto_base_ir_idx != NULL_IDX) {
11154 COPY_OPND(opnd, IR_OPND_L(auto_base_ir_idx));
11155 gen_word_align_byte_length_ir(&opnd);
11156
11157 expr_desc.rank = 0;
11158 xref_state = CIF_No_Usage_Rec;
11159
11160 expr_semantics(&opnd, &expr_desc);
11161
11162 COPY_OPND(IR_OPND_L(auto_base_ir_idx), opnd);
11163 }
11164
11165 if (auto_aux_base_ir_idx != NULL_IDX) {
11166 COPY_OPND(opnd, IR_OPND_L(auto_aux_base_ir_idx));
11167 gen_word_align_byte_length_ir(&opnd);
11168
11169 expr_desc.rank = 0;
11170 xref_state = CIF_No_Usage_Rec;
11171
11172 expr_semantics(&opnd, &expr_desc);
11173
11174 COPY_OPND(IR_OPND_L(auto_aux_base_ir_idx), opnd);
11175 }
11176
11177 if (auto_sym_base_ir_idx != NULL_IDX) {
11178 COPY_OPND(opnd, IR_OPND_L(auto_sym_base_ir_idx));
11179 gen_word_align_byte_length_ir(&opnd);
11180
11181 expr_desc.rank = 0;
11182 xref_state = CIF_No_Usage_Rec;
11183
11184 expr_semantics(&opnd, &expr_desc);
11185
11186 COPY_OPND(IR_OPND_L(auto_sym_base_ir_idx), opnd);
11187 }
11188
11189 # endif
11190
11191 al_idx = auto_base_list_start;
11192 sh_idx = curr_stmt_sh_idx;
11193
11194 while (al_idx != NULL_IDX) {
11195 gen_sh(After,
11196 Automatic_Base_Calc_Stmt,
11197 AT_DEF_LINE(AL_ATTR_IDX(al_idx)),
11198 AT_DEF_COLUMN(AL_ATTR_IDX(al_idx)),
11199 FALSE,
11200 FALSE,
11201 TRUE);
11202
11203 SH_IR_IDX(curr_stmt_sh_idx) = ATD_TMP_IDX(AL_ATTR_IDX(al_idx));
11204 SH_P2_SKIP_ME(curr_stmt_sh_idx)= TRUE;
11205 al_idx = AL_NEXT_IDX(al_idx);
11206 }
11207
11208 if (auto_base_list_start != NULL_IDX &&
11209 SCP_ENTRY_IDX(curr_scp_idx) != NULL_IDX) {
11210 insert_sh_after_entries(auto_base_tmp_idx,
11211 sh_idx,
11212 curr_stmt_sh_idx,
11213 FALSE,
11214 TRUE);
11215 }
11216
11217 auto_base_ir_idx = NULL_IDX;
11218 auto_base_len_idx = NULL_IDX;
11219 auto_base_list_end = NULL_IDX;
11220 auto_base_list_start = NULL_IDX;
11221 auto_base_tmp_idx = NULL_IDX;
11222 auto_base_word_align = TRUE;
11223 auto_aux_base_ir_idx = NULL_IDX;
11224 auto_aux_base_len_idx = NULL_IDX;
11225 auto_aux_base_tmp_idx = NULL_IDX;
11226 auto_aux_base_word_align = TRUE;
11227 auto_sym_base_ir_idx = NULL_IDX;
11228 auto_sym_base_len_idx = NULL_IDX;
11229 auto_sym_base_tmp_idx = NULL_IDX;
11230 auto_sym_base_word_align = TRUE;
11231 }
11232
11233 EXIT:
11234
11235 TRACE (Func_Exit, "gen_multiple_automatic_allocate", NULL);
11236
11237 return;
11238
11239 }
11240 # endif
11241
11242
11243
11244
11245
11246
11247
11248
11249
11250
11251
11252
11253
11254
11255
11256
11257
11258 static void distribution_resolution(int attr_idx)
11259 {
11260 int bd_idx;
11261 int dim;
11262 expr_arg_type expr_desc;
11263 opnd_type opnd;
11264
11265
11266 TRACE (Func_Entry, "distribution_resolution", NULL);
11267
11268 bd_idx = ATD_DISTRIBUTION_IDX(attr_idx);
11269
11270 if (!BD_RESOLVED(bd_idx)) {
11271
11272 for (dim = 1; dim <= BD_RANK(bd_idx); dim++) {
11273
11274 if (BD_CYCLIC_FLD(bd_idx, dim) != NO_Tbl_Idx) {
11275 OPND_FLD(opnd) = BD_CYCLIC_FLD(bd_idx, dim);
11276 OPND_IDX(opnd) = BD_CYCLIC_IDX(bd_idx, dim);
11277 OPND_LINE_NUM(opnd) = BD_LINE_NUM(bd_idx);
11278 OPND_COL_NUM(opnd) = BD_COLUMN_NUM(bd_idx);
11279
11280 expr_desc.rank = 0;
11281 xref_state = CIF_No_Usage_Rec;
11282
11283 expr_semantics(&opnd, &expr_desc);
11284
11285 BD_CYCLIC_FLD(bd_idx, dim) = OPND_FLD(opnd);
11286 BD_CYCLIC_IDX(bd_idx, dim) = OPND_IDX(opnd);
11287 }
11288
11289 if (BD_ONTO_FLD(bd_idx, dim) != NO_Tbl_Idx) {
11290 OPND_FLD(opnd) = BD_ONTO_FLD(bd_idx, dim);
11291 OPND_IDX(opnd) = BD_ONTO_IDX(bd_idx, dim);
11292 OPND_LINE_NUM(opnd) = BD_LINE_NUM(bd_idx);
11293 OPND_COL_NUM(opnd) = BD_COLUMN_NUM(bd_idx);
11294
11295 expr_desc.rank = 0;
11296 xref_state = CIF_No_Usage_Rec;
11297
11298 expr_semantics(&opnd, &expr_desc);
11299
11300 BD_ONTO_FLD(bd_idx, dim) = OPND_FLD(opnd);
11301 BD_ONTO_IDX(bd_idx, dim) = OPND_IDX(opnd);
11302 }
11303 }
11304 }
11305
11306
11307
11308 TRACE (Func_Exit, "distribution_resolution", NULL);
11309
11310 return;
11311
11312 }
11313
11314 #ifdef KEY
11315
11316
11317
11318
11319
11320
11321
11322
11323
11324
11325
11326
11327
11328
11329
11330
11331
11332
11333
11334
11335
11336
11337
11338
11339
11340
11341
11342 static boolean
11343 ignore_intrinsics(int first, int interface_idx, int specific_attr_idx,
11344 interface_type desired_type)
11345 {
11346 if ((!first) || ATP_PROC(specific_attr_idx) == Intrin_Proc) {
11347 return 0;
11348 }
11349 ATI_INTERFACE_CLASS(interface_idx) = desired_type;
11350 AT_IS_INTRIN(interface_idx) = FALSE;
11351 for (int curr_sn_idx = ATI_FIRST_SPECIFIC_IDX(interface_idx);
11352 curr_sn_idx != NULL_IDX; ) {
11353 int next_sn_idx = SN_SIBLING_LINK(curr_sn_idx);
11354 int next_attr_idx = SN_ATTR_IDX(next_sn_idx);
11355
11356 if ((AT_OBJ_CLASS(next_attr_idx) == Pgm_Unit) &&
11357 ATP_PROC(next_attr_idx) == Intrin_Proc) {
11358 SN_SIBLING_LINK(curr_sn_idx) = NULL_IDX;
11359 break;
11360 }
11361
11362 AT_IS_INTRIN(next_attr_idx) = FALSE;
11363 curr_sn_idx = next_sn_idx;
11364 }
11365 return 1;
11366 }
11367 #endif
11368
11369
11370
11371
11372
11373
11374
11375
11376
11377
11378
11379
11380
11381
11382
11383
11384
11385 static void verify_interface(int interface_idx)
11386
11387 {
11388 boolean ambiguous;
11389 int attr_idx;
11390 int correct_num;
11391 int curr_attr_idx;
11392 int curr_darg_idx;
11393 int curr_darg_sn_idx;
11394 int curr_num_dargs;
11395 int curr_sn_idx;
11396 int curr_type_idx;
11397 int darg_idx;
11398 int darg_sn_idx;
11399 boolean found_intrin = FALSE;
11400 int i;
11401 int idx;
11402 int ktr_sn_idx;
11403 int kwd_darg_idx;
11404 int kwd_sn_idx;
11405 int loop_cnt;
11406 int num_dargs;
11407 int optional_sn_idx;
11408 #ifdef KEY
11409 int rank_l = 0;
11410 int rank_r = 0;
11411 #else
11412 int rank_l;
11413 int rank_r;
11414 #endif
11415 boolean same_dargs;
11416 int save_curr_darg_sn_idx;
11417 int save_curr_num_dargs;
11418 int save_darg_sn_idx;
11419 int save_num_dargs;
11420 int sn_idx;
11421 #ifdef KEY
11422 int type_idx_l = 0;
11423 int type_idx_r = 0;
11424 #else
11425 int type_idx_l;
11426 int type_idx_r;
11427 #endif
11428
11429
11430
11431 TRACE (Func_Entry, "verify_interface", NULL);
11432
11433 if (AT_DCL_ERR(interface_idx)) {
11434 goto EXIT;
11435 }
11436
11437 curr_sn_idx = ATI_FIRST_SPECIFIC_IDX(interface_idx);
11438
11439 #ifdef KEY
11440 boolean first = TRUE;
11441 #endif
11442 while (curr_sn_idx != NULL_IDX) {
11443 curr_attr_idx = SN_ATTR_IDX(curr_sn_idx);
11444
11445 if (AT_IS_INTRIN(curr_attr_idx)) {
11446 found_intrin = TRUE;
11447 curr_type_idx = (ATP_PGM_UNIT(curr_attr_idx) != Function) ? NULL_IDX :
11448 ATD_TYPE_IDX(ATP_RSLT_IDX(curr_attr_idx));
11449
11450 if (AT_DCL_ERR(curr_attr_idx)) {
11451 curr_sn_idx = SN_SIBLING_LINK(curr_sn_idx);
11452 continue;
11453 }
11454 }
11455 else {
11456
11457 if (found_intrin) {
11458 PRINTMSG(AT_DEF_LINE(curr_attr_idx), 1534, Internal,
11459 AT_DEF_COLUMN(curr_attr_idx),
11460 AT_OBJ_NAME_PTR(curr_attr_idx));
11461 }
11462
11463 if (ATP_PROC(curr_attr_idx) == Module_Proc &&
11464 ATP_PGM_UNIT(curr_attr_idx) == Pgm_Unknown) {
11465
11466 while (AT_ATTR_LINK(curr_attr_idx) != NULL_IDX) {
11467 curr_attr_idx = AT_ATTR_LINK(curr_attr_idx);
11468 }
11469
11470 if (AT_OBJ_CLASS(curr_attr_idx) == Interface) {
11471 curr_attr_idx = ATI_PROC_IDX(curr_attr_idx);
11472 }
11473
11474 if (curr_attr_idx == NULL_IDX) {
11475
11476 if (!AT_DCL_ERR(SN_ATTR_IDX(curr_sn_idx))) {
11477
11478
11479
11480 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 368, Error,
11481 SN_COLUMN_NUM(curr_sn_idx),
11482 AT_OBJ_NAME_PTR(SN_ATTR_IDX(curr_sn_idx)));
11483 }
11484 curr_attr_idx = SN_ATTR_IDX(curr_sn_idx);
11485 AT_DCL_ERR(curr_attr_idx) = TRUE;
11486 AT_DCL_ERR(interface_idx) = TRUE;
11487 break;
11488 }
11489
11490 if (AT_OBJ_CLASS(curr_attr_idx) != Pgm_Unit ||
11491 ATP_PROC(curr_attr_idx) != Module_Proc ||
11492 ATP_PGM_UNIT(curr_attr_idx) == Pgm_Unknown) {
11493
11494
11495
11496
11497 if (!AT_DCL_ERR(curr_attr_idx) &&
11498 !AT_DCL_ERR(SN_ATTR_IDX(curr_sn_idx))) {
11499 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 368, Error,
11500 SN_COLUMN_NUM(curr_sn_idx),
11501 AT_OBJ_NAME_PTR(curr_attr_idx));
11502 }
11503 curr_attr_idx = SN_ATTR_IDX(curr_sn_idx);
11504 AT_DCL_ERR(curr_attr_idx) = TRUE;
11505 AT_DCL_ERR(interface_idx) = TRUE;
11506 break;
11507 }
11508
11509 SN_ATTR_IDX(curr_sn_idx) = curr_attr_idx;
11510 SN_NAME_IDX(curr_sn_idx) = AT_NAME_IDX(curr_attr_idx);
11511 }
11512
11513 # if 0
11514
11515
11516
11517 if (!ATP_INLINE_ALWAYS(curr_attr_idx) &&
11518 !ATP_INLINE_NEVER(curr_attr_idx)) {
11519
11520
11521
11522
11523 ATP_INLINE_ALWAYS(curr_attr_idx) = ATP_INLINE_ALWAYS(interface_idx);
11524 ATP_INLINE_NEVER(curr_attr_idx) = ATP_INLINE_NEVER(interface_idx);
11525 }
11526 # endif
11527
11528 attr_semantics(curr_attr_idx, FALSE);
11529
11530 curr_type_idx = (ATP_PGM_UNIT(curr_attr_idx) != Function) ? NULL_IDX :
11531 ATD_TYPE_IDX(ATP_RSLT_IDX(curr_attr_idx));
11532
11533 if (AT_DCL_ERR(curr_attr_idx)) {
11534 curr_sn_idx = SN_SIBLING_LINK(curr_sn_idx);
11535 continue;
11536 }
11537
11538 if (ATP_PGM_UNIT(SCP_ATTR_IDX(curr_scp_idx)) == Module &&
11539 !AT_PRIVATE(interface_idx)) {
11540
11541 if (ATP_PGM_UNIT(curr_attr_idx) == Function &&
11542 TYP_TYPE(curr_type_idx) == Structure &&
11543 AT_PRIVATE(TYP_IDX(curr_type_idx)) &&
11544 !AT_USE_ASSOCIATED(TYP_IDX(curr_type_idx))) {
11545
11546
11547
11548
11549 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 686, Error,
11550 SN_COLUMN_NUM(curr_sn_idx),
11551 AT_OBJ_NAME_PTR(interface_idx),
11552 AT_OBJ_NAME_PTR(curr_attr_idx));
11553 AT_DCL_ERR(interface_idx) = TRUE;
11554 }
11555
11556
11557
11558
11559
11560 for (i = (ATP_EXTRA_DARG(curr_attr_idx) ? 1 : 0);
11561 i < ATP_NUM_DARGS(curr_attr_idx); i++) {
11562 darg_idx = SN_ATTR_IDX(ATP_FIRST_IDX(curr_attr_idx) + i);
11563
11564
11565
11566
11567
11568 if (AT_OBJ_CLASS(darg_idx) == Data_Obj &&
11569 TYP_TYPE(ATD_TYPE_IDX(darg_idx)) == Structure &&
11570 AT_PRIVATE(TYP_IDX(ATD_TYPE_IDX(darg_idx))) &&
11571 !AT_USE_ASSOCIATED(TYP_IDX(ATD_TYPE_IDX(darg_idx)))) {
11572 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 687, Error,
11573 SN_COLUMN_NUM(curr_sn_idx),
11574 AT_OBJ_NAME_PTR(interface_idx),
11575 AT_OBJ_NAME_PTR(darg_idx),
11576 AT_OBJ_NAME_PTR(curr_attr_idx));
11577 AT_DCL_ERR(interface_idx) = TRUE;
11578 }
11579 }
11580 }
11581 }
11582
11583
11584
11585 switch (ATI_INTERFACE_CLASS(interface_idx)) {
11586 case Generic_Unknown_Interface:
11587 ATI_INTERFACE_CLASS(interface_idx) =
11588 (ATP_PGM_UNIT(curr_attr_idx) == Function) ?
11589 Generic_Function_Interface:
11590 Generic_Subroutine_Interface;
11591 break;
11592
11593 case Generic_Function_Interface :
11594
11595 if (ATP_PGM_UNIT(curr_attr_idx) == Subroutine &&
11596 !AT_DCL_ERR(interface_idx)) {
11597 #ifdef KEY
11598 if (ignore_intrinsics(first, interface_idx, curr_attr_idx,
11599 Generic_Subroutine_Interface)) {
11600 found_intrin = FALSE;
11601 break;
11602 }
11603 #endif
11604 PRINTMSG(AT_DEF_LINE(interface_idx), 1059, Error,
11605 AT_DEF_COLUMN(interface_idx),
11606 AT_OBJ_NAME_PTR(interface_idx));
11607 AT_DCL_ERR(interface_idx) = TRUE;
11608 }
11609 break;
11610
11611 case Generic_Subroutine_Interface :
11612
11613 if (ATP_PGM_UNIT(curr_attr_idx) == Function &&
11614 !AT_DCL_ERR(interface_idx)) {
11615 #ifdef KEY
11616 if (ignore_intrinsics(first, interface_idx, curr_attr_idx,
11617 Generic_Function_Interface)) {
11618 found_intrin = FALSE;
11619 break;
11620 }
11621 #endif
11622 PRINTMSG(AT_DEF_LINE(interface_idx), 1059, Error,
11623 AT_DEF_COLUMN(interface_idx),
11624 AT_OBJ_NAME_PTR(interface_idx));
11625 AT_DCL_ERR(interface_idx) = TRUE;
11626 }
11627 break;
11628
11629 case Defined_Assign_Interface :
11630
11631
11632
11633 if (ATP_PGM_UNIT(curr_attr_idx) != Subroutine) {
11634 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 475, Error,
11635 SN_COLUMN_NUM(curr_sn_idx),
11636 AT_OBJ_NAME_PTR(curr_attr_idx));
11637 AT_DCL_ERR(interface_idx) = TRUE;
11638 AT_DCL_ERR(curr_attr_idx) = TRUE;
11639 }
11640
11641 correct_num = (ATP_EXTRA_DARG(curr_attr_idx)) ? 3 : 2;
11642
11643 if (ATP_NUM_DARGS(curr_attr_idx) != correct_num) {
11644 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 489, Error,
11645 SN_COLUMN_NUM(curr_sn_idx),
11646 AT_OBJ_NAME_PTR(curr_attr_idx));
11647 AT_DCL_ERR(interface_idx) = TRUE;
11648 AT_DCL_ERR(curr_attr_idx) = TRUE;
11649 }
11650 else {
11651 sn_idx = (ATP_EXTRA_DARG(curr_attr_idx)) ?
11652 (ATP_FIRST_IDX(curr_attr_idx) + 1) :
11653 ATP_FIRST_IDX(curr_attr_idx);
11654 attr_idx = SN_ATTR_IDX(sn_idx);
11655
11656 if (AT_OPTIONAL(attr_idx)) {
11657 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 1071, Error,
11658 SN_COLUMN_NUM(curr_sn_idx),
11659 "ASSIGNMENT",
11660 AT_OBJ_NAME_PTR(interface_idx),
11661 AT_OBJ_NAME_PTR(curr_attr_idx),
11662 AT_OBJ_NAME_PTR(attr_idx));
11663 AT_DCL_ERR(interface_idx) = TRUE;
11664 }
11665
11666 if (AT_OBJ_CLASS(attr_idx) == Data_Obj) {
11667 type_idx_l = ATD_TYPE_IDX(attr_idx);
11668 rank_l = (ATD_ARRAY_IDX(attr_idx) == NULL_IDX) ?
11669 0 : BD_RANK(ATD_ARRAY_IDX(attr_idx));
11670
11671
11672
11673 if (ATD_INTENT(attr_idx) == Intent_In ||
11674 ATD_INTENT(attr_idx) == Intent_Unseen) {
11675
11676 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 1074, Error,
11677 SN_COLUMN_NUM(curr_sn_idx),
11678 AT_OBJ_NAME_PTR(curr_attr_idx),
11679 AT_OBJ_NAME_PTR(attr_idx),
11680 "INOUT");
11681 AT_DCL_ERR(interface_idx) = TRUE;
11682 }
11683 }
11684 # ifdef _DEBUG
11685 else if (AT_OBJ_CLASS(attr_idx) != Pgm_Unit) {
11686 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 884, Internal,
11687 SN_COLUMN_NUM(attr_idx),
11688 AT_OBJ_NAME_PTR(attr_idx),
11689 AT_OBJ_NAME_PTR(curr_attr_idx));
11690 }
11691 # endif
11692 else {
11693 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 1073, Error,
11694 SN_COLUMN_NUM(curr_sn_idx),
11695 AT_OBJ_NAME_PTR(curr_attr_idx),
11696 "ASSIGNMENT",
11697 AT_OBJ_NAME_PTR(interface_idx),
11698 AT_OBJ_NAME_PTR(attr_idx));
11699 AT_DCL_ERR(interface_idx) = TRUE;
11700 }
11701
11702 sn_idx++;
11703 attr_idx = SN_ATTR_IDX(sn_idx);
11704
11705 if (AT_OPTIONAL(attr_idx)) {
11706 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 1071, Error,
11707 SN_COLUMN_NUM(curr_sn_idx),
11708 "ASSIGNMENT",
11709 AT_OBJ_NAME_PTR(interface_idx),
11710 AT_OBJ_NAME_PTR(curr_attr_idx),
11711 AT_OBJ_NAME_PTR(attr_idx));
11712 AT_DCL_ERR(interface_idx) = TRUE;
11713 }
11714
11715 if (AT_OBJ_CLASS(attr_idx) == Data_Obj) {
11716 type_idx_r = ATD_TYPE_IDX(attr_idx);
11717 rank_r = (ATD_ARRAY_IDX(attr_idx) == NULL_IDX) ?
11718 0 : BD_RANK(ATD_ARRAY_IDX(attr_idx));
11719
11720
11721
11722 if (ATD_INTENT(attr_idx) != Intent_In) {
11723 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 1074, Error,
11724 SN_COLUMN_NUM(curr_sn_idx),
11725 AT_OBJ_NAME_PTR(curr_attr_idx),
11726 AT_OBJ_NAME_PTR(attr_idx),
11727 "IN");
11728 AT_DCL_ERR(interface_idx) = TRUE;
11729 }
11730 else if (operation_is_intrinsic((operator_type)
11731 ATI_DEFINED_OPR(interface_idx),
11732 type_idx_l,
11733 rank_l,
11734 type_idx_r,
11735 rank_r)) {
11736
11737 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 495, Error,
11738 SN_COLUMN_NUM(curr_sn_idx),
11739 AT_OBJ_NAME_PTR(curr_attr_idx),
11740 AT_OBJ_NAME_PTR(interface_idx));
11741 AT_DCL_ERR(interface_idx) = TRUE;
11742 }
11743 }
11744 # ifdef _DEBUG
11745 else if (AT_OBJ_CLASS(attr_idx) != Pgm_Unit) {
11746 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 884, Internal,
11747 SN_COLUMN_NUM(curr_sn_idx),
11748 AT_OBJ_NAME_PTR(attr_idx),
11749 AT_OBJ_NAME_PTR(curr_attr_idx));
11750 }
11751 # endif
11752 else {
11753 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 1073, Error,
11754 SN_COLUMN_NUM(curr_sn_idx),
11755 AT_OBJ_NAME_PTR(curr_attr_idx),
11756 "ASSIGNMENT",
11757 AT_OBJ_NAME_PTR(interface_idx),
11758 AT_OBJ_NAME_PTR(attr_idx));
11759 AT_DCL_ERR(interface_idx) = TRUE;
11760 }
11761 }
11762 break;
11763
11764
11765 case Defined_Unary_Interface :
11766
11767 if (ATP_PGM_UNIT(curr_attr_idx) != Function) {
11768 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 492, Error,
11769 SN_COLUMN_NUM(curr_sn_idx),
11770 AT_OBJ_NAME_PTR(curr_attr_idx));
11771 AT_DCL_ERR(interface_idx) = TRUE;
11772 AT_DCL_ERR(curr_attr_idx) = TRUE;
11773 }
11774 else if (TYP_TYPE(curr_type_idx) == Character &&
11775 TYP_CHAR_CLASS(curr_type_idx) == Assumed_Size_Char) {
11776
11777
11778
11779 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 493, Error,
11780 SN_COLUMN_NUM(curr_sn_idx),
11781 AT_OBJ_NAME_PTR(curr_attr_idx));
11782 AT_DCL_ERR(interface_idx) = TRUE;
11783 AT_DCL_ERR(curr_attr_idx) = TRUE;
11784 }
11785
11786 correct_num = (ATP_EXTRA_DARG(curr_attr_idx)) ? 2 : 1;
11787
11788 if (ATP_NUM_DARGS(curr_attr_idx) != correct_num) {
11789 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 494, Error,
11790 SN_COLUMN_NUM(curr_sn_idx),
11791 AT_OBJ_NAME_PTR(curr_attr_idx));
11792 AT_DCL_ERR(interface_idx) = TRUE;
11793 AT_DCL_ERR(curr_attr_idx) = TRUE;
11794 }
11795 else {
11796 sn_idx = (ATP_EXTRA_DARG(curr_attr_idx)) ?
11797 (ATP_FIRST_IDX(curr_attr_idx) + 1) :
11798 ATP_FIRST_IDX(curr_attr_idx);
11799 attr_idx = SN_ATTR_IDX(sn_idx);
11800
11801 if (AT_OPTIONAL(attr_idx)) {
11802 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 1071, Error,
11803 SN_COLUMN_NUM(curr_sn_idx),
11804 "OPERATOR",
11805 AT_OBJ_NAME_PTR(interface_idx),
11806 AT_OBJ_NAME_PTR(curr_attr_idx),
11807 AT_OBJ_NAME_PTR(attr_idx));
11808 AT_DCL_ERR(interface_idx) = TRUE;
11809 }
11810
11811 if (AT_OBJ_CLASS(attr_idx) == Data_Obj) {
11812 type_idx_l = ATD_TYPE_IDX(attr_idx);
11813 rank_l = (ATD_ARRAY_IDX(attr_idx) == NULL_IDX) ?
11814 0 : BD_RANK(ATD_ARRAY_IDX(attr_idx));
11815
11816
11817
11818 if (ATD_INTENT(attr_idx) != Intent_In) {
11819 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 1072, Error,
11820 SN_COLUMN_NUM(curr_sn_idx),
11821 AT_OBJ_NAME_PTR(interface_idx),
11822 AT_OBJ_NAME_PTR(curr_attr_idx),
11823 AT_OBJ_NAME_PTR(attr_idx));
11824
11825 AT_DCL_ERR(interface_idx) = TRUE;
11826 }
11827
11828 type_idx_r = TYPELESS_DEFAULT_TYPE;
11829 rank_r = 0;
11830
11831 if (operation_is_intrinsic((operator_type)
11832 ATI_DEFINED_OPR(interface_idx),
11833 type_idx_l,
11834 rank_l,
11835 type_idx_r,
11836 rank_r)) {
11837
11838 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 495, Error,
11839 SN_COLUMN_NUM(curr_sn_idx),
11840 AT_OBJ_NAME_PTR(curr_attr_idx),
11841 AT_OBJ_NAME_PTR(interface_idx));
11842 AT_DCL_ERR(interface_idx) = TRUE;
11843 }
11844 }
11845 # ifdef _DEBUG
11846 else if (AT_OBJ_CLASS(attr_idx) != Pgm_Unit) {
11847 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 884, Internal,
11848 SN_COLUMN_NUM(curr_sn_idx),
11849 AT_OBJ_NAME_PTR(attr_idx),
11850 AT_OBJ_NAME_PTR(curr_attr_idx));
11851 }
11852 # endif
11853 else {
11854 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 1073, Error,
11855 SN_COLUMN_NUM(curr_sn_idx),
11856 AT_OBJ_NAME_PTR(curr_attr_idx),
11857 "OPERATOR",
11858 AT_OBJ_NAME_PTR(interface_idx),
11859 AT_OBJ_NAME_PTR(attr_idx));
11860 AT_DCL_ERR(interface_idx) = TRUE;
11861 }
11862 }
11863 break;
11864
11865
11866 case Defined_Binary_Interface :
11867
11868 if (ATP_PGM_UNIT(curr_attr_idx) != Function) {
11869 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 492, Error,
11870 SN_COLUMN_NUM(curr_sn_idx),
11871 AT_OBJ_NAME_PTR(curr_attr_idx));
11872 AT_DCL_ERR(interface_idx) = TRUE;
11873 AT_DCL_ERR(curr_attr_idx) = TRUE;
11874 }
11875 else if (TYP_TYPE(curr_type_idx) == Character &&
11876 TYP_CHAR_CLASS(curr_type_idx) == Assumed_Size_Char) {
11877
11878
11879
11880 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 493, Error,
11881 SN_COLUMN_NUM(curr_sn_idx),
11882 AT_OBJ_NAME_PTR(curr_attr_idx));
11883 AT_DCL_ERR(interface_idx) = TRUE;
11884 AT_DCL_ERR(curr_attr_idx) = TRUE;
11885 }
11886
11887 correct_num = (ATP_EXTRA_DARG(curr_attr_idx)) ? 3 : 2;
11888
11889 if (ATP_NUM_DARGS(curr_attr_idx) != correct_num) {
11890 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 496, Error,
11891 SN_COLUMN_NUM(curr_sn_idx),
11892 AT_OBJ_NAME_PTR(curr_attr_idx));
11893 AT_DCL_ERR(interface_idx) = TRUE;
11894 AT_DCL_ERR(curr_attr_idx) = TRUE;
11895 }
11896 else {
11897 sn_idx = (ATP_EXTRA_DARG(curr_attr_idx)) ?
11898 (ATP_FIRST_IDX(curr_attr_idx) + 1) :
11899 ATP_FIRST_IDX(curr_attr_idx);
11900 attr_idx = SN_ATTR_IDX(sn_idx);
11901
11902 if (AT_OPTIONAL(attr_idx)) {
11903 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 1071, Error,
11904 SN_COLUMN_NUM(curr_sn_idx),
11905 "OPERATOR",
11906 AT_OBJ_NAME_PTR(interface_idx),
11907 AT_OBJ_NAME_PTR(curr_attr_idx),
11908 AT_OBJ_NAME_PTR(attr_idx));
11909 AT_DCL_ERR(interface_idx) = TRUE;
11910 }
11911
11912 if (AT_OBJ_CLASS(attr_idx) == Data_Obj) {
11913 type_idx_l = ATD_TYPE_IDX(attr_idx);
11914 rank_l = (ATD_ARRAY_IDX(attr_idx) == NULL_IDX) ?
11915 0 : BD_RANK(ATD_ARRAY_IDX(attr_idx));
11916
11917
11918
11919 if (ATD_INTENT(attr_idx) != Intent_In) {
11920 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 1072, Error,
11921 SN_COLUMN_NUM(curr_sn_idx),
11922 AT_OBJ_NAME_PTR(interface_idx),
11923 AT_OBJ_NAME_PTR(curr_attr_idx),
11924 AT_OBJ_NAME_PTR(attr_idx));
11925 AT_DCL_ERR(interface_idx) = TRUE;
11926 }
11927 }
11928 # ifdef _DEBUG
11929 else if (AT_OBJ_CLASS(attr_idx) != Pgm_Unit) {
11930 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 884, Internal,
11931 SN_COLUMN_NUM(curr_sn_idx),
11932 AT_OBJ_NAME_PTR(attr_idx),
11933 AT_OBJ_NAME_PTR(curr_attr_idx));
11934 }
11935 # endif
11936 else {
11937 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 1073, Error,
11938 SN_COLUMN_NUM(curr_sn_idx),
11939 AT_OBJ_NAME_PTR(curr_attr_idx),
11940 "OPERATOR",
11941 AT_OBJ_NAME_PTR(interface_idx),
11942 AT_OBJ_NAME_PTR(attr_idx));
11943 AT_DCL_ERR(interface_idx) = TRUE;
11944 }
11945
11946 sn_idx++;
11947 attr_idx = SN_ATTR_IDX(sn_idx);
11948
11949 if (AT_OPTIONAL(attr_idx)) {
11950 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 1071, Error,
11951 SN_COLUMN_NUM(curr_sn_idx),
11952 "OPERATOR",
11953 AT_OBJ_NAME_PTR(interface_idx),
11954 AT_OBJ_NAME_PTR(curr_attr_idx),
11955 AT_OBJ_NAME_PTR(attr_idx));
11956 AT_DCL_ERR(interface_idx) = TRUE;
11957 }
11958
11959 if (AT_OBJ_CLASS(attr_idx) == Data_Obj) {
11960 type_idx_r = ATD_TYPE_IDX(attr_idx);
11961 rank_r = (ATD_ARRAY_IDX(attr_idx) == NULL_IDX) ?
11962 0 : BD_RANK(ATD_ARRAY_IDX(attr_idx));
11963
11964
11965
11966 if (ATD_INTENT(attr_idx) != Intent_In) {
11967 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 1072, Error,
11968 SN_COLUMN_NUM(curr_sn_idx),
11969 AT_OBJ_NAME_PTR(interface_idx),
11970 AT_OBJ_NAME_PTR(curr_attr_idx),
11971 AT_OBJ_NAME_PTR(attr_idx));
11972 AT_DCL_ERR(interface_idx) = TRUE;
11973 }
11974 else if (operation_is_intrinsic((operator_type)
11975 ATI_DEFINED_OPR(interface_idx),
11976 type_idx_l,
11977 rank_l,
11978 type_idx_r,
11979 rank_r)) {
11980
11981 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 495, Error,
11982 SN_COLUMN_NUM(curr_sn_idx),
11983 AT_OBJ_NAME_PTR(curr_attr_idx),
11984 AT_OBJ_NAME_PTR(interface_idx));
11985 AT_DCL_ERR(interface_idx) = TRUE;
11986 }
11987 }
11988 # ifdef _DEBUG
11989 else if (AT_OBJ_CLASS(attr_idx) != Pgm_Unit) {
11990 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 884, Internal,
11991 SN_COLUMN_NUM(curr_sn_idx),
11992 AT_OBJ_NAME_PTR(attr_idx),
11993 AT_OBJ_NAME_PTR(curr_attr_idx));
11994 }
11995 # endif
11996 else {
11997 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 1073, Error,
11998 SN_COLUMN_NUM(curr_sn_idx),
11999 AT_OBJ_NAME_PTR(curr_attr_idx),
12000 "OPERATOR",
12001 AT_OBJ_NAME_PTR(interface_idx),
12002 AT_OBJ_NAME_PTR(attr_idx));
12003 AT_DCL_ERR(interface_idx) = TRUE;
12004 }
12005 }
12006 break;
12007
12008
12009 case Defined_Unary_Or_Binary_Interface :
12010
12011
12012
12013 if (ATP_PGM_UNIT(curr_attr_idx) != Function) {
12014 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 492, Error,
12015 SN_COLUMN_NUM(curr_sn_idx),
12016 AT_OBJ_NAME_PTR(curr_attr_idx));
12017 AT_DCL_ERR(interface_idx) = TRUE;
12018 AT_DCL_ERR(curr_attr_idx) = TRUE;
12019 }
12020 else if (TYP_TYPE(curr_type_idx) == Character &&
12021 TYP_CHAR_CLASS(curr_type_idx) == Assumed_Size_Char) {
12022
12023
12024
12025 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 493, Error,
12026 SN_COLUMN_NUM(curr_sn_idx),
12027 AT_OBJ_NAME_PTR(curr_attr_idx));
12028 AT_DCL_ERR(interface_idx) = TRUE;
12029 AT_DCL_ERR(curr_attr_idx) = TRUE;
12030 }
12031
12032 correct_num = (ATP_EXTRA_DARG(curr_attr_idx)) ? 2 : 1;
12033
12034 if (ATP_NUM_DARGS(curr_attr_idx) != correct_num &&
12035 ATP_NUM_DARGS(curr_attr_idx) != correct_num + 1) {
12036 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 497, Error,
12037 SN_COLUMN_NUM(curr_sn_idx),
12038 AT_OBJ_NAME_PTR(curr_attr_idx));
12039 AT_DCL_ERR(interface_idx) = TRUE;
12040 AT_DCL_ERR(curr_attr_idx) = TRUE;
12041 }
12042 else {
12043 sn_idx = (ATP_EXTRA_DARG(curr_attr_idx)) ?
12044 (ATP_FIRST_IDX(curr_attr_idx) + 1) :
12045 ATP_FIRST_IDX(curr_attr_idx);
12046 attr_idx = SN_ATTR_IDX(sn_idx);
12047
12048 if (AT_OPTIONAL(attr_idx)) {
12049 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 1071, Error,
12050 SN_COLUMN_NUM(curr_sn_idx),
12051 "OPERATOR",
12052 AT_OBJ_NAME_PTR(interface_idx),
12053 AT_OBJ_NAME_PTR(curr_attr_idx),
12054 AT_OBJ_NAME_PTR(attr_idx));
12055 AT_DCL_ERR(interface_idx) = TRUE;
12056 }
12057
12058 if (AT_OBJ_CLASS(attr_idx) == Data_Obj) {
12059 type_idx_l = ATD_TYPE_IDX(attr_idx);
12060 rank_l = (ATD_ARRAY_IDX(attr_idx) == NULL_IDX) ?
12061 0 : BD_RANK(ATD_ARRAY_IDX(attr_idx));
12062
12063
12064
12065 if (ATD_INTENT(attr_idx) != Intent_In) {
12066 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 1072, Error,
12067 SN_COLUMN_NUM(curr_sn_idx),
12068 AT_OBJ_NAME_PTR(interface_idx),
12069 AT_OBJ_NAME_PTR(curr_attr_idx),
12070 AT_OBJ_NAME_PTR(attr_idx));
12071 AT_DCL_ERR(interface_idx) = TRUE;
12072 }
12073 }
12074 # ifdef _DEBUG
12075 else if (AT_OBJ_CLASS(attr_idx) != Pgm_Unit) {
12076 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 884, Internal,
12077 SN_COLUMN_NUM(curr_sn_idx),
12078 AT_OBJ_NAME_PTR(attr_idx),
12079 AT_OBJ_NAME_PTR(curr_attr_idx));
12080 }
12081 # endif
12082 else {
12083 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 1073, Error,
12084 SN_COLUMN_NUM(curr_sn_idx),
12085 AT_OBJ_NAME_PTR(curr_attr_idx),
12086 "OPERATOR",
12087 AT_OBJ_NAME_PTR(interface_idx),
12088 AT_OBJ_NAME_PTR(attr_idx));
12089 AT_DCL_ERR(interface_idx) = TRUE;
12090 }
12091
12092 if (ATP_NUM_DARGS(curr_attr_idx) == correct_num + 1) {
12093 sn_idx++;
12094 attr_idx = SN_ATTR_IDX(sn_idx);
12095
12096 if (AT_OPTIONAL(attr_idx)) {
12097 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 1071, Error,
12098 SN_COLUMN_NUM(curr_sn_idx),
12099 "OPERATOR",
12100 AT_OBJ_NAME_PTR(interface_idx),
12101 AT_OBJ_NAME_PTR(curr_attr_idx),
12102 AT_OBJ_NAME_PTR(attr_idx));
12103 AT_DCL_ERR(interface_idx) = TRUE;
12104 }
12105
12106 if (AT_OBJ_CLASS(attr_idx) == Data_Obj) {
12107 type_idx_r = ATD_TYPE_IDX(attr_idx);
12108 rank_r = (ATD_ARRAY_IDX(attr_idx) == NULL_IDX) ?
12109 0 : BD_RANK(ATD_ARRAY_IDX(attr_idx));
12110
12111
12112
12113 if (ATD_INTENT(attr_idx) != Intent_In) {
12114 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 1072, Error,
12115 SN_COLUMN_NUM(curr_sn_idx),
12116 AT_OBJ_NAME_PTR(interface_idx),
12117 AT_OBJ_NAME_PTR(curr_attr_idx),
12118 AT_OBJ_NAME_PTR(attr_idx));
12119 AT_DCL_ERR(interface_idx) = TRUE;
12120 }
12121 }
12122 # ifdef _DEBUG
12123 else if (AT_OBJ_CLASS(attr_idx) != Pgm_Unit) {
12124 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 884, Internal,
12125 SN_COLUMN_NUM(curr_sn_idx),
12126 AT_OBJ_NAME_PTR(attr_idx),
12127 AT_OBJ_NAME_PTR(curr_attr_idx));
12128 }
12129 # endif
12130 else {
12131 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 1073, Error,
12132 SN_COLUMN_NUM(curr_sn_idx),
12133 AT_OBJ_NAME_PTR(curr_attr_idx),
12134 "OPERATOR",
12135 AT_OBJ_NAME_PTR(interface_idx),
12136 AT_OBJ_NAME_PTR(attr_idx));
12137 AT_DCL_ERR(interface_idx) = TRUE;
12138 }
12139 }
12140 else {
12141 type_idx_r = TYPELESS_DEFAULT_TYPE;
12142 }
12143
12144 if (!AT_DCL_ERR(interface_idx) &&
12145 operation_is_intrinsic((operator_type)
12146 ATI_DEFINED_OPR(interface_idx),
12147 type_idx_l,
12148 rank_l,
12149 type_idx_r,
12150 rank_r)) {
12151
12152 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 495, Error,
12153 SN_COLUMN_NUM(curr_sn_idx),
12154 AT_OBJ_NAME_PTR(curr_attr_idx),
12155 AT_OBJ_NAME_PTR(interface_idx));
12156 AT_DCL_ERR(interface_idx) = TRUE;
12157 }
12158 }
12159 break;
12160 }
12161
12162
12163
12164
12165
12166 sn_idx = (AT_IS_INTRIN(curr_attr_idx)) ? NULL_IDX :
12167 SN_SIBLING_LINK(curr_sn_idx);
12168
12169 while (sn_idx != NULL_IDX) {
12170
12171 attr_idx = SN_ATTR_IDX(sn_idx);
12172
12173 if (AT_IS_INTRIN(attr_idx)) {
12174
12175
12176
12177 break;
12178 }
12179
12180 if (ATP_EXTRA_DARG(curr_attr_idx)) {
12181 curr_num_dargs = ATP_NUM_DARGS(curr_attr_idx) - 1;
12182 curr_darg_sn_idx = ATP_FIRST_IDX(curr_attr_idx) + 1;
12183 }
12184 else {
12185 curr_num_dargs = ATP_NUM_DARGS(curr_attr_idx);
12186 curr_darg_sn_idx = ATP_FIRST_IDX(curr_attr_idx);
12187 }
12188
12189 if (ATP_EXTRA_DARG(attr_idx)) {
12190 num_dargs = ATP_NUM_DARGS(attr_idx) - 1;
12191 darg_sn_idx = ATP_FIRST_IDX(attr_idx) + 1;
12192 }
12193 else {
12194 num_dargs = ATP_NUM_DARGS(attr_idx);
12195 darg_sn_idx = ATP_FIRST_IDX(attr_idx);
12196 }
12197
12198 if (ATP_PGM_UNIT(curr_attr_idx) == ATP_PGM_UNIT(attr_idx) &&
12199 (curr_num_dargs == num_dargs ||
12200 ATI_INTERFACE_CLASS(interface_idx) < Defined_Interface)) {
12201 save_num_dargs = num_dargs;
12202 save_darg_sn_idx = darg_sn_idx;
12203 save_curr_num_dargs = curr_num_dargs;
12204 save_curr_darg_sn_idx = curr_darg_sn_idx;
12205 ambiguous = TRUE;
12206 loop_cnt = (curr_num_dargs > num_dargs) ?
12207 curr_num_dargs: num_dargs;
12208
12209 for (i = 0; i < loop_cnt; i++) {
12210
12211 if (curr_num_dargs != NULL_IDX) {
12212 curr_darg_idx = SN_ATTR_IDX(curr_darg_sn_idx);
12213 curr_darg_sn_idx++;
12214 curr_num_dargs--;
12215 }
12216 else {
12217 curr_darg_idx = NULL_IDX;
12218 }
12219
12220 if (num_dargs != NULL_IDX) {
12221 darg_idx = SN_ATTR_IDX(darg_sn_idx);
12222 darg_sn_idx++;
12223 num_dargs--;
12224 }
12225 else {
12226 darg_idx = NULL_IDX;
12227 }
12228
12229
12230
12231
12232
12233 if (curr_darg_idx == NULL_IDX || darg_idx == NULL_IDX) {
12234 same_dargs = FALSE;
12235 }
12236 else {
12237 same_dargs = compare_dummy_arguments(curr_darg_idx, darg_idx);
12238 }
12239
12240 if (ATI_INTERFACE_CLASS(interface_idx) >= Defined_Interface) {
12241
12242 if (!same_dargs) {
12243 ambiguous = FALSE;
12244 break;
12245 }
12246 continue;
12247 }
12248
12249 if (curr_darg_idx != NULL_IDX && !AT_OPTIONAL(curr_darg_idx)) {
12250
12251 if (same_dargs &&
12252 !AT_OPTIONAL(darg_idx) &&
12253 !SN_MATCHED_DARG(darg_sn_idx - 1) &&
12254 !SN_MATCHED_DARG(curr_darg_sn_idx - 1)) {
12255
12256
12257
12258 SN_MATCHED_DARG(darg_sn_idx-1) = TRUE;
12259 SN_MATCHED_DARG(curr_darg_sn_idx-1) = TRUE;
12260 }
12261
12262
12263
12264
12265
12266
12267
12268
12269
12270
12271
12272
12273
12274
12275
12276
12277
12278 if (!same_dargs) {
12279
12280
12281
12282 kwd_darg_idx =srch_kwd_name(AT_OBJ_NAME_PTR(curr_darg_idx),
12283 AT_NAME_LEN(curr_darg_idx),
12284 attr_idx,
12285 &kwd_sn_idx);
12286
12287 if (kwd_darg_idx == NULL_IDX) {
12288 ambiguous = FALSE;
12289 break;
12290 }
12291
12292 if (!compare_dummy_arguments(curr_darg_idx, kwd_darg_idx)){
12293 ambiguous = FALSE;
12294 break;
12295 }
12296
12297 if (!AT_OPTIONAL(kwd_darg_idx) &&
12298 !SN_MATCHED_DARG(kwd_sn_idx) &&
12299 !SN_MATCHED_DARG(curr_darg_sn_idx - 1)) {
12300
12301
12302
12303 SN_MATCHED_DARG(curr_darg_sn_idx - 1) = TRUE;
12304 SN_MATCHED_DARG(kwd_sn_idx) = TRUE;
12305 }
12306 }
12307
12308
12309
12310
12311
12312
12313
12314
12315
12316
12317
12318 if (!SN_MATCHED_DARG(curr_darg_sn_idx - 1)) {
12319 ktr_sn_idx = save_darg_sn_idx;
12320 optional_sn_idx = NULL_IDX;
12321
12322
12323
12324 for (idx = 0; idx < save_num_dargs; idx++) {
12325
12326 if (SN_MATCHED_DARG(ktr_sn_idx)) {
12327 ktr_sn_idx++;
12328 continue;
12329 }
12330
12331 if (compare_dummy_arguments(curr_darg_idx,
12332 SN_ATTR_IDX(ktr_sn_idx))) {
12333
12334
12335
12336
12337
12338
12339
12340 if (AT_OPTIONAL(SN_ATTR_IDX(ktr_sn_idx))) {
12341 optional_sn_idx = ktr_sn_idx;
12342 }
12343 else {
12344 SN_MATCHED_DARG(ktr_sn_idx) = TRUE;
12345 SN_MATCHED_DARG(curr_darg_sn_idx-1) = TRUE;
12346 break;
12347 }
12348 }
12349 ktr_sn_idx++;
12350 }
12351
12352 if (!SN_MATCHED_DARG(curr_darg_sn_idx-1) &&
12353 optional_sn_idx != NULL_IDX) {
12354
12355
12356
12357 SN_MATCHED_DARG(optional_sn_idx) = TRUE;
12358 SN_MATCHED_DARG(curr_darg_sn_idx-1) = TRUE;
12359 }
12360
12361
12362
12363
12364 if (!SN_MATCHED_DARG(curr_darg_sn_idx-1)) {
12365 ambiguous = FALSE;
12366 break;
12367 }
12368 }
12369 }
12370
12371 if (darg_idx != NULL_IDX && !AT_OPTIONAL(darg_idx)) {
12372
12373
12374
12375
12376
12377
12378
12379
12380
12381
12382
12383
12384
12385
12386
12387
12388
12389 if (!same_dargs) {
12390
12391
12392
12393 kwd_darg_idx = srch_kwd_name(AT_OBJ_NAME_PTR(darg_idx),
12394 AT_NAME_LEN(darg_idx),
12395 curr_attr_idx,
12396 &kwd_sn_idx);
12397
12398 if (kwd_darg_idx == NULL_IDX) {
12399 ambiguous = FALSE;
12400 break;
12401 }
12402
12403 if (!compare_dummy_arguments(darg_idx, kwd_darg_idx)){
12404 ambiguous = FALSE;
12405 break;
12406 }
12407
12408 if (!AT_OPTIONAL(kwd_darg_idx) &&
12409 !SN_MATCHED_DARG(kwd_sn_idx) &&
12410 !SN_MATCHED_DARG(darg_sn_idx - 1)) {
12411
12412
12413
12414 SN_MATCHED_DARG(darg_sn_idx - 1) = TRUE;
12415 SN_MATCHED_DARG(kwd_sn_idx) = TRUE;
12416 }
12417 }
12418
12419
12420
12421 if (!SN_MATCHED_DARG(darg_sn_idx - 1)) {
12422 ktr_sn_idx = save_curr_darg_sn_idx;
12423 optional_sn_idx = NULL_IDX;
12424
12425
12426
12427 for (idx = 0; idx < save_curr_num_dargs; idx++) {
12428
12429 if (SN_MATCHED_DARG(ktr_sn_idx)) {
12430 ktr_sn_idx++;
12431 continue;
12432 }
12433
12434 if (compare_dummy_arguments(darg_idx,
12435 SN_ATTR_IDX(ktr_sn_idx))) {
12436
12437
12438
12439
12440
12441
12442
12443 if (AT_OPTIONAL(SN_ATTR_IDX(ktr_sn_idx))) {
12444 optional_sn_idx = ktr_sn_idx;
12445 }
12446 else {
12447 SN_MATCHED_DARG(ktr_sn_idx) = TRUE;
12448 SN_MATCHED_DARG(darg_sn_idx-1) = TRUE;
12449 break;
12450 }
12451 }
12452 ktr_sn_idx++;
12453 }
12454
12455 if (!SN_MATCHED_DARG(darg_sn_idx-1) &&
12456 optional_sn_idx != NULL_IDX) {
12457
12458
12459
12460 SN_MATCHED_DARG(optional_sn_idx) = TRUE;
12461 SN_MATCHED_DARG(darg_sn_idx-1) = TRUE;
12462 }
12463
12464
12465
12466
12467 if (!SN_MATCHED_DARG(darg_sn_idx-1)) {
12468 ambiguous = FALSE;
12469 break;
12470 }
12471 }
12472 }
12473 }
12474
12475
12476
12477 if (ATI_INTERFACE_CLASS(interface_idx) < Defined_Interface) {
12478 ktr_sn_idx = save_darg_sn_idx;
12479
12480 for (idx = 0; idx < save_num_dargs; idx++) {
12481 SN_MATCHED_DARG(ktr_sn_idx) = FALSE;
12482 ktr_sn_idx++;
12483 }
12484
12485 ktr_sn_idx = save_curr_darg_sn_idx;
12486
12487 for (idx = 0; idx < save_curr_num_dargs; idx++) {
12488 SN_MATCHED_DARG(ktr_sn_idx) = FALSE;
12489 ktr_sn_idx++;
12490 }
12491 }
12492
12493 if (ambiguous) {
12494
12495 if (compare_names(AT_OBJ_NAME_LONG(curr_attr_idx),
12496 AT_NAME_LEN(curr_attr_idx),
12497 AT_OBJ_NAME_LONG(attr_idx),
12498 AT_NAME_LEN(attr_idx)) == 0) {
12499
12500
12501
12502
12503
12504
12505
12506 if (AT_MODULE_IDX(curr_attr_idx) == NULL_IDX ||
12507 AT_MODULE_IDX(attr_idx) == NULL_IDX ||
12508 ATP_MODULE_STR_IDX(AT_MODULE_IDX(curr_attr_idx)) !=
12509 ATP_MODULE_STR_IDX(AT_MODULE_IDX(attr_idx))) {
12510 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 991, Error,
12511 SN_COLUMN_NUM(curr_sn_idx),
12512 AT_OBJ_NAME_PTR(curr_attr_idx),
12513 (ATI_INTERFACE_CLASS(interface_idx) ? "GENERIC" :
12514 "DEFINED"),
12515 AT_OBJ_NAME_PTR(interface_idx));
12516 AT_DCL_ERR(interface_idx) = TRUE;
12517 }
12518 }
12519 else {
12520 PRINTMSG(SN_LINE_NUM(curr_sn_idx), 487, Error,
12521 SN_COLUMN_NUM(curr_sn_idx),
12522 AT_OBJ_NAME_PTR(curr_attr_idx),
12523 AT_OBJ_NAME_PTR(attr_idx),
12524 (ATI_INTERFACE_CLASS(interface_idx) ? "GENERIC" :
12525 "DEFINED"),
12526 AT_OBJ_NAME_PTR(interface_idx));
12527 AT_DCL_ERR(interface_idx) = TRUE;
12528 }
12529 }
12530 }
12531
12532 sn_idx = SN_SIBLING_LINK(sn_idx);
12533 }
12534
12535 curr_sn_idx = SN_SIBLING_LINK(curr_sn_idx);
12536 #ifdef KEY
12537 first = FALSE;
12538 #endif
12539 }
12540
12541 EXIT:
12542
12543 TRACE (Func_Exit, "verify_interface", NULL);
12544
12545 return;
12546
12547 }
12548
12549
12550
12551
12552
12553
12554
12555
12556
12557
12558
12559
12560
12561
12562
12563
12564
12565 static void compare_duplicate_interface_bodies(int attr_idx)
12566
12567 {
12568 int dup_attr_idx;
12569 int idx;
12570 int idx1;
12571 int idx2;
12572 int rank1;
12573 int rank2;
12574 boolean same = TRUE;
12575
12576
12577 TRACE (Func_Entry, "compare_duplicate_interface_bodies", NULL);
12578
12579 dup_attr_idx = ATP_DUPLICATE_INTERFACE_IDX(attr_idx);
12580 ATP_DUPLICATE_INTERFACE_IDX(attr_idx) = NULL_IDX;
12581
12582 if (ATP_PGM_UNIT(attr_idx) != ATP_PGM_UNIT(dup_attr_idx) ||
12583 ATP_NUM_DARGS(attr_idx) != ATP_NUM_DARGS(dup_attr_idx) ||
12584 ATP_RSLT_NAME(attr_idx) != ATP_RSLT_NAME(dup_attr_idx)) {
12585
12586
12587
12588
12589
12590 same = FALSE;
12591 }
12592 else {
12593
12594 if (ATP_PGM_UNIT(attr_idx) == Function) {
12595 idx1 = ATP_RSLT_IDX(attr_idx);
12596 idx2 = ATP_RSLT_IDX(dup_attr_idx);
12597
12598 if (ATP_RSLT_NAME(attr_idx) &&
12599 (compare_names(AT_OBJ_NAME_LONG(idx1),
12600 AT_NAME_LEN(idx1),
12601 AT_OBJ_NAME_LONG(idx2),
12602 AT_NAME_LEN(idx2)) != 0)) {
12603 same = FALSE;
12604 }
12605 else {
12606
12607 if (TYP_TYPE(ATD_TYPE_IDX(idx1)) != TYP_TYPE(ATD_TYPE_IDX(idx2))) {
12608 same = FALSE;
12609 }
12610 else if (TYP_TYPE(ATD_TYPE_IDX(idx1)) == Structure &&
12611 !compare_derived_types(ATD_TYPE_IDX(idx1),
12612 ATD_TYPE_IDX(idx2))) {
12613 same = FALSE;
12614 }
12615 else if (TYP_TYPE(ATD_TYPE_IDX(idx1)) != Character &&
12616 TYP_TYPE(ATD_TYPE_IDX(idx1)) != Structure &&
12617 TYP_LINEAR(ATD_TYPE_IDX(idx1)) !=
12618 TYP_LINEAR(ATD_TYPE_IDX(idx2))) {
12619 same = FALSE;
12620 }
12621
12622 if (same) {
12623 rank1 = (ATD_ARRAY_IDX(idx1) == NULL_IDX) ? 0 :
12624 BD_RANK(ATD_ARRAY_IDX(idx1));
12625 rank2 = (ATD_ARRAY_IDX(idx2) == NULL_IDX) ? 0 :
12626 BD_RANK(ATD_ARRAY_IDX(idx2));
12627
12628 if (rank1 != rank2) {
12629 same = FALSE;
12630 }
12631 }
12632 }
12633 }
12634
12635 if (same) {
12636 idx1 = ATP_FIRST_IDX(attr_idx);
12637 idx2 = ATP_FIRST_IDX(dup_attr_idx);
12638
12639 for (idx = 0; idx < ATP_NUM_DARGS(attr_idx); idx++) {
12640
12641 if (compare_names(AT_OBJ_NAME_LONG(SN_ATTR_IDX(idx1)),
12642 AT_NAME_LEN(SN_ATTR_IDX(idx1)),
12643 AT_OBJ_NAME_LONG(SN_ATTR_IDX(idx2)),
12644 AT_NAME_LEN(SN_ATTR_IDX(idx2))) != 0) {
12645 same = FALSE;
12646 break;
12647 }
12648
12649 if (!compare_dummy_arguments(SN_ATTR_IDX(idx1),SN_ATTR_IDX(idx2))) {
12650 same = FALSE;
12651 break;
12652 }
12653 idx1++; idx2++;
12654 }
12655 }
12656 }
12657
12658 if (same) {
12659 PRINTMSG(AT_DEF_LINE(dup_attr_idx), 1515, Ansi,
12660 AT_DEF_COLUMN(dup_attr_idx),
12661 AT_OBJ_NAME_PTR(dup_attr_idx));
12662 }
12663 else {
12664 PRINTMSG(AT_DEF_LINE(dup_attr_idx), 1516, Error,
12665 AT_DEF_COLUMN(dup_attr_idx),
12666 AT_OBJ_NAME_PTR(dup_attr_idx));
12667 }
12668
12669 TRACE (Func_Exit, "compare_duplicate_interface_bodies", NULL);
12670
12671 return;
12672
12673 }
12674
12675
12676
12677
12678
12679
12680
12681
12682
12683
12684
12685
12686
12687
12688
12689
12690 static void reshape_array_semantics(void)
12691 {
12692 int al_idx;
12693 int attr_idx;
12694 int fp_idx;
12695 int name_idx;
12696 token_type name_token;
12697
12698
12699 TRACE (Func_Entry, "reshape_array_semantics", NULL);
12700
12701 fp_idx = opt_flags.reshape_idx;
12702
12703 while (fp_idx != NULL_IDX) {
12704 CREATE_ID(TOKEN_ID(name_token),(FP_NAME_PTR(fp_idx)),FP_NAME_LEN(fp_idx));
12705
12706 TOKEN_COLUMN(name_token) = 1;
12707 TOKEN_LEN(name_token) = FP_NAME_LEN(fp_idx);
12708 TOKEN_LINE(name_token) = stmt_start_line;
12709
12710 attr_idx = srch_sym_tbl(TOKEN_STR(name_token),
12711 TOKEN_LEN(name_token),
12712 &name_idx);
12713
12714 if (attr_idx != NULL_IDX) {
12715
12716 if (AT_OBJ_CLASS(attr_idx) == Data_Obj &&
12717 ATD_ARRAY_IDX(attr_idx) != NULL_IDX) {
12718
12719 if (BD_ARRAY_CLASS(ATD_ARRAY_IDX(attr_idx)) == Explicit_Shape &&
12720 (ATD_CLASS(attr_idx) != CRI__Pointee &&
12721 ATD_CLASS(attr_idx) != Constant) &&
12722 BD_RANK(ATD_ARRAY_IDX(attr_idx)) > 1) {
12723 ATD_RESHAPE_ARRAY_OPT(attr_idx) = TRUE;
12724
12725 NTR_ATTR_LIST_TBL(al_idx);
12726 AL_ATTR_IDX(al_idx) = attr_idx;
12727 AL_NEXT_IDX(al_idx) = reshape_array_list;
12728 reshape_array_list = al_idx;
12729 if (ATD_DATA_INIT(attr_idx)) {
12730 PRINTMSG(AT_DEF_LINE(attr_idx), 1644, Error,
12731 AT_DEF_COLUMN(attr_idx),
12732 AT_OBJ_NAME_PTR(attr_idx));
12733 }
12734 }
12735 else {
12736 PRINTMSG(AT_DEF_LINE(attr_idx), 1539, Error,
12737 AT_DEF_COLUMN(attr_idx),
12738 AT_OBJ_NAME_PTR(attr_idx));
12739 }
12740 }
12741 else {
12742 PRINTMSG(AT_DEF_LINE(attr_idx), 1538, Warning,
12743 AT_DEF_COLUMN(attr_idx),
12744 AT_OBJ_NAME_PTR(attr_idx),
12745 AT_OBJ_NAME_PTR(SCP_ATTR_IDX(curr_scp_idx)));
12746 }
12747 }
12748
12749 fp_idx = FP_NEXT_FILE_IDX(fp_idx);
12750 }
12751
12752 TRACE (Func_Exit, "reshape_array_semantics", NULL);
12753
12754 return;
12755
12756 }
12757
12758
12759
12760
12761
12762
12763
12764
12765
12766
12767
12768
12769
12770
12771
12772
12773
12774 static void gen_allocatable_ptr_ptee(int attr_idx)
12775
12776 {
12777 int col;
12778 int line;
12779 int ptr_idx;
12780 int ptee_idx;
12781 id_str_type storage_name;
12782
12783
12784 TRACE (Func_Entry, "gen_allocatable_ptr_ptee", NULL);
12785
12786 line = AT_DEF_LINE(attr_idx);
12787 col = AT_DEF_COLUMN(attr_idx);
12788
12789 ptr_idx = gen_compiler_tmp(line, col, Shared, TRUE);
12790
12791 if (TYP_TYPE(ATD_TYPE_IDX(attr_idx)) == Character) {
12792 ATD_TYPE_IDX(ptr_idx) = CRI_Ch_Ptr_8;
12793 }
12794 else {
12795 ATD_TYPE_IDX(ptr_idx) = CRI_Ptr_8;
12796 }
12797 AT_SEMANTICS_DONE(ptr_idx) = TRUE;
12798
12799 # ifdef _DEBUG
12800 if (ATD_STOR_BLK_IDX(attr_idx) == NULL_IDX) {
12801 PRINTMSG(line, 626, Internal, col,
12802 "valid ATD_STOR_BLK_IDX",
12803 "gen_allocatable_ptr_ptee");
12804 }
12805 # endif
12806 ATD_STOR_BLK_IDX(ptr_idx) = ATD_STOR_BLK_IDX(attr_idx);
12807
12808 ptee_idx = gen_compiler_tmp(line, col, Shared, TRUE);
12809 ATD_CLASS(ptee_idx) = CRI__Pointee;
12810 AT_SEMANTICS_DONE(ptee_idx) = TRUE;
12811
12812 if (pointee_based_blk == NULL_IDX) {
12813
12814
12815
12816 CREATE_ID(storage_name, sb_name[Pointee_Blk], sb_len[Pointee_Blk]);
12817 pointee_based_blk = ntr_stor_blk_tbl(storage_name.string,
12818 sb_len[Pointee_Blk],
12819 AT_DEF_LINE(attr_idx),
12820 AT_DEF_COLUMN(attr_idx),
12821 Based);
12822 }
12823
12824 ATD_STOR_BLK_IDX(ptee_idx) = pointee_based_blk;
12825
12826 ATD_TYPE_IDX(ptee_idx) = ATD_TYPE_IDX(attr_idx);
12827 ATD_PTR_IDX(ptee_idx) = ptr_idx;
12828
12829 ATD_ARRAY_IDX(ptee_idx) = set_up_bd_tmps(BD_RANK(ATD_ARRAY_IDX(attr_idx)),
12830 line,
12831 col,
12832 ATD_STOR_BLK_IDX(attr_idx),
12833 FALSE);
12834 ATD_PE_ARRAY_IDX(ptee_idx) =
12835 set_up_bd_tmps(BD_RANK(ATD_PE_ARRAY_IDX(attr_idx)),
12836 line,
12837 col,
12838 ATD_STOR_BLK_IDX(attr_idx),
12839 TRUE);
12840
12841 ATD_FLD(attr_idx) = AT_Tbl_Idx;
12842 ATD_VARIABLE_TMP_IDX(attr_idx) = ptee_idx;
12843
12844 TRACE (Func_Exit, "gen_allocatable_ptr_ptee", NULL);
12845
12846 return;
12847
12848 }
12849
12850
12851
12852
12853
12854
12855
12856
12857
12858
12859
12860
12861
12862
12863
12864
12865
12866 static int set_up_bd_tmps(int rank,
12867 int line,
12868 int col,
12869 int stor_blk_idx,
12870 boolean assumed_size)
12871
12872 {
12873 int bd_idx;
12874 int i;
12875 int tmp_idx;
12876
12877
12878 TRACE (Func_Entry, "set_up_bd_tmps", NULL);
12879
12880 bd_idx = reserve_array_ntry(rank);
12881 BD_RANK(bd_idx) = rank;
12882 BD_LINE_NUM(bd_idx) = line;
12883 BD_COLUMN_NUM(bd_idx) = col;
12884 BD_ARRAY_SIZE(bd_idx) = Var_Len_Array;
12885 BD_ARRAY_CLASS(bd_idx) = (assumed_size ? Assumed_Size : Explicit_Shape);
12886 BD_RESOLVED(bd_idx) = TRUE;
12887
12888 for (i =1; i <= rank; i++) {
12889
12890 tmp_idx = gen_compiler_tmp(line, col, Shared, TRUE);
12891 ATD_TYPE_IDX(tmp_idx) = SA_INTEGER_DEFAULT_TYPE;
12892 ATD_STOR_BLK_IDX(tmp_idx) = stor_blk_idx;
12893 AT_SEMANTICS_DONE(tmp_idx) = TRUE;
12894
12895 BD_LB_FLD(bd_idx,i) = AT_Tbl_Idx;
12896 BD_LB_IDX(bd_idx,i) = tmp_idx;
12897
12898
12899 if (assumed_size && i == rank) {
12900 BD_XT_FLD(bd_idx,i) = CN_Tbl_Idx;
12901 BD_XT_IDX(bd_idx,i) = CN_INTEGER_ONE_IDX;
12902
12903 BD_UB_FLD(bd_idx,i) = BD_LB_FLD(bd_idx,i);
12904 BD_UB_IDX(bd_idx,i) = BD_LB_IDX(bd_idx,i);
12905 }
12906 else {
12907 tmp_idx = gen_compiler_tmp(line, col, Shared, TRUE);
12908 ATD_TYPE_IDX(tmp_idx) = SA_INTEGER_DEFAULT_TYPE;
12909 ATD_STOR_BLK_IDX(tmp_idx) = stor_blk_idx;
12910 AT_SEMANTICS_DONE(tmp_idx) = TRUE;
12911
12912 BD_XT_FLD(bd_idx,i) = AT_Tbl_Idx;
12913 BD_XT_IDX(bd_idx,i) = tmp_idx;
12914
12915
12916 tmp_idx = gen_compiler_tmp(line, col, Shared, TRUE);
12917 ATD_TYPE_IDX(tmp_idx) = SA_INTEGER_DEFAULT_TYPE;
12918 ATD_STOR_BLK_IDX(tmp_idx) = stor_blk_idx;
12919 AT_SEMANTICS_DONE(tmp_idx) = TRUE;
12920
12921 BD_UB_FLD(bd_idx,i) = AT_Tbl_Idx;
12922 BD_UB_IDX(bd_idx,i) = tmp_idx;
12923 }
12924
12925 tmp_idx = gen_compiler_tmp(line, col, Shared, TRUE);
12926 ATD_TYPE_IDX(tmp_idx) = SA_INTEGER_DEFAULT_TYPE;
12927 ATD_STOR_BLK_IDX(tmp_idx) = stor_blk_idx;
12928 AT_SEMANTICS_DONE(tmp_idx) = TRUE;
12929
12930 BD_SM_FLD(bd_idx,i) = AT_Tbl_Idx;
12931 BD_SM_IDX(bd_idx,i) = tmp_idx;
12932 }
12933
12934 tmp_idx = gen_compiler_tmp(line, col, Shared, TRUE);
12935 ATD_TYPE_IDX(tmp_idx) = SA_INTEGER_DEFAULT_TYPE;
12936 ATD_STOR_BLK_IDX(tmp_idx) = stor_blk_idx;
12937 AT_SEMANTICS_DONE(tmp_idx) = TRUE;
12938
12939 BD_LEN_FLD(bd_idx) = AT_Tbl_Idx;
12940 BD_LEN_IDX(bd_idx) = tmp_idx;
12941
12942
12943 BD_FLOW_DEPENDENT(bd_idx) = TRUE;
12944
12945 bd_idx = ntr_array_in_bd_tbl(bd_idx);
12946
12947 TRACE (Func_Exit, "set_up_bd_tmps", NULL);
12948
12949 return(bd_idx);
12950
12951 }
12952
12953
12954
12955
12956
12957
12958
12959
12960
12961
12962
12963
12964
12965
12966
12967
12968
12969 int gen_tmp_equal_max_zero(opnd_type *opnd,
12970 int type_idx,
12971 int entry_idx,
12972 boolean is_symbolic_constant,
12973 boolean is_interface)
12974
12975 {
12976 int column;
12977 int defining_attr;
12978 int line;
12979 int list_idx;
12980 int max_idx;
12981 #ifdef KEY
12982 int sh_idx = 0;
12983 #else
12984 int sh_idx;
12985 #endif
12986 int tmp_idx;
12987 int zero_idx;
12988
12989
12990 TRACE (Func_Entry, "gen_tmp_equal_max_zero", NULL);
12991
12992
12993
12994 line = OPND_LINE_NUM((*opnd));
12995 column = OPND_COL_NUM((*opnd));
12996
12997 NTR_IR_TBL(max_idx);
12998 IR_OPR(max_idx) = Max_Opr;
12999 IR_TYPE_IDX(max_idx) = type_idx;
13000 IR_LINE_NUM(max_idx) = line;
13001 IR_COL_NUM(max_idx) = column;
13002 IR_LIST_CNT_L(max_idx) = 2;
13003
13004 NTR_IR_LIST_TBL(list_idx);
13005 IR_FLD_L(max_idx) = IL_Tbl_Idx;
13006 IR_IDX_L(max_idx) = list_idx;
13007
13008 COPY_OPND(IL_OPND(list_idx), (*opnd));
13009
13010 NTR_IR_LIST_TBL(zero_idx);
13011 IL_NEXT_LIST_IDX(list_idx) = zero_idx;
13012 IL_PREV_LIST_IDX(zero_idx) = list_idx;
13013 IL_FLD(zero_idx) = CN_Tbl_Idx;
13014 IL_IDX(zero_idx) = CN_INTEGER_ZERO_IDX;
13015 IL_LINE_NUM(zero_idx) = line;
13016 IL_COL_NUM(zero_idx) = column;
13017
13018 if (OPND_FLD((*opnd)) == AT_Tbl_Idx &&
13019 AT_OBJ_CLASS(OPND_IDX((*opnd))) == Data_Obj &&
13020 ATD_CLASS(OPND_IDX((*opnd))) == Compiler_Tmp) {
13021 defining_attr = ATD_DEFINING_ATTR_IDX(OPND_IDX((*opnd)));
13022 }
13023 else {
13024 defining_attr = NULL_IDX;
13025 }
13026
13027 if (is_symbolic_constant) {
13028 IR_OPR(max_idx) = Symbolic_Max_Opr;
13029 OPND_FLD((*opnd)) = AT_Tbl_Idx;
13030 OPND_IDX((*opnd)) = gen_compiler_tmp(line,
13031 column,
13032 Priv, TRUE);
13033
13034 ATD_TYPE_IDX(OPND_IDX((*opnd))) = type_idx;
13035 ATD_FLD(OPND_IDX((*opnd))) = IR_Tbl_Idx;
13036 ATD_TMP_IDX(OPND_IDX((*opnd))) = max_idx;
13037 ATD_SYMBOLIC_CONSTANT(OPND_IDX((*opnd))) = TRUE;
13038 ATD_DEFINING_ATTR_IDX(OPND_IDX((*opnd))) = defining_attr;
13039 }
13040 else {
13041 OPND_FLD((*opnd)) = IR_Tbl_Idx;
13042 OPND_IDX((*opnd)) = max_idx;
13043
13044
13045 if (!is_interface) {
13046 sh_idx = ntr_sh_tbl();
13047 SH_STMT_TYPE(sh_idx) = Automatic_Base_Size_Stmt;
13048 SH_GLB_LINE(sh_idx) = line;
13049 SH_COL_NUM(sh_idx) = column;
13050 SH_COMPILER_GEN(sh_idx)= TRUE;
13051 SH_P2_SKIP_ME(sh_idx) = TRUE;
13052 }
13053
13054 tmp_idx = ntr_bnds_sh_tmp_list(opnd,
13055 entry_idx,
13056 (is_interface) ? NULL_IDX : sh_idx,
13057 FALSE,
13058 type_idx);
13059 OPND_FLD((*opnd)) = AT_Tbl_Idx;
13060 OPND_IDX((*opnd)) = tmp_idx;
13061 ATD_DEFINING_ATTR_IDX(tmp_idx) = defining_attr;
13062 }
13063
13064 TRACE (Func_Exit, "gen_tmp_equal_max_zero", NULL);
13065
13066 return(max_idx);
13067
13068 }
13069
13070
13071
13072
13073
13074
13075
13076
13077
13078
13079
13080
13081
13082
13083
13084
13085 static boolean compare_darg_or_rslt_types(int idx1,
13086 int idx2)
13087 {
13088 boolean intrin1;
13089 boolean intrin2;
13090 int linear_type1;
13091 int linear_type2;
13092 int rank1;
13093 int rank2;
13094 boolean same = TRUE;
13095
13096
13097 TRACE (Func_Entry, "compare_darg_or_rslt_types", NULL);
13098
13099 intrin1 = (ATD_CLASS(idx1) == Dummy_Argument) && ATD_INTRIN_DARG(idx1);
13100 intrin2 = (ATD_CLASS(idx2) == Dummy_Argument) && ATD_INTRIN_DARG(idx2);
13101
13102 if (intrin1 || intrin2) {
13103 rank1 = (ATD_ARRAY_IDX(idx1) == NULL_IDX) ?
13104 0 : BD_RANK(ATD_ARRAY_IDX(idx1));
13105 rank2 = (ATD_ARRAY_IDX(idx2) == NULL_IDX) ?
13106 0 : BD_RANK(ATD_ARRAY_IDX(idx2));
13107
13108 if (!intrin1) {
13109
13110 if (TYP_TYPE(ATD_TYPE_IDX(idx1)) == Character ||
13111 TYP_TYPE(ATD_TYPE_IDX(idx1)) == Structure) {
13112 same = FALSE;
13113 goto DONE;
13114 }
13115
13116 linear_type1 = TYP_LINEAR(ATD_TYPE_IDX(idx1));
13117 linear_type1 = 1 << linear_type1;
13118 }
13119 else {
13120 linear_type1 = ATD_INTRIN_DARG_TYPE(idx1);
13121 }
13122
13123 if (!intrin2) {
13124
13125 if (TYP_TYPE(ATD_TYPE_IDX(idx2)) == Character ||
13126 TYP_TYPE(ATD_TYPE_IDX(idx2)) == Structure) {
13127 same = FALSE;
13128 goto DONE;
13129 }
13130
13131 linear_type2 = TYP_LINEAR(ATD_TYPE_IDX(idx2));
13132 linear_type2 = 1 << linear_type2;
13133 }
13134 else {
13135 linear_type2 = ATD_INTRIN_DARG_TYPE(idx2);
13136 }
13137
13138 if ((linear_type1 & linear_type2) == 0) {
13139 same = FALSE;
13140 }
13141
13142 if (rank1 != rank2) {
13143 same = FALSE;
13144 }
13145 }
13146 else {
13147
13148 if (TYP_TYPE(ATD_TYPE_IDX(idx1)) != TYP_TYPE(ATD_TYPE_IDX(idx2))){
13149 same = FALSE;
13150 }
13151 else if (TYP_TYPE(ATD_TYPE_IDX(idx1)) == Structure &&
13152 !compare_derived_types(ATD_TYPE_IDX(idx1), ATD_TYPE_IDX(idx2))) {
13153 same = FALSE;
13154 }
13155 else if (TYP_TYPE(ATD_TYPE_IDX(idx1)) != Character &&
13156 TYP_TYPE(ATD_TYPE_IDX(idx1)) != Structure &&
13157 TYP_LINEAR(ATD_TYPE_IDX(idx1)) !=
13158 TYP_LINEAR(ATD_TYPE_IDX(idx2))) {
13159 same = FALSE;
13160 }
13161
13162 if (same) {
13163 rank1 = (ATD_ARRAY_IDX(idx1) == NULL_IDX) ?
13164 0 : BD_RANK(ATD_ARRAY_IDX(idx1));
13165 rank2 = (ATD_ARRAY_IDX(idx2) == NULL_IDX) ?
13166 0 : BD_RANK(ATD_ARRAY_IDX(idx2));
13167
13168 if (rank1 != rank2) {
13169 same = FALSE;
13170 }
13171 }
13172 }
13173
13174 DONE:
13175
13176 TRACE (Func_Exit, "compare_darg_or_rslt_types", NULL);
13177
13178 return(same);
13179
13180 }