Fortran: improve runtime error message with ALLOCATE and ERRMSG= [PR91300]
authorHarald Anlauf <anlauf@gmx.de>
Sat, 28 May 2022 20:02:20 +0000 (22:02 +0200)
committerHarald Anlauf <anlauf@gmx.de>
Mon, 30 May 2022 20:31:34 +0000 (22:31 +0200)
commit871dbb6112e22ff92914613c332944fd19dd39a8
treea7e1aefb4901b2e443d8858908331132950b0883
parentf1652e3343b1ec47035370801d9b9aca1f8b613f
Fortran: improve runtime error message with ALLOCATE and ERRMSG= [PR91300]

ALLOCATE: generate different STAT,ERRMSG results for failures from
allocation of already allocated objects or insufficient virtual memory.

gcc/fortran/ChangeLog:

PR fortran/91300
* libgfortran.h: Define new error code LIBERROR_NO_MEMORY.
* trans-stmt.cc (gfc_trans_allocate): Generate code for setting
ERRMSG depending on result of STAT result of ALLOCATE.
* trans.cc (gfc_allocate_using_malloc): Use STAT value of
LIBERROR_NO_MEMORY in case of failed malloc.

gcc/testsuite/ChangeLog:

PR fortran/91300
* gfortran.dg/allocate_alloc_opt_15.f90: New test.
gcc/fortran/libgfortran.h
gcc/fortran/trans-stmt.cc
gcc/fortran/trans.cc
gcc/testsuite/gfortran.dg/allocate_alloc_opt_15.f90 [new file with mode: 0644]