public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/24558]  New: ENTRY doesn't work in module procedures
@ 2005-10-27 12:40 eedelman at gcc dot gnu dot org
  2005-10-27 23:12 ` [Bug fortran/24558] " pinskia at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: eedelman at gcc dot gnu dot org @ 2005-10-27 12:40 UTC (permalink / raw)
  To: gcc-bugs

With explicitely declared types for a function and it's entry points, I get a
'Duplicate key found!' error:

kl-nrb:~$ cat test_entry_2.f90 
module foo
contains
    function n1()
        integer :: n1, n2
        n1 = 1
        return
    entry n2()
        n2 = 2
        return
    end function n1
end module foo

program bar

    use foo

    print *, n1()
    print *, n2()

end program bar
kl-nrb:~$ gfortran41 test_entry_2.f90
 In file test_entry_2.f90:8

    entry n2()
           1
 Internal Error at (1):
 insert_bbt(): Duplicate key found!


If I remove the explicit type declarations, I get a spurious warning and wierd
results:
kl-nrb:~$ cat test_entry_2b.f90 
module foo
contains
    function n1()
        n1 = 1
        return
    entry n2()
        n2 = 2
        return
    end function n1
end module foo

program bar

    use foo

    print *, n1()
    print *, n2()

end program bar
kl-nrb:~$ gfortran41 test_entry_2b.f90
test_entry_2b.f90: In function 'master.0.n1':
test_entry_2b.f90:8: warning: Function return value not set
kl-nrb:~$ a.out
   134519120
   134519120


-- 
           Summary: ENTRY doesn't work in module procedures
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: eedelman at gcc dot gnu dot org


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


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

* [Bug fortran/24558] ENTRY doesn't work in module procedures
  2005-10-27 12:40 [Bug fortran/24558] New: ENTRY doesn't work in module procedures eedelman at gcc dot gnu dot org
@ 2005-10-27 23:12 ` pinskia at gcc dot gnu dot org
  2006-03-14 15:14 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-10-27 23:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2005-10-27 23:12 -------
For the second one, I get an ICE:
t.f90:10: internal compiler error: in gfc_conv_variable, at
fortran/trans-expr.c:355

But confirmed otherwise.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |ice-on-valid-code
   Last reconfirmed|0000-00-00 00:00:00         |2005-10-27 23:12:08
               date|                            |


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


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

* [Bug fortran/24558] ENTRY doesn't work in module procedures
  2005-10-27 12:40 [Bug fortran/24558] New: ENTRY doesn't work in module procedures eedelman at gcc dot gnu dot org
  2005-10-27 23:12 ` [Bug fortran/24558] " pinskia at gcc dot gnu dot org
@ 2006-03-14 15:14 ` pinskia at gcc dot gnu dot org
  2006-03-15  8:15 ` pault at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-14 15:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2006-03-14 15:14 -------
A simplier example from progsf90:
      module ranlib
      CONTAINS
      LOGICAL FUNCTION qrgnin()
      LOGICAL qrgnsn
      ENTRY qrgnsn(qvalue)
      end function
      end module


-- 


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


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

* [Bug fortran/24558] ENTRY doesn't work in module procedures
  2005-10-27 12:40 [Bug fortran/24558] New: ENTRY doesn't work in module procedures eedelman at gcc dot gnu dot org
  2005-10-27 23:12 ` [Bug fortran/24558] " pinskia at gcc dot gnu dot org
  2006-03-14 15:14 ` pinskia at gcc dot gnu dot org
@ 2006-03-15  8:15 ` pault at gcc dot gnu dot org
  2006-05-30  7:43 ` pault at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-03-15  8:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pault at gcc dot gnu dot org  2006-03-15 08:15 -------
I am working on this one.... slowly but making progress nonetheless.

Paul


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pault at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED


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


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

* [Bug fortran/24558] ENTRY doesn't work in module procedures
  2005-10-27 12:40 [Bug fortran/24558] New: ENTRY doesn't work in module procedures eedelman at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2006-03-15  8:15 ` pault at gcc dot gnu dot org
@ 2006-05-30  7:43 ` pault at gcc dot gnu dot org
  2006-05-31 12:45 ` patchapp at dberlin dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-05-30  7:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pault at gcc dot gnu dot org  2006-05-30 07:43 -------
Created an attachment (id=11535)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11535&action=view)
Preliminary patch to fix the PR

This needs a lot of sprucing up and checking out but it compiles and runs the
version below of your testcase. The disgnostic gfc_warning_now's need removing
too!

Paul

module foo
contains
    function n1(a)
        integer :: n1, n2, a, b
        integer, save :: c
        c = a
        n1 = c**3
        return
    entry n2(b)
        n2 = c * b
        n2 = n2**2
        return
    end function n1

    function n3(d)
        integer :: n3, d
        n3 = n2(d)*n1(d)
        return
    end function n3
end module foo

program bar

    use foo

    print *, n1(9)
    print *, n2(2)
    print *, n3(19)

end program bar


-- 


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


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

* [Bug fortran/24558] ENTRY doesn't work in module procedures
  2005-10-27 12:40 [Bug fortran/24558] New: ENTRY doesn't work in module procedures eedelman at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2006-05-30  7:43 ` pault at gcc dot gnu dot org
@ 2006-05-31 12:45 ` patchapp at dberlin dot org
  2006-06-09 22:16 ` pault at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: patchapp at dberlin dot org @ 2006-05-31 12:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from patchapp at dberlin dot org  2006-05-31 12:45 -------
Subject: Bug number PR24558

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/2006-05/msg01548.html


-- 


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


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

* [Bug fortran/24558] ENTRY doesn't work in module procedures
  2005-10-27 12:40 [Bug fortran/24558] New: ENTRY doesn't work in module procedures eedelman at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2006-05-31 12:45 ` patchapp at dberlin dot org
@ 2006-06-09 22:16 ` pault at gcc dot gnu dot org
  2006-06-11 22:33 ` pault at gcc dot gnu dot org
  2006-06-11 22:34 ` pault at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-06-09 22:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pault at gcc dot gnu dot org  2006-06-09 22:16 -------
Subject: Bug 24558

Author: pault
Date: Fri Jun  9 22:16:08 2006
New Revision: 114526

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=114526
Log:
2006-06-10  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/24558
        PR fortran/20877
        PR fortran/25047
        * decl.c (get_proc_name): Add new argument to flag that a
        module function entry is being treated. If true, correct
        error condition, add symtree to module namespace and add
        a module procedure.
        (gfc_match_function_decl, gfc_match_entry,
        gfc_match_subroutine): Use the new argument in calls to
        get_proc_name.
        * resolve.c (resolve_entries): ENTRY symbol reference to
        to master entry namespace if a module function.
        * trans-decl.c (gfc_create_module_variable): Return if
        the symbol is an entry.
        * trans-exp.c (gfc_conv_variable): Check that parent_decl
        is not NULL.

2006-06-10  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/24558
        * gfortran.dg/entry_6.f90: New test.

        PR fortran/20877
        PR fortran/25047
        * gfortran.dg/entry_7.f90: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/entry_6.f90
    trunk/gcc/testsuite/gfortran.dg/entry_7.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/decl.c
    trunk/gcc/fortran/resolve.c
    trunk/gcc/fortran/trans-decl.c
    trunk/gcc/fortran/trans-expr.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/24558] ENTRY doesn't work in module procedures
  2005-10-27 12:40 [Bug fortran/24558] New: ENTRY doesn't work in module procedures eedelman at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2006-06-09 22:16 ` pault at gcc dot gnu dot org
@ 2006-06-11 22:33 ` pault at gcc dot gnu dot org
  2006-06-11 22:34 ` pault at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-06-11 22:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from pault at gcc dot gnu dot org  2006-06-11 22:33 -------
Cracked on trunk and 4.1.

Paul


-- 

pault at gcc dot gnu dot org changed:

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


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


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

* [Bug fortran/24558] ENTRY doesn't work in module procedures
  2005-10-27 12:40 [Bug fortran/24558] New: ENTRY doesn't work in module procedures eedelman at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2006-06-11 22:33 ` pault at gcc dot gnu dot org
@ 2006-06-11 22:34 ` pault at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-06-11 22:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pault at gcc dot gnu dot org  2006-06-11 22:32 -------
Subject: Bug 24558

Author: pault
Date: Sun Jun 11 22:32:26 2006
New Revision: 114551

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=114551
Log:
2006-06-12  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/24558
        PR fortran/20877
        PR fortran/25047
        * decl.c (get_proc_name): Add new argument to flag that a
        module function entry is being treated. If true, correct
        error condition, add symtree to module namespace and add
        a module procedure.
        (gfc_match_function_decl, gfc_match_entry,
        gfc_match_subroutine): Use the new argument in calls to
        get_proc_name.
        * resolve.c (resolve_entries): ENTRY symbol reference to
        to master entry namespace if a module function.
        * trans-decl.c (gfc_create_module_variable): Return if
        the symbol is an entry.

        PR fortran/23091
        * resolve.c (resolve_fl_variable): Error if an automatic
        object has the SAVE attribute.

        PR fortran/24168
        * expr.c (simplify_intrinsic_op): Transfer the rank and
        the locus to the simplified expression.

        PR fortran/25090
        PR fortran/25058
        * gfortran.h : Add int entry_id to gfc_symbol.
        * resolve.c : Add static variables current_entry_id and
        specification_expr.
        (resolve_variable): During code resolution, check if a
        reference to a dummy variable in an executable expression
        is preceded by its appearance as a parameter in an entry.
        Likewise check its specification expressions.
        (resolve_code): Update current_entry_id on EXEC_ENTRY.
        (resolve_charlen, resolve_fl_variable): Set and reset
        specifiaction_expr.
        (is_non_constant_shape_array): Do not return on detection
        of a variable but continue to resolve all the expressions.
        (resolve_codes): set current_entry_id to an out of range
        value.

2006-06-12  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/24558
        * gfortran.dg/entry_6.f90: New test.

        PR fortran/20877
        PR fortran/25047
        * gfortran.dg/entry_7.f90: New test.

        PR fortran/23091
        * gfortran.dg/saved_automatic_1.f90: New test.

        PR fortran/24168
        * gfortran.dg/array_simplify_1.f90: New test.

        PR fortran/25090
        * gfortran.dg/entry_dummy_ref_1.f90: New test.

        PR fortran/25058
        * gfortran.dg/entry_dummy_ref_2.f90: New test.

Added:
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/array_simplify_1.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/entry_6.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/entry_7.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/entry_dummy_ref_1.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/entry_dummy_ref_2.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/saved_automatic_1.f90
Modified:
    branches/gcc-4_1-branch/gcc/fortran/ChangeLog
    branches/gcc-4_1-branch/gcc/fortran/decl.c
    branches/gcc-4_1-branch/gcc/fortran/expr.c
    branches/gcc-4_1-branch/gcc/fortran/gfortran.h
    branches/gcc-4_1-branch/gcc/fortran/resolve.c
    branches/gcc-4_1-branch/gcc/fortran/trans-decl.c
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog


-- 


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


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

end of thread, other threads:[~2006-06-11 22:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-27 12:40 [Bug fortran/24558] New: ENTRY doesn't work in module procedures eedelman at gcc dot gnu dot org
2005-10-27 23:12 ` [Bug fortran/24558] " pinskia at gcc dot gnu dot org
2006-03-14 15:14 ` pinskia at gcc dot gnu dot org
2006-03-15  8:15 ` pault at gcc dot gnu dot org
2006-05-30  7:43 ` pault at gcc dot gnu dot org
2006-05-31 12:45 ` patchapp at dberlin dot org
2006-06-09 22:16 ` pault at gcc dot gnu dot org
2006-06-11 22:33 ` pault at gcc dot gnu dot org
2006-06-11 22:34 ` pault 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).