[Patch, Fortran] PR fortran/35837: Fix type-resolving and gfc_current_ns

Daniel Kraft d@domob.eu
Fri Sep 5 16:28:00 GMT 2008


Hi,

resolve_types used to set gfc_current_ns to the namespace resolved, but 
did not reset the value on exit; for nested namespaces and the test in 
PR 35837, this lead to the result that gfc_save_all/gfc_add_save was 
called for the module's namespace, while gfc_current_ns still pointed to 
the (resolved from module's resolve_types prior to the save_all call?) 
pure procedure's namespace and thus the compiler complained about the 
SAVE for a pure procedure.

This patch fixes this problem by remembering the old namespace and 
resetting it on exit for resolve_types.  I believe this is generally a 
good idea, though, and just happens to fix this PR.

Currently regression testing on GNU/Linux-x86-32, and I hope there won't 
be any despite this might have some consequences; but I hope all are 
positive :)  Ok to commit if no regressions?

Daniel

PS: The gfc_save_all change remained from some experiments there; I can 
take it out if you prefer.  Should I add a ChangeLog entry like "removed 
blank line"?

-- 
Done:     Arc-Bar-Cav-Sam-Val-Wiz, Dwa-Elf-Gno-Hum-Orc, Law-Neu-Cha, Fem-Mal
To go:    Hea-Kni-Mon-Pri-Ran-Rog-Tou
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch.changelog
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20080905/09c66f68/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch.diff
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20080905/09c66f68/attachment-0001.ksh>


More information about the Fortran mailing list