]> git.ipfire.org Git - thirdparty/gcc.git/commit
Fortran: Unify gfc_get_location handling; fix expr->ts bug
authorTobias Burnus <tburnus@baylibre.com>
Sat, 12 Oct 2024 08:48:41 +0000 (10:48 +0200)
committerTobias Burnus <tburnus@baylibre.com>
Sat, 12 Oct 2024 08:48:41 +0000 (10:48 +0200)
commitc20c9d8408f0ff4677acbd96f4803c191bd13ac6
tree05d8eab47fc0ea5febb89264feabd44ae19ac7b8
parenta564261245ad3002d53916e017b85939ace816a6
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.
gcc/fortran/array.cc
gcc/fortran/error.cc
gcc/fortran/gfortran.h
gcc/fortran/trans.cc
gcc/fortran/trans.h