Skip to content

Commit bd6802a

Browse files
authored
Merge pull request #268 from ThePortlandGroup/nv_stage
Pull 2017-10-11T18-10 Recent NVIDIA Changes
2 parents c93c836 + af038c8 commit bd6802a

File tree

15 files changed

+233
-234
lines changed

15 files changed

+233
-234
lines changed

runtime/flang/acos.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@
1515
*
1616
*/
1717

18-
/** \file
19-
* Single precision acos interface */
20-
2118
#include "mthdecls.h"
19+
/* -------------------- single precision functions: */
2220

2321
float
2422
__mth_i_acos(float f)

runtime/flang/amod.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717

1818
#include "mthdecls.h"
1919

20+
#if defined(WIN64)
2021
float __fmth_i_amod(float f, float g);
22+
#endif
2123

2224
float
2325
__mth_i_amod(float f, float g)

runtime/flang/asin.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
*
1616
*/
1717

18-
/** \file
19-
* Single precision asin interface */
20-
2118
#include "mthdecls.h"
2219

2320
float

runtime/flang/atan2.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
*
1616
*/
1717

18-
/** \file
19-
* Single precision atan2f interface */
20-
2118
#include "mthdecls.h"
2219

2320
float

runtime/flang/dmod.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717

1818
#include "mthdecls.h"
1919

20+
#if defined(WIN64)
2021
double __fmth_i_dmod(double f, double g);
22+
#endif
2123

2224
double
2325
__mth_i_dmod(double f, double g)

runtime/flang/kidim.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include "mthdecls.h"
1919

2020
_LONGLONG_T
21-
ftn_i_kidim(_LONGLONG_T i, _LONGLONG_T j)
21+
ftn_i_kidim(_LONGLONG_T i, long long j)
2222
{
2323
_LONGLONG_T h;
2424

tools/flang1/flang1exe/error.c

Lines changed: 62 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@
3838
#include <string.h>
3939

4040
static char *errfill(const char *, const char *, const char *);
41-
static void display_error(error_code_t ecode, enum error_severity sev,
42-
int eline, const char *op1, const char *op2,
43-
int col, const char * srcFile);
41+
static void display_error(error_code_t ecode, enum error_severity sev,
42+
int eline, const char *op1, const char *op2, int col,
43+
const char *srcFile);
4444

4545
static int ndiags[5];
4646
static int maxfilsev = 0; /* max severity for entire source file */
@@ -84,8 +84,8 @@ error(error_code_t ecode, enum error_severity sev, int eline, const char *op1,
8484
}
8585

8686
static void
87-
display_error(error_code_t ecode, enum error_severity sev, int eline,
88-
const char *op1, const char *op2, int col, const char * srcFile)
87+
display_error(error_code_t ecode, enum error_severity sev, int eline,
88+
const char *op1, const char *op2, int col, const char *srcFile)
8989
{
9090
static char sevlett[5] = {'X', 'I', 'W', 'S', 'F'};
9191
char *formatstr;
@@ -115,7 +115,7 @@ display_error(error_code_t ecode, enum error_severity sev, int eline,
115115
formatstr = "%s-%c-%04d-%s (%s: %d.%d)";
116116
else
117117
formatstr = "%s-%c-%04d-%s (%s: %d)";
118-
}else
118+
} else
119119
formatstr = "%s-%c-%04d-%s (%s)";
120120
} else
121121
formatstr = "%s-%c-%04d-%s";
@@ -129,22 +129,22 @@ display_error(error_code_t ecode, enum error_severity sev, int eline,
129129

130130
if (!XBIT(0, 0x40000000) && col <= 0 && srcFile == NULL)
131131
snprintf(&buff[1], sizeof(buff) - 1, formatstr, version.lang,
132-
sevlett[sev], ecode, errfill(msgstr, op1, op2),
133-
gbl.curr_file, eline);
132+
sevlett[sev], ecode, errfill(msgstr, op1, op2), gbl.curr_file,
133+
eline);
134134
else {
135135
static char *sevtext[5] = {"X", "info", "warning", "error", "error"};
136136
if (col > 0 && (srcFile != NULL || gbl.curr_file != NULL)) {
137137
snprintf(&buff[1], sizeof(buff) - 1, "\n%s:%d:%d: %s %c%04d: %s",
138138
(srcFile != NULL) ? srcFile : gbl.curr_file, eline, col,
139-
sevtext[sev], sevlett[sev], ecode, errfill(msgstr, op1, op2));
139+
sevtext[sev], sevlett[sev], ecode, errfill(msgstr, op1, op2));
140140
} else if (srcFile != NULL) {
141-
snprintf(&buff[1], sizeof(buff) - 1, "\n%s:%d: %s %c%04d: %s",
142-
srcFile, eline, sevtext[sev], sevlett[sev],
143-
ecode, errfill(msgstr, op1, op2));
141+
snprintf(&buff[1], sizeof(buff) - 1, "\n%s:%d: %s %c%04d: %s", srcFile,
142+
eline, sevtext[sev], sevlett[sev], ecode,
143+
errfill(msgstr, op1, op2));
144144
} else if (gbl.curr_file != NULL) {
145145
snprintf(&buff[1], sizeof(buff) - 1, "%s(%d) : %s %c%04d : %s",
146-
gbl.curr_file, eline, sevtext[sev],
147-
sevlett[sev], ecode, errfill(msgstr, op1, op2));
146+
gbl.curr_file, eline, sevtext[sev], sevlett[sev], ecode,
147+
errfill(msgstr, op1, op2));
148148
} else
149149
snprintf(&buff[1], sizeof(buff) - 1, "%s : %s %c%04d : %s", "",
150150
sevtext[sev], sevlett[sev], ecode, errfill(msgstr, op1, op2));
@@ -292,7 +292,7 @@ interrf(enum error_severity sev, const char *fmt, ...)
292292
va_start(ap, fmt);
293293
size = vsnprintf(NULL, 0, fmt, ap);
294294
va_end(ap);
295-
NEW(buffer, char, size+1);
295+
NEW(buffer, char, size + 1);
296296
va_start(ap, fmt);
297297
vsprintf(buffer, fmt, ap);
298298
va_end(ap);
@@ -335,9 +335,10 @@ dassert_err(const char *filename, int line, const char *expr, const char *txt)
335335
* Prints information on behalf of failed asrt.
336336
* \param file: filename: name of file where assertion failed.
337337
* \param line: line number where assertion failed
338-
*/
338+
*/
339339
void
340-
asrt_failed(const char *filename, int line) {
340+
asrt_failed(const char *filename, int line)
341+
{
341342
fprintf(stderr, "asrt failed. line %d, file %s\n", line, filename);
342343
/* Call interr so that we have a common place to set a breakpoint when
343344
running under a debugger. */
@@ -478,11 +479,11 @@ error_max_severity()
478479
* \param ptoken is the token string we are processing.
479480
*
480481
* \return the last substring, else NULL
481-
*/
482+
*/
482483
char *
483-
getDeduceStr(char * ptoken)
484+
getDeduceStr(char *ptoken)
484485
{
485-
char * lastToken;
486+
char *lastToken;
486487
if (ptoken != NULL) {
487488
lastToken = strrchr(ptoken, ' ');
488489
if (lastToken != NULL) {
@@ -497,7 +498,7 @@ getDeduceStr(char * ptoken)
497498
/** \brief Construct and issue an "enhanced" error message.
498499
*
499500
* Construct error message and issue it to user terminal and to listing file
500-
* if appropriate. This is an "enhanced" error message which means we will
501+
* if appropriate. This is an "enhanced" error message which means we will
501502
* also display the source line, column number, and location of the error.
502503
*
503504
* Note: First five arguments are the same as function error().
@@ -511,82 +512,82 @@ getDeduceStr(char * ptoken)
511512
* \param op1 String to be expanded into error message * or 0
512513
*
513514
* \param op2 String to be expanded into error message * or 0
514-
*
515-
* \param col The column number where the error occurred at if
515+
*
516+
* \param col The column number where the error occurred at if
516517
* available, else 0.
517518
*
518519
* \param deduceCol The operand to use (1 for op1, 2 for op2) to deduce the
519520
* the column number when the col argument is not available.
520521
* Setting this to 0 disables column deduction.
521-
*
522+
*
522523
* \param uniqDeduct If set, this function will only deduce the column if
523524
* the operand specified in deduceCol only occurs once
524525
* in the source line. Otherwise, it will use the first
525526
* occurrence of the operand in the source line.
526527
*
527528
* \param deduceVal If this is a non-NULL character pointer, then use this
528529
* string for column deduction instead of op1 or op2.
529-
*
530+
*
530531
*/
531532
void
532-
errWithSrc(error_code_t ecode, enum error_severity sev, int eline,
533-
const char *op1, const char *op2, int col, int deduceCol,
533+
errWithSrc(error_code_t ecode, enum error_severity sev, int eline,
534+
const char *op1, const char *op2, int col, int deduceCol,
534535
bool uniqDeduct, const char *deduceVal)
535536
{
536537
int i, len;
537538
char *srcFile = NULL;
538-
char * srcLine = NULL;
539-
int srcCol=0;
540-
int contNo=0;
539+
char *srcLine = NULL;
540+
int srcCol = 0;
541+
int contNo = 0;
541542

542-
if (!XBIT(1,1)) {
543+
if (!XBIT(1, 1)) {
543544
/* Generate old error messages */
544545
display_error(ecode, sev, eline, op1, op2, 0, NULL);
545546
return;
546547
}
547-
if (eline > 0) {
548-
srcLine = get_src_line(eline, &srcFile, col, &srcCol, &contNo);
549-
if (srcFile && (len=strlen(srcFile)) > 0) {
548+
if (eline > 0) {
549+
srcLine = get_src_line(eline, &srcFile, col, &srcCol, &contNo);
550+
if (srcFile && (len = strlen(srcFile)) > 0) {
550551
/* trim trailing whitespace on srcFile */
551-
char * cp;
552-
for(cp = (srcFile + (len-1)); cp != srcFile; --cp) {
552+
char *cp;
553+
for (cp = (srcFile + (len - 1)); cp != srcFile; --cp) {
553554
if (!isspace(*cp))
554555
break;
555556
}
556557
if (cp != srcFile) {
557-
*(cp+1) = '\0';
558+
*(cp + 1) = '\0';
558559
}
559-
}
560+
}
560561
if (deduceCol > 0) {
561562
/* try to deduce column number */
562-
char * op;
563-
char * srcLC = strdup(srcLine);
564-
char * p;
563+
char *op;
564+
char *srcLC = strdup(srcLine);
565+
char *p;
565566
if (deduceVal != NULL) {
566567
op = strdup(deduceVal);
567568
} else {
568569
op = strdup((deduceCol == 1) ? op1 : op2);
569570
}
570571
len = strlen(srcLC);
571-
for(i=0; i < len; ++i) {
572+
for (i = 0; i < len; ++i) {
572573
srcLC[i] = tolower(srcLC[i]);
573574
}
574575
len = strlen(op);
575-
for(i=0; i < len; ++i) {
576+
for (i = 0; i < len; ++i) {
576577
op[i] = tolower(op[i]);
577578
}
578-
p = strstr(srcLC, op);
579+
p = srcCol == 0 ? strstr(srcLC, op) : strstr(srcLC + (srcCol-1), op);
579580
col = 0;
580581
if (p != NULL) {
581582
if (uniqDeduct) {
582-
char * q = strstr(p+1, op);
583-
if (q == NULL) {
583+
char *q = strstr(p + 1, op);
584+
if (q == NULL) {
584585
/* op only occurs once in srcLine, so we can deduce col */
585-
col = (int)(p-srcLC)+1;
586+
col = (int)(p - srcLC) + 1;
586587
}
587588
} else {
588589
/* found op in srcLine, so we can deduce col */
589-
col = (int)(p-srcLC)+1;
590+
col = (int)(p - srcLC) + 1;
590591
}
591592
}
592593
FREE(op);
@@ -595,41 +596,40 @@ errWithSrc(error_code_t ecode, enum error_severity sev, int eline,
595596
}
596597
if (!deduceCol || col == 0)
597598
col = srcCol;
598-
display_error(ecode, sev, contNo+eline, op1, op2, col, srcFile);
599+
display_error(ecode, sev, contNo + eline, op1, op2, col, srcFile);
599600
if (col > 0 && srcLine != NULL) {
600601
LOGICAL isLeadingChars;
601602
int numLeadingTabs;
602603
len = strlen(srcLine);
603-
for(numLeadingTabs = i = 0, isLeadingChars = TRUE; i < len; ++i) {
604-
if (i == (col-1)) {
604+
for (numLeadingTabs = i = 0, isLeadingChars = TRUE; i < len; ++i) {
605+
if (i == (col - 1)) {
605606
isLeadingChars = FALSE;
606607
}
607608
if (isLeadingChars && srcLine[i] == '\t') {
608609
/* Keep track of tabs that appear before column number. */
609-
fputc('\t',stderr);
610+
fputc('\t', stderr);
610611
++numLeadingTabs;
611612
} else if (srcLine[i] == '\n') {
612613
break;
613614
} else {
614-
fputc(srcLine[i],stderr);
615+
fputc(srcLine[i], stderr);
615616
}
616617
}
617-
fputc('\n',stderr);
618+
fputc('\n', stderr);
618619

619620
/* When we first computed col, we counted a tab as one space. So, we need
620621
* to subtract one from col as we print out the leading tabs.
621622
*/
622-
for(i=0; i < numLeadingTabs; ++i) {
623-
fputc('\t',stderr);
623+
for (i = 0; i < numLeadingTabs; ++i) {
624+
fputc('\t', stderr);
624625
}
625626
col -= numLeadingTabs;
626627

627-
for(i=0; i < (col-1); ++i)
628-
fputc(' ',stderr);
629-
fputs("^\n",stderr);
630-
}
631-
else {
632-
fputc('\n',stderr);
628+
for (i = 0; i < (col - 1); ++i)
629+
fputc(' ', stderr);
630+
fputs("^\n", stderr);
631+
} else {
632+
fputc('\n', stderr);
633633
}
634634
FREE(srcLine);
635635
FREE(srcFile);

tools/flang1/flang1exe/lowerilm.c

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2084,17 +2084,18 @@ lower_do_stmt(int std, int ast, int lineno, int label)
20842084
ilm = compute_dotrip(std, FALSE, doinitilm, doendilm, doinc,
20852085
doincilm, dtype, dotrip);
20862086
} else
2087-
ilm = compute_dotrip(std, doinitast == doincast, doinitilm, doendilm, doinc,
2088-
doincilm, dtype, dotrip);
2089-
2090-
if (doinc == 0) {
2091-
/* convert and store in a temp */
2092-
doinc = dotemp('i', dtype, std);
2093-
lilm = lower_sptr(doinc, VarBase);
2094-
lower_typestore(dtype, lilm, doincilm);
2087+
{
2088+
ilm = compute_dotrip(std, doinitast == doincast, doinitilm,
2089+
doendilm, doinc, doincilm, dtype, dotrip);
2090+
if (doinc == 0) {
2091+
/* convert and store in a temp */
2092+
doinc = dotemp('i', dtype, std);
2093+
lilm = lower_sptr(doinc, VarBase);
2094+
lower_typestore(dtype, lilm, doincilm);
2095+
}
2096+
lilm = lower_sptr(dovar, VarBase);
2097+
lower_typestore(dtype, lilm, doinitilm);
20952098
}
2096-
lilm = lower_sptr(dovar, VarBase);
2097-
lower_typestore(dtype, lilm, doinitilm);
20982099
if (!XBIT(34, 0x8000000) && STD_ZTRIP(std) && A_M4G(ast)) {
20992100
/* lower condition ilm */
21002101
int tilm;
@@ -4938,14 +4939,14 @@ lower_stmt(int std, int ast, int lineno, int label)
49384939
ilm = plower("oSniiii", "BTASKLOOP", lab, num, ilm, ilm2, ilm3, ilm4);
49394940
}
49404941
lower_end_stmt(std);
4942+
lower_push(STKTASK);
4943+
lower_push(lab); /* label */
49414944
if (A_TYPEG(ast) == A_MP_TASKLOOP) {
49424945
break;
49434946
}
4944-
lower_push(STKTASK);
4945-
lower_push(lab); /* label */
49464947

49474948

4948-
/* Note: Currentl we store endlabel in A_MP_TASK but A_MP_ETASKREG will pop it
4949+
/* Note: Currently we store endlabel in A_MP_TASK but A_MP_ETASKREG will pop it
49494950
* This is OK because we always create ast in this order
49504951
* A_MP_TASK/A_MP_TASKREG - A_MP_ETASKREG/A_MP_ENDTASK
49514952
* The reason why we want to pop in A_MP_ETASKREG because that
@@ -5130,6 +5131,8 @@ lower_stmt(int std, int ast, int lineno, int label)
51305131
--lowersym.task_depth;
51315132
if (lowersym.parallel_depth == 0 && lowersym.task_depth == 0)
51325133
lowersym.sc = SC_LOCAL;
5134+
lab = lower_pop();
5135+
lower_check_stack(STKTASK);
51335136
lower_start_stmt(lineno, label, TRUE, std);
51345137
ilm = plower("oL", "ETASKLOOP", lab);
51355138
lower_end_stmt(std);

0 commit comments

Comments
 (0)