Skip to content

Commit 932f7a3

Browse files
authored
Merge pull request #587 from ThePortlandGroup/nv_stage
Pull 2018-09-12T18-00 Recent NVIDIA Changes
2 parents 2ce0ce8 + a23fa3b commit 932f7a3

File tree

28 files changed

+1329
-678
lines changed

28 files changed

+1329
-678
lines changed

include/flang/Error/errmsg-in.n

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1168,9 +1168,8 @@ An actual argument that is an array element cannot be passed to a REFLECTED dumm
11681168
.MS E 487 "Index variable $ does not appear in a subscript on the left hand side of the FORALL assignment"
11691169
In a FORALL statement, each index variable in the FORALL must appear in some subscript of the left hand side of the FORALL assignment.
11701170
Otherwise, the FORALL will assign the same left hand side elements for different values of that index.
1171-
.MS E 488 "The function call in the FORALL does not have the PURE attribute - $"
1172-
In a FORALL statement, all functions used must be PURE or ELEMENTAL.
1173-
Otherwise, they cannot be called in parallel.
1171+
.MS S 488 "$ is not PURE - $"
1172+
DO CONCURRENT and FORALL subprogram calls must be PURE or ELEMENTAL.
11741173
.MS I 489 "An ALLOCATE of a POINTER with transcriptive or inherited distribution causes replication - $"
11751174
When an array with the POINTER attribute and with a distributed that is transcriptive or inherited is allocated,
11761175
the alignment and distribution are ignored and the array pointer is treated as replicated,

tools/flang1/flang1exe/commopt.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3584,10 +3584,11 @@ is_pcalls(int std, int fstd)
35843584
ast = STD_AST(std);
35853585
if (A_TYPEG(ast) == A_CALL) {
35863586
sptr = A_SPTRG(A_LOPG(ast));
3587-
if (PUREG(sptr) || (ELEMENTALG(sptr) && !IMPUREG(sptr)))
3588-
return TRUE;
3587+
if (is_impure(sptr))
3588+
error(488, 4, STD_LINENO(fstd), "subprogram call in FORALL",
3589+
SYMNAME(sptr));
35893590
else
3590-
error(488, 4, STD_LINENO(fstd), SYMNAME(sptr), CNULL);
3591+
return TRUE;
35913592
}
35923593
if (A_TYPEG(ast) == A_ICALL)
35933594
return TRUE;

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/dtypeutl.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1781,6 +1781,21 @@ has_finalized_component(SPTR sptr)
17811781
return test_sym_components_only(sptr, is_finalized);
17821782
}
17831783

1784+
static LOGICAL
1785+
is_impure_finalizer(int sptr, struct visit_list **visited)
1786+
{
1787+
return sptr > NOSYM &&
1788+
((STYPEG(sptr) == ST_MEMBER &&
1789+
FINALG(sptr) && is_impure(VTABLEG(sptr))) ||
1790+
search_type_members(DTYPEG(sptr), is_impure_finalizer, visited));
1791+
}
1792+
1793+
LOGICAL
1794+
has_impure_finalizer(SPTR sptr)
1795+
{
1796+
return test_sym_and_components(sptr, is_impure_finalizer);
1797+
}
1798+
17841799
static LOGICAL
17851800
is_layout_desc(SPTR sptr, struct visit_list **visited)
17861801
{

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/kwddf.h

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -75,21 +75,21 @@ typedef struct {
7575
* table and let alpha() do the rest. (NOTE that 0 is returned by
7676
* keyword() if a name is not found in a keyword table).
7777
*/
78-
#define TKF_BLOCK -1
79-
#define TKF_DOUBLE -2
80-
#define TKF_GO -3
81-
#define TKF_SELECT -4
82-
#define TKF_NO -5
83-
#define TKF_ARRAY -6
84-
#define TKF_ENDBLOCK -7
85-
#define TKF_ATOMIC -8
86-
#define TKF_DOWHILE -9
87-
#define TKF_DOCONCURRENT -10
88-
#define TKF_TARGETENTER -11
89-
#define TKF_TARGETEXIT -12
90-
#define TKF_CANCELLATION -13
91-
#define TKF_DISTPAR -14
92-
#define TKF_ENDDISTPAR -15
78+
#define TKF_ARRAY -1
79+
#define TKF_ATOMIC -2
80+
#define TKF_CANCELLATION -3
81+
#define TKF_DISTPAR -4
82+
#define TKF_DOCONCURRENT -5
83+
#define TKF_DOUBLE -6
84+
#define TKF_DOWHILE -7
85+
#define TKF_ENDDISTPAR -8
86+
#define TKF_GO -9
87+
#define TKF_NO -10
88+
#define TKF_SELECT -11
89+
#define TKF_TARGETENTER -12
90+
#define TKF_TARGETEXIT -13
91+
#define TKF_BLOCK -14
92+
#define TKF_ENDBLOCK -15
9393

9494
static KWORD t1[] = { /* normal keyword table */
9595
{"", 0}, /* a keyword index must be nonzero */
@@ -115,15 +115,18 @@ static KWORD t1[] = { /* normal keyword table */
115115
{"close", TK_CLOSE},
116116
{"common", TK_COMMON},
117117
{"complex", TK_COMPLEX},
118+
{"concurrent", TK_CONCURRENT},
118119
{"contains", TK_CONTAINS},
119120
{"contiguous", TK_CONTIGUOUS},
120121
{"continue", TK_CONTINUE},
121122
{"cycle", TK_CYCLE},
122123
{"data", TK_DATA},
123124
{"deallocate", TK_DEALLOCATE},
124125
{"decode", TK_DECODE},
126+
{"default", TK_DEFAULT},
125127
{"dimension", TK_DIMENSION},
126128
{"do", TK_DO},
129+
{"doconcurrent", TKF_DOCONCURRENT},
127130
{"double", TKF_DOUBLE},
128131
{"doublecomplex", TK_DBLECMPLX},
129132
{"doubleprecision", TK_DBLEPREC},
@@ -182,13 +185,16 @@ static KWORD t1[] = { /* normal keyword table */
182185
{"intent", TK_INTENT},
183186
{"interface", TK_INTERFACE},
184187
{"intrinsic", TK_INTRINSIC},
188+
{"local", TK_LOCAL},
189+
{"local_init", TK_LOCAL_INIT},
185190
{"logical", TK_LOGICAL},
186191
{"map", TK_MAP},
187192
{"module", TK_MODULE},
188193
{"namelist", TK_NAMELIST},
189194
{"ncharacter", TK_NCHARACTER},
190195
{"no", TKF_NO},
191196
{"non_intrinsic", TK_NON_INTRINSIC},
197+
{"none", TK_NONE},
192198
{"nopass", TK_NOPASS},
193199
{"nosequence", TK_NOSEQUENCE},
194200
{"nullify", TK_NULLIFY},
@@ -217,6 +223,7 @@ static KWORD t1[] = { /* normal keyword table */
217223
{"selectcase", TK_SELECTCASE},
218224
{"selecttype", TK_SELECTTYPE},
219225
{"sequence", TK_SEQUENCE},
226+
{"shared", TK_SHARED},
220227
{"stop", TK_STOP},
221228
{"structure", TK_STRUCTURE},
222229
{"submodule", TK_SUBMODULE},

tools/flang1/flang1exe/lowersym.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,6 +1046,10 @@ lower_prepare_symbols()
10461046
DTYPEP(sptr, dtype);
10471047
lower_use_datatype(dtype, 1);
10481048
}
1049+
1050+
if (IGNOREG(sptr))
1051+
break;
1052+
10491053
if (DTY(dtype) == TY_ARRAY) {
10501054
if ((POINTERG(sptr) || ALLOCG(sptr)) && SDSCG(sptr) &&
10511055
STYPEG(SDSCG(sptr)) != ST_PARAM) {

tools/flang1/flang1exe/rest.c

Lines changed: 6 additions & 8 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;
@@ -2407,9 +2407,7 @@ pure_procedure(int ast)
24072407
static void
24082408
check_pure_interface(int entry, int std, int ast)
24092409
{
2410-
if ((PUREG(gbl.currsub) ||
2411-
(ELEMENTALG(gbl.currsub) && !IMPUREG(gbl.currsub))) &&
2412-
!HCCSYMG(entry) && !pure_procedure(ast)) {
2410+
if (!is_impure(gbl.currsub) && !HCCSYMG(entry) && !pure_procedure(ast)) {
24132411
switch (STYPEG(entry)) {
24142412
case ST_INTRIN:
24152413
case ST_GENERIC:

0 commit comments

Comments
 (0)