Bug 32535 - namelist with private items contained in sub-sub-procedure of a module rejected
Summary: namelist with private items contained in sub-sub-procedure of a module rejected
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2007-06-28 12:11 UTC by Tobias Burnus
Modified: 2007-07-17 21:34 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Burnus 2007-06-28 12:11:53 UTC
Janus, how about submitting a patch for this bug including a testcase?

As Janus Weil found out:
http://gcc.gnu.org/ml/fortran/2007-06/msg00488.html

If a namelist in a procedure contained in a module procedure contains a private item as element, a bogus error message is printed:
   Error: PRIVATE symbol 'r' cannot be member of PUBLIC namelist at (1)

This fails if the symbol is not in the parent, but in the parent->parent
namespace.
One solution would be to add
    && !(sym->ns->parent->parent == nl->sym->ns)

module mod
  real, private :: r
contains
  subroutine x
  contains
    subroutine y
      namelist /n/ r
    end subroutine y
  end subroutine x
end module mod
end
Comment 1 patchapp@dberlin.org 2007-07-08 21:06:07 UTC
Subject: Bug number PR 32535

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2007-07/msg00650.html
Comment 2 Tobias Burnus 2007-07-17 21:33:44 UTC
Subject: Bug 32535

Author: burnus
Date: Tue Jul 17 21:33:34 2007
New Revision: 126706

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=126706
Log:
2007-07-17  Janus Weil  <jaydub66@gmail.com>

	PR fortran/32535
	* resolve.c (resolve_fl_namelist): Check for namelist private
	components in contained subprograms.

2007-07-17  Janus Weil  <jaydub66@gmail.com>

	PR fortran/32535
	* gfortran.dg/pr32535.f90: New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/pr32535.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/resolve.c
    trunk/gcc/testsuite/ChangeLog

Comment 3 Tobias Burnus 2007-07-17 21:34:39 UTC
FIXED in the trunk; no regression => no backporting.