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