public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/30081]  New: Interface bug overloading random_seed, random_number
@ 2006-12-06  9:11 anlauf at gmx dot de
  2006-12-06  9:12 ` [Bug fortran/30081] " anlauf at gmx dot de
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: anlauf at gmx dot de @ 2006-12-06  9:11 UTC (permalink / raw)
  To: gcc-bugs

Hi,

here's an interface related bug I discovered which is not
yet mentioned in PR 29670.

% gfortran gfcbug46.f90
gfcbug46.f90:25.29:

    call random_number (t% x)
                            1
Error: There is no specific subroutine for the generic 'random_number' at (1)
gfcbug46.f90:20.29:

    call random_seed (size=n)
                            1
Error: There is no specific subroutine for the generic 'random_seed' at (1)


The code is standard-conforming and works with other compilers.
See the attached code for details.


-- 
           Summary: Interface bug overloading random_seed, random_number
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: anlauf at gmx dot de
  GCC host triplet: i686-pc-linux-gnu


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


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

* [Bug fortran/30081] Interface bug overloading random_seed, random_number
  2006-12-06  9:11 [Bug fortran/30081] New: Interface bug overloading random_seed, random_number anlauf at gmx dot de
@ 2006-12-06  9:12 ` anlauf at gmx dot de
  2006-12-07 17:28 ` pault at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: anlauf at gmx dot de @ 2006-12-06  9:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from anlauf at gmx dot de  2006-12-06 09:12 -------
Created an attachment (id=12752)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12752&action=view)
Interface bug demo code


-- 


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


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

* [Bug fortran/30081] Interface bug overloading random_seed, random_number
  2006-12-06  9:11 [Bug fortran/30081] New: Interface bug overloading random_seed, random_number anlauf at gmx dot de
  2006-12-06  9:12 ` [Bug fortran/30081] " anlauf at gmx dot de
@ 2006-12-07 17:28 ` pault at gcc dot gnu dot org
  2006-12-07 18:50 ` burnus at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-12-07 17:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pault at gcc dot gnu dot org  2006-12-07 17:28 -------
Harald,

I agree that other compilers handle this OK but is it valid?  As far as I can
tell,  random_number and random_seed are specific intrinsics.  What should the
form be here?

Thanks for keeping us on our toes!

Paul


-- 

pault 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=30081


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

* [Bug fortran/30081] Interface bug overloading random_seed, random_number
  2006-12-06  9:11 [Bug fortran/30081] New: Interface bug overloading random_seed, random_number anlauf at gmx dot de
  2006-12-06  9:12 ` [Bug fortran/30081] " anlauf at gmx dot de
  2006-12-07 17:28 ` pault at gcc dot gnu dot org
@ 2006-12-07 18:50 ` burnus at gcc dot gnu dot org
  2006-12-14 21:13 ` pault at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: burnus at gcc dot gnu dot org @ 2006-12-07 18:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from burnus at gcc dot gnu dot org  2006-12-07 18:49 -------
> I agree that other compilers handle this OK but is it valid?

I think it is. Think of the form

  interface operator(=)
     module procedure myassign
  end interface

here the "generic-spec" is not a "generic-name" but an
"operator (defined operator)", but for this case it should be clear that one
can add "myassign" to the generic interface which contains the intrinsic
operator(=).

Analogously, I don't see any reason why one shouldn't be able to enhance
"random_number" by a procedure which takes different arguments.


And now more formally

"12.4.4 Resolving named procedure references"
"(1) A procedure name is established to be generic in a scoping unit
     (a) if that scoping unit contains an interface block with that name;"

Next step:
"12.4.4.1 Resolving procedure references to names established to be generic"
"(3) If (1) and (2) do not apply, if the scoping unit contains either an
INTRINSIC attribute specification for that name"

(If one adds to "random_vector(t)" an "Intrinsic random_number" it indeed works
also with gfortran.)

Ok, still not resolved, next try:

"12.4.4.3 Resolving procedure references to names not established"
"(2) If (1) does not apply, if the name is the name of an intrinsic procedure,
and if there is agreement between the reference and the status of the intrinsic
procedure as being a function or subroutine, the reference is to that intrinsic
procedure."

Uff, finally found something which resolves it.


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |rejects-valid
   Last reconfirmed|0000-00-00 00:00:00         |2006-12-07 18:49:57
               date|                            |


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


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

* [Bug fortran/30081] Interface bug overloading random_seed, random_number
  2006-12-06  9:11 [Bug fortran/30081] New: Interface bug overloading random_seed, random_number anlauf at gmx dot de
                   ` (2 preceding siblings ...)
  2006-12-07 18:50 ` burnus at gcc dot gnu dot org
@ 2006-12-14 21:13 ` pault at gcc dot gnu dot org
  2006-12-14 21:14 ` pault at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-12-14 21:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pault at gcc dot gnu dot org  2006-12-14 21:12 -------
Harald,

As usual, you provide us with the good ones.  This problem arises because the
resolution of intrinsics, if there is no matching specific interface, has been
restricted to generics only. The following effects a cure and regtests OK.

I will submit it with a suitable rendition of your testscase, as soon as I am
back home.

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
   Last reconfirmed|2006-12-07 18:49:57         |2006-12-14 21:12:56
               date|                            |


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


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

* [Bug fortran/30081] Interface bug overloading random_seed, random_number
  2006-12-06  9:11 [Bug fortran/30081] New: Interface bug overloading random_seed, random_number anlauf at gmx dot de
                   ` (3 preceding siblings ...)
  2006-12-14 21:13 ` pault at gcc dot gnu dot org
@ 2006-12-14 21:14 ` pault at gcc dot gnu dot org
  2006-12-16  1:40 ` patchapp at dberlin dot org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-12-14 21:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pault at gcc dot gnu dot org  2006-12-14 21:14 -------
Created an attachment (id=12805)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12805&action=view)
A fix for the PR that regtests OK

This is the patch referred to previously.

Paul


-- 


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


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

* [Bug fortran/30081] Interface bug overloading random_seed, random_number
  2006-12-06  9:11 [Bug fortran/30081] New: Interface bug overloading random_seed, random_number anlauf at gmx dot de
                   ` (4 preceding siblings ...)
  2006-12-14 21:14 ` pault at gcc dot gnu dot org
@ 2006-12-16  1:40 ` patchapp at dberlin dot org
  2006-12-20 13:48 ` pault at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: patchapp at dberlin dot org @ 2006-12-16  1:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from patchapp at dberlin dot org  2006-12-16 01:40 -------
Subject: Bug number PR30081

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-12/msg01147.html


-- 


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


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

* [Bug fortran/30081] Interface bug overloading random_seed, random_number
  2006-12-06  9:11 [Bug fortran/30081] New: Interface bug overloading random_seed, random_number anlauf at gmx dot de
                   ` (5 preceding siblings ...)
  2006-12-16  1:40 ` patchapp at dberlin dot org
@ 2006-12-20 13:48 ` pault at gcc dot gnu dot org
  2006-12-21  8:49 ` anlauf at gmx dot de
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-12-20 13:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pault at gcc dot gnu dot org  2006-12-20 13:48 -------
Subject: Bug 30081

Author: pault
Date: Wed Dec 20 13:48:06 2006
New Revision: 120072

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

        PR fortran/29992
        * interface.c (check_sym_interfaces): Module procedures in a
        generic must be use associated or contained in the module.
        * decl.c (gfc_match_modproc): Set attribute mod_proc.
        * gfortran.h (symbol_attribute): Add mod_proc atribute.

        PR fortran/30081
        * resolve.c (resolve_generic_f, resolve_generic_s): Use
        gfc_intrinsic_name to find out if the function is intrinsic
        because it does not have to be a generic intrinsic to be
        overloaded.

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

        PR fortran/29992
        * gfortran.dg/generic_9.f90: New test.

        PR fortran/30081
        * gfortran.dg/generic_10.f90: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/generic_10.f90
    trunk/gcc/testsuite/gfortran.dg/generic_9.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/decl.c
    trunk/gcc/fortran/gfortran.h
    trunk/gcc/fortran/interface.c
    trunk/gcc/fortran/resolve.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/30081] Interface bug overloading random_seed, random_number
  2006-12-06  9:11 [Bug fortran/30081] New: Interface bug overloading random_seed, random_number anlauf at gmx dot de
                   ` (6 preceding siblings ...)
  2006-12-20 13:48 ` pault at gcc dot gnu dot org
@ 2006-12-21  8:49 ` anlauf at gmx dot de
  2006-12-31 15:01 ` [Bug fortran/30081] [4.2 and 4.1 only ] " pault at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: anlauf at gmx dot de @ 2006-12-21  8:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from anlauf at gmx dot de  2006-12-21 08:49 -------
(In reply to comment #7)

Paul,

a personal thanks for taking care of this one.
With this patch in place, I was now able proceed
compiling a major software piece just to hit
the next gfc_todo (PR 30273)...

Anyway, a merry x-mas and a happy to year to all
actively involved in fixing gfortran.


-- 


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


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

* [Bug fortran/30081] [4.2 and 4.1 only ] Interface bug overloading random_seed, random_number
  2006-12-06  9:11 [Bug fortran/30081] New: Interface bug overloading random_seed, random_number anlauf at gmx dot de
                   ` (7 preceding siblings ...)
  2006-12-21  8:49 ` anlauf at gmx dot de
@ 2006-12-31 15:01 ` pault at gcc dot gnu dot org
  2006-12-31 15:18 ` [Bug fortran/30081] [4.1 " pault at gcc dot gnu dot org
  2007-01-10 18:58 ` pinskia at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-12-31 15:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from pault at gcc dot gnu dot org  2006-12-31 15:00 -------
Subject: Bug 30081

Author: pault
Date: Sun Dec 31 15:00:18 2006
New Revision: 120298

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

        BACKPORTS from 4.3

        PR fortran/30202
        * trans-array.c (gfc_conv_function_call): Use parmse.expr for
        the nullifying of intent(out) arguments rather than the backend
        declaration.

        PR fortran/30190
        * trans-array.c (gfc_conv_array_ref): Remove gfc_evaluate_now
        from the -fbounds-check branch.

        PR fortran/29992
        * interface.c (check_sym_interfaces): Module procedures in a
        generic must be use associated or contained in the module.
        * decl.c (gfc_match_modproc): Set attribute mod_proc.
        * gfortran.h (symbol_attribute): Add mod_proc atribute.

        PR fortran/30081
        * resolve.c (resolve_generic_f, resolve_generic_s): Use
        gfc_intrinsic_name to find out if the function is intrinsic
        because it does not have to be a generic intrinsic to be
        overloaded.

        PR fortran/30236
        * interface.c (compare_interfaces): Handle NULL symbols.
        (count_types_test): Count NULL symbols, which correspond to
        alternate returns.

        (check_interface1): Change final argument from int to bool
        in the function and all references.

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

        BACKPORTS from 4.3

        PR fortran/30202
        * gfortran.dg/alloc_comp_basics_3.f90: New test.

        PR fortran/30190
        * gfortran.dg/bounds_check_5.f90: New test.

        PR fortran/29992
        * gfortran.dg/generic_9.f90: New test.

        PR fortran/30081
        * gfortran.dg/generic_10.f90: New test.

        PR fortran/30236
        * gfortran.dg/altreturn_3.f90: New test.

        * gfortran.dg/char_result_12.f90: Fix comment typos.


Added:
    branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/alloc_comp_basics_3.f90
    branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/bounds_check_5.f90
    branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/generic_10.f90
    branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/generic_9.f90
Modified:
    branches/gcc-4_2-branch/gcc/fortran/ChangeLog
    branches/gcc-4_2-branch/gcc/fortran/decl.c
    branches/gcc-4_2-branch/gcc/fortran/gfortran.h
    branches/gcc-4_2-branch/gcc/fortran/interface.c
    branches/gcc-4_2-branch/gcc/fortran/resolve.c
    branches/gcc-4_2-branch/gcc/fortran/trans-array.c
    branches/gcc-4_2-branch/gcc/fortran/trans-expr.c
    branches/gcc-4_2-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/30081] [4.1 only ] Interface bug overloading random_seed, random_number
  2006-12-06  9:11 [Bug fortran/30081] New: Interface bug overloading random_seed, random_number anlauf at gmx dot de
                   ` (8 preceding siblings ...)
  2006-12-31 15:01 ` [Bug fortran/30081] [4.2 and 4.1 only ] " pault at gcc dot gnu dot org
@ 2006-12-31 15:18 ` pault at gcc dot gnu dot org
  2007-01-10 18:58 ` pinskia at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-12-31 15:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from pault at gcc dot gnu dot org  2006-12-31 15:17 -------
Fixed on trunk and 4.2

Paul


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
            Summary|[4.2 and 4.1 only ]         |[4.1 only ] Interface bug
                   |Interface bug overloading   |overloading random_seed,
                   |random_seed, random_number  |random_number


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


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

* [Bug fortran/30081] [4.1 only ] Interface bug overloading random_seed, random_number
  2006-12-06  9:11 [Bug fortran/30081] New: Interface bug overloading random_seed, random_number anlauf at gmx dot de
                   ` (9 preceding siblings ...)
  2006-12-31 15:18 ` [Bug fortran/30081] [4.1 " pault at gcc dot gnu dot org
@ 2007-01-10 18:58 ` pinskia at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-01-10 18:58 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.2.0


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


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

end of thread, other threads:[~2007-01-10 18:58 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-06  9:11 [Bug fortran/30081] New: Interface bug overloading random_seed, random_number anlauf at gmx dot de
2006-12-06  9:12 ` [Bug fortran/30081] " anlauf at gmx dot de
2006-12-07 17:28 ` pault at gcc dot gnu dot org
2006-12-07 18:50 ` burnus at gcc dot gnu dot org
2006-12-14 21:13 ` pault at gcc dot gnu dot org
2006-12-14 21:14 ` pault at gcc dot gnu dot org
2006-12-16  1:40 ` patchapp at dberlin dot org
2006-12-20 13:48 ` pault at gcc dot gnu dot org
2006-12-21  8:49 ` anlauf at gmx dot de
2006-12-31 15:01 ` [Bug fortran/30081] [4.2 and 4.1 only ] " pault at gcc dot gnu dot org
2006-12-31 15:18 ` [Bug fortran/30081] [4.1 " pault at gcc dot gnu dot org
2007-01-10 18:58 ` pinskia 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).