Skip to content

Commit 98d9141

Browse files
committed
[flang1] Fix an MIN/MAX intrinsic bug
1 parent 7e03751 commit 98d9141

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

tools/flang1/flang1exe/semfunc.c

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4164,41 +4164,44 @@ cmp_mod_scope(SPTR sptr)
41644164
* or character and they shall all have the same kind type parameter.
41654165
*/
41664166
void
4167-
check_max_min_argument(int argdtype, int *dtype_new, int *dtype_last) {
4167+
check_max_min_argument(int argdtype, int *dtype_last)
4168+
{
4169+
int dtype_new = DT_NONE_GENERAL;
4170+
41684171
switch (DTYG(argdtype)) {
41694172
case TY_BINT:
41704173
case TY_SINT:
41714174
case TY_INT:
41724175
case TY_INT8:
41734176
case TY_WORD:
41744177
case TY_DWORD:
4175-
*dtype_new = DT_INT_GENERAL;
4178+
dtype_new = DT_INT_GENERAL;
41764179
break;
41774180
case TY_HALF:
41784181
case TY_REAL:
41794182
case TY_DBLE:
41804183
case TY_QUAD:
4181-
*dtype_new = DT_REAL_GENERAL;
4184+
dtype_new = DT_REAL_GENERAL;
41824185
break;
41834186
case TY_CHAR:
41844187
case TY_NCHAR:
4185-
*dtype_new = DT_CHAR_GENERAL;
4188+
dtype_new = DT_CHAR_GENERAL;
41864189
break;
41874190
default:
4188-
*dtype_new = DT_NONE_GENERAL;
4191+
dtype_new = DT_NONE_GENERAL;
41894192
break;
41904193
}
41914194
if (*dtype_last == 0)
4192-
*dtype_last = *dtype_new;
4195+
*dtype_last = dtype_new;
41934196

4194-
if (*dtype_new == DT_NONE_GENERAL) {
4197+
if (dtype_new == DT_NONE_GENERAL) {
41954198
error(155, 3, gbl.lineno,
41964199
"Arguments must be INTEGER, REAL, or CHARACTER!", CNULL);
4197-
} else if (*dtype_new != *dtype_last) {
4200+
} else if (dtype_new != *dtype_last) {
41984201
error(155, 3, gbl.lineno,
41994202
"Arguments must have the same kind type parameter!", CNULL);
42004203
} else {
4201-
*dtype_last = *dtype_new;
4204+
*dtype_last = dtype_new;
42024205
}
42034206
}
42044207

@@ -4228,7 +4231,6 @@ ref_intrin(SST *stktop, ITEM *list)
42284231
int tmp, tmp_ast;
42294232
FtnRtlEnum rtlRtn;
42304233
int intrin; /* one of the I_* constants */
4231-
int dtype_new = 0;
42324234
int dtype_last = 0;
42334235
int maxtype = 0;
42344236

@@ -4319,7 +4321,7 @@ ref_intrin(SST *stktop, ITEM *list)
43194321
}
43204322

43214323
if (intrin == I_MAX || intrin == I_MIN) {
4322-
check_max_min_argument(argdtype, &dtype_new, &dtype_last);
4324+
check_max_min_argument(argdtype, &dtype_last);
43234325
}
43244326

43254327
if (!dtype1) {

0 commit comments

Comments
 (0)