public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/38065]  New: bug5
@ 2008-11-09 14:53 clerman at fuse dot net
  2008-11-09 14:58 ` [Bug fortran/38065] bug5 clerman at fuse dot net
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: clerman at fuse dot net @ 2008-11-09 14:53 UTC (permalink / raw)
  To: gcc-bugs

Hello,

Thank you for fixing the last bug I reported, number 37445.

I am attempting to build my lens design program. I encounter the following
errors when I compile file geomotfM.f90:

/home/norm/design/source/geomotfM.f90:836.4:

    function CreateLine ( RayData, MaxFreq, NoOfGoodRays, ChromaticWeights, Err
   1
Error: PUBLIC function 'createline' at (1) cannot be of PRIVATE type 'tline'

This is incorrect. Both the type TLine and the function CreateLine are private
to the module. The NAG, Intel and g95 compilers all compile this.

I tried to reproduce this problem with a small example, but I did not succeed. 

As soon as I am assigned a bug number, I will upload a tar file, bug5.tgz to
the following address: gcc-bugzilla@gcc.gnu.org. Unpack the file and invoke the
shell script bug5.sh to reproduce the problem.

I'll indicate the bug number in the subject line.

I am running Open SuSE 10.1 on a dual core Athlon chip. I'm using the gcc-trunk
build:

norm@oxford:~/design/gfortran/production> gfortran --version
GNU Fortran (GCC) 4.4.0 20081109 (experimental) [trunk revision 141714]
Copyright (C) 2008 Free Software Foundation, Inc.

Thank you for your attention.

Norm Clerman


-- 
           Summary: bug5
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: clerman at fuse dot net


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38065


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug fortran/38065] bug5
  2008-11-09 14:53 [Bug fortran/38065] New: bug5 clerman at fuse dot net
@ 2008-11-09 14:58 ` clerman at fuse dot net
  2008-11-09 17:23 ` jv244 at cam dot ac dot uk
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: clerman at fuse dot net @ 2008-11-09 14:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from clerman at fuse dot net  2008-11-09 14:57 -------
Subject: bug 38065 (my bug5)

Attached is the file you will need to reproduce the problem.

Thanks again for your assistance.

Norm Clerman


------- Comment #2 from clerman at fuse dot net  2008-11-09 14:57 -------
Created an attachment (id=16640)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16640&action=view)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38065


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug fortran/38065] bug5
  2008-11-09 14:53 [Bug fortran/38065] New: bug5 clerman at fuse dot net
  2008-11-09 14:58 ` [Bug fortran/38065] bug5 clerman at fuse dot net
@ 2008-11-09 17:23 ` jv244 at cam dot ac dot uk
  2008-11-09 21:55 ` clerman at fuse dot net
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jv244 at cam dot ac dot uk @ 2008-11-09 17:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jv244 at cam dot ac dot uk  2008-11-09 17:22 -------
(In reply to comment #2)
> Created an attachment (id=16640)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16640&action=view) [edit]
> 

the shell script seems to have a few lines referring to your home, but it looks
like most files are there. 

One missing file is:

 treetypeT.f90

please check that all files needed to reproduce the error are in the tarball,
and that the procedure how to reproduce the error is clear enough. 


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38065


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug fortran/38065] bug5
  2008-11-09 14:53 [Bug fortran/38065] New: bug5 clerman at fuse dot net
  2008-11-09 14:58 ` [Bug fortran/38065] bug5 clerman at fuse dot net
  2008-11-09 17:23 ` jv244 at cam dot ac dot uk
@ 2008-11-09 21:55 ` clerman at fuse dot net
  2008-11-11 13:29 ` [Bug fortran/38065] private/public confusion with a contained function jv244 at cam dot ac dot uk
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: clerman at fuse dot net @ 2008-11-09 21:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from clerman at fuse dot net  2008-11-09 21:54 -------
Subject: Re:  bug5

Thank you for your prompt reply. I have reassembled all the files to reproduce
the problem and they are in the attached file bug5a.tgz.

My apologies for any problem this has caused.

Norm Clerman

---- jv244 at cam dot ac dot uk <gcc-bugzilla@gcc.gnu.org> wrote: 
> 
> 
> ------- Comment #3 from jv244 at cam dot ac dot uk  2008-11-09 17:22 -------
> (In reply to comment #2)
> > Created an attachment (id=16640)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16640&action=view)
>  --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16640&action=view) [edit]
> > 
> 
> the shell script seems to have a few lines referring to your home, but it looks
> like most files are there. 
> 
> One missing file is:
> 
>  treetypeT.f90
> 
> please check that all files needed to reproduce the error are in the tarball,
> and that the procedure how to reproduce the error is clear enough. 
> 
> 
> -- 
> 
> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38065
> 
> ------- You are receiving this mail because: -------
> You reported the bug, or are watching the reporter.


------- Comment #5 from clerman at fuse dot net  2008-11-09 21:54 -------
Created an attachment (id=16642)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16642&action=view)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38065


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug fortran/38065] private/public confusion with a contained function
  2008-11-09 14:53 [Bug fortran/38065] New: bug5 clerman at fuse dot net
                   ` (2 preceding siblings ...)
  2008-11-09 21:55 ` clerman at fuse dot net
@ 2008-11-11 13:29 ` jv244 at cam dot ac dot uk
  2008-11-11 13:47 ` clerman at fuse dot net
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jv244 at cam dot ac dot uk @ 2008-11-11 13:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jv244 at cam dot ac dot uk  2008-11-11 13:28 -------
reduced:

MODULE M1
  IMPLICIT NONE
  PRIVATE
  TYPE T1
   INTEGER :: I1
  END TYPE T1
  PUBLIC :: S1
CONTAINS
  SUBROUTINE S1
  CONTAINS
   TYPE(T1) FUNCTION F1()
   END FUNCTION F1
  END SUBROUTINE S1
END MODULE M1


-- 

jv244 at cam dot ac dot uk changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
OtherBugsDependingO|                            |32834
              nThis|                            |
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |rejects-valid
      Known to fail|                            |4.4.0
   Last reconfirmed|0000-00-00 00:00:00         |2008-11-11 13:28:28
               date|                            |
            Summary|bug5                        |private/public confusion
                   |                            |with a contained function


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38065


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug fortran/38065] private/public confusion with a contained function
  2008-11-09 14:53 [Bug fortran/38065] New: bug5 clerman at fuse dot net
                   ` (3 preceding siblings ...)
  2008-11-11 13:29 ` [Bug fortran/38065] private/public confusion with a contained function jv244 at cam dot ac dot uk
@ 2008-11-11 13:47 ` clerman at fuse dot net
  2008-11-11 14:16 ` jv244 at cam dot ac dot uk
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: clerman at fuse dot net @ 2008-11-11 13:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from clerman at fuse dot net  2008-11-11 13:46 -------
Subject: Re:  private/public confusion with a contained
 function

Hello,

  As best I can see, your reduction of the problem is not correct; in it
subroutine S1 should be private, not public.

Yours truly,

Norm Clerman

---- jv244 at cam dot ac dot uk <gcc-bugzilla@gcc.gnu.org> wrote: 
> 
> 
> ------- Comment #6 from jv244 at cam dot ac dot uk  2008-11-11 13:28 -------
> reduced:
> 
> MODULE M1
>   IMPLICIT NONE
>   PRIVATE
>   TYPE T1
>    INTEGER :: I1
>   END TYPE T1
>   PUBLIC :: S1
> CONTAINS
>   SUBROUTINE S1
>   CONTAINS
>    TYPE(T1) FUNCTION F1()
>    END FUNCTION F1
>   END SUBROUTINE S1
> END MODULE M1
> 
> 
> -- 
> 
> jv244 at cam dot ac dot uk changed:
> 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
> OtherBugsDependingO|                            |32834
>               nThis|                            |
>              Status|UNCONFIRMED                 |NEW
>      Ever Confirmed|0                           |1
>            Keywords|                            |rejects-valid
>       Known to fail|                            |4.4.0
>    Last reconfirmed|0000-00-00 00:00:00         |2008-11-11 13:28:28
>                date|                            |
>             Summary|bug5                        |private/public confusion
>                    |                            |with a contained function
> 
> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38065
> 
> ------- You are receiving this mail because: -------
> You reported the bug, or are watching the reporter.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38065


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug fortran/38065] private/public confusion with a contained function
  2008-11-09 14:53 [Bug fortran/38065] New: bug5 clerman at fuse dot net
                   ` (4 preceding siblings ...)
  2008-11-11 13:47 ` clerman at fuse dot net
@ 2008-11-11 14:16 ` jv244 at cam dot ac dot uk
  2008-11-11 14:30 ` burnus at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jv244 at cam dot ac dot uk @ 2008-11-11 14:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from jv244 at cam dot ac dot uk  2008-11-11 14:14 -------
(In reply to comment #7)
>   As best I can see, your reduction of the problem is not correct; in it
> subroutine S1 should be private, not public.

I don't think so. See your code, S1 ~ GeomMTF, which is public. The problem is
the contained function F1 (your CreateLine), which incorrectly gets a 'public'
attribute. Note that the same, incorrect error message is displayed for this
testcase.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38065


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug fortran/38065] private/public confusion with a contained function
  2008-11-09 14:53 [Bug fortran/38065] New: bug5 clerman at fuse dot net
                   ` (5 preceding siblings ...)
  2008-11-11 14:16 ` jv244 at cam dot ac dot uk
@ 2008-11-11 14:30 ` burnus at gcc dot gnu dot org
  2008-11-11 14:36 ` burnus at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-11-11 14:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from burnus at gcc dot gnu dot org  2008-11-11 14:28 -------
(In reply to comment #6)
> reduced:
>
>   SUBROUTINE S1
>   CONTAINS
>    TYPE(T1) FUNCTION F1()
>    END FUNCTION F1
>   END SUBROUTINE S1

Error: PUBLIC function 'f1' at (1) cannot be of PRIVATE type 't1'

gfortran has two bugs:
a) F1 is an internal function and thus PUBLIC/PRIVATE does not apply
b) If one makes F1 a (PUBLIC) *module* function, the program still would be a
valid Fortran 2003 program (and an invalid Fortran 95 program).

I still need to test whether the original program is fixed or not; there are
quite a lot files ... 

Fix:
+++ gcc/fortran/resolve.c       (Arbeitskopie)
@@ -10181,0 +10182 @@ resolve_fntype (gfc_namespace *ns)
+      && !sym->attr.contained
@@ -10186,2 +10187,3 @@ resolve_fntype (gfc_namespace *ns)
-      gfc_error ("PUBLIC function '%s' at %L cannot be of PRIVATE type '%s'",
-                sym->name, &sym->declared_at, sym->ts.derived->name);
+      gfc_notify_std (GFC_STD_F2003, "Fortran 2003: PUBLIC function '%s' at "
+                     "%L of PRIVATE type '%s'", sym->name,
+                     &sym->declared_at, sym->ts.derived->name);


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu dot
                   |                            |org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38065


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug fortran/38065] private/public confusion with a contained function
  2008-11-09 14:53 [Bug fortran/38065] New: bug5 clerman at fuse dot net
                   ` (6 preceding siblings ...)
  2008-11-11 14:30 ` burnus at gcc dot gnu dot org
@ 2008-11-11 14:36 ` burnus at gcc dot gnu dot org
  2008-11-11 14:37 ` clerman at fuse dot net
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-11-11 14:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from burnus at gcc dot gnu dot org  2008-11-11 14:35 -------
bug5a.tgz compiled successfully with the patch in comment 9.


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |burnus at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2008-11-11 13:28:28         |2008-11-11 14:35:00
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38065


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug fortran/38065] private/public confusion with a contained function
  2008-11-09 14:53 [Bug fortran/38065] New: bug5 clerman at fuse dot net
                   ` (7 preceding siblings ...)
  2008-11-11 14:36 ` burnus at gcc dot gnu dot org
@ 2008-11-11 14:37 ` clerman at fuse dot net
  2008-11-12  7:02 ` burnus at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: clerman at fuse dot net @ 2008-11-11 14:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from clerman at fuse dot net  2008-11-11 14:35 -------
Subject: Re:  private/public confusion with a contained
 function

Hello,

  Thank you for responding so promptly.

  Yes, I see what's going on now. It wasn't apparent to me that my function
CreateLine was incorrectly acquiring the ''public' attribute. This explains why
I could not reduce the problem as you have.

Norm Clerman

---- jv244 at cam dot ac dot uk <gcc-bugzilla@gcc.gnu.org> wrote: 
> 
> 
> ------- Comment #8 from jv244 at cam dot ac dot uk  2008-11-11 14:14 -------
> (In reply to comment #7)
> >   As best I can see, your reduction of the problem is not correct; in it
> > subroutine S1 should be private, not public.
> 
> I don't think so. See your code, S1 ~ GeomMTF, which is public. The problem is
> the contained function F1 (your CreateLine), which incorrectly gets a 'public'
> attribute. Note that the same, incorrect error message is displayed for this
> testcase.
> 
> 
> -- 
> 
> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38065
> 
> ------- You are receiving this mail because: -------
> You reported the bug, or are watching the reporter.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38065


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug fortran/38065] private/public confusion with a contained function
  2008-11-09 14:53 [Bug fortran/38065] New: bug5 clerman at fuse dot net
                   ` (8 preceding siblings ...)
  2008-11-11 14:37 ` clerman at fuse dot net
@ 2008-11-12  7:02 ` burnus at gcc dot gnu dot org
  2008-11-12  7:04 ` burnus at gcc dot gnu dot org
  2008-11-12 18:41 ` burnus at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-11-12  7:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from burnus at gcc dot gnu dot org  2008-11-12 07:00 -------
Subject: Bug 38065

Author: burnus
Date: Wed Nov 12 06:59:33 2008
New Revision: 141780

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=141780
Log:
2008-11-12  Tobias Burnus  <burnus@net-b.de>

        PR fortran/38065
        * resolve.c (resolve_fntype): Fix private derived type checking.

2008-11-12  Tobias Burnus  <burnus@net-b.de>

        PR fortran/38065
        * gfortran.dg/private_type_11.f90: New test.
        * gfortran.dg/private_type_12.f90: New test.


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


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38065


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug fortran/38065] private/public confusion with a contained function
  2008-11-09 14:53 [Bug fortran/38065] New: bug5 clerman at fuse dot net
                   ` (9 preceding siblings ...)
  2008-11-12  7:02 ` burnus at gcc dot gnu dot org
@ 2008-11-12  7:04 ` burnus at gcc dot gnu dot org
  2008-11-12 18:41 ` burnus at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-11-12  7:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from burnus at gcc dot gnu dot org  2008-11-12 07:02 -------
FIXED on the trunk (4.4.0).


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38065


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug fortran/38065] private/public confusion with a contained function
  2008-11-09 14:53 [Bug fortran/38065] New: bug5 clerman at fuse dot net
                   ` (10 preceding siblings ...)
  2008-11-12  7:04 ` burnus at gcc dot gnu dot org
@ 2008-11-12 18:41 ` burnus at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-11-12 18:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #14 from burnus at gcc dot gnu dot org  2008-11-12 18:39 -------
Subject: Bug 38065

Author: burnus
Date: Wed Nov 12 18:38:08 2008
New Revision: 141798

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=141798
Log:
2008-11-12  Tobias Burnus  <burnus@net-b.de>

       PR fortran/38065
       PR fortran/38094
       * gfortran.dg/private_type_4.f90: Add -std=f95 option.


Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/private_type_4.f90


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38065


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2008-11-12 18:41 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-09 14:53 [Bug fortran/38065] New: bug5 clerman at fuse dot net
2008-11-09 14:58 ` [Bug fortran/38065] bug5 clerman at fuse dot net
2008-11-09 17:23 ` jv244 at cam dot ac dot uk
2008-11-09 21:55 ` clerman at fuse dot net
2008-11-11 13:29 ` [Bug fortran/38065] private/public confusion with a contained function jv244 at cam dot ac dot uk
2008-11-11 13:47 ` clerman at fuse dot net
2008-11-11 14:16 ` jv244 at cam dot ac dot uk
2008-11-11 14:30 ` burnus at gcc dot gnu dot org
2008-11-11 14:36 ` burnus at gcc dot gnu dot org
2008-11-11 14:37 ` clerman at fuse dot net
2008-11-12  7:02 ` burnus at gcc dot gnu dot org
2008-11-12  7:04 ` burnus at gcc dot gnu dot org
2008-11-12 18:41 ` burnus at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).