+2019-10-03 Bernd Edlinger <bernd.edlinger@hotmail.de>
+
+ * primary.c (match_real_constant): Remove shadowing local vars.
+ Rename local vars. Fix undefined behavior in loop termination.
+ (gfc_convert_to_structure_constructor): Rename local var.
+
2019-10-03 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/84487
if (warn_conversion_extra)
{
mpfr_t r;
- char *c, *p;
+ char *c1;
bool did_break;
- c = strchr (buffer, 'e');
- if (c == NULL)
- c = buffer + strlen(buffer);
+ c1 = strchr (buffer, 'e');
+ if (c1 == NULL)
+ c1 = buffer + strlen(buffer);
did_break = false;
- for (p = c - 1; p >= buffer; p--)
+ for (p = c1; p > buffer;)
{
+ p--;
if (*p == '.')
continue;
&& actual->expr->ts.type == BT_CHARACTER
&& actual->expr->expr_type == EXPR_CONSTANT)
{
- ptrdiff_t c, e;
+ ptrdiff_t c, e1;
c = gfc_mpz_get_hwi (this_comp->ts.u.cl->length->value.integer);
- e = actual->expr->value.character.length;
+ e1 = actual->expr->value.character.length;
- if (c != e)
+ if (c != e1)
{
ptrdiff_t i, to;
gfc_char_t *dest;
dest = gfc_get_wide_string (c + 1);
- to = e < c ? e : c;
+ to = e1 < c ? e1 : c;
for (i = 0; i < to; i++)
dest[i] = actual->expr->value.character.string[i];
- for (i = e; i < c; i++)
+ for (i = e1; i < c; i++)
dest[i] = ' ';
dest[c] = '\0';
actual->expr->value.character.length = c;
actual->expr->value.character.string = dest;
- if (warn_line_truncation && c < e)
+ if (warn_line_truncation && c < e1)
gfc_warning_now (OPT_Wcharacter_truncation,
"CHARACTER expression will be truncated "
"in constructor (%ld/%ld) at %L", (long int) c,
- (long int) e, &actual->expr->where);
+ (long int) e1, &actual->expr->where);
}
}