public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/52452] New: INTRINSIC cannot be applied to gfortran's ETIME
@ 2012-03-01 15:44 roger.ferrer at bsc dot es
  2012-03-01 18:59 ` [Bug fortran/52452] [4.5/4.6/4.7 Regression] " burnus at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: roger.ferrer at bsc dot es @ 2012-03-01 15:44 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 52452
           Summary: INTRINSIC cannot be applied to gfortran's ETIME
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: roger.ferrer@bsc.es


[Note for a possible duplicate: This bug may be related to #52333, but in that
one EXTERNAL and explicit INTERFACEs are involved (which is not the case in the
current bug).]

gfortran's ETIME can be used either as a FUNCTION or as a SUBROUTINE.

Explicitly specifying that it is an INTRINSIC name (using an
intrinsic-statement) works fine if the function version is used. But when using
the subroutine version, gfortran 4.6.2 complains:

Consider the following testcase

PROGRAM test_etime
    IMPLICIT NONE
    INTRINSIC :: etime
    REAL(4) :: tarray(1:2)
    REAL(4) :: result

    CALL etime(tarray, result)
END PROGRAM test_etime

results in

$ gfortran -c test_etime.f90 
test_etime.f90:3.22:

    INTRINSIC :: etime
                      1
Error: FUNCTION attribute conflicts with SUBROUTINE attribute in 'etime' at (1)

Removing that line the compilation succeeds (and gfortran appropiately emits a
call to _gfortran_etime_sub). Using the function version works too with or
without an INTRINSIC statement.

[Note: I'm aware, as the documentation clearly states, that both forms cannot
be used in a single program unit. I'm just using one of them at a time]

Maybe it is my fault assuming too liberally the meaning of the INTRINSIC
statement/attribute.

Kind regards,


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

* [Bug fortran/52452] [4.5/4.6/4.7 Regression] INTRINSIC cannot be applied to gfortran's ETIME
  2012-03-01 15:44 [Bug fortran/52452] New: INTRINSIC cannot be applied to gfortran's ETIME roger.ferrer at bsc dot es
@ 2012-03-01 18:59 ` burnus at gcc dot gnu.org
  2012-03-02 11:00 ` burnus at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-03-01 18:59 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
      Known to work|                            |4.1.2, 4.3.4, 4.4.0
           Keywords|                            |rejects-valid
   Last reconfirmed|                            |2012-03-01
                 CC|                            |burnus at gcc dot gnu.org
     Ever Confirmed|0                           |1
            Summary|INTRINSIC cannot be applied |[4.5/4.6/4.7 Regression]
                   |to gfortran's ETIME         |INTRINSIC cannot be applied
                   |                            |to gfortran's ETIME
   Target Milestone|---                         |4.5.4
      Known to fail|                            |4.5.3, 4.6.2, 4.7.0

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-03-01 18:59:41 UTC ---
That's odd, but I can reproduce it. It works with GCC 4.1 to 4.4.

I think the problem is related to a specialty of ETIME and a few other vendor
intrinsics: ETIME can be either a function or a subroutine, cf.
http://gcc.gnu.org/onlinedocs/gfortran/ETIME.html

I think with
  INTRINSIC :: etime
it is first evaluated for that line - and for some reasons the function version
is chosen. And then later for
  CALL etime(tarray, result)
one gets then an error.


Untested patch:

--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -1496,7 +1498,7 @@ resolve_intrinsic (gfc_symbol *sym, locus *loc)

   if (sym->intmod_sym_id)
     isym = gfc_intrinsic_function_by_id ((gfc_isym_id) sym->intmod_sym_id);
-  else
+  else if (!sym->attr.subroutine)
     isym = gfc_find_function (sym->name);

   if (isym)


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

* [Bug fortran/52452] [4.5/4.6/4.7 Regression] INTRINSIC cannot be applied to gfortran's ETIME
  2012-03-01 15:44 [Bug fortran/52452] New: INTRINSIC cannot be applied to gfortran's ETIME roger.ferrer at bsc dot es
  2012-03-01 18:59 ` [Bug fortran/52452] [4.5/4.6/4.7 Regression] " burnus at gcc dot gnu.org
@ 2012-03-02 11:00 ` burnus at gcc dot gnu.org
  2012-03-02 15:04 ` [Bug fortran/52452] [4.5/4.6/4.7/4.8 " burnus at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-03-02 11:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-03-02 11:00:17 UTC ---
Author: burnus
Date: Fri Mar  2 11:00:04 2012
New Revision: 184778

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=184778
Log:
2012-03-02  Tobias Burnus  <burnus@net-b.de>

        PR fortran/52452
        * resolve.c (resolve_intrinsic): Don't search for a
        function if we know that it is a subroutine.

2012-03-02  Tobias Burnus  <burnus@net-b.de>

        PR fortran/52452
        * gfortran.dg/intrinsic_8.f90: New.


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


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

* [Bug fortran/52452] [4.5/4.6/4.7/4.8 Regression] INTRINSIC cannot be applied to gfortran's ETIME
  2012-03-01 15:44 [Bug fortran/52452] New: INTRINSIC cannot be applied to gfortran's ETIME roger.ferrer at bsc dot es
  2012-03-01 18:59 ` [Bug fortran/52452] [4.5/4.6/4.7 Regression] " burnus at gcc dot gnu.org
  2012-03-02 11:00 ` burnus at gcc dot gnu.org
@ 2012-03-02 15:04 ` burnus at gcc dot gnu.org
  2012-03-05 16:19 ` [Bug fortran/52452] [4.5/4.6/4.7 " jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-03-02 15:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-03-02 15:03:22 UTC ---
(In reply to comment #2)
> New Revision: 184778
> Modified:
>     trunk/gcc/fortran/resolve.c


As it is far from being obvious what "trunk" means: At that point "trunk" was
already GCC 4.8.

Thus, the patch needs to be backported to 4.5, 4.6, and to 4.7.


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

* [Bug fortran/52452] [4.5/4.6/4.7 Regression] INTRINSIC cannot be applied to gfortran's ETIME
  2012-03-01 15:44 [Bug fortran/52452] New: INTRINSIC cannot be applied to gfortran's ETIME roger.ferrer at bsc dot es
                   ` (2 preceding siblings ...)
  2012-03-02 15:04 ` [Bug fortran/52452] [4.5/4.6/4.7/4.8 " burnus at gcc dot gnu.org
@ 2012-03-05 16:19 ` jakub at gcc dot gnu.org
  2012-03-06 17:08 ` burnus at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-03-05 16:19 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4
                 CC|                            |jakub at gcc dot gnu.org
            Summary|[4.5/4.6/4.7/4.8            |[4.5/4.6/4.7 Regression]
                   |Regression] INTRINSIC       |INTRINSIC cannot be applied
                   |cannot be applied to        |to gfortran's ETIME
                   |gfortran's ETIME            |


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

* [Bug fortran/52452] [4.5/4.6/4.7 Regression] INTRINSIC cannot be applied to gfortran's ETIME
  2012-03-01 15:44 [Bug fortran/52452] New: INTRINSIC cannot be applied to gfortran's ETIME roger.ferrer at bsc dot es
                   ` (3 preceding siblings ...)
  2012-03-05 16:19 ` [Bug fortran/52452] [4.5/4.6/4.7 " jakub at gcc dot gnu.org
@ 2012-03-06 17:08 ` burnus at gcc dot gnu.org
  2012-03-06 17:10 ` burnus at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-03-06 17:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-03-06 17:08:07 UTC ---
Author: burnus
Date: Tue Mar  6 17:08:01 2012
New Revision: 185005

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=185005
Log:
2012-03-06  Tobias Burnus  <burnus@net-b.de>

        Backport from mainline
        2012-03-02  Tobias Burnus  <burnus@net-b.de>

        PR fortran/52452
        * resolve.c (resolve_intrinsic): Don't search for a
        function if we know that it is a subroutine.

2012-03-06  Tobias Burnus  <burnus@net-b.de>

        Backport from mainline
        2012-03-02  Tobias Burnus  <burnus@net-b.de>

        PR fortran/52452
        * gfortran.dg/intrinsic_8.f90: New.


Added:
    branches/gcc-4_6-branch/gcc/testsuite/gfortran.dg/intrinsic_8.f90
Modified:
    branches/gcc-4_6-branch/gcc/fortran/ChangeLog
    branches/gcc-4_6-branch/gcc/fortran/resolve.c
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog


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

* [Bug fortran/52452] [4.5/4.6/4.7 Regression] INTRINSIC cannot be applied to gfortran's ETIME
  2012-03-01 15:44 [Bug fortran/52452] New: INTRINSIC cannot be applied to gfortran's ETIME roger.ferrer at bsc dot es
                   ` (4 preceding siblings ...)
  2012-03-06 17:08 ` burnus at gcc dot gnu.org
@ 2012-03-06 17:10 ` burnus at gcc dot gnu.org
  2012-03-06 17:37 ` burnus at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-03-06 17:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-03-06 17:09:55 UTC ---
Author: burnus
Date: Tue Mar  6 17:09:48 2012
New Revision: 185006

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=185006
Log:
2012-03-06  Tobias Burnus  <burnus@net-b.de>

        Backport from mainline
        2012-03-02  Tobias Burnus  <burnus@net-b.de>

        PR fortran/52452
        * resolve.c (resolve_intrinsic): Don't search for a
        function if we know that it is a subroutine.

2012-03-06  Tobias Burnus  <burnus@net-b.de>

        Backport from mainline
        2012-03-02  Tobias Burnus  <burnus@net-b.de>

        PR fortran/52452
        * gfortran.dg/intrinsic_8.f90: New.


Added:
    branches/gcc-4_5-branch/gcc/testsuite/gfortran.dg/intrinsic_8.f90
Modified:
    branches/gcc-4_5-branch/gcc/fortran/ChangeLog
    branches/gcc-4_5-branch/gcc/fortran/resolve.c
    branches/gcc-4_5-branch/gcc/testsuite/ChangeLog


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

* [Bug fortran/52452] [4.5/4.6/4.7 Regression] INTRINSIC cannot be applied to gfortran's ETIME
  2012-03-01 15:44 [Bug fortran/52452] New: INTRINSIC cannot be applied to gfortran's ETIME roger.ferrer at bsc dot es
                   ` (5 preceding siblings ...)
  2012-03-06 17:10 ` burnus at gcc dot gnu.org
@ 2012-03-06 17:37 ` burnus at gcc dot gnu.org
  2012-03-22 21:22 ` burnus at gcc dot gnu.org
  2012-03-22 21:24 ` [Bug fortran/52452] [4.5/4.6/4.7/4.8 " burnus at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-03-06 17:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-03-06 17:36:07 UTC ---
Fixed for on the 4.6 branch for 4.6.4 (the 4.6.3 release was missed) and on the
4.5 branch.

For 4.7, the backport will happen after the 4.7.0 release (i.e. for 4.7.1).


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

* [Bug fortran/52452] [4.5/4.6/4.7 Regression] INTRINSIC cannot be applied to gfortran's ETIME
  2012-03-01 15:44 [Bug fortran/52452] New: INTRINSIC cannot be applied to gfortran's ETIME roger.ferrer at bsc dot es
                   ` (6 preceding siblings ...)
  2012-03-06 17:37 ` burnus at gcc dot gnu.org
@ 2012-03-22 21:22 ` burnus at gcc dot gnu.org
  2012-03-22 21:24 ` [Bug fortran/52452] [4.5/4.6/4.7/4.8 " burnus at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-03-22 21:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-03-22 21:13:07 UTC ---
Author: burnus
Date: Thu Mar 22 21:13:00 2012
New Revision: 185713

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=185713
Log:
2012-03-22  Tobias Burnus  <burnus@net-b.de>

        PR fortran/52452
        * resolve.c (resolve_intrinsic): Don't search for a
        function if we know that it is a subroutine.

2012-03-22  Tobias Burnus  <burnus@net-b.de>

        PR fortran/52452
        * gfortran.dg/intrinsic_8.f90: New.


Added:
    branches/gcc-4_7-branch/gcc/testsuite/gfortran.dg/intrinsic_8.f90
Modified:
    branches/gcc-4_7-branch/gcc/fortran/ChangeLog
    branches/gcc-4_7-branch/gcc/fortran/resolve.c
    branches/gcc-4_7-branch/gcc/testsuite/ChangeLog


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

* [Bug fortran/52452] [4.5/4.6/4.7/4.8 Regression] INTRINSIC cannot be applied to gfortran's ETIME
  2012-03-01 15:44 [Bug fortran/52452] New: INTRINSIC cannot be applied to gfortran's ETIME roger.ferrer at bsc dot es
                   ` (7 preceding siblings ...)
  2012-03-22 21:22 ` burnus at gcc dot gnu.org
@ 2012-03-22 21:24 ` burnus at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-03-22 21:24 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
            Summary|[4.5/4.6/4.7 Regression]    |[4.5/4.6/4.7/4.8
                   |INTRINSIC cannot be applied |Regression] INTRINSIC
                   |to gfortran's ETIME         |cannot be applied to
                   |                            |gfortran's ETIME

--- Comment #8 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-03-22 21:21:55 UTC ---
Now also fixed on the 4.7 branch (for 4.7.1) - close as FIXED.

Thanks for the bugreport!


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

end of thread, other threads:[~2012-03-22 21:22 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-01 15:44 [Bug fortran/52452] New: INTRINSIC cannot be applied to gfortran's ETIME roger.ferrer at bsc dot es
2012-03-01 18:59 ` [Bug fortran/52452] [4.5/4.6/4.7 Regression] " burnus at gcc dot gnu.org
2012-03-02 11:00 ` burnus at gcc dot gnu.org
2012-03-02 15:04 ` [Bug fortran/52452] [4.5/4.6/4.7/4.8 " burnus at gcc dot gnu.org
2012-03-05 16:19 ` [Bug fortran/52452] [4.5/4.6/4.7 " jakub at gcc dot gnu.org
2012-03-06 17:08 ` burnus at gcc dot gnu.org
2012-03-06 17:10 ` burnus at gcc dot gnu.org
2012-03-06 17:37 ` burnus at gcc dot gnu.org
2012-03-22 21:22 ` burnus at gcc dot gnu.org
2012-03-22 21:24 ` [Bug fortran/52452] [4.5/4.6/4.7/4.8 " burnus at gcc dot gnu.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).