[Committed] A target in pointer initialization requires SAVE

Steve Kargl sgk@troutmask.apl.washington.edu
Thu Jun 20 22:20:00 GMT 2019


In taking a look at PR fortran/77632, I stumbled acrossed
the testcase in the attached patch cause an ICE.  I originally
thought that it was realated to the topic of the PR, but is
in fact an unrelated bug.

If a variable is a target in a pointer initialization, then 
it must have the SAVE attribute.  A variable in PROGRAM, 
MODULE, or SUBMODULE scope is implicitly SAVEd.  So, the
patch explicitly sets the save attribute to SAVE_IMPLICIT.

2019-06-20  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/77632
	* /decl.c (variable_decl): Mark a variable that is a target in pointer
	initialization when in PROGRAM, MODULE, or SUBMODULE scope with an
	implicit save.

2019-06-20  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/77632
	* gfortran.dg/pr77632_1.f90: New test.

-- 
Steve
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr77632.diff
Type: text/x-diff
Size: 1303 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20190620/714ff313/attachment.bin>


More information about the Gcc-patches mailing list