Dear Harald, dear all, On 10.03.21 22:26, Harald Anlauf wrote:
[...] I found another testcase which lead to trouble during error recovery due to a NULL pointer dereference.
I was a bit surprised that the crash only occurs in trans*.c; however, the error 'non-constant initialization expression' is only issued by gfc_conv_constant, called via gfc_get_symbol_decl. Thus, when the error is shown we are already deep in trans*.c land.
Here's the updated changelog for the updated patch (attached). I also renamed the first testcase so that they fit better to the existing scheme. Again regtested on x86_64-pc-linux-gnu. Now OK for mainline / 10?
LGTM for mainline and after a bit of waiting for GCC10. Thanks, Tobias
PR fortran/99205 - Out of memory with undefined character length A character variable appearing as a data statement object cannot be automatic, thus it shall have constant length. gcc/fortran/ChangeLog: PR fortran/99205 * data.c (gfc_assign_data_value): Reject non-constant character length for lvalue. * trans-array.c (gfc_conv_array_initializer): Restrict loop to elements which are defined to avoid NULL pointer dereference. gcc/testsuite/ChangeLog: PR fortran/99205 * gfortran.dg/data_char_4.f90: New test. * gfortran.dg/data_char_5.f90: New test.
----------------- Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 München Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Frank Thürauf