public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/31668]  New: %VAL rejected for PROC_MODULE and PROC_INTERNAL procedures
@ 2007-04-23 16:54 burnus at gcc dot gnu dot org
  2007-04-23 17:05 ` [Bug fortran/31668] " fxcoudert at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-04-23 16:54 UTC (permalink / raw)
  To: gcc-bugs

Reported by Arjan van Dijk,
http://gcc.gnu.org/ml/fortran/2007-04/msg00367.html

gfortran rejects the following code with the error:
  "By-value argument at (1) is not allowed in this context"

This is because the following check is matched: resolve.c,
resolve_actual_arglist():

              /* Intrinsics are still PROC_UNKNOWN here.  However,
                 since same file external procedures are not resolvable
                 in gfortran, it is a good deal easier to leave them to
                 intrinsic.c.  */
              if (ptype != PROC_UNKNOWN
                  && ptype != PROC_DUMMY
                  && ptype != PROC_EXTERNAL)

However, in this case: ptype == PROC_MODULE.

The following values are possible:
  PROC_UNKNOWN, PROC_MODULE, PROC_INTERNAL, PROC_DUMMY,
  PROC_INTRINSIC, PROC_ST_FUNCTION, PROC_EXTERNAL

I have to think about which cases make sense and which don't.
What speaks against allowing PROC_INTRINSIC, PROC_INTERNAL, PROC_ST_FUNCTION?
Is there one which needs always be rejected? If yes, a test case would be nice.

For PROC_INTERNAL I would argue it should be allowed:

   SUBROUTINE Grid2BMP(NX)
   INTEGER, INTENT(IN) :: NX
   call bmp_write(%val(nx))
   contains
       subroutine bmp_write(nx)
         integer, intent(in) :: nx
       end subroutine bmp_write
   END SUBROUTINE Grid2BMP
end

For statement functions, I agree it should be invalid (for %VAL, %REF, %DESCR):
   SUBROUTINE Grid2BMP(NX)
   INTEGER, INTENT(IN) :: NX
   integer :: i,f
   f(i)=i**2  ! statement function
   i = f(%VAL(i))
   END SUBROUTINE Grid2BMP
This agrees with ifort which also rejects it.

And for PROC_INTRINSIC: ifort rejects sin(%VAL(x)) as above (%VAL/%REF/%DESCR
invalid in this context), gfortran has the error:
"Argument list function at (1) is not allowed in this context".
(I prefer Intel's error message.)

At the moment, I don't see any intrinsic which would work with %VAL, but maybe
I miss something. Is there an example for PROC_INTRINSIC or PROC_UNKNOWN which
needs to be supported?

Example:
a) Longer example, see follow up email (URL above)
b) short example (works if one moves the interface into the procedure body):

module x
   interface
       subroutine bmp_write(nx)
         integer, intent(in) :: nx
       end subroutine bmp_write
   end interface
contains
   SUBROUTINE Grid2BMP(NX)
   INTEGER, INTENT(IN) :: NX
   call bmp_write(%val(nx))
   END SUBROUTINE Grid2BMP
END module
end


-- 
           Summary: %VAL rejected for PROC_MODULE and PROC_INTERNAL
                    procedures
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


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


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

* [Bug fortran/31668] %VAL rejected for PROC_MODULE and PROC_INTERNAL procedures
  2007-04-23 16:54 [Bug fortran/31668] New: %VAL rejected for PROC_MODULE and PROC_INTERNAL procedures burnus at gcc dot gnu dot org
@ 2007-04-23 17:05 ` fxcoudert at gcc dot gnu dot org
  2007-04-24 19:31 ` steven at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-04-23 17:05 UTC (permalink / raw)
  To: gcc-bugs



-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fxcoudert at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-04-23 18:05:48
               date|                            |


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


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

* [Bug fortran/31668] %VAL rejected for PROC_MODULE and PROC_INTERNAL procedures
  2007-04-23 16:54 [Bug fortran/31668] New: %VAL rejected for PROC_MODULE and PROC_INTERNAL procedures burnus at gcc dot gnu dot org
  2007-04-23 17:05 ` [Bug fortran/31668] " fxcoudert at gcc dot gnu dot org
@ 2007-04-24 19:31 ` steven at gcc dot gnu dot org
  2007-04-25  7:40 ` patchapp at dberlin dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: steven at gcc dot gnu dot org @ 2007-04-24 19:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from steven at gcc dot gnu dot org  2007-04-24 20:31 -------
Patch posted here:
http://gcc.gnu.org/ml/gcc-patches/2007-04/msg01609.html


-- 

steven at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |http://gcc.gnu.org/ml/gcc-
                   |                            |patches/2007-
                   |                            |04/msg01609.html


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


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

* [Bug fortran/31668] %VAL rejected for PROC_MODULE and PROC_INTERNAL procedures
  2007-04-23 16:54 [Bug fortran/31668] New: %VAL rejected for PROC_MODULE and PROC_INTERNAL procedures burnus at gcc dot gnu dot org
  2007-04-23 17:05 ` [Bug fortran/31668] " fxcoudert at gcc dot gnu dot org
  2007-04-24 19:31 ` steven at gcc dot gnu dot org
@ 2007-04-25  7:40 ` patchapp at dberlin dot org
  2007-04-25  8:33 ` burnus at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: patchapp at dberlin dot org @ 2007-04-25  7:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from patchapp at dberlin dot org  2007-04-25 08:40 -------
Subject: Bug number PR 31668

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-04/msg01609.html


-- 


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


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

* [Bug fortran/31668] %VAL rejected for PROC_MODULE and PROC_INTERNAL procedures
  2007-04-23 16:54 [Bug fortran/31668] New: %VAL rejected for PROC_MODULE and PROC_INTERNAL procedures burnus at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2007-04-25  7:40 ` patchapp at dberlin dot org
@ 2007-04-25  8:33 ` burnus at gcc dot gnu dot org
  2007-04-25  8:34 ` fxcoudert at gcc dot gnu dot org
  2007-04-25  8:35 ` burnus at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-04-25  8:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from burnus at gcc dot gnu dot org  2007-04-25 09:32 -------
Subject: Bug 31668

Author: burnus
Date: Wed Apr 25 09:32:21 2007
New Revision: 124147

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=124147
Log:
fortran/
2007-04-25  Tobias Burnus  <burnus@net-b.de>

        PR fortran/31668
        * error.c (error_print): Fix %% support.
        * intrinsic.c (sort_actual): Improve error message.
        * resolve.c (resolve_actual_arglist): Allow %VAL for
        interfaces defined in the module declaration part.

testsuite/
2007-04-25  Tobias Burnus  <burnus@net-b.de>

        PR fortran/31668
        * gfortran.dg/c_by_val_2.f90: Add rejection test of %VAL with
        statement functions.
        * gfortran.dg/c_by_val_5.f90: New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/c_by_val_5.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/error.c
    trunk/gcc/fortran/intrinsic.c
    trunk/gcc/fortran/resolve.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/c_by_val_2.f90


-- 


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


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

* [Bug fortran/31668] %VAL rejected for PROC_MODULE and PROC_INTERNAL procedures
  2007-04-23 16:54 [Bug fortran/31668] New: %VAL rejected for PROC_MODULE and PROC_INTERNAL procedures burnus at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2007-04-25  8:33 ` burnus at gcc dot gnu dot org
@ 2007-04-25  8:34 ` fxcoudert at gcc dot gnu dot org
  2007-04-25  8:35 ` burnus at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-04-25  8:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from fxcoudert at gcc dot gnu dot org  2007-04-25 09:33 -------
Fixed on mainline, closing.


-- 

fxcoudert at gcc dot gnu dot org changed:

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


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


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

* [Bug fortran/31668] %VAL rejected for PROC_MODULE and PROC_INTERNAL procedures
  2007-04-23 16:54 [Bug fortran/31668] New: %VAL rejected for PROC_MODULE and PROC_INTERNAL procedures burnus at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2007-04-25  8:34 ` fxcoudert at gcc dot gnu dot org
@ 2007-04-25  8:35 ` burnus at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-04-25  8:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from burnus at gcc dot gnu dot org  2007-04-25 09:35 -------
Fixed. For completeness, I only support PROC_MODULE (for interfaces to external
routines) and not PROC_INTERNAL as there is no way (except VALUE) to make use
of a call-by-value variable.


-- 


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


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

end of thread, other threads:[~2007-04-25  8:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-23 16:54 [Bug fortran/31668] New: %VAL rejected for PROC_MODULE and PROC_INTERNAL procedures burnus at gcc dot gnu dot org
2007-04-23 17:05 ` [Bug fortran/31668] " fxcoudert at gcc dot gnu dot org
2007-04-24 19:31 ` steven at gcc dot gnu dot org
2007-04-25  7:40 ` patchapp at dberlin dot org
2007-04-25  8:33 ` burnus at gcc dot gnu dot org
2007-04-25  8:34 ` fxcoudert at gcc dot gnu dot org
2007-04-25  8:35 ` 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).