Skip to content

Commit a23fa3b

Browse files
committed
Fix when the array being passed is an member of a derived type
When constructing the runtime call to create the temporary descriptor, need to call check_member().
1 parent f7b60c1 commit a23fa3b

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

tools/flang1/flang1exe/dpm_out.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2358,19 +2358,19 @@ emit_alnd(int sptr, int memberast, LOGICAL free_flag, LOGICAL for_allocate,
23582358
}
23592359

23602360
void
2361-
make_temp_descriptor(int sptr_orig, int sptr_tmp, int before_std)
2361+
make_temp_descriptor(int ast_ele, SPTR sptr_orig, SPTR sptr_tmp, int before_std)
23622362
{
23632363
/* call pgf90_temp_desc(tmp desc, orig desc) */
23642364
SPTR sptr_descr;
2365-
int sptrdescr_arg, ast;
2365+
int ast;
23662366
int nargs = 2;
23672367
int argt = mk_argt(nargs);
23682368
sptr_descr = DESCRG(sptr_tmp);
2369-
sptrdescr_arg = mk_id(sptr_descr);
2370-
ARGT_ARG(argt, 0) = sptrdescr_arg;
2369+
assert(sptr_descr,"missing descriptor for tmp",(int)sptr_tmp,ERR_Fatal);
2370+
ARGT_ARG(argt, 0) = mk_id(sptr_descr);
23712371
sptr_descr = DESCRG(sptr_orig);
2372-
sptrdescr_arg = mk_id(sptr_descr);
2373-
ARGT_ARG(argt, 1) = sptrdescr_arg;
2372+
assert(sptr_descr,"missing descriptor for orig",(int)sptr_orig,ERR_Fatal);
2373+
ARGT_ARG(argt, 1) = check_member(ast_ele,mk_id(sptr_descr));
23742374

23752375
ast =
23762376
mk_func_node(A_CALL,

tools/flang1/flang1exe/extern.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ void copy_surrogate_to_bnds_vars(DTYPE, int, DTYPE, int, int);
7272
void copy_desc_to_bnds_vars(int sptrdest, int desc, int memdesc, int std);
7373
void emit_fl(void); /* dpm_out.c */
7474
void init_sdsc_from_dtype(int sptr, DTYPE, int before_std); /* dpm_out.c */
75-
void make_temp_descriptor(int, int, int); /* dpm_out.c */
75+
void make_temp_descriptor(int, SPTR, SPTR, int); /* dpm_out.c */
7676
int init_sdsc(int sptr, DTYPE dtype, int before_std, int parent_sptr); /* semutil2.c */
7777
void ipa_restore_dtb(char *line); /* dpm_out.c */
7878
void transform_call(int, int);

tools/flang1/flang1exe/rest.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1997,9 +1997,9 @@ transform_call(int std, int ast)
19971997
* of zero-based array bounds and lbase calculation. Also, this type
19981998
* of lbase fixup can also be found in runtime routines like
19991999
* ptr_fix_assumeshp(), where a whole array, instead of a section,
2000-
* is identified.
2000+
* is identified.
20012001
*/
2002-
if(XBIT(58,0x400000)&&ASSUMSHPG(inface_arg)&&TARGETG(inface_arg))
2002+
if(XBIT(58,0x400000) && ASSUMSHPG(inface_arg) && TARGETG(inface_arg))
20032003
{
20042004
char nd[50]; /* new, substitute, descriptor for this arg */
20052005
static int ndctr = 0;
@@ -2011,7 +2011,7 @@ transform_call(int std, int ast)
20112011
get_static_descriptor(sptrtmp); /* add sdsc to sptrtmp; necessary */
20122012
get_all_descriptors(sptrtmp); /* add desc & bounds in dtype */
20132013
/* generate the runtime call pgf90_tmp_desc) */
2014-
make_temp_descriptor(sptr, sptrtmp, std);
2014+
make_temp_descriptor(ele, sptr, sptrtmp, std);
20152015
sptrdesc = DESCRG(sptrtmp);
20162016
ARGT_ARG(newargt, newj) = check_member(ele, mk_id(sptrdesc));
20172017
}
@@ -2092,9 +2092,9 @@ transform_call(int std, int ast)
20922092
get_static_descriptor(sptrtmp); /* add sdsc to sptrtmp; necessary */
20932093
get_all_descriptors(sptrtmp); /* add desc & bounds in dtype */
20942094
/* generate the runtime call pgf90_tmp_desc) */
2095-
make_temp_descriptor(sptr, sptrtmp, std);
2095+
make_temp_descriptor(ele, sptr, sptrtmp, std);
20962096
sptrdesc = DESCRG(sptrtmp);
2097-
ARGT_ARG(newargt, newj) = check_member(lop_ele, mk_id(sptrdesc));
2097+
ARGT_ARG(newargt, newj) = check_member(ele, mk_id(sptrdesc));
20982098
}
20992099
else
21002100
ARGT_ARG(newargt, newj) = descr;

0 commit comments

Comments
 (0)