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_asg_expr.c 5.10 10/26/99 17:20:56\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 # include "s_asg_expr.m"
00063
00064 # include "globals.h"
00065 # include "tokens.h"
00066 # include "sytb.h"
00067 # include "s_globals.h"
00068
00069 # include "s_asg_expr.h"
00070
00071 # if defined(_HOST_OS_UNICOS) || defined(_HOST_OS_MAX)
00072 # include <fortran.h>
00073 # endif
00074
00075 boolean has_present_opr;
00076
00077
00078
00079
00080
00081 static boolean array_construct_semantics(opnd_type *, expr_arg_type *);
00082 static boolean bin_array_syntax_check(expr_arg_type *, expr_arg_type *,
00083 expr_arg_type *, int, int);
00084
00085 static void make_logical_array_tmp(opnd_type *, expr_arg_type *);
00086 static void fold_nested_substrings(int);
00087 static boolean uplus_opr_handler(opnd_type *, expr_arg_type *);
00088 static boolean power_opr_handler(opnd_type *, expr_arg_type *);
00089 static boolean mult_opr_handler(opnd_type *, expr_arg_type *);
00090 static boolean minus_opr_handler(opnd_type *, expr_arg_type *);
00091 static boolean plus_opr_handler(opnd_type *, expr_arg_type *);
00092 static boolean concat_opr_handler(opnd_type *, expr_arg_type *);
00093 static boolean eq_opr_handler(opnd_type *, expr_arg_type *);
00094 static boolean lg_opr_handler(opnd_type *, expr_arg_type *);
00095 static boolean lt_opr_handler(opnd_type *, expr_arg_type *);
00096 static boolean not_opr_handler(opnd_type *, expr_arg_type *);
00097 static boolean and_opr_handler(opnd_type *, expr_arg_type *);
00098 static boolean defined_un_opr_handler(opnd_type *, expr_arg_type *);
00099 static boolean defined_bin_opr_handler(opnd_type *, expr_arg_type *);
00100 static boolean max_opr_handler(opnd_type *, expr_arg_type *);
00101 static boolean struct_opr_handler(opnd_type *, expr_arg_type *, int);
00102 static boolean struct_construct_opr_handler(opnd_type *, expr_arg_type *);
00103 static boolean array_construct_opr_handler(opnd_type *, expr_arg_type *);
00104 static boolean subscript_opr_handler(opnd_type *, expr_arg_type *, int);
00105 static boolean substring_opr_handler(opnd_type *, expr_arg_type *, int);
00106 static boolean triplet_opr_handler(opnd_type *, expr_arg_type *);
00107 static boolean dealloc_obj_opr_handler(opnd_type *, expr_arg_type *, int);
00108 static boolean alloc_obj_opr_handler(opnd_type *, expr_arg_type *, int);
00109 static boolean cvrt_opr_handler(opnd_type *, expr_arg_type *);
00110 static boolean paren_opr_handler(opnd_type *, expr_arg_type *);
00111 static boolean stmt_func_call_opr_handler(opnd_type *, expr_arg_type *);
00112 static int implied_do_depth(opnd_type *);
00113 static long64 outer_imp_do_count(opnd_type *);
00114 static void lower_ptr_asg(expr_arg_type *);
00115 # if defined(_F_MINUS_MINUS)
00116 static void translate_distant_ref1(opnd_type *, expr_arg_type *, int);
00117
00118 # if defined(_TARGET_OS_MAX)
00119 static void translate_t3e_distant_ref(opnd_type *, expr_arg_type *, int);
00120 static void translate_t3e_dv_component(opnd_type *, expr_arg_type *);
00121 static int capture_bounds_from_dv(int, int, int);
00122 # endif
00123
00124 static void translate_distant_dv_ref(opnd_type *, expr_arg_type *, int);
00125 static void translate_distant_ref2(opnd_type *, expr_arg_type *, int);
00126 static int set_up_pe_offset_attr(void);
00127 static void gen_bias_ref(opnd_type *);
00128 static void linearize_pe_dims(int, int, int, int, opnd_type *);
00129 # endif
00130 #ifdef KEY
00131 static boolean expr_sem_d(opnd_type *result_opnd, expr_arg_type *exp_desc,
00132 boolean derived_assign);
00133 static boolean expr_semantics_d (opnd_type *result_opnd,
00134 expr_arg_type *exp_desc, boolean derived_assign);
00135 #endif
00136
00137
00138 # if (defined(_HOST_OS_IRIX) || defined(_HOST_OS_LINUX) || defined(_HOST_OS_DARWIN))
00139 # pragma inline uplus_opr_handler
00140 # pragma inline power_opr_handler
00141 # pragma inline mult_opr_handler
00142 # pragma inline minus_opr_handler
00143 # pragma inline plus_opr_handler
00144 # pragma inline concat_opr_handler
00145 # pragma inline eq_opr_handler
00146 # pragma inline lg_opr_handler
00147 # pragma inline lt_opr_handler
00148 # pragma inline not_opr_handler
00149 # pragma inline and_opr_handler
00150 # pragma inline defined_un_opr_handler
00151 # pragma inline defined_bin_opr_handler
00152 # pragma inline max_opr_handler
00153 # pragma inline struct_opr_handler
00154 # pragma inline struct_construct_opr_handler
00155 # pragma inline array_construct_opr_handler
00156 # pragma inline subscript_opr_handler
00157 # pragma inline substring_opr_handler
00158 # pragma inline triplet_opr_handler
00159 # pragma inline dealloc_obj_opr_handler
00160 # pragma inline alloc_obj_opr_handler
00161 # pragma inline cvrt_opr_handler
00162 # pragma inline paren_opr_handler
00163 # pragma inline stmt_func_call_opr_handler
00164 # else
00165 # pragma _CRI inline uplus_opr_handler
00166 # pragma _CRI inline power_opr_handler
00167 # pragma _CRI inline mult_opr_handler
00168 # pragma _CRI inline minus_opr_handler
00169 # pragma _CRI inline plus_opr_handler
00170 # pragma _CRI inline concat_opr_handler
00171 # pragma _CRI inline eq_opr_handler
00172 # pragma _CRI inline lg_opr_handler
00173 # pragma _CRI inline lt_opr_handler
00174 # pragma _CRI inline not_opr_handler
00175 # pragma _CRI inline and_opr_handler
00176 # pragma _CRI inline defined_un_opr_handler
00177 # pragma _CRI inline defined_bin_opr_handler
00178 # pragma _CRI inline max_opr_handler
00179 # pragma _CRI inline struct_opr_handler
00180 # pragma _CRI inline struct_construct_opr_handler
00181 # pragma _CRI inline array_construct_opr_handler
00182 # pragma _CRI inline subscript_opr_handler
00183 # pragma _CRI inline substring_opr_handler
00184 # pragma _CRI inline triplet_opr_handler
00185 # pragma _CRI inline dealloc_obj_opr_handler
00186 # pragma _CRI inline alloc_obj_opr_handler
00187 # pragma _CRI inline cvrt_opr_handler
00188 # pragma _CRI inline paren_opr_handler
00189 # pragma _CRI inline stmt_func_call_opr_handler
00190 # endif
00191
00192
00193 #ifdef KEY
00194
00195
00196
00197 static boolean opnd_matches(opnd_type *op0, opnd_type *op1) {
00198 return op0->fld == op1->fld && op0->idx == op1->idx;
00199 }
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230 static void unbury_lhs_for_omp() {
00231
00232 if (curr_stmt_sh_idx == SCP_FIRST_SH_IDX(curr_scp_idx) ||
00233 IR_OPR(SH_IR_IDX(SH_PREV_IDX(curr_stmt_sh_idx))) != Atomic_Open_Mp_Opr) {
00234 return;
00235 }
00236 int stmt_idx = SH_IR_IDX(curr_stmt_sh_idx);
00237 int rhs_idx = IR_IDX_R(stmt_idx);
00238
00239 if (IR_FLD_R(stmt_idx) != IR_Tbl_Idx) {
00240 return;
00241 }
00242 operator_type operator = IR_OPR(rhs_idx);
00243
00244 if (operator != Plus_Opr && operator != Minus_Opr &&
00245 operator != Mult_Opr && operator != Div_Opr &&
00246 operator != And_Opr && operator != Or_Opr &&
00247 operator != Eqv_Opr && operator != Neqv_Opr) {
00248 return;
00249 }
00250 opnd_type *lhs_opnd = &(IR_OPND_L(stmt_idx));
00251
00252 if (opnd_matches(lhs_opnd, &(IR_OPND_L(rhs_idx)))) {
00253 return;
00254 }
00255
00256 if (opnd_matches(lhs_opnd, &(IR_OPND_R(rhs_idx)))) {
00257 return;
00258 }
00259
00260 operator_type alt_operator = operator;
00261 if (operator == Plus_Opr) {
00262 alt_operator = Minus_Opr;
00263 }
00264 else if (operator == Minus_Opr) {
00265 alt_operator = Plus_Opr;
00266 }
00267 else if (operator == Mult_Opr) {
00268 alt_operator = Div_Opr;
00269 }
00270 else if (operator == Div_Opr) {
00271 alt_operator = Mult_Opr;
00272 }
00273 else if (operator == Eqv_Opr) {
00274 alt_operator == Neqv_Opr;
00275 }
00276 else if (operator == Neqv_Opr) {
00277 alt_operator == Eqv_Opr;
00278 }
00279
00280 int parent_idx = rhs_idx;
00281 for (int node_idx = IR_IDX_L(parent_idx);
00282 IR_Tbl_Idx == IR_FLD_L(parent_idx) &&
00283 (operator == IR_OPR(node_idx) || alt_operator == IR_OPR(node_idx));
00284 parent_idx = node_idx, node_idx = IR_IDX_L(parent_idx)) {
00285
00286 if (opnd_matches(lhs_opnd, &(IR_OPND_L(node_idx))) &&
00287 (IR_OPR(node_idx) != Minus_Opr) && (IR_OPR(node_idx) != Div_Opr)) {
00288 opnd_type save_rhs = IR_OPND_R(stmt_idx);
00289 opnd_type save_right_opnd = IR_OPND_R(node_idx);
00290 IR_OPND_R(stmt_idx) = IR_OPND_L(parent_idx);
00291 IR_OPND_R(node_idx) = save_rhs;
00292 IR_OPND_L(parent_idx) = save_right_opnd;
00293 break;
00294 }
00295 }
00296 }
00297
00298 #endif
00299 #ifdef KEY
00300 static void help_assign_cpnts(int, int, Uint, int, fld_type, int, fld_type);
00301
00302 static void
00303 help_assign_array_of_structure(int line, int col, int idx_l, fld_type fld_l,
00304 int idx_r, fld_type fld_r) {
00305 opnd_type opnd_l, opnd_r;
00306 expr_arg_type exp_desc_l, exp_desc_r;
00307 int next_sh_idx = NULL_IDX;
00308 int placeholder_sh_idx = pre_gen_loops(line, col, &next_sh_idx);
00309 OPND_FLD(opnd_l) = fld_l;
00310 OPND_IDX(opnd_l) = idx_l;
00311 OPND_FLD(opnd_r) = fld_r;
00312 OPND_IDX(opnd_r) = idx_r;
00313 OPND_LINE_NUM(opnd_l) = OPND_LINE_NUM(opnd_r) = line;
00314 OPND_COL_NUM(opnd_l) = OPND_COL_NUM(opnd_r) = col;
00315 gen_loops(&opnd_l, &opnd_r, TRUE);
00316 help_assign_cpnts(line, col, IR_TYPE_IDX(OPND_IDX(opnd_l)), OPND_IDX(opnd_l),
00317 OPND_FLD(opnd_l), OPND_IDX(opnd_r), OPND_FLD(opnd_r));
00318 post_gen_loops(placeholder_sh_idx, next_sh_idx);
00319 }
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336 static void
00337 help_assign_cpnts(int line, int col, Uint type_idx,
00338 int lvalue_idx, fld_type lvalue_fld, int rvalue_idx, fld_type rvalue_fld) {
00339
00340 for (int sn_idx = ATT_FIRST_CPNT_IDX(TYP_IDX(type_idx));
00341 sn_idx != NULL_IDX;
00342 sn_idx = SN_SIBLING_LINK(sn_idx)) {
00343 boolean need_semantics = FALSE;
00344 int cpnt_attr_idx = SN_ATTR_IDX(sn_idx);
00345 int l_idx = do_make_struct_opr(line, col, lvalue_idx, lvalue_fld,
00346 cpnt_attr_idx);
00347
00348 int r_idx = do_make_struct_opr(line, col, rvalue_idx, rvalue_fld,
00349 cpnt_attr_idx);
00350 int new_ir_idx = NULL_IDX;
00351
00352
00353 if (ATD_ALLOCATABLE(cpnt_attr_idx)) {
00354 new_ir_idx = build_call(Assign_Allocatable_Idx, ASSIGN_ALLOCATABLE_ENTRY,
00355 gen_il(4, TRUE, line, col,
00356 IR_Tbl_Idx, pass_by_ref(IR_Tbl_Idx, l_idx, line, col),
00357 IR_Tbl_Idx, pass_by_ref(IR_Tbl_Idx, r_idx, line, col),
00358 CN_Tbl_Idx, CN_INTEGER_ONE_IDX,
00359 CN_Tbl_Idx, CN_INTEGER_ZERO_IDX),
00360 line, col);
00361 }
00362
00363 else if (allocatable_structure_component(cpnt_attr_idx)) {
00364
00365
00366
00367
00368 if (ATD_ARRAY_IDX(cpnt_attr_idx) != NULL_IDX) {
00369 help_assign_array_of_structure(line, col, l_idx, IR_Tbl_Idx, r_idx,
00370 IR_Tbl_Idx);
00371 }
00372
00373
00374
00375 else {
00376 help_assign_cpnts(line, col,
00377 ATD_TYPE_IDX(cpnt_attr_idx), l_idx, IR_Tbl_Idx, r_idx, IR_Tbl_Idx);
00378 }
00379 }
00380
00381
00382 else {
00383 new_ir_idx = gen_ir(IR_Tbl_Idx, l_idx, Asg_Opr,
00384 ATD_TYPE_IDX(cpnt_attr_idx), line, col, IR_Tbl_Idx, r_idx);
00385
00386 need_semantics = (ATD_ARRAY_IDX(cpnt_attr_idx) != NULL_IDX ||
00387 TYP_TYPE(ATD_TYPE_IDX(cpnt_attr_idx)) == Character);
00388 }
00389
00390 if (new_ir_idx != NULL_IDX) {
00391 gen_sh(After, Assignment_Stmt, line, col, FALSE, FALSE, TRUE);
00392 SH_IR_IDX(curr_stmt_sh_idx) = new_ir_idx;
00393 if (need_semantics) {
00394 assignment_stmt_semantics();
00395 }
00396 else {
00397 SH_P2_SKIP_ME(curr_stmt_sh_idx) = TRUE;
00398 }
00399 }
00400 }
00401 }
00402
00403 #endif
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420 void assignment_stmt_semantics (void)
00421
00422 {
00423 int asg_idx;
00424 int attr_idx;
00425 int col;
00426 expr_arg_type exp_desc_l;
00427 expr_arg_type exp_desc_r;
00428 opnd_type forall_tmp_opnd;
00429 opnd_type forall_tmp_opnd_l;
00430 boolean forall_dependence;
00431 expr_arg_type forall_exp_desc;
00432 int i;
00433 int ir_idx;
00434 int idx;
00435 char l_err_word[40];
00436 opnd_type l_opnd;
00437 int line;
00438 int list_idx;
00439 int label_idx;
00440 boolean ok = TRUE;
00441 opnd_type opnd;
00442 int opnd_col;
00443 int opnd_line;
00444 char r_err_word[40];
00445 opnd_type r_opnd;
00446 linear_type_type result_type;
00447 int save_curr_stmt_sh_idx;
00448 int save_where_ir_idx;
00449
00450
00451 TRACE (Func_Entry, "assignment_stmt_semantics", NULL);
00452
00453 #ifdef KEY
00454 unbury_lhs_for_omp();
00455 #endif
00456
00457 ir_idx = SH_IR_IDX(curr_stmt_sh_idx);
00458
00459 line = IR_LINE_NUM(ir_idx);
00460 col = IR_COL_NUM(ir_idx);
00461
00462 if (IR_OPR(ir_idx) == Asg_Opr) {
00463
00464
00465
00466
00467
00468 save_where_ir_idx = where_ir_idx;
00469 where_ir_idx = NULL_IDX;
00470
00471 if (active_forall_sh_idx) {
00472 defer_stmt_expansion = TRUE;
00473 }
00474
00475 xref_state = CIF_Symbol_Modification;
00476 COPY_OPND(l_opnd, IR_OPND_L(ir_idx));
00477 exp_desc_l.rank = 0;
00478 ok = expr_semantics(&l_opnd, &exp_desc_l);
00479 COPY_OPND(IR_OPND_L(ir_idx), l_opnd);
00480
00481 where_ir_idx = save_where_ir_idx;
00482
00483 if (IR_FLD_R(ir_idx) == IR_Tbl_Idx &&
00484 IR_OPR(IR_IDX_R(ir_idx)) == Call_Opr &&
00485 AT_IS_INTRIN(IR_IDX_L(IR_IDX_R(ir_idx))) &&
00486 (strcmp(AT_OBJ_NAME_PTR(IR_IDX_L(IR_IDX_R(ir_idx))), "NULL") == 0)) {
00487 ok = FALSE;
00488 PRINTMSG(IR_LINE_NUM_R(ir_idx), 1557, Error, IR_COL_NUM_R(ir_idx));
00489 }
00490
00491 if (! ok) {
00492
00493 }
00494 else if (exp_desc_l.constant) {
00495 ok = FALSE;
00496
00497 if (OPND_FLD(l_opnd) == AT_Tbl_Idx &&
00498 AT_OBJ_CLASS(OPND_IDX(l_opnd)) == Data_Obj &&
00499 ATD_SYMBOLIC_CONSTANT(OPND_IDX(l_opnd))) {
00500 PRINTMSG(IR_LINE_NUM(ir_idx), 1632, Error, IR_COL_NUM(ir_idx),
00501 AT_OBJ_NAME_PTR(OPND_IDX(l_opnd)));
00502 }
00503 else {
00504 PRINTMSG(IR_LINE_NUM(ir_idx), 326, Error, IR_COL_NUM(ir_idx));
00505 }
00506 }
00507 else if (SH_COMPILER_GEN(curr_stmt_sh_idx)) {
00508
00509
00510 }
00511 else if (! check_for_legal_define(&l_opnd)) {
00512 ok = FALSE;
00513 }
00514
00515 if (cif_flags & MISC_RECS) {
00516 cif_stmt_type_rec(TRUE,
00517 (exp_desc_l.rank == 0) ?
00518 CIF_Assignment_Stmt : CIF_Array_Assignment_Stmt,
00519 statement_number);
00520 }
00521
00522 xref_state = CIF_Symbol_Reference;
00523 COPY_OPND(r_opnd, IR_OPND_R(ir_idx));
00524 exp_desc_r.rank = 0;
00525 #ifdef KEY
00526 ok &= expr_semantics_d(&r_opnd, &exp_desc_r,
00527 (exp_desc_l.type == Structure));
00528 #else
00529 ok &= expr_semantics(&r_opnd, &exp_desc_r);
00530 #endif
00531 COPY_OPND(IR_OPND_R(ir_idx), r_opnd);
00532
00533 if (! ok) {
00534 goto EXIT;
00535 }
00536
00537 OPND_FLD(r_opnd) = IR_Tbl_Idx;
00538 OPND_IDX(r_opnd) = ir_idx;
00539
00540 if (exp_desc_l.rank == exp_desc_r.rank) {
00541 for (i = 0; i < exp_desc_r.rank; i++) {
00542 if (OPND_FLD(exp_desc_l.shape[i]) == CN_Tbl_Idx &&
00543 OPND_FLD(exp_desc_r.shape[i]) == CN_Tbl_Idx &&
00544 fold_relationals(OPND_IDX(exp_desc_l.shape[i]),
00545 OPND_IDX(exp_desc_r.shape[i]),
00546 Ne_Opr)) {
00547
00548
00549 PRINTMSG(IR_LINE_NUM(ir_idx), 253, Error,
00550 IR_COL_NUM(ir_idx));
00551 ok = FALSE;
00552 break;
00553 }
00554 }
00555 }
00556
00557 result_type = ASG_TYPE(exp_desc_l.linear_type, exp_desc_r.linear_type);
00558
00559 # if defined(_EXTENDED_CRI_CHAR_POINTER)
00560 if (result_type == CRI_Ch_Ptr_8 &&
00561 exp_desc_r.linear_type != CRI_Ch_Ptr_8) {
00562
00563 transform_cri_ch_ptr(&l_opnd);
00564 COPY_OPND(IR_OPND_L(ir_idx), l_opnd);
00565 }
00566 # endif
00567
00568 if (result_type != Err_Res &&
00569 result_type != Structure_Type &&
00570 (exp_desc_l.rank == exp_desc_r.rank || exp_desc_r.rank == 0)) {
00571
00572 if (ASG_EXTN(exp_desc_l.linear_type, exp_desc_r.linear_type)) {
00573
00574
00575 if (resolve_ext_opr(&r_opnd, FALSE, FALSE, FALSE,
00576 &ok,
00577 &exp_desc_l, &exp_desc_r)) {
00578
00579 SH_IR_IDX(curr_stmt_sh_idx) = OPND_IDX(r_opnd);
00580 SH_STMT_TYPE(curr_stmt_sh_idx) = Call_Stmt;
00581 goto CK_WHERE;
00582 }
00583 else if (exp_desc_r.type == Character ||
00584 exp_desc_r.linear_type == Short_Typeless_Const) {
00585
00586 find_opnd_line_and_column((opnd_type *) &IR_OPND_R(ir_idx),
00587 &opnd_line,
00588 &opnd_col);
00589
00590 if (exp_desc_r.type == Character) {
00591
00592 PRINTMSG(opnd_line, 161, Ansi, opnd_col);
00593 }
00594
00595 IR_IDX_R(ir_idx) = cast_typeless_constant(IR_IDX_R(ir_idx),
00596 exp_desc_l.type_idx,
00597 opnd_line,
00598 opnd_col);
00599 exp_desc_r.type_idx = exp_desc_l.type_idx;
00600 exp_desc_r.type = exp_desc_l.type;
00601 exp_desc_r.linear_type = exp_desc_l.linear_type;
00602 }
00603 }
00604
00605 IR_RANK(ir_idx) = exp_desc_l.rank;
00606
00607 IR_TYPE_IDX(ir_idx) = exp_desc_l.type_idx;
00608
00609 }
00610 else if (result_type == Structure_Type &&
00611 (exp_desc_l.rank == exp_desc_r.rank ||
00612 exp_desc_r.rank == 0) &&
00613 compare_derived_types(exp_desc_l.type_idx, exp_desc_r.type_idx)) {
00614
00615
00616 if (resolve_ext_opr(&r_opnd, FALSE, FALSE, FALSE,
00617 &ok,
00618 &exp_desc_l, &exp_desc_r)) {
00619 SH_IR_IDX(curr_stmt_sh_idx) = OPND_IDX(r_opnd);
00620 SH_STMT_TYPE(curr_stmt_sh_idx) = Call_Stmt;
00621 }
00622 else {
00623 IR_RANK(ir_idx) = exp_desc_l.rank;
00624
00625 IR_TYPE_IDX(ir_idx) = exp_desc_l.type_idx;
00626 }
00627 }
00628 else if (resolve_ext_opr(&r_opnd, TRUE, FALSE,
00629 (result_type == Err_Res ||
00630 (result_type == Structure_Type &&
00631 !compare_derived_types(exp_desc_l.type_idx,
00632 exp_desc_r.type_idx) )),
00633 &ok,
00634 &exp_desc_l, &exp_desc_r)) {
00635
00636 SH_IR_IDX(curr_stmt_sh_idx) = OPND_IDX(r_opnd);
00637 SH_STMT_TYPE(curr_stmt_sh_idx) = Call_Stmt;
00638 }
00639 else {
00640 ok = FALSE;
00641 }
00642
00643 if (ok &&
00644 SH_STMT_TYPE(curr_stmt_sh_idx) != Call_Stmt &&
00645 exp_desc_l.type == Integer &&
00646 exp_desc_r.type == Real) {
00647
00648 COPY_OPND(r_opnd, IR_OPND_R(ir_idx));
00649 look_for_real_div(&r_opnd);
00650 COPY_OPND(IR_OPND_R(ir_idx), r_opnd);
00651 }
00652
00653 # ifdef _TRANSFORM_CHAR_SEQUENCE
00654 if (ok &&
00655 SH_STMT_TYPE(curr_stmt_sh_idx) != Call_Stmt &&
00656 exp_desc_l.type == Structure &&
00657 ATT_CHAR_SEQ(TYP_IDX(exp_desc_l.type_idx))) {
00658
00659
00660
00661 COPY_OPND(l_opnd, IR_OPND_L(ir_idx));
00662 transform_char_sequence_ref(&l_opnd, exp_desc_l.type_idx);
00663 COPY_OPND(IR_OPND_L(ir_idx), l_opnd);
00664
00665 COPY_OPND(r_opnd, IR_OPND_R(ir_idx));
00666 transform_char_sequence_ref(&r_opnd, exp_desc_r.type_idx);
00667 COPY_OPND(IR_OPND_R(ir_idx), r_opnd);
00668 }
00669 # endif
00670
00671 CK_WHERE:
00672
00673 if (ok &&
00674 where_ir_idx > 0) {
00675
00676
00677
00678 if (SH_STMT_TYPE(curr_stmt_sh_idx) == Call_Stmt &&
00679 ! ATP_ELEMENTAL(IR_IDX_L(ir_idx))) {
00680 PRINTMSG(line, 1638, Error, col);
00681 ok = FALSE;
00682 }
00683 else if (! check_where_conformance(&exp_desc_l)) {
00684
00685 find_opnd_line_and_column((opnd_type *) &IR_OPND_L(ir_idx),
00686 &opnd_line,
00687 &opnd_col);
00688 PRINTMSG(opnd_line, 195, Error, opnd_col);
00689 ok = FALSE;
00690 }
00691
00692 if (ok) {
00693
00694 change_asg_to_where(ir_idx);
00695 }
00696 }
00697
00698
00699 if (active_forall_sh_idx) {
00700 defer_stmt_expansion = FALSE;
00701
00702 if (IR_OPR(ir_idx) != Call_Opr) {
00703
00704
00705 save_curr_stmt_sh_idx = curr_stmt_sh_idx;
00706 line = IR_LINE_NUM(ir_idx);
00707 col = IR_COL_NUM(ir_idx);
00708
00709 forall_dependence = FALSE;
00710 check_dependence(&forall_dependence,
00711 IR_OPND_L(ir_idx),
00712 IR_OPND_R(ir_idx));
00713
00714 if (forall_dependence) {
00715
00716
00717
00718
00719 forall_exp_desc = exp_desc_r;
00720 forall_exp_desc.type_idx = exp_desc_l.type_idx;
00721 forall_exp_desc.type = exp_desc_l.type;
00722 forall_exp_desc.linear_type = exp_desc_l.linear_type;
00723
00724 if (exp_desc_l.type == Character) {
00725
00726
00727 COPY_OPND(l_opnd, IR_OPND_L(ir_idx));
00728 attr_idx = find_base_attr(&l_opnd, &opnd_line, &opnd_col);
00729 forall_exp_desc.type_idx = ATD_TYPE_IDX(attr_idx);
00730 forall_exp_desc.type = Character;
00731 forall_exp_desc.linear_type =
00732 TYP_LINEAR(forall_exp_desc.type_idx);
00733 forall_exp_desc.char_len.fld =
00734 TYP_FLD(ATD_TYPE_IDX(attr_idx));
00735 forall_exp_desc.char_len.idx =
00736 TYP_IDX(ATD_TYPE_IDX(attr_idx));
00737 }
00738
00739 gen_forall_tmp(&forall_exp_desc,
00740 &forall_tmp_opnd,
00741 line,
00742 col,
00743 FALSE);
00744
00745 asg_idx = gen_ir(OPND_FLD(forall_tmp_opnd),
00746 OPND_IDX(forall_tmp_opnd),
00747 Asg_Opr, forall_exp_desc.type_idx, line, col,
00748 IR_FLD_R(ir_idx), IR_IDX_R(ir_idx));
00749
00750 gen_sh(Before, Assignment_Stmt, line, col, FALSE, FALSE, TRUE);
00751 SH_P2_SKIP_ME(SH_PREV_IDX(curr_stmt_sh_idx)) = TRUE;
00752 SH_IR_IDX(SH_PREV_IDX(curr_stmt_sh_idx)) = asg_idx;
00753 curr_stmt_sh_idx = SH_PREV_IDX(curr_stmt_sh_idx);
00754
00755 gen_forall_loops(curr_stmt_sh_idx, curr_stmt_sh_idx);
00756
00757 gen_forall_if_mask(curr_stmt_sh_idx, curr_stmt_sh_idx);
00758
00759 COPY_OPND(opnd, IR_OPND_R(asg_idx));
00760 process_deferred_functions(&opnd);
00761 COPY_OPND(IR_OPND_R(asg_idx), opnd);
00762
00763 curr_stmt_sh_idx = save_curr_stmt_sh_idx;
00764
00765 copy_subtree(&forall_tmp_opnd, &forall_tmp_opnd);
00766 COPY_OPND(IR_OPND_R(ir_idx), forall_tmp_opnd);
00767
00768 gen_forall_loops(curr_stmt_sh_idx, curr_stmt_sh_idx);
00769
00770 gen_forall_if_mask(curr_stmt_sh_idx, curr_stmt_sh_idx);
00771
00772 COPY_OPND(opnd, IR_OPND_L(ir_idx));
00773 process_deferred_functions(&opnd);
00774 COPY_OPND(IR_OPND_L(ir_idx), opnd);
00775 }
00776 else {
00777 gen_forall_loops(curr_stmt_sh_idx, curr_stmt_sh_idx);
00778
00779 gen_forall_if_mask(curr_stmt_sh_idx, curr_stmt_sh_idx);
00780
00781 COPY_OPND(opnd, IR_OPND_R(ir_idx));
00782 process_deferred_functions(&opnd);
00783 COPY_OPND(IR_OPND_R(ir_idx), opnd);
00784
00785 COPY_OPND(opnd, IR_OPND_L(ir_idx));
00786 process_deferred_functions(&opnd);
00787 COPY_OPND(IR_OPND_L(ir_idx), opnd);
00788 }
00789 }
00790 else {
00791 gen_forall_loops(curr_stmt_sh_idx, curr_stmt_sh_idx);
00792
00793 gen_forall_if_mask(curr_stmt_sh_idx, curr_stmt_sh_idx);
00794
00795 gen_opnd(&opnd,
00796 SH_IR_IDX(curr_stmt_sh_idx),
00797 IR_Tbl_Idx,
00798 line,
00799 col);
00800 process_deferred_functions(&opnd);
00801 SH_IR_IDX(curr_stmt_sh_idx) = OPND_IDX(opnd);
00802 }
00803 }
00804
00805 #ifdef KEY
00806
00807
00808
00809
00810
00811
00812
00813
00814
00815
00816
00817 int type_idx_l = exp_desc_l.type_idx;
00818 if (Structure == exp_desc_l.type &&
00819 ATT_ALLOCATABLE_CPNT(TYP_IDX(type_idx_l)) &&
00820 SH_STMT_TYPE(curr_stmt_sh_idx) == Assignment_Stmt &&
00821 IR_OPR(SH_IR_IDX(curr_stmt_sh_idx)) == Asg_Opr) {
00822
00823
00824 SH_STMT_TYPE(curr_stmt_sh_idx) = Continue_Stmt;
00825 int asg_ir_idx = SH_IR_IDX(curr_stmt_sh_idx);
00826 SH_IR_IDX(curr_stmt_sh_idx) = NULL_IDX;
00827
00828
00829
00830 if (exp_desc_l.rank) {
00831 help_assign_array_of_structure(line, col, IR_IDX_L(asg_ir_idx),
00832 IR_FLD_L(asg_ir_idx), IR_IDX_R(asg_ir_idx), IR_FLD_R(asg_ir_idx));
00833 }
00834
00835 else {
00836 help_assign_cpnts(line, col, exp_desc_l.type_idx,
00837 IR_IDX_L(asg_ir_idx), IR_FLD_L(asg_ir_idx), IR_IDX_R(asg_ir_idx),
00838 IR_FLD_R(asg_ir_idx));
00839 }
00840 }
00841 #endif
00842
00843
00844
00845
00846
00847
00848
00849 if (IR_RANK(ir_idx) > 0) {
00850 label_idx = gen_internal_lbl(line);
00851 NTR_IR_TBL(idx);
00852 IR_OPR(idx) = Label_Opr;
00853 IR_TYPE_IDX(idx) = TYPELESS_DEFAULT_TYPE;
00854 IR_LINE_NUM(idx) = line;
00855 IR_COL_NUM(idx) = col;
00856 IR_FLD_L(idx) = AT_Tbl_Idx;
00857 IR_IDX_L(idx) = label_idx;
00858 IR_COL_NUM_L(idx) = col;
00859 IR_LINE_NUM_L(idx) = line;
00860 AT_DEFINED(label_idx) = TRUE;
00861 AT_REFERENCED(label_idx) = Not_Referenced;
00862 ATL_TOP_OF_LOOP(label_idx) = TRUE;
00863 ATL_INFORM_ONLY(label_idx) = TRUE;
00864
00865 gen_sh(Before, Continue_Stmt, line, col, FALSE, FALSE, TRUE);
00866 SH_P2_SKIP_ME(SH_PREV_IDX(curr_stmt_sh_idx)) = TRUE;
00867 SH_IR_IDX(SH_PREV_IDX(curr_stmt_sh_idx)) = idx;
00868 ATL_DEF_STMT_IDX(label_idx) = SH_PREV_IDX(curr_stmt_sh_idx);
00869 set_directives_on_label(label_idx);
00870 }
00871 }
00872 else if (IR_OPR(ir_idx) == Ptr_Asg_Opr) {
00873
00874 if (IR_FLD_R(ir_idx) == IR_Tbl_Idx &&
00875 IR_OPR(IR_IDX_R(ir_idx)) == Call_Opr &&
00876 IR_LIST_CNT_R(IR_IDX_R(ir_idx)) == 0 &&
00877 AT_IS_INTRIN(IR_IDX_L(IR_IDX_R(ir_idx))) &&
00878 (strcmp(AT_OBJ_NAME_PTR(IR_IDX_L(IR_IDX_R(ir_idx))), "NULL") == 0)) {
00879
00880 NTR_IR_LIST_TBL(list_idx);
00881 attr_idx = find_base_attr(&(IR_OPND_L(ir_idx)), &line, &col);
00882 IL_FLD(list_idx) = AT_Tbl_Idx;
00883 IL_IDX(list_idx) = attr_idx;
00884 IL_LINE_NUM(list_idx) = IR_LINE_NUM(ir_idx);
00885 IL_COL_NUM(list_idx) = IR_COL_NUM(ir_idx);
00886
00887 IR_IDX_R(IR_IDX_R(ir_idx)) = list_idx;
00888 IR_FLD_R(IR_IDX_R(ir_idx)) = IL_Tbl_Idx;
00889 IR_LIST_CNT_R(IR_IDX_R(ir_idx)) = 1;
00890 }
00891
00892 IR_TYPE_IDX(ir_idx) = TYPELESS_DEFAULT_TYPE;
00893
00894 xref_state = CIF_Symbol_Modification;
00895 COPY_OPND(l_opnd, IR_OPND_L(ir_idx));
00896 exp_desc_l.rank = 0;
00897 ok = expr_semantics(&l_opnd, &exp_desc_l);
00898 COPY_OPND(IR_OPND_L(ir_idx), l_opnd);
00899
00900 if (! ok) {
00901 goto EXIT;
00902 }
00903
00904 if (! exp_desc_l.pointer) {
00905 attr_idx = find_base_attr(&l_opnd, &line, &col);
00906 PRINTMSG(line, 417, Error, col);
00907 ok = FALSE;
00908 }
00909 #ifdef KEY
00910
00911
00912 if (exp_desc_l.constant) {
00913 PRINTMSG(line, 326, Error, col);
00914 ok = FALSE;
00915 }
00916 #endif
00917
00918 #ifdef KEY
00919 ok &= check_for_legal_assignment_define(&l_opnd,
00920 IR_OPR(ir_idx) == Ptr_Asg_Opr);
00921 #else
00922 ok &= check_for_legal_define(&l_opnd);
00923 #endif
00924
00925 attr_idx = find_base_attr(&l_opnd, &line, &col);
00926
00927 if (attr_idx &&
00928 AT_OBJ_CLASS(attr_idx) == Data_Obj) {
00929 ATD_PTR_ASSIGNED(attr_idx) = TRUE;
00930 }
00931
00932 # ifdef _F_MINUS_MINUS
00933
00934
00935 if (ok &&
00936 dump_flags.f_minus_minus &&
00937 AT_OBJ_CLASS(attr_idx) == Data_Obj &&
00938 ATD_CLASS(attr_idx) == Struct_Component) {
00939
00940 attr_idx = find_left_attr(&l_opnd);
00941
00942 if (ATD_PE_ARRAY_IDX(attr_idx)) {
00943
00944 PRINTMSG(line, 1572, Error, col);
00945 }
00946 }
00947 # endif
00948
00949
00950
00951
00952
00953 if (cif_flags & MISC_RECS) {
00954 cif_stmt_type_rec(TRUE, CIF_Assignment_Stmt, statement_number);
00955 }
00956
00957 xref_state = CIF_Symbol_Reference;
00958 COPY_OPND(r_opnd, IR_OPND_R(ir_idx));
00959 exp_desc_r.rank = 0;
00960 #ifdef KEY
00961
00962 int save_constant_ptr_ok = constant_ptr_ok;
00963 constant_ptr_ok = TRUE;
00964 #endif
00965 ok = expr_semantics(&r_opnd, &exp_desc_r)
00966 && ok;
00967 #ifdef KEY
00968 constant_ptr_ok = save_constant_ptr_ok;
00969 #endif
00970 COPY_OPND(IR_OPND_R(ir_idx), r_opnd);
00971
00972 if (! ok) {
00973 goto EXIT;
00974 }
00975
00976 if (OPND_FLD(r_opnd) == AT_Tbl_Idx) {
00977
00978 if (AT_OBJ_CLASS(OPND_IDX(r_opnd)) == Data_Obj &&
00979 !ATD_POINTER(OPND_IDX(r_opnd)) && !ATD_TARGET(OPND_IDX(r_opnd))) {
00980 PRINTMSG(OPND_LINE_NUM(r_opnd), 418, Error, OPND_COL_NUM(r_opnd));
00981 ok = FALSE;
00982 }
00983
00984 if (AT_OBJ_CLASS(OPND_IDX(r_opnd)) == Data_Obj &&
00985 ATD_PURE(OPND_IDX(r_opnd))) {
00986 PRINTMSG(OPND_LINE_NUM(r_opnd), 1270, Error, OPND_COL_NUM(r_opnd),
00987 AT_OBJ_NAME_PTR(OPND_IDX(r_opnd)),
00988 ATP_PURE(SCP_ATTR_IDX(curr_scp_idx)) ? "pure":"elemental");
00989 ok = FALSE;
00990 }
00991 }
00992 else if (OPND_FLD(r_opnd) == IR_Tbl_Idx) {
00993
00994 if (IR_OPR(OPND_IDX(r_opnd)) == Call_Opr) {
00995
00996 if (!ATD_POINTER(ATP_RSLT_IDX(IR_IDX_L(OPND_IDX(r_opnd))))) {
00997 PRINTMSG(IR_LINE_NUM_L(OPND_IDX(r_opnd)), 421, Error,
00998 IR_COL_NUM_L(OPND_IDX(r_opnd)));
00999 ok = FALSE;
01000 }
01001 }
01002 else if (exp_desc_r.reference ||
01003 exp_desc_r.tmp_reference) {
01004 attr_idx = find_base_attr(&r_opnd, &line, &col);
01005
01006 if (! exp_desc_r.pointer && ! exp_desc_r.target) {
01007 PRINTMSG(line, 418, Error, col);
01008 ok = FALSE;
01009 }
01010 else {
01011 if (exp_desc_r.rank != 0) {
01012
01013
01014
01015 if (exp_desc_r.vector_subscript) {
01016
01017
01018
01019 PRINTMSG(IR_LINE_NUM(OPND_IDX(r_opnd)), 420, Error,
01020 IR_COL_NUM(OPND_IDX(r_opnd)));
01021 ok = FALSE;
01022 }
01023 }
01024
01025 if (IR_OPR(OPND_IDX(r_opnd)) == Dv_Deref_Opr &&
01026 IR_FLD_L(OPND_IDX(r_opnd)) == AT_Tbl_Idx &&
01027 AT_OBJ_CLASS(IR_IDX_L(OPND_IDX(r_opnd))) == Data_Obj &&
01028 ATD_PURE(IR_IDX_L(OPND_IDX(r_opnd)))) {
01029 ok = FALSE;
01030 PRINTMSG(IR_COL_NUM_L(OPND_IDX(r_opnd)), 1270, Error,
01031 IR_COL_NUM_L(OPND_IDX(r_opnd)),
01032 AT_OBJ_NAME_PTR(IR_IDX_L(OPND_IDX(r_opnd))),
01033 ATP_PURE(SCP_ATTR_IDX(curr_scp_idx)) ?
01034 "pure" : "elemental");
01035 }
01036 else {
01037
01038 if (AT_OBJ_CLASS(attr_idx) == Data_Obj && ATD_PURE(attr_idx)){
01039 find_opnd_line_and_column(&r_opnd, &opnd_line, &opnd_col);
01040 ok = FALSE;
01041 PRINTMSG(opnd_line, 1270, Error, opnd_col,
01042 AT_OBJ_NAME_PTR(attr_idx),
01043 ATP_PURE(SCP_ATTR_IDX(curr_scp_idx)) ?
01044 "pure" : "elemental");
01045 }
01046 }
01047 }
01048 }
01049 else {
01050 find_opnd_line_and_column(&r_opnd, &opnd_line, &opnd_col);
01051 PRINTMSG(opnd_line, 421, Error, opnd_col);
01052 ok = FALSE;
01053 }
01054 }
01055 else {
01056 find_opnd_line_and_column(&r_opnd, &opnd_line, &opnd_col);
01057 PRINTMSG(opnd_line, 418, Error, opnd_col);
01058 ok = FALSE;
01059 }
01060
01061 if (ok) {
01062
01063 if (exp_desc_r.rank != exp_desc_l.rank) {
01064
01065 PRINTMSG(IR_LINE_NUM(ir_idx), 431, Error, IR_COL_NUM(ir_idx));
01066 ok = FALSE;
01067 }
01068
01069 if (exp_desc_r.type != exp_desc_l.type ||
01070 (exp_desc_r.type == Structure &&
01071 !compare_derived_types(exp_desc_r.type_idx,exp_desc_l.type_idx))){
01072 r_err_word[0] = '\0';
01073 l_err_word[0] = '\0';
01074
01075 strcat(r_err_word, get_basic_type_str(exp_desc_r.type_idx));
01076
01077 strcat(l_err_word, get_basic_type_str(exp_desc_l.type_idx));
01078
01079 PRINTMSG(IR_LINE_NUM(ir_idx), 432, Error,
01080 IR_COL_NUM(ir_idx),
01081 r_err_word,
01082 l_err_word);
01083 ok = FALSE;
01084 }
01085
01086 if (exp_desc_r.type == exp_desc_l.type &&
01087 exp_desc_r.type != Character &&
01088 exp_desc_r.type != Structure &&
01089 exp_desc_r.linear_type != exp_desc_l.linear_type) {
01090
01091 PRINTMSG(IR_LINE_NUM(ir_idx), 419, Error, IR_COL_NUM(ir_idx));
01092 ok = FALSE;
01093 }
01094 else if (exp_desc_r.type == exp_desc_l.type &&
01095 exp_desc_r.type == Character &&
01096 exp_desc_r.char_len.fld == CN_Tbl_Idx &&
01097 exp_desc_l.char_len.fld == CN_Tbl_Idx &&
01098 fold_relationals(exp_desc_r.char_len.idx,
01099 exp_desc_l.char_len.idx,
01100 Ne_Opr)) {
01101
01102 PRINTMSG(IR_LINE_NUM(ir_idx), 853, Error, IR_COL_NUM(ir_idx));
01103 ok = FALSE;
01104 }
01105 }
01106
01107 if (ok) {
01108
01109 if (active_forall_sh_idx) {
01110 defer_stmt_expansion = FALSE;
01111
01112 save_curr_stmt_sh_idx = curr_stmt_sh_idx;
01113 line = IR_LINE_NUM(ir_idx);
01114 col = IR_COL_NUM(ir_idx);
01115
01116 forall_exp_desc = exp_desc_l;
01117 gen_forall_tmp(&forall_exp_desc, &forall_tmp_opnd,
01118 line, col, TRUE);
01119
01120 copy_subtree(&forall_tmp_opnd, &forall_tmp_opnd_l);
01121 asg_idx = gen_ir(OPND_FLD(forall_tmp_opnd_l),
01122 OPND_IDX(forall_tmp_opnd_l),
01123 Ptr_Asg_Opr, exp_desc_r.type_idx, line, col,
01124 IR_FLD_R(ir_idx), IR_IDX_R(ir_idx));
01125
01126 gen_sh(Before, Assignment_Stmt, line, col, FALSE, FALSE, TRUE);
01127 SH_P2_SKIP_ME(SH_PREV_IDX(curr_stmt_sh_idx)) = TRUE;
01128 SH_IR_IDX(SH_PREV_IDX(curr_stmt_sh_idx)) = asg_idx;
01129 curr_stmt_sh_idx = SH_PREV_IDX(curr_stmt_sh_idx);
01130
01131 gen_forall_loops(curr_stmt_sh_idx, curr_stmt_sh_idx);
01132
01133 gen_forall_if_mask(curr_stmt_sh_idx, curr_stmt_sh_idx);
01134
01135 if (OPND_FLD(forall_tmp_opnd_l) == IR_Tbl_Idx) {
01136 if (IR_OPR(OPND_IDX(forall_tmp_opnd_l)) == Whole_Substring_Opr) {
01137 COPY_OPND(forall_tmp_opnd_l,
01138 IR_OPND_L(OPND_IDX(forall_tmp_opnd_l)));
01139 }
01140
01141 if (IR_OPR(OPND_IDX(forall_tmp_opnd_l)) == Whole_Subscript_Opr) {
01142 COPY_OPND(forall_tmp_opnd_l,
01143 IR_OPND_L(OPND_IDX(forall_tmp_opnd_l)));
01144 }
01145
01146 if (IR_OPR(OPND_IDX(forall_tmp_opnd_l)) == Dv_Deref_Opr) {
01147 COPY_OPND(forall_tmp_opnd_l,
01148 IR_OPND_L(OPND_IDX(forall_tmp_opnd_l)));
01149 }
01150 }
01151
01152 copy_subtree(&forall_tmp_opnd_l, &forall_tmp_opnd_l);
01153
01154 attr_idx = find_base_attr(&forall_tmp_opnd_l,&opnd_line,&opnd_col);
01155
01156 gen_dv_whole_def_init(&forall_tmp_opnd_l,
01157 attr_idx,
01158 Before);
01159
01160 COPY_OPND(opnd, IR_OPND_R(asg_idx));
01161 process_deferred_functions(&opnd);
01162 COPY_OPND(IR_OPND_R(asg_idx), opnd);
01163
01164 lower_ptr_asg(&exp_desc_r);
01165
01166 curr_stmt_sh_idx = save_curr_stmt_sh_idx;
01167
01168 COPY_OPND(IR_OPND_R(ir_idx), forall_tmp_opnd);
01169
01170 gen_forall_loops(curr_stmt_sh_idx, curr_stmt_sh_idx);
01171
01172 gen_forall_if_mask(curr_stmt_sh_idx, curr_stmt_sh_idx);
01173
01174 COPY_OPND(opnd, IR_OPND_L(ir_idx));
01175 process_deferred_functions(&opnd);
01176 COPY_OPND(IR_OPND_L(ir_idx), opnd);
01177
01178 lower_ptr_asg(&forall_exp_desc);
01179 }
01180 else {
01181 lower_ptr_asg(&exp_desc_r);
01182 }
01183 }
01184 }
01185
01186 EXIT:
01187
01188 defer_stmt_expansion = FALSE;
01189
01190 TRACE (Func_Exit, "assignment_stmt_semantics", NULL);
01191
01192 return;
01193
01194 }
01195
01196
01197
01198
01199
01200
01201
01202
01203
01204
01205
01206
01207
01208
01209
01210
01211
01212 static void lower_ptr_asg(expr_arg_type *exp_desc_r)
01213
01214 {
01215 int ir_idx;
01216 opnd_type l_opnd;
01217 opnd_type r_opnd;
01218 int sh_idx;
01219
01220 TRACE (Func_Entry, "lower_ptr_asg", NULL);
01221
01222 ir_idx = SH_IR_IDX(curr_stmt_sh_idx);
01223
01224 if (IR_FLD_L(ir_idx) == IR_Tbl_Idx) {
01225 if (IR_OPR(IR_IDX_L(ir_idx)) == Whole_Substring_Opr) {
01226 COPY_OPND(IR_OPND_L(ir_idx), IR_OPND_L(IR_IDX_L(ir_idx)));
01227 }
01228
01229 if (IR_OPR(IR_IDX_L(ir_idx)) == Whole_Subscript_Opr) {
01230 COPY_OPND(IR_OPND_L(ir_idx), IR_OPND_L(IR_IDX_L(ir_idx)));
01231 }
01232
01233 if (IR_OPR(IR_IDX_L(ir_idx)) == Dv_Deref_Opr) {
01234 COPY_OPND(IR_OPND_L(ir_idx), IR_OPND_L(IR_IDX_L(ir_idx)));
01235 }
01236 }
01237 else {
01238 # ifdef _DEBUG
01239 print_ir(ir_idx);
01240 # endif
01241 PRINTMSG(IR_LINE_NUM(ir_idx), 973, Internal,
01242 IR_COL_NUM(ir_idx));
01243 }
01244
01245
01246
01247 COPY_OPND(l_opnd, IR_OPND_L(ir_idx));
01248 COPY_OPND(r_opnd, IR_OPND_R(ir_idx));
01249
01250 if (exp_desc_r->pointer || exp_desc_r->allocatable) {
01251 sh_idx = curr_stmt_sh_idx;
01252 ptr_assign_from_ptr(&l_opnd, &r_opnd);
01253
01254
01255
01256
01257
01258
01259 if (SH_LABELED(sh_idx)) {
01260
01261 # ifdef _DEBUG
01262 if (IR_OPR(SH_IR_IDX(sh_idx)) != Ptr_Asg_Opr) {
01263 PRINTMSG(IR_LINE_NUM(ir_idx), 974, Internal,
01264 IR_COL_NUM(ir_idx));
01265 }
01266 # endif
01267
01268 SH_STMT_TYPE(sh_idx) = Continue_Stmt;
01269 SH_IR_IDX(sh_idx) = NULL_IDX;
01270 SH_COMPILER_GEN(sh_idx) = TRUE;
01271
01272
01273
01274
01275
01276
01277 if (SH_LOOP_END(sh_idx)) {
01278 SH_LOOP_END(curr_stmt_sh_idx) = TRUE;
01279 SH_PARENT_BLK_IDX(curr_stmt_sh_idx) =
01280 SH_PARENT_BLK_IDX(sh_idx);
01281 }
01282 }
01283 else {
01284
01285 # ifdef _DEBUG
01286 if (IR_OPR(SH_IR_IDX(curr_stmt_sh_idx)) != Ptr_Asg_Opr) {
01287 PRINTMSG(IR_LINE_NUM(ir_idx), 974, Internal,
01288 IR_COL_NUM(ir_idx));
01289 }
01290 # endif
01291
01292 remove_sh(curr_stmt_sh_idx);
01293 curr_stmt_sh_idx = SH_PREV_IDX(curr_stmt_sh_idx);
01294 }
01295 }
01296 else if (exp_desc_r->target) {
01297 dope_vector_setup(&r_opnd, exp_desc_r, &l_opnd, TRUE);
01298 }
01299
01300 TRACE (Func_Exit, "lower_ptr_asg", NULL);
01301
01302 return;
01303
01304 }
01305
01306
01307
01308
01309
01310
01311
01312
01313
01314
01315
01316
01317
01318
01319
01320
01321
01322
01323 boolean expr_semantics (opnd_type *result_opnd,
01324 expr_arg_type *exp_desc)
01325 #ifdef KEY
01326 {
01327 return expr_semantics_d(result_opnd, exp_desc, FALSE);
01328 }
01329
01330
01331
01332
01333
01334 static boolean expr_semantics_d (opnd_type *result_opnd,
01335 expr_arg_type *exp_desc,
01336 boolean derived_assign)
01337 #endif
01338
01339 {
01340 boolean ok = TRUE;
01341 opnd_type opnd;
01342 boolean save_check_type_conversion;
01343 int save_target_array_idx;
01344 opnd_type save_init_target_opnd;
01345 int save_target_char_len_idx;
01346 int save_target_type_idx;
01347
01348
01349 TRACE (Func_Entry, "expr_semantics", NULL);
01350
01351 save_check_type_conversion = check_type_conversion;
01352 save_target_array_idx = target_array_idx;
01353 COPY_OPND(save_init_target_opnd, init_target_opnd);
01354 save_target_char_len_idx = target_char_len_idx;
01355 save_target_type_idx = target_type_idx;
01356
01357 check_type_conversion = FALSE;
01358 target_array_idx = NULL_IDX;
01359 init_target_opnd = null_opnd;
01360
01361 target_char_len_idx = NULL_IDX;
01362 target_type_idx = NULL_IDX;
01363
01364 #ifdef KEY
01365 ok = expr_sem_d(result_opnd, exp_desc, derived_assign);
01366 #else
01367 ok = expr_sem(result_opnd, exp_desc);
01368 #endif
01369
01370 check_type_conversion = save_check_type_conversion;
01371 target_array_idx = save_target_array_idx;
01372 COPY_OPND(init_target_opnd, save_init_target_opnd);
01373 target_char_len_idx = save_target_char_len_idx;
01374 target_type_idx = save_target_type_idx;
01375
01376 if (ok &&
01377 exp_desc->foldable &&
01378 ((OPND_FLD((*result_opnd)) != CN_Tbl_Idx &&
01379 OPND_FLD((*result_opnd)) != AT_Tbl_Idx &&
01380 (OPND_FLD((*result_opnd)) != IR_Tbl_Idx ||
01381 (IR_OPR(OPND_IDX((*result_opnd))) != Whole_Subscript_Opr &&
01382 (IR_OPR(OPND_IDX((*result_opnd))) != Whole_Substring_Opr ||
01383 IR_FLD_L(OPND_IDX((*result_opnd))) != IR_Tbl_Idx ||
01384 IR_OPR(IR_IDX_L(OPND_IDX((*result_opnd)))) !=
01385 Whole_Subscript_Opr)))) ||
01386 check_type_conversion == TRUE ||
01387 OPND_FLD(init_target_opnd) != NO_Tbl_Idx ||
01388 target_array_idx != NULL_IDX)) {
01389
01390 COPY_OPND(opnd, (*result_opnd));
01391 ok = fold_aggragate_expression(&opnd, exp_desc, FALSE) && ok;
01392 COPY_OPND((*result_opnd), opnd);
01393 }
01394
01395 TRACE (Func_Exit, "expr_semantics", NULL);
01396
01397 return(ok);
01398
01399 }
01400
01401
01402
01403
01404
01405
01406
01407
01408
01409
01410
01411
01412
01413
01414
01415
01416
01417
01418
01419
01420
01421
01422
01423
01424
01425
01426
01427
01428
01429
01430
01431
01432
01433
01434
01435
01436
01437
01438
01439
01440
01441
01442
01443
01444
01445
01446
01447
01448
01449
01450
01451
01452
01453
01454
01455
01456
01457
01458
01459
01460
01461
01462
01463
01464
01465
01466
01467
01468
01469
01470
01471
01472
01473
01474
01475
01476
01477
01478
01479
01480
01481
01482
01483
01484
01485
01486
01487
01488
01489
01490
01491
01492
01493
01494
01495
01496
01497
01498
01499
01500
01501
01502
01503
01504
01505
01506
01507
01508
01509
01510
01511
01512 boolean expr_sem (opnd_type *result_opnd,
01513 expr_arg_type *exp_desc)
01514 #ifdef KEY
01515 {
01516 return expr_sem_d(result_opnd, exp_desc, FALSE);
01517 }
01518
01519
01520
01521
01522
01523 static boolean expr_sem_d(opnd_type *result_opnd,
01524 expr_arg_type *exp_desc,
01525 boolean derived_assign)
01526 #endif
01527
01528 {
01529 int al_list_idx;
01530 int attr_idx;
01531 int col;
01532 int dv_idx;
01533 expr_arg_type exp_desc_l;
01534 expr_arg_type exp_desc_r;
01535 boolean host_associated;
01536 int ir_idx = NULL_IDX;
01537 int line;
01538 int list_idx;
01539 #ifdef KEY
01540 int msg_num = 0;
01541 #else
01542 int msg_num;
01543 #endif
01544 opnd_type opnd;
01545 int rank_in;
01546 boolean junk;
01547 boolean save_in_call_list;
01548 boolean save_in_constructor;
01549 boolean save_no_sub_or_deref;
01550 boolean save_insert_subs_ok;
01551 boolean ok = TRUE;
01552
01553
01554 TRACE (Func_Entry, "expr_sem", NULL);
01555
01556
01557
01558
01559 rank_in = exp_desc->rank;
01560 (*exp_desc) = init_exp_desc;
01561 #ifdef KEY
01562 exp_desc->derived_assign = derived_assign;
01563 #endif
01564 exp_desc->linear_type = TYPELESS_DEFAULT_TYPE;
01565 exp_desc->type_idx = TYPELESS_DEFAULT_TYPE;
01566
01567 find_opnd_line_and_column(result_opnd, &line, &col);
01568
01569 switch (OPND_FLD((*result_opnd))) {
01570
01571 case NO_Tbl_Idx :
01572 break;
01573
01574 case CN_Tbl_Idx:
01575
01576 exp_desc->type_idx = CN_TYPE_IDX(OPND_IDX((*result_opnd)));
01577 exp_desc->type = TYP_TYPE(exp_desc->type_idx);
01578 exp_desc->linear_type = TYP_LINEAR(exp_desc->type_idx);
01579
01580 if (exp_desc->type == Character) {
01581 exp_desc->char_len.fld = TYP_FLD(exp_desc->type_idx);
01582 exp_desc->char_len.idx = TYP_IDX(exp_desc->type_idx);
01583 OPND_LINE_NUM(exp_desc->char_len) = line;
01584 OPND_COL_NUM(exp_desc->char_len) = col;
01585 }
01586
01587 if (exp_desc->type == Character &&
01588 compare_cn_and_value(TYP_IDX(exp_desc->type_idx),
01589 MAX_CHARS_IN_TYPELESS,
01590 Le_Opr)) {
01591 exp_desc->linear_type = Short_Char_Const;
01592 }
01593
01594 exp_desc->rank = 0;
01595 exp_desc->constant = TRUE;
01596 exp_desc->foldable = TRUE;
01597 exp_desc->will_fold_later = TRUE;
01598 break;
01599
01600 case AT_Tbl_Idx :
01601
01602 attr_idx = OPND_IDX((*result_opnd));
01603 AT_LOCKED_IN(attr_idx) = TRUE;
01604 host_associated = FALSE;
01605
01606
01607
01608 if (expr_mode == Restricted_Imp_Do_Expr) {
01609
01610 if (in_implied_do &&
01611 AT_OBJ_CLASS(attr_idx) == Data_Obj) {
01612
01613 while (AT_ATTR_LINK(attr_idx) &&
01614 ! AT_IGNORE_ATTR_LINK(attr_idx)) {
01615 attr_idx = AT_ATTR_LINK(attr_idx);
01616 AT_LOCKED_IN(attr_idx) = TRUE;
01617 host_associated = TRUE;
01618 }
01619
01620 if (AT_ATTR_LINK(attr_idx)) {
01621 attr_idx = AT_ATTR_LINK(attr_idx);
01622 AT_LOCKED_IN(attr_idx) = TRUE;
01623 }
01624 }
01625 else {
01626
01627 while (AT_ATTR_LINK(attr_idx) &&
01628 ! AT_IGNORE_ATTR_LINK(attr_idx)) {
01629
01630 if (AT_OBJ_CLASS(attr_idx) == Data_Obj &&
01631 ATD_IMP_DO_LCV(attr_idx)) {
01632 break;
01633 }
01634
01635 attr_idx = AT_ATTR_LINK(attr_idx);
01636 AT_LOCKED_IN(attr_idx) = TRUE;
01637 }
01638 }
01639
01640 if (AT_NOT_VISIBLE(attr_idx)) {
01641 PRINTMSG(line, 486, Error,
01642 col,
01643 AT_OBJ_NAME_PTR(attr_idx),
01644 AT_OBJ_NAME_PTR(AT_MODULE_IDX((attr_idx))));
01645 ok = FALSE;
01646 break;
01647 }
01648
01649 if (! AT_DCL_ERR(attr_idx)) {
01650
01651 if (AT_OBJ_CLASS(attr_idx) != Data_Obj ||
01652 (ATD_CLASS(attr_idx) != Constant &&
01653 ATD_CLASS(attr_idx) != Struct_Component &&
01654 ! ATD_IMP_DO_LCV(attr_idx))) {
01655 OPND_IDX((*result_opnd)) = attr_idx;
01656 PRINTMSG(line, 658, Error, col, AT_OBJ_NAME_PTR(attr_idx));
01657 ok = FALSE;
01658 break;
01659 }
01660 }
01661 }
01662 else if (in_implied_do &&
01663 AT_OBJ_CLASS(attr_idx) == Data_Obj) {
01664
01665 while (AT_ATTR_LINK(attr_idx) &&
01666 ! AT_IGNORE_ATTR_LINK(attr_idx)) {
01667 attr_idx = AT_ATTR_LINK(attr_idx);
01668 AT_LOCKED_IN(attr_idx) = TRUE;
01669 host_associated = TRUE;
01670 }
01671
01672 if (AT_ATTR_LINK(attr_idx)) {
01673 attr_idx = AT_ATTR_LINK(attr_idx);
01674 AT_LOCKED_IN(attr_idx) = TRUE;
01675 }
01676
01677
01678 if (ATD_IMP_DO_LCV(attr_idx) &&
01679 constructor_level > ATD_TMP_IDX(attr_idx)) {
01680 constructor_level = ATD_TMP_IDX(attr_idx);
01681 }
01682 }
01683 else {
01684 while (AT_ATTR_LINK(attr_idx) &&
01685 ! AT_IGNORE_ATTR_LINK(attr_idx)) {
01686
01687 attr_idx = AT_ATTR_LINK(attr_idx);
01688 AT_LOCKED_IN(attr_idx) = TRUE;
01689 host_associated = TRUE;
01690 }
01691
01692 if (AT_ATTR_LINK(attr_idx) &&
01693 AT_OBJ_CLASS(AT_ATTR_LINK(attr_idx)) == Data_Obj &&
01694 ATD_FORALL_INDEX(AT_ATTR_LINK(attr_idx))) {
01695
01696 attr_idx = AT_ATTR_LINK(attr_idx);
01697 AT_LOCKED_IN(attr_idx) = TRUE;
01698 }
01699 }
01700
01701 if (AT_NOT_VISIBLE(attr_idx)) {
01702 PRINTMSG(line, 486, Error,
01703 col,
01704 AT_OBJ_NAME_PTR(attr_idx),
01705 AT_OBJ_NAME_PTR(AT_MODULE_IDX((attr_idx))));
01706 ok = FALSE;
01707 break;
01708 }
01709
01710 if (expr_mode == Data_Stmt_Target_Expr &&
01711 (AT_OBJ_CLASS(attr_idx) != Data_Obj ||
01712 (ATD_CLASS(attr_idx) != Constant &&
01713 ATD_CLASS(attr_idx) != Struct_Component))) {
01714
01715 PRINTMSG(line, 705, Error, col, AT_OBJ_NAME_PTR(attr_idx));
01716 ok = FALSE;
01717 }
01718
01719 OPND_IDX((*result_opnd)) = attr_idx;
01720
01721 if (! in_component_ref &&
01722 (cif_flags & XREF_RECS) != 0 &&
01723 (AT_OBJ_CLASS(attr_idx) != Data_Obj ||
01724 ATD_CLASS(attr_idx) != Dummy_Argument ||
01725 ! ATD_PARENT_OBJECT(attr_idx) ||
01726 ! ATD_SF_DARG(attr_idx)) &&
01727 xref_state != CIF_No_Usage_Rec) {
01728
01729 if (in_call_list) {
01730 cif_usage_rec(attr_idx, AT_Tbl_Idx, line, col,
01731 CIF_Symbol_Is_Actual_Arg);
01732 }
01733 else {
01734 cif_usage_rec(attr_idx, AT_Tbl_Idx, line, col, xref_state);
01735 }
01736 }
01737
01738 exp_desc->cif_id = AT_CIF_SYMBOL_ID(attr_idx);
01739
01740 if (AT_DCL_ERR(attr_idx)) {
01741 ok = FALSE;
01742 }
01743
01744 if (AT_OPTIONAL(attr_idx)) {
01745 exp_desc->optional_darg = TRUE;
01746 }
01747
01748 switch (AT_OBJ_CLASS(attr_idx)) {
01749
01750 case Data_Obj:
01751
01752 if (ATD_CLASS(attr_idx) == Dummy_Argument &&
01753 ATD_COPY_ASSUMED_SHAPE(attr_idx) &&
01754 ATD_SF_ARG_IDX(attr_idx) != NULL_IDX) {
01755
01756 attr_idx = ATD_SF_ARG_IDX(attr_idx);
01757 OPND_IDX((*result_opnd)) = attr_idx;
01758 }
01759 # if (defined(_TARGET_OS_IRIX) || defined(_TARGET_OS_LINUX) || defined(_TARGET_OS_DARWIN))
01760 # if 0
01761 else if (ATD_CLASS(attr_idx) == Dummy_Argument &&
01762 ATD_ARRAY_IDX(attr_idx) &&
01763 BD_ARRAY_CLASS(ATD_ARRAY_IDX(attr_idx))==Assumed_Shape &&
01764 ATD_SF_ARG_IDX(attr_idx) != NULL_IDX) {
01765
01766 attr_idx = ATD_SF_ARG_IDX(attr_idx);
01767 OPND_IDX((*result_opnd)) = attr_idx;
01768 }
01769 # endif
01770 # endif
01771
01772
01773 exp_desc->type_idx = ATD_TYPE_IDX(attr_idx);
01774 exp_desc->type = TYP_TYPE(exp_desc->type_idx);
01775 exp_desc->linear_type = TYP_LINEAR(exp_desc->type_idx);
01776
01777 if (ATD_PURE(attr_idx) &&
01778 #ifdef KEY
01779
01780
01781
01782 exp_desc->derived_assign &&
01783 #endif
01784 stmt_type == Assignment_Stmt &&
01785 exp_desc->type == Structure &&
01786 ATT_POINTER_CPNT(TYP_IDX(exp_desc->type_idx))) {
01787 ok = FALSE;
01788 PRINTMSG(line, 1270, Error, col, AT_OBJ_NAME_PTR(attr_idx),
01789 ATP_PURE(SCP_ATTR_IDX(curr_scp_idx)) ?
01790 "pure":"elemental");
01791 }
01792
01793 if (exp_desc->type == Character) {
01794 if (!TYP_RESOLVED(ATD_TYPE_IDX(attr_idx))) {
01795 char_bounds_resolution(attr_idx, &junk);
01796 exp_desc->type_idx = ATD_TYPE_IDX(attr_idx);
01797 }
01798
01799 # if defined(_EXTENDED_CRI_CHAR_POINTER)
01800 if (TYP_FLD(exp_desc->type_idx) == AT_Tbl_Idx &&
01801 AT_OBJ_CLASS(TYP_IDX(exp_desc->type_idx)) == Data_Obj &&
01802 TYP_TYPE(ATD_TYPE_IDX(TYP_IDX(exp_desc->type_idx))) ==
01803 CRI_Ch_Ptr) {
01804
01805 NTR_IR_TBL(ir_idx);
01806 IR_OPR(ir_idx) = Clen_Opr;
01807 IR_TYPE_IDX(ir_idx) = INTEGER_DEFAULT_TYPE;
01808 IR_LINE_NUM(ir_idx) = line;
01809 IR_COL_NUM(ir_idx) = col;
01810 IR_FLD_L(ir_idx) = AT_Tbl_Idx;
01811 IR_IDX_L(ir_idx) = attr_idx;
01812 IR_LINE_NUM_L(ir_idx) = line;
01813 IR_COL_NUM_L(ir_idx) = col;
01814
01815 exp_desc->char_len.fld = IR_Tbl_Idx;
01816 exp_desc->char_len.idx = ir_idx;
01817 }
01818 else {
01819 exp_desc->char_len.fld = TYP_FLD(exp_desc->type_idx);
01820 exp_desc->char_len.idx = TYP_IDX(exp_desc->type_idx);
01821 OPND_LINE_NUM(exp_desc->char_len) = line;
01822 OPND_COL_NUM(exp_desc->char_len) = col;
01823 }
01824 # else
01825 exp_desc->char_len.fld = TYP_FLD(exp_desc->type_idx);
01826 exp_desc->char_len.idx = TYP_IDX(exp_desc->type_idx);
01827 OPND_LINE_NUM(exp_desc->char_len) = line;
01828 OPND_COL_NUM(exp_desc->char_len) = col;
01829 # endif
01830
01831 if (TYP_FLD(exp_desc->type_idx) == AT_Tbl_Idx) {
01832 ADD_TMP_TO_SHARED_LIST(TYP_IDX(exp_desc->type_idx));
01833 }
01834
01835 if (ATD_CLASS(attr_idx) == Constant &&
01836 compare_cn_and_value(TYP_IDX(exp_desc->type_idx),
01837 MAX_CHARS_IN_TYPELESS,
01838 Le_Opr)) {
01839 exp_desc->linear_type = Short_Char_Const;
01840 }
01841 }
01842
01843 exp_desc->pointer = ATD_POINTER(attr_idx);
01844 exp_desc->target = ATD_TARGET(attr_idx);
01845 exp_desc->allocatable = ATD_ALLOCATABLE(attr_idx);
01846 exp_desc->dope_vector = ATD_IM_A_DOPE(attr_idx);
01847
01848 if (ATD_POINTER(attr_idx) && rank_in != 0) {
01849 ok = FALSE;
01850 PRINTMSG(line, 408, Error, col);
01851 }
01852
01853 if (cdir_switches.parallel_region &&
01854 ATD_CLASS(attr_idx) != Struct_Component &&
01855 ATD_CLASS(attr_idx) != Constant &&
01856 ATD_CLASS(attr_idx) != Compiler_Tmp &&
01857 ATD_CLASS(attr_idx) != CRI__Pointee &&
01858 (ATD_CLASS(attr_idx) != Dummy_Argument ||
01859 ! ATD_SF_DARG(attr_idx)) &&
01860 ! cdir_switches.autoscope &&
01861 #ifdef KEY
01862 SB_BLK_TYPE(ATD_STOR_BLK_IDX(attr_idx)) != Threadprivate &&
01863 #endif
01864 ! ATD_TASK_PRIVATE(attr_idx) &&
01865 ! ATD_TASK_GETFIRST(attr_idx) &&
01866 ! ATD_TASK_LASTLOCAL(attr_idx) &&
01867 ! ATD_TASK_REDUCTION(attr_idx) &&
01868 ! ATD_TASK_LASTTHREAD(attr_idx) &&
01869 ! ATD_TASK_FIRSTPRIVATE(attr_idx) &&
01870 ! ATD_TASK_COPYIN(attr_idx) &&
01871 ! ATD_TASK_LASTPRIVATE(attr_idx) &&
01872 ! ATD_TASK_SHARED(attr_idx)) {
01873
01874
01875 if (dump_flags.open_mp &&
01876 OPND_FLD(cdir_switches.first_sh_blk_stk) == IL_Tbl_Idx) {
01877
01878
01879
01880 if (cdir_switches.default_scope_list_idx != NULL_IDX &&
01881 CN_INT_TO_C(IL_IDX(cdir_switches.default_scope_list_idx))
01882 == OPEN_MP_DEFAULT_NONE) {
01883
01884 PRINTMSG(line, 1510, Error, col,
01885 AT_OBJ_NAME_PTR(attr_idx));
01886 ok = FALSE;
01887
01888
01889 ADD_VAR_TO_SHARED_LIST(attr_idx);
01890 }
01891 }
01892 else if (dump_flags.mp) {
01893
01894 # if 0
01895 if (processing_do_var) {
01896
01897
01898 ADD_VAR_TO_PRIVATE_LIST(attr_idx);
01899 }
01900 else {
01901 ADD_VAR_TO_SHARED_LIST(attr_idx);
01902 }
01903 # endif
01904 }
01905 else {
01906
01907 if (processing_do_var) {
01908 PRINTMSG(line, 1509, Error, col,
01909 AT_OBJ_NAME_PTR(attr_idx));
01910
01911
01912 ADD_VAR_TO_PRIVATE_LIST(attr_idx);
01913 }
01914 else {
01915 PRINTMSG(line, 960, Error, col,
01916 AT_OBJ_NAME_PTR(attr_idx));
01917
01918
01919 ADD_VAR_TO_SHARED_LIST(attr_idx);
01920 }
01921 ok = FALSE;
01922 }
01923 }
01924
01925 ADD_TMP_TO_SHARED_LIST(attr_idx);
01926
01927 if (ATD_ARRAY_IDX(attr_idx)) {
01928
01929 if (! BD_RESOLVED(ATD_ARRAY_IDX(attr_idx))) {
01930 array_bounds_resolution(attr_idx, &junk);
01931 }
01932
01933 exp_desc->assumed_shape =
01934 (BD_ARRAY_CLASS(ATD_ARRAY_IDX(attr_idx)) == Assumed_Shape);
01935 exp_desc->assumed_size =
01936 (BD_ARRAY_CLASS(ATD_ARRAY_IDX(attr_idx)) == Assumed_Size);
01937
01938 exp_desc->rank = BD_RANK(ATD_ARRAY_IDX(attr_idx));
01939 get_shape_from_attr(exp_desc,
01940 attr_idx,
01941 exp_desc->rank,
01942 line,
01943 col);
01944
01945
01946
01947
01948
01949 exp_desc->contig_array = TRUE;
01950 }
01951
01952 if (ATD_DISTRIBUTION_IDX(attr_idx) != NULL_IDX &&
01953 BD_DISTRIBUTE_RESHAPE(ATD_DISTRIBUTION_IDX(attr_idx))) {
01954
01955 exp_desc->dist_reshape_ref = TRUE;
01956 }
01957
01958 if (ATD_IM_A_DOPE(attr_idx) &&
01959 ! no_sub_or_deref) {
01960
01961
01962
01963
01964 NTR_IR_TBL(dv_idx);
01965 IR_OPR(dv_idx) = Dv_Deref_Opr;
01966 IR_LINE_NUM(dv_idx) = OPND_LINE_NUM((*result_opnd));
01967 IR_COL_NUM(dv_idx) = OPND_COL_NUM((*result_opnd));
01968
01969 IR_TYPE_IDX(dv_idx) = exp_desc->type_idx;
01970 IR_FLD_L(dv_idx) = OPND_FLD((*result_opnd));
01971 IR_IDX_L(dv_idx) = OPND_IDX((*result_opnd));
01972 IR_LINE_NUM_L(dv_idx) = OPND_LINE_NUM((*result_opnd));
01973 IR_COL_NUM_L(dv_idx) = OPND_COL_NUM((*result_opnd));
01974 OPND_FLD((*result_opnd)) = IR_Tbl_Idx;
01975 OPND_IDX((*result_opnd)) = dv_idx;
01976 }
01977
01978 if (ATD_CLASS(attr_idx) == Constant) {
01979 exp_desc->constant = TRUE;
01980 exp_desc->foldable = TRUE;
01981 exp_desc->will_fold_later = TRUE;
01982
01983 if (ATD_CONST_IDX(attr_idx) == NULL_IDX) {
01984 exp_desc->constant = FALSE;
01985 break;
01986 }
01987
01988 OPND_IDX((*result_opnd)) = ATD_CONST_IDX(attr_idx);
01989 OPND_LINE_NUM((*result_opnd)) = line;
01990 OPND_COL_NUM((*result_opnd)) = col;
01991
01992 if (ATD_FLD(attr_idx) == AT_Tbl_Idx) {
01993 OPND_FLD((*result_opnd)) = AT_Tbl_Idx;
01994
01995 ADD_TMP_TO_SHARED_LIST(ATD_CONST_IDX(attr_idx));
01996
01997 if (insert_subs_ok &&
01998 ! no_sub_or_deref) {
01999
02000 # if defined(_TARGET_OS_MAX)
02001 if (ATD_ARRAY_IDX(attr_idx) ||
02002 ATD_PE_ARRAY_IDX(attr_idx))
02003 # else
02004 if (ATD_ARRAY_IDX(attr_idx))
02005 # endif
02006 {
02007
02008 ok &= gen_whole_subscript(result_opnd, exp_desc);
02009 }
02010 else if (exp_desc->type == Character) {
02011 ok &= gen_whole_substring(result_opnd, 0);
02012 }
02013 }
02014 }
02015 else {
02016 OPND_FLD((*result_opnd)) = CN_Tbl_Idx;
02017 }
02018 }
02019 else if (ATD_CLASS(attr_idx) == Dummy_Argument &&
02020 ATD_SF_DARG(attr_idx)) {
02021
02022 OPND_FLD((*result_opnd)) = (fld_type) ATD_FLD(attr_idx);
02023 OPND_IDX((*result_opnd)) = ATD_SF_ARG_IDX(attr_idx);
02024 OPND_LINE_NUM((*result_opnd)) = line;
02025 OPND_COL_NUM((*result_opnd)) = col;
02026
02027 (*exp_desc) = arg_info_list[ATD_SF_LINK(attr_idx)].ed;
02028
02029 if (OPND_FLD((*result_opnd)) == AT_Tbl_Idx &&
02030 AT_OBJ_CLASS(OPND_IDX((*result_opnd))) == Data_Obj &&
02031 ATD_IM_A_DOPE(OPND_IDX((*result_opnd))) &&
02032 ! no_sub_or_deref) {
02033
02034
02035
02036
02037 NTR_IR_TBL(dv_idx);
02038 IR_OPR(dv_idx) = Dv_Deref_Opr;
02039 IR_LINE_NUM(dv_idx) = OPND_LINE_NUM((*result_opnd));
02040 IR_COL_NUM(dv_idx) = OPND_COL_NUM((*result_opnd));
02041
02042 IR_TYPE_IDX(dv_idx) = exp_desc->type_idx;
02043 COPY_OPND(IR_OPND_L(dv_idx), (*result_opnd));
02044 OPND_FLD((*result_opnd)) = IR_Tbl_Idx;
02045 OPND_IDX((*result_opnd)) = dv_idx;
02046 }
02047
02048 if (OPND_FLD((*result_opnd)) == AT_Tbl_Idx ||
02049 (OPND_FLD((*result_opnd)) == IR_Tbl_Idx &&
02050 (IR_OPR(OPND_IDX((*result_opnd))) == Dv_Deref_Opr ||
02051 IR_OPR(OPND_IDX((*result_opnd))) == Struct_Opr))) {
02052
02053 if (insert_subs_ok &&
02054 ! no_sub_or_deref) {
02055
02056 if (exp_desc->rank) {
02057 ok &= gen_whole_subscript(result_opnd, exp_desc);
02058 }
02059 else if (exp_desc->type == Character) {
02060 ok &= gen_whole_substring(result_opnd, 0);
02061 }
02062 }
02063 }
02064 break;
02065 }
02066 else {
02067
02068 if (ATD_LCV_IS_CONST(attr_idx)) {
02069 exp_desc->will_fold_later = TRUE;
02070 }
02071
02072 exp_desc->reference = TRUE;
02073 exp_desc->has_symbolic = ATD_SYMBOLIC_CONSTANT(attr_idx);
02074
02075 if (insert_subs_ok &&
02076 ! no_sub_or_deref) {
02077
02078 # if defined(_TARGET_OS_MAX)
02079 if (ATD_ARRAY_IDX(attr_idx) ||
02080 ATD_PE_ARRAY_IDX(attr_idx))
02081 # else
02082 if (ATD_ARRAY_IDX(attr_idx))
02083 # endif
02084 {
02085 ok &= gen_whole_subscript(result_opnd, exp_desc);
02086 }
02087 else if (exp_desc->type == Character) {
02088 ok &= gen_whole_substring(result_opnd, 0);
02089 }
02090 }
02091 }
02092
02093
02094 if (expr_mode == Specification_Expr) {
02095
02096
02097
02098
02099
02100
02101
02102
02103 switch (ATD_CLASS(attr_idx)) {
02104 case Dummy_Argument:
02105
02106 if (AT_OPTIONAL(attr_idx) ||
02107 TYP_TYPE(ATD_TYPE_IDX(attr_idx)) == CRI_Ptr) {
02108 fnd_semantic_err(Obj_Use_Spec_Expr,
02109 line,
02110 col,
02111 attr_idx,
02112 TRUE);
02113 ok = FALSE;
02114 }
02115 else if (ATD_INTENT(attr_idx) == Intent_Out) {
02116 PRINTMSG(line, 519, Error, col,
02117 AT_OBJ_NAME_PTR(attr_idx));
02118 ok = FALSE;
02119 }
02120 else if (ATP_ELEMENTAL(SCP_ATTR_IDX(curr_scp_idx))) {
02121 PRINTMSG(line, 1439, Error, col,
02122 AT_OBJ_NAME_PTR(attr_idx));
02123 ok = FALSE;
02124 }
02125
02126 if (AT_ALT_DARG(attr_idx)) {
02127
02128
02129
02130
02131
02132
02133 al_list_idx = SCP_TMP_LIST(curr_scp_idx);
02134
02135 while (al_list_idx != NULL_IDX &&
02136 attr_idx != AL_ATTR_IDX(al_list_idx)) {
02137 al_list_idx = AL_NEXT_IDX(al_list_idx);
02138 }
02139
02140 if (al_list_idx == NULL_IDX) {
02141 NTR_ATTR_LIST_TBL(al_list_idx);
02142 AL_NEXT_IDX(al_list_idx) =SCP_TMP_LIST(curr_scp_idx);
02143 AL_ATTR_IDX(al_list_idx) = attr_idx;
02144 SCP_TMP_LIST(curr_scp_idx) = al_list_idx;
02145 }
02146 }
02147
02148 break;
02149
02150 case Variable:
02151 case Atd_Unknown:
02152
02153 if (TYP_TYPE(ATD_TYPE_IDX(attr_idx)) == CRI_Ptr) {
02154 fnd_semantic_err(Obj_Use_Spec_Expr,
02155 line,
02156 col,
02157 attr_idx,
02158 TRUE);
02159 ok = FALSE;
02160 }
02161 else if (!ATD_IN_COMMON(attr_idx) &&
02162 !AT_USE_ASSOCIATED(attr_idx) &&
02163 !host_associated &&
02164 !ATD_SYMBOLIC_CONSTANT(attr_idx)) {
02165
02166 if (ATD_EQUIV(attr_idx)) {
02167 ATD_EQUIV_IN_BNDS_EXPR(attr_idx) = TRUE;
02168 }
02169 else {
02170
02171 if (!AT_DCL_ERR(attr_idx)) {
02172 PRINTMSG(line, 521, Error, col,
02173 AT_OBJ_NAME_PTR(attr_idx));
02174 }
02175 ok = FALSE;
02176 }
02177 }
02178 break;
02179
02180 case Constant:
02181 case Struct_Component:
02182 break;
02183
02184 case Function_Result:
02185 case CRI__Pointee:
02186 fnd_semantic_err(Obj_Use_Spec_Expr,
02187 line,
02188 col,
02189 attr_idx,
02190 TRUE);
02191 ok = FALSE;
02192 break;
02193 }
02194 }
02195 else if (expr_mode == Initialization_Expr) {
02196
02197 if (ATD_CLASS(attr_idx) != Struct_Component &&
02198 ! ATD_LCV_IS_CONST(attr_idx) &&
02199 ! ATD_PARENT_OBJECT(attr_idx) &&
02200 ATD_CLASS(attr_idx) != Constant) {
02201
02202 if (!fnd_semantic_err(Obj_Use_Init_Expr,
02203 line,
02204 col,
02205 attr_idx,
02206 TRUE)) {
02207 PRINTMSG(line, 868, Error, col,
02208 AT_OBJ_NAME_PTR(attr_idx));
02209 AT_DCL_ERR(attr_idx) = TRUE;
02210 }
02211
02212 ok = FALSE;
02213 }
02214 }
02215 break;
02216
02217 case Pgm_Unit:
02218
02219 if (ATP_PROC(attr_idx) == Dummy_Proc &&
02220 ATP_DUMMY_PROC_LINK(attr_idx) != NULL_IDX) {
02221
02222 attr_idx = ATP_DUMMY_PROC_LINK(attr_idx);
02223 }
02224
02225 if (pgm_unit_illegal && !in_call_list) {
02226 ok = FALSE;
02227
02228 switch (ATP_PGM_UNIT(attr_idx)) {
02229 case Function :
02230 msg_num = 451;
02231 break;
02232
02233 case Subroutine :
02234 msg_num = 452;
02235 break;
02236
02237 case Program :
02238 msg_num = 453;
02239 break;
02240
02241 case Blockdata :
02242 msg_num = 454;
02243 break;
02244
02245 case Module :
02246 msg_num = 455;
02247 break;
02248
02249 case Pgm_Unknown :
02250 msg_num = 378;
02251 break;
02252 }
02253 PRINTMSG(line, msg_num, Error, col,
02254 AT_OBJ_NAME_PTR(attr_idx));
02255 }
02256 else if (ATP_PGM_UNIT(attr_idx) == Function) {
02257
02258 exp_desc->type_idx = ATD_TYPE_IDX(ATP_RSLT_IDX(attr_idx));
02259 exp_desc->type = TYP_TYPE(exp_desc->type_idx);
02260 exp_desc->linear_type = TYP_LINEAR(exp_desc->type_idx);
02261
02262 if (ATD_ARRAY_IDX(ATP_RSLT_IDX(attr_idx))) {
02263 exp_desc->rank=BD_RANK(ATD_ARRAY_IDX(ATP_RSLT_IDX(attr_idx)));
02264
02265 get_shape_from_attr(exp_desc,
02266 ATP_RSLT_IDX(attr_idx),
02267 exp_desc->rank,
02268 line,
02269 col);
02270 }
02271 else {
02272 exp_desc->rank = 0;
02273 }
02274 }
02275 break;
02276
02277 case Label:
02278 if (ATL_CLASS(attr_idx) == Lbl_Construct) {
02279
02280
02281
02282 PRINTMSG(line, 1461, Error, col,
02283 AT_OBJ_NAME_PTR(attr_idx));
02284 ok = FALSE;
02285 }
02286 else if (label_allowed) {
02287 exp_desc->label = TRUE;
02288 }
02289 else {
02290
02291 PRINTMSG(line, 1462, Error, col,
02292 AT_OBJ_NAME_PTR(attr_idx));
02293 ok = FALSE;
02294 }
02295 break;
02296
02297 case Namelist_Grp:
02298 if (expr_mode == Specification_Expr) {
02299 fnd_semantic_err(Obj_Use_Spec_Expr,
02300 line,
02301 col,
02302 attr_idx,
02303 TRUE);
02304 ok = FALSE;
02305 }
02306 else if (expr_mode == Initialization_Expr) {
02307 fnd_semantic_err(Obj_Use_Init_Expr,
02308 line,
02309 col,
02310 attr_idx,
02311 TRUE);
02312 ok = FALSE;
02313 }
02314 else if (namelist_illegal) {
02315 PRINTMSG(line, 512, Error, col,
02316 AT_OBJ_NAME_PTR(attr_idx));
02317
02318 ok = FALSE;
02319 }
02320 break;
02321
02322
02323 case Derived_Type :
02324
02325 if (!AT_DEFINED(attr_idx)) {
02326
02327
02328
02329
02330 issue_undefined_type_msg(attr_idx, line, col);
02331 ok = FALSE;
02332 }
02333 else if (expr_mode == Specification_Expr) {
02334 fnd_semantic_err(Obj_Use_Spec_Expr,
02335 line,
02336 col,
02337 attr_idx,
02338 TRUE);
02339 ok = FALSE;
02340 }
02341 else if (expr_mode == Initialization_Expr) {
02342 fnd_semantic_err(Obj_Use_Init_Expr,
02343 line,
02344 col,
02345 attr_idx,
02346 TRUE);
02347 ok = FALSE;
02348 }
02349 break;
02350
02351
02352 case Interface :
02353
02354 if (pgm_unit_illegal) {
02355
02356 if (in_call_list &&
02357 ATI_PROC_IDX(attr_idx) != NULL_IDX) {
02358
02359
02360 attr_idx = ATI_PROC_IDX(attr_idx);
02361 OPND_FLD((*result_opnd)) = AT_Tbl_Idx;
02362 OPND_IDX((*result_opnd)) = attr_idx;
02363 OPND_LINE_NUM((*result_opnd)) = line;
02364 OPND_COL_NUM((*result_opnd)) = col;
02365
02366 AT_REFERENCED(attr_idx) = (expr_mode == Specification_Expr ||
02367 expr_mode == Stmt_Func_Expr) ?
02368 Dcl_Bound_Ref : Referenced;
02369
02370 if (ATP_PGM_UNIT(attr_idx) == Function) {
02371
02372 exp_desc->type_idx = ATD_TYPE_IDX(ATP_RSLT_IDX(attr_idx));
02373 exp_desc->type = TYP_TYPE(exp_desc->type_idx);
02374 exp_desc->linear_type = TYP_LINEAR(exp_desc->type_idx);
02375
02376 AT_REFERENCED(ATP_RSLT_IDX(attr_idx)) =
02377 AT_REFERENCED(attr_idx);
02378
02379 if (ATD_ARRAY_IDX(ATP_RSLT_IDX(attr_idx))) {
02380 exp_desc->rank =
02381 BD_RANK(ATD_ARRAY_IDX(ATP_RSLT_IDX(attr_idx)));
02382
02383 get_shape_from_attr(exp_desc,
02384 ATP_RSLT_IDX(attr_idx),
02385 exp_desc->rank,
02386 line,
02387 col);
02388 }
02389 else {
02390 exp_desc->rank = 0;
02391 }
02392 }
02393 }
02394 else {
02395
02396 if (!AT_DCL_ERR(attr_idx)) {
02397 PRINTMSG(line, 1078, Error, col,
02398 AT_OBJ_NAME_PTR(attr_idx));
02399 }
02400 ok = FALSE;
02401 }
02402 }
02403 else if (expr_mode == Specification_Expr) {
02404 fnd_semantic_err(Obj_Use_Spec_Expr,
02405 line,
02406 col,
02407 attr_idx,
02408 TRUE);
02409 ok = FALSE;
02410 }
02411 else if (expr_mode == Initialization_Expr) {
02412 fnd_semantic_err(Obj_Use_Init_Expr,
02413 line,
02414 col,
02415 attr_idx,
02416 TRUE);
02417 ok = FALSE;
02418 }
02419 break;
02420
02421 case Stmt_Func :
02422
02423 if (expr_mode == Specification_Expr) {
02424 fnd_semantic_err(Obj_Use_Spec_Expr,
02425 line,
02426 col,
02427 attr_idx,
02428 TRUE);
02429 ok = FALSE;
02430 }
02431 else if (expr_mode == Initialization_Expr) {
02432 fnd_semantic_err(Obj_Use_Init_Expr,
02433 line,
02434 col,
02435 attr_idx,
02436 TRUE);
02437 ok = FALSE;
02438 }
02439
02440 exp_desc->type_idx = ATD_TYPE_IDX(attr_idx);
02441 exp_desc->type = TYP_TYPE(exp_desc->type_idx);
02442 exp_desc->linear_type = TYP_LINEAR(exp_desc->type_idx);
02443
02444 break;
02445
02446 }
02447 break;
02448
02449 case IR_Tbl_Idx :
02450
02451 namelist_illegal = TRUE;
02452 label_allowed = FALSE;
02453
02454 ir_idx = OPND_IDX((*result_opnd));
02455
02456
02457 IR_ARRAY_SYNTAX(ir_idx) = FALSE;
02458
02459 switch (IR_OPR(ir_idx)) {
02460
02461 case Null_Opr :
02462 break;
02463
02464 case Defined_Un_Opr :
02465
02466 ok = defined_un_opr_handler(result_opnd, exp_desc);
02467 break;
02468
02469 case Uplus_Opr :
02470 case Uminus_Opr :
02471
02472 ok = uplus_opr_handler(result_opnd, exp_desc);
02473 break;
02474
02475 case Power_Opr :
02476
02477 ok = power_opr_handler(result_opnd, exp_desc);
02478 break;
02479
02480 case Mult_Opr :
02481 case Div_Opr :
02482
02483 ok = mult_opr_handler(result_opnd, exp_desc);
02484 break;
02485
02486 case Minus_Opr :
02487
02488 ok = minus_opr_handler(result_opnd, exp_desc);
02489 break;
02490
02491 case Plus_Opr :
02492
02493 ok = plus_opr_handler(result_opnd, exp_desc);
02494 break;
02495
02496 case Concat_Opr :
02497
02498 ok = concat_opr_handler(result_opnd, exp_desc);
02499 break;
02500
02501 case Eq_Opr :
02502 case Ne_Opr :
02503
02504 ok = eq_opr_handler(result_opnd, exp_desc);
02505 break;
02506
02507 case Lg_Opr :
02508
02509 ok = lg_opr_handler(result_opnd, exp_desc);
02510 break;
02511
02512 case Lt_Opr :
02513 case Le_Opr :
02514 case Gt_Opr :
02515 case Ge_Opr :
02516
02517 ok = lt_opr_handler(result_opnd, exp_desc);
02518 break;
02519
02520 case Not_Opr :
02521
02522 ok = not_opr_handler(result_opnd, exp_desc);
02523 break;
02524
02525 case And_Opr :
02526 case Or_Opr :
02527 case Eqv_Opr :
02528 case Neqv_Opr :
02529
02530 ok = and_opr_handler(result_opnd, exp_desc);
02531 break;
02532
02533 case Defined_Bin_Opr :
02534
02535 ok = defined_bin_opr_handler(result_opnd, exp_desc);
02536 break;
02537
02538 case Max_Opr :
02539 case Min_Opr :
02540
02541 ok = max_opr_handler(result_opnd, exp_desc);
02542 break;
02543
02544 case Call_Opr :
02545
02546 if (need_pure_function &&
02547 AT_OBJ_CLASS(IR_IDX_L(ir_idx)) == Pgm_Unit &&
02548 #ifdef KEY
02549
02550 !(ATP_PURE(IR_IDX_L(ir_idx)) ||
02551 ATP_ELEMENTAL(IR_IDX_L(ir_idx))))
02552 #else
02553 !ATP_PURE(IR_IDX_L(ir_idx)))
02554 #endif
02555 {
02556
02557 ok = FALSE;
02558 break;
02559 }
02560
02561 if (expr_mode == Restricted_Imp_Do_Expr) {
02562 PRINTMSG(line, 706, Error, col);
02563 ok = FALSE;
02564 break;
02565 }
02566
02567 save_in_constructor = in_constructor;
02568 in_constructor = FALSE;
02569
02570 ok = call_list_semantics(result_opnd,
02571 exp_desc,
02572 TRUE);
02573
02574 in_constructor = save_in_constructor;
02575
02576 if (expr_mode == Data_Stmt_Target_Expr &&
02577 !exp_desc->constant) {
02578
02579 PRINTMSG(line, 706, Error, col);
02580 ok = FALSE;
02581 }
02582
02583 break;
02584
02585 case Struct_Opr :
02586
02587 ok = struct_opr_handler(result_opnd, exp_desc, rank_in);
02588 break;
02589
02590 case Struct_Construct_Opr :
02591 case Constant_Struct_Construct_Opr :
02592
02593 ok = struct_construct_opr_handler(result_opnd, exp_desc);
02594 break;
02595
02596 case Array_Construct_Opr :
02597 case Constant_Array_Construct_Opr :
02598
02599 ok = array_construct_opr_handler(result_opnd, exp_desc);
02600 break;
02601
02602 case Whole_Subscript_Opr :
02603 case Section_Subscript_Opr :
02604 case Subscript_Opr :
02605
02606 ok = subscript_opr_handler(result_opnd, exp_desc, rank_in);
02607 break;
02608
02609 case Whole_Substring_Opr :
02610 case Substring_Opr :
02611
02612 ok = substring_opr_handler(result_opnd, exp_desc, rank_in);
02613 break;
02614
02615 case Triplet_Opr :
02616
02617 ok = triplet_opr_handler(result_opnd, exp_desc);
02618 break;
02619
02620 case Dealloc_Obj_Opr :
02621
02622 ok = dealloc_obj_opr_handler(result_opnd, exp_desc, rank_in);
02623 break;
02624
02625 case Alloc_Obj_Opr :
02626
02627 ok = alloc_obj_opr_handler(result_opnd, exp_desc, rank_in);
02628 break;
02629
02630 case Cvrt_Opr :
02631 case Cvrt_Unsigned_Opr :
02632
02633 ok = cvrt_opr_handler(result_opnd, exp_desc);
02634 break;
02635
02636 case Paren_Opr :
02637
02638 ok = paren_opr_handler(result_opnd, exp_desc);
02639 break;
02640
02641 case Kwd_Opr :
02642
02643
02644
02645 PRINTMSG(IR_LINE_NUM(ir_idx), 197, Error, IR_COL_NUM(ir_idx),
02646 ", or )", "=");
02647 ok = FALSE;
02648 break;
02649
02650 case Stmt_Func_Call_Opr :
02651
02652 ok = stmt_func_call_opr_handler(result_opnd, exp_desc);
02653 break;
02654
02655 case Clen_Opr:
02656
02657 save_insert_subs_ok = insert_subs_ok;
02658 insert_subs_ok = FALSE;
02659
02660 save_in_call_list = in_call_list;
02661
02662 if (IR_FLD_L(ir_idx) == AT_Tbl_Idx &&
02663 AT_OBJ_CLASS(IR_IDX_L(ir_idx)) == Pgm_Unit) {
02664 in_call_list = TRUE;
02665 }
02666
02667 COPY_OPND(opnd, IR_OPND_L(ir_idx));
02668 ok = expr_sem(&opnd, exp_desc);
02669 COPY_OPND(IR_OPND_L(ir_idx), opnd);
02670 insert_subs_ok = save_insert_subs_ok;
02671 in_call_list = save_in_call_list;
02672
02673 exp_desc->type = Integer;
02674 exp_desc->linear_type = INTEGER_DEFAULT_TYPE;
02675 exp_desc->type_idx = INTEGER_DEFAULT_TYPE;
02676
02677 fold_clen_opr(result_opnd, exp_desc);
02678 break;
02679
02680 case Percent_Val_Opr :
02681 COPY_OPND(opnd, IR_OPND_L(ir_idx));
02682 ok = expr_sem(&opnd, exp_desc);
02683 COPY_OPND(IR_OPND_L(ir_idx), opnd);
02684
02685 if (OPND_FLD(opnd) == AT_Tbl_Idx &&
02686 AT_OBJ_CLASS(OPND_IDX(opnd)) == Pgm_Unit) {
02687
02688 COPY_OPND((*result_opnd), opnd);
02689 }
02690 else if (exp_desc->rank == 0 &&
02691 (exp_desc->type == Integer ||
02692 exp_desc->type == Logical ||
02693 exp_desc->type == Real)) {
02694
02695 COPY_OPND((*result_opnd), opnd);
02696 exp_desc->percent_val_arg = TRUE;
02697 }
02698 else {
02699 PRINTMSG(IR_LINE_NUM(ir_idx), 1125, Error,
02700 IR_COL_NUM(ir_idx));
02701 ok = FALSE;
02702 }
02703 break;
02704
02705
02706
02707
02708
02709
02710 case Dv_Deref_Opr :
02711
02712 save_no_sub_or_deref = no_sub_or_deref;
02713 no_sub_or_deref = TRUE;
02714 COPY_OPND(opnd, IR_OPND_L(ir_idx));
02715 ok = expr_sem(&opnd, exp_desc);
02716 COPY_OPND(IR_OPND_L(ir_idx), opnd);
02717 no_sub_or_deref = save_no_sub_or_deref;
02718 break;
02719
02720 case Dv_Access_Base_Addr:
02721 case Dv_Access_El_Len:
02722 case Dv_Access_Assoc:
02723 case Dv_Access_Ptr_Alloc:
02724 case Dv_Access_P_Or_A:
02725 case Dv_Access_A_Contig:
02726 case Dv_Access_N_Dim:
02727 case Dv_Access_Typ_Code:
02728 case Dv_Access_Orig_Base:
02729 case Dv_Access_Orig_Size:
02730 case Dv_Access_Low_Bound:
02731 case Dv_Access_Extent:
02732 case Dv_Access_Stride_Mult:
02733 save_no_sub_or_deref = no_sub_or_deref;
02734 no_sub_or_deref = TRUE;
02735 exp_desc_l.rank = 0;
02736 COPY_OPND(opnd, IR_OPND_L(ir_idx));
02737 ok = expr_sem(&opnd, &exp_desc_l);
02738 COPY_OPND(IR_OPND_L(ir_idx), opnd);
02739 no_sub_or_deref = save_no_sub_or_deref;
02740
02741 exp_desc->type_idx = IR_TYPE_IDX(ir_idx);
02742 exp_desc->type = TYP_TYPE(exp_desc->type_idx);
02743 exp_desc->linear_type = TYP_LINEAR(exp_desc->type_idx);
02744 exp_desc->has_symbolic= exp_desc_l.has_symbolic;
02745 break;
02746
02747 default :
02748 save_no_sub_or_deref = no_sub_or_deref;
02749 no_sub_or_deref = TRUE;
02750 exp_desc_l.rank = 0;
02751 COPY_OPND(opnd, IR_OPND_L(ir_idx));
02752 ok = expr_sem(&opnd, &exp_desc_l);
02753 COPY_OPND(IR_OPND_L(ir_idx), opnd);
02754
02755 no_sub_or_deref = TRUE;
02756 exp_desc_r.rank = 0;
02757 COPY_OPND(opnd, IR_OPND_R(ir_idx));
02758 ok = expr_sem(&opnd, &exp_desc_r);
02759 COPY_OPND(IR_OPND_R(ir_idx), opnd);
02760 no_sub_or_deref = save_no_sub_or_deref;
02761
02762 exp_desc->type_idx = IR_TYPE_IDX(ir_idx);
02763 exp_desc->type = TYP_TYPE(exp_desc->type_idx);
02764 exp_desc->linear_type = TYP_LINEAR(exp_desc->type_idx);
02765 exp_desc->rank = IR_RANK(ir_idx);
02766 break;
02767 }
02768
02769 break;
02770
02771 case IL_Tbl_Idx :
02772 list_idx = OPND_IDX((*result_opnd));
02773 while (list_idx) {
02774 COPY_OPND(opnd, IL_OPND(list_idx));
02775 ok = expr_sem(&opnd, &exp_desc_l);
02776 COPY_OPND(IL_OPND(list_idx), opnd);
02777 list_idx = IL_NEXT_LIST_IDX(list_idx);
02778 }
02779
02780 break;
02781 }
02782
02783
02784 TRACE (Func_Exit, "expr_sem", NULL);
02785
02786 return (ok);
02787
02788 }
02789
02790
02791
02792
02793
02794
02795
02796
02797
02798
02799
02800
02801
02802
02803
02804
02805
02806
02807 boolean gen_whole_subscript (opnd_type *opnd, expr_arg_type *exp_desc)
02808
02809 {
02810 int attr_idx;
02811 int bd_idx;
02812 int col;
02813 int dv_idx;
02814 opnd_type dv_opnd;
02815 int i;
02816 int line;
02817 int list1_idx = NULL_IDX;
02818 int list2_idx;
02819 expr_arg_type loc_exp_desc;
02820 int minus_idx;
02821 opnd_type opnd2;
02822 int plus_idx;
02823
02824 # if defined(_TARGET_OS_MAX) && defined(_F_MINUS_MINUS)
02825 int save_pe_dv_list_idx = NULL_IDX;
02826 # endif
02827
02828 int sub_idx;
02829 boolean ok = TRUE;
02830 int tlst1_idx;
02831 int tlst2_idx;
02832 int tlst3_idx;
02833 int trip_idx;
02834
02835
02836 TRACE (Func_Entry, "gen_whole_subscript", NULL);
02837
02838 attr_idx = find_base_attr(opnd, &line, &col);
02839
02840 bd_idx = ATD_ARRAY_IDX(attr_idx);
02841
02842 if (bd_idx &&
02843 BD_ARRAY_CLASS(bd_idx) == Assumed_Size) {
02844
02845 if (in_call_list) {
02846
02847
02848 if (TYP_TYPE(ATD_TYPE_IDX(attr_idx)) == Character) {
02849 ok = gen_whole_substring(opnd, BD_RANK(bd_idx));
02850 }
02851 }
02852 else {
02853
02854 ok = FALSE;
02855
02856 if (SH_STMT_TYPE(curr_stmt_sh_idx) == Assignment_Stmt &&
02857 IR_FLD_L(SH_IR_IDX(curr_stmt_sh_idx)) == AT_Tbl_Idx &&
02858 IR_IDX_L(SH_IR_IDX(curr_stmt_sh_idx)) == attr_idx &&
02859 IR_COL_NUM_L(SH_IR_IDX(curr_stmt_sh_idx)) == col &&
02860 IR_LINE_NUM_L(SH_IR_IDX(curr_stmt_sh_idx)) == line) {
02861
02862 PRINTMSG(line, 411, Error, col);
02863 }
02864 else {
02865 PRINTMSG(line, 412, Error, col);
02866 }
02867 }
02868
02869 goto EXIT;
02870 }
02871
02872 NTR_IR_TBL(sub_idx);
02873 IR_OPR(sub_idx) = Whole_Subscript_Opr;
02874
02875 # if defined(_TARGET_OS_MAX) && defined(_F_MINUS_MINUS)
02876 if (exp_desc->pe_dim_ref &&
02877 OPND_FLD((*opnd)) == IR_Tbl_Idx &&
02878 IR_OPR(OPND_IDX((*opnd))) == Subscript_Opr &&
02879 IR_LIST_CNT_R(OPND_IDX((*opnd))) == 1 &&
02880 IL_PE_SUBSCRIPT(IR_IDX_R(OPND_IDX((*opnd))))) {
02881
02882
02883 save_pe_dv_list_idx = IR_IDX_R(OPND_IDX((*opnd)));
02884
02885 plus_idx = OPND_IDX((*opnd));
02886 COPY_OPND((*opnd), IR_OPND_L(OPND_IDX((*opnd))));
02887 FREE_IR_NODE(plus_idx);
02888 }
02889 # endif
02890
02891 if (OPND_FLD((*opnd)) == IR_Tbl_Idx &&
02892 IR_OPR(OPND_IDX((*opnd))) == Dv_Deref_Opr) {
02893
02894 COPY_OPND(dv_opnd, IR_OPND_L(OPND_IDX((*opnd))));
02895 }
02896 else {
02897 COPY_OPND(dv_opnd, (*opnd));
02898 }
02899
02900 copy_subtree(&dv_opnd, &dv_opnd);
02901
02902 COPY_OPND(IR_OPND_L(sub_idx), (*opnd));
02903
02904
02905
02906 OPND_FLD((*opnd)) = IR_Tbl_Idx;
02907 OPND_IDX((*opnd)) = sub_idx;
02908
02909 IR_RANK(sub_idx) = (bd_idx ? BD_RANK(bd_idx) : 0);
02910 IR_TYPE_IDX(sub_idx) = ATD_TYPE_IDX(attr_idx);
02911 IR_LINE_NUM(sub_idx) = line;
02912 IR_COL_NUM(sub_idx) = col;
02913
02914 exp_desc->rank = IR_RANK(sub_idx);
02915
02916 IR_FLD_R(sub_idx) = IL_Tbl_Idx;
02917 IR_LIST_CNT_R(sub_idx) = IR_RANK(sub_idx);
02918
02919 for (i = 1 ; i <= IR_LIST_CNT_R(sub_idx); i++) {
02920
02921
02922 if (ATD_IM_A_DOPE(attr_idx)) {
02923 OPND_FLD(exp_desc->shape[i-1]) = IR_Tbl_Idx;
02924 NTR_IR_TBL(dv_idx);
02925 IR_OPR(dv_idx) = Dv_Access_Extent;
02926 IR_TYPE_IDX(dv_idx) = SA_INTEGER_DEFAULT_TYPE;
02927 IR_LINE_NUM(dv_idx) = line;
02928 IR_COL_NUM(dv_idx) = col;
02929 IR_DV_DIM(dv_idx) = i;
02930 COPY_OPND(IR_OPND_L(dv_idx), dv_opnd);
02931 OPND_IDX(exp_desc->shape[i-1]) = dv_idx;
02932 SHAPE_FOLDABLE(exp_desc->shape[i-1]) = FALSE;
02933 SHAPE_WILL_FOLD_LATER(exp_desc->shape[i-1]) = FALSE;
02934 }
02935 else {
02936 OPND_FLD(exp_desc->shape[i-1]) = BD_XT_FLD(bd_idx, i);
02937 OPND_IDX(exp_desc->shape[i-1]) = BD_XT_IDX(bd_idx, i);
02938
02939 if (OPND_FLD(exp_desc->shape[i-1]) == AT_Tbl_Idx) {
02940 ADD_TMP_TO_SHARED_LIST(OPND_IDX(exp_desc->shape[i-1]));
02941 }
02942
02943 if (OPND_FLD(exp_desc->shape[i-1]) == CN_Tbl_Idx) {
02944 SHAPE_FOLDABLE(exp_desc->shape[i-1]) = TRUE;
02945 SHAPE_WILL_FOLD_LATER(exp_desc->shape[i-1]) = TRUE;
02946 }
02947 else if (OPND_FLD(exp_desc->shape[i-1]) == AT_Tbl_Idx &&
02948 AT_OBJ_CLASS(OPND_IDX(exp_desc->shape[i-1])) == Data_Obj &&
02949 ATD_LCV_IS_CONST(OPND_IDX(exp_desc->shape[i-1]))) {
02950
02951 SHAPE_FOLDABLE(exp_desc->shape[i-1]) = FALSE;
02952 SHAPE_WILL_FOLD_LATER(exp_desc->shape[i-1]) = TRUE;
02953 }
02954 else {
02955 SHAPE_FOLDABLE(exp_desc->shape[i-1]) = FALSE;
02956 SHAPE_WILL_FOLD_LATER(exp_desc->shape[i-1]) = FALSE;
02957 }
02958 }
02959
02960 if (list1_idx == NULL_IDX) {
02961 NTR_IR_LIST_TBL(list1_idx);
02962 IR_IDX_R(sub_idx) = list1_idx;
02963 }
02964 else {
02965 list2_idx = list1_idx;
02966 NTR_IR_LIST_TBL(list1_idx);
02967 IL_NEXT_LIST_IDX(list2_idx) = list1_idx;
02968 IL_PREV_LIST_IDX(list1_idx) = list2_idx;
02969 }
02970
02971 IL_FLD(list1_idx) = IR_Tbl_Idx;
02972 NTR_IR_TBL(trip_idx);
02973 IR_OPR(trip_idx) = Triplet_Opr;
02974 IR_TYPE_IDX(trip_idx) = CG_INTEGER_DEFAULT_TYPE;
02975 IR_RANK(trip_idx) = 1;
02976 IR_LINE_NUM(trip_idx) = line;
02977 IR_COL_NUM(trip_idx) = col;
02978 IL_IDX(list1_idx) = trip_idx;
02979
02980 NTR_IR_LIST_TBL(tlst1_idx);
02981 NTR_IR_LIST_TBL(tlst2_idx);
02982 NTR_IR_LIST_TBL(tlst3_idx);
02983 IR_FLD_L(trip_idx) = IL_Tbl_Idx;
02984 IR_LIST_CNT_L(trip_idx) = 3;
02985 IR_IDX_L(trip_idx) = tlst1_idx;
02986
02987 IL_NEXT_LIST_IDX(tlst1_idx) = tlst2_idx;
02988 IL_PREV_LIST_IDX(tlst2_idx) = tlst1_idx;
02989 IL_NEXT_LIST_IDX(tlst2_idx) = tlst3_idx;
02990 IL_PREV_LIST_IDX(tlst3_idx) = tlst2_idx;
02991
02992 if (ATD_IM_A_DOPE(attr_idx)) {
02993
02994
02995
02996 gen_dv_access_low_bound(&opnd2, &dv_opnd, i);
02997
02998 COPY_OPND(IL_OPND(tlst1_idx), opnd2);
02999
03000
03001
03002 NTR_IR_TBL(minus_idx);
03003 IR_OPR(minus_idx) = Minus_Opr;
03004 IR_TYPE_IDX(minus_idx) = SA_INTEGER_DEFAULT_TYPE;
03005 IR_LINE_NUM(minus_idx) = line;
03006 IR_COL_NUM(minus_idx) = col;
03007 IR_FLD_R(minus_idx) = CN_Tbl_Idx;
03008 IR_IDX_R(minus_idx) = CN_INTEGER_ONE_IDX;
03009 IR_LINE_NUM_R(minus_idx) = line;
03010 IR_COL_NUM_R(minus_idx) = col;
03011
03012 NTR_IR_TBL(plus_idx);
03013 IR_OPR(plus_idx) = Plus_Opr;
03014 IR_TYPE_IDX(plus_idx) = SA_INTEGER_DEFAULT_TYPE;
03015 IR_LINE_NUM(plus_idx) = line;
03016 IR_COL_NUM(plus_idx) = col;
03017 IR_FLD_L(minus_idx) = IR_Tbl_Idx;
03018 IR_IDX_L(minus_idx) = plus_idx;
03019
03020 gen_dv_access_low_bound(&opnd2, &dv_opnd, i);
03021
03022 COPY_OPND(IR_OPND_R(plus_idx), opnd2);
03023
03024 NTR_IR_TBL(dv_idx);
03025 IR_OPR(dv_idx) = Dv_Access_Extent;
03026 IR_TYPE_IDX(dv_idx) = SA_INTEGER_DEFAULT_TYPE;
03027 IR_LINE_NUM(dv_idx) = line;
03028 IR_COL_NUM(dv_idx) = col;
03029 IR_DV_DIM(dv_idx) = i;
03030 COPY_OPND(IR_OPND_L(dv_idx), dv_opnd);
03031
03032 IR_FLD_L(plus_idx) = IR_Tbl_Idx;
03033 IR_IDX_L(plus_idx) = dv_idx;
03034
03035 IL_FLD(tlst2_idx) = IR_Tbl_Idx;
03036 IL_IDX(tlst2_idx) = minus_idx;
03037
03038 }
03039 else {
03040 IL_FLD(tlst1_idx) = BD_LB_FLD(bd_idx, i);
03041 IL_IDX(tlst1_idx) = BD_LB_IDX(bd_idx, i);
03042 IL_LINE_NUM(tlst1_idx) = line;
03043 IL_COL_NUM(tlst1_idx) = col;
03044
03045 if (IL_FLD(tlst1_idx) == AT_Tbl_Idx) {
03046 ADD_TMP_TO_SHARED_LIST(IL_IDX(tlst1_idx));
03047 }
03048
03049 if (IL_FLD(tlst1_idx) != CN_Tbl_Idx) {
03050
03051
03052 loc_exp_desc.type_idx = ATD_TYPE_IDX(IL_IDX(tlst1_idx));
03053 loc_exp_desc.type = TYP_TYPE(loc_exp_desc.type_idx);
03054 loc_exp_desc.linear_type =
03055 TYP_LINEAR(loc_exp_desc.type_idx);
03056 }
03057 else {
03058 loc_exp_desc.type_idx = CN_TYPE_IDX(IL_IDX(tlst1_idx));
03059 loc_exp_desc.type = TYP_TYPE(loc_exp_desc.type_idx);
03060 loc_exp_desc.linear_type =
03061 TYP_LINEAR(loc_exp_desc.type_idx);
03062 }
03063
03064 #ifdef KEY
03065
03066
03067
03068
03069 #else
03070 if (in_io_list) {
03071
03072
03073
03074
03075 COPY_OPND(opnd2, IL_OPND(tlst1_idx));
03076 cast_to_cg_default(&opnd2, &loc_exp_desc);
03077 COPY_OPND(IL_OPND(tlst1_idx), opnd2);
03078 }
03079 #endif
03080
03081 IL_FLD(tlst2_idx) = BD_UB_FLD(bd_idx, i);
03082 IL_IDX(tlst2_idx) = BD_UB_IDX(bd_idx, i);
03083 IL_LINE_NUM(tlst2_idx) = line;
03084 IL_COL_NUM(tlst2_idx) = col;
03085
03086 if (IL_FLD(tlst2_idx) == AT_Tbl_Idx) {
03087 ADD_TMP_TO_SHARED_LIST(IL_IDX(tlst2_idx));
03088 }
03089
03090 if (IL_FLD(tlst2_idx) != CN_Tbl_Idx) {
03091
03092
03093 loc_exp_desc.type_idx = ATD_TYPE_IDX(IL_IDX(tlst2_idx));
03094 loc_exp_desc.type = TYP_TYPE(loc_exp_desc.type_idx);
03095 loc_exp_desc.linear_type =
03096 TYP_LINEAR(loc_exp_desc.type_idx);
03097 }
03098 else {
03099 loc_exp_desc.type_idx = CN_TYPE_IDX(IL_IDX(tlst2_idx));
03100 loc_exp_desc.type = TYP_TYPE(loc_exp_desc.type_idx);
03101 loc_exp_desc.linear_type =
03102 TYP_LINEAR(loc_exp_desc.type_idx);
03103 }
03104
03105 #ifdef KEY
03106
03107
03108
03109
03110 #else
03111 if (in_io_list) {
03112
03113
03114
03115
03116 COPY_OPND(opnd2, IL_OPND(tlst2_idx));
03117 cast_to_cg_default(&opnd2, &loc_exp_desc);
03118 COPY_OPND(IL_OPND(tlst2_idx), opnd2);
03119 }
03120 #endif
03121 }
03122
03123 IL_FLD(tlst3_idx) = CN_Tbl_Idx;
03124 IL_LINE_NUM(tlst3_idx) = line;
03125 IL_COL_NUM(tlst3_idx) = col;
03126 IL_IDX(tlst3_idx) = CN_INTEGER_ONE_IDX;
03127 }
03128
03129 # if defined(_TARGET_OS_MAX)
03130
03131 # ifdef _F_MINUS_MINUS
03132 if (save_pe_dv_list_idx != NULL_IDX) {
03133
03134
03135 list1_idx = IR_IDX_R(sub_idx);
03136
03137 while (IL_NEXT_LIST_IDX(list1_idx)) {
03138 list1_idx = IL_NEXT_LIST_IDX(list1_idx);
03139 }
03140
03141 IL_NEXT_LIST_IDX(list1_idx) = save_pe_dv_list_idx;
03142 IL_PREV_LIST_IDX(save_pe_dv_list_idx) = list1_idx;
03143 IR_LIST_CNT_R(sub_idx) += 1;
03144 }
03145 else if (ATD_PE_ARRAY_IDX(attr_idx) &&
03146 ! ATD_ALLOCATABLE(attr_idx)) {
03147
03148
03149 list1_idx = IR_IDX_R(sub_idx);
03150
03151 if (list1_idx) {
03152 while (IL_NEXT_LIST_IDX(list1_idx) != NULL_IDX) {
03153 list1_idx = IL_NEXT_LIST_IDX(list1_idx);
03154 }
03155
03156 NTR_IR_LIST_TBL(IL_NEXT_LIST_IDX(list1_idx));
03157 IL_PREV_LIST_IDX(IL_NEXT_LIST_IDX(list1_idx)) = list1_idx;
03158 list1_idx = IL_NEXT_LIST_IDX(list1_idx);
03159 IR_LIST_CNT_R(sub_idx) += 1;
03160 }
03161 else {
03162 NTR_IR_LIST_TBL(list1_idx);
03163 IR_FLD_R(sub_idx) = IL_Tbl_Idx;
03164 IR_LIST_CNT_R(sub_idx) = 1;
03165 IR_IDX_R(sub_idx) = list1_idx;
03166
03167 IR_OPR(sub_idx) = Subscript_Opr;
03168 }
03169
03170 NTR_IR_TBL(plus_idx);
03171 IR_OPR(plus_idx) = My_Pe_Opr;
03172 IR_TYPE_IDX(plus_idx) = INTEGER_DEFAULT_TYPE;
03173 IR_LINE_NUM(plus_idx) = IR_LINE_NUM(sub_idx);
03174 IR_COL_NUM(plus_idx) = IR_COL_NUM(sub_idx);
03175
03176 IL_FLD(list1_idx) = IR_Tbl_Idx;
03177 IL_IDX(list1_idx) = plus_idx;
03178
03179 IL_PE_SUBSCRIPT(list1_idx) = TRUE;
03180 io_item_must_flatten = TRUE;
03181 }
03182 # endif
03183 # endif
03184
03185 if (ok &&
03186 TYP_TYPE(ATD_TYPE_IDX(attr_idx)) == Character) {
03187 ok = gen_whole_substring(opnd, IR_RANK(sub_idx));
03188 }
03189
03190 IR_ARRAY_SYNTAX(sub_idx) = FALSE;
03191
03192 EXIT:
03193
03194 TRACE (Func_Exit, "gen_whole_subscript", NULL);
03195
03196 return(ok);
03197
03198 }
03199
03200
03201
03202
03203
03204
03205
03206
03207
03208
03209
03210
03211
03212
03213
03214
03215
03216
03217 boolean gen_whole_substring (opnd_type *opnd,
03218 int rank)
03219
03220 {
03221 int attr_idx;
03222 int clen_idx;
03223 int col;
03224 int ir_idx;
03225 int line;
03226 int list_idx;
03227 int list1_idx;
03228 int list2_idx;
03229 int shift_idx;
03230 int sub_idx;
03231 boolean ok = TRUE;
03232
03233
03234 TRACE (Func_Entry, "gen_whole_substring", NULL);
03235
03236
03237
03238 attr_idx = find_base_attr(opnd, &line, &col);
03239
03240 NTR_IR_TBL(sub_idx);
03241
03242 COPY_OPND(IR_OPND_L(sub_idx), (*opnd));
03243
03244 IR_OPR(sub_idx) = Whole_Substring_Opr;
03245 IR_RANK(sub_idx) = rank;
03246 IR_TYPE_IDX(sub_idx) = ATD_TYPE_IDX(attr_idx);
03247 IR_LINE_NUM(sub_idx) = line;
03248 IR_COL_NUM(sub_idx) = col;
03249
03250 OPND_FLD((*opnd)) = IR_Tbl_Idx;
03251 OPND_IDX((*opnd)) = sub_idx;
03252
03253 IR_FLD_R(sub_idx) = IL_Tbl_Idx;
03254 IR_LIST_CNT_R(sub_idx) = 2;
03255
03256 NTR_IR_LIST_TBL(list1_idx);
03257 IR_IDX_R(sub_idx) = list1_idx;
03258 IL_FLD(list1_idx) = CN_Tbl_Idx;
03259 IL_IDX(list1_idx) = CN_INTEGER_ONE_IDX;
03260 IL_LINE_NUM(list1_idx) = line;
03261 IL_COL_NUM(list1_idx) = col;
03262
03263 NTR_IR_LIST_TBL(list2_idx);
03264 IL_NEXT_LIST_IDX(list1_idx) = list2_idx;
03265 IL_PREV_LIST_IDX(list2_idx) = list1_idx;
03266
03267 if (ATD_CLASS(attr_idx) == CRI__Pointee &&
03268 TYP_CHAR_CLASS(ATD_TYPE_IDX(attr_idx)) == Assumed_Size_Char){
03269
03270 NTR_IR_TBL(clen_idx);
03271 IR_OPR(clen_idx) = Clen_Opr;
03272 IR_TYPE_IDX(clen_idx) = CG_INTEGER_DEFAULT_TYPE;
03273 IR_LINE_NUM(clen_idx) = line;
03274 IR_COL_NUM(clen_idx) = col;
03275 IR_FLD_L(clen_idx) = AT_Tbl_Idx;
03276 IR_IDX_L(clen_idx) = attr_idx;
03277 IR_LINE_NUM_L(clen_idx) = line;
03278 IR_COL_NUM_L(clen_idx) = col;
03279 IL_FLD(list2_idx) = IR_Tbl_Idx;
03280 IL_IDX(list2_idx) = clen_idx;
03281 }
03282 else if (ATD_CHAR_LEN_IN_DV(attr_idx)) {
03283 NTR_IR_TBL(ir_idx);
03284 IR_OPR(ir_idx) = Dv_Access_El_Len;
03285 IR_TYPE_IDX(ir_idx) = SA_INTEGER_DEFAULT_TYPE;
03286 IR_LINE_NUM(ir_idx) = line;
03287 IR_COL_NUM(ir_idx) = col;
03288 IR_FLD_L(ir_idx) = AT_Tbl_Idx;
03289 IR_IDX_L(ir_idx) = attr_idx;
03290 IR_LINE_NUM_L(ir_idx) = line;
03291 IR_COL_NUM_L(ir_idx) = col;
03292
03293 if (char_len_in_bytes) {
03294
03295 IL_FLD(list2_idx) = IR_Tbl_Idx;
03296 IL_IDX(list2_idx) = ir_idx;
03297 }
03298 else {
03299 NTR_IR_TBL(shift_idx);
03300 IR_OPR(shift_idx) = Shiftr_Opr;
03301 IR_TYPE_IDX(shift_idx) = CG_INTEGER_DEFAULT_TYPE;
03302 IR_LINE_NUM(shift_idx) = line;
03303 IR_COL_NUM(shift_idx) = col;
03304
03305 NTR_IR_LIST_TBL(list_idx);
03306
03307 IR_FLD_L(shift_idx) = IL_Tbl_Idx;
03308 IR_IDX_L(shift_idx) = list_idx;
03309 IR_LIST_CNT_L(shift_idx) = 2;
03310 IL_FLD(list_idx) = IR_Tbl_Idx;
03311 IL_IDX(list_idx) = ir_idx;
03312
03313 NTR_IR_LIST_TBL(IL_NEXT_LIST_IDX(list_idx));
03314 IL_PREV_LIST_IDX(IL_NEXT_LIST_IDX(list_idx)) = list_idx;
03315 list_idx = IL_NEXT_LIST_IDX(list_idx);
03316
03317 IL_FLD(list_idx) = CN_Tbl_Idx;
03318 IL_LINE_NUM(list_idx) = line;
03319 IL_COL_NUM(list_idx) = col;
03320 IL_IDX(list_idx) = CN_INTEGER_THREE_IDX;
03321 IL_FLD(list2_idx) = IR_Tbl_Idx;
03322 IL_IDX(list2_idx) = shift_idx;
03323 }
03324 }
03325 else {
03326 IL_IDX(list2_idx) = TYP_IDX(ATD_TYPE_IDX(attr_idx));
03327 IL_FLD(list2_idx) = TYP_FLD(ATD_TYPE_IDX(attr_idx));
03328 IL_LINE_NUM(list2_idx) = line;
03329 IL_COL_NUM(list2_idx) = col;
03330
03331 if (IL_FLD(list2_idx) == AT_Tbl_Idx) {
03332 ADD_TMP_TO_SHARED_LIST(IL_IDX(list2_idx));
03333 }
03334 }
03335
03336 add_substring_length(sub_idx);
03337
03338 IR_ARRAY_SYNTAX(sub_idx) = FALSE;
03339
03340 TRACE (Func_Exit, "gen_whole_substring", NULL);
03341
03342 return(ok);
03343
03344 }
03345
03346
03347
03348
03349
03350
03351
03352
03353
03354
03355
03356
03357
03358
03359
03360
03361
03362
03363
03364
03365
03366
03367 boolean operation_is_intrinsic(operator_type opr,
03368 int type_idx_l,
03369 int rank_l,
03370 int type_idx_r,
03371 int rank_r)
03372
03373 {
03374 linear_type_type exp_idx_l;
03375 linear_type_type exp_idx_r;
03376 boolean intrinsic = TRUE;
03377 basic_type_type type_l;
03378 basic_type_type type_r;
03379
03380
03381 TRACE (Func_Entry, "operation_is_intrinsic", NULL);
03382
03383 if (opr == Null_Opr) {
03384 intrinsic = FALSE;
03385 goto EXIT;
03386 }
03387
03388 type_l = TYP_TYPE(type_idx_l);
03389 type_r = TYP_TYPE(type_idx_r);
03390 exp_idx_l = TYP_LINEAR(type_idx_l);
03391 exp_idx_r = TYP_LINEAR(type_idx_r);
03392
03393 if (type_r != Typeless) {
03394
03395 if (opr == Asg_Opr) {
03396
03397 if (rank_l != rank_r &&
03398 rank_r != 0) {
03399
03400 intrinsic = FALSE;
03401 goto EXIT;
03402 }
03403 }
03404 else {
03405
03406 if (rank_l != rank_r &&
03407 rank_l * rank_r != 0) {
03408
03409 intrinsic = FALSE;
03410 goto EXIT;
03411 }
03412 }
03413 }
03414
03415 switch (opr) {
03416 case Plus_Opr :
03417
03418 if (type_r == Typeless) {
03419
03420 if (UN_PLUS_TYPE(exp_idx_l) == Err_Res ||
03421 UN_PLUS_EXTN(exp_idx_l)) {
03422 intrinsic = FALSE;
03423 }
03424 }
03425 else {
03426 if (BIN_ADD_TYPE(exp_idx_l, exp_idx_r) == Err_Res ||
03427 BIN_ADD_EXTN(exp_idx_l, exp_idx_r)) {
03428 intrinsic = FALSE;
03429 }
03430 }
03431 break;
03432
03433 case Minus_Opr :
03434
03435 if (type_r == Typeless) {
03436
03437 if (UN_PLUS_TYPE(exp_idx_l) == Err_Res ||
03438 UN_PLUS_EXTN(exp_idx_l)) {
03439 intrinsic = FALSE;
03440 }
03441 }
03442 else {
03443 if (BIN_SUB_TYPE(exp_idx_l, exp_idx_r) == Err_Res ||
03444 BIN_SUB_EXTN(exp_idx_l, exp_idx_r)) {
03445 intrinsic = FALSE;
03446 }
03447 }
03448 break;
03449
03450 case Power_Opr :
03451
03452 if (POWER_TYPE(exp_idx_l, exp_idx_r) == Err_Res ||
03453 POWER_EXTN(exp_idx_l, exp_idx_r)) {
03454 intrinsic = FALSE;
03455 }
03456 break;
03457
03458 case Div_Opr :
03459 case Mult_Opr :
03460
03461 if (MULT_DIV_TYPE(exp_idx_l, exp_idx_r) == Err_Res ||
03462 MULT_DIV_EXTN(exp_idx_l, exp_idx_r)) {
03463 intrinsic = FALSE;
03464 }
03465 break;
03466
03467 case Concat_Opr :
03468
03469 if (type_l != Character || type_r != Character) {
03470 intrinsic = FALSE;
03471 }
03472 break;
03473
03474 case Eq_Opr :
03475 # ifndef KEY
03476 case Ge_Opr :
03477 # endif
03478
03479 if (EQ_NE_TYPE(exp_idx_l, exp_idx_r) == Err_Res ||
03480 EQ_NE_EXTN(exp_idx_l, exp_idx_r)) {
03481 intrinsic = FALSE;
03482 }
03483 break;
03484
03485 # ifdef KEY
03486 case Ge_Opr :
03487 # endif
03488 case Gt_Opr :
03489 case Le_Opr :
03490 case Lt_Opr :
03491 case Ne_Opr :
03492
03493 if (GT_LT_TYPE(exp_idx_l, exp_idx_r) == Err_Res ||
03494 GT_LT_EXTN(exp_idx_l, exp_idx_r)) {
03495 intrinsic = FALSE;
03496 }
03497 break;
03498
03499 case And_Opr :
03500 case Eqv_Opr :
03501 case Neqv_Opr :
03502 case Or_Opr :
03503
03504 if (AND_OR_TYPE(exp_idx_l, exp_idx_r) == Err_Res ||
03505 AND_OR_EXTN(exp_idx_l, exp_idx_r)) {
03506 intrinsic = FALSE;
03507 }
03508 break;
03509
03510 case Not_Opr :
03511
03512 if (NOT_TYPE(exp_idx_l) == Err_Res ||
03513 NOT_EXTN(exp_idx_l)) {
03514 intrinsic = FALSE;
03515 }
03516 break;
03517
03518 case Asg_Opr :
03519
03520 if (ASG_TYPE(exp_idx_l, exp_idx_r) == Err_Res ||
03521 ASG_TYPE(exp_idx_l, exp_idx_r) == Structure_Type ||
03522 ASG_EXTN(exp_idx_l, exp_idx_r)) {
03523 intrinsic = FALSE;
03524 }
03525 break;
03526 }
03527
03528
03529
03530 EXIT:
03531
03532 TRACE (Func_Exit, "operation_is_intrinsic", NULL);
03533
03534 return(intrinsic);
03535
03536 }
03537
03538
03539
03540
03541
03542
03543
03544
03545
03546
03547
03548
03549
03550
03551
03552
03553
03554
03555
03556
03557
03558
03559
03560 boolean fold_relationals(int idx_1,
03561 int idx_2,
03562 operator_type opr)
03563
03564 {
03565 long_type folded_const[MAX_WORDS_FOR_NUMERIC];
03566 boolean ok;
03567 int unused;
03568
03569
03570 TRACE (Func_Entry, "fold_relationals", NULL);
03571
03572 switch (opr) {
03573 case Eq_Opr:
03574 case Ne_Opr:
03575 case Lt_Opr:
03576 case Le_Opr:
03577 case Gt_Opr:
03578 case Ge_Opr:
03579
03580 unused = CG_LOGICAL_DEFAULT_TYPE;
03581
03582 ok = folder_driver((char *)&CN_CONST(idx_1),
03583 CN_TYPE_IDX(idx_1),
03584 (char *)&CN_CONST(idx_2),
03585 CN_TYPE_IDX(idx_2),
03586 folded_const,
03587 &unused,
03588 stmt_start_line,
03589 stmt_start_col,
03590 2,
03591 opr);
03592
03593 break;
03594
03595 default :
03596 PRINTMSG(stmt_start_line, 251, Internal, stmt_start_col);
03597 break;
03598
03599 }
03600
03601
03602 TRACE (Func_Exit, "fold_relationals", NULL);
03603
03604 return(THIS_IS_TRUE(folded_const,unused));
03605
03606 }
03607
03608 # ifdef KEY
03609 static boolean is_loop_index_of_forall_loop (int ir_idx)
03610 {
03611 int stmt_sh_idx, forall_list_idx, index_idx;
03612 boolean found = FALSE;
03613
03614 stmt_sh_idx = SH_PREV_IDX(curr_stmt_sh_idx);
03615 while (stmt_sh_idx != NULL_IDX){
03616 if ( IR_OPR(SH_IR_IDX(stmt_sh_idx)) == Forall_Opr ){
03617 found = TRUE;
03618 break;
03619 }
03620 else if (SH_STMT_TYPE(stmt_sh_idx) == End_Forall_Stmt)
03621 break;
03622 stmt_sh_idx = SH_PREV_IDX(stmt_sh_idx);
03623 }
03624
03625 if (!found)
03626 return FALSE;
03627
03628 forall_list_idx = IR_IDX_R(SH_IR_IDX(stmt_sh_idx));
03629 index_idx = IL_IDX(forall_list_idx);
03630
03631 if (IL_FLD(index_idx) == AT_Tbl_Idx){
03632 index_idx = IL_IDX(index_idx);
03633 ir_idx = IL_IDX(ir_idx);
03634 if (AT_ATTR_LINK(index_idx) == ir_idx)
03635 return TRUE;
03636 }
03637 return FALSE;
03638 }
03639 static int ir_contains_variable_subscript(int ir_idx, int pos)
03640 {
03641 int ret_idx = NULL_IDX;
03642 int attr_bd_idx;
03643
03644 if (IR_OPR(ir_idx) == Subscript_Opr)
03645 {
03646 int arg_idx = IR_IDX_R(ir_idx);
03647 for (int index = 1; index < pos; index++)
03648 arg_idx = IL_NEXT_LIST_IDX(arg_idx);
03649 if (IL_FLD(arg_idx) == AT_Tbl_Idx){
03650 int array_idx = IR_IDX_L(ir_idx);
03651 if (IR_FLD_L(ir_idx) == AT_Tbl_Idx &&
03652 is_loop_index_of_forall_loop(arg_idx)){
03653 attr_bd_idx = ATD_ARRAY_IDX(array_idx);
03654 if (BD_LB_FLD(attr_bd_idx, pos) == CN_Tbl_Idx &&
03655 BD_UB_FLD(attr_bd_idx, pos) == CN_Tbl_Idx &&
03656 BD_SM_FLD(attr_bd_idx, pos) == CN_Tbl_Idx)
03657 return ir_idx;
03658 }
03659 }
03660 }
03661 else{
03662 if (IR_FLD_L(ir_idx) == IR_Tbl_Idx){
03663 ret_idx = ir_contains_variable_subscript(IR_IDX_L(ir_idx), pos);
03664 if (ret_idx != NULL_IDX)
03665 return ret_idx;
03666 }
03667
03668 if (IR_FLD_R(ir_idx) == IR_Tbl_Idx){
03669 ret_idx = ir_contains_variable_subscript(IR_IDX_R(ir_idx), pos);
03670 if (ret_idx != NULL_IDX)
03671 return ret_idx;
03672 }
03673 }
03674 return ret_idx;
03675 }
03676 static void change_extent(opnd_type *result_opnd)
03677 {
03678 int subscript_idx, list_idx_11, list_idx_12, list_idx_13,list_idx_14, list_idx_15, list_idx_16, maxval_idx, arg_idx, triplet_idx, attr_bd_idx, i, line, col;
03679
03680 i = 1;
03681 line = OPND_LINE_NUM((*result_opnd));
03682 col = OPND_COL_NUM((*result_opnd));
03683 subscript_idx = NULL_IDX;
03684 if (OPND_FLD((*result_opnd)) == IR_Tbl_Idx)
03685 subscript_idx = ir_contains_variable_subscript(OPND_IDX((*result_opnd)),i);
03686 if (subscript_idx != NULL_IDX)
03687 {
03688
03689 NTR_IR_LIST_TBL(list_idx_11);
03690 maxval_idx = gen_ir(IL_Tbl_Idx, list_idx_11, Maxval_Opr, SA_INTEGER_DEFAULT_TYPE, line, col, NO_Tbl_Idx, NULL_IDX);
03691 IR_RANK(maxval_idx) = 0;
03692 IR_LIST_CNT_L(maxval_idx) = 3;
03693 IR_LIST_CNT_R(maxval_idx) = 0;
03694
03695 IL_FLD(list_idx_11) = IR_Tbl_Idx;
03696 IL_ARG_DESC_VARIANT(list_idx_11) = TRUE;
03697 IL_LINE_NUM(list_idx_11) = line;
03698 IL_COL_NUM(list_idx_11) = col;
03699 IL_IDX(list_idx_11) = OPND_IDX((*result_opnd));
03700
03701 IR_OPR(subscript_idx) = Whole_Subscript_Opr;
03702 arg_idx = IR_IDX_R(subscript_idx);
03703 for (int index = 1; index < i; index++)
03704 arg_idx = IL_NEXT_LIST_IDX(arg_idx);
03705
03706 attr_bd_idx = ATD_ARRAY_IDX(IR_IDX_L(subscript_idx));
03707
03708 NTR_IR_LIST_TBL(list_idx_14);
03709 triplet_idx = gen_ir(IL_Tbl_Idx, list_idx_14, Triplet_Opr, SA_INTEGER_DEFAULT_TYPE, line, col, NO_Tbl_Idx, NULL_IDX);
03710 IR_LIST_CNT_L(triplet_idx) = 3;
03711
03712 IL_FLD(arg_idx) = IR_Tbl_Idx;
03713 IL_IDX(arg_idx) = triplet_idx;
03714 IL_LINE_NUM(arg_idx) = line;
03715 IL_COL_NUM(arg_idx) = col;
03716
03717 IL_ARG_DESC_VARIANT(list_idx_14) = TRUE;
03718 IL_LINE_NUM(list_idx_14) = line;
03719 IL_COL_NUM(list_idx_14) = col;
03720 IL_FLD(list_idx_14) = BD_LB_FLD(attr_bd_idx, i);
03721 IL_IDX(list_idx_14) = BD_LB_IDX(attr_bd_idx, i);
03722
03723 NTR_IR_LIST_TBL(list_idx_15);
03724 IL_ARG_DESC_VARIANT(list_idx_15) = TRUE;
03725 IL_LINE_NUM(list_idx_15) = line;
03726 IL_COL_NUM(list_idx_15) = col;
03727 IL_FLD(list_idx_15) = BD_UB_FLD(attr_bd_idx, i);
03728 IL_IDX(list_idx_15) = BD_UB_IDX(attr_bd_idx, i);
03729 IL_NEXT_LIST_IDX(list_idx_14) = list_idx_15;
03730
03731 NTR_IR_LIST_TBL(list_idx_16);
03732 IL_ARG_DESC_VARIANT(list_idx_16) = TRUE;
03733 IL_LINE_NUM(list_idx_16) = line;
03734 IL_COL_NUM(list_idx_16) = col;
03735 IL_FLD(list_idx_16) = BD_XT_FLD(attr_bd_idx, i);
03736 IL_IDX(list_idx_16) = C_INT_TO_CN(SA_INTEGER_DEFAULT_TYPE, CN_INT_TO_C(BD_UB_IDX(attr_bd_idx,i))/CN_INT_TO_C(BD_XT_IDX(attr_bd_idx,i)));
03737 IL_NEXT_LIST_IDX(list_idx_15) = list_idx_16;
03738
03739 IL_NEXT_LIST_IDX(list_idx_16) = NULL_IDX;
03740
03741 NTR_IR_LIST_TBL(list_idx_12);
03742 IL_FLD(list_idx_12) = CN_Tbl_Idx;
03743 IL_IDX(list_idx_12) = C_INT_TO_CN(CG_INTEGER_DEFAULT_TYPE, i);;
03744 IL_ARG_DESC_VARIANT(list_idx_12) = TRUE;
03745 IL_LINE_NUM(list_idx_12) = line;
03746 IL_COL_NUM(list_idx_12) = col;
03747 IL_NEXT_LIST_IDX(list_idx_11) = list_idx_12;
03748
03749 NTR_IR_LIST_TBL(list_idx_13);
03750 IL_FLD(list_idx_13) = NO_Tbl_Idx;
03751 IL_LINE_NUM(list_idx_13) = line;
03752 IL_COL_NUM(list_idx_13) = col;
03753 IL_ARG_DESC_VARIANT(list_idx_13) = TRUE;
03754 IL_NEXT_LIST_IDX(list_idx_12) = list_idx_13;
03755 IL_NEXT_LIST_IDX(list_idx_13) = NULL_IDX;
03756
03757 OPND_IDX((*result_opnd)) = maxval_idx;
03758 }
03759 }
03760 #endif
03761
03762
03763
03764
03765
03766
03767
03768
03769
03770
03771
03772
03773
03774
03775
03776
03777 void make_triplet_extent_tree(opnd_type *opnd,
03778 int list_idx)
03779
03780 {
03781 int col;
03782 int div_idx;
03783 expr_arg_type exp_desc;
03784 boolean foldable = TRUE;
03785 int line;
03786 int plus_idx;
03787 int list_idx2;
03788 int max_idx;
03789 expr_mode_type save_expr_mode;
03790 cif_usage_code_type save_xref_state;
03791 int sub_idx;
03792 opnd_type topnd;
03793 boolean unused;
03794 boolean will_fold_later = TRUE;
03795
03796
03797 TRACE (Func_Entry, "make_triplet_extent_tree", NULL);
03798
03799 find_opnd_line_and_column(opnd, &line, &col);
03800
03801 NTR_IR_TBL(plus_idx);
03802 IR_OPR(plus_idx) = Plus_Opr;
03803 IR_TYPE_IDX(plus_idx) = CG_INTEGER_DEFAULT_TYPE;
03804 IR_LINE_NUM(plus_idx) = line;
03805 IR_COL_NUM(plus_idx) = col;
03806
03807 NTR_IR_TBL(div_idx);
03808 IR_OPR(div_idx) = Div_Opr;
03809 IR_TYPE_IDX(div_idx) = CG_INTEGER_DEFAULT_TYPE;
03810 IR_LINE_NUM(div_idx) = line;
03811 IR_COL_NUM(div_idx) = col;
03812
03813 NTR_IR_TBL(sub_idx);
03814 IR_OPR(sub_idx) = Minus_Opr;
03815 IR_TYPE_IDX(sub_idx) = CG_INTEGER_DEFAULT_TYPE;
03816 IR_LINE_NUM(sub_idx) = line;
03817 IR_COL_NUM(sub_idx) = col;
03818
03819 NTR_IR_TBL(max_idx);
03820 IR_OPR(max_idx) = Max_Opr;
03821 IR_TYPE_IDX(max_idx) = CG_INTEGER_DEFAULT_TYPE;
03822 IR_LINE_NUM(max_idx) = line;
03823 IR_COL_NUM(max_idx) = col;
03824
03825
03826 OPND_FLD((*opnd)) = IR_Tbl_Idx;
03827 OPND_IDX((*opnd)) = max_idx;
03828
03829 NTR_IR_LIST_TBL(list_idx2);
03830 IR_FLD_L(max_idx) = IL_Tbl_Idx;
03831 IR_LIST_CNT_L(max_idx) = 2;
03832 IR_IDX_L(max_idx) = list_idx2;
03833
03834 IL_FLD(list_idx2) = IR_Tbl_Idx;
03835 IL_IDX(list_idx2) = div_idx;
03836
03837 NTR_IR_LIST_TBL(IL_NEXT_LIST_IDX(list_idx2));
03838 IL_PREV_LIST_IDX(IL_NEXT_LIST_IDX(list_idx2)) = list_idx2;
03839 list_idx2 = IL_NEXT_LIST_IDX(list_idx2);
03840
03841 IL_FLD(list_idx2) = CN_Tbl_Idx;
03842 IL_IDX(list_idx2) = CN_INTEGER_ZERO_IDX;
03843 IL_LINE_NUM(list_idx2) = line;
03844 IL_COL_NUM(list_idx2) = col;
03845
03846 IR_FLD_L(div_idx) = IR_Tbl_Idx;
03847 IR_IDX_L(div_idx) = plus_idx;
03848
03849 IR_FLD_L(plus_idx) = IR_Tbl_Idx;
03850 IR_IDX_L(plus_idx) = sub_idx;
03851
03852
03853 COPY_OPND(topnd, IL_OPND(list_idx));
03854 copy_subtree(&topnd, &topnd);
03855 COPY_OPND(IR_OPND_R(sub_idx), topnd);
03856
03857 foldable = foldable && (IL_FLD(list_idx) == CN_Tbl_Idx ||
03858 SHAPE_FOLDABLE(IL_OPND(list_idx)));
03859 will_fold_later = will_fold_later &&
03860 SHAPE_WILL_FOLD_LATER(IL_OPND(list_idx));
03861
03862 list_idx = IL_NEXT_LIST_IDX(list_idx);
03863
03864
03865 COPY_OPND(topnd, IL_OPND(list_idx));
03866 copy_subtree(&topnd, &topnd);
03867
03868 # ifdef KEY
03869 change_extent(&topnd);
03870 # endif
03871 COPY_OPND(IR_OPND_L(sub_idx), topnd);
03872
03873 foldable = foldable && (IL_FLD(list_idx) == CN_Tbl_Idx ||
03874 SHAPE_FOLDABLE(IL_OPND(list_idx)));
03875 will_fold_later = will_fold_later &&
03876 SHAPE_WILL_FOLD_LATER(IL_OPND(list_idx));
03877
03878 list_idx = IL_NEXT_LIST_IDX(list_idx);
03879
03880
03881 COPY_OPND(topnd, IL_OPND(list_idx));
03882 copy_subtree(&topnd, &topnd);
03883 COPY_OPND(IR_OPND_R(div_idx), topnd);
03884
03885 COPY_OPND(topnd, IL_OPND(list_idx));
03886 copy_subtree(&topnd, &topnd);
03887 COPY_OPND(IR_OPND_R(plus_idx), topnd);
03888
03889 foldable = foldable && (IL_FLD(list_idx) == CN_Tbl_Idx ||
03890 SHAPE_FOLDABLE(IL_OPND(list_idx)));
03891 will_fold_later = will_fold_later &&
03892 SHAPE_WILL_FOLD_LATER(IL_OPND(list_idx));
03893
03894 if (foldable) {
03895 save_xref_state = xref_state;
03896 xref_state = CIF_No_Usage_Rec;
03897 save_expr_mode = expr_mode;
03898 expr_mode = Regular_Expr;
03899
03900 exp_desc.rank = 0;
03901 unused = expr_semantics(opnd, &exp_desc);
03902 xref_state = save_xref_state;
03903 expr_mode = save_expr_mode;
03904
03905 SHAPE_FOLDABLE((*opnd)) = exp_desc.foldable;
03906 SHAPE_WILL_FOLD_LATER((*opnd)) = exp_desc.will_fold_later;
03907 }
03908 else {
03909 SHAPE_FOLDABLE((*opnd)) = foldable;
03910 SHAPE_WILL_FOLD_LATER((*opnd)) = will_fold_later;
03911 }
03912
03913
03914 TRACE (Func_Exit, "make_triplet_extent_tree", NULL);
03915
03916 return;
03917
03918 }
03919
03920
03921
03922
03923
03924
03925
03926
03927
03928
03929
03930
03931
03932
03933
03934
03935
03936
03937
03938
03939
03940
03941
03942
03943 boolean check_asg_semantics(int l_new_type_idx,
03944 int r_new_type_idx,
03945 int line,
03946 int col)
03947
03948 {
03949 boolean correct = TRUE;
03950 linear_type_type exp_idx_l;
03951 linear_type_type exp_idx_r;
03952
03953
03954 TRACE (Func_Entry, "check_asg_semantics", NULL);
03955
03956 exp_idx_l = TYP_LINEAR(l_new_type_idx);
03957 exp_idx_r = TYP_LINEAR(r_new_type_idx);
03958
03959 if (TYP_TYPE(r_new_type_idx) == Character &&
03960 compare_cn_and_value(TYP_IDX(r_new_type_idx),
03961 MAX_CHARS_IN_TYPELESS,
03962 Le_Opr)) {
03963 exp_idx_r = Short_Char_Const;
03964 }
03965
03966 if (ASG_TYPE(exp_idx_l, exp_idx_r) == Err_Res) {
03967 correct = FALSE;
03968 }
03969 else if (ASG_TYPE(exp_idx_l, exp_idx_r) == Structure_Type &&
03970 !compare_derived_types(l_new_type_idx, r_new_type_idx)) {
03971 correct = FALSE;
03972 }
03973
03974 if (correct &&
03975 ASG_EXTN(exp_idx_l, exp_idx_r) &&
03976 TYP_TYPE(r_new_type_idx) == Character &&
03977 line != -1) {
03978
03979 PRINTMSG(line, 161, Ansi, col);
03980 }
03981
03982 TRACE (Func_Exit, "check_asg_semantics", NULL);
03983
03984 return(correct);
03985
03986 }
03987
03988
03989
03990
03991
03992
03993
03994
03995
03996
03997
03998
03999
04000
04001
04002
04003
04004
04005 void ptr_assign_from_ptr(opnd_type *l_opnd,
04006 opnd_type *r_opnd)
04007
04008 {
04009 int column;
04010 int dv_idx;
04011 int line;
04012 sh_position_type location;
04013 opnd_type opnd;
04014
04015
04016 TRACE (Func_Entry, "ptr_assign_from_ptr", NULL);
04017
04018 location = (SH_LABELED(curr_stmt_sh_idx)) ? After : Before;
04019
04020
04021
04022
04023
04024
04025 NTR_IR_TBL(dv_idx);
04026
04027 IR_OPR(dv_idx) = Dv_Whole_Copy_Opr;
04028 IR_TYPE_IDX(dv_idx) = TYPELESS_DEFAULT_TYPE;
04029 IR_LINE_NUM(dv_idx) = stmt_start_line;
04030 IR_COL_NUM(dv_idx) = stmt_start_col;
04031
04032 COPY_OPND(IR_OPND_L(dv_idx), (*l_opnd));
04033
04034 COPY_OPND(opnd, (*r_opnd));
04035
04036 if (OPND_FLD(opnd) == IR_Tbl_Idx) {
04037
04038 while (OPND_FLD(opnd) == IR_Tbl_Idx) {
04039 if (IR_OPR(OPND_IDX(opnd)) == Dv_Deref_Opr) {
04040 break;
04041 }
04042 COPY_OPND(opnd, IR_OPND_L(OPND_IDX(opnd)));
04043 }
04044
04045 if (OPND_FLD(opnd) != IR_Tbl_Idx ||
04046 IR_OPR(OPND_IDX(opnd)) != Dv_Deref_Opr) {
04047 find_opnd_line_and_column(&opnd, &line, &column);
04048 PRINTMSG(line, 976, Internal, column);
04049 }
04050 else {
04051 COPY_OPND(opnd, IR_OPND_L(OPND_IDX(opnd)));
04052 }
04053 }
04054 else {
04055 find_opnd_line_and_column(&opnd, &line, &column);
04056 PRINTMSG(line, 977, Internal, column);
04057 }
04058
04059 COPY_OPND(IR_OPND_R(dv_idx), opnd);
04060
04061 gen_sh(location, Assignment_Stmt, stmt_start_line,
04062 stmt_start_col, FALSE, FALSE, TRUE);
04063
04064 if (location == Before) {
04065 SH_IR_IDX(SH_PREV_IDX(curr_stmt_sh_idx)) = dv_idx;
04066 }
04067 else {
04068 SH_IR_IDX(curr_stmt_sh_idx) = dv_idx;
04069 }
04070
04071
04072
04073
04074
04075
04076 NTR_IR_TBL(dv_idx);
04077 IR_OPR(dv_idx) = Dv_Set_P_Or_A;
04078 IR_TYPE_IDX(dv_idx) = TYPELESS_DEFAULT_TYPE;
04079 IR_LINE_NUM(dv_idx) = stmt_start_line;
04080 IR_COL_NUM(dv_idx) = stmt_start_col;
04081
04082 COPY_OPND(IR_OPND_L(dv_idx), (*l_opnd));
04083
04084 IR_FLD_R(dv_idx) = CN_Tbl_Idx;
04085 IR_IDX_R(dv_idx) = CN_INTEGER_ONE_IDX;
04086 IR_LINE_NUM_R(dv_idx) = stmt_start_line;
04087 IR_COL_NUM_R(dv_idx) = stmt_start_col;
04088
04089 gen_sh(location, Assignment_Stmt, stmt_start_line,
04090 stmt_start_col, FALSE, FALSE, TRUE);
04091
04092 if (location == Before) {
04093 SH_IR_IDX(SH_PREV_IDX(curr_stmt_sh_idx)) = dv_idx;
04094 }
04095 else {
04096 SH_IR_IDX(curr_stmt_sh_idx) = dv_idx;
04097 }
04098
04099 TRACE (Func_Exit, "ptr_assign_from_ptr", NULL);
04100
04101 return;
04102
04103 }
04104
04105
04106
04107
04108
04109
04110
04111
04112
04113
04114
04115
04116
04117
04118
04119
04120
04121 void add_substring_length(int sub_idx)
04122
04123 {
04124 int col;
04125 int end_idx;
04126 expr_arg_type exp_desc;
04127 boolean foldit;
04128 int line;
04129 int list_idx;
04130 int list2_idx;
04131 int max_idx;
04132 int minus_idx;
04133 boolean ok;
04134 opnd_type opnd;
04135 int plus_idx;
04136 expr_mode_type save_expr_mode;
04137 cif_usage_code_type save_xref_state;
04138 int start_idx;
04139
04140
04141 TRACE (Func_Entry, "add_substring_length", NULL);
04142
04143 start_idx = IR_IDX_R(sub_idx);
04144 end_idx = IL_NEXT_LIST_IDX(start_idx);
04145
04146 if (IL_FLD(start_idx) == NO_Tbl_Idx ||
04147 IL_FLD(end_idx) == NO_Tbl_Idx) {
04148
04149 goto EXIT;
04150 }
04151
04152 foldit = (IL_FLD(start_idx) == CN_Tbl_Idx) &&
04153 (IL_FLD(end_idx) == CN_Tbl_Idx);
04154
04155 line = IR_LINE_NUM(sub_idx);
04156 col = IR_COL_NUM(sub_idx);
04157
04158 save_expr_mode = expr_mode;
04159
04160 NTR_IR_LIST_TBL(list_idx);
04161 IL_PREV_LIST_IDX(list_idx) = end_idx;
04162 IL_NEXT_LIST_IDX(end_idx) = list_idx;
04163 IR_LIST_CNT_R(sub_idx)++;
04164
04165 NTR_IR_TBL(max_idx);
04166 IR_OPR(max_idx) = Max_Opr;
04167 IR_TYPE_IDX(max_idx) = CG_INTEGER_DEFAULT_TYPE;
04168 IR_LINE_NUM(max_idx) = line;
04169 IR_COL_NUM(max_idx) = col;
04170
04171 IL_FLD(list_idx) = IR_Tbl_Idx;
04172 #ifdef KEY
04173
04174
04175
04176
04177
04178
04179
04180
04181
04182
04183
04184
04185
04186
04187 if (cmd_line_flags.s_integer8) {
04188 int convert_idx = gen_ir(IR_Tbl_Idx, max_idx, Cvrt_Opr,
04189 CG_INTEGER_DEFAULT_TYPE, line, col, NO_Tbl_Idx, NULL_IDX);
04190 IL_IDX(list_idx) = convert_idx;
04191 }
04192 else
04193 #endif
04194 IL_IDX(list_idx) = max_idx;
04195
04196 NTR_IR_LIST_TBL(list2_idx);
04197 IR_FLD_L(max_idx) = IL_Tbl_Idx;
04198 IR_LIST_CNT_L(max_idx) = 2;
04199 IR_IDX_L(max_idx) = list2_idx;
04200
04201 IL_FLD(list2_idx) = CN_Tbl_Idx;
04202 IL_IDX(list2_idx) = CN_INTEGER_ZERO_IDX;
04203 IL_LINE_NUM(list2_idx) = line;
04204 IL_COL_NUM(list2_idx) = col;
04205
04206 NTR_IR_LIST_TBL(IL_NEXT_LIST_IDX(list2_idx));
04207 IL_PREV_LIST_IDX(IL_NEXT_LIST_IDX(list2_idx)) = list2_idx;
04208 list2_idx = IL_NEXT_LIST_IDX(list2_idx);
04209
04210 NTR_IR_TBL(plus_idx);
04211 IR_OPR(plus_idx) = Plus_Opr;
04212 IR_TYPE_IDX(plus_idx) = CG_INTEGER_DEFAULT_TYPE;
04213 IR_LINE_NUM(plus_idx) = line;
04214 IR_COL_NUM(plus_idx) = col;
04215
04216 IL_FLD(list2_idx) = IR_Tbl_Idx;
04217 IL_IDX(list2_idx) = plus_idx;
04218
04219 NTR_IR_TBL(minus_idx);
04220 IR_OPR(minus_idx) = Minus_Opr;
04221 IR_TYPE_IDX(minus_idx) = CG_INTEGER_DEFAULT_TYPE;
04222 IR_LINE_NUM(minus_idx) = line;
04223 IR_COL_NUM(minus_idx) = col;
04224
04225 IR_FLD_R(plus_idx) = IR_Tbl_Idx;
04226 IR_IDX_R(plus_idx) = minus_idx;
04227
04228 COPY_OPND(opnd, IL_OPND(start_idx));
04229 copy_subtree(&opnd, &opnd);
04230 COPY_OPND(IR_OPND_R(minus_idx), opnd);
04231
04232 COPY_OPND(opnd, IL_OPND(end_idx));
04233 copy_subtree(&opnd, &opnd);
04234 COPY_OPND(IR_OPND_L(plus_idx), opnd);
04235
04236 IR_FLD_L(minus_idx) = CN_Tbl_Idx;
04237 IR_IDX_L(minus_idx) = CN_INTEGER_ONE_IDX;
04238 IR_LINE_NUM_L(minus_idx) = line;
04239 IR_COL_NUM_L(minus_idx) = col;
04240
04241 if (foldit) {
04242 expr_mode = Regular_Expr;
04243 save_xref_state = xref_state;
04244 xref_state = CIF_No_Usage_Rec;
04245 COPY_OPND(opnd, IL_OPND(list_idx));
04246 exp_desc.rank = 0;
04247 ok = expr_semantics(&opnd, &exp_desc);
04248 COPY_OPND(IL_OPND(list_idx), opnd);
04249
04250 expr_mode = save_expr_mode;
04251 xref_state = save_xref_state;
04252 }
04253
04254 EXIT:
04255
04256 TRACE (Func_Exit, "add_substring_length", NULL);
04257
04258 return;
04259
04260 }
04261
04262
04263
04264
04265
04266
04267
04268
04269
04270
04271
04272
04273
04274
04275
04276
04277
04278 static boolean array_construct_semantics(opnd_type *top_opnd,
04279 expr_arg_type *exp_desc)
04280
04281 {
04282 int column;
04283 boolean constant_trip = TRUE;
04284 #ifdef KEY
04285 int do_var_idx = 0;
04286 #else
04287 int do_var_idx;
04288 #endif
04289 boolean do_var_ok;
04290 boolean first_item = TRUE;
04291 int line;
04292 expr_arg_type loc_exp_desc;
04293 opnd_type initial_opnd;
04294 #ifdef KEY
04295 int list_idx = 0;
04296 int list2_idx;
04297 int new_do_var_idx = 0;
04298 #else
04299 int list_idx;
04300 int list2_idx;
04301 int new_do_var_idx;
04302 #endif
04303 opnd_type opnd;
04304 boolean ok = TRUE;
04305 expr_mode_type save_expr_mode;
04306 boolean save_in_implied_do;
04307 cif_usage_code_type save_xref_state;
04308 long_type the_constant[MAX_WORDS_FOR_NUMERIC];
04309 int type_idx;
04310
04311
04312 TRACE (Func_Entry, "array_construct_semantics", NULL);
04313
04314 if (OPND_FLD((*top_opnd)) == NO_Tbl_Idx) {
04315 goto EXIT;
04316 }
04317 if (OPND_FLD((*top_opnd)) == IL_Tbl_Idx) {
04318 list_idx = OPND_IDX((*top_opnd));
04319 }
04320 else {
04321 find_opnd_line_and_column(top_opnd, &line, &column);
04322 PRINTMSG(line, 978, Internal, column);
04323 }
04324
04325 #ifdef KEY
04326 boolean needs_char_padding = FALSE;
04327 #endif
04328 while (list_idx != NULL_IDX) {
04329
04330 IL_HAS_FUNCTIONS(list_idx) = FALSE;
04331
04332 constant_trip = TRUE;
04333
04334 if (IL_FLD(list_idx) == IR_Tbl_Idx &&
04335 IR_OPR(IL_IDX(list_idx)) == Implied_Do_Opr) {
04336
04337 list2_idx = IL_NEXT_LIST_IDX(IR_IDX_R(IL_IDX(list_idx)));
04338
04339
04340
04341
04342
04343
04344
04345 COPY_OPND(initial_opnd, IL_OPND(list2_idx));
04346 loc_exp_desc.rank = 0;
04347 number_of_functions = 0;
04348 save_xref_state = xref_state;
04349 xref_state = CIF_Symbol_Reference;
04350 ok = expr_sem(&initial_opnd, &loc_exp_desc) && ok;
04351 COPY_OPND(IL_OPND(list2_idx), initial_opnd);
04352 xref_state = save_xref_state;
04353
04354 IL_ARG_DESC_VARIANT(list2_idx) = TRUE;
04355
04356
04357 arg_info_list_base = arg_info_list_top;
04358 arg_info_list_top = arg_info_list_base + 1;
04359
04360 if (arg_info_list_top >= arg_info_list_size) {
04361 enlarge_info_list_table();
04362 }
04363
04364 IL_ARG_DESC_IDX(list2_idx) = arg_info_list_top;
04365 arg_info_list[arg_info_list_top] = init_arg_info;
04366 arg_info_list[arg_info_list_top].ed = loc_exp_desc;
04367
04368 constant_trip = loc_exp_desc.foldable ||
04369 loc_exp_desc.will_fold_later;
04370
04371 if (number_of_functions > 0) {
04372 IL_HAS_FUNCTIONS(list2_idx) = TRUE;
04373 IL_HAS_FUNCTIONS(list_idx) = TRUE;
04374 }
04375 else {
04376 IL_HAS_FUNCTIONS(list2_idx) = FALSE;
04377 }
04378
04379 if (loc_exp_desc.rank != 0) {
04380 find_opnd_line_and_column(&initial_opnd, &line, &column);
04381 PRINTMSG(line, 476, Error, column);
04382 ok = FALSE;
04383 }
04384
04385 if (loc_exp_desc.linear_type == Long_Typeless) {
04386 find_opnd_line_and_column(&initial_opnd, &line, &column);
04387 PRINTMSG(line, 1133, Error, column);
04388 ok = FALSE;
04389 }
04390 else if (loc_exp_desc.type != Integer &&
04391 loc_exp_desc.type != Typeless) {
04392 find_opnd_line_and_column(&initial_opnd, &line, &column);
04393 PRINTMSG(line, 962, Error, column);
04394 ok = FALSE;
04395 }
04396 else if (loc_exp_desc.linear_type == Short_Typeless_Const) {
04397 find_opnd_line_and_column(&initial_opnd, &line, &column);
04398 IL_IDX(list2_idx) = cast_typeless_constant(IL_IDX(list2_idx),
04399 INTEGER_DEFAULT_TYPE,
04400 line,
04401 column);
04402 loc_exp_desc.type_idx = INTEGER_DEFAULT_TYPE;
04403 loc_exp_desc.type = Integer;
04404 loc_exp_desc.linear_type = INTEGER_DEFAULT_TYPE;
04405 COPY_OPND(initial_opnd, IL_OPND(list2_idx));
04406 }
04407
04408 list2_idx = IL_NEXT_LIST_IDX(list2_idx);
04409
04410
04411
04412
04413
04414 COPY_OPND(opnd, IL_OPND(list2_idx));
04415 loc_exp_desc.rank = 0;
04416 number_of_functions = 0;
04417 save_xref_state = xref_state;
04418 xref_state = CIF_Symbol_Reference;
04419 ok = expr_sem(&opnd, &loc_exp_desc) && ok;
04420 COPY_OPND(IL_OPND(list2_idx), opnd);
04421 xref_state = save_xref_state;
04422
04423 IL_ARG_DESC_VARIANT(list2_idx) = TRUE;
04424
04425
04426 arg_info_list_base = arg_info_list_top;
04427 arg_info_list_top = arg_info_list_base + 1;
04428
04429 if (arg_info_list_top >= arg_info_list_size) {
04430 enlarge_info_list_table();
04431 }
04432
04433 IL_ARG_DESC_IDX(list2_idx) = arg_info_list_top;
04434 arg_info_list[arg_info_list_top] = init_arg_info;
04435 arg_info_list[arg_info_list_top].ed = loc_exp_desc;
04436
04437 constant_trip &= loc_exp_desc.foldable ||
04438 loc_exp_desc.will_fold_later;
04439
04440 if (number_of_functions > 0) {
04441 IL_HAS_FUNCTIONS(list2_idx) = TRUE;
04442 IL_HAS_FUNCTIONS(list_idx) = TRUE;
04443 }
04444 else {
04445 IL_HAS_FUNCTIONS(list2_idx) = FALSE;
04446 }
04447
04448 if (loc_exp_desc.rank != 0) {
04449 find_opnd_line_and_column(&opnd, &line, &column);
04450 PRINTMSG(line, 476, Error, column);
04451 ok = FALSE;
04452 }
04453
04454 if (loc_exp_desc.linear_type == Long_Typeless) {
04455 find_opnd_line_and_column(&opnd, &line, &column);
04456 PRINTMSG(line, 1133, Error, column);
04457 ok = FALSE;
04458 }
04459 else if (loc_exp_desc.type != Integer &&
04460 loc_exp_desc.type != Typeless) {
04461
04462 find_opnd_line_and_column(&opnd, &line, &column);
04463 PRINTMSG(line, 962, Error, column);
04464 ok = FALSE;
04465 }
04466 else if (loc_exp_desc.linear_type == Short_Typeless_Const) {
04467 find_opnd_line_and_column(&opnd, &line, &column);
04468 IL_IDX(list2_idx) = cast_typeless_constant(IL_IDX(list2_idx),
04469 INTEGER_DEFAULT_TYPE,
04470 line,
04471 column);
04472 loc_exp_desc.type_idx = INTEGER_DEFAULT_TYPE;
04473 loc_exp_desc.type = Integer;
04474 loc_exp_desc.linear_type = INTEGER_DEFAULT_TYPE;
04475 }
04476
04477
04478
04479
04480
04481
04482 if (IL_NEXT_LIST_IDX(list2_idx) != NULL_IDX) {
04483 list2_idx = IL_NEXT_LIST_IDX(list2_idx);
04484 COPY_OPND(opnd, IL_OPND(list2_idx));
04485 loc_exp_desc.rank = 0;
04486 number_of_functions = 0;
04487 save_xref_state = xref_state;
04488 xref_state = CIF_Symbol_Reference;
04489 ok = expr_sem(&opnd, &loc_exp_desc) && ok;
04490 COPY_OPND(IL_OPND(list2_idx), opnd);
04491 xref_state = save_xref_state;
04492
04493 find_opnd_line_and_column(&opnd, &line, &column);
04494
04495 IL_ARG_DESC_VARIANT(list2_idx) = TRUE;
04496
04497
04498 arg_info_list_base = arg_info_list_top;
04499 arg_info_list_top = arg_info_list_base + 1;
04500
04501 if (arg_info_list_top >= arg_info_list_size) {
04502 enlarge_info_list_table();
04503 }
04504
04505 IL_ARG_DESC_IDX(list2_idx) = arg_info_list_top;
04506 arg_info_list[arg_info_list_top] = init_arg_info;
04507 arg_info_list[arg_info_list_top].ed = loc_exp_desc;
04508
04509 constant_trip &= loc_exp_desc.foldable ||
04510 loc_exp_desc.will_fold_later;
04511
04512 if (number_of_functions > 0) {
04513 IL_HAS_FUNCTIONS(list2_idx) = TRUE;
04514 IL_HAS_FUNCTIONS(list_idx) = TRUE;
04515 }
04516 else {
04517 IL_HAS_FUNCTIONS(list2_idx) = FALSE;
04518 }
04519
04520 if (loc_exp_desc.rank != 0) {
04521 PRINTMSG(line, 476, Error, column);
04522 ok = FALSE;
04523 }
04524
04525 if (loc_exp_desc.linear_type == Long_Typeless) {
04526 PRINTMSG(line, 1133, Error, column);
04527 ok = FALSE;
04528 }
04529 else if (loc_exp_desc.type != Integer &&
04530 loc_exp_desc.type != Typeless) {
04531
04532 PRINTMSG(line, 962, Error, column);
04533 ok = FALSE;
04534 }
04535 else if (loc_exp_desc.linear_type == Short_Typeless_Const) {
04536 IL_IDX(list2_idx) = cast_typeless_constant(IL_IDX(list2_idx),
04537 INTEGER_DEFAULT_TYPE,
04538 line,
04539 column);
04540 loc_exp_desc.type_idx = INTEGER_DEFAULT_TYPE;
04541 loc_exp_desc.type = Integer;
04542 loc_exp_desc.linear_type = INTEGER_DEFAULT_TYPE;
04543 }
04544
04545 if (ok &&
04546 OPND_FLD(opnd) == CN_Tbl_Idx) {
04547
04548 type_idx = CG_LOGICAL_DEFAULT_TYPE;
04549
04550 ok &= folder_driver((char *)&CN_CONST(OPND_IDX(opnd)),
04551 loc_exp_desc.type_idx,
04552 (char *)&CN_CONST(CN_INTEGER_ZERO_IDX),
04553 CG_INTEGER_DEFAULT_TYPE,
04554 the_constant,
04555 &type_idx,
04556 line,
04557 column,
04558 2,
04559 Eq_Opr);
04560
04561 if (THIS_IS_TRUE(the_constant, type_idx)) {
04562 PRINTMSG(line, 1084, Error, column);
04563 ok = FALSE;
04564 }
04565 }
04566 }
04567 else {
04568
04569 NTR_IR_LIST_TBL(IL_NEXT_LIST_IDX(list2_idx));
04570 list2_idx = IL_NEXT_LIST_IDX(list2_idx);
04571 IR_LIST_CNT_R(IL_IDX(list_idx))++;
04572 IL_FLD(list2_idx) = CN_Tbl_Idx;
04573 IL_IDX(list2_idx) = CN_INTEGER_ONE_IDX;
04574 IL_LINE_NUM(list2_idx) = stmt_start_line;
04575 IL_COL_NUM(list2_idx) = stmt_start_col;
04576 IL_ARG_DESC_VARIANT(list2_idx) = TRUE;
04577
04578
04579 arg_info_list_base = arg_info_list_top;
04580 arg_info_list_top = arg_info_list_base + 1;
04581
04582 if (arg_info_list_top >= arg_info_list_size) {
04583 enlarge_info_list_table();
04584 }
04585
04586 IL_ARG_DESC_IDX(list2_idx) = arg_info_list_top;
04587 arg_info_list[arg_info_list_top] = init_arg_info;
04588 arg_info_list[arg_info_list_top].ed.constant = TRUE;
04589 arg_info_list[arg_info_list_top].ed.foldable = TRUE;
04590 arg_info_list[arg_info_list_top].ed.type = Integer;
04591 arg_info_list[arg_info_list_top].ed.type_idx =
04592 CG_INTEGER_DEFAULT_TYPE;
04593 arg_info_list[arg_info_list_top].ed.linear_type =
04594 CG_INTEGER_DEFAULT_TYPE;
04595 }
04596
04597
04598
04599
04600
04601 list2_idx = IR_IDX_R(IL_IDX(list_idx));
04602
04603 do_var_ok = TRUE;
04604 COPY_OPND(opnd, IL_OPND(list2_idx));
04605 loc_exp_desc.rank = 0;
04606 number_of_functions = 0;
04607 save_xref_state = xref_state;
04608 xref_state = CIF_No_Usage_Rec;
04609 save_in_implied_do = in_implied_do;
04610 in_implied_do = FALSE;
04611 save_expr_mode = expr_mode;
04612 expr_mode = Regular_Expr;
04613 do_var_ok = expr_sem(&opnd, &loc_exp_desc);
04614 COPY_OPND(IL_OPND(list2_idx), opnd);
04615 expr_mode = save_expr_mode;
04616 in_implied_do = save_in_implied_do;
04617 xref_state = save_xref_state;
04618
04619 if (number_of_functions > 0) {
04620 IL_HAS_FUNCTIONS(list2_idx) = TRUE;
04621 IL_HAS_FUNCTIONS(list_idx) = TRUE;
04622 }
04623 else {
04624 IL_HAS_FUNCTIONS(list2_idx) = FALSE;
04625 }
04626
04627
04628
04629 if (!loc_exp_desc.reference) {
04630 find_opnd_line_and_column(&opnd, &line, &column);
04631 PRINTMSG(line, 481, Error, column);
04632 do_var_ok = FALSE;
04633 }
04634 else {
04635
04636 if (loc_exp_desc.type != Integer) {
04637 find_opnd_line_and_column(&opnd, &line, &column);
04638 PRINTMSG(line, 675, Error, column);
04639 do_var_ok = FALSE;
04640 }
04641
04642 if (OPND_FLD(opnd) == IR_Tbl_Idx &&
04643 IR_OPR(OPND_IDX(opnd)) == Whole_Subscript_Opr) {
04644 COPY_OPND(opnd, IR_OPND_L(OPND_IDX(opnd)));
04645 }
04646
04647 if (OPND_FLD(opnd) == IR_Tbl_Idx &&
04648 IR_OPR(OPND_IDX(opnd)) == Dv_Deref_Opr) {
04649 COPY_OPND(opnd, IR_OPND_L(OPND_IDX(opnd)));
04650 }
04651
04652 if (do_var_ok &&
04653 OPND_FLD(opnd) != AT_Tbl_Idx) {
04654 find_opnd_line_and_column(&opnd, &line, &column);
04655 PRINTMSG(line, 530, Error, column);
04656 do_var_ok = FALSE;
04657 }
04658 else {
04659 do_var_idx = OPND_IDX(opnd);
04660 }
04661
04662 if (do_var_ok &&
04663 loc_exp_desc.rank) {
04664 find_opnd_line_and_column(&opnd, &line, &column);
04665 PRINTMSG(line, 837, Ansi, column);
04666 }
04667
04668 }
04669
04670 if (do_var_ok) {
04671
04672 if (AT_ATTR_LINK(do_var_idx)) {
04673 find_opnd_line_and_column(&opnd, &line, &column);
04674 PRINTMSG(line, 533, Error, column,
04675 AT_OBJ_NAME_PTR(do_var_idx));
04676 do_var_ok = FALSE;
04677 }
04678 else {
04679 find_opnd_line_and_column(&opnd, &line, &column);
04680 new_do_var_idx = gen_compiler_tmp(line, column, Priv, TRUE);
04681 AT_SEMANTICS_DONE(new_do_var_idx)= TRUE;
04682 ATD_TYPE_IDX(new_do_var_idx) = ATD_TYPE_IDX(do_var_idx);
04683 ATD_STOR_BLK_IDX(new_do_var_idx) =
04684 SCP_SB_STACK_IDX(curr_scp_idx);
04685
04686
04687 AT_NAME_IDX(new_do_var_idx) = AT_NAME_IDX(do_var_idx);
04688 AT_NAME_LEN(new_do_var_idx) = AT_NAME_LEN(do_var_idx);
04689
04690 ATD_TMP_IDX(new_do_var_idx) = constructor_level;
04691 AT_ATTR_LINK(do_var_idx) = new_do_var_idx;
04692 AT_IGNORE_ATTR_LINK(do_var_idx) = TRUE;
04693
04694 ATD_IMP_DO_LCV(new_do_var_idx) = TRUE;
04695 ATD_LCV_IS_CONST(new_do_var_idx) = constant_trip;
04696 ATD_TMP_NEEDS_CIF(new_do_var_idx) = TRUE;
04697
04698 IL_FLD(list2_idx) = AT_Tbl_Idx;
04699 IL_IDX(list2_idx) = new_do_var_idx;
04700 IL_LINE_NUM(list2_idx) = line;
04701 IL_COL_NUM(list2_idx) = column;
04702
04703
04704 if ((cif_flags & XREF_RECS) != 0) {
04705 cif_usage_rec(new_do_var_idx, AT_Tbl_Idx, line, column,
04706 CIF_Symbol_Modification);
04707 }
04708
04709 }
04710 }
04711
04712 ok = ok && do_var_ok;
04713
04714
04715
04716
04717
04718 in_implied_do = TRUE;
04719 COPY_OPND(opnd, IR_OPND_L(IL_IDX(list_idx)));
04720 number_of_functions = 0;
04721 ok = array_construct_semantics(&opnd, &loc_exp_desc) && ok;
04722 COPY_OPND(IR_OPND_L(IL_IDX(list_idx)), opnd);
04723
04724 if (number_of_functions > 0) {
04725 IL_HAS_FUNCTIONS(list_idx) = TRUE;
04726 }
04727
04728 IR_TYPE_IDX(IL_IDX(list_idx)) = loc_exp_desc.type_idx;
04729
04730 if (do_var_ok) {
04731
04732 AT_ATTR_LINK(do_var_idx) = NULL_IDX;
04733 AT_IGNORE_ATTR_LINK(do_var_idx) = FALSE;
04734
04735
04736
04737 ATD_TMP_IDX(new_do_var_idx) = NULL_IDX;
04738
04739
04740 ATD_FLD(new_do_var_idx) = OPND_FLD(initial_opnd);
04741 ATD_TMP_IDX(new_do_var_idx) = OPND_IDX(initial_opnd);
04742 }
04743
04744 in_implied_do = save_in_implied_do;
04745 }
04746 else {
04747
04748 loc_exp_desc.rank = 0;
04749 COPY_OPND(opnd, IL_OPND(list_idx));
04750 number_of_functions = 0;
04751
04752 save_xref_state = xref_state;
04753 xref_state = CIF_Symbol_Reference;
04754
04755 ok = expr_sem(&opnd, &loc_exp_desc) && ok;
04756
04757 xref_state = save_xref_state;
04758
04759 if (loc_exp_desc.linear_type == Short_Typeless_Const) {
04760 find_opnd_line_and_column((opnd_type *) &opnd, &line, &column);
04761 OPND_IDX(opnd) = cast_typeless_constant(OPND_IDX(opnd),
04762 INTEGER_DEFAULT_TYPE,
04763 line,
04764 column);
04765
04766 loc_exp_desc.type_idx = INTEGER_DEFAULT_TYPE;
04767 loc_exp_desc.type = Integer;
04768 loc_exp_desc.linear_type = INTEGER_DEFAULT_TYPE;
04769 }
04770
04771 COPY_OPND(IL_OPND(list_idx), opnd);
04772
04773 IL_ARG_DESC_VARIANT(list_idx) = TRUE;
04774
04775
04776 arg_info_list_base = arg_info_list_top;
04777 arg_info_list_top = arg_info_list_base + 1;
04778
04779 if (arg_info_list_top >= arg_info_list_size) {
04780 enlarge_info_list_table();
04781 }
04782
04783 IL_ARG_DESC_IDX(list_idx) = arg_info_list_top;
04784 arg_info_list[arg_info_list_top] = init_arg_info;
04785 arg_info_list[arg_info_list_top].ed = loc_exp_desc;
04786
04787 if (number_of_functions > 0) {
04788 IL_HAS_FUNCTIONS(list_idx) = TRUE;
04789 }
04790
04791 }
04792
04793 if (first_item) {
04794 if (loc_exp_desc.linear_type == Typeless_4 ||
04795 loc_exp_desc.linear_type == Typeless_8) {
04796 exp_desc->type_idx = INTEGER_DEFAULT_TYPE;
04797 exp_desc->type = Integer;
04798 exp_desc->linear_type = INTEGER_DEFAULT_TYPE;
04799 }
04800 else {
04801 exp_desc->type = loc_exp_desc.type;
04802 exp_desc->type_idx = loc_exp_desc.type_idx;
04803 exp_desc->linear_type = loc_exp_desc.linear_type;
04804 }
04805
04806 COPY_OPND((exp_desc->char_len), (loc_exp_desc.char_len));
04807 exp_desc->constant = loc_exp_desc.constant;
04808 exp_desc->foldable = loc_exp_desc.foldable && constant_trip;
04809 exp_desc->will_fold_later = (loc_exp_desc.will_fold_later ||
04810 loc_exp_desc.foldable) && constant_trip;
04811 exp_desc->has_symbolic = loc_exp_desc.has_symbolic;
04812 first_item = FALSE;
04813 }
04814 else {
04815
04816 if ((loc_exp_desc.linear_type == Typeless_4 ||
04817 loc_exp_desc.linear_type == Typeless_8) &&
04818 exp_desc->linear_type == INTEGER_DEFAULT_TYPE) {
04819
04820
04821 }
04822 else if (exp_desc->type != loc_exp_desc.type) {
04823
04824 find_opnd_line_and_column((opnd_type *) &IL_OPND(list_idx),
04825 &line, &column);
04826 PRINTMSG(line, 829, Error, column);
04827 ok = FALSE;
04828 }
04829 else if (exp_desc->type == Structure &&
04830 !compare_derived_types(exp_desc->type_idx,
04831 loc_exp_desc.type_idx)) {
04832 find_opnd_line_and_column((opnd_type *) &IL_OPND(list_idx),
04833 &line, &column);
04834 PRINTMSG(line, 829, Error, column);
04835 ok = FALSE;
04836 }
04837 else if (exp_desc->type == Character) {
04838
04839 if (loc_exp_desc.char_len.fld == CN_Tbl_Idx) {
04840
04841 if (exp_desc->char_len.fld == CN_Tbl_Idx) {
04842
04843 if (
04844 #ifdef KEY
04845
04846
04847
04848
04849
04850
04851
04852
04853
04854
04855
04856
04857 on_off_flags.issue_ansi_messages &&
04858 #endif
04859 fold_relationals(loc_exp_desc.char_len.idx,
04860 exp_desc->char_len.idx,
04861 Ne_Opr)) {
04862 find_opnd_line_and_column((opnd_type *) &IL_OPND(list_idx),
04863 &line, &column);
04864 #ifdef KEY
04865 PRINTMSG(line, 838, Ansi, column);
04866 #else
04867 PRINTMSG(line, 838, Error, column);
04868 ok = FALSE;
04869 #endif
04870 }
04871
04872
04873
04874
04875 if (fold_relationals(loc_exp_desc.char_len.idx,
04876 exp_desc->char_len.idx,
04877 Gt_Opr)) {
04878
04879 COPY_OPND((exp_desc->char_len), (loc_exp_desc.char_len));
04880 #ifdef KEY
04881 exp_desc->type_idx = loc_exp_desc.type_idx;
04882 needs_char_padding =
04883 (loc_exp_desc.char_len.fld == CN_Tbl_Idx);
04884 #endif
04885 }
04886
04887 }
04888 else {
04889
04890 COPY_OPND((exp_desc->char_len), (loc_exp_desc.char_len));
04891 }
04892 }
04893 }
04894 else if (exp_desc->linear_type != loc_exp_desc.linear_type) {
04895 find_opnd_line_and_column((opnd_type *) &IL_OPND(list_idx),
04896 &line, &column);
04897 PRINTMSG(line, 829, Error, column);
04898 ok = FALSE;
04899 }
04900
04901 exp_desc->has_symbolic |= loc_exp_desc.has_symbolic;
04902 exp_desc->constant &= loc_exp_desc.constant;
04903 exp_desc->foldable &= loc_exp_desc.foldable && constant_trip;
04904 exp_desc->will_fold_later &= (loc_exp_desc.will_fold_later ||
04905 loc_exp_desc.foldable) &&
04906 constant_trip;
04907 }
04908
04909 list_idx = IL_NEXT_LIST_IDX(list_idx);
04910 }
04911
04912 #ifdef KEY
04913
04914
04915
04916
04917
04918
04919
04920
04921
04922 if (needs_char_padding && exp_desc->constant &&
04923 exp_desc->char_len.fld == CN_Tbl_Idx) {
04924 long desired_length = CN_CONST(exp_desc->char_len.idx);
04925 for (list_idx = OPND_IDX((*top_opnd)); list_idx != NULL_IDX;
04926 list_idx = IL_NEXT_LIST_IDX(list_idx)) {
04927 opnd_type opnd = IL_OPND(list_idx);
04928 long actual_length = 0;
04929 if (opnd.fld == CN_Tbl_Idx && desired_length !=
04930 (actual_length = CN_CONST(TYP_IDX(CN_TYPE_IDX(opnd.idx))))) {
04931 int char_idx = ntr_const_tbl(exp_desc->type_idx, TRUE, NULL);
04932 char *char_ptr = (char *) &CN_CONST(char_idx);
04933 memset(char_ptr, ' ', desired_length);
04934 memcpy(char_ptr, (char *) &CN_CONST(opnd.idx), actual_length);
04935 IL_OPND(list_idx).idx = char_idx;
04936 }
04937 }
04938 }
04939 #endif
04940
04941
04942 EXIT:
04943
04944 TRACE (Func_Exit, "array_construct_semantics", NULL);
04945
04946 return(ok);
04947
04948 }
04949
04950
04951
04952
04953
04954
04955
04956
04957
04958
04959
04960
04961
04962
04963
04964
04965
04966 boolean stmt_func_semantics(int stmt_func_idx)
04967
04968 {
04969 expr_arg_type exp_desc;
04970 int i;
04971 linear_type_type linear_type;
04972 boolean ok = TRUE;
04973 opnd_type opnd;
04974 expr_mode_type save_expr_mode;
04975 boolean save_no_func_expansion;
04976 boolean save_parallel_region;
04977 cif_usage_code_type save_xref_state;
04978 int sn_idx;
04979
04980
04981 TRACE (Func_Entry, "stmt_func_semantics", NULL);
04982
04983 #ifdef KEY
04984 defining_stmt_func = TRUE;
04985 #endif
04986
04987 ATS_SF_SEMANTICS_DONE(stmt_func_idx) = TRUE;
04988
04989
04990
04991 sn_idx = ATP_FIRST_IDX(stmt_func_idx);
04992
04993 for (i = 0; i < ATP_NUM_DARGS(stmt_func_idx); i++) {
04994 ATD_SF_DARG(SN_ATTR_IDX(sn_idx)) = FALSE;
04995 sn_idx++;
04996 }
04997
04998 OPND_FLD(opnd) = (fld_type) ATS_SF_FLD(stmt_func_idx);
04999 OPND_IDX(opnd) = ATS_SF_IDX(stmt_func_idx);
05000 copy_subtree(&opnd, &opnd);
05001
05002 ATS_SF_ACTIVE(stmt_func_idx) = TRUE;
05003
05004 save_parallel_region = cdir_switches.parallel_region;
05005 cdir_switches.parallel_region = FALSE;
05006 save_no_func_expansion = no_func_expansion;
05007 no_func_expansion = TRUE;
05008 save_xref_state = xref_state;
05009 xref_state = CIF_Symbol_Reference;
05010 save_expr_mode = expr_mode;
05011 expr_mode = Stmt_Func_Expr;
05012
05013 ok &= expr_semantics(&opnd, &exp_desc);
05014
05015 expr_mode = save_expr_mode;
05016 xref_state = save_xref_state;
05017 no_func_expansion = save_no_func_expansion;
05018 cdir_switches.parallel_region = save_parallel_region;
05019 ATS_SF_ACTIVE(stmt_func_idx) = FALSE;
05020
05021
05022
05023 sn_idx = ATP_FIRST_IDX(stmt_func_idx);
05024
05025 for (i = 0; i < ATP_NUM_DARGS(stmt_func_idx); i++) {
05026 ATD_SF_DARG(SN_ATTR_IDX(sn_idx)) = TRUE;
05027 sn_idx++;
05028 }
05029
05030
05031 if (exp_desc.rank != 0) {
05032
05033
05034
05035 PRINTMSG(AT_DEF_LINE(stmt_func_idx), 755, Error,
05036 AT_DEF_COLUMN(stmt_func_idx),
05037 AT_OBJ_NAME_PTR(stmt_func_idx));
05038 ok = FALSE;
05039 AT_DCL_ERR(stmt_func_idx) = TRUE;
05040 }
05041
05042 linear_type = TYP_LINEAR(ATD_TYPE_IDX(stmt_func_idx));
05043
05044 if (ASG_TYPE(linear_type, exp_desc.linear_type) == Err_Res) {
05045 PRINTMSG(AT_DEF_LINE(stmt_func_idx), 756, Error,
05046 AT_DEF_COLUMN(stmt_func_idx),
05047 AT_OBJ_NAME_PTR(stmt_func_idx));
05048 ok = FALSE;
05049 AT_DCL_ERR(stmt_func_idx) = TRUE;
05050 }
05051 else if (ASG_TYPE(linear_type, exp_desc.linear_type) == Structure_Type) {
05052
05053 if (!compare_derived_types(ATD_TYPE_IDX(stmt_func_idx),
05054 exp_desc.type_idx)) {
05055 PRINTMSG(AT_DEF_LINE(stmt_func_idx), 756, Error,
05056 AT_DEF_COLUMN(stmt_func_idx),
05057 AT_OBJ_NAME_PTR(stmt_func_idx));
05058 ok = FALSE;
05059 AT_DCL_ERR(stmt_func_idx) = TRUE;
05060 }
05061 }
05062
05063 #ifdef KEY
05064 defining_stmt_func = FALSE;
05065 #endif
05066
05067 TRACE (Func_Exit, "stmt_func_semantics", NULL);
05068
05069 return(ok);
05070
05071 }
05072
05073
05074
05075
05076
05077
05078
05079
05080
05081
05082
05083
05084
05085
05086
05087
05088
05089
05090
05091
05092
05093 static boolean bin_array_syntax_check(expr_arg_type *exp_desc_l,
05094 expr_arg_type *exp_desc_r,
05095 expr_arg_type *exp_desc,
05096 int line,
05097 int col)
05098
05099 {
05100 int i;
05101 boolean ok = TRUE;
05102
05103 TRACE (Func_Entry, "bin_array_syntax_check", NULL);
05104
05105 if (exp_desc_r->rank == exp_desc_l->rank) {
05106
05107
05108 exp_desc->rank = exp_desc_r->rank;
05109
05110 for (i = 0; i < exp_desc_r->rank; i++) {
05111
05112 if (OPND_FLD(exp_desc_l->shape[i]) == CN_Tbl_Idx &&
05113 OPND_FLD(exp_desc_r->shape[i]) == CN_Tbl_Idx) {
05114
05115 if (fold_relationals(OPND_IDX(exp_desc_l->shape[i]),
05116 OPND_IDX(exp_desc_r->shape[i]),
05117 Ne_Opr)) {
05118
05119
05120 PRINTMSG(line, 252, Error, col);
05121 ok = FALSE;
05122 exp_desc->rank = exp_desc_r->rank;
05123 COPY_SHAPE(exp_desc->shape,exp_desc_r->shape,
05124 exp_desc_r->rank);
05125 break;
05126 }
05127 else {
05128 COPY_OPND(exp_desc->shape[i], exp_desc_l->shape[i]);
05129 }
05130 }
05131 else if (SHAPE_FOLDABLE(exp_desc_l->shape[i])) {
05132 COPY_OPND(exp_desc->shape[i], exp_desc_l->shape[i]);
05133 }
05134 else if (SHAPE_FOLDABLE(exp_desc_r->shape[i])) {
05135 COPY_OPND(exp_desc->shape[i], exp_desc_r->shape[i]);
05136 }
05137 else if (SHAPE_WILL_FOLD_LATER(exp_desc_l->shape[i])) {
05138 COPY_OPND(exp_desc->shape[i], exp_desc_l->shape[i]);
05139 }
05140 else {
05141 COPY_OPND(exp_desc->shape[i], exp_desc_r->shape[i]);
05142 }
05143 }
05144 }
05145 else if (exp_desc_r->rank > exp_desc_l->rank) {
05146 exp_desc->rank = exp_desc_r->rank;
05147 COPY_SHAPE(exp_desc->shape,exp_desc_r->shape,
05148 exp_desc_r->rank);
05149 }
05150 else {
05151 exp_desc->rank = exp_desc_l->rank;
05152 COPY_SHAPE(exp_desc->shape,exp_desc_l->shape,
05153 exp_desc_l->rank);
05154 }
05155
05156
05157 TRACE (Func_Exit, "bin_array_syntax_check", NULL);
05158
05159 return(ok);
05160
05161 }
05162
05163
05164
05165
05166
05167
05168
05169
05170
05171
05172
05173
05174
05175
05176
05177
05178
05179
05180
05181
05182 void look_for_real_div(opnd_type *opnd)
05183
05184 {
05185 int list_idx;
05186 opnd_type lopnd;
05187
05188 TRACE (Func_Entry, "look_for_real_div", NULL);
05189
05190 switch (OPND_FLD((*opnd))) {
05191 case IR_Tbl_Idx:
05192
05193 if (IR_OPR(OPND_IDX((*opnd))) == Div_Opr &&
05194 TYP_TYPE(IR_TYPE_IDX(OPND_IDX((*opnd)))) == Real) {
05195
05196 if (on_off_flags.round_integer_divide) {
05197 IR_OPR(OPND_IDX((*opnd))) = Real_Div_To_Int_Opr;
05198 }
05199 else {
05200 PRINTMSG(IR_LINE_NUM(OPND_IDX((*opnd))), 938, Caution,
05201 IR_COL_NUM(OPND_IDX((*opnd))));
05202 }
05203 }
05204
05205 COPY_OPND(lopnd, IR_OPND_L(OPND_IDX((*opnd))));
05206 look_for_real_div(&lopnd);
05207 COPY_OPND(IR_OPND_L(OPND_IDX((*opnd))), lopnd);
05208
05209 COPY_OPND(lopnd, IR_OPND_R(OPND_IDX((*opnd))));
05210 look_for_real_div(&lopnd);
05211 COPY_OPND(IR_OPND_R(OPND_IDX((*opnd))), lopnd);
05212
05213 break;
05214
05215 case IL_Tbl_Idx:
05216
05217 list_idx = OPND_IDX((*opnd));
05218
05219 while (list_idx) {
05220 COPY_OPND(lopnd, IL_OPND(list_idx));
05221 look_for_real_div(&lopnd);
05222 COPY_OPND(IL_OPND(list_idx), lopnd);
05223 list_idx = IL_NEXT_LIST_IDX(list_idx);
05224 }
05225 break;
05226 }
05227
05228 TRACE (Func_Exit, "look_for_real_div", NULL);
05229
05230 return;
05231
05232 }
05233
05234
05235
05236
05237
05238
05239
05240
05241
05242
05243
05244
05245
05246
05247
05248
05249
05250
05251 static void make_logical_array_tmp(opnd_type *top_opnd,
05252 expr_arg_type *exp_desc)
05253
05254 {
05255 int col;
05256 boolean constant_shape = TRUE;
05257 int i;
05258 opnd_type l_opnd;
05259 int line;
05260 expr_arg_type loc_exp_desc;
05261 boolean ok;
05262 opnd_type r_opnd;
05263 boolean save_check_type_conversion;
05264 int save_target_array_idx;
05265 opnd_type save_init_target_opnd;
05266 int save_target_type_idx;
05267 int unused;
05268
05269 TRACE (Func_Entry, "make_logical_array_tmp", NULL);
05270
05271 find_opnd_line_and_column(top_opnd, &line, &col);
05272
05273 for (i = 0; i < exp_desc->rank; i++) {
05274
05275 if (! SHAPE_FOLDABLE(exp_desc->shape[i])) {
05276 constant_shape = FALSE;
05277 break;
05278 }
05279 }
05280
05281 if (constant_shape) {
05282 save_check_type_conversion = check_type_conversion;
05283 save_target_array_idx = target_array_idx;
05284 save_target_type_idx = target_type_idx;
05285 COPY_OPND(save_init_target_opnd, init_target_opnd);
05286
05287 target_array_idx = create_bd_ntry_for_const(exp_desc, line, col);
05288
05289 check_type_conversion = TRUE;
05290 target_type_idx = exp_desc->type_idx;
05291 init_target_opnd = null_opnd;
05292
05293 loc_exp_desc.type = exp_desc->type;
05294 loc_exp_desc.linear_type = exp_desc->linear_type;
05295 loc_exp_desc.type_idx = exp_desc->type_idx;
05296
05297 ok = fold_aggragate_expression(top_opnd,
05298 &loc_exp_desc,
05299 FALSE);
05300
05301 check_type_conversion = save_check_type_conversion;
05302 COPY_OPND(init_target_opnd, save_init_target_opnd);
05303 target_type_idx = save_target_type_idx;
05304 target_array_idx = save_target_array_idx;
05305
05306 exp_desc->tmp_reference = TRUE;
05307 exp_desc->foldable = TRUE;
05308 }
05309 else {
05310
05311 COPY_OPND(r_opnd, (*top_opnd));
05312 unused = create_tmp_asg(&r_opnd,
05313 exp_desc,
05314 &l_opnd,
05315 Intent_In,
05316 FALSE,
05317 FALSE);
05318 COPY_OPND((*top_opnd), l_opnd);
05319 }
05320
05321 TRACE (Func_Exit, "make_logical_array_tmp", NULL);
05322
05323 return;
05324
05325 }
05326
05327
05328
05329
05330
05331
05332
05333
05334
05335
05336
05337
05338
05339
05340
05341
05342
05343
05344
05345
05346 static void fold_nested_substrings(int ir_idx)
05347
05348 {
05349 int col;
05350 opnd_type end_opnd;
05351 expr_arg_type exp_desc;
05352 int line;
05353 int list_idx;
05354 int minus_idx;
05355 boolean ok;
05356 opnd_type opnd;
05357 int plus_idx;
05358 expr_mode_type save_expr_mode;
05359 cif_usage_code_type save_xref_state;
05360 opnd_type start_opnd;
05361
05362
05363 TRACE (Func_Entry, "fold_nested_substrings", NULL);
05364
05365 if (IR_OPR(IR_IDX_L(ir_idx)) == Whole_Substring_Opr) {
05366
05367 COPY_OPND(IR_OPND_L(ir_idx), IR_OPND_L(IR_IDX_L(ir_idx)));
05368 goto EXIT;
05369 }
05370
05371 list_idx = IR_IDX_R(IR_IDX_L(ir_idx));
05372 COPY_OPND(start_opnd, IL_OPND(list_idx));
05373
05374 list_idx = IL_NEXT_LIST_IDX(list_idx);
05375
05376 COPY_OPND(end_opnd, IL_OPND(list_idx));
05377
05378
05379
05380 list_idx = IR_IDX_R(ir_idx);
05381 find_opnd_line_and_column((opnd_type *) &IL_OPND(list_idx), &line, &col);
05382
05383 NTR_IR_TBL(plus_idx);
05384 IR_OPR(plus_idx) = Plus_Opr;
05385 IR_TYPE_IDX(plus_idx) = CG_INTEGER_DEFAULT_TYPE;
05386 IR_LINE_NUM(plus_idx) = line;
05387 IR_COL_NUM(plus_idx) = col;
05388
05389 COPY_OPND(IR_OPND_L(plus_idx), start_opnd);
05390 COPY_OPND(IR_OPND_R(plus_idx), IL_OPND(list_idx));
05391
05392 NTR_IR_TBL(minus_idx);
05393 IR_OPR(minus_idx) = Minus_Opr;
05394 IR_TYPE_IDX(minus_idx) = CG_INTEGER_DEFAULT_TYPE;
05395 IR_LINE_NUM(minus_idx) = line;
05396 IR_COL_NUM(minus_idx) = col;
05397
05398 IR_FLD_L(minus_idx) = IR_Tbl_Idx;
05399 IR_IDX_L(minus_idx) = plus_idx;
05400 IR_FLD_R(minus_idx) = CN_Tbl_Idx;
05401 IR_IDX_R(minus_idx) = CN_INTEGER_ONE_IDX;
05402 IR_LINE_NUM_R(minus_idx) = line;
05403 IR_COL_NUM_R(minus_idx) = col;
05404
05405 OPND_FLD(opnd) = IR_Tbl_Idx;
05406 OPND_IDX(opnd) = minus_idx;
05407
05408
05409 save_xref_state = xref_state;
05410 xref_state = CIF_No_Usage_Rec;
05411 save_expr_mode = expr_mode;
05412 expr_mode = Regular_Expr;
05413 exp_desc.rank = 0;
05414 ok = expr_semantics(&opnd, &exp_desc);
05415 xref_state = save_xref_state;
05416 expr_mode = save_expr_mode;
05417
05418
05419 COPY_OPND(IL_OPND(list_idx), opnd);
05420
05421
05422
05423
05424 list_idx = IL_NEXT_LIST_IDX(list_idx);
05425
05426 find_opnd_line_and_column((opnd_type *) &IL_OPND(list_idx), &line, &col);
05427
05428 NTR_IR_TBL(plus_idx);
05429 IR_OPR(plus_idx) = Plus_Opr;
05430 IR_TYPE_IDX(plus_idx) = CG_INTEGER_DEFAULT_TYPE;
05431 IR_LINE_NUM(plus_idx) = line;
05432 IR_COL_NUM(plus_idx) = col;
05433
05434 COPY_OPND(IR_OPND_L(plus_idx), start_opnd);
05435 COPY_OPND(IR_OPND_R(plus_idx), IL_OPND(list_idx));
05436
05437 NTR_IR_TBL(minus_idx);
05438 IR_OPR(minus_idx) = Minus_Opr;
05439 IR_TYPE_IDX(minus_idx) = CG_INTEGER_DEFAULT_TYPE;
05440 IR_LINE_NUM(minus_idx) = line;
05441 IR_COL_NUM(minus_idx) = col;
05442
05443 IR_FLD_L(minus_idx) = IR_Tbl_Idx;
05444 IR_IDX_L(minus_idx) = plus_idx;
05445 IR_FLD_R(minus_idx) = CN_Tbl_Idx;
05446 IR_IDX_R(minus_idx) = CN_INTEGER_ONE_IDX;
05447 IR_LINE_NUM_R(minus_idx) = line;
05448 IR_COL_NUM_R(minus_idx) = col;
05449
05450 OPND_FLD(opnd) = IR_Tbl_Idx;
05451 OPND_IDX(opnd) = minus_idx;
05452
05453
05454 save_xref_state = xref_state;
05455 xref_state = CIF_No_Usage_Rec;
05456 save_expr_mode = expr_mode;
05457 expr_mode = Regular_Expr;
05458 exp_desc.rank = 0;
05459 ok = expr_semantics(&opnd, &exp_desc);
05460 xref_state = save_xref_state;
05461 expr_mode = save_expr_mode;
05462
05463 COPY_OPND(IL_OPND(list_idx), opnd);
05464
05465
05466
05467
05468
05469 COPY_OPND(IR_OPND_L(ir_idx), IR_OPND_L(IR_IDX_L(ir_idx)));
05470
05471 EXIT:
05472
05473 TRACE (Func_Exit, "fold_nested_substrings", NULL);
05474
05475 return;
05476
05477 }
05478
05479
05480
05481
05482
05483
05484
05485
05486
05487
05488
05489
05490
05491
05492
05493
05494
05495 static boolean uplus_opr_handler(opnd_type *result_opnd,
05496 expr_arg_type *exp_desc)
05497
05498 {
05499 int col;
05500 expr_arg_type exp_desc_l;
05501 expr_arg_type exp_desc_r;
05502 long_type folded_const[MAX_WORDS_FOR_NUMERIC];
05503 int ir_idx;
05504 int line;
05505 boolean ok = TRUE;
05506 opnd_type opnd;
05507 int opnd_col;
05508 int opnd_line;
05509 boolean save_in_call_list;
05510 int type_idx;
05511
05512
05513 TRACE (Func_Entry, "uplus_opr_handler" , NULL);
05514
05515 ir_idx = OPND_IDX((*result_opnd));
05516 line = IR_LINE_NUM(ir_idx);
05517 col = IR_COL_NUM(ir_idx);
05518 save_in_call_list = in_call_list;
05519 in_call_list = FALSE;
05520
05521 COPY_OPND(opnd, IR_OPND_L(ir_idx));
05522 exp_desc_l.rank = 0;
05523 ok = expr_sem(&opnd, &exp_desc_l);
05524 COPY_OPND(IR_OPND_L(ir_idx), opnd);
05525
05526 if (!ok) {
05527 goto EXIT;
05528 }
05529
05530 exp_desc->has_constructor = exp_desc_l.has_constructor;
05531 exp_desc->has_symbolic = exp_desc_l.has_symbolic;
05532
05533 exp_desc->linear_type = UN_PLUS_TYPE(exp_desc_l.linear_type);
05534
05535 if (exp_desc->linear_type != Err_Res) {
05536
05537 if (UN_PLUS_EXTN(exp_desc_l.linear_type)) {
05538
05539 if (resolve_ext_opr(result_opnd, FALSE, save_in_call_list,
05540 FALSE,
05541 &ok,
05542 &exp_desc_l, &exp_desc_r)) {
05543
05544 (*exp_desc) = exp_desc_l;
05545
05546 goto EXIT;
05547 }
05548 else if (exp_desc_l.type == Character ||
05549 exp_desc_l.linear_type == Short_Typeless_Const) {
05550 find_opnd_line_and_column((opnd_type *)
05551 &IR_OPND_L(ir_idx),
05552 &opnd_line,
05553 &opnd_col);
05554 if (exp_desc_l.type == Character) {
05555 PRINTMSG(opnd_line, 161, Ansi, opnd_col);
05556 }
05557
05558 IR_IDX_L(ir_idx) = cast_typeless_constant(IR_IDX_L(ir_idx),
05559 exp_desc->linear_type,
05560 opnd_line,
05561 opnd_col);
05562
05563 exp_desc_l.type_idx = exp_desc->linear_type;
05564 exp_desc_l.type = TYP_TYPE(exp_desc->linear_type);
05565 exp_desc_l.linear_type = exp_desc->linear_type;
05566 exp_desc->linear_type = UN_PLUS_TYPE(exp_desc_l.linear_type);
05567 }
05568
05569 }
05570
05571 exp_desc->type_idx = exp_desc->linear_type;
05572 exp_desc->type = TYP_TYPE(exp_desc->linear_type);
05573 exp_desc->rank = exp_desc_l.rank;
05574 exp_desc->has_symbolic = exp_desc_l.has_symbolic;
05575 exp_desc->constant = exp_desc_l.constant;
05576 exp_desc->foldable = exp_desc_l.foldable;
05577 exp_desc->will_fold_later = exp_desc_l.will_fold_later;
05578
05579 if (exp_desc->linear_type == Integer_8) {
05580
05581
05582 if (exp_desc_l.linear_type == Integer_8 &&
05583 TYP_DESC(exp_desc_l.type_idx) != Default_Typed) {
05584 exp_desc->type_idx = exp_desc_l.type_idx;
05585 }
05586 }
05587
05588 COPY_SHAPE(exp_desc->shape,exp_desc_l.shape,exp_desc_l.rank);
05589
05590 if (IR_OPR(ir_idx) == Uplus_Opr) {
05591 COPY_OPND((*result_opnd), IR_OPND_L(ir_idx));
05592 }
05593 else if (opt_flags.ieeeconform &&
05594 ! comp_gen_expr &&
05595 (exp_desc_l.type == Real ||
05596 exp_desc_l.type == Complex)) {
05597
05598
05599
05600 exp_desc->foldable = FALSE;
05601 exp_desc->will_fold_later = FALSE;
05602 }
05603 else if (exp_desc_l.rank == 0 &&
05604 exp_desc_l.foldable &&
05605 IR_FLD_L(ir_idx) == CN_Tbl_Idx) {
05606
05607 type_idx = exp_desc->type_idx;
05608
05609 if (folder_driver((char *)&CN_CONST(IR_IDX_L(ir_idx)),
05610 exp_desc_l.type_idx,
05611 NULL,
05612 NULL_IDX,
05613 folded_const,
05614 &type_idx,
05615 line,
05616 col,
05617 1,
05618 IR_OPR(ir_idx))) {
05619
05620 exp_desc->type_idx = type_idx;
05621 OPND_FLD((*result_opnd)) = CN_Tbl_Idx;
05622
05623 if (CN_BOZ_CONSTANT(IR_IDX_L(ir_idx))) {
05624 OPND_IDX((*result_opnd)) =
05625 ntr_boz_const_tbl(type_idx, folded_const);
05626 }
05627 else {
05628 OPND_IDX((*result_opnd)) = ntr_const_tbl(exp_desc->type_idx,
05629 FALSE,
05630 folded_const);
05631 }
05632
05633 exp_desc->linear_type = TYP_LINEAR(exp_desc->type_idx);
05634 OPND_LINE_NUM((*result_opnd)) = line;
05635 OPND_COL_NUM((*result_opnd)) = col;
05636 }
05637 else {
05638 ok = FALSE;
05639 }
05640 }
05641 }
05642 else if (resolve_ext_opr(result_opnd, TRUE, save_in_call_list,
05643 (exp_desc->linear_type == Err_Res),
05644 &ok,
05645 &exp_desc_l, &exp_desc_r)) {
05646
05647 (*exp_desc) = exp_desc_l;
05648
05649 goto EXIT;
05650 }
05651 else {
05652 ok = FALSE;
05653 }
05654
05655 IR_TYPE_IDX(ir_idx) = exp_desc->type_idx;
05656 IR_RANK(ir_idx) = exp_desc->rank;
05657
05658 if (IR_RANK(ir_idx)) {
05659 IR_ARRAY_SYNTAX(ir_idx) = TRUE;
05660 }
05661
05662 EXIT:
05663
05664 TRACE (Func_Exit, "uplus_opr_handler", NULL);
05665
05666 return(ok);
05667
05668 }
05669
05670
05671
05672
05673
05674
05675
05676
05677
05678
05679
05680
05681
05682
05683
05684
05685
05686 static boolean power_opr_handler(opnd_type *result_opnd,
05687 expr_arg_type *exp_desc)
05688
05689 {
05690 int col;
05691 expr_arg_type exp_desc_l;
05692 expr_arg_type exp_desc_r;
05693 long_type folded_const[MAX_WORDS_FOR_NUMERIC];
05694 int ir_idx;
05695 int line;
05696 boolean ok = TRUE;
05697 opnd_type opnd;
05698 int opnd_col;
05699 int opnd_line;
05700 boolean save_in_call_list;
05701 int type_idx;
05702
05703
05704 TRACE (Func_Entry, "power_opr_handler" , NULL);
05705
05706 ir_idx = OPND_IDX((*result_opnd));
05707 line = IR_LINE_NUM(ir_idx);
05708 col = IR_COL_NUM(ir_idx);
05709 save_in_call_list = in_call_list;
05710 in_call_list = FALSE;
05711
05712 COPY_OPND(opnd, IR_OPND_L(ir_idx));
05713 exp_desc_l.rank = 0;
05714 ok = expr_sem(&opnd, &exp_desc_l);
05715 COPY_OPND(IR_OPND_L(ir_idx), opnd);
05716
05717 COPY_OPND(opnd, IR_OPND_R(ir_idx));
05718 exp_desc_r.rank = 0;
05719 ok &= expr_sem(&opnd, &exp_desc_r);
05720 COPY_OPND(IR_OPND_R(ir_idx), opnd);
05721
05722 if (!ok) {
05723 goto EXIT;
05724 }
05725
05726 exp_desc->has_constructor = exp_desc_l.has_constructor ||
05727 exp_desc_r.has_constructor;
05728
05729 exp_desc->linear_type = POWER_TYPE(exp_desc_l.linear_type,
05730 exp_desc_r.linear_type);
05731 exp_desc->has_symbolic = exp_desc_l.has_symbolic || exp_desc_r.has_symbolic;
05732
05733 if (exp_desc->linear_type != Err_Res &&
05734 (exp_desc_l.rank == exp_desc_r.rank ||
05735 exp_desc_l.rank * exp_desc_r.rank == 0)) {
05736
05737 if (POWER_EXTN(exp_desc_l.linear_type,
05738 exp_desc_r.linear_type)) {
05739
05740 if (resolve_ext_opr(result_opnd, FALSE, save_in_call_list,
05741 FALSE,
05742 &ok,
05743 &exp_desc_l, &exp_desc_r)) {
05744
05745 (*exp_desc) = exp_desc_l;
05746
05747 goto EXIT;
05748 }
05749 else {
05750 if (exp_desc_l.type == Character ||
05751 exp_desc_l.linear_type == Short_Typeless_Const) {
05752
05753 find_opnd_line_and_column((opnd_type *)
05754 &IR_OPND_L(ir_idx),
05755 &opnd_line,
05756 &opnd_col);
05757
05758 if (exp_desc_l.type == Character) {
05759 PRINTMSG(opnd_line, 161, Ansi, opnd_col);
05760 }
05761
05762 IR_IDX_L(ir_idx) = cast_typeless_constant(IR_IDX_L(ir_idx),
05763 exp_desc->linear_type,
05764 opnd_line,
05765 opnd_col);
05766
05767 exp_desc_l.type_idx = exp_desc->linear_type;
05768 exp_desc_l.type = TYP_TYPE(exp_desc->linear_type);
05769 exp_desc_l.linear_type = exp_desc->linear_type;
05770 }
05771
05772 if (exp_desc_r.type == Character ||
05773 exp_desc_r.linear_type == Short_Typeless_Const) {
05774
05775 find_opnd_line_and_column((opnd_type *)
05776 &IR_OPND_R(ir_idx),
05777 &opnd_line,
05778 &opnd_col);
05779
05780 if (exp_desc_r.type == Character) {
05781 PRINTMSG(opnd_line, 161, Ansi, opnd_col);
05782 }
05783
05784 IR_IDX_R(ir_idx) = cast_typeless_constant(IR_IDX_R(ir_idx),
05785 exp_desc->linear_type,
05786 opnd_line,
05787 opnd_col);
05788
05789 exp_desc_r.type_idx = exp_desc->linear_type;
05790 exp_desc_r.type = TYP_TYPE(exp_desc->linear_type);
05791 exp_desc_r.linear_type = exp_desc->linear_type;
05792 }
05793
05794
05795 exp_desc->linear_type = POWER_TYPE(exp_desc_l.linear_type,
05796 exp_desc_r.linear_type);
05797
05798 }
05799 }
05800
05801 exp_desc->type_idx = exp_desc->linear_type;
05802 exp_desc->type = TYP_TYPE(exp_desc->linear_type);
05803
05804 if (exp_desc->linear_type == Integer_8) {
05805
05806
05807 if (exp_desc_l.linear_type == Integer_8 &&
05808 TYP_DESC(exp_desc_l.type_idx) != Default_Typed) {
05809 exp_desc->type_idx = exp_desc_l.type_idx;
05810 }
05811 else if (exp_desc_r.linear_type == Integer_8 &&
05812 TYP_DESC(exp_desc_r.type_idx) != Default_Typed) {
05813 exp_desc->type_idx = exp_desc_r.type_idx;
05814 }
05815 }
05816
05817
05818
05819 if (exp_desc_l.foldable &&
05820 exp_desc_l.type == Real &&
05821 exp_desc_r.type == Real &&
05822 IR_FLD_L(ir_idx) == CN_Tbl_Idx) {
05823
05824 if (fold_relationals(IR_IDX_L(ir_idx),
05825 CN_INTEGER_ZERO_IDX,
05826 Lt_Opr)) {
05827
05828 PRINTMSG(line, 538, Error, col);
05829 ok = FALSE;
05830 }
05831 }
05832
05833 if (! bin_array_syntax_check(&exp_desc_l, &exp_desc_r,
05834 exp_desc, line, col)) {
05835 ok = FALSE;
05836 }
05837
05838 exp_desc->constant = exp_desc_l.constant &&
05839 exp_desc_r.constant;
05840 exp_desc->foldable = exp_desc_l.foldable &&
05841 exp_desc_r.foldable;
05842
05843 exp_desc->will_fold_later = (exp_desc_l.will_fold_later &
05844 exp_desc_r.will_fold_later) |
05845 (exp_desc_l.will_fold_later &
05846 exp_desc_r.foldable) |
05847 (exp_desc_l.foldable &
05848 exp_desc_r.will_fold_later);
05849
05850
05851 if (opt_flags.ieeeconform &&
05852 ! comp_gen_expr &&
05853 (exp_desc_l.type == Real ||
05854 exp_desc_l.type == Complex ||
05855 exp_desc_r.type == Real ||
05856 exp_desc_r.type == Complex)) {
05857
05858
05859
05860 exp_desc->foldable = FALSE;
05861 exp_desc->will_fold_later = FALSE;
05862 }
05863 else if (exp_desc->rank != 0) {
05864
05865 }
05866 else if (exp_desc->foldable &&
05867 IR_FLD_L(ir_idx) == CN_Tbl_Idx &&
05868 IR_FLD_R(ir_idx) == CN_Tbl_Idx &&
05869 ok) {
05870
05871 if (expr_mode == Initialization_Expr &&
05872 exp_desc_r.type != Integer) {
05873
05874
05875
05876 PRINTMSG(IR_LINE_NUM_R(ir_idx), 206, Error,
05877 IR_COL_NUM_R(ir_idx));
05878 ok = FALSE;
05879 }
05880
05881
05882 type_idx = exp_desc->type_idx;
05883
05884 if (folder_driver((char *)&CN_CONST(IR_IDX_L(ir_idx)),
05885 exp_desc_l.type_idx,
05886 (char *)&CN_CONST(IR_IDX_R(ir_idx)),
05887 exp_desc_r.type_idx,
05888 folded_const,
05889 &type_idx,
05890 line,
05891 col,
05892 2, IR_OPR(ir_idx))) {
05893
05894 exp_desc->type_idx = type_idx;
05895 OPND_FLD((*result_opnd)) = CN_Tbl_Idx;
05896 OPND_IDX((*result_opnd)) = ntr_const_tbl(exp_desc->type_idx,
05897 FALSE,
05898 folded_const);
05899
05900 exp_desc->linear_type = TYP_LINEAR(exp_desc->type_idx);
05901 OPND_LINE_NUM((*result_opnd)) = line;
05902 OPND_COL_NUM((*result_opnd)) = col;
05903 }
05904 else {
05905 ok = FALSE;
05906 }
05907 }
05908 }
05909 else if (resolve_ext_opr(result_opnd, TRUE, save_in_call_list,
05910 (exp_desc->linear_type == Err_Res),
05911 &ok,
05912 &exp_desc_l, &exp_desc_r)) {
05913
05914 (*exp_desc) = exp_desc_l;
05915
05916 goto EXIT;
05917 }
05918 else {
05919 ok = FALSE;
05920 }
05921
05922 if (OPND_FLD((*result_opnd)) == IR_Tbl_Idx &&
05923 IR_OPR(OPND_IDX((*result_opnd))) == Power_Opr) {
05924
05925
05926 io_item_must_flatten = TRUE;
05927
05928 IR_TYPE_IDX(ir_idx) = exp_desc->type_idx;
05929 IR_RANK(ir_idx) = exp_desc->rank;
05930
05931 if (IR_RANK(ir_idx)) {
05932 IR_ARRAY_SYNTAX(ir_idx) = TRUE;
05933 }
05934 }
05935
05936 EXIT:
05937
05938 TRACE (Func_Exit, "power_opr_handler", NULL);
05939
05940 return(ok);
05941
05942 }
05943
05944
05945
05946
05947
05948
05949
05950
05951
05952
05953
05954
05955
05956
05957
05958
05959
05960 static boolean mult_opr_handler(opnd_type *result_opnd,
05961 expr_arg_type *exp_desc)
05962
05963 {
05964 int col;
05965 expr_arg_type exp_desc_l;
05966 expr_arg_type exp_desc_r;
05967 long_type folded_const[MAX_WORDS_FOR_NUMERIC];
05968 int ir_idx;
05969 int line;
05970 boolean ok = TRUE;
05971 opnd_type opnd;
05972 int opnd_col;
05973 int opnd_line;
05974 boolean save_in_call_list;
05975 int type_idx;
05976
05977
05978 TRACE (Func_Entry, "mult_opr_handler" , NULL);
05979
05980 ir_idx = OPND_IDX((*result_opnd));
05981 line = IR_LINE_NUM(ir_idx);
05982 col = IR_COL_NUM(ir_idx);
05983 save_in_call_list = in_call_list;
05984 in_call_list = FALSE;
05985
05986 COPY_OPND(opnd, IR_OPND_L(ir_idx));
05987 exp_desc_l.rank = 0;
05988 ok = expr_sem(&opnd, &exp_desc_l);
05989 COPY_OPND(IR_OPND_L(ir_idx), opnd);
05990
05991 COPY_OPND(opnd, IR_OPND_R(ir_idx));
05992 exp_desc_r.rank = 0;
05993 ok &= expr_sem(&opnd, &exp_desc_r);
05994 COPY_OPND(IR_OPND_R(ir_idx), opnd);
05995
05996 if (!ok) {
05997 goto EXIT;
05998 }
05999
06000 exp_desc->has_constructor = exp_desc_l.has_constructor ||
06001 exp_desc_r.has_constructor;
06002
06003 exp_desc->has_symbolic = exp_desc_l.has_symbolic || exp_desc_r.has_symbolic;
06004
06005 exp_desc->linear_type = MULT_DIV_TYPE(exp_desc_l.linear_type,
06006 exp_desc_r.linear_type);
06007
06008 if (exp_desc->linear_type != Err_Res &&
06009 (exp_desc_l.rank == exp_desc_r.rank ||
06010 exp_desc_l.rank * exp_desc_r.rank == 0)) {
06011
06012 if (MULT_DIV_EXTN(exp_desc_l.linear_type,
06013 exp_desc_r.linear_type)) {
06014
06015 if (resolve_ext_opr(result_opnd, FALSE, save_in_call_list,
06016 FALSE,
06017 &ok,
06018 &exp_desc_l, &exp_desc_r)) {
06019
06020 (*exp_desc) = exp_desc_l;
06021
06022 goto EXIT;
06023 }
06024 else {
06025
06026 if (exp_desc_l.type == Character ||
06027 exp_desc_l.linear_type == Short_Typeless_Const) {
06028
06029 find_opnd_line_and_column((opnd_type *)
06030 &IR_OPND_L(ir_idx),
06031 &opnd_line,
06032 &opnd_col);
06033
06034 if (exp_desc_l.type == Character) {
06035 PRINTMSG(opnd_line, 161, Ansi, opnd_col);
06036 }
06037
06038 IR_IDX_L(ir_idx) = cast_typeless_constant(IR_IDX_L(ir_idx),
06039 exp_desc->linear_type,
06040 opnd_line,
06041 opnd_col);
06042
06043 exp_desc_l.type_idx = exp_desc->linear_type;
06044 exp_desc_l.type = TYP_TYPE(exp_desc->linear_type);
06045 exp_desc_l.linear_type = exp_desc->linear_type;
06046 }
06047
06048 if (exp_desc_r.type == Character ||
06049 exp_desc_r.linear_type == Short_Typeless_Const) {
06050
06051 find_opnd_line_and_column((opnd_type *)
06052 &IR_OPND_R(ir_idx),
06053 &opnd_line,
06054 &opnd_col);
06055
06056 if (exp_desc_r.type == Character) {
06057 PRINTMSG(opnd_line, 161, Ansi, opnd_col);
06058 }
06059
06060 IR_IDX_R(ir_idx) = cast_typeless_constant(IR_IDX_R(ir_idx),
06061 exp_desc->linear_type,
06062 opnd_line,
06063 opnd_col);
06064
06065 exp_desc_r.type_idx = exp_desc->linear_type;
06066 exp_desc_r.type = TYP_TYPE(exp_desc->linear_type);
06067 exp_desc_r.linear_type = exp_desc->linear_type;
06068 }
06069
06070
06071 exp_desc->linear_type = MULT_DIV_TYPE(exp_desc_l.linear_type,
06072 exp_desc_r.linear_type);
06073 }
06074 }
06075
06076 exp_desc->type_idx = exp_desc->linear_type;
06077 exp_desc->type = TYP_TYPE(exp_desc->linear_type);
06078
06079 if (exp_desc->linear_type == Integer_8) {
06080
06081
06082 if (exp_desc_l.linear_type == Integer_8 &&
06083 TYP_DESC(exp_desc_l.type_idx) != Default_Typed) {
06084 exp_desc->type_idx = exp_desc_l.type_idx;
06085 }
06086 else if (exp_desc_r.linear_type == Integer_8 &&
06087 TYP_DESC(exp_desc_r.type_idx) != Default_Typed) {
06088 exp_desc->type_idx = exp_desc_r.type_idx;
06089 }
06090 }
06091
06092
06093 if (! bin_array_syntax_check(&exp_desc_l, &exp_desc_r,
06094 exp_desc, line, col)) {
06095 ok = FALSE;
06096 }
06097
06098 exp_desc->constant = exp_desc_l.constant &&
06099 exp_desc_r.constant;
06100 exp_desc->foldable = exp_desc_l.foldable &&
06101 exp_desc_r.foldable;
06102
06103 exp_desc->will_fold_later = (exp_desc_l.will_fold_later &
06104 exp_desc_r.will_fold_later) |
06105 (exp_desc_l.will_fold_later &
06106 exp_desc_r.foldable) |
06107 (exp_desc_l.foldable &
06108 exp_desc_r.will_fold_later);
06109
06110
06111 if ((! target_ieee ||
06112 exp_desc->type == Integer) &&
06113 exp_desc_r.rank == 0 &&
06114 IR_OPR(ir_idx) == Div_Opr &&
06115 IR_FLD_R(ir_idx) == CN_Tbl_Idx) {
06116
06117 if (fold_relationals(IR_IDX_R(ir_idx),
06118 CN_INTEGER_ZERO_IDX,
06119 Eq_Opr)) {
06120
06121
06122
06123 if (comp_gen_expr) {
06124 PRINTMSG(IR_LINE_NUM_R(ir_idx), 721, Error,
06125 IR_COL_NUM_R(ir_idx));
06126 ok = FALSE;
06127 }
06128 else {
06129 PRINTMSG(IR_LINE_NUM_R(ir_idx), 1649, Warning,
06130 IR_COL_NUM_R(ir_idx));
06131 exp_desc->foldable = FALSE;
06132 exp_desc->will_fold_later = FALSE;
06133 }
06134 }
06135 }
06136
06137 if (OPND_FLD((*result_opnd)) == IR_Tbl_Idx &&
06138 IR_OPR(OPND_IDX((*result_opnd))) == Div_Opr &&
06139 exp_desc->type == Real &&
06140 on_off_flags.round_integer_divide) {
06141
06142 IR_OPR(OPND_IDX((*result_opnd))) = Real_Div_To_Int_Opr;
06143 }
06144
06145 if (! ok) {
06146
06147 }
06148 else if (opt_flags.ieeeconform &&
06149 ! comp_gen_expr &&
06150 (exp_desc_l.type == Real ||
06151 exp_desc_l.type == Complex ||
06152 exp_desc_r.type == Real ||
06153 exp_desc_r.type == Complex)) {
06154
06155
06156
06157 exp_desc->foldable = FALSE;
06158 exp_desc->will_fold_later = FALSE;
06159 }
06160 else if (exp_desc->rank != 0) {
06161
06162 }
06163 else if (exp_desc->foldable &&
06164 IR_FLD_L(ir_idx) == CN_Tbl_Idx &&
06165 IR_FLD_R(ir_idx) == CN_Tbl_Idx) {
06166
06167 type_idx = exp_desc->type_idx;
06168
06169 if (folder_driver((char *)&CN_CONST(IR_IDX_L(ir_idx)),
06170 exp_desc_l.type_idx,
06171 (char *)&CN_CONST(IR_IDX_R(ir_idx)),
06172 exp_desc_r.type_idx,
06173 folded_const,
06174 &type_idx,
06175 line,
06176 col,
06177 2,
06178 IR_OPR(ir_idx))) {
06179
06180 exp_desc->type_idx = type_idx;
06181 OPND_FLD((*result_opnd)) = CN_Tbl_Idx;
06182 OPND_IDX((*result_opnd)) = ntr_const_tbl(exp_desc->type_idx,
06183 FALSE,
06184 folded_const);
06185
06186 exp_desc->linear_type = TYP_LINEAR(exp_desc->type_idx);
06187 OPND_LINE_NUM((*result_opnd)) = line;
06188 OPND_COL_NUM((*result_opnd)) = col;
06189 }
06190 else {
06191 ok = FALSE;
06192 }
06193 }
06194 else if (exp_desc_l.foldable &&
06195 IR_FLD_L(ir_idx) == CN_Tbl_Idx) {
06196
06197 if (exp_desc_l.type == Integer &&
06198 exp_desc_l.type_idx == exp_desc_r.type_idx) {
06199
06200 if (compare_cn_and_value(IR_IDX_L(ir_idx), 0, Eq_Opr)) {
06201
06202 COPY_OPND((*result_opnd), IR_OPND_L(ir_idx));
06203 exp_desc->constant = TRUE;
06204 exp_desc->foldable = TRUE;
06205 }
06206 else if (compare_cn_and_value(IR_IDX_L(ir_idx), 1, Eq_Opr) &&
06207 IR_OPR(ir_idx) == Mult_Opr) {
06208
06209 COPY_OPND((*result_opnd), IR_OPND_R(ir_idx));
06210 }
06211 }
06212 }
06213 else if (exp_desc_r.foldable &&
06214 IR_FLD_R(ir_idx) == CN_Tbl_Idx) {
06215
06216 if (exp_desc_l.type == Integer &&
06217 exp_desc_l.type_idx == exp_desc_r.type_idx) {
06218
06219 if (compare_cn_and_value(IR_IDX_R(ir_idx), 1, Eq_Opr)) {
06220
06221 COPY_OPND((*result_opnd), IR_OPND_L(ir_idx));
06222 }
06223 else if (compare_cn_and_value(IR_IDX_R(ir_idx), 0, Eq_Opr) &&
06224 IR_OPR(ir_idx) == Mult_Opr) {
06225
06226 COPY_OPND((*result_opnd), IR_OPND_R(ir_idx));
06227 exp_desc->constant = TRUE;
06228 exp_desc->foldable = TRUE;
06229 }
06230 }
06231 }
06232 }
06233 else if (resolve_ext_opr(result_opnd, TRUE, save_in_call_list,
06234 (exp_desc->linear_type == Err_Res),
06235 &ok,
06236 &exp_desc_l, &exp_desc_r)) {
06237
06238 (*exp_desc) = exp_desc_l;
06239
06240 goto EXIT;
06241 }
06242 else {
06243 ok = FALSE;
06244 }
06245
06246 IR_TYPE_IDX(ir_idx) = exp_desc->type_idx;
06247 IR_RANK(ir_idx) = exp_desc->rank;
06248
06249 if (IR_RANK(ir_idx)) {
06250 IR_ARRAY_SYNTAX(ir_idx) = TRUE;
06251 }
06252
06253 EXIT:
06254
06255 TRACE (Func_Exit, "mult_opr_handler", NULL);
06256
06257 return(ok);
06258
06259 }
06260
06261
06262
06263
06264
06265
06266
06267
06268
06269
06270
06271
06272
06273
06274
06275
06276
06277 static boolean minus_opr_handler(opnd_type *result_opnd,
06278 expr_arg_type *exp_desc)
06279
06280 {
06281 int col;
06282 expr_arg_type exp_desc_l;
06283 expr_arg_type exp_desc_r;
06284 long_type folded_const[MAX_WORDS_FOR_NUMERIC];
06285 int ir_idx;
06286 int line;
06287 boolean ok = TRUE;
06288 opnd_type opnd;
06289 int opnd_col;
06290 int opnd_line;
06291 boolean save_in_call_list;
06292 int type_idx;
06293
06294
06295 TRACE (Func_Entry, "minus_opr_handler" , NULL);
06296
06297 ir_idx = OPND_IDX((*result_opnd));
06298 line = IR_LINE_NUM(ir_idx);
06299 col = IR_COL_NUM(ir_idx);
06300 save_in_call_list = in_call_list;
06301 in_call_list = FALSE;
06302
06303 COPY_OPND(opnd, IR_OPND_L(ir_idx));
06304 exp_desc_l.rank = 0;
06305 ok = expr_sem(&opnd, &exp_desc_l);
06306 COPY_OPND(IR_OPND_L(ir_idx), opnd);
06307
06308 COPY_OPND(opnd, IR_OPND_R(ir_idx));
06309 exp_desc_r.rank = 0;
06310 ok &= expr_sem(&opnd, &exp_desc_r);
06311 COPY_OPND(IR_OPND_R(ir_idx), opnd);
06312
06313 if (!ok) {
06314 goto EXIT;
06315 }
06316
06317 exp_desc->has_constructor = exp_desc_l.has_constructor ||
06318 exp_desc_r.has_constructor;
06319
06320 exp_desc->has_symbolic = exp_desc_l.has_symbolic || exp_desc_r.has_symbolic;
06321
06322 exp_desc->linear_type = BIN_SUB_TYPE(exp_desc_l.linear_type,
06323 exp_desc_r.linear_type);
06324
06325 if (exp_desc->linear_type != Err_Res &&
06326 (exp_desc_l.rank == exp_desc_r.rank ||
06327 exp_desc_l.rank * exp_desc_r.rank == 0)) {
06328
06329 if (BIN_SUB_EXTN(exp_desc_l.linear_type,
06330 exp_desc_r.linear_type)) {
06331
06332 if (resolve_ext_opr(result_opnd, FALSE, save_in_call_list,
06333 FALSE,
06334 &ok,
06335 &exp_desc_l, &exp_desc_r)) {
06336
06337 (*exp_desc) = exp_desc_l;
06338
06339 goto EXIT;
06340 }
06341 else {
06342 if (exp_desc_l.type == Character ||
06343 exp_desc_l.linear_type == Short_Typeless_Const) {
06344
06345 find_opnd_line_and_column((opnd_type *)
06346 &IR_OPND_L(ir_idx),
06347 &opnd_line,
06348 &opnd_col);
06349
06350 if (exp_desc_l.type == Character) {
06351 PRINTMSG(opnd_line, 161, Ansi, opnd_col);
06352 }
06353
06354 IR_IDX_L(ir_idx) = cast_typeless_constant(IR_IDX_L(ir_idx),
06355 exp_desc->linear_type,
06356 opnd_line,
06357 opnd_col);
06358
06359 exp_desc_l.type_idx = exp_desc->linear_type;
06360 exp_desc_l.type = TYP_TYPE(exp_desc->linear_type);
06361 exp_desc_l.linear_type = exp_desc->linear_type;
06362 }
06363
06364 if (exp_desc_r.type == Character ||
06365 exp_desc_r.linear_type == Short_Typeless_Const) {
06366
06367 find_opnd_line_and_column((opnd_type *)
06368 &IR_OPND_R(ir_idx),
06369 &opnd_line,
06370 &opnd_col);
06371
06372 if (exp_desc_r.type == Character) {
06373 PRINTMSG(opnd_line, 161, Ansi, opnd_col);
06374 }
06375
06376 IR_IDX_R(ir_idx) = cast_typeless_constant(IR_IDX_R(ir_idx),
06377 exp_desc->linear_type,
06378 opnd_line,
06379 opnd_col);
06380
06381 exp_desc_r.type_idx = exp_desc->linear_type;
06382 exp_desc_r.type = TYP_TYPE(exp_desc->linear_type);
06383 exp_desc_r.linear_type = exp_desc->linear_type;
06384 }
06385
06386
06387 exp_desc->linear_type = BIN_SUB_TYPE(exp_desc_l.linear_type,
06388 exp_desc_r.linear_type);
06389 }
06390 }
06391
06392 exp_desc->type_idx = exp_desc->linear_type;
06393 exp_desc->type = TYP_TYPE(exp_desc->type_idx);
06394
06395 if (exp_desc->linear_type == Integer_8) {
06396
06397
06398 if (exp_desc_l.linear_type == Integer_8 &&
06399 TYP_DESC(exp_desc_l.type_idx) != Default_Typed) {
06400 exp_desc->type_idx = exp_desc_l.type_idx;
06401 }
06402 else if (exp_desc_r.linear_type == Integer_8 &&
06403 TYP_DESC(exp_desc_r.type_idx) != Default_Typed) {
06404 exp_desc->type_idx = exp_desc_r.type_idx;
06405 }
06406 }
06407
06408 if (! bin_array_syntax_check(&exp_desc_l, &exp_desc_r,
06409 exp_desc, line, col)) {
06410 ok = FALSE;
06411 }
06412
06413 exp_desc->constant = exp_desc_l.constant &&
06414 exp_desc_r.constant;
06415 exp_desc->foldable = exp_desc_l.foldable &&
06416 exp_desc_r.foldable;
06417
06418 exp_desc->will_fold_later = (exp_desc_l.will_fold_later &
06419 exp_desc_r.will_fold_later) |
06420 (exp_desc_l.will_fold_later &
06421 exp_desc_r.foldable) |
06422 (exp_desc_l.foldable &
06423 exp_desc_r.will_fold_later);
06424
06425 if (opt_flags.ieeeconform &&
06426 ! comp_gen_expr &&
06427 (exp_desc_l.type == Real ||
06428 exp_desc_l.type == Complex ||
06429 exp_desc_r.type == Real ||
06430 exp_desc_r.type == Complex)) {
06431
06432
06433
06434 exp_desc->foldable = FALSE;
06435 exp_desc->will_fold_later = FALSE;
06436 }
06437 else if (exp_desc->rank != 0) {
06438
06439 }
06440 else if (exp_desc->foldable &&
06441 IR_FLD_L(ir_idx) == CN_Tbl_Idx &&
06442 IR_FLD_R(ir_idx) == CN_Tbl_Idx) {
06443
06444 type_idx = exp_desc->type_idx;
06445
06446 if (folder_driver((char *)&CN_CONST(IR_IDX_L(ir_idx)),
06447 exp_desc_l.type_idx,
06448 (char *)&CN_CONST(IR_IDX_R(ir_idx)),
06449 exp_desc_r.type_idx,
06450 folded_const,
06451 &type_idx,
06452 line,
06453 col,
06454 2,
06455 IR_OPR(ir_idx))) {
06456
06457 exp_desc->type_idx = type_idx;
06458 OPND_FLD((*result_opnd)) = CN_Tbl_Idx;
06459 OPND_IDX((*result_opnd)) = ntr_const_tbl(exp_desc->type_idx,
06460 FALSE,
06461 folded_const);
06462
06463 exp_desc->linear_type = TYP_LINEAR(exp_desc->type_idx);
06464 OPND_LINE_NUM((*result_opnd)) = line;
06465 OPND_COL_NUM((*result_opnd)) = col;
06466 }
06467 else {
06468 ok = FALSE;
06469 }
06470 }
06471 else if (exp_desc_r.foldable &&
06472 IR_FLD_R(ir_idx) == CN_Tbl_Idx) {
06473
06474 if (exp_desc_l.type == Integer &&
06475 exp_desc_l.type_idx == exp_desc_r.type_idx) {
06476
06477 if (compare_cn_and_value(IR_IDX_R(ir_idx), 0, Eq_Opr)) {
06478
06479 COPY_OPND((*result_opnd), IR_OPND_L(ir_idx));
06480 }
06481 }
06482 }
06483 }
06484 else if (resolve_ext_opr(result_opnd, TRUE, save_in_call_list,
06485 (exp_desc->linear_type == Err_Res),
06486 &ok,
06487 &exp_desc_l, &exp_desc_r)) {
06488
06489 (*exp_desc) = exp_desc_l;
06490
06491 goto EXIT;
06492 }
06493 else {
06494 ok = FALSE;
06495 }
06496
06497 IR_TYPE_IDX(ir_idx) = exp_desc->type_idx;
06498 IR_RANK(ir_idx) = exp_desc->rank;
06499
06500 if (IR_RANK(ir_idx)) {
06501 IR_ARRAY_SYNTAX(ir_idx) = TRUE;
06502 }
06503
06504 EXIT:
06505
06506 TRACE (Func_Exit, "minus_opr_handler", NULL);
06507
06508 return(ok);
06509
06510 }
06511
06512
06513
06514
06515
06516
06517
06518
06519
06520
06521
06522
06523
06524
06525
06526
06527
06528 static boolean plus_opr_handler(opnd_type *result_opnd,
06529 expr_arg_type *exp_desc)
06530
06531 {
06532 int col;
06533 expr_arg_type exp_desc_l;
06534 expr_arg_type exp_desc_r;
06535 long_type folded_const[MAX_WORDS_FOR_NUMERIC];
06536 int ir_idx;
06537 int line;
06538 boolean ok = TRUE;
06539 opnd_type opnd;
06540 int opnd_col;
06541 int opnd_line;
06542 boolean save_in_call_list;
06543 int type_idx;
06544
06545
06546 TRACE (Func_Entry, "plus_opr_handler" , NULL);
06547
06548 ir_idx = OPND_IDX((*result_opnd));
06549 line = IR_LINE_NUM(ir_idx);
06550 col = IR_COL_NUM(ir_idx);
06551 save_in_call_list = in_call_list;
06552 in_call_list = FALSE;
06553
06554 COPY_OPND(opnd, IR_OPND_L(ir_idx));
06555 exp_desc_l.rank = 0;
06556 ok = expr_sem(&opnd, &exp_desc_l);
06557 COPY_OPND(IR_OPND_L(ir_idx), opnd);
06558
06559 COPY_OPND(opnd, IR_OPND_R(ir_idx));
06560 exp_desc_r.rank = 0;
06561 ok &= expr_sem(&opnd, &exp_desc_r);
06562 COPY_OPND(IR_OPND_R(ir_idx), opnd);
06563
06564 if (!ok) {
06565 goto EXIT;
06566 }
06567
06568 exp_desc->has_constructor = exp_desc_l.has_constructor ||
06569 exp_desc_r.has_constructor;
06570
06571 exp_desc->has_symbolic = exp_desc_l.has_symbolic || exp_desc_r.has_symbolic;
06572
06573 exp_desc->linear_type = BIN_ADD_TYPE(exp_desc_l.linear_type,
06574 exp_desc_r.linear_type);
06575 if (exp_desc->linear_type != Err_Res &&
06576 (exp_desc_l.rank == exp_desc_r.rank ||
06577 exp_desc_l.rank * exp_desc_r.rank == 0)) {
06578
06579 if (BIN_ADD_EXTN(exp_desc_l.linear_type,
06580 exp_desc_r.linear_type)) {
06581
06582 if (resolve_ext_opr(result_opnd, FALSE, save_in_call_list,
06583 FALSE,
06584 &ok,
06585 &exp_desc_l, &exp_desc_r)) {
06586
06587 (*exp_desc) = exp_desc_l;
06588
06589 goto EXIT;
06590 }
06591 else {
06592 if (exp_desc_l.type == Character ||
06593 exp_desc_l.linear_type == Short_Typeless_Const) {
06594
06595 find_opnd_line_and_column((opnd_type *)
06596 &IR_OPND_L(ir_idx),
06597 &opnd_line,
06598 &opnd_col);
06599
06600 if (exp_desc_l.type == Character) {
06601 PRINTMSG(opnd_line, 161, Ansi, opnd_col);
06602 }
06603
06604 IR_IDX_L(ir_idx) = cast_typeless_constant(IR_IDX_L(ir_idx),
06605 exp_desc->linear_type,
06606 opnd_line,
06607 opnd_col);
06608
06609 exp_desc_l.type_idx = exp_desc->linear_type;
06610 exp_desc_l.type = TYP_TYPE(exp_desc->linear_type);
06611 exp_desc_l.linear_type = exp_desc->linear_type;
06612 }
06613
06614 if (exp_desc_r.type == Character ||
06615 exp_desc_r.linear_type == Short_Typeless_Const) {
06616
06617 find_opnd_line_and_column((opnd_type *)
06618 &IR_OPND_R(ir_idx),
06619 &opnd_line,
06620 &opnd_col);
06621
06622 if (exp_desc_r.type == Character) {
06623 PRINTMSG(opnd_line, 161, Ansi, opnd_col);
06624 }
06625
06626 IR_IDX_R(ir_idx) = cast_typeless_constant(IR_IDX_R(ir_idx),
06627 exp_desc->linear_type,
06628 opnd_line,
06629 opnd_col);
06630
06631 exp_desc_r.type_idx = exp_desc->linear_type;
06632 exp_desc_r.type = TYP_TYPE(exp_desc->linear_type);
06633 exp_desc_r.linear_type = exp_desc->linear_type;
06634 }
06635
06636
06637 exp_desc->linear_type = BIN_ADD_TYPE(exp_desc_l.linear_type,
06638 exp_desc_r.linear_type);
06639 }
06640 }
06641
06642 exp_desc->type_idx = exp_desc->linear_type;
06643 exp_desc->type = TYP_TYPE(exp_desc->type_idx);
06644
06645 if (exp_desc->linear_type == Integer_8) {
06646
06647
06648 if (exp_desc_l.linear_type == Integer_8 &&
06649 TYP_DESC(exp_desc_l.type_idx) != Default_Typed) {
06650 exp_desc->type_idx = exp_desc_l.type_idx;
06651 }
06652 else if (exp_desc_r.linear_type == Integer_8 &&
06653 TYP_DESC(exp_desc_r.type_idx) != Default_Typed) {
06654 exp_desc->type_idx = exp_desc_r.type_idx;
06655 }
06656 }
06657
06658 if (! bin_array_syntax_check(&exp_desc_l, &exp_desc_r,
06659 exp_desc, line, col)) {
06660 ok = FALSE;
06661 }
06662
06663 exp_desc->constant = exp_desc_l.constant &&
06664 exp_desc_r.constant;
06665 exp_desc->foldable = exp_desc_l.foldable &&
06666 exp_desc_r.foldable;
06667
06668 exp_desc->will_fold_later = (exp_desc_l.will_fold_later &
06669 exp_desc_r.will_fold_later) |
06670 (exp_desc_l.will_fold_later &
06671 exp_desc_r.foldable) |
06672 (exp_desc_l.foldable &
06673 exp_desc_r.will_fold_later);
06674
06675 if (opt_flags.ieeeconform &&
06676 ! comp_gen_expr &&
06677 (exp_desc_l.type == Real ||
06678 exp_desc_l.type == Complex ||
06679 exp_desc_r.type == Real ||
06680 exp_desc_r.type == Complex)) {
06681
06682
06683
06684 exp_desc->foldable = FALSE;
06685 exp_desc->will_fold_later = FALSE;
06686 }
06687 else if (exp_desc->rank != 0) {
06688
06689 }
06690 else if (exp_desc->foldable &&
06691 IR_FLD_L(ir_idx) == CN_Tbl_Idx &&
06692 IR_FLD_R(ir_idx) == CN_Tbl_Idx) {
06693
06694
06695 type_idx = exp_desc->type_idx;
06696
06697 if (folder_driver((char *)&CN_CONST(IR_IDX_L(ir_idx)),
06698 exp_desc_l.type_idx,
06699 (char *)&CN_CONST(IR_IDX_R(ir_idx)),
06700 exp_desc_r.type_idx,
06701 folded_const,
06702 &type_idx,
06703 line,
06704 col,
06705 2,
06706 IR_OPR(ir_idx))) {
06707
06708 exp_desc->type_idx = type_idx;
06709 OPND_FLD((*result_opnd)) = CN_Tbl_Idx;
06710 OPND_IDX((*result_opnd)) = ntr_const_tbl(
06711 exp_desc->type_idx,
06712 FALSE,
06713 folded_const);
06714
06715 exp_desc->linear_type = TYP_LINEAR(exp_desc->type_idx);
06716 OPND_LINE_NUM((*result_opnd)) = line;
06717 OPND_COL_NUM((*result_opnd)) = col;
06718 }
06719 else {
06720 ok = FALSE;
06721 }
06722 }
06723 else if (exp_desc_l.foldable &&
06724 IR_FLD_L(ir_idx) == CN_Tbl_Idx) {
06725
06726 if (exp_desc_l.type == Integer &&
06727 exp_desc_l.type_idx == exp_desc_r.type_idx) {
06728
06729 if (compare_cn_and_value(IR_IDX_L(ir_idx), 0, Eq_Opr)) {
06730
06731 COPY_OPND((*result_opnd), IR_OPND_R(ir_idx));
06732 }
06733 }
06734 }
06735 else if (exp_desc_r.foldable &&
06736 IR_FLD_R(ir_idx) == CN_Tbl_Idx) {
06737
06738 if (exp_desc_l.type == Integer &&
06739 exp_desc_l.type_idx == exp_desc_r.type_idx) {
06740
06741 if (compare_cn_and_value(IR_IDX_R(ir_idx), 0, Eq_Opr)) {
06742
06743 COPY_OPND((*result_opnd), IR_OPND_L(ir_idx));
06744 }
06745 }
06746 }
06747 }
06748 else if (resolve_ext_opr(result_opnd, TRUE, save_in_call_list,
06749 (exp_desc->linear_type == Err_Res),
06750 &ok,
06751 &exp_desc_l, &exp_desc_r)) {
06752
06753 (*exp_desc) = exp_desc_l;
06754
06755 goto EXIT;
06756 }
06757 else {
06758 ok = FALSE;
06759 }
06760
06761 IR_TYPE_IDX(ir_idx) = exp_desc->type_idx;
06762 IR_RANK(ir_idx) = exp_desc->rank;
06763
06764 if (IR_RANK(ir_idx)) {
06765 IR_ARRAY_SYNTAX(ir_idx) = TRUE;
06766 }
06767
06768 EXIT:
06769
06770 TRACE (Func_Exit, "plus_opr_handler", NULL);
06771
06772 return(ok);
06773
06774 }
06775
06776
06777
06778
06779
06780
06781
06782
06783
06784
06785
06786
06787
06788
06789
06790
06791
06792 static boolean concat_opr_handler(opnd_type *result_opnd,
06793 expr_arg_type *exp_desc)
06794
06795 {
06796 char *char_ptr1;
06797 char *char_ptr2;
06798 int col;
06799 expr_arg_type exp_desc_l;
06800 expr_arg_type exp_desc_r;
06801 long i;
06802 int ir_idx;
06803 long_type length[MAX_WORDS_FOR_INTEGER];
06804 int line;
06805 int list_idx;
06806 int k;
06807 boolean ok = TRUE;
06808 opnd_type opnd;
06809 int plus_idx;
06810 boolean save_in_call_list;
06811 int type_idx;
06812
06813
06814 TRACE (Func_Entry, "concat_opr_handler" , NULL);
06815
06816 ir_idx = OPND_IDX((*result_opnd));
06817 line = IR_LINE_NUM(ir_idx);
06818 col = IR_COL_NUM(ir_idx);
06819 save_in_call_list = in_call_list;
06820 in_call_list = FALSE;
06821
06822 #ifdef KEY
06823
06824
06825
06826
06827
06828
06829 if (OPND_FLD(IR_OPND_L(ir_idx)) == IL_Tbl_Idx) {
06830 return ok;
06831 }
06832 #endif
06833
06834 COPY_OPND(opnd, IR_OPND_L(ir_idx));
06835 exp_desc_l.rank = 0;
06836 ok = expr_sem(&opnd, &exp_desc_l);
06837 COPY_OPND(IR_OPND_L(ir_idx), opnd);
06838
06839 COPY_OPND(opnd, IR_OPND_R(ir_idx));
06840 exp_desc_r.rank = 0;
06841 ok &= expr_sem(&opnd, &exp_desc_r);
06842 COPY_OPND(IR_OPND_R(ir_idx), opnd);
06843
06844 exp_desc->has_constructor = exp_desc_l.has_constructor ||
06845 exp_desc_r.has_constructor;
06846
06847 if (! ok) {
06848 goto EXIT;
06849 }
06850
06851 if (exp_desc_l.type == Character &&
06852 exp_desc_r.type == Character &&
06853 (exp_desc_r.rank == exp_desc_l.rank ||
06854 exp_desc_r.rank * exp_desc_l.rank == 0)) {
06855
06856 exp_desc->type = Character;
06857
06858
06859
06860 exp_desc->type_idx = exp_desc_l.type_idx;
06861
06862 if (! bin_array_syntax_check(&exp_desc_l, &exp_desc_r,
06863 exp_desc, line, col)) {
06864 ok = FALSE;
06865 }
06866
06867 exp_desc->constant = exp_desc_l.constant &&
06868 exp_desc_r.constant;
06869 exp_desc->foldable = exp_desc_l.foldable &&
06870 exp_desc_r.foldable;
06871
06872 exp_desc->has_symbolic = exp_desc_l.has_symbolic ||
06873 exp_desc_r.has_symbolic;
06874
06875 exp_desc->will_fold_later = (exp_desc_l.will_fold_later &
06876 exp_desc_r.will_fold_later) |
06877 (exp_desc_l.will_fold_later &
06878 exp_desc_r.foldable) |
06879 (exp_desc_l.foldable &
06880 exp_desc_r.will_fold_later);
06881
06882 if (exp_desc->foldable &&
06883 IR_FLD_L(ir_idx) == CN_Tbl_Idx &&
06884 IR_FLD_R(ir_idx) == CN_Tbl_Idx) {
06885
06886
06887
06888 type_idx = CG_INTEGER_DEFAULT_TYPE;
06889
06890 if (folder_driver((char *) &CN_CONST(TYP_IDX(exp_desc_r.type_idx)),
06891 CN_TYPE_IDX(TYP_IDX(exp_desc_r.type_idx)),
06892 (char *) &CN_CONST(TYP_IDX(exp_desc_l.type_idx)),
06893 CN_TYPE_IDX(TYP_IDX(exp_desc_l.type_idx)),
06894 length,
06895 &type_idx,
06896 line,
06897 col,
06898 2,
06899 Plus_Opr)) {
06900 }
06901
06902 CLEAR_TBL_NTRY(type_tbl, TYP_WORK_IDX);
06903
06904 TYP_TYPE(TYP_WORK_IDX) = Character;
06905 TYP_LINEAR(TYP_WORK_IDX) = CHARACTER_DEFAULT_TYPE;
06906 TYP_CHAR_CLASS(TYP_WORK_IDX) = Const_Len_Char;
06907 TYP_FLD(TYP_WORK_IDX) = CN_Tbl_Idx;
06908 TYP_IDX(TYP_WORK_IDX) = ntr_const_tbl(CG_INTEGER_DEFAULT_TYPE,
06909 FALSE,
06910 length);
06911 exp_desc->type_idx = ntr_type_tbl();
06912 exp_desc->char_len.fld = TYP_FLD(exp_desc->type_idx);
06913 exp_desc->char_len.idx = TYP_IDX(exp_desc->type_idx);
06914 OPND_LINE_NUM(exp_desc->char_len) = line;
06915 OPND_COL_NUM(exp_desc->char_len) = col;
06916
06917 OPND_FLD((*result_opnd)) = CN_Tbl_Idx;
06918 OPND_LINE_NUM((*result_opnd)) = IR_LINE_NUM(ir_idx);
06919 OPND_COL_NUM((*result_opnd)) = IR_COL_NUM(ir_idx);
06920
06921
06922
06923
06924 OPND_IDX((*result_opnd))= ntr_const_tbl(exp_desc->type_idx,
06925 TRUE,
06926 NULL);
06927
06928
06929
06930
06931
06932 char_ptr1 = (char *)&CN_CONST(OPND_IDX((*result_opnd)));
06933 char_ptr2 = (char *)&CN_CONST(IR_IDX_L(ir_idx));
06934 k = 0;
06935
06936 for (i=0; i < CN_INT_TO_C(TYP_IDX(exp_desc_l.type_idx)); i++){
06937 char_ptr1[k] = char_ptr2[i];
06938 k++;
06939 }
06940
06941
06942
06943 char_ptr2 = (char *)&CN_CONST(IR_IDX_R(ir_idx));
06944
06945 for (i=0; i < CN_INT_TO_C(TYP_IDX(exp_desc_r.type_idx)); i++){
06946 char_ptr1[k] = char_ptr2[i];
06947 k++;
06948 }
06949
06950
06951
06952 while (k % TARGET_CHARS_PER_WORD != 0) {
06953 char_ptr1[k] = ' ';
06954 k++;
06955 }
06956 }
06957 else {
06958
06959 io_item_must_flatten = TRUE;
06960
06961 NTR_IR_TBL(plus_idx);
06962 IR_OPR(plus_idx) = Plus_Opr;
06963 IR_TYPE_IDX(plus_idx) = CG_INTEGER_DEFAULT_TYPE;
06964 IR_LINE_NUM(plus_idx) = line;
06965 IR_COL_NUM(plus_idx) = col;
06966 COPY_OPND(IR_OPND_L(plus_idx), exp_desc_l.char_len);
06967 COPY_OPND(IR_OPND_R(plus_idx), exp_desc_r.char_len);
06968
06969 exp_desc->char_len.fld = IR_Tbl_Idx;
06970 exp_desc->char_len.idx = plus_idx;
06971
06972 if (exp_desc_l.char_len.fld == CN_Tbl_Idx &&
06973 exp_desc_r.char_len.fld == CN_Tbl_Idx) {
06974
06975 COPY_OPND(opnd, exp_desc->char_len);
06976 exp_desc_l.rank = 0;
06977 ok = expr_semantics(&opnd, &exp_desc_l);
06978 COPY_OPND(exp_desc->char_len, opnd);
06979 }
06980
06981
06982 if (IR_FLD_L(ir_idx) == IR_Tbl_Idx &&
06983 IR_OPR(IR_IDX_L(ir_idx)) == Concat_Opr) {
06984
06985 COPY_OPND(IR_OPND_L(ir_idx),
06986 IR_OPND_L(IR_IDX_L(ir_idx)));
06987
06988 list_idx = IR_IDX_L(ir_idx);
06989 while (IL_NEXT_LIST_IDX(list_idx)) {
06990 list_idx = IL_NEXT_LIST_IDX(list_idx);
06991 }
06992
06993 NTR_IR_LIST_TBL(IL_NEXT_LIST_IDX(list_idx));
06994 IL_PREV_LIST_IDX(IL_NEXT_LIST_IDX(list_idx)) = list_idx;
06995 list_idx = IL_NEXT_LIST_IDX(list_idx);
06996 COPY_OPND(IL_OPND(list_idx), IR_OPND_R(ir_idx));
06997 IR_LIST_CNT_L(ir_idx)++;
06998 IR_FLD_R(ir_idx) = NO_Tbl_Idx;
06999 IR_IDX_R(ir_idx) = NULL_IDX;
07000 }
07001 else {
07002 NTR_IR_LIST_TBL(list_idx);
07003 COPY_OPND(IL_OPND(list_idx), IR_OPND_L(ir_idx));
07004 IR_FLD_L(ir_idx) = IL_Tbl_Idx;
07005 IR_IDX_L(ir_idx) = list_idx;
07006 IR_LIST_CNT_L(ir_idx) = 2;
07007 NTR_IR_LIST_TBL(IL_NEXT_LIST_IDX(list_idx));
07008 IL_PREV_LIST_IDX(IL_NEXT_LIST_IDX(list_idx)) = list_idx;
07009 list_idx = IL_NEXT_LIST_IDX(list_idx);
07010 COPY_OPND(IL_OPND(list_idx), IR_OPND_R(ir_idx));
07011 IR_FLD_R(ir_idx) = NO_Tbl_Idx;
07012 IR_IDX_R(ir_idx) = NULL_IDX;
07013 }
07014 }
07015
07016 if (exp_desc->foldable &&
07017 compare_cn_and_value(TYP_IDX(exp_desc->type_idx),
07018 MAX_CHARS_IN_TYPELESS,
07019 Le_Opr)) {
07020 exp_desc->linear_type = Short_Char_Const;
07021 }
07022 else {
07023
07024 exp_desc->linear_type = Character_1;
07025 }
07026
07027 type_tbl[TYP_WORK_IDX] = type_tbl[exp_desc->type_idx];
07028 TYP_LINEAR(TYP_WORK_IDX) = exp_desc->linear_type;
07029 exp_desc->type_idx = ntr_type_tbl();
07030
07031 }
07032 else if (resolve_ext_opr(result_opnd, TRUE, save_in_call_list,
07033 (exp_desc_l.type != Character ||
07034 exp_desc_r.type != Character),
07035 &ok,
07036 &exp_desc_l, &exp_desc_r)) {
07037
07038 (*exp_desc) = exp_desc_l;
07039
07040 goto EXIT;
07041 }
07042 else {
07043 ok = FALSE;
07044 }
07045
07046 IR_TYPE_IDX(ir_idx) = exp_desc->type_idx;
07047 IR_RANK(ir_idx) = exp_desc->rank;
07048
07049 if (IR_RANK(ir_idx)) {
07050 IR_ARRAY_SYNTAX(ir_idx) = TRUE;
07051 }
07052
07053
07054 EXIT:
07055
07056 TRACE (Func_Exit, "concat_opr_handler", NULL);
07057
07058 return(ok);
07059
07060 }
07061 #ifdef KEY
07062
07063
07064
07065
07066
07067
07068 int eq_ne_on_logical(expr_arg_type *exp_desc, expr_arg_type *exp_desc_l,
07069 expr_arg_type *exp_desc_r)
07070 {
07071 if (on_off_flags.issue_ansi_messages) {
07072 return FALSE;
07073 }
07074 int result = EQ_NE_ON_LOGICAL(exp_desc_l->linear_type,
07075 exp_desc_r->linear_type);
07076 if (Err_Res == result) {
07077 return FALSE;
07078 }
07079 if (exp_desc) {
07080 exp_desc->linear_type = result;
07081 }
07082 return TRUE;
07083 }
07084
07085
07086
07087
07088
07089
07090 static void
07091 handle_intrinsic_opr(
07092 expr_arg_type *exp_desc,
07093 expr_arg_type *exp_desc_l,
07094 expr_arg_type *exp_desc_r,
07095 int line,
07096 int col,
07097 boolean *ok,
07098 int *type_idx,
07099 opnd_type *result_opnd,
07100 int ir_idx,
07101 long_type folded_const[])
07102 {
07103 exp_desc->type_idx = exp_desc->linear_type;
07104 exp_desc->type = TYP_TYPE(exp_desc->type_idx);
07105
07106 if (! bin_array_syntax_check(exp_desc_l, exp_desc_r,
07107 exp_desc, line, col)) {
07108 *ok = FALSE;
07109 }
07110
07111 exp_desc->constant = exp_desc_l->constant &&
07112 exp_desc_r->constant;
07113 exp_desc->foldable = exp_desc_l->foldable &&
07114 exp_desc_r->foldable;
07115
07116 exp_desc->will_fold_later = (exp_desc_l->will_fold_later &
07117 exp_desc_r->will_fold_later) |
07118 (exp_desc_l->will_fold_later &
07119 exp_desc_r->foldable) |
07120 (exp_desc_l->foldable &
07121 exp_desc_r->will_fold_later);
07122
07123 if (opt_flags.ieeeconform &&
07124 ! comp_gen_expr &&
07125 (exp_desc_l->type == Real ||
07126 exp_desc_l->type == Complex ||
07127 exp_desc_r->type == Real ||
07128 exp_desc_r->type == Complex)) {
07129
07130
07131
07132 exp_desc->foldable = FALSE;
07133 exp_desc->will_fold_later = FALSE;
07134 }
07135 else if (exp_desc->foldable &&
07136 IR_FLD_L(ir_idx) == CN_Tbl_Idx &&
07137 IR_FLD_R(ir_idx) == CN_Tbl_Idx) {
07138
07139 *type_idx = exp_desc->type_idx;
07140
07141 if (folder_driver((char *)&CN_CONST(IR_IDX_L(ir_idx)),
07142 exp_desc_l->type_idx,
07143 (char *)&CN_CONST(IR_IDX_R(ir_idx)),
07144 exp_desc_r->type_idx,
07145 folded_const,
07146 type_idx,
07147 line,
07148 col,
07149 2,
07150 IR_OPR(ir_idx))) {
07151
07152 exp_desc->type_idx = *type_idx;
07153 OPND_FLD((*result_opnd)) = CN_Tbl_Idx;
07154 OPND_IDX((*result_opnd)) = ntr_const_tbl(exp_desc->type_idx,
07155 FALSE,
07156 folded_const);
07157
07158 exp_desc->linear_type = TYP_LINEAR(exp_desc->type_idx);
07159 OPND_LINE_NUM((*result_opnd)) = line;
07160 OPND_COL_NUM((*result_opnd)) = col;
07161 }
07162 else {
07163 *ok = FALSE;
07164 }
07165 }
07166 else if (exp_desc_l->type == Character &&
07167 exp_desc_r->type == Character &&
07168 exp_desc_l->char_len.fld == CN_Tbl_Idx &&
07169 CN_INT_TO_C(exp_desc_l->char_len.idx) == 0 &&
07170 exp_desc_r->char_len.fld == CN_Tbl_Idx &&
07171 CN_INT_TO_C(exp_desc_r->char_len.idx) == 0) {
07172
07173
07174
07175 OPND_FLD((*result_opnd)) = CN_Tbl_Idx;
07176 OPND_IDX((*result_opnd)) = set_up_logical_constant(folded_const,
07177 exp_desc->type_idx,
07178 (IR_OPR(ir_idx) == Eq_Opr) ? TRUE_VALUE :
07179 FALSE_VALUE,
07180 TRUE);
07181
07182
07183
07184 OPND_LINE_NUM((*result_opnd)) = line;
07185 OPND_COL_NUM((*result_opnd)) = col;
07186
07187 if (exp_desc->rank) {
07188 make_logical_array_tmp(result_opnd,
07189 exp_desc);
07190 }
07191 }
07192 }
07193 #endif
07194
07195
07196
07197
07198
07199
07200
07201
07202
07203
07204
07205
07206
07207
07208
07209
07210
07211 static boolean eq_opr_handler(opnd_type *result_opnd,
07212 expr_arg_type *exp_desc)
07213
07214 {
07215 int col;
07216 expr_arg_type exp_desc_l;
07217 expr_arg_type exp_desc_r;
07218 long_type folded_const[MAX_WORDS_FOR_NUMERIC];
07219 int ir_idx;
07220 int line;
07221 boolean ok = TRUE;
07222 opnd_type opnd;
07223 int opnd_col;
07224 int opnd_line;
07225 boolean save_in_call_list;
07226 int type_idx;
07227
07228
07229 TRACE (Func_Entry, "eq_opr_handler" , NULL);
07230
07231 ir_idx = OPND_IDX((*result_opnd));
07232 line = IR_LINE_NUM(ir_idx);
07233 col = IR_COL_NUM(ir_idx);
07234 save_in_call_list = in_call_list;
07235 in_call_list = FALSE;
07236
07237 COPY_OPND(opnd, IR_OPND_L(ir_idx));
07238 exp_desc_l.rank = 0;
07239 ok = expr_sem(&opnd, &exp_desc_l);
07240 COPY_OPND(IR_OPND_L(ir_idx), opnd);
07241
07242 COPY_OPND(opnd, IR_OPND_R(ir_idx));
07243 exp_desc_r.rank = 0;
07244 ok &= expr_sem(&opnd, &exp_desc_r);
07245 COPY_OPND(IR_OPND_R(ir_idx), opnd);
07246
07247 if (!ok) {
07248 goto EXIT;
07249 }
07250
07251 exp_desc->has_constructor = exp_desc_l.has_constructor ||
07252 exp_desc_r.has_constructor;
07253
07254 exp_desc->has_symbolic = exp_desc_l.has_symbolic ||
07255 exp_desc_r.has_symbolic;
07256
07257 exp_desc->linear_type = EQ_NE_TYPE(exp_desc_l.linear_type,
07258 exp_desc_r.linear_type);
07259
07260 if (exp_desc->linear_type != Err_Res &&
07261 (exp_desc_l.rank == exp_desc_r.rank ||
07262 exp_desc_l.rank * exp_desc_r.rank == 0)) {
07263
07264 if (EQ_NE_EXTN(exp_desc_l.linear_type,
07265 exp_desc_r.linear_type)) {
07266
07267 if (resolve_ext_opr(result_opnd, FALSE, save_in_call_list,
07268 FALSE,
07269 &ok,
07270 &exp_desc_l, &exp_desc_r)) {
07271
07272 (*exp_desc) = exp_desc_l;
07273
07274 goto EXIT;
07275 }
07276 else {
07277 if (exp_desc_l.type == Character ||
07278 exp_desc_l.linear_type == Short_Typeless_Const) {
07279
07280 find_opnd_line_and_column((opnd_type *)
07281 &IR_OPND_L(ir_idx),
07282 &opnd_line,
07283 &opnd_col);
07284
07285 if (exp_desc_l.type == Character) {
07286 PRINTMSG(opnd_line, 161, Ansi, opnd_col);
07287 }
07288
07289 type_idx = exp_desc_r.type_idx;
07290
07291 if (exp_desc_r.type == Character ||
07292 exp_desc_r.type == Typeless) {
07293 type_idx = INTEGER_DEFAULT_TYPE;
07294 }
07295
07296 IR_IDX_L(ir_idx) = cast_typeless_constant(IR_IDX_L(ir_idx),
07297 type_idx,
07298 opnd_line,
07299 opnd_col);
07300
07301 exp_desc_l.type_idx = type_idx;
07302 exp_desc_l.type = TYP_TYPE(type_idx);
07303 exp_desc_l.linear_type = TYP_LINEAR(type_idx);
07304 }
07305
07306 if (exp_desc_r.type == Character ||
07307 exp_desc_r.linear_type == Short_Typeless_Const) {
07308
07309 find_opnd_line_and_column((opnd_type *)
07310 &IR_OPND_R(ir_idx),
07311 &opnd_line,
07312 &opnd_col);
07313
07314 if (exp_desc_r.type == Character) {
07315 PRINTMSG(opnd_line, 161, Ansi, opnd_col);
07316 }
07317
07318 type_idx = exp_desc_l.type_idx;
07319
07320 if (exp_desc_l.type == Character ||
07321 exp_desc_l.type == Typeless) {
07322 type_idx = INTEGER_DEFAULT_TYPE;
07323 }
07324
07325 IR_IDX_R(ir_idx) = cast_typeless_constant(IR_IDX_R(ir_idx),
07326 type_idx,
07327 opnd_line,
07328 opnd_col);
07329
07330 exp_desc_r.type_idx = type_idx;
07331 exp_desc_r.type = TYP_TYPE(type_idx);
07332 exp_desc_r.linear_type = TYP_LINEAR(type_idx);
07333 }
07334
07335
07336 exp_desc->linear_type = EQ_NE_TYPE(exp_desc_l.linear_type,
07337 exp_desc_r.linear_type);
07338 }
07339 }
07340
07341 #ifdef KEY
07342 handle_intrinsic_opr(exp_desc, &exp_desc_l, &exp_desc_r, line, col,
07343 &ok, &type_idx, result_opnd, ir_idx, folded_const);
07344 #else
07345
07346 #endif
07347 }
07348 else if (resolve_ext_opr(result_opnd, TRUE, save_in_call_list,
07349 (exp_desc->linear_type == Err_Res),
07350 &ok,
07351 &exp_desc_l, &exp_desc_r)) {
07352
07353 (*exp_desc) = exp_desc_l;
07354
07355 goto EXIT;
07356 }
07357 #ifdef KEY
07358
07359
07360
07361
07362
07363
07364 else if (eq_ne_on_logical(exp_desc, &exp_desc_l, &exp_desc_r)) {
07365 handle_intrinsic_opr(exp_desc, &exp_desc_l, &exp_desc_r, line, col,
07366 &ok, &type_idx, result_opnd, ir_idx, folded_const);
07367 }
07368 #endif
07369 else {
07370 ok = FALSE;
07371 }
07372
07373 IR_TYPE_IDX(ir_idx) = exp_desc->type_idx;
07374 IR_RANK(ir_idx) = exp_desc->rank;
07375
07376 if (IR_RANK(ir_idx)) {
07377 IR_ARRAY_SYNTAX(ir_idx) = TRUE;
07378 }
07379
07380 EXIT:
07381
07382 TRACE (Func_Exit, "eq_opr_handler", NULL);
07383
07384 return(ok);
07385
07386 }
07387
07388
07389
07390
07391
07392
07393
07394
07395
07396
07397
07398
07399
07400
07401
07402
07403
07404 static boolean lg_opr_handler(opnd_type *result_opnd,
07405 expr_arg_type *exp_desc)
07406
07407 {
07408 int col;
07409 expr_arg_type exp_desc_l;
07410 expr_arg_type exp_desc_r;
07411 long_type folded_const[MAX_WORDS_FOR_NUMERIC];
07412 int ir_idx;
07413 int line;
07414 boolean ok = TRUE;
07415 opnd_type opnd;
07416 int opnd_col;
07417 int opnd_line;
07418 boolean save_in_call_list;
07419 int type_idx;
07420
07421
07422 TRACE (Func_Entry, "lg_opr_handler" , NULL);
07423
07424 ir_idx = OPND_IDX((*result_opnd));
07425 line = IR_LINE_NUM(ir_idx);
07426 col = IR_COL_NUM(ir_idx);
07427 save_in_call_list = in_call_list;
07428 in_call_list = FALSE;
07429
07430 COPY_OPND(opnd, IR_OPND_L(ir_idx));
07431 exp_desc_l.rank = 0;
07432 ok = expr_sem(&opnd, &exp_desc_l);
07433 COPY_OPND(IR_OPND_L(ir_idx), opnd);
07434
07435 COPY_OPND(opnd, IR_OPND_R(ir_idx));
07436 exp_desc_r.rank = 0;
07437 ok &= expr_sem(&opnd, &exp_desc_r);
07438 COPY_OPND(IR_OPND_R(ir_idx), opnd);
07439
07440 if (!ok) {
07441 goto EXIT;
07442 }
07443
07444 exp_desc->has_constructor = exp_desc_l.has_constructor ||
07445 exp_desc_r.has_constructor;
07446
07447 exp_desc->has_symbolic = exp_desc_l.has_symbolic || exp_desc_r.has_symbolic;
07448
07449 exp_desc->linear_type = LG_TYPE(exp_desc_l.linear_type,
07450 exp_desc_r.linear_type);
07451
07452 if (exp_desc->linear_type != Err_Res &&
07453 (exp_desc_l.rank == exp_desc_r.rank ||
07454 exp_desc_l.rank * exp_desc_r.rank == 0)) {
07455
07456 if (LG_EXTN(exp_desc_l.linear_type,
07457 exp_desc_r.linear_type)) {
07458
07459 if (resolve_ext_opr(result_opnd, FALSE, save_in_call_list,
07460 FALSE,
07461 &ok,
07462 &exp_desc_l, &exp_desc_r)) {
07463
07464 (*exp_desc) = exp_desc_l;
07465
07466 goto EXIT;
07467 }
07468 else {
07469 if (exp_desc_l.type == Character ||
07470 exp_desc_l.linear_type == Short_Typeless_Const) {
07471
07472 find_opnd_line_and_column((opnd_type *)
07473 &IR_OPND_L(ir_idx),
07474 &opnd_line,
07475 &opnd_col);
07476
07477 if (exp_desc_l.type == Character) {
07478 PRINTMSG(opnd_line, 161, Ansi, opnd_col);
07479 }
07480
07481 type_idx = exp_desc_r.type_idx;
07482
07483 if (exp_desc_r.type == Character ||
07484 exp_desc_r.type == Typeless) {
07485 type_idx = INTEGER_DEFAULT_TYPE;
07486 }
07487
07488 IR_IDX_L(ir_idx) = cast_typeless_constant(IR_IDX_L(ir_idx),
07489 type_idx,
07490 opnd_line,
07491 opnd_col);
07492
07493 exp_desc_l.type_idx = type_idx;
07494 exp_desc_l.type = TYP_TYPE(type_idx);
07495 exp_desc_l.linear_type = TYP_LINEAR(type_idx);
07496 }
07497
07498 if (exp_desc_r.type == Character ||
07499 exp_desc_r.linear_type == Short_Typeless_Const) {
07500
07501 find_opnd_line_and_column((opnd_type *)
07502 &IR_OPND_R(ir_idx),
07503 &opnd_line,
07504 &opnd_col);
07505
07506 if (exp_desc_r.type == Character) {
07507 PRINTMSG(opnd_line, 161, Ansi, opnd_col);
07508 }
07509
07510 type_idx = exp_desc_l.type_idx;
07511
07512 if (exp_desc_l.type == Character ||
07513 exp_desc_l.type == Typeless) {
07514 type_idx = INTEGER_DEFAULT_TYPE;
07515 }
07516
07517 IR_IDX_R(ir_idx) = cast_typeless_constant(IR_IDX_R(ir_idx),
07518 type_idx,
07519 opnd_line,
07520 opnd_col);
07521
07522 exp_desc_r.type_idx = type_idx;
07523 exp_desc_r.type = TYP_TYPE(type_idx);
07524 exp_desc_r.linear_type = TYP_LINEAR(type_idx);
07525 }
07526
07527
07528 exp_desc->linear_type = LG_TYPE(exp_desc_l.linear_type,
07529 exp_desc_r.linear_type);
07530 }
07531 }
07532
07533 exp_desc->type_idx = exp_desc->linear_type;
07534 exp_desc->type = TYP_TYPE(exp_desc->type_idx);
07535
07536 if (! bin_array_syntax_check(&exp_desc_l, &exp_desc_r,
07537 exp_desc, line, col)) {
07538 ok = FALSE;
07539 }
07540
07541 exp_desc->constant = exp_desc_l.constant &&
07542 exp_desc_r.constant;
07543 exp_desc->foldable = exp_desc_l.foldable &&
07544 exp_desc_r.foldable;
07545
07546 exp_desc->will_fold_later = (exp_desc_l.will_fold_later &
07547 exp_desc_r.will_fold_later) |
07548 (exp_desc_l.will_fold_later &
07549 exp_desc_r.foldable) |
07550 (exp_desc_l.foldable &
07551 exp_desc_r.will_fold_later);
07552
07553
07554 if (! target_ieee) {
07555
07556 IR_OPR(ir_idx) = Ne_Opr;
07557 }
07558 else {
07559
07560
07561 exp_desc->foldable = FALSE;
07562 exp_desc->will_fold_later = FALSE;
07563 }
07564
07565 if (opt_flags.ieeeconform &&
07566 ! comp_gen_expr &&
07567 (exp_desc_l.type == Real ||
07568 exp_desc_l.type == Complex ||
07569 exp_desc_r.type == Real ||
07570 exp_desc_r.type == Complex)) {
07571
07572
07573
07574 exp_desc->foldable = FALSE;
07575 exp_desc->will_fold_later = FALSE;
07576 }
07577 else if (exp_desc->foldable &&
07578 IR_FLD_L(ir_idx) == CN_Tbl_Idx &&
07579 IR_FLD_R(ir_idx) == CN_Tbl_Idx) {
07580
07581 type_idx = exp_desc->type_idx;
07582
07583 if (folder_driver((char *)&CN_CONST(IR_IDX_L(ir_idx)),
07584 exp_desc_l.type_idx,
07585 (char *)&CN_CONST(IR_IDX_R(ir_idx)),
07586 exp_desc_r.type_idx,
07587 folded_const,
07588 &type_idx,
07589 line,
07590 col,
07591 2,
07592 IR_OPR(ir_idx))) {
07593
07594 exp_desc->type_idx = type_idx;
07595 OPND_FLD((*result_opnd)) = CN_Tbl_Idx;
07596 OPND_IDX((*result_opnd)) = ntr_const_tbl(exp_desc->type_idx,
07597 FALSE,
07598 folded_const);
07599
07600 exp_desc->linear_type = TYP_LINEAR(exp_desc->type_idx);
07601 OPND_LINE_NUM((*result_opnd)) = line;
07602 OPND_COL_NUM((*result_opnd)) = col;
07603 }
07604 else {
07605 ok = FALSE;
07606 }
07607 }
07608 }
07609 else if (resolve_ext_opr(result_opnd, TRUE, save_in_call_list,
07610 (exp_desc->linear_type == Err_Res),
07611 &ok,
07612 &exp_desc_l, &exp_desc_r)) {
07613
07614 (*exp_desc) = exp_desc_l;
07615
07616 goto EXIT;
07617 }
07618 else {
07619 ok = FALSE;
07620 }
07621
07622 IR_TYPE_IDX(ir_idx) = exp_desc->type_idx;
07623 IR_RANK(ir_idx) = exp_desc->rank;
07624
07625 if (IR_RANK(ir_idx)) {
07626 IR_ARRAY_SYNTAX(ir_idx) = TRUE;
07627 }
07628
07629 EXIT:
07630
07631 TRACE (Func_Exit, "lg_opr_handler", NULL);
07632
07633 return(ok);
07634
07635 }
07636
07637
07638
07639
07640
07641
07642
07643
07644
07645
07646
07647
07648
07649
07650
07651
07652
07653 static boolean lt_opr_handler(opnd_type *result_opnd,
07654 expr_arg_type *exp_desc)
07655
07656 {
07657 int col;
07658 expr_arg_type exp_desc_l;
07659 expr_arg_type exp_desc_r;
07660 long_type folded_const[MAX_WORDS_FOR_NUMERIC];
07661 int ir_idx;
07662 int line;
07663 boolean ok = TRUE;
07664 opnd_type opnd;
07665 int opnd_col;
07666 int opnd_line;
07667 boolean save_in_call_list;
07668 int type_idx;
07669
07670
07671 TRACE (Func_Entry, "lt_opr_handler" , NULL);
07672
07673 ir_idx = OPND_IDX((*result_opnd));
07674 line = IR_LINE_NUM(ir_idx);
07675 col = IR_COL_NUM(ir_idx);
07676 save_in_call_list = in_call_list;
07677 in_call_list = FALSE;
07678
07679 COPY_OPND(opnd, IR_OPND_L(ir_idx));
07680 exp_desc_l.rank = 0;
07681 ok = expr_sem(&opnd, &exp_desc_l);
07682 COPY_OPND(IR_OPND_L(ir_idx), opnd);
07683
07684 COPY_OPND(opnd, IR_OPND_R(ir_idx));
07685 exp_desc_r.rank = 0;
07686 ok &= expr_sem(&opnd, &exp_desc_r);
07687 COPY_OPND(IR_OPND_R(ir_idx), opnd);
07688
07689 if (!ok) {
07690 goto EXIT;
07691 }
07692
07693 exp_desc->has_constructor = exp_desc_l.has_constructor ||
07694 exp_desc_r.has_constructor;
07695
07696 exp_desc->has_symbolic = exp_desc_l.has_symbolic || exp_desc_r.has_symbolic;
07697
07698 exp_desc->linear_type = GT_LT_TYPE(exp_desc_l.linear_type,
07699 exp_desc_r.linear_type);
07700
07701 if (exp_desc->linear_type != Err_Res &&
07702 (exp_desc_l.rank == exp_desc_r.rank ||
07703 exp_desc_l.rank * exp_desc_r.rank == 0)) {
07704
07705 if (GT_LT_EXTN(exp_desc_l.linear_type,
07706 exp_desc_r.linear_type)) {
07707
07708 if (resolve_ext_opr(result_opnd, FALSE, save_in_call_list,
07709 FALSE,
07710 &ok,
07711 &exp_desc_l, &exp_desc_r)) {
07712
07713 (*exp_desc) = exp_desc_l;
07714
07715 goto EXIT;
07716 }
07717 else {
07718 if (exp_desc_l.type == Character ||
07719 exp_desc_l.linear_type == Short_Typeless_Const) {
07720
07721 find_opnd_line_and_column((opnd_type *)
07722 &IR_OPND_L(ir_idx),
07723 &opnd_line,
07724 &opnd_col);
07725
07726 if (exp_desc_l.type == Character) {
07727 PRINTMSG(opnd_line, 161, Ansi, opnd_col);
07728 }
07729
07730 type_idx = exp_desc_r.type_idx;
07731
07732 if (exp_desc_r.type == Character ||
07733 exp_desc_r.type == Typeless) {
07734 type_idx = INTEGER_DEFAULT_TYPE;
07735 }
07736
07737 IR_IDX_L(ir_idx) = cast_typeless_constant(IR_IDX_L(ir_idx),
07738 type_idx,
07739 opnd_line,
07740 opnd_col);
07741
07742 exp_desc_l.type_idx = type_idx;
07743 exp_desc_l.type = TYP_TYPE(type_idx);
07744 exp_desc_l.linear_type = TYP_LINEAR(type_idx);
07745 }
07746
07747 if (exp_desc_r.type == Character ||
07748 exp_desc_r.linear_type == Short_Typeless_Const) {
07749
07750 find_opnd_line_and_column((opnd_type *)
07751 &IR_OPND_R(ir_idx),
07752 &opnd_line,
07753 &opnd_col);
07754
07755 if (exp_desc_r.type == Character) {
07756 PRINTMSG(opnd_line, 161, Ansi, opnd_col);
07757 }
07758
07759 type_idx = exp_desc_l.type_idx;
07760
07761 if (exp_desc_l.type == Character ||
07762 exp_desc_l.type == Typeless) {
07763 type_idx = INTEGER_DEFAULT_TYPE;
07764 }
07765
07766 IR_IDX_R(ir_idx) = cast_typeless_constant(IR_IDX_R(ir_idx),
07767 type_idx,
07768 opnd_line,
07769 opnd_col);
07770
07771 exp_desc_r.type_idx = type_idx;
07772 exp_desc_r.type = TYP_TYPE(type_idx);
07773 exp_desc_r.linear_type = TYP_LINEAR(type_idx);
07774 }
07775
07776
07777 exp_desc->linear_type = GT_LT_TYPE(exp_desc_l.linear_type,
07778 exp_desc_r.linear_type);
07779 }
07780 }
07781
07782 exp_desc->type_idx = exp_desc->linear_type;
07783 exp_desc->type = TYP_TYPE(exp_desc->type_idx);
07784
07785 if (! bin_array_syntax_check(&exp_desc_l, &exp_desc_r,
07786 exp_desc, line, col)) {
07787 ok = FALSE;
07788 }
07789
07790 exp_desc->constant = exp_desc_l.constant &&
07791 exp_desc_r.constant;
07792 exp_desc->foldable = exp_desc_l.foldable &&
07793 exp_desc_r.foldable;
07794
07795 exp_desc->will_fold_later = (exp_desc_l.will_fold_later &
07796 exp_desc_r.will_fold_later) |
07797 (exp_desc_l.will_fold_later &
07798 exp_desc_r.foldable) |
07799 (exp_desc_l.foldable &
07800 exp_desc_r.will_fold_later);
07801
07802 if (opt_flags.ieeeconform &&
07803 ! comp_gen_expr &&
07804 (exp_desc_l.type == Real ||
07805 exp_desc_l.type == Complex ||
07806 exp_desc_r.type == Real ||
07807 exp_desc_r.type == Complex)) {
07808
07809
07810
07811 exp_desc->foldable = FALSE;
07812 exp_desc->will_fold_later = FALSE;
07813 }
07814 else if (exp_desc->foldable &&
07815 IR_FLD_L(ir_idx) == CN_Tbl_Idx &&
07816 IR_FLD_R(ir_idx) == CN_Tbl_Idx) {
07817
07818 type_idx = exp_desc->type_idx;
07819
07820 if (folder_driver((char *)&CN_CONST(IR_IDX_L(ir_idx)),
07821 exp_desc_l.type_idx,
07822 (char *)&CN_CONST(IR_IDX_R(ir_idx)),
07823 exp_desc_r.type_idx,
07824 folded_const,
07825 &type_idx,
07826 line,
07827 col,
07828 2,
07829 IR_OPR(ir_idx))) {
07830
07831 exp_desc->type_idx = type_idx;
07832 OPND_FLD((*result_opnd)) = CN_Tbl_Idx;
07833 OPND_IDX((*result_opnd)) = ntr_const_tbl(exp_desc->type_idx,
07834 FALSE,
07835 folded_const);
07836
07837 exp_desc->linear_type = TYP_LINEAR(exp_desc->type_idx);
07838 OPND_LINE_NUM((*result_opnd)) = line;
07839 OPND_COL_NUM((*result_opnd)) = col;
07840 }
07841 else {
07842 ok = FALSE;
07843 }
07844 }
07845 else if (exp_desc_l.type == Character &&
07846 exp_desc_r.type == Character &&
07847 exp_desc_l.char_len.fld == CN_Tbl_Idx &&
07848 CN_INT_TO_C(exp_desc_l.char_len.idx) == 0 &&
07849 exp_desc_r.char_len.fld == CN_Tbl_Idx &&
07850 CN_INT_TO_C(exp_desc_r.char_len.idx) == 0) {
07851
07852
07853
07854 if (IR_OPR(ir_idx) == Ge_Opr || IR_OPR(ir_idx) == Le_Opr) {
07855
07856
07857
07858 OPND_IDX((*result_opnd)) = set_up_logical_constant(folded_const,
07859 exp_desc->type_idx,
07860 TRUE_VALUE,
07861 TRUE);
07862 }
07863 else {
07864 OPND_IDX((*result_opnd)) = set_up_logical_constant(folded_const,
07865 exp_desc->type_idx,
07866 FALSE_VALUE,
07867 TRUE);
07868 }
07869
07870 OPND_FLD((*result_opnd)) = CN_Tbl_Idx;
07871 OPND_LINE_NUM((*result_opnd)) = line;
07872 OPND_COL_NUM((*result_opnd)) = col;
07873
07874 if (exp_desc->rank) {
07875 make_logical_array_tmp(result_opnd,
07876 exp_desc);
07877 }
07878 }
07879 }
07880 else if (resolve_ext_opr(result_opnd, TRUE, save_in_call_list,
07881 (exp_desc->linear_type == Err_Res),
07882 &ok,
07883 &exp_desc_l, &exp_desc_r)) {
07884
07885 (*exp_desc) = exp_desc_l;
07886
07887 goto EXIT;
07888 }
07889 else {
07890 ok = FALSE;
07891 }
07892
07893 IR_TYPE_IDX(ir_idx) = exp_desc->type_idx;
07894 IR_RANK(ir_idx) = exp_desc->rank;
07895
07896 if (IR_RANK(ir_idx)) {
07897 IR_ARRAY_SYNTAX(ir_idx) = TRUE;
07898 }
07899
07900 EXIT:
07901
07902 TRACE (Func_Exit, "lt_opr_handler", NULL);
07903
07904 return(ok);
07905
07906 }
07907
07908
07909
07910
07911
07912
07913
07914
07915
07916
07917
07918
07919
07920
07921
07922
07923
07924 static boolean not_opr_handler(opnd_type *result_opnd,
07925 expr_arg_type *exp_desc)
07926
07927 {
07928 int col;
07929 expr_arg_type exp_desc_l;
07930 expr_arg_type exp_desc_r;
07931 long_type folded_const[MAX_WORDS_FOR_NUMERIC];
07932 int ir_idx;
07933 int line;
07934 boolean ok = TRUE;
07935 opnd_type opnd;
07936 int opnd_col;
07937 int opnd_line;
07938 boolean save_in_call_list;
07939 int type_idx;
07940
07941
07942 TRACE (Func_Entry, "not_opr_handler" , NULL);
07943
07944 ir_idx = OPND_IDX((*result_opnd));
07945 line = IR_LINE_NUM(ir_idx);
07946 col = IR_COL_NUM(ir_idx);
07947 save_in_call_list = in_call_list;
07948 in_call_list = FALSE;
07949
07950 COPY_OPND(opnd, IR_OPND_L(ir_idx));
07951 exp_desc_l.rank = 0;
07952 ok = expr_sem(&opnd, &exp_desc_l);
07953 COPY_OPND(IR_OPND_L(ir_idx), opnd);
07954
07955 if (!ok) {
07956 goto EXIT;
07957 }
07958
07959 exp_desc->has_constructor = exp_desc_l.has_constructor;
07960
07961 exp_desc->has_symbolic = exp_desc_l.has_symbolic;
07962
07963 exp_desc->linear_type = NOT_TYPE(exp_desc_l.linear_type);
07964
07965 if (exp_desc->linear_type != Err_Res) {
07966
07967 if (NOT_EXTN(exp_desc_l.linear_type)) {
07968
07969 if (resolve_ext_opr(result_opnd, FALSE, save_in_call_list,
07970 FALSE,
07971 &ok,
07972 &exp_desc_l, &exp_desc_r)) {
07973
07974 (*exp_desc) = exp_desc_l;
07975
07976 goto EXIT;
07977 }
07978 else {
07979
07980 IR_OPR(ir_idx) = Bnot_Opr;
07981 PRINTMSG(IR_LINE_NUM(ir_idx), 395, Ansi,
07982 IR_COL_NUM(ir_idx));
07983
07984 if (exp_desc_l.type == Character ||
07985 exp_desc_l.linear_type == Short_Typeless_Const) {
07986
07987 find_opnd_line_and_column((opnd_type *)
07988 &IR_OPND_L(ir_idx),
07989 &opnd_line,
07990 &opnd_col);
07991
07992 if (exp_desc_l.type == Character) {
07993 PRINTMSG(opnd_line, 161, Ansi, opnd_col);
07994 }
07995
07996 IR_IDX_L(ir_idx) = cast_typeless_constant(IR_IDX_L(ir_idx),
07997 exp_desc->linear_type,
07998 opnd_line,
07999 opnd_col);
08000
08001 exp_desc_l.type_idx = exp_desc->linear_type;
08002 exp_desc_l.type = TYP_TYPE(exp_desc->linear_type);
08003 exp_desc_l.linear_type = exp_desc->linear_type;
08004
08005
08006 exp_desc->linear_type = NOT_TYPE(exp_desc_l.linear_type);
08007 }
08008 }
08009 }
08010
08011 exp_desc->type_idx = exp_desc->linear_type;
08012 exp_desc->type = TYP_TYPE(exp_desc->type_idx);
08013 exp_desc->rank = exp_desc_l.rank;
08014 exp_desc->constant = exp_desc_l.constant;
08015 exp_desc->foldable = exp_desc_l.foldable;
08016 exp_desc->will_fold_later = exp_desc_l.will_fold_later;
08017
08018 COPY_SHAPE(exp_desc->shape,exp_desc_l.shape,exp_desc_l.rank);
08019
08020 if (opt_flags.ieeeconform &&
08021 ! comp_gen_expr &&
08022 (exp_desc_l.type == Real ||
08023 exp_desc_l.type == Complex)) {
08024
08025
08026
08027 exp_desc->foldable = FALSE;
08028 exp_desc->will_fold_later = FALSE;
08029 }
08030 else if (exp_desc_l.foldable &&
08031 IR_FLD_L(ir_idx) == CN_Tbl_Idx) {
08032
08033 type_idx = exp_desc->type_idx;
08034
08035 if (folder_driver((char *)&CN_CONST(IR_IDX_L(ir_idx)),
08036 exp_desc_l.type_idx,
08037 NULL,
08038 NULL_IDX,
08039 folded_const,
08040 &type_idx,
08041 line,
08042 col,
08043 1,
08044 IR_OPR(ir_idx))) {
08045
08046 exp_desc->type_idx = type_idx;
08047 OPND_FLD((*result_opnd)) = CN_Tbl_Idx;
08048 OPND_IDX((*result_opnd)) = ntr_const_tbl(exp_desc->type_idx,
08049 FALSE,
08050 folded_const);
08051
08052 OPND_LINE_NUM((*result_opnd)) = line;
08053 OPND_COL_NUM((*result_opnd)) = col;
08054 }
08055 else {
08056 ok = FALSE;
08057 }
08058 }
08059 }
08060 else if (resolve_ext_opr(result_opnd, TRUE, save_in_call_list,
08061 (exp_desc->linear_type == Err_Res),
08062 &ok,
08063 &exp_desc_l, &exp_desc_r)) {
08064
08065 (*exp_desc) = exp_desc_l;
08066
08067 goto EXIT;
08068 }
08069 else {
08070 ok = FALSE;
08071 }
08072
08073 IR_TYPE_IDX(ir_idx) = exp_desc->type_idx;
08074 IR_RANK(ir_idx) = exp_desc->rank;
08075
08076 if (IR_RANK(ir_idx)) {
08077 IR_ARRAY_SYNTAX(ir_idx) = TRUE;
08078 }
08079
08080 EXIT:
08081
08082 TRACE (Func_Exit, "not_opr_handler", NULL);
08083
08084 return(ok);
08085
08086 }
08087
08088
08089
08090
08091
08092
08093
08094
08095
08096
08097
08098
08099
08100
08101
08102
08103
08104 static boolean and_opr_handler(opnd_type *result_opnd,
08105 expr_arg_type *exp_desc)
08106
08107 {
08108 int col;
08109 expr_arg_type exp_desc_l;
08110 expr_arg_type exp_desc_r;
08111 long_type folded_const[MAX_WORDS_FOR_NUMERIC];
08112 int ir_idx;
08113 int line;
08114 boolean ok = TRUE;
08115 opnd_type opnd;
08116 int opnd_col;
08117 int opnd_line;
08118 # if defined(_HIGH_LEVEL_IF_FORM)
08119 # ifdef KEY
08120 boolean save_has_present_opr = FALSE;
08121 # else
08122 boolean save_has_present_opr;
08123 # endif
08124 # endif
08125 boolean save_in_call_list;
08126 #ifdef KEY
08127 int save_number_of_functions = 0;
08128 int save_number_of_functions_l = 0;
08129 #else
08130 int save_number_of_functions;
08131 int save_number_of_functions_l;
08132 #endif
08133 int type_idx;
08134
08135
08136 TRACE (Func_Entry, "and_opr_handler" , NULL);
08137
08138 ir_idx = OPND_IDX((*result_opnd));
08139 line = IR_LINE_NUM(ir_idx);
08140 col = IR_COL_NUM(ir_idx);
08141 save_in_call_list = in_call_list;
08142 in_call_list = FALSE;
08143
08144 # if defined(_HIGH_LEVEL_IF_FORM)
08145 if (in_branch_true) {
08146 if (opt_flags.short_circuit_lvl == Short_Circuit_Present) {
08147 save_has_present_opr = has_present_opr;
08148 has_present_opr = FALSE;
08149 }
08150 else if (opt_flags.short_circuit_lvl == Short_Circuit_Functions) {
08151 save_number_of_functions = number_of_functions;
08152 number_of_functions = 0;
08153 }
08154 }
08155 # else
08156 if (in_branch_true) {
08157 save_number_of_functions = number_of_functions;
08158 number_of_functions = 0;
08159 }
08160 # endif
08161
08162 COPY_OPND(opnd, IR_OPND_L(ir_idx));
08163 exp_desc_l.rank = 0;
08164 ok = expr_sem(&opnd, &exp_desc_l);
08165 COPY_OPND(IR_OPND_L(ir_idx), opnd);
08166
08167 # if defined(_HIGH_LEVEL_IF_FORM)
08168 if (in_branch_true) {
08169 if (opt_flags.short_circuit_lvl == Short_Circuit_Present) {
08170 save_has_present_opr |= has_present_opr;
08171 IR_SHORT_CIRCUIT_L(ir_idx) = has_present_opr;
08172 has_present_opr = FALSE;
08173 }
08174 else if (opt_flags.short_circuit_lvl == Short_Circuit_Functions) {
08175 save_number_of_functions_l = number_of_functions;
08176 number_of_functions = 0;
08177 }
08178 }
08179 # else
08180 if (in_branch_true) {
08181 save_number_of_functions_l = number_of_functions;
08182 number_of_functions = 0;
08183 }
08184 # endif
08185
08186 COPY_OPND(opnd, IR_OPND_R(ir_idx));
08187 exp_desc_r.rank = 0;
08188 ok &= expr_sem(&opnd, &exp_desc_r);
08189 COPY_OPND(IR_OPND_R(ir_idx), opnd);
08190
08191 # if defined(_HIGH_LEVEL_IF_FORM)
08192 if (in_branch_true) {
08193 if (opt_flags.short_circuit_lvl == Short_Circuit_Present) {
08194 save_has_present_opr |= has_present_opr;
08195 IR_SHORT_CIRCUIT_R(ir_idx) = has_present_opr;
08196 has_present_opr = save_has_present_opr;
08197 }
08198 else if (opt_flags.short_circuit_lvl == Short_Circuit_Functions) {
08199
08200 if (save_number_of_functions_l == number_of_functions &&
08201 number_of_functions == 0) {
08202
08203 IR_SHORT_CIRCUIT_L(ir_idx) = FALSE;
08204 IR_SHORT_CIRCUIT_R(ir_idx) = FALSE;
08205 }
08206 else if (save_number_of_functions_l <= number_of_functions) {
08207 IR_SHORT_CIRCUIT_R(ir_idx) = TRUE;
08208 IR_SHORT_CIRCUIT_L(ir_idx) = FALSE;
08209 }
08210 else {
08211 IR_SHORT_CIRCUIT_L(ir_idx) = TRUE;
08212 IR_SHORT_CIRCUIT_R(ir_idx) = FALSE;
08213 }
08214
08215 number_of_functions += save_number_of_functions_l +
08216 save_number_of_functions;
08217 }
08218 }
08219 # else
08220 if (in_branch_true) {
08221
08222 if (save_number_of_functions_l == number_of_functions &&
08223 number_of_functions == 0) {
08224
08225 IR_SHORT_CIRCUIT_L(ir_idx) = FALSE;
08226 IR_SHORT_CIRCUIT_R(ir_idx) = FALSE;
08227 }
08228 else if (save_number_of_functions_l <= number_of_functions) {
08229 IR_SHORT_CIRCUIT_R(ir_idx) = TRUE;
08230 IR_SHORT_CIRCUIT_L(ir_idx) = FALSE;
08231 }
08232 else {
08233 IR_SHORT_CIRCUIT_L(ir_idx) = TRUE;
08234 IR_SHORT_CIRCUIT_R(ir_idx) = FALSE;
08235 }
08236
08237 number_of_functions += save_number_of_functions_l +
08238 save_number_of_functions;
08239 }
08240 # endif
08241
08242 if (!ok) {
08243 goto EXIT;
08244 }
08245
08246 exp_desc->has_constructor = exp_desc_l.has_constructor ||
08247 exp_desc_r.has_constructor;
08248
08249 exp_desc->has_symbolic = exp_desc_l.has_symbolic || exp_desc_r.has_symbolic;
08250
08251 exp_desc->linear_type = AND_OR_TYPE(exp_desc_l.linear_type,
08252 exp_desc_r.linear_type);
08253
08254 if (exp_desc->linear_type != Err_Res &&
08255 (exp_desc_l.rank == exp_desc_r.rank ||
08256 exp_desc_l.rank * exp_desc_r.rank == 0)) {
08257
08258 if (AND_OR_EXTN(exp_desc_l.linear_type,
08259 exp_desc_r.linear_type)) {
08260
08261 if (resolve_ext_opr(result_opnd, FALSE, save_in_call_list,
08262 FALSE,
08263 &ok,
08264 &exp_desc_l, &exp_desc_r)) {
08265
08266 (*exp_desc) = exp_desc_l;
08267
08268 goto EXIT;
08269 }
08270 else {
08271
08272
08273 switch (IR_OPR(ir_idx)) {
08274 case And_Opr :
08275 IR_OPR(ir_idx) = Band_Opr;
08276 break;
08277 case Or_Opr :
08278 IR_OPR(ir_idx) = Bor_Opr;
08279 break;
08280 case Eqv_Opr :
08281 IR_OPR(ir_idx) = Beqv_Opr;
08282 break;
08283 case Neqv_Opr :
08284 IR_OPR(ir_idx) = Bneqv_Opr;
08285 break;
08286 }
08287 PRINTMSG(IR_LINE_NUM(ir_idx), 395, Ansi,
08288 IR_COL_NUM(ir_idx));
08289
08290 if (exp_desc_l.type == Character ||
08291 exp_desc_l.linear_type == Short_Typeless_Const) {
08292
08293 find_opnd_line_and_column((opnd_type *)
08294 &IR_OPND_L(ir_idx),
08295 &opnd_line,
08296 &opnd_col);
08297
08298 if (exp_desc_l.type == Character) {
08299 PRINTMSG(opnd_line, 161, Ansi, opnd_col);
08300 }
08301
08302 type_idx = exp_desc_r.type_idx;
08303
08304 if (exp_desc_r.type == Character ||
08305 exp_desc_r.type == Typeless) {
08306 type_idx = INTEGER_DEFAULT_TYPE;
08307 }
08308
08309 IR_IDX_L(ir_idx) = cast_typeless_constant(IR_IDX_L(ir_idx),
08310 type_idx,
08311 opnd_line,
08312 opnd_col);
08313
08314 exp_desc_l.type_idx = type_idx;
08315 exp_desc_l.type = TYP_TYPE(type_idx);
08316 exp_desc_l.linear_type = TYP_LINEAR(type_idx);
08317 }
08318
08319 if (exp_desc_r.type == Character ||
08320 exp_desc_r.linear_type == Short_Typeless_Const) {
08321
08322 find_opnd_line_and_column((opnd_type *)
08323 &IR_OPND_R(ir_idx),
08324 &opnd_line,
08325 &opnd_col);
08326
08327 if (exp_desc_r.type == Character) {
08328 PRINTMSG(opnd_line, 161, Ansi, opnd_col);
08329 }
08330
08331
08332 type_idx = exp_desc_l.type_idx;
08333
08334 if (exp_desc_l.type == Character ||
08335 exp_desc_l.type == Typeless) {
08336 type_idx = INTEGER_DEFAULT_TYPE;
08337 }
08338
08339 IR_IDX_R(ir_idx) = cast_typeless_constant(IR_IDX_R(ir_idx),
08340 type_idx,
08341 opnd_line,
08342 opnd_col);
08343
08344 exp_desc_r.type_idx = type_idx;
08345 exp_desc_r.type = TYP_TYPE(type_idx);
08346 exp_desc_r.linear_type = TYP_LINEAR(type_idx);
08347 }
08348
08349
08350 exp_desc->linear_type = AND_OR_TYPE(exp_desc_l.linear_type,
08351 exp_desc_r.linear_type);
08352
08353 if (num_host_wds[exp_desc_l.linear_type] !=
08354 num_host_wds[exp_desc_r.linear_type]) {
08355
08356 PRINTMSG(IR_LINE_NUM(ir_idx),
08357 1188,
08358 Error,
08359 IR_COL_NUM(ir_idx));
08360 ok = FALSE;
08361 }
08362 }
08363 }
08364
08365 exp_desc->type_idx = exp_desc->linear_type;
08366 exp_desc->type = TYP_TYPE(exp_desc->type_idx);
08367
08368 if (! bin_array_syntax_check(&exp_desc_l, &exp_desc_r,
08369 exp_desc, line, col)) {
08370 ok = FALSE;
08371 }
08372
08373 exp_desc->constant = exp_desc_l.constant && exp_desc_r.constant;
08374 exp_desc->foldable = exp_desc_l.foldable && exp_desc_r.foldable;
08375
08376 exp_desc->will_fold_later = (exp_desc_l.will_fold_later &
08377 exp_desc_r.will_fold_later) |
08378 (exp_desc_l.will_fold_later &
08379 exp_desc_r.foldable) |
08380 (exp_desc_l.foldable &
08381 exp_desc_r.will_fold_later);
08382
08383
08384 if (opt_flags.ieeeconform &&
08385 ! comp_gen_expr &&
08386 (exp_desc_l.type == Real ||
08387 exp_desc_l.type == Complex ||
08388 exp_desc_r.type == Real ||
08389 exp_desc_r.type == Complex)) {
08390
08391
08392
08393 exp_desc->foldable = FALSE;
08394 exp_desc->will_fold_later = FALSE;
08395 }
08396 else if (exp_desc->foldable &&
08397 ok &&
08398 IR_FLD_L(ir_idx) == CN_Tbl_Idx &&
08399 IR_FLD_R(ir_idx) == CN_Tbl_Idx) {
08400
08401 type_idx = exp_desc->type_idx;
08402
08403 if (folder_driver((char *)&CN_CONST(IR_IDX_L(ir_idx)),
08404 exp_desc_l.type_idx,
08405 (char *)&CN_CONST(IR_IDX_R(ir_idx)),
08406 exp_desc_r.type_idx,
08407 folded_const,
08408 &type_idx,
08409 line,
08410 col,
08411 2,
08412 IR_OPR(ir_idx))) {
08413
08414 exp_desc->type_idx = type_idx;
08415 OPND_FLD((*result_opnd)) = CN_Tbl_Idx;
08416 OPND_IDX((*result_opnd)) = ntr_const_tbl(exp_desc->type_idx,
08417 FALSE,
08418 folded_const);
08419
08420 OPND_LINE_NUM((*result_opnd)) = line;
08421 OPND_COL_NUM((*result_opnd)) = col;
08422 }
08423 else {
08424 ok = FALSE;
08425 }
08426 }
08427 }
08428 else if (resolve_ext_opr(result_opnd, TRUE, save_in_call_list,
08429 (exp_desc->linear_type == Err_Res),
08430 &ok,
08431 &exp_desc_l, &exp_desc_r)) {
08432
08433 (*exp_desc) = exp_desc_l;
08434
08435 goto EXIT;
08436 }
08437 else {
08438 ok = FALSE;
08439 }
08440
08441 IR_TYPE_IDX(ir_idx) = exp_desc->type_idx;
08442 IR_RANK(ir_idx) = exp_desc->rank;
08443
08444 if (IR_RANK(ir_idx)) {
08445 IR_ARRAY_SYNTAX(ir_idx) = TRUE;
08446 }
08447
08448 EXIT:
08449
08450 TRACE (Func_Exit, "and_opr_handler", NULL);
08451
08452 return(ok);
08453
08454 }
08455
08456
08457
08458
08459
08460
08461
08462
08463
08464
08465
08466
08467
08468
08469
08470
08471
08472 static boolean defined_un_opr_handler(opnd_type *result_opnd,
08473 expr_arg_type *exp_desc)
08474
08475 {
08476 int attr_idx;
08477 expr_arg_type exp_desc_l;
08478 expr_arg_type exp_desc_r;
08479 int ir_idx;
08480 boolean ok = TRUE;
08481 opnd_type opnd;
08482 boolean save_in_call_list;
08483
08484
08485 TRACE (Func_Entry, "defined_un_opr_handler" , NULL);
08486
08487 ir_idx = OPND_IDX((*result_opnd));
08488 save_in_call_list = in_call_list;
08489 in_call_list = FALSE;
08490
08491
08492
08493 attr_idx = IR_IDX_L(ir_idx);
08494 AT_LOCKED_IN(attr_idx) = TRUE;
08495
08496 while (AT_ATTR_LINK(attr_idx) &&
08497 ! AT_IGNORE_ATTR_LINK(attr_idx)) {
08498
08499 attr_idx = AT_ATTR_LINK(attr_idx);
08500 AT_LOCKED_IN(attr_idx) = TRUE;
08501 }
08502
08503 IR_IDX_L(ir_idx) = attr_idx;
08504
08505 COPY_OPND(opnd, IR_OPND_R(ir_idx));
08506 exp_desc_l.rank = 0;
08507 ok = expr_sem(&opnd, &exp_desc_l);
08508 COPY_OPND(IR_OPND_R(ir_idx), opnd);
08509
08510 exp_desc->has_symbolic = exp_desc_l.has_symbolic;
08511
08512
08513 if (resolve_ext_opr(result_opnd, TRUE, save_in_call_list,
08514 FALSE,
08515 &ok,
08516 &exp_desc_l, &exp_desc_r)) {
08517
08518 (*exp_desc) = exp_desc_l;
08519 }
08520 else {
08521 ok = FALSE;
08522 }
08523
08524 TRACE (Func_Exit, "defined_un_opr_handler", NULL);
08525
08526 return(ok);
08527
08528 }
08529
08530
08531
08532
08533
08534
08535
08536
08537
08538
08539
08540
08541
08542
08543
08544
08545
08546 static boolean defined_bin_opr_handler(opnd_type *result_opnd,
08547 expr_arg_type *exp_desc)
08548
08549 {
08550 int attr_idx;
08551 expr_arg_type exp_desc_l;
08552 expr_arg_type exp_desc_r;
08553 int ir_idx;
08554 boolean ok = TRUE;
08555 opnd_type opnd;
08556 boolean save_in_call_list;
08557
08558
08559 TRACE (Func_Entry, "defined_bin_opr_handler" , NULL);
08560
08561 ir_idx = OPND_IDX((*result_opnd));
08562 save_in_call_list = in_call_list;
08563 in_call_list = FALSE;
08564
08565
08566
08567 attr_idx = IR_IDX_L(ir_idx);
08568 AT_LOCKED_IN(attr_idx) = TRUE;
08569
08570 while (AT_ATTR_LINK(attr_idx) &&
08571 ! AT_IGNORE_ATTR_LINK(attr_idx)) {
08572
08573 attr_idx = AT_ATTR_LINK(attr_idx);
08574 AT_LOCKED_IN(attr_idx) = TRUE;
08575 }
08576
08577 IR_IDX_L(ir_idx) = attr_idx;
08578
08579 COPY_OPND(opnd, IL_OPND(IR_IDX_R(ir_idx)));
08580 exp_desc_l.rank = 0;
08581 ok = expr_sem(&opnd, &exp_desc_l);
08582 COPY_OPND(IL_OPND(IR_IDX_R(ir_idx)), opnd);
08583
08584 COPY_OPND(opnd, IL_OPND(IL_NEXT_LIST_IDX(IR_IDX_R(ir_idx))));
08585 exp_desc_r.rank = 0;
08586 ok &= expr_sem(&opnd, &exp_desc_r);
08587 COPY_OPND(IL_OPND(IL_NEXT_LIST_IDX(IR_IDX_R(ir_idx))), opnd);
08588
08589
08590 if (resolve_ext_opr(result_opnd, TRUE, save_in_call_list,
08591 FALSE,
08592 &ok,
08593 &exp_desc_l, &exp_desc_r)) {
08594
08595 (*exp_desc) = exp_desc_l;
08596 }
08597 else {
08598 ok = FALSE;
08599 }
08600
08601
08602 exp_desc->has_symbolic = exp_desc_l.has_symbolic || exp_desc_r.has_symbolic;
08603
08604 TRACE (Func_Exit, "defined_bin_opr_handler", NULL);
08605
08606 return(ok);
08607
08608 }
08609
08610
08611
08612
08613
08614
08615
08616
08617
08618
08619
08620
08621
08622
08623
08624
08625
08626 static boolean max_opr_handler(opnd_type *result_opnd,
08627 expr_arg_type *exp_desc)
08628
08629 {
08630 #ifdef KEY
08631 int comp_idx = 0;
08632 #else
08633 int comp_idx;
08634 #endif
08635 expr_arg_type exp_desc_l;
08636 int ir_idx;
08637 int list_idx;
08638 boolean ok = TRUE;
08639 opnd_type opnd;
08640 boolean save_in_call_list;
08641
08642
08643 TRACE (Func_Entry, "max_opr_handler" , NULL);
08644
08645 ir_idx = OPND_IDX((*result_opnd));
08646 save_in_call_list = in_call_list;
08647 in_call_list = FALSE;
08648
08649
08650
08651 list_idx = IR_IDX_L(ir_idx);
08652
08653 COPY_OPND(opnd, IL_OPND(list_idx));
08654 exp_desc_l.rank = 0;
08655 ok = expr_sem(&opnd, &exp_desc_l);
08656 COPY_OPND(IL_OPND(list_idx), opnd);
08657
08658
08659
08660 exp_desc->has_symbolic = exp_desc_l.has_symbolic;
08661 exp_desc->constant = exp_desc_l.constant;
08662 exp_desc->foldable = exp_desc_l.foldable;
08663 exp_desc->will_fold_later = exp_desc_l.will_fold_later;
08664
08665 if (exp_desc_l.type == Typeless) {
08666 exp_desc->type = Integer;
08667 exp_desc->linear_type = CG_INTEGER_DEFAULT_TYPE;
08668 exp_desc->type_idx = CG_INTEGER_DEFAULT_TYPE;
08669 }
08670 else {
08671 exp_desc->type = exp_desc_l.type;
08672 exp_desc->linear_type = exp_desc_l.linear_type;
08673 exp_desc->type_idx = exp_desc_l.type_idx;
08674 }
08675
08676 if (exp_desc->foldable) {
08677 comp_idx = IL_IDX(list_idx);
08678 }
08679
08680 list_idx = IL_NEXT_LIST_IDX(list_idx);
08681
08682 while (list_idx != NULL_IDX) {
08683 COPY_OPND(opnd, IL_OPND(list_idx));
08684 exp_desc_l.rank = 0;
08685 ok &= expr_sem(&opnd, &exp_desc_l);
08686 COPY_OPND(IL_OPND(list_idx), opnd);
08687
08688 exp_desc->has_symbolic = exp_desc->has_symbolic ||
08689 exp_desc_l.has_symbolic;
08690 exp_desc->constant = exp_desc->constant && exp_desc_l.constant;
08691 exp_desc->foldable = exp_desc->foldable && exp_desc_l.foldable;
08692
08693 exp_desc->will_fold_later = exp_desc->will_fold_later &&
08694 (exp_desc_l.will_fold_later ||
08695 exp_desc_l.foldable);
08696
08697 if (exp_desc->foldable) {
08698 if (fold_relationals(IL_IDX(list_idx),
08699 comp_idx,
08700 (IR_OPR(ir_idx) == Max_Opr ?
08701 Gt_Opr : Lt_Opr))) {
08702
08703 comp_idx = IL_IDX(list_idx);
08704 }
08705 }
08706
08707 list_idx = IL_NEXT_LIST_IDX(list_idx);
08708 }
08709
08710 if (exp_desc->foldable) {
08711 OPND_FLD((*result_opnd)) = CN_Tbl_Idx;
08712 OPND_IDX((*result_opnd)) = comp_idx;
08713 OPND_LINE_NUM((*result_opnd)) = IR_LINE_NUM(ir_idx);
08714 OPND_COL_NUM((*result_opnd)) = IR_COL_NUM(ir_idx);
08715 exp_desc->type_idx = CN_TYPE_IDX(comp_idx);
08716 exp_desc->type = TYP_TYPE(exp_desc->type_idx);
08717 exp_desc->linear_type = TYP_LINEAR(exp_desc->type_idx);
08718 }
08719
08720
08721 TRACE (Func_Exit, "max_opr_handler", NULL);
08722
08723 return(ok);
08724
08725 }
08726
08727
08728
08729
08730
08731
08732
08733
08734
08735
08736
08737
08738
08739
08740
08741
08742
08743 static boolean struct_opr_handler(opnd_type *result_opnd,
08744 expr_arg_type *exp_desc,
08745 int rank_in)
08746
08747 {
08748 expr_arg_type exp_desc_l;
08749 expr_arg_type exp_desc_r;
08750 boolean final_component = FALSE;
08751 int ir_idx;
08752 boolean ok = TRUE;
08753 opnd_type opnd;
08754 boolean save_in_call_list;
08755 boolean save_insert_subs_ok;
08756
08757 # ifdef _TARGET_OS_MAX
08758 int col;
08759 int line;
08760 # endif
08761
08762 TRACE (Func_Entry, "struct_opr_handler" , NULL);
08763
08764 ir_idx = OPND_IDX((*result_opnd));
08765 # ifdef _TARGET_OS_MAX
08766 col = IR_COL_NUM(ir_idx);
08767 col = IR_LINE_NUM(ir_idx);
08768 # endif
08769 save_in_call_list = in_call_list;
08770 in_call_list = FALSE;
08771
08772 if (! in_component_ref) {
08773 final_component = TRUE;
08774 in_component_ref = TRUE;
08775 }
08776
08777 save_insert_subs_ok = insert_subs_ok;
08778
08779 insert_subs_ok = TRUE;
08780
08781 exp_desc_l.rank = rank_in;
08782
08783 COPY_OPND(opnd, IR_OPND_L(ir_idx));
08784 ok = expr_sem(&opnd, &exp_desc_l);
08785 COPY_OPND(IR_OPND_L(ir_idx), opnd);
08786 #ifdef KEY
08787
08788
08789
08790
08791 if (exp_desc_l.constant && exp_desc_l.pointer) {
08792 int line_tmp, col_tmp;
08793 find_opnd_line_and_column(&IR_OPND_L(ir_idx), &line_tmp, &col_tmp);
08794 PRINTMSG(line_tmp, 1677, Error, col_tmp);
08795 ok = FALSE;
08796 }
08797 #endif
08798
08799 if (OPND_FLD(opnd) == IR_Tbl_Idx &&
08800 (IR_OPR(OPND_IDX(opnd)) == Substring_Opr ||
08801 IR_OPR(OPND_IDX(opnd)) == Whole_Substring_Opr)) {
08802
08803
08804
08805
08806
08807
08808 COPY_OPND(IR_OPND_L(ir_idx), IR_OPND_L(OPND_IDX(opnd)));
08809 }
08810
08811 in_call_list = save_in_call_list;
08812
08813 exp_desc_r.rank = exp_desc_l.rank;
08814
08815 insert_subs_ok = FALSE;
08816
08817 #ifdef KEY
08818 if ( IR_OPR(ir_idx) == Struct_Opr &&
08819 IR_FLD_L(ir_idx) == AT_Tbl_Idx &&
08820 AT_OBJ_CLASS(IR_OPND_L(ir_idx).idx) == Data_Obj ){
08821 int attr_idx = TYP_IDX(ATD_TYPE_IDX(IR_OPND_L(ir_idx).idx));
08822 if (AT_OBJ_CLASS(attr_idx) == Derived_Type) {
08823 int first_idx = ATT_FIRST_CPNT_IDX(attr_idx);
08824 if (first_idx != NULL_IDX) {
08825 for (int i = first_idx; i != NULL_IDX; i = SN_SIBLING_LINK(i)) {
08826 if (AT_OBJ_CLASS(SN_ATTR_IDX(i)) == Data_Obj &&
08827 ATD_CLASS(SN_ATTR_IDX(i)) == Struct_Component &&
08828 SN_ATTR_IDX(i) != IR_OPND_R(ir_idx).idx &&
08829 strcmp(AT_OBJ_NAME_PTR(IR_OPND_R(ir_idx).idx),&name_pool[SN_NAME_IDX(i)].name_char)==0)
08830 IR_OPND_R(ir_idx).idx = SN_ATTR_IDX(i);
08831 }
08832 }
08833 }
08834 }
08835 #endif
08836
08837 COPY_OPND(opnd, IR_OPND_R(ir_idx));
08838 ok &= expr_sem(&opnd, &exp_desc_r);
08839 COPY_OPND(IR_OPND_R(ir_idx), opnd);
08840
08841 insert_subs_ok = save_insert_subs_ok;
08842
08843 exp_desc->has_constructor = exp_desc_l.has_constructor ||
08844 exp_desc_r.has_constructor;
08845
08846 exp_desc->has_symbolic = exp_desc_l.has_symbolic || exp_desc_r.has_symbolic;
08847
08848 if (final_component) {
08849 in_component_ref = FALSE;
08850
08851 if ((cif_flags & XREF_RECS) != 0 &&
08852 xref_state != CIF_No_Usage_Rec) {
08853
08854 if (in_call_list) {
08855
08856 cif_usage_rec(ir_idx, IR_Tbl_Idx, IR_LINE_NUM(ir_idx),
08857 IR_COL_NUM(ir_idx),
08858 CIF_Symbol_Is_Actual_Arg);
08859 }
08860 else {
08861
08862 cif_usage_rec(ir_idx, IR_Tbl_Idx, IR_LINE_NUM(ir_idx),
08863 IR_COL_NUM(ir_idx),
08864 xref_state);
08865 }
08866 }
08867 }
08868
08869 if (insert_subs_ok) {
08870
08871 if (exp_desc_l.rank > exp_desc_r.rank) {
08872 exp_desc->rank = exp_desc_l.rank;
08873 COPY_SHAPE(exp_desc->shape,exp_desc_l.shape,
08874 exp_desc_l.rank);
08875 }
08876 else {
08877 exp_desc->rank = exp_desc_r.rank;
08878 COPY_SHAPE(exp_desc->shape,exp_desc_r.shape,
08879 exp_desc_r.rank);
08880 }
08881 }
08882 else {
08883 exp_desc->rank = exp_desc_l.rank;
08884 COPY_SHAPE(exp_desc->shape,exp_desc_l.shape, exp_desc_l.rank);
08885 }
08886
08887
08888 exp_desc->type = exp_desc_r.type;
08889 exp_desc->linear_type = exp_desc_r.linear_type;
08890 exp_desc->type_idx = exp_desc_r.type_idx;
08891 COPY_OPND(exp_desc->char_len, exp_desc_r.char_len);
08892 exp_desc->constant = exp_desc_l.constant;
08893 exp_desc->foldable = exp_desc_l.foldable;
08894 exp_desc->will_fold_later = exp_desc_l.will_fold_later;
08895
08896
08897
08898 exp_desc->pointer = exp_desc_r.pointer;
08899
08900
08901 exp_desc->target = exp_desc_l.target ||
08902 exp_desc_r.target ||
08903 exp_desc_l.pointer;
08904
08905 exp_desc->vector_subscript = exp_desc_l.vector_subscript;
08906 exp_desc->reference = exp_desc_l.reference;
08907 exp_desc->pe_dim_ref = exp_desc_l.pe_dim_ref;
08908 COPY_OPND((exp_desc->bias_opnd), (exp_desc_l.bias_opnd));
08909 exp_desc->component = TRUE;
08910
08911
08912
08913 exp_desc->section = (exp_desc_l.rank > 0);
08914 exp_desc->array_elt = exp_desc_l.array_elt;
08915 exp_desc->assumed_shape = exp_desc_l.assumed_shape;
08916 exp_desc->assumed_size = exp_desc_l.assumed_size;
08917 #ifdef KEY
08918 exp_desc->allocatable = exp_desc_r.allocatable;
08919 #endif
08920 exp_desc->contig_array = exp_desc_r.contig_array;
08921 exp_desc->dist_reshape_ref = exp_desc_l.dist_reshape_ref |
08922 exp_desc_r.dist_reshape_ref;
08923
08924 exp_desc->dope_vector = exp_desc_r.dope_vector;
08925
08926 if (exp_desc_r.dope_vector &&
08927 ! no_sub_or_deref) {
08928 COPY_OPND((*result_opnd), IR_OPND_R(ir_idx));
08929 COPY_OPND(IR_OPND_R(ir_idx),
08930 IR_OPND_L(OPND_IDX((*result_opnd))));
08931 IR_FLD_L(OPND_IDX((*result_opnd))) = IR_Tbl_Idx;
08932 IR_IDX_L(OPND_IDX((*result_opnd))) = ir_idx;
08933
08934 IR_TYPE_IDX(OPND_IDX((*result_opnd))) = exp_desc->type_idx;
08935
08936
08937
08938 IR_RANK(OPND_IDX((*result_opnd))) = exp_desc->rank;
08939 }
08940
08941 # if defined(_F_MINUS_MINUS)
08942 if (exp_desc->pe_dim_ref) {
08943
08944 # ifdef _TARGET_OS_MAX
08945 if (final_component &&
08946 storage_bit_size_tbl[exp_desc->linear_type] != 64) {
08947
08948 find_opnd_line_and_column(&IR_OPND_R(ir_idx), &line, &col);
08949 PRINTMSG(line, 1585, Error, col);
08950 ok = FALSE;
08951 }
08952 # endif
08953
08954 if (exp_desc_r.dope_vector) {
08955
08956 # ifdef _TARGET_OS_MAX
08957 translate_t3e_dv_component(result_opnd, exp_desc);
08958 # else
08959 translate_dv_component(result_opnd, exp_desc);
08960 # endif
08961 }
08962 }
08963 # endif
08964
08965 IR_TYPE_IDX(ir_idx) = exp_desc->type_idx;
08966 IR_RANK(ir_idx) = exp_desc->rank;
08967
08968 if (insert_subs_ok &&
08969 ! no_sub_or_deref) {
08970
08971 if (exp_desc_r.rank > 0 && exp_desc_l.rank > 0) {
08972
08973 PRINTMSG(IR_LINE_NUM_R(ir_idx), 127, Error,
08974 IR_COL_NUM_R(ir_idx));
08975 ok = FALSE;
08976 }
08977
08978 if (ATD_ARRAY_IDX(IR_IDX_R(ir_idx))) {
08979
08980 ok &= gen_whole_subscript(result_opnd, exp_desc);
08981 }
08982 else if (exp_desc->type == Character) {
08983 ok &= gen_whole_substring(result_opnd, exp_desc->rank);
08984 }
08985 }
08986
08987
08988 TRACE (Func_Exit, "struct_opr_handler", NULL);
08989
08990 return(ok);
08991
08992 }
08993 #ifdef KEY
08994
08995
08996
08997
08998
08999
09000
09001
09002
09003
09004
09005
09006
09007
09008
09009
09010
09011
09012
09013
09014
09015
09016
09017
09018
09019 static void
09020 help_ctor_array_to_allocatable(int line, int col, expr_arg_type *exp_desc_l,
09021 opnd_type *rvalue_opnd, expr_arg_type *exp_desc_r) {
09022 opnd_type tmp_opnd;
09023 boolean ok = TRUE;
09024
09025
09026
09027
09028 operator_type ir_opr = IR_OPR(OPND_IDX(*rvalue_opnd));
09029 if (ir_opr == Array_Construct_Opr || ir_opr == Constant_Array_Construct_Opr) {
09030 size_level_type constructor_size_level = Simple_Expr_Size;
09031 opnd_type size_opnd;
09032 analyse_loops(rvalue_opnd, &size_opnd, &constructor_size_level);
09033 expr_arg_type loc_exp_desc;
09034 if (!expr_semantics(&size_opnd, &loc_exp_desc)) {
09035 PRINTMSG(line, 1044, Internal, col, "help_ctor_array_to_allocatable");
09036 }
09037 COPY_OPND((exp_desc_r->shape[0]), size_opnd);
09038 }
09039
09040 boolean save_dfe = defer_stmt_expansion;
09041 defer_stmt_expansion = FALSE;
09042
09043
09044
09045 boolean need_tmp_for_rvalue = TRUE;
09046 switch (get_act_arg_type(exp_desc_r)) {
09047 case Array_Ptr:
09048 case Array_Tmp_Ptr:
09049 case Whole_Allocatable:
09050 case Whole_Tmp_Allocatable:
09051 case Whole_Sequence:
09052 case Whole_Tmp_Sequence:
09053 case Whole_Ass_Shape:
09054 case Whole_Array_Constant:
09055 case Sequence_Array_Section:
09056 case Constant_Array_Section:
09057 case Dv_Array_Section:
09058 case Contig_Section:
09059 case Dv_Contig_Section:
09060 need_tmp_for_rvalue = FALSE;
09061 }
09062
09063 boolean need_conversion = FALSE;
09064 if (exp_desc_l->linear_type != exp_desc_r->linear_type) {
09065 need_conversion = TRUE;
09066 need_tmp_for_rvalue = TRUE;
09067 }
09068
09069 int tmp_idx = NULL_IDX;
09070
09071 if (need_tmp_for_rvalue) {
09072 tmp_idx = create_tmp_asg(rvalue_opnd, exp_desc_r, &tmp_opnd, Intent_In,
09073 TRUE, FALSE);
09074
09075 if (need_conversion) {
09076 ATD_TYPE_IDX(tmp_idx) = exp_desc_l->type_idx;
09077 }
09078 }
09079
09080
09081 int tmp_dv_idx = gen_compiler_tmp(line, col, Priv, TRUE);
09082 ATD_NOT_PT_UNIQUE_MEM(tmp_dv_idx) = TRUE;
09083 if (need_tmp_for_rvalue) {
09084 ATD_NOT_PT_UNIQUE_MEM(tmp_idx) = TRUE;
09085 }
09086 else {
09087 ATD_NOT_PT_UNIQUE_MEM((find_left_attr(rvalue_opnd))) = TRUE;
09088 }
09089
09090 ATD_TYPE_IDX(tmp_dv_idx) = exp_desc_r->type_idx;
09091 ATD_STOR_BLK_IDX(tmp_dv_idx) = SCP_SB_STACK_IDX(curr_scp_idx);
09092 AT_SEMANTICS_DONE(tmp_dv_idx) = TRUE;
09093
09094 if (exp_desc_r->rank) {
09095
09096 ATD_ARRAY_IDX(tmp_dv_idx) = exp_desc_r->rank;
09097 }
09098 ATD_IM_A_DOPE(tmp_dv_idx) = TRUE;
09099
09100 if (need_tmp_for_rvalue) {
09101 opnd_type r_opnd;
09102 OPND_FLD(r_opnd) = AT_Tbl_Idx;
09103 OPND_IDX(r_opnd) = tmp_idx;
09104 OPND_LINE_NUM(r_opnd) = line;
09105 OPND_COL_NUM(r_opnd) = col;
09106
09107 if (TYP_TYPE(ATD_TYPE_IDX(tmp_idx)) == Character) {
09108 ok = gen_whole_substring(&r_opnd, exp_desc_r->rank) && ok;
09109 }
09110
09111 OPND_FLD(tmp_opnd) = AT_Tbl_Idx;
09112 OPND_IDX(tmp_opnd) = tmp_dv_idx;
09113 OPND_LINE_NUM(tmp_opnd) = line;
09114 OPND_COL_NUM(tmp_opnd) = col;
09115
09116 gen_dv_whole_def(&tmp_opnd, &r_opnd, exp_desc_r);
09117 }
09118 else {
09119 OPND_FLD(tmp_opnd) = AT_Tbl_Idx;
09120 OPND_IDX(tmp_opnd) = tmp_dv_idx;
09121 OPND_LINE_NUM(tmp_opnd) = line;
09122 OPND_COL_NUM(tmp_opnd) = col;
09123 gen_dv_whole_def(&tmp_opnd, rvalue_opnd, exp_desc_r);
09124 }
09125
09126 COPY_OPND(*rvalue_opnd, tmp_opnd);
09127
09128 defer_stmt_expansion = save_dfe;
09129 }
09130 #endif
09131
09132
09133
09134
09135
09136
09137
09138
09139
09140
09141
09142
09143
09144
09145
09146
09147
09148
09149 static boolean struct_construct_opr_handler(opnd_type *result_opnd,
09150 expr_arg_type *exp_desc)
09151
09152 {
09153 int col;
09154 int comp_idx;
09155 boolean depends_on_outer_impdo;
09156 expr_arg_type exp_desc_l;
09157 expr_arg_type exp_desc_r;
09158 int i;
09159 int ir_idx;
09160 int line;
09161 int list_idx;
09162 char l_err_word[40];
09163 boolean ok = TRUE;
09164 opnd_type opnd;
09165 opnd_type dv_opnd;
09166 int opnd_col;
09167 int opnd_line;
09168 char r_err_word[40];
09169 int save_constructor_level;
09170 boolean save_defer_stmt_expansion;
09171 boolean defer_stmt_expansion_save;
09172 expr_mode_type save_expr_mode;
09173 boolean save_in_call_list;
09174 boolean save_io_item_must_flatten;
09175 int sn_idx;
09176 boolean top_constructor = FALSE;
09177 int type_idx;
09178 int tmp_dv_idx;
09179
09180
09181 TRACE (Func_Entry, "struct_construct_opr_handler" , NULL);
09182
09183 ir_idx = OPND_IDX((*result_opnd));
09184 line = IR_LINE_NUM(ir_idx);
09185 col = IR_COL_NUM(ir_idx);
09186 save_io_item_must_flatten = io_item_must_flatten;
09187 save_in_call_list = in_call_list;
09188 in_call_list = FALSE;
09189
09190 save_expr_mode = expr_mode;
09191 expr_mode = Regular_Expr;
09192
09193 COPY_OPND(opnd, IR_OPND_L(ir_idx));
09194
09195 pgm_unit_illegal = FALSE;
09196 exp_desc_l.rank = 0;
09197 ok = expr_sem(&opnd, &exp_desc_l);
09198 pgm_unit_illegal = TRUE;
09199 expr_mode = save_expr_mode;
09200
09201 COPY_OPND(IR_OPND_L(ir_idx), opnd);
09202
09203 if (AT_OBJ_CLASS(OPND_IDX(opnd)) == Derived_Type) {
09204
09205
09206
09207
09208
09209
09210
09211 if (!ok) {
09212 goto EXIT;
09213 }
09214
09215 if (AT_USE_ASSOCIATED(OPND_IDX(opnd)) &&
09216 ATT_PRIVATE_CPNT(OPND_IDX(opnd))) {
09217 find_opnd_line_and_column(&opnd,
09218 &opnd_line,
09219 &opnd_col);
09220 PRINTMSG(opnd_line, 883, Error, opnd_col,
09221 AT_OBJ_NAME_PTR(OPND_IDX(opnd)));
09222
09223 ok = FALSE;
09224 goto EXIT;
09225 }
09226
09227
09228
09229 save_defer_stmt_expansion = defer_stmt_expansion;
09230 save_constructor_level = constructor_level;
09231
09232 constructor_level++;
09233
09234 if (! in_constructor) {
09235 in_constructor = TRUE;
09236 top_constructor = TRUE;
09237 defer_stmt_expansion = TRUE;
09238 }
09239
09240 exp_desc->rank = 0;
09241 exp_desc->type = Structure;
09242 exp_desc->linear_type = Structure_Type;
09243
09244 CLEAR_TBL_NTRY(type_tbl, TYP_WORK_IDX);
09245 TYP_TYPE(TYP_WORK_IDX) = Structure;
09246 TYP_LINEAR(TYP_WORK_IDX) = Structure_Type;
09247 TYP_IDX(TYP_WORK_IDX) = OPND_IDX(opnd);
09248 exp_desc->type_idx = ntr_type_tbl();
09249
09250 IR_TYPE_IDX(ir_idx) = exp_desc->type_idx;
09251 IR_RANK(ir_idx) = exp_desc->rank;
09252
09253 if (ATT_NUM_CPNTS(TYP_IDX(exp_desc->type_idx)) !=
09254 IR_LIST_CNT_R(ir_idx)) {
09255
09256
09257
09258 ok = FALSE;
09259 PRINTMSG(line, 357, Error, col);
09260 goto EXIT;
09261 }
09262
09263 exp_desc->foldable = TRUE;
09264 exp_desc->will_fold_later = TRUE;
09265
09266 list_idx = IR_IDX_R(ir_idx);
09267 sn_idx = ATT_FIRST_CPNT_IDX(TYP_IDX(exp_desc->type_idx));
09268
09269 for (i = 0; i < IR_LIST_CNT_R(ir_idx); i++) {
09270 exp_desc_r.rank = 0;
09271
09272 #ifdef KEY
09273 opnd_type save_list_opnd = IL_OPND(list_idx);
09274 #endif
09275 COPY_OPND(opnd, IL_OPND(list_idx));
09276 #ifdef KEY
09277 comp_idx = SN_ATTR_IDX(sn_idx);
09278
09279 if (ATD_ALLOCATABLE(comp_idx)) {
09280 ok &= expr_semantics(&opnd, &exp_desc_r);
09281 }
09282 else {
09283 ok &= expr_sem(&opnd, &exp_desc_r);
09284 }
09285 #else
09286 ok &= expr_sem(&opnd, &exp_desc_r);
09287 #endif
09288 COPY_OPND(IL_OPND(list_idx), opnd);
09289
09290 IL_ARG_DESC_VARIANT(list_idx) = TRUE;
09291
09292
09293 arg_info_list_base = arg_info_list_top;
09294 arg_info_list_top = arg_info_list_base + 1;
09295
09296 if (arg_info_list_top >= arg_info_list_size) {
09297 enlarge_info_list_table();
09298 }
09299
09300 IL_ARG_DESC_IDX(list_idx) = arg_info_list_top;
09301 arg_info_list[arg_info_list_top] = init_arg_info;
09302 arg_info_list[arg_info_list_top].ed = exp_desc_r;
09303
09304 exp_desc->has_symbolic |= exp_desc_r.has_symbolic;
09305
09306 comp_idx = SN_ATTR_IDX(sn_idx);
09307 exp_desc_l.type_idx = ATD_TYPE_IDX(comp_idx);
09308 exp_desc_l.linear_type = TYP_LINEAR(exp_desc_l.type_idx);
09309 exp_desc_l.type = TYP_TYPE(exp_desc_l.type_idx);
09310
09311 if (ASG_TYPE(exp_desc_l.linear_type,
09312 exp_desc_r.linear_type) == Err_Res) {
09313
09314
09315
09316 if ((exp_desc_r.type == Typeless) && ATD_POINTER(comp_idx)) {
09317
09318 }
09319 else {
09320 ok = FALSE;
09321 PRINTMSG(IR_LINE_NUM(ir_idx), 358, Error,
09322 IR_COL_NUM(ir_idx), i + 1);
09323 }
09324 }
09325
09326 if (ASG_EXTN(exp_desc_l.linear_type,
09327 exp_desc_r.linear_type) &&
09328 (exp_desc_r.type == Character ||
09329 exp_desc_r.linear_type == Short_Typeless_Const)) {
09330 find_opnd_line_and_column(&opnd,
09331 &opnd_line,
09332 &opnd_col);
09333
09334 if (exp_desc_r.type == Character) {
09335 PRINTMSG(opnd_line, 161, Ansi, opnd_col);
09336 }
09337
09338
09339 IL_IDX(list_idx) = cast_typeless_constant(IL_IDX(list_idx),
09340 exp_desc_l.linear_type,
09341 opnd_line,
09342 opnd_col);
09343
09344 exp_desc_r.type_idx = exp_desc_l.linear_type;
09345 exp_desc_r.type = TYP_TYPE(exp_desc_l.linear_type);
09346 exp_desc_r.linear_type = exp_desc_l.linear_type;
09347 }
09348
09349 if ((ATD_ARRAY_IDX(comp_idx) == 0 &&
09350 exp_desc_r.rank != 0) ||
09351 (ATD_ARRAY_IDX(comp_idx) != 0 &&
09352 exp_desc_r.rank != 0 &&
09353 BD_RANK(ATD_ARRAY_IDX(comp_idx)) != exp_desc_r.rank)) {
09354
09355 ok = FALSE;
09356 find_opnd_line_and_column(&opnd,
09357 &opnd_line,
09358 &opnd_col);
09359 PRINTMSG(opnd_line, 360, Error, opnd_col, i + 1);
09360 }
09361
09362 if (ATD_POINTER(comp_idx) && ok) {
09363
09364 if (OPND_FLD(opnd) == AT_Tbl_Idx) {
09365
09366 if (AT_OBJ_CLASS(OPND_IDX(opnd)) != Data_Obj ||
09367 (!ATD_TARGET(OPND_IDX(opnd)) &&
09368 !ATD_POINTER(OPND_IDX(opnd)))) {
09369
09370 ok = FALSE;
09371 find_opnd_line_and_column(&opnd,
09372 &opnd_line,
09373 &opnd_col);
09374 PRINTMSG(opnd_line, 359, Error, opnd_col);
09375 }
09376 }
09377 else if (OPND_FLD(opnd) == IR_Tbl_Idx) {
09378
09379 if (IR_OPR(OPND_IDX(opnd)) == Null_Intrinsic_Opr) {
09380 tmp_dv_idx = gen_compiler_tmp(line,
09381 col,
09382 Priv,
09383 TRUE);
09384
09385 ATD_TYPE_IDX(tmp_dv_idx) = ATD_TYPE_IDX(comp_idx);
09386 ATD_STOR_BLK_IDX(tmp_dv_idx) =
09387 SCP_SB_STATIC_INIT_IDX(curr_scp_idx);
09388 AT_SEMANTICS_DONE(tmp_dv_idx) = TRUE;
09389 ATD_ARRAY_IDX(tmp_dv_idx) = ATD_ARRAY_IDX(comp_idx);
09390 ATD_POINTER(tmp_dv_idx) = TRUE;
09391 ATD_IM_A_DOPE(tmp_dv_idx) = TRUE;
09392
09393 gen_opnd(&dv_opnd,
09394 tmp_dv_idx,
09395 AT_Tbl_Idx,
09396 line,
09397 col);
09398
09399 defer_stmt_expansion_save = defer_stmt_expansion;
09400 defer_stmt_expansion = FALSE;
09401 gen_static_dv_whole_def(&dv_opnd,
09402 tmp_dv_idx,
09403 Before);
09404
09405 defer_stmt_expansion = defer_stmt_expansion_save;
09406
09407 exp_desc_r.type_idx = ATD_TYPE_IDX(comp_idx);
09408 exp_desc_r.type = TYP_TYPE(ATD_TYPE_IDX(comp_idx));
09409 exp_desc_r.linear_type = TYP_LINEAR(ATD_TYPE_IDX(comp_idx));
09410 exp_desc_r.pointer = TRUE;
09411 exp_desc_r.tmp_reference = TRUE;
09412 exp_desc_r.foldable = TRUE;
09413 exp_desc_r.will_fold_later = TRUE;
09414
09415 if (ATD_ARRAY_IDX(comp_idx) == NULL_IDX) {
09416 exp_desc_r.rank = 0;
09417 }
09418 else {
09419 exp_desc_r.rank = BD_RANK(ATD_ARRAY_IDX(comp_idx));
09420 }
09421
09422
09423 gen_opnd(&dv_opnd,
09424 gen_ir(AT_Tbl_Idx,
09425 tmp_dv_idx,
09426 Dv_Deref_Opr,
09427 exp_desc_r.type_idx,
09428 line,
09429 col,
09430 NO_Tbl_Idx,
09431 NULL_IDX),
09432 IR_Tbl_Idx,
09433 line,
09434 col);
09435
09436 if (exp_desc_r.rank > 0) {
09437 ok = gen_whole_subscript(&dv_opnd, &exp_desc_r);
09438 }
09439
09440 COPY_OPND(opnd, dv_opnd);
09441 COPY_OPND(IL_OPND(list_idx), opnd);
09442 }
09443 else if (IR_OPR(OPND_IDX(opnd)) == Call_Opr) {
09444
09445 if (!ATD_POINTER(ATP_RSLT_IDX(IR_IDX_L(
09446 OPND_IDX(opnd))))) {
09447 ok = FALSE;
09448 find_opnd_line_and_column(&opnd,
09449 &opnd_line,
09450 &opnd_col);
09451 PRINTMSG(opnd_line, 359, Error, opnd_col);
09452 }
09453 }
09454 else if (exp_desc_r.reference ||
09455 exp_desc_r.tmp_reference) {
09456
09457 if (! exp_desc_r.pointer && ! exp_desc_r.target) {
09458 ok = FALSE;
09459 find_opnd_line_and_column(&opnd,
09460 &opnd_line,
09461 &opnd_col);
09462 PRINTMSG(opnd_line, 359, Error, opnd_col);
09463 }
09464 else {
09465 if (exp_desc_r.rank != 0) {
09466
09467 if (exp_desc_r.vector_subscript) {
09468
09469 find_opnd_line_and_column(&opnd,
09470 &opnd_line,
09471 &opnd_col);
09472 PRINTMSG(opnd_line, 420, Error,
09473 opnd_col);
09474 ok = FALSE;
09475 }
09476 }
09477 }
09478 }
09479 else {
09480 ok = FALSE;
09481 find_opnd_line_and_column(&opnd,
09482 &opnd_line,
09483 &opnd_col);
09484 PRINTMSG(opnd_line, 359, Error, opnd_col);
09485 }
09486 }
09487 else {
09488
09489 ok = FALSE;
09490 find_opnd_line_and_column(&opnd,
09491 &opnd_line,
09492 &opnd_col);
09493 PRINTMSG(opnd_line, 359, Error, opnd_col);
09494 }
09495
09496 if (ok &&
09497 (ATD_ARRAY_IDX(comp_idx) ?
09498 BD_RANK(ATD_ARRAY_IDX(comp_idx)) : 0) !=
09499 exp_desc_r.rank) {
09500
09501 ok = FALSE;
09502 find_opnd_line_and_column(&opnd,
09503 &opnd_line,
09504 &opnd_col);
09505 PRINTMSG(opnd_line, 431, Error, opnd_col);
09506 }
09507
09508 type_idx = ATD_TYPE_IDX(comp_idx);
09509
09510 if (ok &&
09511 (TYP_TYPE(type_idx) != exp_desc_r.type ||
09512 (TYP_TYPE(type_idx) == Structure &&
09513 !compare_derived_types(type_idx,
09514 exp_desc_r.type_idx)))) {
09515
09516 r_err_word[0] = '\0';
09517 l_err_word[0] = '\0';
09518
09519 strcat(l_err_word, get_basic_type_str(type_idx));
09520
09521 strcat(r_err_word,
09522 get_basic_type_str(exp_desc_r.type_idx));
09523
09524 find_opnd_line_and_column(&opnd,
09525 &opnd_line,
09526 &opnd_col);
09527
09528 PRINTMSG(opnd_line, 432, Error, opnd_col,
09529 r_err_word,
09530 l_err_word);
09531 ok = FALSE;
09532
09533 }
09534
09535 if (ok &&
09536 TYP_TYPE(type_idx) != Character &&
09537 TYP_TYPE(type_idx) != Structure &&
09538 TYP_LINEAR(type_idx) != exp_desc_r.linear_type) {
09539
09540 find_opnd_line_and_column(&opnd,
09541 &opnd_line,
09542 &opnd_col);
09543
09544 PRINTMSG(opnd_line, 419, Error, opnd_col);
09545 ok = FALSE;
09546 }
09547
09548 if (ok &&
09549 TYP_TYPE(type_idx) == Character &&
09550 TYP_FLD(type_idx) == CN_Tbl_Idx &&
09551 exp_desc_r.char_len.fld == CN_Tbl_Idx &&
09552 fold_relationals(TYP_IDX(type_idx),
09553 exp_desc_r.char_len.idx, Ne_Opr)) {
09554
09555 ok = FALSE;
09556 find_opnd_line_and_column(&opnd,
09557 &opnd_line,
09558 &opnd_col);
09559 PRINTMSG(opnd_line, 853, Error, opnd_col);
09560 }
09561 }
09562 #ifdef KEY
09563 else if (ATD_ALLOCATABLE(comp_idx) && ok) {
09564 if (OPND_FLD(opnd) == AT_Tbl_Idx) {
09565 if (AT_OBJ_CLASS(OPND_IDX(opnd)) != Data_Obj) {
09566 ok = FALSE;
09567 find_opnd_line_and_column(&opnd, &opnd_line, &opnd_col);
09568 PRINTMSG(opnd_line, 358, Error, opnd_col, i + 1);
09569 }
09570 }
09571 else if (OPND_FLD(opnd) == IR_Tbl_Idx) {
09572
09573 operator_type ir_opr = IR_OPR(OPND_IDX(opnd));
09574
09575
09576 if (ir_opr == Null_Intrinsic_Opr) {
09577 tmp_dv_idx = gen_compiler_tmp(line, col, Priv, TRUE);
09578
09579 ATD_TYPE_IDX(tmp_dv_idx) = ATD_TYPE_IDX(comp_idx);
09580 ATD_STOR_BLK_IDX(tmp_dv_idx) =
09581 SCP_SB_STATIC_INIT_IDX(curr_scp_idx);
09582 AT_SEMANTICS_DONE(tmp_dv_idx) = TRUE;
09583 ATD_ARRAY_IDX(tmp_dv_idx) = ATD_ARRAY_IDX(comp_idx);
09584 ATD_ALLOCATABLE(tmp_dv_idx) = TRUE;
09585 ATD_IM_A_DOPE(tmp_dv_idx) = TRUE;
09586
09587 gen_opnd(&dv_opnd, tmp_dv_idx, AT_Tbl_Idx, line, col);
09588
09589 defer_stmt_expansion_save = defer_stmt_expansion;
09590 defer_stmt_expansion = FALSE;
09591 gen_static_dv_whole_def(&dv_opnd, tmp_dv_idx, Before);
09592
09593 defer_stmt_expansion = defer_stmt_expansion_save;
09594
09595 exp_desc_r.type_idx = ATD_TYPE_IDX(comp_idx);
09596 exp_desc_r.type = TYP_TYPE(ATD_TYPE_IDX(comp_idx));
09597 exp_desc_r.linear_type = TYP_LINEAR(ATD_TYPE_IDX(comp_idx));
09598 exp_desc_r.pointer = FALSE;
09599 exp_desc_r.allocatable = TRUE;
09600 exp_desc_r.tmp_reference = TRUE;
09601 exp_desc_r.foldable = TRUE;
09602 exp_desc_r.will_fold_later = TRUE;
09603
09604 if (ATD_ARRAY_IDX(comp_idx) == NULL_IDX) {
09605 exp_desc_r.rank = 0;
09606 }
09607 else {
09608 exp_desc_r.rank = BD_RANK(ATD_ARRAY_IDX(comp_idx));
09609 }
09610
09611
09612 gen_opnd(&dv_opnd,
09613 gen_ir(AT_Tbl_Idx,
09614 tmp_dv_idx,
09615 Dv_Deref_Opr,
09616 exp_desc_r.type_idx,
09617 line,
09618 col,
09619 NO_Tbl_Idx,
09620 NULL_IDX),
09621 IR_Tbl_Idx,
09622 line,
09623 col);
09624
09625 if (exp_desc_r.rank > 0) {
09626 ok = gen_whole_subscript(&dv_opnd, &exp_desc_r);
09627 }
09628
09629 COPY_OPND(opnd, dv_opnd);
09630 COPY_OPND(IL_OPND(list_idx), opnd);
09631 }
09632
09633
09634
09635
09636
09637
09638
09639
09640
09641
09642 else if ((exp_desc_r.allocatable || exp_desc_r.dope_vector) &&
09643 !exp_desc_r.section) {
09644 COPY_OPND(IL_OPND(list_idx), save_list_opnd);
09645 }
09646
09647
09648 else {
09649 help_ctor_array_to_allocatable(line, col, &exp_desc_l, &opnd,
09650 &exp_desc_r);
09651
09652 exp_desc->foldable = exp_desc->will_fold_later = FALSE;
09653 COPY_OPND(IL_OPND(list_idx), opnd);
09654 }
09655 }
09656 else {
09657
09658 ok = FALSE;
09659 find_opnd_line_and_column(&opnd, &opnd_line, &opnd_col);
09660 PRINTMSG(opnd_line, 358, Error, opnd_col, i + 1);
09661 }
09662
09663 int rank_l = ATD_ARRAY_IDX(comp_idx) ?
09664 BD_RANK(ATD_ARRAY_IDX(comp_idx)) : 0;
09665 if (ok && rank_l != exp_desc_r.rank) {
09666 ok = FALSE;
09667 find_opnd_line_and_column(&opnd, &opnd_line, &opnd_col);
09668 PRINTMSG(opnd_line, 324, Error, opnd_col, exp_desc_r.rank,
09669 rank_l);
09670 }
09671
09672 type_idx = ATD_TYPE_IDX(comp_idx);
09673
09674 if (ok && Err_Res ==
09675 ASG_TYPE(TYP_LINEAR(type_idx), exp_desc_r.linear_type)) {
09676 find_opnd_line_and_column(&opnd, &opnd_line, &opnd_col);
09677 PRINTMSG(opnd_line, 358, Error, opnd_col, i + 1);
09678 ok = FALSE;
09679 }
09680 }
09681 #endif
09682
09683 exp_desc->foldable = exp_desc->foldable && exp_desc_r.foldable;
09684
09685 exp_desc->will_fold_later &= (exp_desc_r.will_fold_later ||
09686 exp_desc_r.foldable);
09687
09688 sn_idx = SN_SIBLING_LINK(sn_idx);
09689 list_idx = IL_NEXT_LIST_IDX(list_idx);
09690 }
09691
09692 defer_stmt_expansion = save_defer_stmt_expansion;
09693
09694 depends_on_outer_impdo = FALSE;
09695
09696 if (constructor_level > save_constructor_level) {
09697 constructor_level = save_constructor_level;
09698
09699 if (exp_desc->foldable ||
09700 exp_desc->will_fold_later) {
09701
09702 IR_OPR(ir_idx) = Constant_Struct_Construct_Opr;
09703 }
09704 }
09705 else if (top_constructor) {
09706 depends_on_outer_impdo = TRUE;
09707 exp_desc->will_fold_later |= exp_desc->foldable;
09708 exp_desc->foldable = FALSE;
09709 }
09710
09711 if (! top_constructor) {
09712 exp_desc->has_constructor = TRUE;
09713 }
09714
09715 if (top_constructor &&
09716 ! no_func_expansion &&
09717 ok) {
09718
09719 if (exp_desc->foldable ||
09720 exp_desc->will_fold_later) {
09721
09722 if (depends_on_outer_impdo) {
09723
09724 }
09725 else if (expr_mode == Initialization_Expr) {
09726 exp_desc->foldable = TRUE;
09727 }
09728 else if (! create_constructor_constant(result_opnd, exp_desc)) {
09729 ok = FALSE;
09730 }
09731 }
09732 else {
09733
09734 ok = create_runtime_struct_constructor(result_opnd);
09735
09736 exp_desc->tmp_reference = TRUE;
09737 }
09738 }
09739
09740 if (top_constructor) {
09741 in_constructor = FALSE;
09742 }
09743
09744 io_item_must_flatten = save_io_item_must_flatten;
09745 }
09746 else if (AT_OBJ_CLASS(OPND_IDX(opnd)) == Pgm_Unit) {
09747
09748
09749 IR_OPR(ir_idx) = Call_Opr;
09750 ok = expr_sem(result_opnd, exp_desc);
09751 }
09752 else {
09753
09754 PRINTMSG(line, 975, Internal, col);
09755 }
09756
09757 EXIT:
09758
09759 TRACE (Func_Exit, "struct_construct_opr_handler", NULL);
09760
09761 return(ok);
09762
09763 }
09764
09765
09766
09767
09768
09769
09770
09771
09772
09773
09774
09775
09776
09777
09778
09779
09780
09781
09782 static boolean array_construct_opr_handler(opnd_type *result_opnd,
09783 expr_arg_type *exp_desc)
09784
09785 {
09786 size_level_type constructor_size_level;
09787 boolean depends_on_outer_impdo;
09788 int depth;
09789 int ir_idx;
09790 expr_arg_type loc_exp_desc;
09791 boolean ok = TRUE;
09792 opnd_type opnd;
09793 int save_constructor_level;
09794 boolean save_defer_stmt_expansion;
09795 boolean save_in_call_list;
09796 boolean save_io_item_must_flatten;
09797 opnd_type size_opnd;
09798 boolean top_constructor = FALSE;
09799
09800
09801 TRACE (Func_Entry, "array_construct_opr_handler" , NULL);
09802
09803 ir_idx = OPND_IDX((*result_opnd));
09804 save_io_item_must_flatten = io_item_must_flatten;
09805 save_in_call_list = in_call_list;
09806 in_call_list = FALSE;
09807
09808 save_defer_stmt_expansion = defer_stmt_expansion;
09809 save_constructor_level = constructor_level;
09810 constructor_level++;
09811
09812 if (! in_constructor) {
09813 top_constructor = TRUE;
09814 in_constructor = TRUE;
09815 defer_stmt_expansion = TRUE;
09816 }
09817
09818 COPY_OPND(opnd, IR_OPND_R(ir_idx));
09819 ok = array_construct_semantics(&opnd, exp_desc);
09820 COPY_OPND(IR_OPND_R(ir_idx), opnd);
09821
09822 IR_TYPE_IDX(ir_idx) = exp_desc->type_idx;
09823 exp_desc->rank = 1;
09824 defer_stmt_expansion = save_defer_stmt_expansion;
09825
09826 depends_on_outer_impdo = FALSE;
09827
09828 if (constructor_level > save_constructor_level) {
09829 constructor_level = save_constructor_level;
09830
09831 if (exp_desc->foldable ||
09832 exp_desc->will_fold_later) {
09833
09834 IR_OPR(ir_idx) = Constant_Array_Construct_Opr;
09835 }
09836 }
09837 else if (top_constructor) {
09838 depends_on_outer_impdo = TRUE;
09839 exp_desc->will_fold_later |= exp_desc->foldable;
09840 exp_desc->foldable = FALSE;
09841 }
09842
09843 if (top_constructor &&
09844 ok) {
09845
09846 COPY_OPND(opnd, (*result_opnd));
09847 constructor_size_level = Simple_Expr_Size;
09848 analyse_loops(&opnd, &size_opnd, &constructor_size_level);
09849
09850 if (constructor_size_level == Simple_Expr_Size) {
09851 ok &= expr_semantics(&size_opnd, &loc_exp_desc);
09852 }
09853
09854 # if 0
09855 # ifdef _DEBUG
09856 switch (OPND_FLD(size_opnd)) {
09857 case CN_Tbl_Idx:
09858 print_cn(OPND_IDX(size_opnd));
09859 break;
09860 case IR_Tbl_Idx:
09861 print_ir(OPND_IDX(size_opnd));
09862 break;
09863 case AT_Tbl_Idx:
09864 print_at_all(OPND_IDX(size_opnd));
09865 break;
09866 }
09867 # endif
09868 # endif
09869
09870 COPY_OPND((exp_desc->shape[0]), size_opnd);
09871 exp_desc->constructor_size_level = constructor_size_level;
09872
09873 if (exp_desc->foldable ||
09874 exp_desc->will_fold_later) {
09875
09876 switch (stmt_type) {
09877 case Allocate_Stmt :
09878 case Arith_If_Stmt :
09879 case Assignment_Stmt :
09880 case Backspace_Stmt :
09881 case Buffer_Stmt :
09882 case Call_Stmt :
09883 case Case_Stmt :
09884 case Close_Stmt :
09885 case Deallocate_Stmt :
09886 case Decode_Stmt :
09887 case Do_Iterative_Stmt :
09888 case Do_While_Stmt :
09889 case Do_Infinite_Stmt :
09890 case Else_If_Stmt :
09891 case Else_Where_Stmt :
09892 case Encode_Stmt :
09893 case Endfile_Stmt :
09894 case If_Cstrct_Stmt :
09895 case If_Stmt :
09896 case Inquire_Stmt :
09897 case Nullify_Stmt :
09898 case Open_Stmt :
09899 case Outmoded_If_Stmt :
09900 case Print_Stmt :
09901 case Read_Stmt :
09902 case Rewind_Stmt :
09903 case Select_Stmt :
09904 case Where_Cstrct_Stmt :
09905 case Where_Stmt :
09906 case Write_Stmt :
09907
09908
09909
09910 if (constructor_size_level == Simple_Expr_Size) {
09911
09912
09913
09914 if (OPND_FLD(size_opnd) == CN_Tbl_Idx &&
09915 compare_cn_and_value(OPND_IDX(size_opnd),
09916 5000,
09917 Gt_Opr)) {
09918
09919 exp_desc->will_fold_later = FALSE;
09920 exp_desc->foldable = FALSE;
09921 IR_OPR(ir_idx) = Array_Construct_Opr;
09922 }
09923 }
09924 else if (constructor_size_level == Interp_Loop_Size) {
09925
09926 depth = implied_do_depth(&size_opnd);
09927
09928
09929
09930 if (depth > 2) {
09931 exp_desc->will_fold_later = FALSE;
09932 exp_desc->foldable = FALSE;
09933 IR_OPR(ir_idx) = Array_Construct_Opr;
09934 }
09935 else if (outer_imp_do_count(&size_opnd) > 50) {
09936 exp_desc->will_fold_later = FALSE;
09937 exp_desc->foldable = FALSE;
09938 IR_OPR(ir_idx) = Array_Construct_Opr;
09939 }
09940 }
09941 break;
09942 }
09943 }
09944 }
09945
09946 if (top_constructor &&
09947 ! no_func_expansion &&
09948 ok) {
09949
09950 if (exp_desc->foldable ||
09951 exp_desc->will_fold_later) {
09952
09953 if (depends_on_outer_impdo) {
09954
09955 }
09956 else if (expr_mode == Initialization_Expr) {
09957 exp_desc->foldable = TRUE;
09958 }
09959 else if (! create_constructor_constant(result_opnd, exp_desc)) {
09960 ok = FALSE;
09961 }
09962 }
09963 else {
09964 ok = create_runtime_array_constructor(result_opnd, exp_desc);
09965 }
09966 }
09967
09968 if (! top_constructor) {
09969
09970 exp_desc->has_constructor = TRUE;
09971
09972
09973 arg_info_list_base = arg_info_list_top;
09974 arg_info_list_top = arg_info_list_base + 1;
09975
09976 if (arg_info_list_top >= arg_info_list_size) {
09977 enlarge_info_list_table();
09978 }
09979
09980 IR_IDX_L(ir_idx) = arg_info_list_top;
09981 arg_info_list[arg_info_list_top] = init_arg_info;
09982 arg_info_list[arg_info_list_top].ed = *exp_desc;
09983
09984 }
09985
09986 if (top_constructor) {
09987 in_constructor = FALSE;
09988 }
09989
09990 io_item_must_flatten = save_io_item_must_flatten;
09991
09992 TRACE (Func_Exit, "array_construct_opr_handler", NULL);
09993
09994 return(ok);
09995
09996 }
09997
09998
09999
10000
10001
10002
10003
10004
10005
10006
10007
10008
10009
10010
10011
10012
10013
10014
10015
10016 static boolean subscript_opr_handler(opnd_type *result_opnd,
10017 expr_arg_type *exp_desc,
10018 int rank_in)
10019
10020 {
10021
10022 enum section_value {
10023 Full_Section,
10024 Part_Section,
10025 Element,
10026 Vector_Section
10027 };
10028
10029 typedef enum section_value section_type;
10030
10031 int allocatable_pointee_idx = NULL_IDX;
10032 section_type contig_state;
10033 section_type curr_section;
10034 boolean lb_default;
10035 boolean ub_default;
10036 boolean st_default;
10037 int attr_idx;
10038 int bd_idx;
10039 int col;
10040 int dv_idx;
10041 opnd_type dv_opnd;
10042 expr_arg_type exp_desc_l;
10043 expr_arg_type exp_desc_r;
10044 int host_attr_idx;
10045 int i;
10046 int ir_idx;
10047 int line;
10048 int listp_idx;
10049 int list_idx;
10050 int list2_idx;
10051 int num_dims;
10052 int minus_idx;
10053 boolean ok = TRUE;
10054 opnd_type opnd;
10055 opnd_type opnd2;
10056 int opnd_col;
10057 int opnd_line;
10058 int pe_dim_list_idx = NULL_IDX;
10059 int plus_idx;
10060 expr_mode_type save_expr_mode;
10061 boolean save_insert_subs_ok;
10062 boolean save_in_call_list;
10063 boolean save_in_component_ref;
10064 boolean save_in_implied_do;
10065 cif_usage_code_type save_xref_state;
10066
10067 # if defined(_F_MINUS_MINUS) && defined(_TARGET_OS_MAX)
10068 int save_pe_dv_list_idx = NULL_IDX;
10069 # endif
10070
10071
10072 TRACE (Func_Entry, "subscript_opr_handler" , NULL);
10073
10074 ir_idx = OPND_IDX((*result_opnd));
10075 line = IR_LINE_NUM(ir_idx);
10076 col = IR_COL_NUM(ir_idx);
10077
10078 exp_desc_l.rank = rank_in;
10079
10080 save_in_implied_do = in_implied_do;
10081
10082 if (IR_FLD_L(ir_idx) == AT_Tbl_Idx) {
10083 in_implied_do = FALSE;
10084 }
10085
10086 # if defined(_F_MINUS_MINUS)
10087 attr_idx = find_base_attr(&(IR_OPND_L(ir_idx)), &line, &col);
10088 host_attr_idx = attr_idx;
10089
10090 while (AT_ATTR_LINK(host_attr_idx) != NULL_IDX &&
10091 ! AT_IGNORE_ATTR_LINK(host_attr_idx)) {
10092
10093 host_attr_idx = AT_ATTR_LINK(host_attr_idx);
10094 }
10095
10096 if (AT_OBJ_CLASS(host_attr_idx) == Data_Obj &&
10097 ATD_CLASS(host_attr_idx) == Variable &&
10098 host_attr_idx != attr_idx &&
10099 ATD_PE_ARRAY_IDX(host_attr_idx) &&
10100 ATD_ALLOCATABLE(host_attr_idx) &&
10101 ATD_VARIABLE_TMP_IDX(host_attr_idx) != NULL_IDX) {
10102
10103
10104
10105 ATD_CLASS(attr_idx) = Variable;
10106
10107 if (ATD_VARIABLE_TMP_IDX(attr_idx) == NULL_IDX) {
10108
10109
10110 allocatable_pointee_idx = gen_compiler_tmp(line, col, Shared, TRUE);
10111
10112 ATD_CLASS(allocatable_pointee_idx) = CRI__Pointee;
10113 AT_SEMANTICS_DONE(allocatable_pointee_idx) = TRUE;
10114
10115 ATD_TYPE_IDX(allocatable_pointee_idx) =
10116 ATD_TYPE_IDX(ATD_VARIABLE_TMP_IDX(host_attr_idx));
10117 ATD_STOR_BLK_IDX(allocatable_pointee_idx) =
10118 SCP_SB_BASED_IDX(curr_scp_idx);
10119
10120 ATD_PTR_IDX(allocatable_pointee_idx) =
10121 ATD_PTR_IDX(ATD_VARIABLE_TMP_IDX(host_attr_idx));
10122 ATD_ARRAY_IDX(allocatable_pointee_idx) =
10123 ATD_ARRAY_IDX(ATD_VARIABLE_TMP_IDX(host_attr_idx));
10124 ATD_PE_ARRAY_IDX(allocatable_pointee_idx) =
10125 ATD_PE_ARRAY_IDX(ATD_VARIABLE_TMP_IDX(host_attr_idx));
10126
10127 ATD_FLD(attr_idx) = AT_Tbl_Idx;
10128 ATD_VARIABLE_TMP_IDX(attr_idx) = allocatable_pointee_idx;
10129
10130 }
10131 else {
10132 allocatable_pointee_idx = ATD_VARIABLE_TMP_IDX(attr_idx);
10133 }
10134 }
10135 # endif
10136
10137
10138
10139 COPY_OPND(opnd, IR_OPND_L(ir_idx));
10140 save_insert_subs_ok = insert_subs_ok;
10141 insert_subs_ok = FALSE;
10142 pgm_unit_illegal = FALSE;
10143 ok = expr_sem(&opnd, &exp_desc_l);
10144 insert_subs_ok = TRUE;
10145 pgm_unit_illegal = TRUE;
10146 COPY_OPND(IR_OPND_L(ir_idx), opnd);
10147
10148 in_implied_do = save_in_implied_do;
10149
10150 exp_desc->has_constructor = exp_desc_l.has_constructor;
10151
10152 # if defined(_F_MINUS_MINUS) && defined(_TARGET_OS_MAX)
10153 if (exp_desc_l.pe_dim_ref &&
10154 IR_FLD_L(ir_idx) == IR_Tbl_Idx &&
10155 IR_OPR(IR_IDX_L(ir_idx)) == Subscript_Opr &&
10156 IR_LIST_CNT_R(IR_IDX_L(ir_idx)) == 1 &&
10157 IL_PE_SUBSCRIPT(IR_IDX_R(IR_IDX_L(ir_idx)))) {
10158
10159
10160 save_pe_dv_list_idx = IR_IDX_R(IR_IDX_L(ir_idx));
10161
10162 plus_idx = IR_IDX_L(ir_idx);
10163 COPY_OPND(IR_OPND_L(ir_idx), IR_OPND_L(IR_IDX_L(ir_idx)));
10164 COPY_OPND(opnd, IR_OPND_L(ir_idx));
10165 FREE_IR_NODE(plus_idx);
10166
10167 }
10168 # endif
10169
10170 attr_idx = find_base_attr(&opnd, &line, &col);
10171
10172 if (attr_idx &&
10173 AT_OBJ_CLASS(attr_idx) == Data_Obj) {
10174
10175
10176
10177 save_in_call_list = in_call_list;
10178 in_call_list = FALSE;
10179
10180 bd_idx = ATD_ARRAY_IDX(attr_idx);
10181
10182 if (bd_idx &&
10183 (BD_ARRAY_CLASS(bd_idx) == Explicit_Shape ||
10184 BD_ARRAY_CLASS(bd_idx) == Assumed_Size)) {
10185
10186 for (i = 1; i <= BD_RANK(bd_idx); i++) {
10187 if (BD_LB_FLD(bd_idx,i) == AT_Tbl_Idx) {
10188 ADD_TMP_TO_SHARED_LIST(BD_LB_IDX(bd_idx,i));
10189 }
10190 }
10191 }
10192
10193 # ifdef _F_MINUS_MINUS
10194 if (ATD_ARRAY_IDX(attr_idx) == NULL_IDX &&
10195 ATD_PE_ARRAY_IDX(attr_idx) == NULL_IDX)
10196 # else
10197 if (ATD_ARRAY_IDX(attr_idx) == NULL_IDX)
10198 # endif
10199 {
10200 PRINTMSG(line, 546, Internal, col);
10201 }
10202
10203 exp_desc->type = exp_desc_l.type;
10204 exp_desc->linear_type = exp_desc_l.linear_type;
10205 exp_desc->type_idx = exp_desc_l.type_idx;
10206 exp_desc->rank = 0;
10207 exp_desc->constant = exp_desc_l.constant;
10208 exp_desc->foldable = exp_desc_l.foldable;
10209 exp_desc->will_fold_later = exp_desc_l.will_fold_later;
10210 exp_desc->reference = exp_desc_l.reference;
10211 exp_desc->pe_dim_ref = exp_desc_l.pe_dim_ref;
10212 COPY_OPND((exp_desc->bias_opnd), (exp_desc_l.bias_opnd));
10213 exp_desc->cif_id = exp_desc_l.cif_id;
10214 exp_desc->component = exp_desc_l.component;
10215 exp_desc->dope_vector = exp_desc_l.dope_vector;
10216 exp_desc->vector_subscript = exp_desc_l.vector_subscript;
10217 exp_desc->section = exp_desc_l.section;
10218 exp_desc->has_symbolic= exp_desc_l.has_symbolic;
10219
10220 exp_desc->contig_array = exp_desc_l.contig_array;
10221 exp_desc->dist_reshape_ref = exp_desc_l.dist_reshape_ref;
10222
10223 COPY_OPND((exp_desc->char_len), (exp_desc_l.char_len));
10224
10225 if (IR_FLD_L(ir_idx) == IR_Tbl_Idx &&
10226 IR_OPR(IR_IDX_L(ir_idx)) == Dv_Deref_Opr) {
10227
10228 COPY_OPND(dv_opnd, IR_OPND_L(IR_IDX_L(ir_idx)));
10229 }
10230 else {
10231 COPY_OPND(dv_opnd, IR_OPND_L(ir_idx));
10232 }
10233
10234 copy_subtree(&dv_opnd, &dv_opnd);
10235
10236 IR_TYPE_IDX(ir_idx) = exp_desc->type_idx;
10237
10238 list_idx = IR_IDX_R(ir_idx);
10239 num_dims = 0;
10240
10241 while (list_idx != NULL_IDX) {
10242 if (IL_PE_SUBSCRIPT(list_idx)) {
10243 pe_dim_list_idx = list_idx;
10244 break;
10245 }
10246 num_dims++;
10247 list_idx = IL_NEXT_LIST_IDX(list_idx);
10248 }
10249
10250 if (pe_dim_list_idx != NULL_IDX &&
10251 num_dims == 0 &&
10252 bd_idx != NULL_IDX) {
10253
10254
10255
10256 COPY_OPND(opnd, IR_OPND_L(ir_idx));
10257 ok &= gen_whole_subscript(&opnd, &exp_desc_l);
10258
10259 if (ok) {
10260 list_idx = IR_IDX_R(OPND_IDX(opnd));
10261
10262 while (IL_NEXT_LIST_IDX(list_idx) != NULL_IDX) {
10263 if (IL_PE_SUBSCRIPT(IL_NEXT_LIST_IDX(list_idx))) {
10264 FREE_IR_NODE(IL_IDX(IL_NEXT_LIST_IDX(list_idx)));
10265 FREE_IR_LIST_NODE(IL_NEXT_LIST_IDX(list_idx));
10266 IL_NEXT_LIST_IDX(list_idx) = NULL_IDX;
10267 IR_LIST_CNT_R(OPND_IDX(opnd)) -= 1;
10268 break;
10269 }
10270 list_idx = IL_NEXT_LIST_IDX(list_idx);
10271 }
10272
10273 num_dims = IR_LIST_CNT_R(OPND_IDX(opnd));
10274
10275 IR_LIST_CNT_R(OPND_IDX(opnd)) += IR_LIST_CNT_R(ir_idx);
10276 IL_NEXT_LIST_IDX(list_idx) = pe_dim_list_idx;
10277 IL_PREV_LIST_IDX(pe_dim_list_idx) = list_idx;
10278 COPY_OPND((*result_opnd), opnd);
10279 ir_idx = OPND_IDX(opnd);
10280 }
10281 }
10282
10283 if (ok &&
10284 ATD_PE_ARRAY_IDX(attr_idx) &&
10285 ATD_ALLOCATABLE(attr_idx) &&
10286 ATD_VARIABLE_TMP_IDX(attr_idx) != NULL_IDX &&
10287 pe_dim_list_idx != NULL_IDX) {
10288
10289 IR_FLD_L(ir_idx) = AT_Tbl_Idx;
10290
10291 if (allocatable_pointee_idx != NULL_IDX) {
10292 IR_IDX_L(ir_idx) = allocatable_pointee_idx;
10293 }
10294 else {
10295 IR_IDX_L(ir_idx) = ATD_VARIABLE_TMP_IDX(attr_idx);
10296 }
10297 IR_LINE_NUM_L(ir_idx) = IR_LINE_NUM(ir_idx);
10298 IR_COL_NUM_L(ir_idx) = IR_COL_NUM(ir_idx);
10299
10300 attr_idx = IR_IDX_L(ir_idx);
10301 bd_idx = ATD_ARRAY_IDX(attr_idx);
10302
10303 exp_desc_l.dope_vector = FALSE;
10304 exp_desc->dope_vector = exp_desc_l.dope_vector;
10305 }
10306
10307 if (IR_OPR(ir_idx) == Whole_Subscript_Opr) {
10308 exp_desc->pointer = exp_desc_l.pointer;
10309 exp_desc->target = exp_desc_l.target;
10310 }
10311 else {
10312 exp_desc->target = exp_desc_l.target ||
10313 exp_desc_l.pointer;
10314 }
10315
10316 if (BD_RANK(bd_idx) < num_dims) {
10317 ok = FALSE;
10318 PRINTMSG(line, 204, Error, col);
10319 }
10320 else if (IR_LIST_CNT_R(ir_idx) == 0) {
10321 ok = FALSE;
10322 PRINTMSG(line, 393, Error, col);
10323 }
10324 else {
10325
10326 save_expr_mode = expr_mode;
10327
10328 if (expr_mode == Data_Stmt_Target) {
10329 expr_mode = Data_Stmt_Target_Expr;
10330 }
10331 else if (expr_mode == Restricted_Imp_Do_Target) {
10332 expr_mode = Restricted_Imp_Do_Expr;
10333 }
10334
10335
10336 listp_idx = NULL_IDX;
10337 list_idx = IR_IDX_R(ir_idx);
10338
10339 save_xref_state = xref_state;
10340
10341 if (xref_state != CIF_No_Usage_Rec) {
10342 xref_state = CIF_Symbol_Reference;
10343 }
10344 save_in_component_ref = in_component_ref;
10345 in_component_ref = FALSE;
10346
10347 contig_state = Full_Section;
10348
10349 for (i = 1; i <= num_dims; i++) {
10350
10351 curr_section = Full_Section;
10352
10353 exp_desc_r.rank = 0;
10354
10355 COPY_OPND(opnd, IL_OPND(list_idx));
10356 ok &= expr_sem(&opnd, &exp_desc_r);
10357 COPY_OPND(IL_OPND(list_idx), opnd);
10358
10359 exp_desc->has_symbolic |= exp_desc_r.has_symbolic;
10360 exp_desc->has_constructor |= exp_desc_r.has_constructor;
10361 exp_desc->foldable &= exp_desc_r.foldable;
10362
10363 exp_desc->will_fold_later &= (exp_desc_r.will_fold_later ||
10364 exp_desc_r.foldable);
10365
10366 IL_CONSTANT_SUBSCRIPT(list_idx) = exp_desc_r.foldable;
10367
10368 if (exp_desc_r.rank == 0) {
10369 curr_section = Element;
10370 }
10371
10372 if (exp_desc_r.linear_type == Long_Typeless) {
10373 find_opnd_line_and_column((opnd_type *)
10374 &IL_OPND(list_idx),
10375 &opnd_line,
10376 &opnd_col);
10377 PRINTMSG(opnd_line, 1133, Error, opnd_col);
10378 ok = FALSE;
10379 }
10380 else if (exp_desc_r.type != Integer &&
10381 exp_desc_r.type != Typeless &&
10382 exp_desc_r.rank == 0) {
10383
10384 find_opnd_line_and_column((opnd_type *)
10385 &IL_OPND(list_idx),
10386 &opnd_line,
10387 &opnd_col);
10388 PRINTMSG(opnd_line, 319, Error, opnd_col);
10389 ok = FALSE;
10390 }
10391 else if (exp_desc_r.rank == 1 &&
10392 (exp_desc_r.type == Integer ||
10393 exp_desc_r.type == Typeless)) {
10394
10395 (exp_desc->rank)++;
10396
10397 if (IL_FLD(list_idx) == IR_Tbl_Idx &&
10398 IR_OPR(IL_IDX(list_idx)) == Triplet_Opr) {
10399
10400 exp_desc->section = TRUE;
10401
10402 list2_idx = IR_IDX_L(IL_IDX(list_idx));
10403
10404 if (IL_FLD(list2_idx) == NO_Tbl_Idx) {
10405
10406
10407 lb_default = TRUE;
10408
10409 if (exp_desc_l.dope_vector) {
10410 gen_dv_access_low_bound(&opnd2, &dv_opnd, i);
10411 COPY_OPND(IL_OPND(list2_idx), opnd2);
10412 IL_CONSTANT_SUBSCRIPT(list2_idx) = TRUE;
10413
10414 if (OPND_FLD(opnd2) != CN_Tbl_Idx) {
10415 exp_desc->foldable = FALSE;
10416 exp_desc->will_fold_later = FALSE;
10417 SHAPE_FOLDABLE(IL_OPND(list2_idx)) = FALSE;
10418 SHAPE_WILL_FOLD_LATER(IL_OPND(list2_idx)) = FALSE;
10419 }
10420 }
10421 else {
10422 IL_FLD(list2_idx) = BD_LB_FLD(bd_idx, i);
10423 IL_IDX(list2_idx) = BD_LB_IDX(bd_idx, i);
10424 IL_LINE_NUM(list2_idx) = IR_LINE_NUM(IL_IDX(list_idx));
10425 IL_COL_NUM(list2_idx) = IR_COL_NUM(IL_IDX(list_idx));
10426
10427 if (IL_FLD(list2_idx) == AT_Tbl_Idx) {
10428 ADD_TMP_TO_SHARED_LIST(IL_IDX(list2_idx));
10429 }
10430
10431 if (IL_FLD(list2_idx) != CN_Tbl_Idx) {
10432 exp_desc->foldable = FALSE;
10433 exp_desc->will_fold_later = FALSE;
10434
10435
10436 exp_desc_r.type_idx =
10437 ATD_TYPE_IDX(IL_IDX(list2_idx));
10438 exp_desc_r.type = TYP_TYPE(exp_desc_r.type_idx);
10439 exp_desc_r.linear_type =
10440 TYP_LINEAR(exp_desc_r.type_idx);
10441 SHAPE_FOLDABLE(IL_OPND(list2_idx))
10442 = FALSE;
10443 SHAPE_WILL_FOLD_LATER(
10444 IL_OPND(list2_idx)) = FALSE;
10445 }
10446 else {
10447 SHAPE_FOLDABLE(IL_OPND(list2_idx))
10448 = TRUE;
10449 SHAPE_WILL_FOLD_LATER(
10450 IL_OPND(list2_idx)) = TRUE;
10451 exp_desc_r.type_idx = CN_TYPE_IDX(IL_IDX(list2_idx));
10452 exp_desc_r.type = TYP_TYPE(exp_desc_r.type_idx);
10453 exp_desc_r.linear_type =
10454 TYP_LINEAR(exp_desc_r.type_idx);
10455 }
10456
10457 #ifdef KEY
10458
10459
10460
10461
10462 #else
10463 if (in_io_list) {
10464
10465
10466
10467
10468 COPY_OPND(opnd2, IL_OPND(list2_idx));
10469 cast_to_cg_default(&opnd2, &exp_desc_r);
10470 COPY_OPND(IL_OPND(list2_idx), opnd2);
10471 }
10472 #endif
10473
10474
10475
10476
10477 IL_CONSTANT_SUBSCRIPT(list2_idx) = TRUE;
10478 }
10479 }
10480 else if (IL_FLD(list2_idx) == CN_Tbl_Idx &&
10481 BD_ARRAY_CLASS(bd_idx) == Explicit_Shape &&
10482 BD_LB_FLD(bd_idx, i) == CN_Tbl_Idx &&
10483 fold_relationals(IL_IDX(list2_idx),
10484 BD_LB_IDX(bd_idx, i),
10485 Eq_Opr)) {
10486 lb_default = TRUE;
10487 }
10488 else {
10489 lb_default = FALSE;
10490 }
10491
10492 list2_idx = IL_NEXT_LIST_IDX(list2_idx);
10493
10494 if (IL_FLD(list2_idx) == NO_Tbl_Idx) {
10495
10496 ub_default = TRUE;
10497
10498 if (i == BD_RANK(bd_idx) &&
10499 BD_ARRAY_CLASS(bd_idx) == Assumed_Size) {
10500
10501 PRINTMSG(IR_LINE_NUM(IL_IDX(list_idx)),
10502 321,Error,
10503 IR_COL_NUM(IL_IDX(list_idx)));
10504 ok = FALSE;
10505 }
10506 else if (exp_desc_l.dope_vector) {
10507
10508 gen_dv_access_low_bound(&opnd2, &dv_opnd, i);
10509
10510 dv_idx = gen_ir(OPND_FLD(dv_opnd), OPND_IDX(dv_opnd),
10511 Dv_Access_Extent,SA_INTEGER_DEFAULT_TYPE,line,col,
10512 NO_Tbl_Idx, NULL_IDX);
10513
10514 IR_DV_DIM(dv_idx) = i;
10515
10516 plus_idx = gen_ir(OPND_FLD(opnd2), OPND_IDX(opnd2),
10517 Plus_Opr,SA_INTEGER_DEFAULT_TYPE,line,col,
10518 IR_Tbl_Idx, dv_idx);
10519
10520 minus_idx = gen_ir(IR_Tbl_Idx, plus_idx,
10521 Minus_Opr,SA_INTEGER_DEFAULT_TYPE,line,col,
10522 CN_Tbl_Idx, CN_INTEGER_ONE_IDX);
10523
10524 IL_FLD(list2_idx) = IR_Tbl_Idx;
10525 IL_IDX(list2_idx) = minus_idx;
10526 IL_CONSTANT_SUBSCRIPT(list2_idx) = TRUE;
10527 exp_desc->foldable = FALSE;
10528 exp_desc->will_fold_later = FALSE;
10529 SHAPE_FOLDABLE(IL_OPND(list2_idx)) = FALSE;
10530 SHAPE_WILL_FOLD_LATER(IL_OPND(list2_idx)) = FALSE;
10531 }
10532 else {
10533
10534 IL_FLD(list2_idx) = BD_UB_FLD(bd_idx, i);
10535 IL_IDX(list2_idx) = BD_UB_IDX(bd_idx, i);
10536 IL_LINE_NUM(list2_idx) = IR_LINE_NUM(IL_IDX(list_idx));
10537 IL_COL_NUM(list2_idx) = IR_COL_NUM(IL_IDX(list_idx));
10538
10539 if (IL_FLD(list2_idx) == AT_Tbl_Idx) {
10540 ADD_TMP_TO_SHARED_LIST(IL_IDX(list2_idx));
10541 }
10542
10543 if (IL_FLD(list2_idx) != CN_Tbl_Idx) {
10544 exp_desc->foldable = FALSE;
10545 exp_desc->will_fold_later = FALSE;
10546
10547 exp_desc_r.type_idx =
10548 ATD_TYPE_IDX(IL_IDX(list2_idx));
10549 exp_desc_r.type = TYP_TYPE(exp_desc_r.type_idx);
10550 exp_desc_r.linear_type =
10551 TYP_LINEAR(exp_desc_r.type_idx);
10552 SHAPE_FOLDABLE(IL_OPND(list2_idx)) = FALSE;
10553 SHAPE_WILL_FOLD_LATER(IL_OPND(list2_idx)) = FALSE;
10554 }
10555 else {
10556 SHAPE_FOLDABLE(IL_OPND(list2_idx)) = TRUE;
10557 SHAPE_WILL_FOLD_LATER(IL_OPND(list2_idx)) = TRUE;
10558 exp_desc_r.type_idx = CN_TYPE_IDX(IL_IDX(list2_idx));
10559 exp_desc_r.type = TYP_TYPE(exp_desc_r.type_idx);
10560 exp_desc_r.linear_type =
10561 TYP_LINEAR(exp_desc_r.type_idx);
10562 }
10563
10564 #ifdef KEY
10565
10566
10567
10568
10569 #else
10570 if (in_io_list) {
10571
10572
10573
10574
10575 COPY_OPND(opnd2, IL_OPND(list2_idx));
10576 cast_to_cg_default(&opnd2, &exp_desc_r);
10577 COPY_OPND(IL_OPND(list2_idx), opnd2);
10578 }
10579 #endif
10580
10581
10582
10583 IL_CONSTANT_SUBSCRIPT(list2_idx) = TRUE;
10584 }
10585 }
10586 else if (IL_FLD(list2_idx) == CN_Tbl_Idx &&
10587 BD_ARRAY_CLASS(bd_idx) == Explicit_Shape &&
10588 BD_UB_FLD(bd_idx, i) == CN_Tbl_Idx &&
10589 fold_relationals(IL_IDX(list2_idx),
10590 BD_UB_IDX(bd_idx, i),
10591 Eq_Opr)) {
10592 ub_default = TRUE;
10593 }
10594 else {
10595 ub_default = FALSE;
10596 }
10597
10598 list2_idx = IL_NEXT_LIST_IDX(list2_idx);
10599
10600 st_default = FALSE;
10601
10602 if (IL_FLD(list2_idx) == NO_Tbl_Idx) {
10603
10604 st_default = TRUE;
10605
10606
10607 IL_FLD(list2_idx) = CN_Tbl_Idx;
10608 IL_IDX(list2_idx) = CN_INTEGER_ONE_IDX;
10609 IL_LINE_NUM(list2_idx) = IR_LINE_NUM(IL_IDX(list_idx));
10610 IL_COL_NUM(list2_idx) = IR_COL_NUM(IL_IDX(list_idx));
10611
10612 IL_CONSTANT_SUBSCRIPT(list2_idx) = TRUE;
10613 SHAPE_FOLDABLE(IL_OPND(list2_idx)) = TRUE;
10614 SHAPE_WILL_FOLD_LATER(IL_OPND(list2_idx)) = TRUE;
10615 }
10616 else if (IL_FLD(list2_idx) == CN_Tbl_Idx &&
10617 compare_cn_and_value(IL_IDX(list2_idx), 0, Eq_Opr)) {
10618
10619
10620 PRINTMSG(IL_LINE_NUM(list2_idx), 1001, Error,
10621 IL_COL_NUM(list2_idx));
10622 ok = FALSE;
10623 }
10624 else if (IL_FLD(list2_idx) == CN_Tbl_Idx &&
10625 compare_cn_and_value(IL_IDX(list2_idx), 1, Eq_Opr)) {
10626 st_default = TRUE;
10627 }
10628
10629 if (lb_default &&
10630 ub_default &&
10631 st_default) {
10632 curr_section = Full_Section;
10633 }
10634 else if (st_default) {
10635 curr_section = Part_Section;
10636 }
10637 else {
10638 exp_desc->contig_array = FALSE;
10639 }
10640
10641 if (ok) {
10642 make_triplet_extent_tree(&opnd,
10643 IR_IDX_L(IL_IDX(list_idx)));
10644 COPY_OPND(exp_desc->shape[exp_desc->rank - 1], opnd);
10645 }
10646 }
10647 else {
10648
10649 IL_VECTOR_SUBSCRIPT(list_idx) = TRUE;
10650 exp_desc->vector_subscript = TRUE;
10651 COPY_OPND(exp_desc->shape[exp_desc->rank - 1],
10652 exp_desc_r.shape[0]);
10653 curr_section = Vector_Section;
10654 }
10655 }
10656 else if (exp_desc_r.rank > 1 ||
10657 (exp_desc_r.type != Integer &&
10658 exp_desc_r.type != Typeless)) {
10659
10660
10661
10662 find_opnd_line_and_column((opnd_type *)
10663 &IL_OPND(list_idx),
10664 &opnd_line,
10665 &opnd_col);
10666 PRINTMSG(opnd_line, 320, Error, opnd_col);
10667 ok = FALSE;
10668 }
10669 else if (exp_desc_r.linear_type == Short_Typeless_Const) {
10670 find_opnd_line_and_column((opnd_type *) &IL_OPND(list_idx),
10671 &opnd_line,
10672 &opnd_col);
10673 IL_IDX(list_idx) = cast_typeless_constant(IL_IDX(list_idx),
10674 INTEGER_DEFAULT_TYPE,
10675 opnd_line,
10676 opnd_col);
10677 exp_desc_r.type_idx = INTEGER_DEFAULT_TYPE;
10678 exp_desc_r.type = Integer;
10679 exp_desc_r.linear_type = INTEGER_DEFAULT_TYPE;
10680 }
10681
10682
10683 if (in_io_list) {
10684
10685
10686
10687
10688 if (IL_FLD(list_idx) == IR_Tbl_Idx &&
10689 IR_OPR(IL_IDX(list_idx)) == Triplet_Opr) {
10690
10691
10692 }
10693 else {
10694 COPY_OPND(opnd, IL_OPND(list_idx));
10695
10696 # ifndef KEY
10697 cast_to_cg_default(&opnd, &exp_desc_r);
10698 # endif
10699 COPY_OPND(IL_OPND(list_idx), opnd);
10700 }
10701 }
10702
10703 if (curr_section == Vector_Section) {
10704 exp_desc->contig_array = FALSE;
10705 }
10706 else if (contig_state == Full_Section) {
10707
10708 if (curr_section == Part_Section) {
10709 contig_state = Part_Section;
10710 }
10711 else if (curr_section == Element) {
10712 contig_state = Element;
10713 }
10714 }
10715 else if (contig_state == Part_Section) {
10716 if (curr_section == Full_Section ||
10717 curr_section == Part_Section) {
10718 exp_desc->contig_array = FALSE;
10719 }
10720 else if (curr_section == Element) {
10721 contig_state = Element;
10722 }
10723 }
10724 else if (contig_state == Element) {
10725 if (curr_section != Element) {
10726 exp_desc->contig_array = FALSE;
10727 }
10728 }
10729
10730 listp_idx = list_idx;
10731 list_idx = IL_NEXT_LIST_IDX(list_idx);
10732 }
10733
10734 expr_mode = save_expr_mode;
10735 xref_state = save_xref_state;
10736 in_component_ref = save_in_component_ref;
10737
10738 if (exp_desc->rank > 0) {
10739 IR_OPR(ir_idx) = Section_Subscript_Opr;
10740 }
10741 else {
10742 exp_desc->contig_array = FALSE;
10743 }
10744
10745 if (exp_desc_l.rank > 0 &&
10746 IR_FLD_L(ir_idx) == IR_Tbl_Idx &&
10747 (IR_OPR(IR_IDX_L(ir_idx)) == Struct_Opr ||
10748 IR_FLD_L(IR_IDX_L(ir_idx)) == IR_Tbl_Idx)) {
10749
10750
10751 if (exp_desc->rank > 0) {
10752 PRINTMSG(IR_LINE_NUM(ir_idx), 127, Error,
10753 IR_COL_NUM(ir_idx));
10754 ok = FALSE;
10755 }
10756 else {
10757 exp_desc->rank = exp_desc_l.rank;
10758 COPY_SHAPE(exp_desc->shape,exp_desc_l.shape,
10759 exp_desc_l.rank);
10760 }
10761 }
10762
10763 if (! dump_flags.no_dimension_padding &&
10764 BD_RANK(bd_idx) > num_dims) {
10765
10766 ATP_HAS_OVER_INDEXING(SCP_ATTR_IDX(curr_scp_idx)) = TRUE;
10767
10768
10769 PRINTMSG(line, 375, Warning, col);
10770
10771
10772 PRINTMSG(line, 376, Ansi, col);
10773
10774 for (i = num_dims + 1;
10775 i <= BD_RANK(bd_idx); i++) {
10776 NTR_IR_LIST_TBL(list_idx);
10777 IL_PREV_LIST_IDX(list_idx) = listp_idx;
10778 IL_NEXT_LIST_IDX(list_idx) = IL_NEXT_LIST_IDX(listp_idx);
10779 IL_PREV_LIST_IDX(IL_NEXT_LIST_IDX(list_idx)) = list_idx;
10780 IL_NEXT_LIST_IDX(listp_idx) = list_idx;
10781
10782 IR_LIST_CNT_R(ir_idx) += 1;
10783
10784 if (exp_desc_l.dope_vector) {
10785 gen_dv_access_low_bound(&opnd2, &dv_opnd, i);
10786 COPY_OPND(IL_OPND(list_idx), opnd2);
10787 IL_CONSTANT_SUBSCRIPT(list_idx) = TRUE;
10788
10789 if (OPND_FLD(opnd2) != CN_Tbl_Idx) {
10790 exp_desc->foldable = FALSE;
10791 exp_desc->will_fold_later = FALSE;
10792 SHAPE_FOLDABLE(IL_OPND(list_idx)) = FALSE;
10793 SHAPE_WILL_FOLD_LATER(IL_OPND(list_idx)) = FALSE;
10794 }
10795 }
10796 else {
10797 IL_FLD(list_idx) = BD_LB_FLD(bd_idx, i);
10798 IL_IDX(list_idx) = BD_LB_IDX(bd_idx, i);
10799 IL_LINE_NUM(list_idx) = line;
10800 IL_COL_NUM(list_idx) = col;
10801
10802 if (IL_FLD(list_idx) == AT_Tbl_Idx) {
10803 ADD_TMP_TO_SHARED_LIST(IL_IDX(list_idx));
10804 }
10805
10806 if (IL_FLD(list_idx) != CN_Tbl_Idx) {
10807 exp_desc->foldable = FALSE;
10808 exp_desc->will_fold_later = FALSE;
10809 SHAPE_FOLDABLE(IL_OPND(list_idx)) = FALSE;
10810 SHAPE_WILL_FOLD_LATER(IL_OPND(list_idx)) = FALSE;
10811 }
10812 else {
10813 SHAPE_FOLDABLE(IL_OPND(list_idx)) = TRUE;
10814 SHAPE_WILL_FOLD_LATER(IL_OPND(list_idx)) = TRUE;
10815 }
10816
10817
10818
10819
10820 IL_CONSTANT_SUBSCRIPT(list_idx) = TRUE;
10821 }
10822
10823 listp_idx = list_idx;
10824 }
10825 }
10826
10827 #ifdef _F_MINUS_MINUS
10828 bd_idx = ATD_PE_ARRAY_IDX(attr_idx);
10829
10830 if (bd_idx &&
10831 pe_dim_list_idx != NULL_IDX) {
10832
10833 # if 0
10834
10835
10836 if (pe_dim_list_idx == NULL_IDX) {
10837
10838
10839 list_idx = IR_IDX_R(ir_idx);
10840 while (IL_NEXT_LIST_IDX(list_idx) != NULL_IDX) {
10841 list_idx = IL_NEXT_LIST_IDX(list_idx);
10842 }
10843
10844 NTR_IR_LIST_TBL(IL_NEXT_LIST_IDX(list_idx));
10845 IL_PREV_LIST_IDX(IL_NEXT_LIST_IDX(list_idx)) = list_idx;
10846 list_idx = IL_NEXT_LIST_IDX(list_idx);
10847 IR_LIST_CNT_R(ir_idx) += 1;
10848
10849 IL_FLD(list_idx) = IR_Tbl_Idx;
10850
10851 NTR_IR_TBL(plus_idx);
10852 IR_OPR(plus_idx) = Local_Pe_Dim_Opr;
10853 IR_TYPE_IDX(plus_idx) = CG_INTEGER_DEFAULT_TYPE;
10854 IR_LINE_NUM(plus_idx) = line;
10855 IR_COL_NUM(plus_idx) = col;
10856 IL_IDX(list_idx) = plus_idx;
10857 }
10858 # endif
10859
10860 num_dims = 0;
10861 list_idx = pe_dim_list_idx;
10862
10863 while (list_idx != NULL_IDX) {
10864
10865 num_dims++;
10866 list_idx = IL_NEXT_LIST_IDX(list_idx);
10867 }
10868
10869 if (BD_RANK(bd_idx) < num_dims) {
10870 ok = FALSE;
10871 PRINTMSG(line, 204, Error, col);
10872 }
10873 else {
10874
10875 save_expr_mode = expr_mode;
10876
10877 if (expr_mode == Data_Stmt_Target) {
10878 expr_mode = Data_Stmt_Target_Expr;
10879 }
10880 else if (expr_mode == Restricted_Imp_Do_Target) {
10881 expr_mode = Restricted_Imp_Do_Expr;
10882 }
10883
10884
10885 list_idx = pe_dim_list_idx;
10886 listp_idx = IL_PREV_LIST_IDX(list_idx);
10887
10888 save_xref_state = xref_state;
10889
10890 if (xref_state != CIF_No_Usage_Rec) {
10891 xref_state = CIF_Symbol_Reference;
10892 }
10893 save_in_component_ref = in_component_ref;
10894 in_component_ref = FALSE;
10895
10896 for (i = 1; i <= num_dims; i++) {
10897
10898 exp_desc_r.rank = 0;
10899
10900 COPY_OPND(opnd, IL_OPND(list_idx));
10901 ok &= expr_sem(&opnd, &exp_desc_r);
10902 COPY_OPND(IL_OPND(list_idx), opnd);
10903
10904 exp_desc->has_symbolic |= exp_desc_r.has_symbolic;
10905 exp_desc->has_constructor |= exp_desc_r.has_constructor;
10906 exp_desc->foldable &= exp_desc_r.foldable;
10907
10908 exp_desc->will_fold_later &= (exp_desc_r.will_fold_later ||
10909 exp_desc_r.foldable);
10910
10911 IL_CONSTANT_SUBSCRIPT(list_idx) = exp_desc_r.foldable;
10912
10913 if (exp_desc_r.linear_type == Long_Typeless) {
10914 find_opnd_line_and_column((opnd_type *)
10915 &IL_OPND(list_idx),
10916 &opnd_line,
10917 &opnd_col);
10918 PRINTMSG(opnd_line, 1133, Error, opnd_col);
10919 ok = FALSE;
10920 }
10921 else if (exp_desc_r.type != Integer &&
10922 exp_desc_r.type != Typeless &&
10923 exp_desc_r.rank == 0) {
10924
10925 find_opnd_line_and_column((opnd_type *)
10926 &IL_OPND(list_idx),
10927 &opnd_line,
10928 &opnd_col);
10929 PRINTMSG(opnd_line, 319, Error, opnd_col);
10930 ok = FALSE;
10931 }
10932 else if (exp_desc_r.rank == 1 &&
10933 (exp_desc_r.type == Integer ||
10934 exp_desc_r.type == Typeless)) {
10935
10936 (exp_desc->rank)++;
10937
10938 # if 1
10939 find_opnd_line_and_column((opnd_type *)
10940 &IL_OPND(list_idx),
10941 &opnd_line,
10942 &opnd_col);
10943 PRINTMSG(opnd_line, 1583, Error, opnd_col,
10944 "array syntax", "co-array variables");
10945 ok = FALSE;
10946
10947 # else
10948
10949 if (IL_FLD(list_idx) == IR_Tbl_Idx &&
10950 IR_OPR(IL_IDX(list_idx)) == Triplet_Opr) {
10951
10952 exp_desc->section = TRUE;
10953
10954 list2_idx = IR_IDX_L(IL_IDX(list_idx));
10955
10956 if (IL_FLD(list2_idx) == NO_Tbl_Idx) {
10957
10958
10959 IL_FLD(list2_idx) = BD_LB_FLD(bd_idx, i);
10960 IL_IDX(list2_idx) = BD_LB_IDX(bd_idx, i);
10961 IL_LINE_NUM(list2_idx) =
10962 IR_LINE_NUM(IL_IDX(list_idx));
10963 IL_COL_NUM(list2_idx) =
10964 IR_COL_NUM(IL_IDX(list_idx));
10965
10966 if (IL_FLD(list2_idx) == AT_Tbl_Idx) {
10967 ADD_TMP_TO_SHARED_LIST(IL_IDX(list2_idx));
10968 }
10969
10970 if (IL_FLD(list2_idx) != CN_Tbl_Idx) {
10971 exp_desc->foldable = FALSE;
10972 exp_desc->will_fold_later = FALSE;
10973
10974
10975 exp_desc_r.type_idx =
10976 ATD_TYPE_IDX(IL_IDX(list2_idx));
10977 exp_desc_r.type=TYP_TYPE(exp_desc_r.type_idx);
10978 exp_desc_r.linear_type =
10979 TYP_LINEAR(exp_desc_r.type_idx);
10980 SHAPE_FOLDABLE(IL_OPND(list2_idx))
10981 = FALSE;
10982 SHAPE_WILL_FOLD_LATER(
10983 IL_OPND(list2_idx)) = FALSE;
10984 }
10985 else {
10986 SHAPE_FOLDABLE(IL_OPND(list2_idx))
10987 = TRUE;
10988 SHAPE_WILL_FOLD_LATER(
10989 IL_OPND(list2_idx)) = TRUE;
10990 exp_desc_r.type_idx =
10991 CN_TYPE_IDX(IL_IDX(list2_idx));
10992 exp_desc_r.type=TYP_TYPE(exp_desc_r.type_idx);
10993 exp_desc_r.linear_type =
10994 TYP_LINEAR(exp_desc_r.type_idx);
10995 }
10996
10997
10998
10999 IL_CONSTANT_SUBSCRIPT(list2_idx) = TRUE;
11000 }
11001
11002 list2_idx = IL_NEXT_LIST_IDX(list2_idx);
11003
11004 if (IL_FLD(list2_idx) == NO_Tbl_Idx) {
11005
11006 if (i == BD_RANK(bd_idx) &&
11007 BD_ARRAY_CLASS(bd_idx) == Assumed_Size) {
11008
11009 PRINTMSG(IR_LINE_NUM(IL_IDX(list_idx)),
11010 321,Error,
11011 IR_COL_NUM(IL_IDX(list_idx)));
11012 ok = FALSE;
11013 }
11014
11015
11016 IL_FLD(list2_idx) = BD_UB_FLD(bd_idx, i);
11017 IL_IDX(list2_idx) = BD_UB_IDX(bd_idx, i);
11018 IL_LINE_NUM(list2_idx) =
11019 IR_LINE_NUM(IL_IDX(list_idx));
11020 IL_COL_NUM(list2_idx) =
11021 IR_COL_NUM(IL_IDX(list_idx));
11022
11023 if (IL_FLD(list2_idx) == AT_Tbl_Idx) {
11024 ADD_TMP_TO_SHARED_LIST(IL_IDX(list2_idx));
11025 }
11026
11027 if (IL_FLD(list2_idx) != CN_Tbl_Idx) {
11028 exp_desc->foldable = FALSE;
11029 exp_desc->will_fold_later = FALSE;
11030
11031 exp_desc_r.type_idx =
11032 ATD_TYPE_IDX(IL_IDX(list2_idx));
11033 exp_desc_r.type=TYP_TYPE(exp_desc_r.type_idx);
11034 exp_desc_r.linear_type =
11035 TYP_LINEAR(exp_desc_r.type_idx);
11036 SHAPE_FOLDABLE(IL_OPND(list2_idx)) = FALSE;
11037 SHAPE_WILL_FOLD_LATER(IL_OPND(list2_idx))
11038 = FALSE;
11039 }
11040 else {
11041 SHAPE_FOLDABLE(IL_OPND(list2_idx)) = TRUE;
11042 SHAPE_WILL_FOLD_LATER(IL_OPND(list2_idx))
11043 = TRUE;
11044 exp_desc_r.type_idx =
11045 CN_TYPE_IDX(IL_IDX(list2_idx));
11046 exp_desc_r.type=TYP_TYPE(exp_desc_r.type_idx);
11047 exp_desc_r.linear_type =
11048 TYP_LINEAR(exp_desc_r.type_idx);
11049 }
11050
11051
11052
11053 IL_CONSTANT_SUBSCRIPT(list2_idx) = TRUE;
11054 }
11055
11056 list2_idx = IL_NEXT_LIST_IDX(list2_idx);
11057
11058 if (IL_FLD(list2_idx) == NO_Tbl_Idx) {
11059
11060
11061 IL_FLD(list2_idx) = CN_Tbl_Idx;
11062 IL_IDX(list2_idx) = CN_INTEGER_ONE_IDX;
11063 IL_LINE_NUM(list2_idx) =
11064 IR_LINE_NUM(IL_IDX(list_idx));
11065 IL_COL_NUM(list2_idx) =
11066 IR_COL_NUM(IL_IDX(list_idx));
11067
11068 IL_CONSTANT_SUBSCRIPT(list2_idx) = TRUE;
11069 SHAPE_FOLDABLE(IL_OPND(list2_idx)) = TRUE;
11070 SHAPE_WILL_FOLD_LATER(IL_OPND(list2_idx)) = TRUE;
11071 }
11072 else if (IL_FLD(list2_idx) == CN_Tbl_Idx &&
11073 compare_cn_and_value(IL_IDX(list2_idx),
11074 0, Eq_Opr)) {
11075
11076
11077 PRINTMSG(IL_LINE_NUM(list2_idx), 1001, Error,
11078 IL_COL_NUM(list2_idx));
11079 ok = FALSE;
11080 }
11081
11082 if (ok) {
11083 make_triplet_extent_tree(&opnd,
11084 IR_IDX_L(IL_IDX(list_idx)));
11085 COPY_OPND(exp_desc->shape[exp_desc->rank - 1],
11086 opnd);
11087 }
11088 }
11089 else {
11090
11091 IL_VECTOR_SUBSCRIPT(list_idx) = TRUE;
11092 exp_desc->vector_subscript = TRUE;
11093 COPY_OPND(exp_desc->shape[exp_desc->rank - 1],
11094 exp_desc_r.shape[0]);
11095 }
11096 # endif
11097 }
11098 else if (exp_desc_r.rank > 1 ||
11099 (exp_desc_r.type != Integer &&
11100 exp_desc_r.type != Typeless)) {
11101
11102
11103
11104 find_opnd_line_and_column((opnd_type *)
11105 &IL_OPND(list_idx),
11106 &opnd_line,
11107 &opnd_col);
11108 PRINTMSG(opnd_line, 320, Error, opnd_col);
11109 ok = FALSE;
11110 }
11111 else if (exp_desc_r.linear_type == Short_Typeless_Const) {
11112 find_opnd_line_and_column(
11113 (opnd_type *) &IL_OPND(list_idx),
11114 &opnd_line,
11115 &opnd_col);
11116 IL_IDX(list_idx) =
11117 cast_typeless_constant(IL_IDX(list_idx),
11118 INTEGER_DEFAULT_TYPE,
11119 opnd_line,
11120 opnd_col);
11121 exp_desc_r.type_idx = INTEGER_DEFAULT_TYPE;
11122 exp_desc_r.type = Integer;
11123 exp_desc_r.linear_type = INTEGER_DEFAULT_TYPE;
11124 }
11125
11126 listp_idx = list_idx;
11127 list_idx = IL_NEXT_LIST_IDX(list_idx);
11128 }
11129
11130 expr_mode = save_expr_mode;
11131 xref_state = save_xref_state;
11132 in_component_ref = save_in_component_ref;
11133
11134 if (exp_desc->rank > 0) {
11135 IR_OPR(ir_idx) = Section_Subscript_Opr;
11136 }
11137
11138 if (! dump_flags.no_dimension_padding &&
11139 BD_RANK(bd_idx) > num_dims) {
11140
11141 ATP_HAS_OVER_INDEXING(SCP_ATTR_IDX(curr_scp_idx)) = TRUE;
11142
11143
11144 PRINTMSG(line, 375, Warning, col);
11145
11146
11147 PRINTMSG(line, 376, Ansi, col);
11148
11149 for (i = num_dims + 1;
11150 i <= BD_RANK(bd_idx); i++) {
11151
11152 NTR_IR_LIST_TBL(list_idx);
11153 IL_PREV_LIST_IDX(list_idx) = listp_idx;
11154 IL_NEXT_LIST_IDX(list_idx)=IL_NEXT_LIST_IDX(listp_idx);
11155 IL_PREV_LIST_IDX(IL_NEXT_LIST_IDX(list_idx)) = list_idx;
11156 IL_NEXT_LIST_IDX(listp_idx) = list_idx;
11157
11158 IR_LIST_CNT_R(ir_idx) += 1;
11159
11160 IL_FLD(list_idx) = BD_LB_FLD(bd_idx, i);
11161 IL_IDX(list_idx) = BD_LB_IDX(bd_idx, i);
11162 IL_LINE_NUM(list_idx) = line;
11163 IL_COL_NUM(list_idx) = col;
11164
11165 if (IL_FLD(list_idx) == AT_Tbl_Idx) {
11166 ADD_TMP_TO_SHARED_LIST(IL_IDX(list_idx));
11167 }
11168
11169 if (IL_FLD(list_idx) != CN_Tbl_Idx) {
11170 exp_desc->foldable = FALSE;
11171 exp_desc->will_fold_later = FALSE;
11172 SHAPE_FOLDABLE(IL_OPND(list_idx)) = FALSE;
11173 SHAPE_WILL_FOLD_LATER(IL_OPND(list_idx)) = FALSE;
11174 }
11175 else {
11176 SHAPE_FOLDABLE(IL_OPND(list_idx)) = TRUE;
11177 SHAPE_WILL_FOLD_LATER(IL_OPND(list_idx)) = TRUE;
11178 }
11179
11180
11181
11182
11183 IL_CONSTANT_SUBSCRIPT(list_idx) = TRUE;
11184
11185 listp_idx = list_idx;
11186 }
11187 }
11188 }
11189 }
11190 # endif
11191
11192
11193 IR_RANK(ir_idx) = exp_desc->rank;
11194
11195 if (exp_desc->rank == 0 &&
11196 !exp_desc_l.pointer &&
11197 !exp_desc_l.assumed_shape) {
11198 exp_desc->array_elt = TRUE;
11199 }
11200
11201 if (ok) {
11202 ok = check_array_bounds(ir_idx);
11203 }
11204
11205 # if defined(_F_MINUS_MINUS)
11206 # if defined(_TARGET_OS_MAX)
11207 if (save_pe_dv_list_idx != NULL_IDX) {
11208
11209
11210 list_idx = IR_IDX_R(ir_idx);
11211
11212 while (IL_NEXT_LIST_IDX(list_idx)) {
11213 list_idx = IL_NEXT_LIST_IDX(list_idx);
11214 }
11215
11216 IL_NEXT_LIST_IDX(list_idx) = save_pe_dv_list_idx;
11217 IL_PREV_LIST_IDX(save_pe_dv_list_idx) = list_idx;
11218 IR_LIST_CNT_R(ir_idx) += 1;
11219 } else
11220 # endif
11221 if (ok &&
11222 ATD_PE_ARRAY_IDX(attr_idx)) {
11223
11224 if (pe_dim_list_idx != NULL_IDX) {
11225
11226 translate_distant_ref(result_opnd, exp_desc, pe_dim_list_idx);
11227 }
11228 # if defined(_TARGET_OS_MAX)
11229 else if (! ATD_ALLOCATABLE(attr_idx)) {
11230
11231
11232 list_idx = IR_IDX_R(ir_idx);
11233 while (IL_NEXT_LIST_IDX(list_idx) != NULL_IDX) {
11234 list_idx = IL_NEXT_LIST_IDX(list_idx);
11235 }
11236
11237 NTR_IR_LIST_TBL(IL_NEXT_LIST_IDX(list_idx));
11238 IL_PREV_LIST_IDX(IL_NEXT_LIST_IDX(list_idx)) = list_idx;
11239 list_idx = IL_NEXT_LIST_IDX(list_idx);
11240 IR_LIST_CNT_R(ir_idx) += 1;
11241
11242 NTR_IR_TBL(plus_idx);
11243 IR_OPR(plus_idx) = My_Pe_Opr;
11244 IR_TYPE_IDX(plus_idx) = INTEGER_DEFAULT_TYPE;
11245 IR_LINE_NUM(plus_idx) = IR_LINE_NUM(ir_idx);
11246 IR_COL_NUM(plus_idx) = IR_COL_NUM(ir_idx);
11247
11248 IL_FLD(list_idx) = IR_Tbl_Idx;
11249 IL_IDX(list_idx) = plus_idx;
11250
11251 IL_PE_SUBSCRIPT(list_idx) = TRUE;
11252 io_item_must_flatten = TRUE;
11253 }
11254 # endif
11255 }
11256 # endif
11257
11258
11259
11260 if (ok &&
11261 save_insert_subs_ok &&
11262 ! no_sub_or_deref &&
11263 exp_desc->type == Character) {
11264
11265 ok = gen_whole_substring(result_opnd, exp_desc->rank);
11266 }
11267 }
11268 }
11269 else if (IR_FLD_L(ir_idx) == AT_Tbl_Idx &&
11270 AT_OBJ_CLASS(IR_IDX_L(ir_idx)) == Pgm_Unit) {
11271
11272 IR_OPR(ir_idx) = Call_Opr;
11273
11274 ok = expr_sem(result_opnd, exp_desc);
11275 }
11276 else {
11277
11278 PRINTMSG(line, 975, Internal, col);
11279 }
11280
11281 TRACE (Func_Exit, "subscript_opr_handler", NULL);
11282
11283 return(ok);
11284
11285 }
11286
11287
11288
11289
11290
11291
11292
11293
11294
11295
11296
11297
11298
11299
11300
11301
11302
11303 static boolean substring_opr_handler(opnd_type *result_opnd,
11304 expr_arg_type *exp_desc,
11305 int rank_in)
11306
11307 {
11308 #ifdef KEY
11309 int attr_idx = 0;
11310 #else
11311 int attr_idx;
11312 #endif
11313 char *char_ptr1;
11314 char *char_ptr2;
11315 int clen_idx;
11316 int col;
11317 expr_arg_type exp_desc_l;
11318 expr_arg_type exp_desc_r;
11319 int i;
11320 int ir_idx;
11321 int line;
11322 int list_idx;
11323 boolean ok = TRUE;
11324 opnd_type opnd;
11325 int opnd_col;
11326 int opnd_line;
11327 boolean save_defer_stmt_expansion;
11328 expr_mode_type save_expr_mode;
11329 boolean save_in_component_ref;
11330 int save_number_of_functions;
11331 cif_usage_code_type save_xref_state;
11332 int tmp_idx;
11333 int type_idx;
11334
11335
11336 TRACE (Func_Entry, "substring_opr_handler" , NULL);
11337
11338 ir_idx = OPND_IDX((*result_opnd));
11339 line = IR_LINE_NUM(ir_idx);
11340 col = IR_COL_NUM(ir_idx);
11341
11342 exp_desc_l.rank = rank_in;
11343
11344
11345
11346 COPY_OPND(opnd, IR_OPND_L(ir_idx));
11347 insert_subs_ok = FALSE;
11348 ok = expr_sem(&opnd, &exp_desc_l);
11349 insert_subs_ok = TRUE;
11350 COPY_OPND(IR_OPND_L(ir_idx), opnd);
11351
11352
11353 in_call_list = FALSE;
11354
11355 if (OPND_FLD(opnd) == CN_Tbl_Idx) {
11356 type_idx = CN_TYPE_IDX(OPND_IDX(opnd));
11357 }
11358 else {
11359 attr_idx = find_base_attr(&opnd, &line, &col);
11360 type_idx = ATD_TYPE_IDX(attr_idx);
11361 }
11362
11363 exp_desc->has_constructor = exp_desc_l.has_constructor;
11364 exp_desc->has_symbolic = exp_desc_l.has_symbolic;
11365
11366 exp_desc->constant = exp_desc_l.constant;
11367 exp_desc->foldable = exp_desc_l.foldable;
11368 exp_desc->will_fold_later = exp_desc_l.will_fold_later;
11369
11370 exp_desc->rank = exp_desc_l.rank;
11371 COPY_SHAPE(exp_desc->shape,exp_desc_l.shape,exp_desc_l.rank);
11372 exp_desc->type = exp_desc_l.type;
11373 exp_desc->linear_type = exp_desc_l.linear_type;
11374 exp_desc->type_idx = exp_desc_l.type_idx;
11375
11376 if (exp_desc->linear_type == Short_Char_Const) {
11377
11378
11379
11380
11381
11382
11383 type_tbl[TYP_WORK_IDX] = type_tbl[exp_desc->type_idx];
11384 TYP_LINEAR(TYP_WORK_IDX) = Character_1;
11385 exp_desc->type_idx = ntr_type_tbl();
11386 exp_desc->linear_type = Character_1;
11387 }
11388
11389
11390
11391 if (IR_OPR(ir_idx) == Whole_Substring_Opr) {
11392 exp_desc->pointer = exp_desc_l.pointer;
11393 exp_desc->target = exp_desc_l.target;
11394 }
11395 else {
11396 exp_desc->target = exp_desc_l.target ||
11397 exp_desc_l.pointer;
11398 }
11399
11400 exp_desc->vector_subscript = exp_desc_l.vector_subscript;
11401 exp_desc->reference = exp_desc_l.reference;
11402 exp_desc->pe_dim_ref = exp_desc_l.pe_dim_ref;
11403 COPY_OPND((exp_desc->bias_opnd), (exp_desc_l.bias_opnd));
11404 exp_desc->cif_id = exp_desc_l.cif_id;
11405 exp_desc->component = exp_desc_l.component;
11406 exp_desc->section = exp_desc_l.section;
11407 exp_desc->array_elt = exp_desc_l.array_elt;
11408 exp_desc->dope_vector = exp_desc_l.dope_vector;
11409 exp_desc->contig_array = exp_desc_l.contig_array;
11410 exp_desc->dist_reshape_ref = exp_desc_l.dist_reshape_ref;
11411
11412
11413 IR_TYPE_IDX(ir_idx) = exp_desc->type_idx;
11414 IR_RANK(ir_idx) = exp_desc->rank;
11415
11416
11417 if (exp_desc_l.type != Character) {
11418 PRINTMSG(line, 508, Error, col);
11419 ok = FALSE;
11420 }
11421
11422 save_expr_mode = expr_mode;
11423 save_xref_state = xref_state;
11424
11425 if (xref_state != CIF_No_Usage_Rec) {
11426 xref_state = CIF_Symbol_Reference;
11427 }
11428 save_in_component_ref = in_component_ref;
11429 in_component_ref = FALSE;
11430
11431 if (expr_mode == Data_Stmt_Target) {
11432 expr_mode = Data_Stmt_Target_Expr;
11433 }
11434 else if (expr_mode == Restricted_Imp_Do_Target) {
11435 expr_mode = Restricted_Imp_Do_Expr;
11436 }
11437
11438 list_idx = IR_IDX_R(ir_idx);
11439
11440 exp_desc_r.rank = 0;
11441 save_number_of_functions = number_of_functions;
11442 number_of_functions = 0;
11443
11444 COPY_OPND(opnd, IL_OPND(list_idx));
11445 ok &= expr_sem(&opnd, &exp_desc_r);
11446 COPY_OPND(IL_OPND(list_idx), opnd);
11447
11448 exp_desc->has_symbolic |= exp_desc_r.has_symbolic;
11449 exp_desc->has_constructor |= exp_desc_r.has_constructor;
11450
11451 if (IL_FLD(list_idx) == NO_Tbl_Idx) {
11452
11453 IL_FLD(list_idx) = CN_Tbl_Idx;
11454 IL_IDX(list_idx) = CN_INTEGER_ONE_IDX;
11455 IL_LINE_NUM(list_idx) = line;
11456 IL_COL_NUM(list_idx) = col;
11457 exp_desc_r.foldable = TRUE;
11458 }
11459 else if (exp_desc_r.linear_type == Long_Typeless) {
11460 find_opnd_line_and_column((opnd_type *) &IL_OPND(list_idx),
11461 &opnd_line,
11462 &opnd_col);
11463 PRINTMSG(opnd_line, 1133, Error, opnd_col);
11464 ok = FALSE;
11465 }
11466 else if (exp_desc_r.rank != 0 ||
11467 (exp_desc_r.type != Integer &&
11468 exp_desc_r.type != Typeless)) {
11469 find_opnd_line_and_column((opnd_type *) &IL_OPND(list_idx),
11470 &opnd_line,
11471 &opnd_col);
11472 PRINTMSG(opnd_line, 323, Error, opnd_col);
11473 ok = FALSE;
11474 }
11475 else if (exp_desc_r.linear_type == Short_Typeless_Const) {
11476 find_opnd_line_and_column((opnd_type *) &IL_OPND(list_idx),
11477 &opnd_line,
11478 &opnd_col);
11479 IL_IDX(list_idx) = cast_typeless_constant(IL_IDX(list_idx),
11480 INTEGER_DEFAULT_TYPE,
11481 opnd_line,
11482 opnd_col);
11483 exp_desc_r.type_idx = INTEGER_DEFAULT_TYPE;
11484 exp_desc_r.type = Integer;
11485 exp_desc_r.linear_type = INTEGER_DEFAULT_TYPE;
11486 }
11487
11488 if (ok &&
11489 IL_FLD(list_idx) == CN_Tbl_Idx &&
11490 compare_cn_and_value(IL_IDX(list_idx), 1, Eq_Opr)) {
11491
11492 }
11493 else {
11494 exp_desc->contig_array = FALSE;
11495 }
11496
11497 exp_desc->foldable = exp_desc->foldable &&
11498 exp_desc_r.foldable;
11499
11500 exp_desc->will_fold_later &= (exp_desc_r.will_fold_later ||
11501 exp_desc_r.foldable);
11502
11503 IL_CONSTANT_SUBSCRIPT(list_idx) = exp_desc_r.foldable;
11504
11505 list_idx = IL_NEXT_LIST_IDX(list_idx);
11506
11507 exp_desc_r.rank = 0;
11508
11509 COPY_OPND(opnd, IL_OPND(list_idx));
11510 ok &= expr_sem(&opnd, &exp_desc_r);
11511 COPY_OPND(IL_OPND(list_idx), opnd);
11512
11513 exp_desc->has_symbolic |= exp_desc_r.has_symbolic;
11514 exp_desc->has_constructor |= exp_desc_r.has_constructor;
11515
11516 if (IL_FLD(list_idx) == NO_Tbl_Idx ||
11517 (IL_FLD(list_idx) == CN_Tbl_Idx &&
11518 TYP_CHAR_CLASS(type_idx) == Const_Len_Char &&
11519 TYP_FLD(type_idx) == CN_Tbl_Idx &&
11520 fold_relationals(IL_IDX(list_idx), TYP_IDX(type_idx), Eq_Opr))) {
11521
11522
11523 }
11524 else {
11525 exp_desc->contig_array = FALSE;
11526 }
11527
11528 if (IL_FLD(list_idx) == NO_Tbl_Idx) {
11529
11530 if (IR_FLD_L(ir_idx) != CN_Tbl_Idx &&
11531 ATD_CLASS(attr_idx) == CRI__Pointee &&
11532 TYP_CHAR_CLASS(type_idx) == Assumed_Size_Char) {
11533
11534 NTR_IR_TBL(clen_idx);
11535 IR_OPR(clen_idx) = Clen_Opr;
11536 IR_TYPE_IDX(clen_idx) = CG_INTEGER_DEFAULT_TYPE;
11537 IR_LINE_NUM(clen_idx) = line;
11538 IR_COL_NUM(clen_idx) = col;
11539 IR_FLD_L(clen_idx) = AT_Tbl_Idx;
11540 IR_IDX_L(clen_idx) = attr_idx;
11541 IR_LINE_NUM_L(clen_idx) = line;
11542 IR_COL_NUM_L(clen_idx) = col;
11543 IL_FLD(list_idx) = IR_Tbl_Idx;
11544 IL_IDX(list_idx) = clen_idx;
11545 }
11546 else {
11547 IL_FLD(list_idx) = TYP_FLD(type_idx);
11548 IL_IDX(list_idx) = TYP_IDX(type_idx);
11549 IL_LINE_NUM(list_idx) = line;
11550 IL_COL_NUM(list_idx) = col;
11551
11552 if (IL_FLD(list_idx) == AT_Tbl_Idx) {
11553 ADD_TMP_TO_SHARED_LIST(IL_IDX(list_idx));
11554 }
11555
11556 if (IL_FLD(list_idx) == CN_Tbl_Idx) {
11557 exp_desc_r.foldable = TRUE;
11558 }
11559 }
11560 }
11561 else if (exp_desc_r.linear_type == Long_Typeless) {
11562 find_opnd_line_and_column((opnd_type *) &IL_OPND(list_idx),
11563 &opnd_line,
11564 &opnd_col);
11565 PRINTMSG(opnd_line, 1133, Error, opnd_col);
11566 ok = FALSE;
11567 }
11568 else if (exp_desc_r.rank != 0 ||
11569 (exp_desc_r.type != Integer &&
11570 exp_desc_r.type != Typeless)) {
11571 find_opnd_line_and_column((opnd_type *) &IL_OPND(list_idx),
11572 &opnd_line,
11573 &opnd_col);
11574 PRINTMSG(opnd_line, 323, Error, opnd_col);
11575 ok = FALSE;
11576 }
11577 else if (exp_desc_r.linear_type == Short_Typeless_Const) {
11578 find_opnd_line_and_column((opnd_type *) &IL_OPND(list_idx),
11579 &opnd_line,
11580 &opnd_col);
11581 IL_IDX(list_idx) = cast_typeless_constant(IL_IDX(list_idx),
11582 INTEGER_DEFAULT_TYPE,
11583 opnd_line,
11584 opnd_col);
11585 exp_desc_r.type_idx = INTEGER_DEFAULT_TYPE;
11586 exp_desc_r.type = Integer;
11587 exp_desc_r.linear_type = INTEGER_DEFAULT_TYPE;
11588 }
11589
11590 exp_desc->foldable = exp_desc->foldable && exp_desc_r.foldable;
11591 exp_desc->will_fold_later &= (exp_desc_r.will_fold_later ||
11592 exp_desc_r.foldable);
11593
11594 IL_CONSTANT_SUBSCRIPT(list_idx) = exp_desc_r.foldable;
11595
11596 if (ok) {
11597
11598 add_substring_length(ir_idx);
11599
11600 if (IR_FLD_L(ir_idx) == IR_Tbl_Idx &&
11601 (IR_OPR(IR_IDX_L(ir_idx)) == Substring_Opr ||
11602 IR_OPR(IR_IDX_L(ir_idx)) == Whole_Substring_Opr)) {
11603
11604
11605
11606
11607 fold_nested_substrings(ir_idx);
11608 }
11609
11610 list_idx = IL_NEXT_LIST_IDX(list_idx);
11611
11612 COPY_OPND(exp_desc->char_len, IL_OPND(list_idx));
11613
11614 ok &= check_substring_bounds(ir_idx);
11615
11616 if (ok &&
11617 IR_FLD_L(ir_idx) == CN_Tbl_Idx &&
11618 IL_FLD(list_idx) == CN_Tbl_Idx &&
11619 exp_desc->foldable) {
11620
11621 CLEAR_TBL_NTRY(type_tbl, TYP_WORK_IDX);
11622 TYP_TYPE(TYP_WORK_IDX) = Character;
11623 TYP_CHAR_CLASS(TYP_WORK_IDX) = Const_Len_Char;
11624 TYP_FLD(TYP_WORK_IDX) = IL_FLD(list_idx),
11625 TYP_IDX(TYP_WORK_IDX) = IL_IDX(list_idx),
11626 TYP_LINEAR(TYP_WORK_IDX) = CHARACTER_DEFAULT_TYPE;
11627 exp_desc->type = Character;
11628 exp_desc->linear_type = TYP_LINEAR(TYP_WORK_IDX);
11629 exp_desc->type_idx = ntr_type_tbl();
11630
11631 OPND_FLD((*result_opnd)) = CN_Tbl_Idx;
11632 OPND_LINE_NUM((*result_opnd)) = line;
11633 OPND_COL_NUM((*result_opnd)) = col;
11634
11635
11636
11637 OPND_IDX((*result_opnd))= ntr_const_tbl(exp_desc->type_idx,
11638 TRUE,
11639 NULL);
11640
11641
11642 char_ptr1 = (char *)&CN_CONST(OPND_IDX((*result_opnd)));
11643 char_ptr2 = (char *)&CN_CONST(IR_IDX_L(ir_idx)) +
11644 CN_INT_TO_C(IL_IDX(IR_IDX_R(ir_idx))) - 1;
11645
11646 for (i=0; i < CN_INT_TO_C(IL_IDX(list_idx)); i++) {
11647 char_ptr1[i] = char_ptr2[i];
11648 }
11649
11650
11651
11652 while (i % TARGET_CHARS_PER_WORD != 0) {
11653 char_ptr1[i] = ' ';
11654 i++;
11655 }
11656
11657 if (compare_cn_and_value(TYP_IDX(exp_desc->type_idx),
11658 MAX_CHARS_IN_TYPELESS,
11659 Le_Opr)) {
11660 exp_desc->linear_type = Short_Char_Const;
11661 type_tbl[TYP_WORK_IDX] = type_tbl[exp_desc->type_idx];
11662 TYP_LINEAR(TYP_WORK_IDX)= Short_Char_Const;
11663 exp_desc->type_idx = ntr_type_tbl();
11664
11665 }
11666 }
11667 else if (ok &&
11668 IR_FLD_L(ir_idx) == CN_Tbl_Idx) {
11669
11670 stmt_expansion_control_start();
11671 save_defer_stmt_expansion = defer_stmt_expansion;
11672 defer_stmt_expansion = FALSE;
11673
11674
11675
11676
11677
11678 tmp_idx = gen_initialized_tmp(IR_IDX_L(ir_idx), line,col);
11679
11680 IR_FLD_L(ir_idx) = AT_Tbl_Idx;
11681 IR_IDX_L(ir_idx) = tmp_idx;
11682 IR_LINE_NUM_L(ir_idx) = line;
11683 IR_COL_NUM_L(ir_idx) = col;
11684
11685 COPY_OPND(opnd, IR_OPND_L(ir_idx));
11686 defer_stmt_expansion = save_defer_stmt_expansion;
11687 stmt_expansion_control_end(&opnd);
11688 COPY_OPND(IR_OPND_L(ir_idx), opnd);
11689 }
11690 }
11691
11692 number_of_functions += save_number_of_functions;
11693
11694 expr_mode = save_expr_mode;
11695 xref_state = save_xref_state;
11696 in_component_ref = save_in_component_ref;
11697
11698
11699 TRACE (Func_Exit, "substring_opr_handler", NULL);
11700
11701 return(ok);
11702
11703 }
11704
11705
11706
11707
11708
11709
11710
11711
11712
11713
11714
11715
11716
11717
11718
11719
11720
11721 static boolean triplet_opr_handler(opnd_type *result_opnd,
11722 expr_arg_type *exp_desc)
11723
11724 {
11725 expr_arg_type exp_desc_l;
11726 int ir_idx;
11727 int list_idx;
11728 boolean ok = TRUE;
11729 opnd_type opnd;
11730 int opnd_col;
11731 int opnd_line;
11732
11733
11734 TRACE (Func_Entry, "triplet_opr_handler" , NULL);
11735
11736 ir_idx = OPND_IDX((*result_opnd));
11737 in_call_list = FALSE;
11738
11739 exp_desc->constant = TRUE;
11740 exp_desc->foldable = TRUE;
11741 exp_desc->will_fold_later = TRUE;
11742
11743 list_idx = IR_IDX_L(ir_idx);
11744 COPY_OPND(opnd, IL_OPND(list_idx));
11745 exp_desc_l.rank = 0;
11746 ok = expr_sem(&opnd, &exp_desc_l);
11747 COPY_OPND(IL_OPND(list_idx), opnd);
11748
11749 IL_CONSTANT_SUBSCRIPT(list_idx) = exp_desc_l.foldable;
11750
11751 exp_desc->has_constructor = exp_desc_l.has_constructor;
11752 exp_desc->has_symbolic = exp_desc_l.has_symbolic;
11753
11754 if (IL_FLD(list_idx) != NO_Tbl_Idx) {
11755
11756 if (exp_desc_l.linear_type == Long_Typeless) {
11757 find_opnd_line_and_column((opnd_type *)
11758 &IL_OPND(list_idx),
11759 &opnd_line,
11760 &opnd_col);
11761 PRINTMSG(opnd_line, 1133, Error, opnd_col);
11762 ok = FALSE;
11763 }
11764 else if (exp_desc_l.rank > 0 ||
11765 (exp_desc_l.type != Integer &&
11766 exp_desc_l.type != Typeless)) {
11767
11768
11769
11770 ok = FALSE;
11771 find_opnd_line_and_column((opnd_type *)
11772 &IL_OPND(list_idx),
11773 &opnd_line,
11774 &opnd_col);
11775 PRINTMSG(opnd_line, 319, Error, opnd_col);
11776 }
11777 else if (exp_desc_l.linear_type == Short_Typeless_Const) {
11778 find_opnd_line_and_column((opnd_type *) &IL_OPND(list_idx),
11779 &opnd_line,
11780 &opnd_col);
11781 IL_IDX(list_idx) = cast_typeless_constant(IL_IDX(list_idx),
11782 INTEGER_DEFAULT_TYPE,
11783 opnd_line,
11784 opnd_col);
11785 exp_desc_l.type_idx = INTEGER_DEFAULT_TYPE;
11786 exp_desc_l.type = Integer;
11787 exp_desc_l.linear_type = INTEGER_DEFAULT_TYPE;
11788 }
11789
11790 exp_desc->constant = exp_desc_l.constant;
11791 exp_desc->foldable = exp_desc_l.foldable;
11792 exp_desc->will_fold_later = exp_desc_l.will_fold_later ||
11793 exp_desc_l.foldable;
11794 SHAPE_FOLDABLE(IL_OPND(list_idx)) = exp_desc_l.foldable;
11795 SHAPE_WILL_FOLD_LATER(IL_OPND(list_idx)) =
11796 exp_desc_l.will_fold_later;
11797
11798 #ifdef KEY
11799
11800
11801
11802
11803 #else
11804 if (in_io_list) {
11805
11806
11807
11808
11809 COPY_OPND(opnd, IL_OPND(list_idx));
11810 cast_to_cg_default(&opnd, &exp_desc_l);
11811 COPY_OPND(IL_OPND(list_idx), opnd);
11812 }
11813 #endif
11814 }
11815
11816
11817 list_idx = IL_NEXT_LIST_IDX(list_idx);
11818 exp_desc_l.rank = 0;
11819 COPY_OPND(opnd, IL_OPND(list_idx));
11820 ok &= expr_sem(&opnd, &exp_desc_l);
11821 COPY_OPND(IL_OPND(list_idx), opnd);
11822
11823 IL_CONSTANT_SUBSCRIPT(list_idx) = exp_desc_l.foldable;
11824
11825 exp_desc->has_symbolic |= exp_desc_l.has_symbolic;
11826 exp_desc->has_constructor |= exp_desc_l.has_constructor;
11827
11828 if (IL_FLD(list_idx) != NO_Tbl_Idx) {
11829
11830 if (exp_desc_l.linear_type == Long_Typeless) {
11831 find_opnd_line_and_column((opnd_type *)
11832 &IL_OPND(list_idx),
11833 &opnd_line,
11834 &opnd_col);
11835 PRINTMSG(opnd_line, 1133, Error, opnd_col);
11836 ok = FALSE;
11837 }
11838 else if (exp_desc_l.rank > 0 ||
11839 (exp_desc_l.type != Integer &&
11840 exp_desc_l.type != Typeless)) {
11841
11842
11843
11844 ok = FALSE;
11845 find_opnd_line_and_column((opnd_type *)
11846 &IL_OPND(list_idx),
11847 &opnd_line,
11848 &opnd_col);
11849 PRINTMSG(opnd_line, 319, Error, opnd_col);
11850 }
11851 else if (exp_desc_l.linear_type == Short_Typeless_Const) {
11852 find_opnd_line_and_column((opnd_type *) &IL_OPND(list_idx),
11853 &opnd_line,
11854 &opnd_col);
11855 IL_IDX(list_idx) = cast_typeless_constant(IL_IDX(list_idx),
11856 INTEGER_DEFAULT_TYPE,
11857 opnd_line,
11858 opnd_col);
11859 exp_desc_l.type_idx = INTEGER_DEFAULT_TYPE;
11860 exp_desc_l.type = Integer;
11861 exp_desc_l.linear_type = INTEGER_DEFAULT_TYPE;
11862 }
11863
11864 exp_desc->constant = exp_desc->constant && exp_desc_l.constant;
11865 exp_desc->foldable = exp_desc->foldable && exp_desc_l.foldable;
11866 exp_desc->will_fold_later &= (exp_desc_l.will_fold_later ||
11867 exp_desc_l.foldable);
11868 SHAPE_FOLDABLE(IL_OPND(list_idx)) = exp_desc_l.foldable;
11869 SHAPE_WILL_FOLD_LATER(IL_OPND(list_idx)) = exp_desc_l.will_fold_later;
11870
11871 #ifdef KEY
11872
11873
11874
11875
11876 #else
11877 if (in_io_list) {
11878
11879
11880
11881
11882 COPY_OPND(opnd, IL_OPND(list_idx));
11883 cast_to_cg_default(&opnd, &exp_desc_l);
11884 COPY_OPND(IL_OPND(list_idx), opnd);
11885
11886 }
11887 #endif
11888 }
11889
11890
11891 exp_desc_l.rank = 0;
11892 list_idx = IL_NEXT_LIST_IDX(list_idx);
11893 COPY_OPND(opnd, IL_OPND(list_idx));
11894 ok &= expr_sem(&opnd, &exp_desc_l);
11895 COPY_OPND(IL_OPND(list_idx), opnd);
11896
11897 IL_CONSTANT_SUBSCRIPT(list_idx) = exp_desc_l.foldable;
11898
11899 exp_desc->has_symbolic |= exp_desc_l.has_symbolic;
11900 exp_desc->has_constructor |= exp_desc_l.has_constructor;
11901
11902 if (IL_FLD(list_idx) != NO_Tbl_Idx) {
11903
11904 if (exp_desc_l.linear_type == Long_Typeless) {
11905 find_opnd_line_and_column((opnd_type *)
11906 &IL_OPND(list_idx),
11907 &opnd_line,
11908 &opnd_col);
11909 PRINTMSG(opnd_line, 1133, Error, opnd_col);
11910 ok = FALSE;
11911 }
11912 else if (exp_desc_l.rank > 0 ||
11913 (exp_desc_l.type != Integer &&
11914 exp_desc_l.type != Typeless)) {
11915
11916
11917
11918 ok = FALSE;
11919 find_opnd_line_and_column((opnd_type *)
11920 &IL_OPND(list_idx),
11921 &opnd_line,
11922 &opnd_col);
11923 PRINTMSG(opnd_line, 319, Error, opnd_col);
11924 }
11925 else if (exp_desc_l.linear_type == Short_Typeless_Const) {
11926 find_opnd_line_and_column((opnd_type *) &IL_OPND(list_idx),
11927 &opnd_line,
11928 &opnd_col);
11929 IL_IDX(list_idx) = cast_typeless_constant(IL_IDX(list_idx),
11930 INTEGER_DEFAULT_TYPE,
11931 opnd_line,
11932 opnd_col);
11933 exp_desc_l.type_idx = INTEGER_DEFAULT_TYPE;
11934 exp_desc_l.type = Integer;
11935 exp_desc_l.linear_type = INTEGER_DEFAULT_TYPE;
11936 }
11937
11938 exp_desc->constant = exp_desc->constant && exp_desc_l.constant;
11939 exp_desc->foldable = exp_desc->foldable && exp_desc_l.foldable;
11940 exp_desc->will_fold_later &= (exp_desc_l.will_fold_later ||
11941 exp_desc_l.foldable);
11942 SHAPE_FOLDABLE(IL_OPND(list_idx)) = exp_desc_l.foldable;
11943 SHAPE_WILL_FOLD_LATER(IL_OPND(list_idx)) = exp_desc_l.will_fold_later;
11944
11945 #ifdef KEY
11946
11947
11948
11949
11950 #else
11951 if (in_io_list) {
11952
11953
11954
11955
11956 COPY_OPND(opnd, IL_OPND(list_idx));
11957 cast_to_cg_default(&opnd, &exp_desc_l);
11958 COPY_OPND(IL_OPND(list_idx), opnd);
11959
11960 }
11961 #endif
11962 }
11963
11964 exp_desc->rank = 1;
11965 exp_desc->type = Integer;
11966 exp_desc->type_idx = CG_INTEGER_DEFAULT_TYPE;
11967 exp_desc->linear_type = TYP_LINEAR(exp_desc->type_idx);
11968
11969 IR_TYPE_IDX(ir_idx) = exp_desc->type_idx;
11970 IR_RANK(ir_idx) = exp_desc->rank;
11971
11972
11973 TRACE (Func_Exit, "triplet_opr_handler", NULL);
11974
11975 return(ok);
11976
11977 }
11978
11979
11980
11981
11982
11983
11984
11985
11986
11987
11988
11989
11990
11991
11992
11993
11994
11995 static boolean dealloc_obj_opr_handler(opnd_type *result_opnd,
11996 expr_arg_type *exp_desc,
11997 int rank_in)
11998
11999 {
12000 int attr_idx;
12001 int col;
12002 expr_arg_type exp_desc_l;
12003 int ir_idx;
12004 int line;
12005 boolean ok = TRUE;
12006 opnd_type opnd;
12007
12008 TRACE (Func_Entry, "dealloc_obj_opr_handler" , NULL);
12009
12010 ir_idx = OPND_IDX((*result_opnd));
12011 line = IR_LINE_NUM(ir_idx);
12012 col = IR_COL_NUM(ir_idx);
12013 in_call_list = FALSE;
12014
12015 exp_desc_l.rank = rank_in;
12016
12017 COPY_OPND(opnd, IR_OPND_L(ir_idx));
12018 insert_subs_ok = FALSE;
12019 pgm_unit_illegal = FALSE;
12020 ok = expr_sem(&opnd, &exp_desc_l);
12021 insert_subs_ok = TRUE;
12022 pgm_unit_illegal = TRUE;
12023 COPY_OPND(IR_OPND_L(ir_idx), opnd);
12024
12025 attr_idx = find_base_attr(&opnd, &line, &col);
12026
12027 if (attr_idx &&
12028 AT_OBJ_CLASS(attr_idx) == Data_Obj) {
12029
12030 exp_desc->type = exp_desc_l.type;
12031 exp_desc->linear_type = exp_desc_l.linear_type;
12032 exp_desc->type_idx = exp_desc_l.type_idx;
12033 exp_desc->rank = 0;
12034 exp_desc->constant = exp_desc_l.constant;
12035 exp_desc->foldable = exp_desc_l.foldable;
12036 exp_desc->reference = TRUE;
12037 exp_desc->component = exp_desc_l.component;
12038 exp_desc->has_symbolic= exp_desc_l.has_symbolic;
12039
12040 IR_TYPE_IDX(ir_idx) = exp_desc->type_idx;
12041 IR_RANK(ir_idx) = exp_desc->rank;
12042
12043 if (ATD_ARRAY_IDX(attr_idx) == NULL_IDX) {
12044
12045 if (! ATD_POINTER(attr_idx)) {
12046
12047 ok = FALSE;
12048 PRINTMSG(line, 428, Error, col);
12049 }
12050
12051 if (IR_FLD_R(ir_idx) != NO_Tbl_Idx) {
12052
12053 PRINTMSG(line, 975, Internal, col);
12054 }
12055
12056
12057 }
12058 else {
12059
12060 if (!ATD_POINTER(attr_idx) && !ATD_ALLOCATABLE(attr_idx)) {
12061
12062
12063 ok = FALSE;
12064 PRINTMSG(line, 428, Error, col);
12065 }
12066 }
12067 }
12068 else {
12069
12070 ok = FALSE;
12071 PRINTMSG(line, 428, Error, col);
12072 }
12073
12074
12075 TRACE (Func_Exit, "dealloc_obj_opr_handler", NULL);
12076
12077 return(ok);
12078
12079 }
12080
12081
12082
12083
12084
12085
12086
12087
12088
12089
12090
12091
12092
12093
12094
12095
12096
12097 static boolean alloc_obj_opr_handler(opnd_type *result_opnd,
12098 expr_arg_type *exp_desc,
12099 int rank_in)
12100
12101 {
12102 int attr_idx;
12103 int bd_idx;
12104 int col;
12105 expr_arg_type exp_desc_l;
12106 expr_arg_type exp_desc_r;
12107 int i;
12108 int ir_idx;
12109 int line;
12110 int listp_idx;
12111 int list_idx;
12112 boolean ok = TRUE;
12113 opnd_type opnd;
12114 int opnd_col;
12115 int opnd_line;
12116 int pe_bd_idx;
12117 boolean save_in_component_ref;
12118 cif_usage_code_type save_xref_state;
12119
12120
12121 TRACE (Func_Entry, "alloc_obj_opr_handler" , NULL);
12122
12123 ir_idx = OPND_IDX((*result_opnd));
12124 line = IR_LINE_NUM(ir_idx);
12125 col = IR_COL_NUM(ir_idx);
12126 in_call_list = FALSE;
12127
12128 exp_desc_l.rank = rank_in;
12129
12130 COPY_OPND(opnd, IR_OPND_L(ir_idx));
12131 insert_subs_ok = FALSE;
12132 pgm_unit_illegal = FALSE;
12133 ok = expr_sem(&opnd, &exp_desc_l);
12134 insert_subs_ok = TRUE;
12135 pgm_unit_illegal = TRUE;
12136 COPY_OPND(IR_OPND_L(ir_idx), opnd);
12137
12138 attr_idx = find_base_attr(&opnd, &line, &col);
12139
12140 if (attr_idx &&
12141 AT_OBJ_CLASS(attr_idx) == Data_Obj) {
12142
12143 exp_desc->type = exp_desc_l.type;
12144 exp_desc->linear_type = exp_desc_l.linear_type;
12145 exp_desc->type_idx = exp_desc_l.type_idx;
12146 exp_desc->rank = 0;
12147 exp_desc->constant = exp_desc_l.constant;
12148 exp_desc->foldable = exp_desc_l.foldable;
12149 exp_desc->reference = TRUE;
12150 exp_desc->component = exp_desc_l.component;
12151 exp_desc->has_symbolic= exp_desc_l.has_symbolic;
12152
12153 IR_TYPE_IDX(ir_idx) = exp_desc->type_idx;
12154 IR_RANK(ir_idx) = exp_desc->rank;
12155
12156 bd_idx = ATD_ARRAY_IDX(attr_idx);
12157 pe_bd_idx = ATD_PE_ARRAY_IDX(attr_idx);
12158
12159 if (bd_idx == NULL_IDX) {
12160
12161 if (! ATD_POINTER(attr_idx)) {
12162
12163 ok = FALSE;
12164 PRINTMSG(line, 201, Error, col);
12165 }
12166
12167 if (IR_FLD_R(ir_idx) != NO_Tbl_Idx) {
12168
12169 PRINTMSG(line, 975, Internal, col);
12170 }
12171
12172
12173 }
12174 else if (IR_FLD_R(ir_idx) == NO_Tbl_Idx) {
12175 ok = FALSE;
12176 PRINTMSG(line, 205, Error, col);
12177 }
12178 else if (pe_bd_idx &&
12179 BD_RANK(pe_bd_idx) + BD_RANK(bd_idx) != IR_LIST_CNT_R(ir_idx)) {
12180
12181 ok = FALSE;
12182 PRINTMSG(line, 402, Error, col);
12183 }
12184 else if (pe_bd_idx == NULL_IDX &&
12185 BD_RANK(ATD_ARRAY_IDX(attr_idx)) != IR_LIST_CNT_R(ir_idx)) {
12186 ok = FALSE;
12187 PRINTMSG(line, 402, Error, col);
12188 }
12189 else {
12190
12191 if (!ATD_POINTER(attr_idx) && !ATD_ALLOCATABLE(attr_idx)) {
12192
12193
12194 ok = FALSE;
12195 PRINTMSG(line, 201, Error, col);
12196 }
12197
12198
12199 list_idx = IR_IDX_R(ir_idx);
12200 save_xref_state = xref_state;
12201
12202 if (xref_state != CIF_No_Usage_Rec) {
12203 xref_state = CIF_Symbol_Reference;
12204 }
12205 save_in_component_ref = in_component_ref;
12206 in_component_ref = FALSE;
12207
12208 for (i = 1; i <= IR_LIST_CNT_R(ir_idx); i++) {
12209
12210 if (IL_FLD(list_idx) == IL_Tbl_Idx) {
12211
12212
12213
12214
12215 listp_idx = IL_IDX(list_idx);
12216
12217 exp_desc_r.rank = 0;
12218
12219 COPY_OPND(opnd, IL_OPND(listp_idx));
12220 ok &= expr_sem(&opnd, &exp_desc_r);
12221 COPY_OPND(IL_OPND(listp_idx), opnd);
12222
12223 if (exp_desc_r.linear_type == Long_Typeless) {
12224
12225 find_opnd_line_and_column((opnd_type *)
12226 &IL_OPND(listp_idx),
12227 &opnd_line,
12228 &opnd_col);
12229 PRINTMSG(opnd_line, 1133, Error, opnd_col);
12230 ok = FALSE;
12231 }
12232 else if ((exp_desc_r.type != Integer &&
12233 exp_desc_r.type != Typeless) ||
12234 exp_desc_r.rank != 0) {
12235
12236 find_opnd_line_and_column((opnd_type *)
12237 &IL_OPND(listp_idx),
12238 &opnd_line,
12239 &opnd_col);
12240 PRINTMSG(opnd_line, 403, Error, opnd_col);
12241 ok = FALSE;
12242 }
12243 else if (exp_desc_r.linear_type == Short_Typeless_Const) {
12244 find_opnd_line_and_column((opnd_type *) &IL_OPND(listp_idx),
12245 &opnd_line,
12246 &opnd_col);
12247 IL_IDX(listp_idx) = cast_typeless_constant(IL_IDX(listp_idx),
12248 INTEGER_DEFAULT_TYPE,
12249 opnd_line,
12250 opnd_col);
12251 exp_desc_r.type_idx = INTEGER_DEFAULT_TYPE;
12252 exp_desc_r.type = Integer;
12253 exp_desc_r.linear_type = INTEGER_DEFAULT_TYPE;
12254 }
12255
12256 exp_desc->constant = exp_desc->constant && exp_desc_r.constant;
12257 exp_desc->foldable = exp_desc->foldable && exp_desc_r.foldable;
12258
12259
12260
12261 listp_idx = IL_NEXT_LIST_IDX(listp_idx);
12262
12263 exp_desc_r.rank = 0;
12264
12265 COPY_OPND(opnd, IL_OPND(listp_idx));
12266 ok &= expr_sem(&opnd, &exp_desc_r);
12267 COPY_OPND(IL_OPND(listp_idx), opnd);
12268
12269 if (exp_desc_r.linear_type == Long_Typeless) {
12270 find_opnd_line_and_column((opnd_type *)
12271 &IL_OPND(listp_idx),
12272 &opnd_line,
12273 &opnd_col);
12274 PRINTMSG(opnd_line, 1133, Error, opnd_col);
12275 ok = FALSE;
12276 }
12277 else if ((exp_desc_r.type != Integer &&
12278 exp_desc_r.type != Typeless) ||
12279 exp_desc_r.rank != 0) {
12280
12281 find_opnd_line_and_column((opnd_type *)
12282 &IL_OPND(listp_idx),
12283 &opnd_line,
12284 &opnd_col);
12285 PRINTMSG(opnd_line, 403, Error, opnd_col);
12286 ok = FALSE;
12287 }
12288 else if (exp_desc_r.linear_type == Short_Typeless_Const) {
12289 find_opnd_line_and_column((opnd_type *) &IL_OPND(listp_idx),
12290 &opnd_line,
12291 &opnd_col);
12292 IL_IDX(listp_idx) = cast_typeless_constant(IL_IDX(listp_idx),
12293 INTEGER_DEFAULT_TYPE,
12294 opnd_line,
12295 opnd_col);
12296 exp_desc_r.type_idx = INTEGER_DEFAULT_TYPE;
12297 exp_desc_r.type = Integer;
12298 exp_desc_r.linear_type = INTEGER_DEFAULT_TYPE;
12299 }
12300
12301 exp_desc->constant = exp_desc->constant &&
12302 exp_desc_r.constant;
12303 exp_desc->foldable = exp_desc->foldable &&
12304 exp_desc_r.foldable;
12305
12306 }
12307 else {
12308
12309
12310 exp_desc_r.rank = 0;
12311
12312 COPY_OPND(opnd, IL_OPND(list_idx));
12313 ok &= expr_sem(&opnd, &exp_desc_r);
12314 COPY_OPND(IL_OPND(list_idx), opnd);
12315
12316
12317 if (exp_desc_r.linear_type == Long_Typeless) {
12318 find_opnd_line_and_column((opnd_type *)
12319 &IL_OPND(list_idx),
12320 &opnd_line,
12321 &opnd_col);
12322 PRINTMSG(opnd_line, 1133, Error, opnd_col);
12323
12324 ok = FALSE;
12325 }
12326 else if ((exp_desc_r.type != Integer &&
12327 exp_desc_r.type != Typeless) ||
12328 exp_desc_r.rank != 0) {
12329
12330 find_opnd_line_and_column((opnd_type *)
12331 &IL_OPND(list_idx),
12332 &opnd_line,
12333 &opnd_col);
12334 PRINTMSG(opnd_line, 403, Error, opnd_col);
12335
12336 ok = FALSE;
12337 }
12338 else if (exp_desc_r.linear_type == Short_Typeless_Const) {
12339 find_opnd_line_and_column((opnd_type *) &IL_OPND(list_idx),
12340 &opnd_line,
12341 &opnd_col);
12342 IL_IDX(list_idx) = cast_typeless_constant(IL_IDX(list_idx),
12343 INTEGER_DEFAULT_TYPE,
12344 opnd_line,
12345 opnd_col);
12346 exp_desc_r.type_idx = INTEGER_DEFAULT_TYPE;
12347 exp_desc_r.type = Integer;
12348 exp_desc_r.linear_type = INTEGER_DEFAULT_TYPE;
12349 }
12350
12351 exp_desc->constant = exp_desc->constant && exp_desc_r.constant;
12352 exp_desc->foldable = exp_desc->foldable && exp_desc_r.foldable;
12353 }
12354
12355 list_idx = IL_NEXT_LIST_IDX(list_idx);
12356
12357 }
12358
12359 xref_state = save_xref_state;
12360 in_component_ref = save_in_component_ref;
12361
12362 }
12363 }
12364 else {
12365
12366 ok = FALSE;
12367 PRINTMSG(line, 201, Error, col);
12368 }
12369
12370
12371 TRACE (Func_Exit, "alloc_obj_opr_handler", NULL);
12372
12373 return(ok);
12374
12375 }
12376
12377
12378
12379
12380
12381
12382
12383
12384
12385
12386
12387
12388
12389
12390
12391
12392
12393 static boolean cvrt_opr_handler(opnd_type *result_opnd,
12394 expr_arg_type *exp_desc)
12395
12396 {
12397 expr_arg_type exp_desc_l;
12398 long_type folded_const[MAX_WORDS_FOR_NUMERIC];
12399 int ir_idx;
12400 boolean ok = TRUE;
12401 opnd_type opnd;
12402 int type_idx;
12403
12404
12405 TRACE (Func_Entry, "cvrt_opr_handler" , NULL);
12406
12407 ir_idx = OPND_IDX((*result_opnd));
12408
12409 COPY_OPND(opnd, IR_OPND_L(ir_idx));
12410 exp_desc_l.rank = 0;
12411 ok = expr_sem(&opnd, &exp_desc_l);
12412 COPY_OPND(IR_OPND_L(ir_idx), opnd);
12413
12414 exp_desc->has_constructor = exp_desc_l.has_constructor;
12415
12416 exp_desc->has_symbolic = exp_desc_l.has_symbolic;
12417 exp_desc->constant = exp_desc_l.constant;
12418 exp_desc->foldable = exp_desc_l.foldable;
12419 exp_desc->will_fold_later = exp_desc_l.will_fold_later;
12420 exp_desc->rank = exp_desc_l.rank;
12421 exp_desc->type = TYP_TYPE(IR_TYPE_IDX(ir_idx));
12422 exp_desc->type_idx = IR_TYPE_IDX(ir_idx);
12423 exp_desc->linear_type = TYP_LINEAR(IR_TYPE_IDX(ir_idx));
12424
12425 COPY_SHAPE(exp_desc->shape,exp_desc_l.shape,exp_desc_l.rank);
12426 COPY_OPND(exp_desc->char_len, exp_desc_l.char_len);
12427
12428 if (exp_desc_l.linear_type == exp_desc->linear_type) {
12429
12430 COPY_OPND((*result_opnd), IR_OPND_L(ir_idx));
12431 }
12432 else if (opt_flags.ieeeconform &&
12433 ! comp_gen_expr &&
12434 (exp_desc_l.type == Real ||
12435 exp_desc_l.type == Complex)) {
12436
12437
12438
12439 exp_desc->foldable = FALSE;
12440 exp_desc->will_fold_later = FALSE;
12441 }
12442 else if (exp_desc->foldable &&
12443 IR_FLD_L(ir_idx) == CN_Tbl_Idx &&
12444 exp_desc_l.type == Typeless) {
12445
12446 OPND_FLD((*result_opnd)) = CN_Tbl_Idx;
12447 OPND_IDX((*result_opnd)) = cast_typeless_constant(IR_IDX_L(ir_idx),
12448 exp_desc->type_idx,
12449 IR_LINE_NUM(ir_idx),
12450 IR_COL_NUM(ir_idx));
12451 OPND_LINE_NUM((*result_opnd)) = IR_LINE_NUM(ir_idx);
12452 OPND_COL_NUM((*result_opnd)) = IR_COL_NUM(ir_idx);
12453 }
12454 else if (exp_desc->foldable &&
12455 IR_FLD_L(ir_idx) == CN_Tbl_Idx) {
12456
12457 type_idx = exp_desc->type_idx;
12458
12459 if (folder_driver((char *)&CN_CONST(IR_IDX_L(ir_idx)),
12460 exp_desc_l.type_idx,
12461 NULL,
12462 NULL_IDX,
12463 folded_const,
12464 &type_idx,
12465 IR_LINE_NUM(ir_idx),
12466 IR_COL_NUM(ir_idx),
12467 1,
12468 Cvrt_Opr)) {
12469
12470 exp_desc->type_idx = type_idx;
12471 OPND_FLD((*result_opnd)) = CN_Tbl_Idx;
12472 OPND_IDX((*result_opnd)) = ntr_const_tbl(exp_desc->type_idx,
12473 FALSE,
12474 folded_const);
12475
12476 OPND_LINE_NUM((*result_opnd)) = IR_LINE_NUM(ir_idx);
12477 OPND_COL_NUM((*result_opnd)) = IR_COL_NUM(ir_idx);
12478 }
12479 else {
12480 ok = FALSE;
12481 }
12482 }
12483
12484
12485 TRACE (Func_Exit, "cvrt_opr_handler", NULL);
12486
12487 return(ok);
12488
12489 }
12490
12491
12492
12493
12494
12495
12496
12497
12498
12499
12500
12501
12502
12503
12504
12505
12506
12507 static boolean paren_opr_handler(opnd_type *result_opnd,
12508 expr_arg_type *exp_desc)
12509
12510 {
12511 expr_arg_type exp_desc_l;
12512 int ir_idx;
12513 boolean ok = TRUE;
12514 opnd_type opnd;
12515
12516
12517 TRACE (Func_Entry, "paren_opr_handler" , NULL);
12518
12519 ir_idx = OPND_IDX((*result_opnd));
12520 in_call_list = FALSE;
12521
12522 COPY_OPND(opnd, IR_OPND_L(ir_idx));
12523 exp_desc_l.rank = 0;
12524 ok = expr_sem(&opnd, &exp_desc_l);
12525 COPY_OPND(IR_OPND_L(ir_idx), opnd);
12526
12527
12528 exp_desc->has_constructor = exp_desc_l.has_constructor;
12529
12530 exp_desc->has_symbolic = exp_desc_l.has_symbolic;
12531 exp_desc->constant = exp_desc_l.constant;
12532 exp_desc->foldable = exp_desc_l.foldable;
12533 exp_desc->will_fold_later = exp_desc_l.will_fold_later;
12534 exp_desc->rank = exp_desc_l.rank;
12535 exp_desc->type = exp_desc_l.type;
12536 exp_desc->type_idx = exp_desc_l.type_idx;
12537 exp_desc->linear_type = exp_desc_l.linear_type;
12538 exp_desc->vector_subscript = exp_desc_l.vector_subscript;
12539
12540 COPY_SHAPE(exp_desc->shape,exp_desc_l.shape,exp_desc_l.rank);
12541 COPY_OPND(exp_desc->char_len, exp_desc_l.char_len);
12542
12543 if (exp_desc_l.constant) {
12544
12545 COPY_OPND((*result_opnd), opnd);
12546
12547 }
12548 else if (IR_FLD_L(ir_idx) == IR_Tbl_Idx &&
12549 IR_OPR(IR_IDX_L(ir_idx)) == Concat_Opr) {
12550
12551 COPY_OPND((*result_opnd), opnd);
12552
12553 }
12554 else if (IR_FLD_L(ir_idx) == IR_Tbl_Idx &&
12555 IR_OPR(IR_IDX_L(ir_idx)) == Paren_Opr) {
12556
12557
12558
12559 COPY_OPND(IR_OPND_L(ir_idx), IR_OPND_L(IR_IDX_L(ir_idx)));
12560 IR_RANK(ir_idx) = exp_desc_l.rank;
12561
12562 if (IR_RANK(ir_idx)) {
12563 IR_ARRAY_SYNTAX(ir_idx) = TRUE;
12564 }
12565
12566 IR_TYPE_IDX(ir_idx) = exp_desc->type_idx;
12567 }
12568 else {
12569 IR_RANK(ir_idx) = exp_desc_l.rank;
12570
12571 if (IR_RANK(ir_idx)) {
12572 IR_ARRAY_SYNTAX(ir_idx) = TRUE;
12573 }
12574
12575 IR_TYPE_IDX(ir_idx) = exp_desc->type_idx;
12576 }
12577
12578
12579 TRACE (Func_Exit, "paren_opr_handler", NULL);
12580
12581 return(ok);
12582
12583 }
12584
12585
12586
12587
12588
12589
12590
12591
12592
12593
12594
12595
12596
12597
12598
12599
12600
12601 static boolean stmt_func_call_opr_handler(opnd_type *result_opnd,
12602 expr_arg_type *exp_desc)
12603
12604 {
12605 int asg_idx;
12606 int col;
12607 int dummy_idx;
12608 expr_arg_type exp_desc_l;
12609 expr_arg_type exp_desc_r;
12610 int i;
12611 int ir_idx;
12612 int line;
12613 int list_idx;
12614 int loc_info_idx;
12615 char l_err_word[40];
12616 opnd_type l_opnd;
12617 boolean ok = TRUE;
12618 opnd_type opnd;
12619 int opnd_col;
12620 int opnd_line;
12621 int paren_idx;
12622 char r_err_word[40];
12623 int save_arg_info_list_base;
12624 expr_mode_type save_expr_mode;
12625 boolean save_defer_stmt_expansion;
12626 int save_number_of_functions;
12627 boolean save_tree_has_ranf;
12628 boolean save_io_item_must_flatten;
12629 boolean save_check_type_conversion;
12630 int save_target_type_idx;
12631 int save_target_char_len_idx;
12632 int sn_idx;
12633 int stmt_func_idx;
12634 opnd_type stmt_func_opnd;
12635 int tmp_idx;
12636 int type_idx;
12637
12638
12639 TRACE (Func_Entry, "stmt_func_call_opr_handler" , NULL);
12640
12641 stmt_expansion_control_start();
12642 save_defer_stmt_expansion = defer_stmt_expansion;
12643 defer_stmt_expansion = FALSE;
12644
12645 ir_idx = OPND_IDX((*result_opnd));
12646 line = IR_LINE_NUM(ir_idx);
12647 col = IR_COL_NUM(ir_idx);
12648 save_io_item_must_flatten = io_item_must_flatten;
12649
12650
12651
12652 save_tree_has_ranf = tree_has_ranf;
12653
12654 COPY_OPND(opnd, IR_OPND_L(ir_idx));
12655 ok = expr_sem(&opnd, exp_desc);
12656 COPY_OPND(IR_OPND_L(ir_idx), opnd);
12657 stmt_func_idx = IR_IDX_L(ir_idx);
12658
12659 if (! ATS_SF_SEMANTICS_DONE(stmt_func_idx)) {
12660 ok = stmt_func_semantics(stmt_func_idx) && ok;
12661 }
12662
12663 if (AT_DCL_ERR(stmt_func_idx)) {
12664
12665 ok = FALSE;
12666 goto EXIT;
12667 }
12668
12669 if (ATS_SF_ACTIVE(stmt_func_idx)) {
12670
12671
12672
12673 find_opnd_line_and_column(&opnd,
12674 &opnd_line,
12675 &opnd_col);
12676 PRINTMSG(opnd_line, 753, Error, opnd_col,
12677 AT_OBJ_NAME_PTR(stmt_func_idx));
12678 ok = FALSE;
12679 AT_DCL_ERR(stmt_func_idx) = TRUE;
12680 goto EXIT;
12681 }
12682
12683 if (ATP_NUM_DARGS(stmt_func_idx) != IR_LIST_CNT_R(ir_idx)) {
12684
12685 find_opnd_line_and_column((opnd_type *) &IR_OPND_L(ir_idx),
12686 &opnd_line,
12687 &opnd_col);
12688 PRINTMSG(opnd_line, 754, Error, opnd_col,
12689 AT_OBJ_NAME_PTR(stmt_func_idx));
12690 ok = FALSE;
12691 goto EXIT;
12692 }
12693
12694
12695
12696
12697 if (max_call_list_size >= arg_list_size) {
12698 enlarge_call_list_tables();
12699 }
12700
12701 save_arg_info_list_base = arg_info_list_base;
12702
12703 arg_info_list_base = arg_info_list_top;
12704
12705 arg_info_list_top = arg_info_list_base +
12706 IR_LIST_CNT_R(ir_idx);
12707
12708 if (arg_info_list_top >= arg_info_list_size) {
12709 enlarge_info_list_table();
12710 }
12711 loc_info_idx = arg_info_list_base;
12712
12713
12714
12715 list_idx = IR_IDX_R(ir_idx);
12716 sn_idx = ATP_FIRST_IDX(stmt_func_idx);
12717
12718 for (i = loc_info_idx + 1;
12719 i <= loc_info_idx + IR_LIST_CNT_R(ir_idx);
12720 i++) {
12721
12722 dummy_idx = SN_ATTR_IDX(sn_idx);
12723
12724 save_number_of_functions = number_of_functions;
12725 tree_has_ranf = FALSE;
12726 COPY_OPND(opnd, IL_OPND(list_idx));
12727 exp_desc_r.rank = 0;
12728 ok = expr_sem(&opnd, &exp_desc_r) && ok;
12729 COPY_OPND(IL_OPND(list_idx), opnd);
12730
12731 exp_desc_r.tree_has_ranf = tree_has_ranf;
12732 arg_info_list[i] = init_arg_info;
12733 arg_info_list[i].ed = exp_desc_r;
12734
12735 IL_ARG_DESC_VARIANT(list_idx) = TRUE;
12736 IL_ARG_DESC_IDX(list_idx) = i;
12737
12738
12739
12740 type_idx = ATD_TYPE_IDX(dummy_idx);
12741
12742 find_opnd_line_and_column(&opnd, &opnd_line, &opnd_col);
12743
12744 if (OPND_FLD(opnd) == AT_Tbl_Idx &&
12745 AT_OBJ_CLASS(OPND_IDX(opnd)) != Data_Obj &&
12746 fnd_semantic_err(Obj_Sf_Actual_Arg,
12747 opnd_line,
12748 opnd_col,
12749 OPND_IDX(opnd),
12750 TRUE)) {
12751
12752 ok = FALSE;
12753 }
12754 else {
12755
12756 if (exp_desc_r.rank > 0) {
12757 PRINTMSG(opnd_line, 750, Error, opnd_col,
12758 i - loc_info_idx,
12759 AT_OBJ_NAME_PTR(stmt_func_idx));
12760 ok = FALSE;
12761 }
12762
12763 if (exp_desc_r.linear_type == Typeless_4 ||
12764 exp_desc_r.linear_type == Typeless_8 ||
12765 exp_desc_r.linear_type == Short_Typeless_Const) {
12766
12767 if (ASG_TYPE(TYP_LINEAR(type_idx),
12768 exp_desc_r.linear_type) == Err_Res) {
12769 r_err_word[0] = '\0';
12770 l_err_word[0] = '\0';
12771
12772 strcat(r_err_word,
12773 get_basic_type_str(exp_desc_r.type_idx));
12774 strcat(l_err_word, get_basic_type_str(type_idx));
12775
12776 PRINTMSG(opnd_line, 751, Error, opnd_col,
12777 r_err_word,
12778 AT_OBJ_NAME_PTR(dummy_idx),
12779 l_err_word);
12780 ok = FALSE;
12781 }
12782 else if (exp_desc_r.linear_type == Short_Typeless_Const) {
12783 OPND_IDX(opnd) = cast_typeless_constant(OPND_IDX(opnd),
12784 type_idx,
12785 opnd_line,
12786 opnd_col);
12787 exp_desc_r.linear_type = TYP_LINEAR(type_idx);
12788 exp_desc_r.type_idx = type_idx;
12789 exp_desc_r.type = TYP_TYPE(type_idx);
12790
12791 arg_info_list[i].ed = exp_desc_r;
12792 }
12793 }
12794 else if (exp_desc_r.type != TYP_TYPE(type_idx) ||
12795 (exp_desc_r.type == Structure &&
12796 !compare_derived_types(exp_desc_r.type_idx,
12797 type_idx))) {
12798
12799 r_err_word[0] = '\0';
12800 l_err_word[0] = '\0';
12801
12802 strcat(r_err_word,
12803 get_basic_type_str(exp_desc_r.type_idx));
12804 strcat(l_err_word, get_basic_type_str(type_idx));
12805
12806 PRINTMSG(opnd_line, 751, Error, opnd_col,
12807 r_err_word,
12808 AT_OBJ_NAME_PTR(dummy_idx),
12809 l_err_word);
12810
12811 ok = FALSE;
12812 }
12813 else if (exp_desc_r.type != Structure &&
12814 exp_desc_r.type != Character &&
12815 exp_desc_r.linear_type != TYP_LINEAR(type_idx)) {
12816
12817 PRINTMSG(opnd_line, 752, Error, opnd_col,
12818 i - loc_info_idx,
12819 AT_OBJ_NAME_PTR(stmt_func_idx));
12820 ok = FALSE;
12821 }
12822 }
12823
12824 IL_HAS_FUNCTIONS(list_idx) = FALSE;
12825
12826 if (number_of_functions > save_number_of_functions) {
12827 IL_HAS_FUNCTIONS(list_idx) = TRUE;
12828 }
12829
12830 if (tree_has_ranf ||
12831 (exp_desc_r.type == Character &&
12832 TYP_TYPE(type_idx) == Character)) {
12833
12834 ok &= validate_char_len(&opnd, &exp_desc_r);
12835 arg_info_list[i].ed = exp_desc_r;
12836
12837 if (TYP_TYPE(type_idx) == Character &&
12838 exp_desc_r.char_len.fld == CN_Tbl_Idx &&
12839 TYP_FLD(type_idx) == CN_Tbl_Idx &&
12840 fold_relationals(exp_desc_r.char_len.idx,
12841 TYP_IDX(type_idx),
12842 Lt_Opr)) {
12843
12844 if (IL_FLD(list_idx) == CN_Tbl_Idx) {
12845 PRINTMSG(opnd_line, 1305, Caution, opnd_col);
12846 PRINTMSG(opnd_line, 1306, Ansi, opnd_col);
12847 cast_to_type_idx(&opnd, &exp_desc_r, type_idx);
12848 arg_info_list[i].ed = exp_desc_r;
12849 COPY_OPND(IL_OPND(list_idx), opnd);
12850 }
12851 else {
12852
12853
12854 PRINTMSG(opnd_line, 848, Error, opnd_col,
12855 AT_OBJ_NAME_PTR(dummy_idx));
12856 ok = FALSE;
12857 }
12858 }
12859
12860 if (! ok) {
12861
12862 }
12863 else if (TYP_TYPE(type_idx) == Character &&
12864 exp_desc_r.type == Character &&
12865 TYP_FLD(type_idx) == CN_Tbl_Idx &&
12866 OPND_FLD(opnd) == CN_Tbl_Idx) {
12867
12868 save_check_type_conversion = check_type_conversion;
12869 save_target_type_idx = target_type_idx;
12870 save_target_char_len_idx = target_char_len_idx;
12871
12872 check_type_conversion = TRUE;
12873 target_type_idx = Character_1;
12874
12875 target_char_len_idx = TYP_IDX(type_idx);
12876 fold_aggragate_expression(&opnd, &exp_desc_r, TRUE);
12877 COPY_OPND(IL_OPND(list_idx), opnd);
12878
12879 check_type_conversion = save_check_type_conversion;
12880 target_type_idx = save_target_type_idx;
12881 target_char_len_idx = save_target_char_len_idx;
12882
12883 arg_info_list[i].arg_opnd.fld = OPND_FLD(opnd);
12884 arg_info_list[i].arg_opnd.idx = OPND_IDX(opnd);
12885 arg_info_list[i].ed = exp_desc_r;
12886 }
12887 else if (no_func_expansion) {
12888 arg_info_list[i].arg_opnd.fld = OPND_FLD(opnd);
12889 arg_info_list[i].arg_opnd.idx = OPND_IDX(opnd);
12890 }
12891 else if (tree_has_ranf ||
12892 TYP_TYPE(type_idx) == Character) {
12893
12894 arg_info_list[i].ed.type_idx = type_idx;
12895 arg_info_list[i].ed.type = TYP_TYPE(type_idx);
12896 arg_info_list[i].ed.linear_type = TYP_LINEAR(type_idx);
12897 arg_info_list[i].ed.constant = FALSE;
12898 arg_info_list[i].ed.foldable = FALSE;
12899 arg_info_list[i].ed.will_fold_later = FALSE;
12900
12901 if (TYP_TYPE(type_idx) == Character) {
12902 arg_info_list[i].ed.char_len.fld = TYP_FLD(type_idx);
12903 arg_info_list[i].ed.char_len.idx = TYP_IDX(type_idx);
12904 OPND_LINE_NUM(arg_info_list[i].ed.char_len) = line;
12905 OPND_COL_NUM(arg_info_list[i].ed.char_len) = col;
12906 }
12907
12908 tmp_idx = create_tmp_asg(&opnd,
12909 &arg_info_list[i].ed,
12910 &l_opnd,
12911 Intent_In,
12912 FALSE,
12913 FALSE);
12914
12915 arg_info_list[i].arg_opnd.fld = AT_Tbl_Idx;
12916 arg_info_list[i].arg_opnd.idx = tmp_idx;
12917
12918 COPY_OPND(opnd, l_opnd);
12919 }
12920 }
12921 else {
12922 arg_info_list[i].arg_opnd.fld = OPND_FLD(opnd);
12923 arg_info_list[i].arg_opnd.idx = OPND_IDX(opnd);
12924 }
12925
12926
12927
12928
12929 if (! no_func_expansion &&
12930 arg_info_list[i].arg_opnd.fld == IR_Tbl_Idx &&
12931 IR_OPR(arg_info_list[i].arg_opnd.idx) != Whole_Subscript_Opr &&
12932 IR_OPR(arg_info_list[i].arg_opnd.idx) != Section_Subscript_Opr &&
12933 IR_OPR(arg_info_list[i].arg_opnd.idx) != Subscript_Opr &&
12934 IR_OPR(arg_info_list[i].arg_opnd.idx) != Substring_Opr &&
12935 IR_OPR(arg_info_list[i].arg_opnd.idx) != Whole_Substring_Opr &&
12936 IR_OPR(arg_info_list[i].arg_opnd.idx) != Dv_Deref_Opr &&
12937 IR_OPR(arg_info_list[i].arg_opnd.idx) != Struct_Opr &&
12938 IR_OPR(arg_info_list[i].arg_opnd.idx) != Paren_Opr) {
12939
12940 NTR_IR_TBL(paren_idx);
12941 IR_OPR(paren_idx) = Paren_Opr;
12942 IR_TYPE_IDX(paren_idx) = arg_info_list[i].ed.type_idx;
12943 IR_LINE_NUM(paren_idx) = opnd_line;
12944 IR_COL_NUM(paren_idx) = opnd_col;
12945 COPY_OPND(IR_OPND_L(paren_idx), arg_info_list[i].arg_opnd);
12946 arg_info_list[i].arg_opnd.fld = IR_Tbl_Idx;
12947 arg_info_list[i].arg_opnd.idx = paren_idx;
12948 }
12949
12950 sn_idx++;
12951 list_idx = IL_NEXT_LIST_IDX(list_idx);
12952 }
12953
12954
12955
12956
12957 sn_idx = ATP_FIRST_IDX(stmt_func_idx);
12958
12959 for (i = loc_info_idx + 1;
12960 i <= loc_info_idx + IR_LIST_CNT_R(ir_idx);
12961 i++) {
12962
12963 dummy_idx = SN_ATTR_IDX(sn_idx);
12964 ATD_SF_LINK(dummy_idx) = i;
12965
12966 ATD_FLD(dummy_idx) = arg_info_list[i].arg_opnd.fld;
12967 ATD_SF_ARG_IDX(dummy_idx) = arg_info_list[i].arg_opnd.idx;
12968
12969 sn_idx++;
12970 list_idx = IL_NEXT_LIST_IDX(list_idx);
12971 }
12972
12973 if (! ok) {
12974 goto EXIT;
12975 }
12976
12977 OPND_LINE_NUM(stmt_func_opnd)= line;
12978 OPND_COL_NUM(stmt_func_opnd) = col;
12979 OPND_FLD(stmt_func_opnd) = (fld_type) ATS_SF_FLD(stmt_func_idx);
12980 OPND_IDX(stmt_func_opnd) = ATS_SF_IDX(stmt_func_idx);
12981 copy_subtree(&stmt_func_opnd, &stmt_func_opnd);
12982
12983
12984
12985 ATS_SF_ACTIVE(stmt_func_idx) = TRUE;
12986
12987 save_expr_mode = expr_mode;
12988 expr_mode = Stmt_Func_Expr;
12989
12990 exp_desc_l.rank = 0;
12991 ok = expr_sem(&stmt_func_opnd, &exp_desc_l)
12992 && ok;
12993
12994 expr_mode = save_expr_mode;
12995
12996 exp_desc->has_symbolic = exp_desc_l.has_symbolic;
12997 exp_desc->has_constructor = exp_desc_l.has_constructor;
12998 exp_desc->constant = exp_desc_l.constant;
12999 exp_desc->foldable = exp_desc_l.foldable;
13000 exp_desc->will_fold_later = exp_desc_l.will_fold_later;
13001
13002 type_idx = ATD_TYPE_IDX(stmt_func_idx);
13003
13004 exp_desc->type_idx = ATD_TYPE_IDX(stmt_func_idx);
13005 exp_desc->type = TYP_TYPE(exp_desc->type_idx);
13006 exp_desc->linear_type = TYP_LINEAR(exp_desc->type_idx);
13007
13008 if (exp_desc->type == Character) {
13009 exp_desc->char_len.fld = TYP_FLD(exp_desc->type_idx);
13010 exp_desc->char_len.idx = TYP_IDX(exp_desc->type_idx);
13011 OPND_LINE_NUM(exp_desc->char_len) = line;
13012 OPND_COL_NUM(exp_desc->char_len) = col;
13013 }
13014
13015 if (ok &&
13016 ASG_EXTN(exp_desc->linear_type, exp_desc_l.linear_type) &&
13017 (exp_desc_l.type == Character ||
13018 exp_desc_l.linear_type == Short_Typeless_Const)) {
13019 find_opnd_line_and_column(&stmt_func_opnd,
13020 &opnd_line,
13021 &opnd_col);
13022 if (exp_desc_l.type == Character) {
13023 PRINTMSG(opnd_line, 161, Ansi, opnd_col);
13024 }
13025
13026
13027 OPND_IDX(stmt_func_opnd) =
13028 cast_typeless_constant(OPND_IDX(stmt_func_opnd),
13029 type_idx,
13030 opnd_line,
13031 opnd_col);
13032
13033 exp_desc_l.type_idx = type_idx;
13034 exp_desc_l.type = TYP_TYPE(type_idx);
13035 exp_desc_l.linear_type = TYP_LINEAR(type_idx);
13036 }
13037 else if (ok &&
13038 TYP_TYPE(type_idx) != Character &&
13039 TYP_TYPE(type_idx) != Structure &&
13040 TYP_LINEAR(type_idx) != exp_desc_l.linear_type) {
13041
13042 cast_to_type_idx(&stmt_func_opnd,
13043 &exp_desc_l,
13044 exp_desc->type_idx);
13045 }
13046
13047 if (! ok) {
13048
13049 }
13050 else if (TYP_TYPE(type_idx) == Character &&
13051 exp_desc_l.type == Character &&
13052 TYP_FLD(type_idx) == CN_Tbl_Idx &&
13053 TYP_FLD(exp_desc_l.type_idx) == CN_Tbl_Idx &&
13054 fold_relationals(TYP_IDX(type_idx),
13055 TYP_IDX(exp_desc_l.type_idx),
13056 Eq_Opr)) {
13057
13058
13059 }
13060 else if (TYP_TYPE(type_idx) == Character &&
13061 exp_desc_l.type == Character &&
13062 TYP_FLD(type_idx) == CN_Tbl_Idx &&
13063 OPND_FLD(stmt_func_opnd) == CN_Tbl_Idx) {
13064
13065 save_check_type_conversion = check_type_conversion;
13066 save_target_type_idx = target_type_idx;
13067 save_target_char_len_idx = target_char_len_idx;
13068
13069 check_type_conversion = TRUE;
13070 target_type_idx = Character_1;
13071 target_char_len_idx = TYP_IDX(type_idx);
13072 fold_aggragate_expression(&stmt_func_opnd, &exp_desc_l, TRUE);
13073
13074 check_type_conversion = save_check_type_conversion;
13075 target_type_idx = save_target_type_idx;
13076 target_char_len_idx = save_target_char_len_idx;
13077 }
13078 else if (! no_func_expansion &&
13079 TYP_TYPE(type_idx) == Character) {
13080
13081
13082
13083 GEN_COMPILER_TMP_ASG(asg_idx,
13084 tmp_idx,
13085 TRUE,
13086 line,
13087 col,
13088 type_idx,
13089 Priv);
13090
13091 COPY_OPND(IR_OPND_R(asg_idx), stmt_func_opnd);
13092 OPND_FLD(opnd) = AT_Tbl_Idx;
13093 OPND_IDX(opnd) = tmp_idx;
13094 OPND_LINE_NUM(opnd) = line;
13095 OPND_COL_NUM(opnd) = col;
13096 ok = gen_whole_substring(&opnd, 0);
13097 COPY_OPND(IR_OPND_L(asg_idx), opnd);
13098
13099
13100 exp_desc->constant = FALSE;
13101 exp_desc->foldable = FALSE;
13102 exp_desc->will_fold_later = FALSE;
13103
13104
13105 gen_sh(Before, Assignment_Stmt, line, col,
13106 FALSE, FALSE, TRUE);
13107 SH_IR_IDX(SH_PREV_IDX(curr_stmt_sh_idx)) = asg_idx;
13108 SH_P2_SKIP_ME(SH_PREV_IDX(curr_stmt_sh_idx)) = TRUE;
13109
13110 COPY_OPND(stmt_func_opnd, IR_OPND_L(asg_idx));
13111 }
13112
13113
13114 COPY_OPND((*result_opnd), stmt_func_opnd);
13115
13116 if (OPND_FLD((*result_opnd)) != CN_Tbl_Idx &&
13117 ! exp_desc->reference &&
13118 ! exp_desc->tmp_reference) {
13119
13120
13121
13122
13123 NTR_IR_TBL(paren_idx);
13124 IR_OPR(paren_idx) = Paren_Opr;
13125 IR_TYPE_IDX(paren_idx) = exp_desc->type_idx;
13126 IR_LINE_NUM(paren_idx) = line;
13127 IR_COL_NUM(paren_idx) = col;
13128
13129 COPY_OPND(IR_OPND_L(paren_idx), (*result_opnd));
13130 OPND_FLD((*result_opnd)) = IR_Tbl_Idx;
13131 OPND_IDX((*result_opnd)) = paren_idx;
13132 }
13133
13134
13135
13136 ATS_SF_ACTIVE(stmt_func_idx) = FALSE;
13137
13138
13139
13140 arg_info_list_top = arg_info_list_base;
13141 arg_info_list_base = save_arg_info_list_base;
13142
13143 if (TYP_TYPE(type_idx) == Character) {
13144 io_item_must_flatten = save_io_item_must_flatten;
13145 }
13146
13147 EXIT:
13148
13149 defer_stmt_expansion = save_defer_stmt_expansion;
13150 stmt_expansion_control_end(result_opnd);
13151
13152 TRACE (Func_Exit, "stmt_func_call_opr_handler", NULL);
13153
13154 return(ok);
13155
13156 }
13157
13158
13159
13160
13161
13162
13163
13164
13165
13166
13167
13168
13169
13170
13171
13172
13173
13174 boolean check_substring_bounds(int ir_idx)
13175
13176 {
13177 int base_attr;
13178 int col;
13179 int line;
13180 boolean ok = TRUE;
13181 int type_idx;
13182
13183 TRACE (Func_Entry, "check_substring_bounds", NULL);
13184
13185 if (IR_FLD_L(ir_idx) == CN_Tbl_Idx) {
13186 type_idx = CN_TYPE_IDX(IR_IDX_L(ir_idx));
13187 }
13188 else {
13189 base_attr = find_base_attr(&(IR_OPND_L(ir_idx)), &line, &col);
13190 type_idx = ATD_TYPE_IDX(base_attr);
13191 }
13192
13193 if (IL_FLD(IR_IDX_R(ir_idx)) == CN_Tbl_Idx &&
13194 IL_FLD(IL_NEXT_LIST_IDX(IR_IDX_R(ir_idx))) == CN_Tbl_Idx &&
13195 fold_relationals(IL_IDX(IR_IDX_R(ir_idx)),
13196 IL_IDX(IL_NEXT_LIST_IDX(IR_IDX_R(ir_idx))),
13197 Le_Opr) &&
13198 TYP_FLD(type_idx) == CN_Tbl_Idx) {
13199
13200
13201
13202 if (compare_cn_and_value(IL_IDX(IR_IDX_R(ir_idx)), 1, Lt_Opr)) {
13203
13204
13205
13206 find_opnd_line_and_column((opnd_type *)
13207 &IL_OPND(IR_IDX_R(ir_idx)),
13208 &line,
13209 &col);
13210 # if 0
13211 PRINTMSG(line, 1634, Warning, col);
13212 # else
13213 PRINTMSG(line, 781, Error, col);
13214 ok = FALSE;
13215 # endif
13216 }
13217 else if (fold_relationals(IL_IDX(IL_NEXT_LIST_IDX(IR_IDX_R(ir_idx))),
13218 TYP_IDX(type_idx),
13219 Gt_Opr)) {
13220
13221
13222
13223 find_opnd_line_and_column((opnd_type *)&IL_OPND(IL_NEXT_LIST_IDX(
13224 IR_IDX_R(ir_idx))),
13225 &line,
13226 &col);
13227 # if 0
13228 PRINTMSG(line, 1634, Warning, col);
13229 # else
13230 PRINTMSG(line, 781, Error, col);
13231 ok = FALSE;
13232 # endif
13233 }
13234 }
13235
13236 TRACE (Func_Exit, "check_substring_bounds", NULL);
13237
13238 return(ok);
13239
13240 }
13241
13242
13243
13244
13245
13246
13247
13248
13249
13250
13251
13252
13253
13254
13255
13256
13257
13258 boolean check_array_bounds(int ir_idx)
13259
13260 {
13261 int base_attr;
13262 int bd_idx;
13263 boolean check_ub = TRUE;
13264 opnd_type cond_opnd;
13265 opnd_type end_opnd;
13266 opnd_type inc_opnd;
13267 opnd_type lb_opnd;
13268 int line;
13269 int list_idx;
13270 int col;
13271 int i;
13272 boolean ok = TRUE;
13273 opnd_type start_opnd;
13274 opnd_type ub_opnd;
13275
13276
13277 TRACE (Func_Entry, "check_array_bounds", NULL);
13278
13279 if (! needs_bounds_check(ir_idx)) {
13280 goto EXIT;
13281 }
13282
13283 base_attr = find_base_attr(&(IR_OPND_L(ir_idx)), &line, &col);
13284
13285 bd_idx = ATD_ARRAY_IDX(base_attr);
13286
13287 if (BD_ARRAY_CLASS(bd_idx) != Explicit_Shape &&
13288 (BD_ARRAY_CLASS(bd_idx) != Assumed_Size ||
13289 BD_RANK(bd_idx) == 1)) {
13290
13291 goto EXIT;
13292 }
13293
13294 list_idx = IR_IDX_R(ir_idx);
13295 i = 1;
13296
13297 while (list_idx != NULL_IDX) {
13298
13299 if (IL_PE_SUBSCRIPT(list_idx) &&
13300 ATD_PE_ARRAY_IDX(base_attr) != NULL_IDX &&
13301 bd_idx != ATD_PE_ARRAY_IDX(base_attr)) {
13302
13303 bd_idx = ATD_PE_ARRAY_IDX(base_attr);
13304 i = 1;
13305
13306 check_ub = TRUE;
13307
13308 if (BD_ARRAY_CLASS(bd_idx) == Assumed_Size &&
13309 i == BD_RANK(bd_idx)) {
13310 check_ub = FALSE;
13311 }
13312 }
13313
13314 if (IL_FLD(list_idx) == CN_Tbl_Idx) {
13315 if (BD_LB_FLD(bd_idx, i) == CN_Tbl_Idx &&
13316 fold_relationals(IL_IDX(list_idx), BD_LB_IDX(bd_idx, i), Lt_Opr)) {
13317
13318 find_opnd_line_and_column((opnd_type *)&IL_OPND(list_idx),
13319 &line,
13320 &col);
13321 # if 0
13322 PRINTMSG(line, 1633, Warning, col, i);
13323 # else
13324 PRINTMSG(line, 1197, Error, col, i);
13325 ok = FALSE;
13326 # endif
13327 }
13328 else if (BD_UB_FLD(bd_idx, i) == CN_Tbl_Idx &&
13329 check_ub &&
13330 fold_relationals(IL_IDX(list_idx), BD_UB_IDX(bd_idx, i), Gt_Opr)) {
13331
13332 find_opnd_line_and_column((opnd_type *)&IL_OPND(list_idx),
13333 &line,
13334 &col);
13335 # if 0
13336 PRINTMSG(line, 1633, Warning, col, i);
13337 # else
13338 PRINTMSG(line, 1197, Error, col, i);
13339 ok = FALSE;
13340 # endif
13341 }
13342 }
13343 else if (IL_FLD(list_idx) == IR_Tbl_Idx &&
13344 check_ub &&
13345 IR_OPR(IL_IDX(list_idx)) == Triplet_Opr &&
13346 IL_FLD(IR_IDX_L(IL_IDX(list_idx))) == CN_Tbl_Idx &&
13347 IL_FLD(IL_NEXT_LIST_IDX(IR_IDX_L(IL_IDX(list_idx))))
13348 == CN_Tbl_Idx &&
13349 IL_FLD(IL_NEXT_LIST_IDX(IL_NEXT_LIST_IDX(
13350 IR_IDX_L(IL_IDX(list_idx))))) == CN_Tbl_Idx &&
13351 BD_LB_FLD(bd_idx, i) == CN_Tbl_Idx &&
13352 BD_UB_FLD(bd_idx, i) == CN_Tbl_Idx) {
13353
13354 COPY_OPND(start_opnd,
13355 IL_OPND(IR_IDX_L(IL_IDX(list_idx))));
13356
13357 COPY_OPND(end_opnd,
13358 IL_OPND(IL_NEXT_LIST_IDX(IR_IDX_L(IL_IDX(list_idx)))));
13359
13360 COPY_OPND(inc_opnd,
13361 IL_OPND(IL_NEXT_LIST_IDX(IL_NEXT_LIST_IDX(IR_IDX_L(
13362 IL_IDX(list_idx))))));
13363
13364 gen_opnd(&lb_opnd,
13365 BD_LB_IDX(bd_idx, i),
13366 BD_LB_FLD(bd_idx, i),
13367 line,
13368 col);
13369
13370 gen_opnd(&ub_opnd,
13371 BD_UB_IDX(bd_idx, i),
13372 BD_UB_FLD(bd_idx, i),
13373 line,
13374 col);
13375
13376 gen_rbounds_condition(&cond_opnd,
13377 &start_opnd,
13378 &end_opnd,
13379 &inc_opnd,
13380 &lb_opnd,
13381 &ub_opnd,
13382 line,
13383 col);
13384
13385 # ifdef _DEBUG
13386 if (OPND_FLD(cond_opnd) != CN_Tbl_Idx ||
13387 TYP_TYPE(CN_TYPE_IDX(OPND_IDX(cond_opnd))) != Logical) {
13388 PRINTMSG(line, 626, Internal, col,
13389 "LOGICAL CN_Tbl_Idx", "check_array_bounds");
13390 }
13391 # endif
13392
13393 if (THIS_IS_TRUE(&CN_CONST(OPND_IDX(cond_opnd)),
13394 CN_TYPE_IDX(OPND_IDX(cond_opnd)))) {
13395
13396 find_opnd_line_and_column(&start_opnd, &line, &col);
13397 # if 0
13398 PRINTMSG(line, 1633, Warning, col, i);
13399 # else
13400 PRINTMSG(line, 1197, Error, col, i);
13401 ok = FALSE;
13402 # endif
13403 }
13404 }
13405
13406 i++;
13407 list_idx = IL_NEXT_LIST_IDX(list_idx);
13408
13409 if (BD_ARRAY_CLASS(bd_idx) == Assumed_Size &&
13410 i == BD_RANK(bd_idx)) {
13411 check_ub = FALSE;
13412 }
13413 }
13414
13415 EXIT:
13416
13417 TRACE (Func_Exit, "check_array_bounds", NULL);
13418
13419 return(ok);
13420
13421 }
13422
13423
13424
13425
13426
13427
13428
13429
13430
13431
13432
13433
13434
13435
13436
13437
13438
13439 static int implied_do_depth(opnd_type *top_opnd)
13440
13441 {
13442 int depth = 0;
13443 int i;
13444 int ir_idx;
13445 int list_idx;
13446 opnd_type opnd;
13447
13448 TRACE (Func_Entry, "implied_do_depth", NULL);
13449
13450 switch (OPND_FLD((*top_opnd))) {
13451 case IR_Tbl_Idx:
13452 ir_idx = OPND_IDX((*top_opnd));
13453 if (IR_OPR(ir_idx) == Implied_Do_Opr) {
13454 COPY_OPND(opnd, IR_OPND_L(ir_idx));
13455 i = implied_do_depth(&opnd);
13456 depth = i + 1;
13457 }
13458 else {
13459 COPY_OPND(opnd, IR_OPND_L(ir_idx));
13460 depth = implied_do_depth(&opnd);
13461
13462 COPY_OPND(opnd, IR_OPND_R(ir_idx));
13463 i = implied_do_depth(&opnd);
13464 if (i > depth)
13465 depth = i;
13466 }
13467 break;
13468 case IL_Tbl_Idx:
13469 list_idx = OPND_IDX((*top_opnd));
13470 while (list_idx) {
13471 COPY_OPND(opnd, IL_OPND(list_idx));
13472 i = implied_do_depth(&opnd);
13473 if (i > depth)
13474 depth = i;
13475 list_idx = IL_NEXT_LIST_IDX(list_idx);
13476 }
13477 break;
13478 }
13479
13480 TRACE (Func_Exit, "implied_do_depth", NULL);
13481
13482 return(depth);
13483
13484 }
13485
13486
13487
13488
13489
13490
13491
13492
13493
13494
13495
13496
13497
13498
13499
13500
13501
13502 static long64 outer_imp_do_count(opnd_type *size_opnd)
13503
13504 {
13505 int col;
13506 long64 count = 0;
13507 int div_idx;
13508 opnd_type end_opnd;
13509 expr_arg_type exp_desc;
13510 opnd_type inc_opnd;
13511 int ir_idx;
13512 int line;
13513 int list_idx;
13514 int minus_idx;
13515 boolean ok;
13516 opnd_type opnd;
13517 int plus_idx;
13518 cif_usage_code_type save_xref_state;
13519 opnd_type start_opnd;
13520
13521
13522 TRACE (Func_Entry, "outer_imp_do_count", NULL);
13523
13524 COPY_OPND(opnd, (*size_opnd));
13525
13526 while (OPND_FLD(opnd) == IR_Tbl_Idx &&
13527 IR_OPR(OPND_IDX(opnd)) != Implied_Do_Opr) {
13528 COPY_OPND(opnd, IR_OPND_R(OPND_IDX(opnd)));
13529 }
13530
13531 if (OPND_FLD(opnd) != IR_Tbl_Idx ||
13532 IR_OPR(OPND_IDX(opnd)) != Implied_Do_Opr) {
13533
13534 goto EXIT;
13535 }
13536
13537 ir_idx = OPND_IDX(opnd);
13538
13539 line = IR_LINE_NUM(ir_idx);
13540 col = IR_COL_NUM(ir_idx);
13541
13542 list_idx = IR_IDX_R(ir_idx);
13543
13544 list_idx = IL_NEXT_LIST_IDX(list_idx);
13545 COPY_OPND(start_opnd, IL_OPND(list_idx));
13546
13547 list_idx = IL_NEXT_LIST_IDX(list_idx);
13548 COPY_OPND(end_opnd, IL_OPND(list_idx));
13549
13550 list_idx = IL_NEXT_LIST_IDX(list_idx);
13551 COPY_OPND(inc_opnd, IL_OPND(list_idx));
13552
13553 minus_idx = gen_ir(OPND_FLD(end_opnd), OPND_IDX(end_opnd),
13554 Minus_Opr, SA_INTEGER_DEFAULT_TYPE, line, col,
13555 OPND_FLD(start_opnd),OPND_IDX(start_opnd));
13556
13557 plus_idx = gen_ir(IR_Tbl_Idx, minus_idx,
13558 Plus_Opr, SA_INTEGER_DEFAULT_TYPE, line, col,
13559 OPND_FLD(inc_opnd), OPND_IDX(inc_opnd));
13560
13561 div_idx = gen_ir(IR_Tbl_Idx, plus_idx,
13562 Div_Opr, SA_INTEGER_DEFAULT_TYPE, line, col,
13563 OPND_FLD(inc_opnd), OPND_IDX(inc_opnd));
13564
13565 gen_opnd(&opnd, div_idx, IR_Tbl_Idx, line, col);
13566
13567 exp_desc = init_exp_desc;
13568 exp_desc.rank = 0;
13569 save_xref_state = xref_state;
13570 xref_state = CIF_No_Usage_Rec;
13571 ok = expr_semantics(&opnd, &exp_desc);
13572 xref_state = save_xref_state;
13573
13574 if (OPND_FLD(opnd) == CN_Tbl_Idx) {
13575 count = CN_INT_TO_C(OPND_IDX(opnd));
13576 }
13577
13578 EXIT:
13579
13580 TRACE (Func_Exit, "outer_imp_do_count", NULL);
13581
13582 return(count);
13583
13584 }
13585
13586 # if defined(_F_MINUS_MINUS)
13587
13588
13589
13590
13591
13592
13593
13594
13595
13596
13597
13598
13599
13600
13601
13602
13603
13604
13605 void translate_distant_ref(opnd_type *result_opnd,
13606 expr_arg_type *exp_desc,
13607 int pe_dim_list_idx)
13608
13609 {
13610 int attr_idx;
13611 boolean save_defer_stmt_expansion;
13612 int sub_idx;
13613
13614 # if defined(_TARGET_OS_MAX)
13615 int line;
13616 int col;
13617 # endif
13618
13619
13620 TRACE (Func_Entry, "translate_distant_ref", NULL);
13621
13622 # if defined(_TARGET_OS_MAX)
13623
13624 if (IL_FLD(pe_dim_list_idx) == IR_Tbl_Idx &&
13625 IR_OPR(IL_IDX(pe_dim_list_idx)) == My_Pe_Opr) {
13626
13627
13628
13629 return;
13630 }
13631
13632 if (storage_bit_size_tbl[exp_desc->linear_type] != 64 &&
13633 (exp_desc->type != Structure ||
13634 ! in_component_ref)) {
13635
13636 find_opnd_line_and_column(result_opnd, &line, &col);
13637 PRINTMSG(line, 1585, Error, col);
13638 }
13639
13640 # endif
13641
13642 stmt_expansion_control_start();
13643 save_defer_stmt_expansion = defer_stmt_expansion;
13644 defer_stmt_expansion = FALSE;
13645
13646 io_item_must_flatten = TRUE;
13647
13648 sub_idx = OPND_IDX((*result_opnd));
13649
13650 while (IR_FLD_L(sub_idx) != AT_Tbl_Idx) {
13651 sub_idx = IR_IDX_L(sub_idx);
13652 }
13653
13654 attr_idx = IR_IDX_L(sub_idx);
13655
13656 # if defined(_TARGET_OS_MAX)
13657 translate_t3e_distant_ref(result_opnd, exp_desc, pe_dim_list_idx);
13658 # else
13659 if (ATD_IM_A_DOPE(attr_idx)) {
13660 translate_distant_dv_ref(result_opnd, exp_desc, pe_dim_list_idx);
13661 }
13662 else if (dump_flags.fmm1) {
13663 translate_distant_ref1(result_opnd, exp_desc, pe_dim_list_idx);
13664 }
13665 else {
13666 translate_distant_ref2(result_opnd, exp_desc, pe_dim_list_idx);
13667 }
13668 # endif
13669
13670 exp_desc->pe_dim_ref = TRUE;
13671
13672 defer_stmt_expansion = save_defer_stmt_expansion;
13673 stmt_expansion_control_end(result_opnd);
13674
13675 TRACE (Func_Exit, "translate_distant_ref", NULL);
13676
13677 return;
13678
13679 }
13680
13681
13682
13683
13684
13685
13686
13687
13688
13689
13690
13691
13692
13693
13694
13695
13696
13697
13698 static void translate_distant_dv_ref(opnd_type *result_opnd,
13699 expr_arg_type *exp_desc,
13700 int pe_dim_list_idx)
13701
13702 {
13703 int bd_idx;
13704 int col;
13705 int deref_idx;
13706 int dv_idx;
13707 int i;
13708 int ir_idx;
13709 int ir_idx2;
13710 int line;
13711 int list_idx;
13712 opnd_type opnd;
13713 int plus_idx;
13714 int sub_idx = NULL_IDX;
13715 int tmp_dv_idx;
13716
13717 TRACE (Func_Entry, "translate_distant_dv_ref", NULL);
13718
13719 find_opnd_line_and_column(result_opnd, &line, &col);
13720
13721 deref_idx = OPND_IDX((*result_opnd));
13722
13723 while (IR_FLD_L(deref_idx) != AT_Tbl_Idx) {
13724 if (IR_OPR(IR_IDX_L(deref_idx)) == Dv_Deref_Opr) {
13725 sub_idx = deref_idx;
13726 }
13727 deref_idx = IR_IDX_L(deref_idx);
13728 }
13729
13730 # if defined(_DEBUG)
13731 if (sub_idx == NULL_IDX) {
13732 PRINTMSG(line, 626, Internal, col,
13733 "Subscript_Opr", "translate_distant_dv_ref");
13734 }
13735 # endif
13736
13737 dv_idx = IR_IDX_L(deref_idx);
13738
13739 if (ATD_ARRAY_IDX(dv_idx) != NULL_IDX) {
13740 list_idx = IR_IDX_R(sub_idx);
13741
13742 for (i = 1; i < BD_RANK(ATD_ARRAY_IDX(dv_idx)); i++) {
13743 list_idx = IL_NEXT_LIST_IDX(list_idx);
13744 }
13745
13746 IL_NEXT_LIST_IDX(list_idx) = NULL_IDX;
13747 IR_LIST_CNT_R(sub_idx) = BD_RANK(ATD_ARRAY_IDX(dv_idx));
13748 }
13749
13750 tmp_dv_idx = gen_compiler_tmp(line, col, Priv, TRUE);
13751 ATD_TYPE_IDX(tmp_dv_idx) = ATD_TYPE_IDX(dv_idx);
13752 ATD_STOR_BLK_IDX(tmp_dv_idx) = SCP_SB_STACK_IDX(curr_scp_idx);
13753 AT_SEMANTICS_DONE(tmp_dv_idx) = TRUE;
13754 ATD_ARRAY_IDX(tmp_dv_idx) = ATD_ARRAY_IDX(dv_idx);
13755 ATD_POINTER(tmp_dv_idx) = ATD_POINTER(dv_idx);
13756 ATD_IM_A_DOPE(tmp_dv_idx) = TRUE;
13757
13758 NTR_IR_TBL(ir_idx);
13759 IR_OPR(ir_idx) = Dv_Whole_Copy_Opr;
13760 IR_TYPE_IDX(ir_idx) = TYPELESS_DEFAULT_TYPE;
13761 IR_LINE_NUM(ir_idx) = line;
13762 IR_COL_NUM(ir_idx) = col;
13763
13764 IR_FLD_L(ir_idx) = AT_Tbl_Idx;
13765 IR_IDX_L(ir_idx) = tmp_dv_idx;
13766 IR_LINE_NUM_L(ir_idx) = line;
13767 IR_COL_NUM_L(ir_idx) = col;
13768
13769 IR_FLD_R(ir_idx) = AT_Tbl_Idx;
13770 IR_IDX_R(ir_idx) = dv_idx;
13771 IR_LINE_NUM_R(ir_idx) = line;
13772 IR_COL_NUM_R(ir_idx) = col;
13773
13774 gen_sh(Before, Assignment_Stmt, SH_GLB_LINE(curr_stmt_sh_idx),
13775 SH_COL_NUM(curr_stmt_sh_idx), FALSE, FALSE, TRUE);
13776
13777 SH_IR_IDX(SH_PREV_IDX(curr_stmt_sh_idx)) = ir_idx;
13778 SH_P2_SKIP_ME(SH_PREV_IDX(curr_stmt_sh_idx)) = TRUE;
13779
13780 bd_idx = ATD_PE_ARRAY_IDX(dv_idx);
13781
13782 linearize_pe_dims(pe_dim_list_idx,
13783 bd_idx,
13784 line,
13785 col,
13786 &opnd);
13787
13788
13789
13790 gen_bias_ref(&opnd);
13791
13792 COPY_OPND((exp_desc->bias_opnd), opnd);
13793
13794
13795
13796 NTR_IR_TBL(ir_idx);
13797 IR_OPR(ir_idx) = Dv_Set_Base_Addr;
13798 IR_TYPE_IDX(ir_idx) = SA_INTEGER_DEFAULT_TYPE;
13799 IR_LINE_NUM(ir_idx) = line;
13800 IR_COL_NUM(ir_idx) = col;
13801
13802 IR_FLD_L(ir_idx) = AT_Tbl_Idx;
13803 IR_IDX_L(ir_idx) = tmp_dv_idx;
13804 IR_LINE_NUM_L(ir_idx) = line;
13805 IR_COL_NUM_L(ir_idx) = col;
13806
13807 NTR_IR_TBL(plus_idx);
13808 IR_OPR(plus_idx) = Plus_Opr;
13809 IR_TYPE_IDX(plus_idx) = SA_INTEGER_DEFAULT_TYPE;
13810 IR_LINE_NUM(plus_idx) = line;
13811 IR_COL_NUM(plus_idx) = col;
13812
13813 IR_FLD_R(ir_idx) = IR_Tbl_Idx;
13814 IR_IDX_R(ir_idx) = plus_idx;
13815
13816 COPY_OPND(IR_OPND_R(plus_idx), opnd);
13817
13818 NTR_IR_TBL(ir_idx2);
13819 IR_OPR(ir_idx2) = Dv_Access_Base_Addr;
13820 IR_TYPE_IDX(ir_idx2) = SA_INTEGER_DEFAULT_TYPE;
13821 IR_LINE_NUM(ir_idx2) = line;
13822 IR_COL_NUM(ir_idx2) = col;
13823
13824 IR_FLD_L(ir_idx2) = AT_Tbl_Idx;
13825 IR_IDX_L(ir_idx2) = tmp_dv_idx;
13826 IR_LINE_NUM_L(ir_idx2) = line;
13827 IR_COL_NUM_L(ir_idx2) = col;
13828
13829 IR_FLD_L(plus_idx) = IR_Tbl_Idx;
13830 IR_IDX_L(plus_idx) = ir_idx2;
13831
13832 gen_sh(Before, Assignment_Stmt, SH_GLB_LINE(curr_stmt_sh_idx),
13833 SH_COL_NUM(curr_stmt_sh_idx), FALSE, FALSE, TRUE);
13834
13835 SH_IR_IDX(SH_PREV_IDX(curr_stmt_sh_idx)) = ir_idx;
13836 SH_P2_SKIP_ME(SH_PREV_IDX(curr_stmt_sh_idx)) = TRUE;
13837
13838
13839
13840
13841 IR_IDX_L(deref_idx) = tmp_dv_idx;
13842
13843 TRACE (Func_Exit, "translate_distant_dv_ref", NULL);
13844
13845 return;
13846
13847 }
13848
13849
13850
13851
13852
13853
13854
13855
13856
13857
13858
13859
13860
13861
13862
13863
13864 # if defined(_TARGET_OS_MAX)
13865
13866 static void translate_t3e_distant_ref(opnd_type *result_opnd,
13867 expr_arg_type *exp_desc,
13868 int pe_dim_list_idx)
13869
13870 {
13871 int attr_idx;
13872 int bd_idx;
13873 int col;
13874 int i;
13875 int line;
13876 int list_idx;
13877 expr_arg_type loc_exp_desc;
13878 boolean ok;
13879 opnd_type opnd;
13880 cif_usage_code_type save_xref_state;
13881 int sub_idx;
13882
13883
13884 TRACE (Func_Entry, "translate_t3e_distant_ref", NULL);
13885
13886 find_opnd_line_and_column(result_opnd, &line, &col);
13887
13888 sub_idx = OPND_IDX((*result_opnd));
13889
13890 while (IR_FLD_L(sub_idx) != AT_Tbl_Idx &&
13891 (IR_FLD_L(sub_idx) != IR_Tbl_Idx ||
13892 IR_OPR(IR_IDX_L(sub_idx)) != Dv_Deref_Opr)) {
13893 sub_idx = IR_IDX_L(sub_idx);
13894 }
13895
13896 if (IR_FLD_L(sub_idx) == AT_Tbl_Idx) {
13897 attr_idx = IR_IDX_L(sub_idx);
13898 }
13899 else {
13900 attr_idx = IR_IDX_L(IR_IDX_L(sub_idx));
13901 }
13902
13903 bd_idx = ATD_PE_ARRAY_IDX(attr_idx);
13904
13905 linearize_pe_dims(pe_dim_list_idx,
13906 bd_idx,
13907 line,
13908 col,
13909 &opnd);
13910
13911 save_xref_state = xref_state;
13912 xref_state = CIF_No_Usage_Rec;
13913 loc_exp_desc.rank = 0;
13914 ok = expr_semantics(&opnd, &loc_exp_desc);
13915 xref_state = save_xref_state;
13916
13917 COPY_OPND((exp_desc->bias_opnd), opnd);
13918
13919 if (ATD_ARRAY_IDX(attr_idx) != NULL_IDX) {
13920 list_idx = IR_IDX_R(sub_idx);
13921
13922 for (i = 0; i < BD_RANK(ATD_ARRAY_IDX(attr_idx)); i++) {
13923 list_idx = IL_NEXT_LIST_IDX(list_idx);
13924 }
13925
13926 # ifdef _DEBUG
13927 if (list_idx != pe_dim_list_idx) {
13928 PRINTMSG(line, 626, Internal, col,
13929 "list_idx != pe_dim_list_idx",
13930 "translate_t3e_distant_ref");
13931 }
13932 # endif
13933
13934 IL_NEXT_LIST_IDX(list_idx) = NULL_IDX;
13935 IR_LIST_CNT_R(sub_idx) = BD_RANK(ATD_ARRAY_IDX(attr_idx)) + 1;
13936 }
13937 else {
13938 IL_NEXT_LIST_IDX(pe_dim_list_idx) = NULL_IDX;
13939 IR_LIST_CNT_R(sub_idx) = 1;
13940 }
13941
13942 COPY_OPND(IL_OPND(pe_dim_list_idx), opnd);
13943
13944 TRACE (Func_Exit, "translate_t3e_distant_ref", NULL);
13945
13946 return;
13947
13948 }
13949 # endif
13950
13951
13952
13953
13954
13955
13956
13957
13958
13959
13960
13961
13962
13963
13964
13965
13966
13967 static void translate_distant_ref1(opnd_type *result_opnd,
13968 expr_arg_type *exp_desc,
13969 int pe_dim_list_idx)
13970
13971 {
13972 int asg_idx;
13973 int attr_idx;
13974 int bd_idx;
13975 int col;
13976 int i;
13977 int line;
13978 int list_idx;
13979 expr_arg_type loc_exp_desc;
13980 int loc_idx;
13981 boolean ok = TRUE;
13982 opnd_type opnd;
13983 int plus_idx;
13984 int ptr_idx;
13985 int ptee_idx;
13986 int save_curr_stmt_sh_idx;
13987 cif_usage_code_type save_xref_state;
13988 int sub_idx;
13989
13990 TRACE (Func_Entry, "translate_distant_ref1", NULL);
13991
13992 find_opnd_line_and_column(result_opnd, &line, &col);
13993
13994 sub_idx = OPND_IDX((*result_opnd));
13995
13996 while (IR_FLD_L(sub_idx) != AT_Tbl_Idx) {
13997 sub_idx = IR_IDX_L(sub_idx);
13998 }
13999
14000 attr_idx = IR_IDX_L(sub_idx);
14001
14002 if (ATD_ARRAY_IDX(attr_idx) != NULL_IDX) {
14003 list_idx = IR_IDX_R(sub_idx);
14004
14005 for (i = 1; i < BD_RANK(ATD_ARRAY_IDX(attr_idx)); i++) {
14006 list_idx = IL_NEXT_LIST_IDX(list_idx);
14007 }
14008
14009 IL_NEXT_LIST_IDX(list_idx) = NULL_IDX;
14010 IR_LIST_CNT_R(sub_idx) = BD_RANK(ATD_ARRAY_IDX(attr_idx));
14011 }
14012
14013 bd_idx = ATD_PE_ARRAY_IDX(attr_idx);
14014
14015
14016
14017 ptr_idx = gen_compiler_tmp(line, col, Shared, TRUE);
14018 ATD_TYPE_IDX(ptr_idx) = CRI_Ptr_8;
14019 AT_SEMANTICS_DONE(ptr_idx) = TRUE;
14020 ATD_STOR_BLK_IDX(ptr_idx) = SCP_SB_STACK_IDX(curr_scp_idx);
14021
14022 ptee_idx = gen_compiler_tmp(line, col, Shared, TRUE);
14023 ATD_CLASS(ptee_idx) = CRI__Pointee;
14024 AT_SEMANTICS_DONE(ptee_idx) = TRUE;
14025 ATD_STOR_BLK_IDX(ptee_idx) = SCP_SB_BASED_IDX(curr_scp_idx);
14026 ATD_TYPE_IDX(ptee_idx) = ATD_TYPE_IDX(attr_idx);
14027 ATD_ARRAY_IDX(ptee_idx) = ATD_ARRAY_IDX(attr_idx);
14028 ATD_PTR_IDX(ptee_idx) = ptr_idx;
14029
14030
14031
14032 NTR_IR_TBL(asg_idx);
14033 IR_OPR(asg_idx) = Asg_Opr;
14034 IR_TYPE_IDX(asg_idx) = CRI_Ptr_8;
14035 IR_LINE_NUM(asg_idx) = line;
14036 IR_COL_NUM(asg_idx) = col;
14037
14038 IR_FLD_L(asg_idx) = AT_Tbl_Idx;
14039 IR_IDX_L(asg_idx) = ptr_idx;
14040 IR_LINE_NUM_L(asg_idx) = line;
14041 IR_COL_NUM_L(asg_idx) = col;
14042
14043 NTR_IR_TBL(plus_idx);
14044 IR_OPR(plus_idx) = Plus_Opr;
14045 IR_TYPE_IDX(plus_idx) = CRI_Ptr_8;
14046 IR_LINE_NUM(plus_idx) = line;
14047 IR_COL_NUM(plus_idx) = col;
14048
14049 IR_FLD_R(asg_idx) = IR_Tbl_Idx;
14050 IR_IDX_R(asg_idx) = plus_idx;
14051
14052 NTR_IR_TBL(loc_idx);
14053 IR_OPR(loc_idx) = Loc_Opr;
14054 IR_TYPE_IDX(loc_idx) = CRI_Ptr_8;
14055 IR_LINE_NUM(loc_idx) = line;
14056 IR_COL_NUM(loc_idx) = col;
14057
14058
14059
14060 IR_FLD_L(loc_idx) = AT_Tbl_Idx;
14061 IR_IDX_L(loc_idx) = attr_idx;
14062 IR_LINE_NUM_L(loc_idx) = line;
14063 IR_COL_NUM_L(loc_idx) = col;
14064
14065 IR_FLD_L(plus_idx) = IR_Tbl_Idx;
14066 IR_IDX_L(plus_idx) = loc_idx;
14067
14068 linearize_pe_dims(pe_dim_list_idx,
14069 bd_idx,
14070 line,
14071 col,
14072 &opnd);
14073
14074
14075
14076 gen_bias_ref(&opnd);
14077
14078 COPY_OPND((exp_desc->bias_opnd), opnd);
14079
14080 COPY_OPND(IR_OPND_R(plus_idx), opnd);
14081
14082 save_curr_stmt_sh_idx = curr_stmt_sh_idx;
14083 gen_sh(Before, Assignment_Stmt, stmt_start_line, stmt_start_col,
14084 FALSE, FALSE, TRUE);
14085
14086 curr_stmt_sh_idx = SH_PREV_IDX(curr_stmt_sh_idx);
14087
14088 SH_IR_IDX(curr_stmt_sh_idx) = asg_idx;
14089 SH_P2_SKIP_ME(curr_stmt_sh_idx) = TRUE;
14090
14091 COPY_OPND(opnd, IR_OPND_R(asg_idx));
14092 save_xref_state = xref_state;
14093 xref_state = CIF_No_Usage_Rec;
14094 loc_exp_desc.rank = 0;
14095 ok &= expr_semantics(&opnd, &loc_exp_desc);
14096 xref_state = save_xref_state;
14097 COPY_OPND(IR_OPND_R(asg_idx), opnd);
14098
14099 curr_stmt_sh_idx = save_curr_stmt_sh_idx;
14100
14101
14102
14103
14104 if (ATD_ARRAY_IDX(attr_idx) == NULL_IDX) {
14105 if (TYP_TYPE(ATD_TYPE_IDX(ptee_idx)) == Structure) {
14106 loc_exp_desc = init_exp_desc;
14107 loc_exp_desc.type_idx = ATD_TYPE_IDX(ptee_idx);
14108 loc_exp_desc.type = TYP_TYPE(loc_exp_desc.type_idx);
14109 loc_exp_desc.linear_type = TYP_LINEAR(loc_exp_desc.type_idx);
14110 loc_exp_desc.rank = 1;
14111 loc_exp_desc.shape[0].fld = CN_Tbl_Idx;
14112 loc_exp_desc.shape[0].idx = CN_INTEGER_ONE_IDX;
14113
14114 ATD_ARRAY_IDX(ptee_idx) = create_bd_ntry_for_const(&loc_exp_desc,
14115 line,
14116 col);
14117
14118 NTR_IR_LIST_TBL(list_idx);
14119 IR_FLD_R(sub_idx) = IL_Tbl_Idx;
14120 IR_LIST_CNT_R(sub_idx) = 1;
14121 IR_IDX_R(sub_idx) = list_idx;
14122 IL_FLD(list_idx) = CN_Tbl_Idx;
14123 IL_IDX(list_idx) = CN_INTEGER_ONE_IDX;
14124 IL_LINE_NUM(list_idx) = line;
14125 IL_COL_NUM(list_idx) = col;
14126
14127 IR_IDX_L(sub_idx) = ptee_idx;
14128 }
14129 else if (sub_idx == OPND_IDX((*result_opnd))) {
14130 OPND_FLD((*result_opnd)) = AT_Tbl_Idx;
14131 OPND_IDX((*result_opnd)) = ptee_idx;
14132 OPND_LINE_NUM((*result_opnd)) = line;
14133 OPND_COL_NUM((*result_opnd)) = col;
14134 }
14135 else {
14136 plus_idx = OPND_IDX((*result_opnd));
14137
14138 while (IR_IDX_L(plus_idx) != sub_idx) {
14139 plus_idx = IR_IDX_L(plus_idx);
14140 }
14141
14142 IR_FLD_L(plus_idx) = AT_Tbl_Idx;
14143 IR_IDX_L(plus_idx) = ptee_idx;
14144 IR_LINE_NUM_L(plus_idx) = line;
14145 IR_COL_NUM_L(plus_idx) = col;
14146 }
14147 }
14148 else {
14149 IR_IDX_L(sub_idx) = ptee_idx;
14150 }
14151
14152 TRACE (Func_Exit, "translate_distant_ref1", NULL);
14153
14154 return;
14155
14156 }
14157
14158
14159
14160
14161
14162
14163
14164
14165
14166
14167
14168
14169
14170
14171
14172
14173
14174 static void linearize_pe_dims(int pe_dim_list_idx,
14175 int bd_idx,
14176 int line,
14177 int col,
14178 opnd_type *result_opnd)
14179
14180 {
14181 int i;
14182 int list_idx;
14183 int minus_idx;
14184 int mult_idx;
14185 int plus_idx;
14186
14187 TRACE (Func_Entry, "linearize_pe_dims", NULL);
14188
14189 list_idx = pe_dim_list_idx;
14190
14191 NTR_IR_TBL(minus_idx);
14192 IR_OPR(minus_idx) = Minus_Opr;
14193 IR_TYPE_IDX(minus_idx) = INTEGER_DEFAULT_TYPE;
14194 IR_LINE_NUM(minus_idx) = line;
14195 IR_COL_NUM(minus_idx) = col;
14196
14197 NTR_IR_TBL(plus_idx);
14198 IR_OPR(plus_idx) = Plus_Opr;
14199 IR_TYPE_IDX(plus_idx) = INTEGER_DEFAULT_TYPE;
14200 IR_LINE_NUM(plus_idx) = line;
14201 IR_COL_NUM(plus_idx) = col;
14202
14203 COPY_OPND(IR_OPND_L(plus_idx), IL_OPND(list_idx));
14204 IR_FLD_R(plus_idx) = CN_Tbl_Idx;
14205 IR_IDX_R(plus_idx) = CN_INTEGER_ONE_IDX;
14206 IR_LINE_NUM_R(plus_idx) = line;
14207 IR_COL_NUM_R(plus_idx) = col;
14208
14209 IR_FLD_L(minus_idx) = IR_Tbl_Idx;
14210 IR_IDX_L(minus_idx) = plus_idx;
14211
14212 IR_FLD_R(minus_idx) = BD_LB_FLD(bd_idx, 1);
14213 IR_IDX_R(minus_idx) = BD_LB_IDX(bd_idx, 1);
14214 IR_LINE_NUM_R(minus_idx) = line;
14215 IR_COL_NUM_R(minus_idx) = col;
14216
14217 OPND_FLD((*result_opnd)) = IR_Tbl_Idx;
14218 OPND_IDX((*result_opnd)) = minus_idx;
14219
14220 list_idx = IL_NEXT_LIST_IDX(list_idx);
14221
14222 for (i = 2; i <= BD_RANK(bd_idx); i++) {
14223 NTR_IR_TBL(plus_idx);
14224 IR_OPR(plus_idx) = Plus_Opr;
14225 IR_TYPE_IDX(plus_idx) = INTEGER_DEFAULT_TYPE;
14226 IR_LINE_NUM(plus_idx) = line;
14227 IR_COL_NUM(plus_idx) = col;
14228
14229 COPY_OPND(IR_OPND_L(plus_idx), (*result_opnd));
14230 OPND_FLD((*result_opnd)) = IR_Tbl_Idx;
14231 OPND_IDX((*result_opnd)) = plus_idx;
14232
14233 NTR_IR_TBL(mult_idx);
14234 IR_OPR(mult_idx) = Mult_Opr;
14235 IR_TYPE_IDX(mult_idx) = INTEGER_DEFAULT_TYPE;
14236 IR_LINE_NUM(mult_idx) = line;
14237 IR_COL_NUM(mult_idx) = col;
14238
14239 NTR_IR_TBL(minus_idx);
14240 IR_OPR(minus_idx) = Minus_Opr;
14241 IR_TYPE_IDX(minus_idx) = INTEGER_DEFAULT_TYPE;
14242 IR_LINE_NUM(minus_idx) = line;
14243 IR_COL_NUM(minus_idx) = col;
14244
14245 COPY_OPND(IR_OPND_L(minus_idx), IL_OPND(list_idx));
14246
14247 IR_FLD_R(minus_idx) = BD_LB_FLD(bd_idx, i);
14248 IR_IDX_R(minus_idx) = BD_LB_IDX(bd_idx, i);
14249 IR_LINE_NUM_R(minus_idx) = line;
14250 IR_COL_NUM_R(minus_idx) = col;
14251
14252 IR_FLD_L(mult_idx) = IR_Tbl_Idx;
14253 IR_IDX_L(mult_idx) = minus_idx;
14254
14255 IR_FLD_R(mult_idx) = BD_SM_FLD(bd_idx, i);
14256 IR_IDX_R(mult_idx) = BD_SM_IDX(bd_idx, i);
14257 IR_LINE_NUM_R(mult_idx) = line;
14258 IR_COL_NUM_R(mult_idx) = col;
14259
14260 IR_FLD_R(plus_idx) = IR_Tbl_Idx;
14261 IR_IDX_R(plus_idx) = mult_idx;
14262
14263 list_idx = IL_NEXT_LIST_IDX(list_idx);
14264 }
14265
14266
14267 TRACE (Func_Exit, "linearize_pe_dims", NULL);
14268
14269 return;
14270
14271 }
14272
14273
14274
14275
14276
14277
14278
14279
14280
14281
14282
14283
14284
14285
14286
14287
14288
14289 void translate_dv_component(opnd_type *result_opnd,
14290 expr_arg_type *exp_desc)
14291
14292 {
14293 int col;
14294 int dv_idx;
14295 int ir_idx;
14296 int ir_idx2;
14297 int line;
14298 opnd_type opnd;
14299 int plus_idx;
14300 boolean save_defer_stmt_expansion;
14301 int tmp_dv_idx;
14302 int unused;
14303
14304
14305 TRACE (Func_Entry, "translate_dv_component", NULL);
14306
14307 stmt_expansion_control_start();
14308 save_defer_stmt_expansion = defer_stmt_expansion;
14309 defer_stmt_expansion = FALSE;
14310
14311 io_item_must_flatten = TRUE;
14312
14313 find_opnd_line_and_column(result_opnd, &line, &col);
14314
14315 COPY_OPND(opnd, (*result_opnd));
14316
14317 if (OPND_FLD(opnd) == IR_Tbl_Idx &&
14318 IR_OPR(OPND_IDX(opnd)) == Dv_Deref_Opr) {
14319
14320 COPY_OPND(opnd, IR_OPND_L(OPND_IDX(opnd)));
14321 }
14322
14323 unused = find_left_attr(&opnd);
14324
14325 # ifdef _DEBUG
14326 if (OPND_FLD(opnd) != IR_Tbl_Idx ||
14327 IR_OPR(OPND_IDX(opnd)) != Struct_Opr) {
14328 PRINTMSG(line, 626, Internal, col,
14329 "Struct_Opr", "translate_dv_component");
14330 }
14331 # endif
14332
14333 dv_idx = IR_IDX_R(OPND_IDX(opnd));
14334
14335 tmp_dv_idx = gen_compiler_tmp(line, col, Priv, TRUE);
14336 ATD_TYPE_IDX(tmp_dv_idx) = ATD_TYPE_IDX(dv_idx);
14337 ATD_STOR_BLK_IDX(tmp_dv_idx) = SCP_SB_STACK_IDX(curr_scp_idx);
14338 AT_SEMANTICS_DONE(tmp_dv_idx) = TRUE;
14339 ATD_ARRAY_IDX(tmp_dv_idx) = ATD_ARRAY_IDX(dv_idx);
14340 ATD_POINTER(tmp_dv_idx) = ATD_POINTER(dv_idx);
14341 ATD_IM_A_DOPE(tmp_dv_idx) = TRUE;
14342
14343 NTR_IR_TBL(ir_idx);
14344 IR_OPR(ir_idx) = Dv_Whole_Copy_Opr;
14345 IR_TYPE_IDX(ir_idx) = TYPELESS_DEFAULT_TYPE;
14346 IR_LINE_NUM(ir_idx) = line;
14347 IR_COL_NUM(ir_idx) = col;
14348
14349 IR_FLD_L(ir_idx) = AT_Tbl_Idx;
14350 IR_IDX_L(ir_idx) = tmp_dv_idx;
14351 IR_LINE_NUM_L(ir_idx) = line;
14352 IR_COL_NUM_L(ir_idx) = col;
14353
14354 COPY_OPND(IR_OPND_R(ir_idx), opnd);
14355
14356 gen_sh(Before, Assignment_Stmt, SH_GLB_LINE(curr_stmt_sh_idx),
14357 SH_COL_NUM(curr_stmt_sh_idx), FALSE, FALSE, TRUE);
14358
14359 SH_IR_IDX(SH_PREV_IDX(curr_stmt_sh_idx)) = ir_idx;
14360 SH_P2_SKIP_ME(SH_PREV_IDX(curr_stmt_sh_idx)) = TRUE;
14361
14362
14363
14364 NTR_IR_TBL(ir_idx);
14365 IR_OPR(ir_idx) = Dv_Set_Base_Addr;
14366 IR_TYPE_IDX(ir_idx) = SA_INTEGER_DEFAULT_TYPE;
14367 IR_LINE_NUM(ir_idx) = line;
14368 IR_COL_NUM(ir_idx) = col;
14369
14370 IR_FLD_L(ir_idx) = AT_Tbl_Idx;
14371 IR_IDX_L(ir_idx) = tmp_dv_idx;
14372 IR_LINE_NUM_L(ir_idx) = line;
14373 IR_COL_NUM_L(ir_idx) = col;
14374
14375 NTR_IR_TBL(plus_idx);
14376 IR_OPR(plus_idx) = Plus_Opr;
14377 IR_TYPE_IDX(plus_idx) = SA_INTEGER_DEFAULT_TYPE;
14378 IR_LINE_NUM(plus_idx) = line;
14379 IR_COL_NUM(plus_idx) = col;
14380
14381 IR_FLD_R(ir_idx) = IR_Tbl_Idx;
14382 IR_IDX_R(ir_idx) = plus_idx;
14383
14384 copy_subtree(&(exp_desc->bias_opnd), &opnd);
14385
14386 COPY_OPND(IR_OPND_R(plus_idx), opnd);
14387
14388 NTR_IR_TBL(ir_idx2);
14389 IR_OPR(ir_idx2) = Dv_Access_Base_Addr;
14390 IR_TYPE_IDX(ir_idx2) = SA_INTEGER_DEFAULT_TYPE;
14391 IR_LINE_NUM(ir_idx2) = line;
14392 IR_COL_NUM(ir_idx2) = col;
14393
14394 IR_FLD_L(ir_idx2) = AT_Tbl_Idx;
14395 IR_IDX_L(ir_idx2) = tmp_dv_idx;
14396 IR_LINE_NUM_L(ir_idx2) = line;
14397 IR_COL_NUM_L(ir_idx2) = col;
14398
14399 IR_FLD_L(plus_idx) = IR_Tbl_Idx;
14400 IR_IDX_L(plus_idx) = ir_idx2;
14401
14402 gen_sh(Before, Assignment_Stmt, SH_GLB_LINE(curr_stmt_sh_idx),
14403 SH_COL_NUM(curr_stmt_sh_idx), FALSE, FALSE, TRUE);
14404
14405 SH_IR_IDX(SH_PREV_IDX(curr_stmt_sh_idx)) = ir_idx;
14406 SH_P2_SKIP_ME(SH_PREV_IDX(curr_stmt_sh_idx)) = TRUE;
14407
14408 if (OPND_FLD((*result_opnd)) == IR_Tbl_Idx &&
14409 IR_OPR(OPND_IDX((*result_opnd))) == Dv_Deref_Opr) {
14410
14411 OPND_FLD(IR_OPND_L(OPND_IDX((*result_opnd)))) = AT_Tbl_Idx;
14412 OPND_IDX(IR_OPND_L(OPND_IDX((*result_opnd)))) = tmp_dv_idx;
14413 }
14414 else {
14415 OPND_FLD((*result_opnd)) = AT_Tbl_Idx;
14416 OPND_IDX((*result_opnd)) = tmp_dv_idx;
14417 }
14418
14419 defer_stmt_expansion = save_defer_stmt_expansion;
14420 stmt_expansion_control_end(result_opnd);
14421
14422 TRACE (Func_Exit, "translate_dv_component", NULL);
14423
14424 return;
14425
14426 }
14427
14428
14429
14430
14431
14432
14433
14434
14435
14436
14437
14438
14439
14440
14441
14442
14443
14444 # ifdef _TARGET_OS_MAX
14445 static void translate_t3e_dv_component(opnd_type *result_opnd,
14446 expr_arg_type *exp_desc)
14447
14448 {
14449
14450
14451
14452
14453
14454 boolean allocatable = TRUE;
14455 int asg_idx;
14456 int base_attr;
14457 int col;
14458 int dv_idx;
14459 int ir_idx;
14460 int line;
14461 int list_idx;
14462 opnd_type opnd;
14463 int ptr_idx;
14464 int ptee_idx;
14465 boolean save_defer_stmt_expansion;
14466 int tmp_dv_idx;
14467
14468
14469 TRACE (Func_Entry, "translate_t3e_dv_component", NULL);
14470
14471 stmt_expansion_control_start();
14472 save_defer_stmt_expansion = defer_stmt_expansion;
14473 defer_stmt_expansion = FALSE;
14474
14475 COPY_OPND(opnd, (*result_opnd));
14476
14477 io_item_must_flatten = TRUE;
14478
14479 if (OPND_FLD(opnd) == IR_Tbl_Idx &&
14480 IR_OPR(OPND_IDX(opnd)) == Dv_Deref_Opr) {
14481
14482 COPY_OPND(opnd, IR_OPND_L(OPND_IDX(opnd)));
14483 }
14484
14485 base_attr = find_left_attr(&opnd);
14486 dv_idx = find_base_attr(&opnd, &line, &col);
14487
14488 find_opnd_line_and_column(result_opnd, &line, &col);
14489
14490 tmp_dv_idx = gen_compiler_tmp(line, col, Priv, TRUE);
14491 ATD_TYPE_IDX(tmp_dv_idx) = ATD_TYPE_IDX(dv_idx);
14492 ATD_STOR_BLK_IDX(tmp_dv_idx) = SCP_SB_STACK_IDX(curr_scp_idx);
14493 AT_SEMANTICS_DONE(tmp_dv_idx) = TRUE;
14494 ATD_ARRAY_IDX(tmp_dv_idx) = ATD_ARRAY_IDX(dv_idx);
14495 ATD_POINTER(tmp_dv_idx) = ATD_POINTER(dv_idx);
14496 ATD_IM_A_DOPE(tmp_dv_idx) = TRUE;
14497
14498 NTR_IR_TBL(ir_idx);
14499 IR_OPR(ir_idx) = Dv_Whole_Copy_Opr;
14500 IR_TYPE_IDX(ir_idx) = TYPELESS_DEFAULT_TYPE;
14501 IR_LINE_NUM(ir_idx) = line;
14502 IR_COL_NUM(ir_idx) = col;
14503
14504 IR_FLD_L(ir_idx) = AT_Tbl_Idx;
14505 IR_IDX_L(ir_idx) = tmp_dv_idx;
14506 IR_LINE_NUM_L(ir_idx) = line;
14507 IR_COL_NUM_L(ir_idx) = col;
14508
14509 COPY_OPND(IR_OPND_R(ir_idx), opnd);
14510
14511 ATD_FLD(tmp_dv_idx) = OPND_FLD(opnd);
14512 ATD_TMP_IDX(tmp_dv_idx) = OPND_IDX(opnd);
14513
14514 gen_sh(Before, Assignment_Stmt, SH_GLB_LINE(curr_stmt_sh_idx),
14515 SH_COL_NUM(curr_stmt_sh_idx), FALSE, FALSE, TRUE);
14516
14517 SH_IR_IDX(SH_PREV_IDX(curr_stmt_sh_idx)) = ir_idx;
14518 SH_P2_SKIP_ME(SH_PREV_IDX(curr_stmt_sh_idx)) = TRUE;
14519
14520 if (allocatable) {
14521
14522
14523 ptr_idx = gen_compiler_tmp(line, col, Shared, TRUE);
14524 ATD_TYPE_IDX(ptr_idx) = CRI_Ptr_8;
14525 AT_SEMANTICS_DONE(ptr_idx) = TRUE;
14526 ATD_STOR_BLK_IDX(ptr_idx) = SCP_SB_STACK_IDX(curr_scp_idx);
14527
14528 ptee_idx = gen_compiler_tmp(line, col, Shared, TRUE);
14529 ATD_CLASS(ptee_idx) = CRI__Pointee;
14530 AT_SEMANTICS_DONE(ptee_idx) = TRUE;
14531 ATD_STOR_BLK_IDX(ptee_idx) = SCP_SB_BASED_IDX(curr_scp_idx);
14532 ATD_TYPE_IDX(ptee_idx) = ATD_TYPE_IDX(dv_idx);
14533 ATD_PTR_IDX(ptee_idx) = ptr_idx;
14534
14535 if (ATD_ARRAY_IDX(tmp_dv_idx) != NULL_IDX) {
14536 ATD_ARRAY_IDX(ptee_idx) = capture_bounds_from_dv(tmp_dv_idx,
14537 line,
14538 col);
14539 }
14540
14541 ATD_PE_ARRAY_IDX(ptee_idx) = ATD_PE_ARRAY_IDX(base_attr);
14542
14543
14544
14545 NTR_IR_TBL(asg_idx);
14546 IR_OPR(asg_idx) = Asg_Opr;
14547 IR_TYPE_IDX(asg_idx) = CRI_Ptr_8;
14548 IR_LINE_NUM(asg_idx) = line;
14549 IR_COL_NUM(asg_idx) = col;
14550
14551 IR_FLD_L(asg_idx) = AT_Tbl_Idx;
14552 IR_IDX_L(asg_idx) = ptr_idx;
14553 IR_LINE_NUM_L(asg_idx) = line;
14554 IR_COL_NUM_L(asg_idx) = col;
14555
14556 NTR_IR_TBL(ir_idx);
14557 IR_OPR(ir_idx) = Dv_Access_Base_Addr;
14558 IR_TYPE_IDX(ir_idx) = CRI_Ptr_8;
14559 IR_LINE_NUM(ir_idx) = line;
14560 IR_COL_NUM(ir_idx) = col;
14561
14562 IR_FLD_L(ir_idx) = AT_Tbl_Idx;
14563 IR_IDX_L(ir_idx) = tmp_dv_idx;
14564 IR_LINE_NUM_L(ir_idx) = line;
14565 IR_COL_NUM_L(ir_idx) = col;
14566
14567 IR_FLD_R(asg_idx) = IR_Tbl_Idx;
14568 IR_IDX_R(asg_idx) = ir_idx;
14569
14570 gen_sh(Before, Assignment_Stmt, line, col, FALSE, FALSE, TRUE);
14571
14572 SH_IR_IDX(SH_PREV_IDX(curr_stmt_sh_idx)) = asg_idx;
14573 SH_P2_SKIP_ME(SH_PREV_IDX(curr_stmt_sh_idx)) = TRUE;
14574
14575 OPND_FLD((*result_opnd)) = AT_Tbl_Idx;
14576 OPND_IDX((*result_opnd)) = ptee_idx;
14577
14578 exp_desc->dope_vector = FALSE;
14579 }
14580 else {
14581
14582 if (OPND_FLD((*result_opnd)) == IR_Tbl_Idx &&
14583 IR_OPR(OPND_IDX((*result_opnd))) == Dv_Deref_Opr) {
14584
14585 OPND_FLD(IR_OPND_L(OPND_IDX((*result_opnd)))) = AT_Tbl_Idx;
14586 OPND_IDX(IR_OPND_L(OPND_IDX((*result_opnd)))) = tmp_dv_idx;
14587 }
14588 else {
14589 OPND_FLD((*result_opnd)) = AT_Tbl_Idx;
14590 OPND_IDX((*result_opnd)) = tmp_dv_idx;
14591 }
14592
14593 ATD_PE_ARRAY_IDX(tmp_dv_idx) = ATD_PE_ARRAY_IDX(base_attr);
14594 }
14595
14596 defer_stmt_expansion = save_defer_stmt_expansion;
14597 stmt_expansion_control_end(result_opnd);
14598
14599
14600 NTR_IR_TBL(ir_idx);
14601 IR_OPR(ir_idx) = Subscript_Opr;
14602 IR_LINE_NUM(ir_idx) = line;
14603 IR_COL_NUM(ir_idx) = col;
14604 IR_TYPE_IDX(ir_idx) = ATD_TYPE_IDX(tmp_dv_idx);
14605
14606 COPY_OPND(IR_OPND_L(ir_idx), (*result_opnd));
14607
14608 NTR_IR_LIST_TBL(list_idx);
14609 IR_FLD_R(ir_idx) = IL_Tbl_Idx;
14610 IR_IDX_R(ir_idx) = list_idx;
14611 IR_LIST_CNT_R(ir_idx) = 1;
14612 COPY_OPND(IL_OPND(list_idx), exp_desc->bias_opnd);
14613 IL_PE_SUBSCRIPT(list_idx) = TRUE;
14614
14615 OPND_FLD((*result_opnd)) = IR_Tbl_Idx;
14616 OPND_IDX((*result_opnd)) = ir_idx;
14617
14618 TRACE (Func_Exit, "translate_t3e_dv_component", NULL);
14619
14620 return;
14621
14622 }
14623 # endif
14624
14625
14626
14627
14628
14629
14630
14631
14632
14633
14634
14635
14636
14637
14638
14639
14640
14641 # if defined(_TARGET_OS_MAX)
14642 static int capture_bounds_from_dv(int dv_attr_idx,
14643 int line,
14644 int col)
14645
14646 {
14647 int asg_idx;
14648 int bd_idx;
14649 opnd_type dv_opnd;
14650 int i;
14651 int ir_idx;
14652 opnd_type len_opnd;
14653 int minus_idx;
14654 opnd_type opnd;
14655 int plus_idx;
14656 int tmp_idx;
14657
14658 TRACE (Func_Entry, "capture_bounds_from_dv", NULL);
14659
14660 bd_idx = reserve_array_ntry(BD_RANK(ATD_ARRAY_IDX(dv_attr_idx)));
14661 BD_RANK(bd_idx) = BD_RANK(ATD_ARRAY_IDX(dv_attr_idx));
14662 BD_LINE_NUM(bd_idx) = line;
14663 BD_COLUMN_NUM(bd_idx) = col;
14664 BD_ARRAY_SIZE(bd_idx) = Var_Len_Array;
14665 BD_ARRAY_CLASS(bd_idx) = Explicit_Shape;
14666 BD_RESOLVED(bd_idx) = TRUE;
14667
14668 gen_opnd(&dv_opnd, dv_attr_idx, AT_Tbl_Idx, line, col);
14669
14670 for (i =1; i <= BD_RANK(ATD_ARRAY_IDX(dv_attr_idx)); i++) {
14671
14672
14673
14674 gen_dv_access_low_bound(&opnd, &dv_opnd, i);
14675
14676 if (OPND_FLD(opnd) == CN_Tbl_Idx ||
14677 (OPND_FLD(opnd) == AT_Tbl_Idx &&
14678 ATD_CLASS(OPND_IDX(opnd)) == Compiler_Tmp)) {
14679
14680 BD_LB_FLD(bd_idx,i) = OPND_FLD(opnd);
14681 BD_LB_IDX(bd_idx,i) = OPND_IDX(opnd);
14682 }
14683 else {
14684 GEN_COMPILER_TMP_ASG(asg_idx,
14685 tmp_idx,
14686 TRUE,
14687 line,
14688 col,
14689 SA_INTEGER_DEFAULT_TYPE,
14690 Priv);
14691
14692 COPY_OPND(IR_OPND_R(asg_idx), opnd);
14693
14694 gen_sh(Before, Assignment_Stmt, line, col,
14695 FALSE, FALSE, TRUE);
14696 SH_IR_IDX(SH_PREV_IDX(curr_stmt_sh_idx)) = asg_idx;
14697 SH_P2_SKIP_ME(SH_PREV_IDX(curr_stmt_sh_idx)) = TRUE;
14698
14699 gen_copyin_bounds_stmt(tmp_idx);
14700
14701 BD_LB_FLD(bd_idx,i) = AT_Tbl_Idx;
14702 BD_LB_IDX(bd_idx,i) = tmp_idx;
14703 }
14704
14705
14706
14707 GEN_COMPILER_TMP_ASG(asg_idx,
14708 tmp_idx,
14709 TRUE,
14710 line,
14711 col,
14712 SA_INTEGER_DEFAULT_TYPE,
14713 Priv);
14714
14715 NTR_IR_TBL(ir_idx);
14716 IR_OPR(ir_idx) = Dv_Access_Extent;
14717 IR_DV_DIM(ir_idx) = i;
14718 IR_TYPE_IDX(ir_idx) = SA_INTEGER_DEFAULT_TYPE;
14719 IR_LINE_NUM(ir_idx) = line;
14720 IR_COL_NUM(ir_idx) = col;
14721
14722 IR_FLD_L(ir_idx) = AT_Tbl_Idx;
14723 IR_IDX_L(ir_idx) = dv_attr_idx;
14724 IR_LINE_NUM_L(ir_idx) = line;
14725 IR_COL_NUM_L(ir_idx) = col;
14726
14727 IR_FLD_R(asg_idx) = IR_Tbl_Idx;
14728 IR_IDX_R(asg_idx) = ir_idx;
14729
14730 gen_sh(Before, Assignment_Stmt, line, col,
14731 FALSE, FALSE, TRUE);
14732 SH_IR_IDX(SH_PREV_IDX(curr_stmt_sh_idx)) = asg_idx;
14733 SH_P2_SKIP_ME(SH_PREV_IDX(curr_stmt_sh_idx)) = TRUE;
14734
14735 gen_copyin_bounds_stmt(tmp_idx);
14736
14737 BD_XT_FLD(bd_idx,i) = AT_Tbl_Idx;
14738 BD_XT_IDX(bd_idx,i) = tmp_idx;
14739
14740 if (i == 1) {
14741 OPND_FLD(len_opnd) = AT_Tbl_Idx;
14742 OPND_IDX(len_opnd) = tmp_idx;
14743 OPND_LINE_NUM(len_opnd) = line;
14744 OPND_COL_NUM(len_opnd) = col;
14745 }
14746 else {
14747 NTR_IR_TBL(ir_idx);
14748 IR_OPR(ir_idx) = Mult_Opr;
14749 IR_TYPE_IDX(ir_idx) = CG_INTEGER_DEFAULT_TYPE;
14750 IR_LINE_NUM(ir_idx) = line;
14751 IR_COL_NUM(ir_idx) = col;
14752
14753 COPY_OPND(IR_OPND_L(ir_idx), len_opnd);
14754 IR_FLD_R(ir_idx) = AT_Tbl_Idx;
14755 IR_IDX_R(ir_idx) = tmp_idx;
14756 IR_LINE_NUM_R(ir_idx) = line;
14757 IR_COL_NUM_R(ir_idx) = col;
14758
14759 OPND_FLD(len_opnd) = IR_Tbl_Idx;
14760 OPND_IDX(len_opnd) = ir_idx;
14761 }
14762
14763
14764
14765 GEN_COMPILER_TMP_ASG(asg_idx,
14766 tmp_idx,
14767 TRUE,
14768 line,
14769 col,
14770 SA_INTEGER_DEFAULT_TYPE,
14771 Priv);
14772
14773 NTR_IR_TBL(ir_idx);
14774 IR_OPR(ir_idx) = Dv_Access_Stride_Mult;
14775 IR_DV_DIM(ir_idx) = i;
14776 IR_TYPE_IDX(ir_idx) = SA_INTEGER_DEFAULT_TYPE;
14777 IR_LINE_NUM(ir_idx) = line;
14778 IR_COL_NUM(ir_idx) = col;
14779
14780 IR_FLD_L(ir_idx) = AT_Tbl_Idx;
14781 IR_IDX_L(ir_idx) = dv_attr_idx;
14782 IR_LINE_NUM_L(ir_idx) = line;
14783 IR_COL_NUM_L(ir_idx) = col;
14784
14785 IR_FLD_R(asg_idx) = IR_Tbl_Idx;
14786 IR_IDX_R(asg_idx) = ir_idx;
14787
14788 gen_sh(Before, Assignment_Stmt, line, col,
14789 FALSE, FALSE, TRUE);
14790 SH_IR_IDX(SH_PREV_IDX(curr_stmt_sh_idx)) = asg_idx;
14791 SH_P2_SKIP_ME(SH_PREV_IDX(curr_stmt_sh_idx)) = TRUE;
14792
14793 BD_SM_FLD(bd_idx,i) = AT_Tbl_Idx;
14794 BD_SM_IDX(bd_idx,i) = tmp_idx;
14795
14796
14797
14798 GEN_COMPILER_TMP_ASG(asg_idx,
14799 tmp_idx,
14800 TRUE,
14801 line,
14802 col,
14803 SA_INTEGER_DEFAULT_TYPE,
14804 Priv);
14805
14806 NTR_IR_TBL(plus_idx);
14807 IR_OPR(plus_idx) = Plus_Opr;
14808 IR_TYPE_IDX(plus_idx) = CG_INTEGER_DEFAULT_TYPE;
14809 IR_LINE_NUM(plus_idx) = line;
14810 IR_COL_NUM(plus_idx) = col;
14811
14812 IR_FLD_L(plus_idx) = AT_Tbl_Idx;
14813 IR_IDX_L(plus_idx) = BD_LB_IDX(bd_idx,i);
14814 IR_LINE_NUM_L(plus_idx) = line;
14815 IR_COL_NUM_L(plus_idx) = col;
14816
14817 IR_FLD_R(plus_idx) = AT_Tbl_Idx;
14818 IR_IDX_R(plus_idx) = BD_XT_IDX(bd_idx,i);
14819 IR_LINE_NUM_R(plus_idx) = line;
14820 IR_COL_NUM_R(plus_idx) = col;
14821
14822 NTR_IR_TBL(minus_idx);
14823 IR_OPR(minus_idx) = Minus_Opr;
14824 IR_TYPE_IDX(minus_idx) = CG_INTEGER_DEFAULT_TYPE;
14825 IR_LINE_NUM(minus_idx) = line;
14826 IR_COL_NUM(minus_idx) = col;
14827
14828 IR_FLD_L(minus_idx) = IR_Tbl_Idx;
14829 IR_IDX_L(minus_idx) = plus_idx;
14830
14831 IR_FLD_R(minus_idx) = CN_Tbl_Idx;
14832 IR_IDX_R(minus_idx) = CN_INTEGER_ONE_IDX;
14833 IR_LINE_NUM_R(minus_idx) = line;
14834 IR_COL_NUM_R(minus_idx) = col;
14835
14836 IR_FLD_R(asg_idx) = IR_Tbl_Idx;
14837 IR_IDX_R(asg_idx) = minus_idx;
14838
14839 gen_sh(Before, Assignment_Stmt, line, col,
14840 FALSE, FALSE, TRUE);
14841 SH_IR_IDX(SH_PREV_IDX(curr_stmt_sh_idx)) = asg_idx;
14842 SH_P2_SKIP_ME(SH_PREV_IDX(curr_stmt_sh_idx)) = TRUE;
14843
14844 gen_copyin_bounds_stmt(tmp_idx);
14845
14846 BD_UB_FLD(bd_idx,i) = AT_Tbl_Idx;
14847 BD_UB_IDX(bd_idx,i) = tmp_idx;
14848 }
14849
14850 GEN_COMPILER_TMP_ASG(asg_idx,
14851 tmp_idx,
14852 TRUE,
14853 line,
14854 col,
14855 SA_INTEGER_DEFAULT_TYPE,
14856 Priv);
14857
14858 COPY_OPND(IR_OPND_R(asg_idx), len_opnd);
14859
14860 gen_sh(Before, Assignment_Stmt, line, col,
14861 FALSE, FALSE, TRUE);
14862 SH_IR_IDX(SH_PREV_IDX(curr_stmt_sh_idx)) = asg_idx;
14863 SH_P2_SKIP_ME(SH_PREV_IDX(curr_stmt_sh_idx)) = TRUE;
14864
14865 BD_LEN_FLD(bd_idx) = AT_Tbl_Idx;
14866 BD_LEN_IDX(bd_idx) = tmp_idx;
14867
14868 BD_FLOW_DEPENDENT(bd_idx) = TRUE;
14869
14870 bd_idx = ntr_array_in_bd_tbl(bd_idx);
14871
14872 TRACE (Func_Exit, "capture_bounds_from_dv", NULL);
14873
14874 return(bd_idx);
14875
14876 }
14877 # endif
14878
14879
14880
14881
14882
14883
14884
14885
14886
14887
14888
14889
14890
14891
14892
14893
14894
14895 static void translate_distant_ref2(opnd_type *result_opnd,
14896 expr_arg_type *exp_desc,
14897 int pe_dim_list_idx)
14898
14899 {
14900 int attr_idx;
14901 int bd_idx;
14902 long_type bytes_per_element[MAX_WORDS_FOR_INTEGER];
14903 opnd_type bytes_opnd;
14904 int col;
14905 int div_idx;
14906 int i;
14907 int line;
14908 int list_idx;
14909 boolean ok;
14910 opnd_type opnd;
14911 int plus_idx;
14912 int plus_idx2;
14913 int sub_idx;
14914 int type_idx;
14915 int type1_idx;
14916
14917
14918 TRACE (Func_Entry, "translate_distant_ref2", NULL);
14919
14920 find_opnd_line_and_column(result_opnd, &line, &col);
14921
14922 sub_idx = OPND_IDX((*result_opnd));
14923
14924 while (IR_FLD_L(sub_idx) != AT_Tbl_Idx) {
14925 sub_idx = IR_IDX_L(sub_idx);
14926 }
14927
14928 attr_idx = IR_IDX_L(sub_idx);
14929
14930 type_idx = ATD_TYPE_IDX(attr_idx);
14931
14932 OPND_LINE_NUM(bytes_opnd) = line;
14933 OPND_COL_NUM(bytes_opnd) = col;
14934
14935 if (TYP_TYPE(type_idx) == Structure) {
14936 # ifdef _DEBUG
14937 if (ATT_STRUCT_BIT_LEN_FLD(TYP_IDX(type_idx)) != CN_Tbl_Idx) {
14938 PRINTMSG(line, 626, Internal, col,
14939 "CN_Tbl_Idx", "translate_distant_ref2");
14940 }
14941 # endif
14942 type1_idx = CN_TYPE_IDX(ATT_STRUCT_BIT_LEN_IDX(TYP_IDX(type_idx)));
14943
14944 ok = folder_driver((char *)
14945 &CN_CONST(ATT_STRUCT_BIT_LEN_IDX(TYP_IDX(type_idx))),
14946 type1_idx,
14947 (char *)&CN_CONST(CN_INTEGER_CHAR_BIT_IDX),
14948 CG_INTEGER_DEFAULT_TYPE,
14949 bytes_per_element,
14950 &type1_idx,
14951 line,
14952 col,
14953 2,
14954 Div_Opr);
14955
14956 OPND_FLD(bytes_opnd) = CN_Tbl_Idx;
14957 OPND_IDX(bytes_opnd) = ntr_const_tbl(type1_idx,
14958 FALSE,
14959 bytes_per_element);
14960 }
14961 else if (TYP_TYPE(type_idx) == Character) {
14962 OPND_FLD(bytes_opnd) = TYP_FLD(type_idx);
14963 OPND_IDX(bytes_opnd) = TYP_IDX(type_idx);
14964 }
14965 else {
14966 OPND_FLD(bytes_opnd) = CN_Tbl_Idx;
14967 OPND_IDX(bytes_opnd) = C_INT_TO_CN(CG_INTEGER_DEFAULT_TYPE,
14968 (storage_bit_size_tbl[TYP_LINEAR(type_idx)] / 8));
14969 }
14970
14971 bd_idx = ATD_PE_ARRAY_IDX(attr_idx);
14972
14973 NTR_IR_TBL(plus_idx);
14974 IR_OPR(plus_idx) = Plus_Opr;
14975 IR_TYPE_IDX(plus_idx) = Integer_8;
14976 IR_LINE_NUM(plus_idx) = line;
14977 IR_COL_NUM(plus_idx) = col;
14978
14979 linearize_pe_dims(pe_dim_list_idx,
14980 bd_idx,
14981 line,
14982 col,
14983 &opnd);
14984
14985
14986
14987 gen_bias_ref(&opnd);
14988
14989 COPY_OPND((exp_desc->bias_opnd), opnd);
14990
14991 NTR_IR_TBL(div_idx);
14992 IR_OPR(div_idx) = Div_Opr;
14993 IR_TYPE_IDX(div_idx) = INTEGER_DEFAULT_TYPE;
14994 IR_LINE_NUM(div_idx) = line;
14995 IR_COL_NUM(div_idx) = col;
14996
14997 COPY_OPND(IR_OPND_L(div_idx), opnd);
14998 COPY_OPND(IR_OPND_R(div_idx), bytes_opnd);
14999
15000 IR_FLD_R(plus_idx) = IR_Tbl_Idx;
15001 IR_IDX_R(plus_idx) = div_idx;
15002
15003 if (ATD_ARRAY_IDX(attr_idx) != NULL_IDX) {
15004
15005
15006 list_idx = IR_IDX_R(sub_idx);
15007
15008 if (IL_FLD(list_idx) == IR_Tbl_Idx &&
15009 IR_OPR(IL_IDX(list_idx)) == Triplet_Opr) {
15010
15011
15012 list_idx = IR_IDX_L(IL_IDX(list_idx));
15013
15014 gen_opnd(&opnd, plus_idx, IR_Tbl_Idx, line, col);
15015 copy_subtree(&opnd, &opnd);
15016 plus_idx2 = OPND_IDX(opnd);
15017 COPY_OPND(IR_OPND_L(plus_idx), IL_OPND(list_idx));
15018 IL_FLD(list_idx) = IR_Tbl_Idx;
15019 IL_IDX(list_idx) = plus_idx;
15020
15021 list_idx = IL_NEXT_LIST_IDX(list_idx);
15022 COPY_OPND(IR_OPND_L(plus_idx2), IL_OPND(list_idx));
15023 IL_FLD(list_idx) = IR_Tbl_Idx;
15024 IL_IDX(list_idx) = plus_idx2;
15025
15026 list_idx = IR_IDX_R(sub_idx);
15027 }
15028 else {
15029 COPY_OPND(IR_OPND_L(plus_idx), IL_OPND(list_idx));
15030 IL_FLD(list_idx) = IR_Tbl_Idx;
15031 IL_IDX(list_idx) = plus_idx;
15032 }
15033
15034 for (i = 1; i < BD_RANK(ATD_ARRAY_IDX(attr_idx)); i++) {
15035 list_idx = IL_NEXT_LIST_IDX(list_idx);
15036 }
15037
15038 IL_NEXT_LIST_IDX(list_idx) = NULL_IDX;
15039 IR_LIST_CNT_R(sub_idx) = BD_RANK(ATD_ARRAY_IDX(attr_idx));
15040 }
15041 else {
15042 COPY_OPND(IL_OPND(IR_IDX_R(sub_idx)), IR_OPND_R(plus_idx));
15043 IL_NEXT_LIST_IDX(IR_IDX_R(sub_idx)) = NULL_IDX;
15044 IR_LIST_CNT_R(sub_idx) = 1;
15045 }
15046
15047 TRACE (Func_Exit, "translate_distant_ref2", NULL);
15048
15049 return;
15050
15051 }
15052
15053
15054
15055
15056
15057
15058
15059
15060
15061
15062
15063
15064
15065
15066
15067
15068
15069 static int set_up_pe_offset_attr(void)
15070
15071 {
15072
15073 int attr_idx;
15074 expr_arg_type exp_desc;
15075 int name_idx;
15076 int sb_idx;
15077
15078 # if !defined(_TARGET_OS_UNICOS)
15079 int dt_idx;
15080 int np_idx;
15081 long64 offset;
15082 int prev_sn_idx;
15083 int sn_idx;
15084 # endif
15085
15086 # if defined(_TARGET_OS_UNICOS)
15087 # define BIAS_SIZE 32
15088 # else
15089 # define BIAS_SIZE 128
15090 # endif
15091
15092 TRACE (Func_Entry, "set_up_pe_offset_attr", NULL);
15093
15094
15095
15096
15097
15098 # if defined(_TARGET_OS_UNICOS)
15099 CREATE_ID(TOKEN_ID(token), "_fmm_pe_bias", 12);
15100 TOKEN_LEN(token) = 12;
15101 # else
15102 CREATE_ID(TOKEN_ID(token), "__shmem_local_info", 18);
15103 TOKEN_LEN(token) = 18;
15104 # endif
15105 TOKEN_VALUE(token) = Tok_Id;
15106 TOKEN_LINE(token) = stmt_start_line;
15107 TOKEN_COLUMN(token) = stmt_start_col;
15108
15109 sb_idx = srch_stor_blk_tbl(TOKEN_STR(token),
15110 TOKEN_LEN(token),
15111 curr_scp_idx);
15112
15113 if (sb_idx == NULL_IDX) {
15114 sb_idx = ntr_stor_blk_tbl(TOKEN_STR(token),
15115 TOKEN_LEN(token),
15116 TOKEN_LINE(token),
15117 TOKEN_COLUMN(token),
15118 # if defined(_TARGET_OS_UNICOS)
15119 Task_Common);
15120 # else
15121 Common);
15122 # endif
15123
15124 SB_BLANK_COMMON(sb_idx) = FALSE;
15125 SB_COMMON_NEEDS_OFFSET(sb_idx) = FALSE;
15126 SB_NAME_IN_STONE(sb_idx) = TRUE;
15127 }
15128 else {
15129
15130 }
15131
15132 # if ! defined(_TARGET_OS_UNICOS)
15133
15134
15135
15136
15137
15138 CREATE_ID(TOKEN_ID(token), "__shmem_local_info_type", 23);
15139 TOKEN_LEN(token) = 23;
15140 TOKEN_VALUE(token) = Tok_Id;
15141 TOKEN_LINE(token) = stmt_start_line;
15142 TOKEN_COLUMN(token) = stmt_start_col;
15143
15144 dt_idx = srch_sym_tbl(TOKEN_STR(token), TOKEN_LEN(token), &name_idx);
15145
15146 if (dt_idx == NULL_IDX) {
15147 dt_idx = ntr_sym_tbl(&token, name_idx);
15148 AT_OBJ_CLASS(dt_idx) = Derived_Type;
15149 ATT_SCP_IDX(dt_idx) = curr_scp_idx;
15150 ATT_NUMERIC_CPNT(dt_idx) = TRUE;
15151 ATT_DCL_NUMERIC_SEQ(dt_idx) = TRUE;
15152 ATT_SEQUENCE_SET(dt_idx) = TRUE;
15153 #ifdef KEY
15154 ATT_ALIGNMENT(dt_idx) = Align_64;
15155 #endif
15156 }
15157 else {
15158
15159 }
15160
15161 ATT_NUM_CPNTS(dt_idx) = 0;
15162
15163
15164
15165
15166
15167 offset = 0;
15168
15169
15170
15171 CREATE_ID(TOKEN_ID(token), "anchor", 6);
15172 TOKEN_LEN(token) = 6;
15173 TOKEN_VALUE(token) = Tok_Id;
15174 TOKEN_LINE(token) = stmt_start_line;
15175 TOKEN_COLUMN(token) = stmt_start_col;
15176
15177 NTR_SN_TBL(sn_idx);
15178 NTR_NAME_POOL(TOKEN_ID(token).words, TOKEN_LEN(token), np_idx);
15179 NTR_ATTR_TBL(attr_idx);
15180 AT_OBJ_CLASS(attr_idx) = Data_Obj;
15181 AT_DEF_LINE(attr_idx) = TOKEN_LINE(token);
15182 AT_DEF_COLUMN(attr_idx) = TOKEN_COLUMN(token);
15183 AT_NAME_LEN(attr_idx) = TOKEN_LEN(token);
15184 AT_NAME_IDX(attr_idx) = np_idx;
15185 SN_NAME_LEN(sn_idx) = TOKEN_LEN(token);
15186 SN_NAME_IDX(sn_idx) = np_idx;
15187 SN_ATTR_IDX(sn_idx) = attr_idx;
15188
15189 AT_SEMANTICS_DONE(attr_idx) = TRUE;
15190 ATD_CLASS(attr_idx) = Struct_Component;
15191 ATD_DERIVED_TYPE_IDX(attr_idx) = dt_idx;
15192
15193 AT_TYPED(attr_idx) = TRUE;
15194
15195 ATD_TYPE_IDX(attr_idx) = Integer_4;
15196
15197 ATD_OFFSET_ASSIGNED(attr_idx) = TRUE;
15198 ATD_OFFSET_FLD(attr_idx) = CN_Tbl_Idx;
15199 ATD_CPNT_OFFSET_IDX(attr_idx) = CN_INTEGER_ZERO_IDX;
15200
15201 offset += storage_bit_size_tbl[TYP_LINEAR(ATD_TYPE_IDX(attr_idx))];
15202
15203 ATT_FIRST_CPNT_IDX(dt_idx) = sn_idx;
15204 ATT_NUM_CPNTS(dt_idx) += 1;
15205
15206 prev_sn_idx = sn_idx;
15207
15208
15209
15210 CREATE_ID(TOKEN_ID(token), "mype", 4);
15211 TOKEN_LEN(token) = 4;
15212 TOKEN_VALUE(token) = Tok_Id;
15213 TOKEN_LINE(token) = stmt_start_line;
15214 TOKEN_COLUMN(token) = stmt_start_col;
15215
15216 NTR_SN_TBL(sn_idx);
15217 NTR_NAME_POOL(TOKEN_ID(token).words, TOKEN_LEN(token), np_idx);
15218 NTR_ATTR_TBL(attr_idx);
15219 AT_OBJ_CLASS(attr_idx) = Data_Obj;
15220 AT_DEF_LINE(attr_idx) = TOKEN_LINE(token);
15221 AT_DEF_COLUMN(attr_idx) = TOKEN_COLUMN(token);
15222 AT_NAME_LEN(attr_idx) = TOKEN_LEN(token);
15223 AT_NAME_IDX(attr_idx) = np_idx;
15224 SN_NAME_LEN(sn_idx) = TOKEN_LEN(token);
15225 SN_NAME_IDX(sn_idx) = np_idx;
15226 SN_ATTR_IDX(sn_idx) = attr_idx;
15227
15228 AT_SEMANTICS_DONE(attr_idx) = TRUE;
15229 ATD_CLASS(attr_idx) = Struct_Component;
15230 ATD_DERIVED_TYPE_IDX(attr_idx) = dt_idx;
15231 AT_TYPED(attr_idx) = TRUE;
15232
15233 ATD_TYPE_IDX(attr_idx) = Integer_4;
15234
15235 ATD_OFFSET_ASSIGNED(attr_idx) = TRUE;
15236 ATD_OFFSET_FLD(attr_idx) = CN_Tbl_Idx;
15237 ATD_CPNT_OFFSET_IDX(attr_idx) = C_INT_TO_CN(CG_INTEGER_DEFAULT_TYPE, offset);
15238
15239 offset += storage_bit_size_tbl[TYP_LINEAR(ATD_TYPE_IDX(attr_idx))];
15240
15241 ATT_NUM_CPNTS(dt_idx) += 1;
15242 SN_SIBLING_LINK(prev_sn_idx) = sn_idx;
15243
15244 prev_sn_idx = sn_idx;
15245
15246
15247
15248 CREATE_ID(TOKEN_ID(token), "initcomplete", 12);
15249 TOKEN_LEN(token) = 12;
15250 TOKEN_VALUE(token) = Tok_Id;
15251 TOKEN_LINE(token) = stmt_start_line;
15252 TOKEN_COLUMN(token) = stmt_start_col;
15253
15254 NTR_SN_TBL(sn_idx);
15255 NTR_NAME_POOL(TOKEN_ID(token).words, TOKEN_LEN(token), np_idx);
15256 NTR_ATTR_TBL(attr_idx);
15257 AT_OBJ_CLASS(attr_idx) = Data_Obj;
15258 AT_DEF_LINE(attr_idx) = TOKEN_LINE(token);
15259 AT_DEF_COLUMN(attr_idx) = TOKEN_COLUMN(token);
15260 AT_NAME_LEN(attr_idx) = TOKEN_LEN(token);
15261 AT_NAME_IDX(attr_idx) = np_idx;
15262 SN_NAME_LEN(sn_idx) = TOKEN_LEN(token);
15263 SN_NAME_IDX(sn_idx) = np_idx;
15264 SN_ATTR_IDX(sn_idx) = attr_idx;
15265
15266 AT_SEMANTICS_DONE(attr_idx) = TRUE;
15267 ATD_CLASS(attr_idx) = Struct_Component;
15268 ATD_DERIVED_TYPE_IDX(attr_idx) = dt_idx;
15269 AT_TYPED(attr_idx) = TRUE;
15270
15271 ATD_TYPE_IDX(attr_idx) = Integer_4;
15272
15273 ATD_OFFSET_ASSIGNED(attr_idx) = TRUE;
15274 ATD_OFFSET_FLD(attr_idx) = CN_Tbl_Idx;
15275 ATD_CPNT_OFFSET_IDX(attr_idx) = C_INT_TO_CN(CG_INTEGER_DEFAULT_TYPE, offset);
15276
15277 offset += storage_bit_size_tbl[TYP_LINEAR(ATD_TYPE_IDX(attr_idx))] + 32;
15278
15279 ATT_NUM_CPNTS(dt_idx) += 1;
15280 SN_SIBLING_LINK(prev_sn_idx) = sn_idx;
15281
15282 prev_sn_idx = sn_idx;
15283
15284
15285
15286 CREATE_ID(TOKEN_ID(token), "bias", 4);
15287 TOKEN_LEN(token) = 4;
15288 TOKEN_VALUE(token) = Tok_Id;
15289 TOKEN_LINE(token) = stmt_start_line;
15290 TOKEN_COLUMN(token) = stmt_start_col;
15291
15292 NTR_SN_TBL(sn_idx);
15293 NTR_NAME_POOL(TOKEN_ID(token).words, TOKEN_LEN(token), np_idx);
15294 NTR_ATTR_TBL(attr_idx);
15295 AT_OBJ_CLASS(attr_idx) = Data_Obj;
15296 AT_DEF_LINE(attr_idx) = TOKEN_LINE(token);
15297 AT_DEF_COLUMN(attr_idx) = TOKEN_COLUMN(token);
15298 AT_NAME_LEN(attr_idx) = TOKEN_LEN(token);
15299 AT_NAME_IDX(attr_idx) = np_idx;
15300 SN_NAME_LEN(sn_idx) = TOKEN_LEN(token);
15301 SN_NAME_IDX(sn_idx) = np_idx;
15302 SN_ATTR_IDX(sn_idx) = attr_idx;
15303
15304 AT_SEMANTICS_DONE(attr_idx) = TRUE;
15305 ATD_CLASS(attr_idx) = Struct_Component;
15306 ATD_DERIVED_TYPE_IDX(attr_idx) = dt_idx;
15307 AT_TYPED(attr_idx) = TRUE;
15308
15309 ATD_TYPE_IDX(attr_idx) = Integer_8;
15310
15311 exp_desc = init_exp_desc;
15312 exp_desc.type_idx = Integer_8;
15313 exp_desc.linear_type = Integer_8;
15314 exp_desc.type = Integer;
15315 exp_desc.shape[0].fld = CN_Tbl_Idx;
15316
15317 exp_desc.rank = 1;
15318
15319 exp_desc.shape[0].idx = C_INT_TO_CN(CG_INTEGER_DEFAULT_TYPE, BIAS_SIZE);
15320
15321 ATD_ARRAY_IDX(attr_idx) = create_bd_ntry_for_const(&exp_desc,
15322 stmt_start_line,
15323 stmt_start_col);
15324
15325 ATD_OFFSET_ASSIGNED(attr_idx) = TRUE;
15326 ATD_OFFSET_FLD(attr_idx) = CN_Tbl_Idx;
15327 ATD_CPNT_OFFSET_IDX(attr_idx) = C_INT_TO_CN(CG_INTEGER_DEFAULT_TYPE, offset);
15328
15329 offset += BIAS_SIZE *
15330 storage_bit_size_tbl[TYP_LINEAR(ATD_TYPE_IDX(attr_idx))];
15331
15332 ATT_NUM_CPNTS(dt_idx) += 1;
15333 SN_SIBLING_LINK(prev_sn_idx) = sn_idx;
15334
15335 prev_sn_idx = sn_idx;
15336
15337
15338
15339 CREATE_ID(TOKEN_ID(token), "shheapbase", 10);
15340 TOKEN_LEN(token) = 10;
15341 TOKEN_VALUE(token) = Tok_Id;
15342 TOKEN_LINE(token) = stmt_start_line;
15343 TOKEN_COLUMN(token) = stmt_start_col;
15344
15345 NTR_SN_TBL(sn_idx);
15346 NTR_NAME_POOL(TOKEN_ID(token).words, TOKEN_LEN(token), np_idx);
15347 NTR_ATTR_TBL(attr_idx);
15348 AT_OBJ_CLASS(attr_idx) = Data_Obj;
15349 AT_DEF_LINE(attr_idx) = TOKEN_LINE(token);
15350 AT_DEF_COLUMN(attr_idx) = TOKEN_COLUMN(token);
15351 AT_NAME_LEN(attr_idx) = TOKEN_LEN(token);
15352 AT_NAME_IDX(attr_idx) = np_idx;
15353 SN_NAME_LEN(sn_idx) = TOKEN_LEN(token);
15354 SN_NAME_IDX(sn_idx) = np_idx;
15355 SN_ATTR_IDX(sn_idx) = attr_idx;
15356
15357 AT_SEMANTICS_DONE(attr_idx) = TRUE;
15358 ATD_CLASS(attr_idx) = Struct_Component;
15359 ATD_DERIVED_TYPE_IDX(attr_idx) = dt_idx;
15360 AT_TYPED(attr_idx) = TRUE;
15361
15362 ATD_TYPE_IDX(attr_idx) = SA_INTEGER_DEFAULT_TYPE;
15363
15364 ATD_OFFSET_ASSIGNED(attr_idx) = TRUE;
15365 ATD_OFFSET_FLD(attr_idx) = CN_Tbl_Idx;
15366 ATD_CPNT_OFFSET_IDX(attr_idx) = C_INT_TO_CN(CG_INTEGER_DEFAULT_TYPE,offset);
15367
15368 offset += storage_bit_size_tbl[TYP_LINEAR(ATD_TYPE_IDX(attr_idx))];
15369
15370 ATT_NUM_CPNTS(dt_idx) += 1;
15371 SN_SIBLING_LINK(prev_sn_idx) = sn_idx;
15372
15373 prev_sn_idx = sn_idx;
15374
15375
15376
15377 CREATE_ID(TOKEN_ID(token), "shheapend", 9);
15378 TOKEN_LEN(token) = 9;
15379 TOKEN_VALUE(token) = Tok_Id;
15380 TOKEN_LINE(token) = stmt_start_line;
15381 TOKEN_COLUMN(token) = stmt_start_col;
15382
15383 NTR_SN_TBL(sn_idx);
15384 NTR_NAME_POOL(TOKEN_ID(token).words, TOKEN_LEN(token), np_idx);
15385 NTR_ATTR_TBL(attr_idx);
15386 AT_OBJ_CLASS(attr_idx) = Data_Obj;
15387 AT_DEF_LINE(attr_idx) = TOKEN_LINE(token);
15388 AT_DEF_COLUMN(attr_idx) = TOKEN_COLUMN(token);
15389 AT_NAME_LEN(attr_idx) = TOKEN_LEN(token);
15390 AT_NAME_IDX(attr_idx) = np_idx;
15391 SN_NAME_LEN(sn_idx) = TOKEN_LEN(token);
15392 SN_NAME_IDX(sn_idx) = np_idx;
15393 SN_ATTR_IDX(sn_idx) = attr_idx;
15394
15395 AT_SEMANTICS_DONE(attr_idx) = TRUE;
15396 ATD_CLASS(attr_idx) = Struct_Component;
15397 ATD_DERIVED_TYPE_IDX(attr_idx) = dt_idx;
15398 AT_TYPED(attr_idx) = TRUE;
15399
15400 ATD_TYPE_IDX(attr_idx) = SA_INTEGER_DEFAULT_TYPE;
15401
15402 ATD_OFFSET_ASSIGNED(attr_idx) = TRUE;
15403 ATD_OFFSET_FLD(attr_idx) = CN_Tbl_Idx;
15404 ATD_CPNT_OFFSET_IDX(attr_idx) = C_INT_TO_CN(CG_INTEGER_DEFAULT_TYPE, offset);
15405
15406 offset += storage_bit_size_tbl[TYP_LINEAR(ATD_TYPE_IDX(attr_idx))];
15407
15408 ATT_NUM_CPNTS(dt_idx) += 1;
15409 SN_SIBLING_LINK(prev_sn_idx) = sn_idx;
15410
15411
15412 ATT_STRUCT_BIT_LEN_FLD(dt_idx) = CN_Tbl_Idx;
15413 #ifdef KEY
15414 ATT_STRUCT_BIT_LEN_IDX(dt_idx) = C_INT_TO_CN(CG_INTEGER_DEFAULT_TYPE,
15415 offset);
15416 #else
15417 ATT_STRUCT_BIT_LEN_IDX(attr_idx) = C_INT_TO_CN(CG_INTEGER_DEFAULT_TYPE,
15418 offset);
15419 #endif
15420
15421
15422
15423
15424
15425 CREATE_ID(TOKEN_ID(token), "_shmem_local_info", 17);
15426 TOKEN_LEN(token) = 17;
15427 TOKEN_VALUE(token) = Tok_Id;
15428 TOKEN_LINE(token) = stmt_start_line;
15429 TOKEN_COLUMN(token) = stmt_start_col;
15430
15431 attr_idx = srch_sym_tbl(TOKEN_STR(token), TOKEN_LEN(token), &name_idx);
15432
15433 if (attr_idx == NULL_IDX) {
15434 attr_idx = ntr_sym_tbl(&token, name_idx);
15435
15436 AT_OBJ_CLASS(attr_idx) = Data_Obj;
15437 AT_REFERENCED(attr_idx) = Referenced;
15438 AT_LOCKED_IN(attr_idx) = TRUE;
15439 AT_TYPED(attr_idx) = TRUE;
15440 AT_SEMANTICS_DONE(attr_idx) = TRUE;
15441 ATD_CLASS(attr_idx) = Variable;
15442 ATD_IN_COMMON(attr_idx) = TRUE;
15443 ATD_OFFSET_ASSIGNED(attr_idx) = TRUE;
15444
15445 CLEAR_TBL_NTRY(type_tbl, TYP_WORK_IDX);
15446 TYP_TYPE(TYP_WORK_IDX) = Structure;
15447 TYP_LINEAR(TYP_WORK_IDX) = Structure_Type;
15448 TYP_IDX(TYP_WORK_IDX) = dt_idx;
15449
15450 ATD_TYPE_IDX(attr_idx) = ntr_type_tbl();
15451 ATD_STOR_BLK_IDX(attr_idx) = sb_idx;
15452 ATD_OFFSET_FLD(attr_idx) = CN_Tbl_Idx;
15453 ATD_OFFSET_IDX(attr_idx) = CN_INTEGER_ZERO_IDX;
15454 }
15455 else {
15456
15457 }
15458
15459 SB_FIRST_ATTR_IDX(sb_idx) = attr_idx;
15460 SB_LEN_FLD(sb_idx) = CN_Tbl_Idx;
15461 SB_LEN_IDX(sb_idx) = ATT_STRUCT_BIT_LEN_IDX(dt_idx);
15462
15463 # else
15464
15465
15466
15467
15468
15469 CREATE_ID(TOKEN_ID(token), "__fmm_pe_bias", 13);
15470 TOKEN_LEN(token) = 13;
15471 TOKEN_VALUE(token) = Tok_Id;
15472 TOKEN_LINE(token) = stmt_start_line;
15473 TOKEN_COLUMN(token) = stmt_start_col;
15474
15475 attr_idx = srch_sym_tbl(TOKEN_STR(token), TOKEN_LEN(token), &name_idx);
15476
15477 if (attr_idx == NULL_IDX) {
15478 attr_idx = ntr_sym_tbl(&token, name_idx);
15479
15480 AT_OBJ_CLASS(attr_idx) = Data_Obj;
15481 AT_REFERENCED(attr_idx) = Referenced;
15482 AT_LOCKED_IN(attr_idx) = TRUE;
15483 AT_TYPED(attr_idx) = TRUE;
15484 AT_SEMANTICS_DONE(attr_idx) = TRUE;
15485 ATD_CLASS(attr_idx) = Variable;
15486 ATD_IN_COMMON(attr_idx) = TRUE;
15487 ATD_OFFSET_ASSIGNED(attr_idx) = TRUE;
15488
15489 ATD_TYPE_IDX(attr_idx) = Integer_8;
15490
15491 exp_desc = init_exp_desc;
15492 exp_desc.type_idx = Integer_8;
15493 exp_desc.linear_type = Integer_8;
15494 exp_desc.type = Integer;
15495 exp_desc.shape[0].fld = CN_Tbl_Idx;
15496
15497 exp_desc.rank = 1;
15498
15499 exp_desc.shape[0].idx = C_INT_TO_CN(CG_INTEGER_DEFAULT_TYPE, BIAS_SIZE);
15500
15501 ATD_ARRAY_IDX(attr_idx) = create_bd_ntry_for_const(&exp_desc,
15502 stmt_start_line,
15503 stmt_start_col);
15504 ATD_STOR_BLK_IDX(attr_idx) = sb_idx;
15505 ATD_OFFSET_FLD(attr_idx) = CN_Tbl_Idx;
15506 ATD_OFFSET_IDX(attr_idx) = CN_INTEGER_ZERO_IDX;
15507 }
15508 else {
15509
15510 }
15511
15512 SB_FIRST_ATTR_IDX(sb_idx) = attr_idx;
15513 SB_LEN_FLD(sb_idx) = CN_Tbl_Idx;
15514
15515 SB_LEN_IDX(sb_idx) = C_INT_TO_CN(CG_INTEGER_DEFAULT_TYPE, (BIAS_SIZE * 64));
15516
15517 # endif
15518
15519 TRACE (Func_Exit, "set_up_pe_offset_attr", NULL);
15520
15521 return(attr_idx);
15522
15523 }
15524
15525
15526
15527
15528
15529
15530
15531
15532
15533
15534
15535
15536
15537
15538
15539
15540
15541 static void gen_bias_ref(opnd_type *opnd)
15542
15543 {
15544 int col;
15545 int line;
15546 int list_idx;
15547 int sub_idx;
15548
15549 # if ! defined(_TARGET_OS_UNICOS)
15550 int bias_idx;
15551 int struct_idx;
15552 # endif
15553
15554
15555
15556 TRACE (Func_Entry, "gen_bias_ref", NULL);
15557
15558 find_opnd_line_and_column(opnd, &line, &col);
15559
15560 if (glb_tbl_idx[Pe_Offset_Attr_Idx] == NULL_IDX) {
15561 glb_tbl_idx[Pe_Offset_Attr_Idx] = set_up_pe_offset_attr();
15562 }
15563
15564 # if ! defined(_TARGET_OS_UNICOS)
15565 bias_idx = SN_ATTR_IDX(SN_SIBLING_LINK(SN_SIBLING_LINK(SN_SIBLING_LINK(
15566 ATT_FIRST_CPNT_IDX(TYP_IDX(ATD_TYPE_IDX(
15567 glb_tbl_idx[Pe_Offset_Attr_Idx])))))));
15568
15569 NTR_IR_TBL(sub_idx);
15570 IR_OPR(sub_idx) = Subscript_Opr;
15571 IR_TYPE_IDX(sub_idx) = ATD_TYPE_IDX(bias_idx);
15572 IR_LINE_NUM(sub_idx) = line;
15573 IR_COL_NUM(sub_idx) = col;
15574 IR_FLD_R(sub_idx) = IL_Tbl_Idx;
15575 IR_LIST_CNT_R(sub_idx) = 1;
15576
15577 NTR_IR_LIST_TBL(list_idx);
15578
15579 IR_IDX_R(sub_idx) = list_idx;
15580
15581 COPY_OPND(IL_OPND(list_idx), (*opnd));
15582
15583 NTR_IR_TBL(struct_idx);
15584 IR_OPR(struct_idx) = Struct_Opr;
15585 IR_TYPE_IDX(struct_idx) = ATD_TYPE_IDX(bias_idx);
15586 IR_LINE_NUM(struct_idx) = line;
15587 IR_COL_NUM(struct_idx) = col;
15588 IR_LINE_NUM_L(struct_idx) = line;
15589 IR_COL_NUM_L(struct_idx) = col;
15590 IR_LINE_NUM_R(struct_idx) = line;
15591 IR_COL_NUM_R(struct_idx) = col;
15592
15593 IR_FLD_L(struct_idx) = AT_Tbl_Idx;
15594 IR_IDX_L(struct_idx) = glb_tbl_idx[Pe_Offset_Attr_Idx];
15595 IR_FLD_R(struct_idx) = AT_Tbl_Idx;
15596 IR_IDX_R(struct_idx) = bias_idx;
15597
15598 IR_FLD_L(sub_idx) = IR_Tbl_Idx;
15599 IR_IDX_L(sub_idx) = struct_idx;
15600
15601 OPND_FLD((*opnd)) = IR_Tbl_Idx;
15602 OPND_IDX((*opnd)) = sub_idx;
15603
15604 # else
15605
15606 NTR_IR_TBL(sub_idx);
15607 IR_OPR(sub_idx) = Subscript_Opr;
15608 IR_TYPE_IDX(sub_idx) = Integer_8;
15609 IR_LINE_NUM(sub_idx) = line;
15610 IR_COL_NUM(sub_idx) = col;
15611 IR_FLD_R(sub_idx) = IL_Tbl_Idx;
15612 IR_LIST_CNT_R(sub_idx) = 1;
15613
15614 NTR_IR_LIST_TBL(list_idx);
15615
15616 IR_IDX_R(sub_idx) = list_idx;
15617
15618 IR_FLD_L(sub_idx) = AT_Tbl_Idx;
15619 IR_IDX_L(sub_idx) = glb_tbl_idx[Pe_Offset_Attr_Idx];
15620 IR_LINE_NUM_L(sub_idx) = line;
15621 IR_COL_NUM_L(sub_idx) = col;
15622
15623 COPY_OPND(IL_OPND(list_idx), (*opnd));
15624
15625 OPND_FLD((*opnd)) = IR_Tbl_Idx;
15626 OPND_IDX((*opnd)) = sub_idx;
15627 # endif
15628
15629 TRACE (Func_Exit, "gen_bias_ref", NULL);
15630
15631 return;
15632
15633 }
15634 # endif
15635
15636
15637
15638
15639
15640
15641
15642
15643
15644
15645
15646
15647
15648
15649
15650
15651
15652
15653
15654
15655
15656 void transform_cri_ch_ptr(opnd_type *result_opnd)
15657
15658 {
15659 int asg_idx;
15660 int attr_idx;
15661 int col;
15662 int eq_idx;
15663 int eq_tmp_idx;
15664 int line;
15665 int loc_idx;
15666 int overlay_attr_idx;
15667 int ptee_idx;
15668 int ptr_idx;
15669 int sb_idx;
15670
15671 TRACE (Func_Entry, "transform_cri_ch_ptr", NULL);
15672
15673 find_opnd_line_and_column(result_opnd, &line, &col);
15674 attr_idx = find_left_attr(result_opnd);
15675
15676 # ifdef _DEBUG
15677 if (AT_OBJ_CLASS(attr_idx) != Data_Obj) {
15678 PRINTMSG(line, 626, Internal, col,
15679 "Data_Obj", "transform_cri_ch_ptr");
15680 }
15681 else if (OPND_FLD((*result_opnd)) != AT_Tbl_Idx) {
15682 PRINTMSG(line, 626, Internal, col,
15683 "AT_Tbl_Idx", "transform_cri_ch_ptr");
15684 }
15685 else if (TYP_TYPE(ATD_TYPE_IDX(attr_idx)) != CRI_Ch_Ptr) {
15686 PRINTMSG(line, 626, Internal, col,
15687 "CRI_Ch_Ptr", "transform_cri_ch_ptr");
15688 }
15689 else if (defer_stmt_expansion) {
15690 PRINTMSG(line, 626, Internal, col,
15691 "not defer_stmt_expansion", "transform_cri_ch_ptr");
15692 }
15693 # endif
15694
15695 if (ATD_CLASS(attr_idx) == Variable) {
15696
15697 if (ATD_VARIABLE_TMP_IDX(attr_idx) != NULL_IDX) {
15698 overlay_attr_idx = ATD_VARIABLE_TMP_IDX(attr_idx);
15699 goto FOUND;
15700 }
15701
15702 overlay_attr_idx = gen_compiler_tmp(line, col, Shared, TRUE);
15703 ATD_CLASS(overlay_attr_idx) = Variable;
15704 #ifdef KEY
15705 ATD_TYPE_IDX(overlay_attr_idx) = SA_INTEGER_DEFAULT_TYPE;
15706 #else
15707 ATD_TYPE_IDX(overlay_attr_idx) = INTEGER_DEFAULT_TYPE;
15708 #endif
15709 ATD_STOR_BLK_IDX(overlay_attr_idx) = ATD_STOR_BLK_IDX(attr_idx);
15710 ATD_EQUIV(overlay_attr_idx) = TRUE;
15711 AT_REFERENCED(overlay_attr_idx) = Referenced;
15712 AT_SEMANTICS_DONE(overlay_attr_idx) = TRUE;
15713 AT_DEFINED(overlay_attr_idx) = TRUE;
15714
15715 ATD_OFFSET_FLD(overlay_attr_idx) = ATD_OFFSET_FLD(attr_idx);
15716 ATD_OFFSET_IDX(overlay_attr_idx) = ATD_OFFSET_IDX(attr_idx);
15717 ATD_OFFSET_ASSIGNED(overlay_attr_idx) = ATD_OFFSET_ASSIGNED(attr_idx);
15718
15719
15720
15721
15722
15723
15724
15725
15726
15727 if (ATD_EQUIV(attr_idx)) {
15728 eq_idx = SCP_FIRST_EQUIV_GRP(curr_scp_idx);
15729
15730 while (eq_idx != NULL_IDX) {
15731 eq_tmp_idx = eq_idx;
15732 eq_idx = EQ_NEXT_EQUIV_GRP(eq_idx);
15733
15734 while (eq_tmp_idx != NULL_IDX) {
15735
15736 if (EQ_ATTR_IDX(eq_tmp_idx) == attr_idx) {
15737 NTR_EQ_TBL(eq_idx);
15738 COPY_TBL_NTRY(equiv_tbl, eq_idx, eq_tmp_idx);
15739 EQ_NEXT_EQUIV_OBJ(eq_tmp_idx) = eq_idx;
15740 EQ_ATTR_IDX(eq_idx) = overlay_attr_idx;
15741 ATD_OFFSET_FLD(overlay_attr_idx)=
15742 ATD_OFFSET_FLD(attr_idx);
15743 ATD_OFFSET_IDX(overlay_attr_idx)=
15744 ATD_OFFSET_IDX(attr_idx);
15745 ATD_EQUIV(attr_idx) = TRUE;
15746 goto FOUND;
15747 }
15748 eq_tmp_idx = EQ_NEXT_EQUIV_OBJ(eq_tmp_idx);
15749 }
15750 }
15751 }
15752
15753
15754
15755
15756 NTR_EQ_TBL(eq_idx);
15757 NTR_EQ_TBL(eq_tmp_idx);
15758
15759 EQ_NEXT_EQUIV_GRP(eq_idx) = SCP_FIRST_EQUIV_GRP(curr_scp_idx);
15760 SCP_FIRST_EQUIV_GRP(curr_scp_idx) = eq_idx;
15761 EQ_ATTR_IDX(eq_idx) = attr_idx;
15762 EQ_ATTR_IDX(eq_tmp_idx) = overlay_attr_idx;
15763 EQ_NEXT_EQUIV_OBJ(eq_idx) = eq_tmp_idx;
15764 ATD_EQUIV(attr_idx) = TRUE;
15765 ATD_VARIABLE_TMP_IDX(attr_idx) = overlay_attr_idx;
15766 ATD_FLD(attr_idx) = AT_Tbl_Idx;
15767
15768 sb_idx = ATD_STOR_BLK_IDX(attr_idx);
15769
15770 if (SB_BLK_TYPE(sb_idx) == Stack) {
15771 sb_idx = create_equiv_stor_blk(attr_idx, Stack);
15772 SB_EQUIVALENCED(sb_idx) = TRUE;
15773 ATD_STOR_BLK_IDX(overlay_attr_idx) = sb_idx;
15774 ATD_STOR_BLK_IDX(attr_idx) = sb_idx;
15775 }
15776
15777 # if defined(_SEPARATE_NONCOMMON_EQUIV_GROUPS)
15778
15779
15780 if (sb_idx == NULL_IDX ||
15781 (!SB_MODULE(sb_idx) && !SB_IS_COMMON(sb_idx))) {
15782
15783 if (SB_HOSTED_STATIC(sb_idx)) {
15784 sb_idx = create_equiv_stor_blk(attr_idx, SB_BLK_TYPE(sb_idx));
15785 SB_HOSTED_STATIC(sb_idx) = TRUE;
15786 }
15787 else {
15788 sb_idx = create_equiv_stor_blk(attr_idx, SB_BLK_TYPE(sb_idx));
15789 }
15790
15791 ATD_STOR_BLK_IDX(attr_idx) = sb_idx;
15792 ATD_STOR_BLK_IDX(overlay_attr_idx) = sb_idx;
15793 }
15794 # endif
15795
15796 FOUND:
15797
15798 OPND_IDX((*result_opnd)) = overlay_attr_idx;
15799
15800 }
15801 else if (ATD_CLASS(attr_idx) == Dummy_Argument) {
15802
15803 ptr_idx = gen_compiler_tmp(line, col, Shared, TRUE);
15804 ATD_TYPE_IDX(ptr_idx) = CRI_Ptr_8;
15805 AT_SEMANTICS_DONE(ptr_idx) = TRUE;
15806 ATD_STOR_BLK_IDX(ptr_idx) = SCP_SB_STACK_IDX(curr_scp_idx);
15807
15808 ptee_idx = gen_compiler_tmp(line, col, Shared, TRUE);
15809 ATD_CLASS(ptee_idx) = CRI__Pointee;
15810 AT_SEMANTICS_DONE(ptee_idx) = TRUE;
15811 ATD_STOR_BLK_IDX(ptee_idx) = SCP_SB_BASED_IDX(curr_scp_idx);
15812 ATD_TYPE_IDX(ptee_idx) = INTEGER_DEFAULT_TYPE;
15813 ATD_PTR_IDX(ptee_idx) = ptr_idx;
15814
15815
15816
15817 NTR_IR_TBL(asg_idx);
15818 IR_OPR(asg_idx) = Asg_Opr;
15819 IR_TYPE_IDX(asg_idx) = CRI_Ptr_8;
15820 IR_LINE_NUM(asg_idx) = line;
15821 IR_COL_NUM(asg_idx) = col;
15822
15823 IR_FLD_L(asg_idx) = AT_Tbl_Idx;
15824 IR_IDX_L(asg_idx) = ptr_idx;
15825 IR_LINE_NUM_L(asg_idx) = line;
15826 IR_COL_NUM_L(asg_idx) = col;
15827
15828 NTR_IR_TBL(loc_idx);
15829 IR_OPR(loc_idx) = Loc_Opr;
15830 IR_TYPE_IDX(loc_idx) = CRI_Ptr_8;
15831 IR_LINE_NUM(loc_idx) = line;
15832 IR_COL_NUM(loc_idx) = col;
15833
15834
15835
15836 IR_FLD_L(loc_idx) = AT_Tbl_Idx;
15837 IR_IDX_L(loc_idx) = attr_idx;
15838 IR_LINE_NUM_L(loc_idx) = line;
15839 IR_COL_NUM_L(loc_idx) = col;
15840
15841 IR_FLD_R(asg_idx) = IR_Tbl_Idx;
15842 IR_IDX_R(asg_idx) = loc_idx;
15843
15844 gen_sh(Before, Assignment_Stmt, stmt_start_line, stmt_start_col,
15845 FALSE, FALSE, TRUE);
15846
15847 SH_IR_IDX(SH_PREV_IDX(curr_stmt_sh_idx)) = asg_idx;
15848 SH_P2_SKIP_ME(SH_PREV_IDX(curr_stmt_sh_idx)) = TRUE;
15849
15850 OPND_IDX((*result_opnd)) = ptee_idx;;
15851 }
15852 else {
15853 PRINTMSG(line, 626, Internal, col,
15854 "variable or dummy arg", "transform_cri_ch_ptr");
15855 }
15856
15857 TRACE (Func_Exit, "transform_cri_ch_ptr", NULL);
15858
15859 return;
15860
15861 }