Skip to content

Commit

Permalink
Fix for submodules defined in separate file
Browse files Browse the repository at this point in the history
  • Loading branch information
gklimowicz committed Jul 23, 2019
1 parent f02c66b commit fd5b2e7
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 102 deletions.
23 changes: 0 additions & 23 deletions test/f90_correct/inc/submod50_b.mk

This file was deleted.

19 changes: 0 additions & 19 deletions test/f90_correct/lit/submod50_b.sh

This file was deleted.

55 changes: 0 additions & 55 deletions test/f90_correct/src/submod50_b.f90

This file was deleted.

1 change: 1 addition & 0 deletions tools/flang1/flang1exe/semant.c
Original file line number Diff line number Diff line change
Expand Up @@ -1937,6 +1937,7 @@ semant1(int rednum, SST *top)
case PROG_TITLE7:
sem.submod_sym = SST_SYMG(RHS(5));
sptr = begin_submodule(sem.submod_sym, SST_SYMG(RHS(3)), NOSYM, &sptr1);
STYPEP(sem.submod_sym, ST_MODULE);
goto module_shared;
/*
* <prog title> ::= SUBMODULE ( <id> : <id> ) <id> |
Expand Down
6 changes: 4 additions & 2 deletions tools/flang1/flang1exe/semtbp.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2018, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -1309,7 +1309,7 @@ requiresOverloading(int sym, TBP *curr, tbpTask task)
static int
resolveImp(int dtype, tbpTask task, TBP *curr, char *impName)
{
int sym, sym2, errCnt, scope;
int sym, sym2, errCnt, scope, inmod;

/* complete tbp implementation */
errCnt = 0;
Expand Down Expand Up @@ -1391,8 +1391,10 @@ resolveImp(int dtype, tbpTask task, TBP *curr, char *impName)
sym = insert_sym(sym);
sym = declsym(sym, ST_ENTRY, FALSE);
} else {
inmod = INMODULEG(sym);
sym = insert_sym(sym);
sym = declsym(sym, ST_PROC, FALSE);
INMODULEP(sym, inmod);
}
SCP(sym, SC_EXTERN);
} else if (sem.which_pass && !curr->genericType &&
Expand Down
12 changes: 9 additions & 3 deletions tools/flang2/flang2exe/llassem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2320,9 +2320,10 @@ write_typedescs(void)
int tag, member, level, vft;
char *last, *name, *sname, *suffix;
char ftname[MXIDLN], tdtname[MXIDLN];
int len, inmod, gblsym, eq, has_layout_desc;
int len, gblsym, eq, has_layout_desc;
int ft, size, integer_size, subscript_size;
int subprog;
SPTR inmod;

integer_size = subscript_size = 32;
integer_size = 64;
Expand Down Expand Up @@ -2350,7 +2351,7 @@ write_typedescs(void)
ft = has_pending_final_procedures(sptr);
}
inmod = INMODULEG(subprog);
if (inmod) {
if (inmod > NOSYM) {
name = SYMNAME(sptr);
if (strncmp(SYMNAME(inmod), name, strlen(SYMNAME(inmod))) != 0) {
continue;
Expand All @@ -2368,7 +2369,12 @@ write_typedescs(void)
if (suffix)
*suffix = '\0';
eq = strcmp(SYMNAME(inmod), name);
if (inmod && eq != 0) {
/* Do not generate type descriptor if it is not in the scope of the current
subprogram or if subprogram is in a use associated module.
Note: NEEDMOD is set on use associated module names
*/
if (inmod > NOSYM && (eq != 0 || NEEDMODG(inmod))) {
FREE(name);
continue;
} else if (eq && strcmp(SYMNAME(subprog), name) != 0) {
Expand Down

0 comments on commit fd5b2e7

Please sign in to comment.