[patch, fortran] Fix PR 71237

Thomas Koenig tkoenig@netcologne.de
Wed Feb 6 20:27:00 GMT 2019


Hello world,

this patch fixes a 7/8/9 regression where we tried to accept invalid
code, which led to an ICE later on.

The patch is rather straightforward.  The reason why I could not
use gfc_expr_attr is that it does not actually return the
flags the way they can be found in the original attributes;
for example, an expression containing a pointer attribute is
shown as having the target attribute, for reasons I cannot
fathom.

Regression-tested.  OK for trunk and other open branches?

Regards

	Thomas

2019-02-06  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/71237
	* expr.c (gfc_check_assign): Add argument is_init_expr.  If we are
	looking at an init expression, issue error if the target is not a
	TARGET and we are not looking at a procedure pointer.
	* gfortran.h (gfc_check_assign): Add optional argument
	is_init_expr.

2019-02-06  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/71237
	* gfortran.dg/pointer_init_2.f90: Adjust error messages.
	* gfortran.dg/pointer_init_6.f90: Likewise.
	* gfortran.dg/pointer_init_9.f90: New test.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pointer_init_9.f90
Type: text/x-fortran
Size: 316 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20190206/ac08a2b6/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p3.diff
Type: text/x-patch
Size: 5055 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20190206/ac08a2b6/attachment-0001.bin>


More information about the Fortran mailing list