diff options
author | Tobias Burnus <tburnus@baylibre.com> | 2024-10-12 10:48:41 +0200 |
---|---|---|
committer | Tobias Burnus <tburnus@baylibre.com> | 2024-10-12 10:48:41 +0200 |
commit | c20c9d8408f0ff4677acbd96f4803c191bd13ac6 (patch) | |
tree | 05d8eab47fc0ea5febb89264feabd44ae19ac7b8 /gcc/fortran/array.cc | |
parent | a564261245ad3002d53916e017b85939ace816a6 (diff) | |
download | gcc-c20c9d8408f0ff4677acbd96f4803c191bd13ac6.zip gcc-c20c9d8408f0ff4677acbd96f4803c191bd13ac6.tar.gz gcc-c20c9d8408f0ff4677acbd96f4803c191bd13ac6.tar.bz2 |
Fortran: Unify gfc_get_location handling; fix expr->ts bug
This commit reduces code duplication by moving gfc_get_location
from trans.cc to error.cc. The gcc_assert is now used more often
and reveald a bug in gfc_match_array_constructor where the union
expr->ts.u.derived of a derived type is partially overwritten by
the assignment expr->ts.u.cl->... as a ts.type == BT_CHARACTER check
was missing.
gcc/fortran/ChangeLog:
* array.cc (gfc_match_array_constructor): Only update the
character length if the expression is of character type.
* error.cc (gfc_get_location_with_offset): New; split off
from ...
(gfc_format_decoder): ... here; call it.
* gfortran.h (gfc_get_location_with_offset): New prototype.
(gfc_get_location): New inline function.
* trans.cc (gfc_get_location): Remove function definition.
* trans.h (gfc_get_location): Remove declaration.
Diffstat (limited to 'gcc/fortran/array.cc')
-rw-r--r-- | gcc/fortran/array.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/fortran/array.cc b/gcc/fortran/array.cc index ed8cb54..773c5b7 100644 --- a/gcc/fortran/array.cc +++ b/gcc/fortran/array.cc @@ -1390,7 +1390,7 @@ done: expr = gfc_get_array_expr (BT_UNKNOWN, 0, &where); expr->value.constructor = head; - if (expr->ts.u.cl) + if (expr->ts.type == BT_CHARACTER && expr->ts.u.cl) expr->ts.u.cl->length_from_typespec = seen_ts; *result = expr; |