public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/27122]  New: binary operator functions should require intent(in)
@ 2006-04-11 18:37 tkoenig at gcc dot gnu dot org
  2006-04-17  6:21 ` [Bug fortran/27122] " pault at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2006-04-11 18:37 UTC (permalink / raw)
  To: gcc-bugs

Binary operator functions require their arguments to have intent(in).
Gfortran currently doesn't enforce this, ifort does.

$ cat oper-fun.f90
module mymod
  interface operator (.foo.)
     module procedure foo_int
  end interface
contains
  function foo_int (a, b)
    integer:: foo_int
    integer :: a, b    ! <==== should be intent(in) here
    foo_int = a + 3 * b
  end function foo_int
end module mymod

program main
  use mymod
  print *, 1 .foo. 2
end program main
$ gfortran oper-fun.f90 && ./a.out
           7
$ ifort oper-fun.f90
fortcom: Error: oper-fun.f90, line 6: An explicit INTENT(IN) declaration is
expected for this dummy argument of the defined operation.   [A]
  function foo_int (a, b)
--------------------^
fortcom: Error: oper-fun.f90, line 6: An explicit INTENT(IN) declaration is
expected for this dummy argument of the defined operation.   [B]
  function foo_int (a, b)
-----------------------^
fortcom: Error: oper-fun.f90, line 14: Error in opening the Library module
file.   [MYMOD]
  use mymod
------^
fortcom: Error: oper-fun.f90, line 15: Dotted string neither a defined operator
nor a structure component   [FOO]
  print *, 1 .foo. 2
--------------^
compilation aborted for oper-fun.f90 (code 1)


-- 
           Summary: binary operator functions should require intent(in)
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid, diagnostic
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tkoenig at gcc dot gnu dot org


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


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

* [Bug fortran/27122] binary operator functions should require intent(in)
  2006-04-11 18:37 [Bug fortran/27122] New: binary operator functions should require intent(in) tkoenig at gcc dot gnu dot org
@ 2006-04-17  6:21 ` pault at gcc dot gnu dot org
  2006-04-17 15:00 ` patchapp at dberlin dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-04-17  6:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pault at gcc dot gnu dot org  2006-04-17 06:21 -------
I have a fix for this, modulo some nonsense involving character(*) results in
defined interfaces.  Expect a patch in ~24hours.

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                     |


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


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

* [Bug fortran/27122] binary operator functions should require intent(in)
  2006-04-11 18:37 [Bug fortran/27122] New: binary operator functions should require intent(in) tkoenig at gcc dot gnu dot org
  2006-04-17  6:21 ` [Bug fortran/27122] " pault at gcc dot gnu dot org
@ 2006-04-17 15:00 ` patchapp at dberlin dot org
  2006-04-17 16:03 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: patchapp at dberlin dot org @ 2006-04-17 15:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from patchapp at dberlin dot org  2006-04-17 15:00 -------
Subject: Bug number PR27122

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


-- 


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


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

* [Bug fortran/27122] binary operator functions should require intent(in)
  2006-04-11 18:37 [Bug fortran/27122] New: binary operator functions should require intent(in) tkoenig at gcc dot gnu dot org
  2006-04-17  6:21 ` [Bug fortran/27122] " pault at gcc dot gnu dot org
  2006-04-17 15:00 ` patchapp at dberlin dot org
@ 2006-04-17 16:03 ` pinskia at gcc dot gnu dot org
  2006-04-21  5:10 ` pault at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-04-17 16:03 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-04-17 16:03:10
               date|                            |


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


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

* [Bug fortran/27122] binary operator functions should require intent(in)
  2006-04-11 18:37 [Bug fortran/27122] New: binary operator functions should require intent(in) tkoenig at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2006-04-17 16:03 ` pinskia at gcc dot gnu dot org
@ 2006-04-21  5:10 ` pault at gcc dot gnu dot org
  2006-04-23  5:33 ` pault at gcc dot gnu dot org
  2006-04-23  5:42 ` pault at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-04-21  5:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pault at gcc dot gnu dot org  2006-04-21 05:10 -------
Subject: Bug 27122

Author: pault
Date: Fri Apr 21 05:10:22 2006
New Revision: 113133

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

        PR fortran/27122
        * resolve.c (resolve_function): Remove general restriction on auto
        character length function interfaces.
        (gfc_resolve_uops): Check restrictions on defined operator
        procedures.
        (resolve_types): Call the check for defined operators.

        PR fortran/27113
        * trans-array.c (gfc_trans_array_constructor_subarray): Remove
        redundant gfc_todo_error.
        (get_array_ctor_var_strlen): Remove typo in enum.

2006-04-21 Paul Thomas <pault@gcc.gnu.org>

        PR fortran/27122
        * gfortran.dg/defined_operators_1.f90: New test.
        * gfortran.dg/assumed_charlen_function_1.f90: Add new error and
        remove old ones associated, incorrectly, with Note 5.46.

        PR fortran/27113
        * gfortran.dg/character_array_constructor_1.f90: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/character_array_constructor_1.f90
    trunk/gcc/testsuite/gfortran.dg/defined_operators_1.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/resolve.c
    trunk/gcc/fortran/trans-array.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/assumed_charlen_function_1.f90


-- 


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


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

* [Bug fortran/27122] binary operator functions should require intent(in)
  2006-04-11 18:37 [Bug fortran/27122] New: binary operator functions should require intent(in) tkoenig at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2006-04-21  5:10 ` pault at gcc dot gnu dot org
@ 2006-04-23  5:33 ` pault at gcc dot gnu dot org
  2006-04-23  5:42 ` pault at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-04-23  5:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pault at gcc dot gnu dot org  2006-04-23 05:33 -------
Subject: Bug 27122

Author: pault
Date: Sun Apr 23 05:33:16 2006
New Revision: 113191

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

        PR fortran/27122
        * resolve.c (resolve_function): Remove general restriction on auto
        character length function interfaces.
        (gfc_resolve_uops): Check restrictions on defined operator
        procedures.
        (resolve_types): Call the check for defined operators.

        PR fortran/27113
        * trans-array.c (get_array_ctor_var_strlen): Remove typo in enum.
        Part of the fix in 4.2, which does not work in 4.1 because the
        divergence is now too great.

        PR fortran/26822
        * intrinsic.c (add_functions): Mark LOGICAL as elemental.

        PR fortran/26787
        * expr.c (gfc_check_assign): Extend scope of error to include
        assignments to a procedure in the main program or, from a
        module or internal procedure that is not that represented by
        the lhs symbol. Use VARIABLE rather than l-value in message.

        PR fortran/25597
        * trans-decl.c (gfc_trans_deferred_vars): Check if an array
        result, is also automatic character length.  If so, process
        the character length. Note that this fixes the bug in 4.2
        but not here in 4.1 because the trees have diverged too much.
        Manifestly correct, so applied anyway.

        PR fortran/18803
        PR fortran/25669
        PR fortran/26834
        * trans_intrinsic.c (gfc_walk_intrinsic_bound): Set
        data.info.dimen for bound intrinsics.
        * trans_array.c (gfc_conv_ss_startstride): Pick out LBOUND and
        UBOUND intrinsics and supply their shape information to the ss
        and the loop.

        PR fortran/27124
        * trans_expr.c (gfc_trans_function_call):  Add a new block, post,
        in to which all the argument post blocks are put.  Add this block
        to se->pre after a byref call or to se->post, otherwise.

2006-04-23  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/27122
        * gfortran.dg/defined_operators_1.f90: New test.
        * gfortran.dg/assumed_charlen_function_1.f90: Add new error and
        remove old ones associated, incorrectly, with Note 5.46.

        PR fortran/26787
        * gfortran.dg/proc_assign_1.f90: New test.
        * gfortran.dg/procedure_lvalue.f90: Change message.
        * gfortran.dg/namelist_4.f90: Add new error.

        PR fortran/27089
        * gfortran.dg/specification_type_resolution_1.f90

        PR fortran/18803
        PR fortran/25669
        PR fortran/26834
        * gfortran.dg/bounds_temporaries_1.f90: New test.

        PR fortran/27124
        * gfortran.dg/array_return_value_1.f90: New test.



Added:
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/array_return_value_1.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/bounds_temporaries_1.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/defined_operators_1.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/proc_assign_1.f90
   
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/specification_type_resolution_1.f90
Modified:
    branches/gcc-4_1-branch/gcc/fortran/ChangeLog
    branches/gcc-4_1-branch/gcc/fortran/expr.c
    branches/gcc-4_1-branch/gcc/fortran/intrinsic.c
    branches/gcc-4_1-branch/gcc/fortran/resolve.c
    branches/gcc-4_1-branch/gcc/fortran/trans-array.c
    branches/gcc-4_1-branch/gcc/fortran/trans-decl.c
    branches/gcc-4_1-branch/gcc/fortran/trans-expr.c
    branches/gcc-4_1-branch/gcc/fortran/trans-intrinsic.c
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
   
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/assumed_charlen_function_1.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/namelist_4.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/procedure_lvalue.f90


-- 


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


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

* [Bug fortran/27122] binary operator functions should require intent(in)
  2006-04-11 18:37 [Bug fortran/27122] New: binary operator functions should require intent(in) tkoenig at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2006-04-23  5:33 ` pault at gcc dot gnu dot org
@ 2006-04-23  5:42 ` pault at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-04-23  5:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pault at gcc dot gnu dot org  2006-04-23 05:42 -------
Fixed 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=27122


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

end of thread, other threads:[~2006-04-23  5:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-11 18:37 [Bug fortran/27122] New: binary operator functions should require intent(in) tkoenig at gcc dot gnu dot org
2006-04-17  6:21 ` [Bug fortran/27122] " pault at gcc dot gnu dot org
2006-04-17 15:00 ` patchapp at dberlin dot org
2006-04-17 16:03 ` pinskia at gcc dot gnu dot org
2006-04-21  5:10 ` pault at gcc dot gnu dot org
2006-04-23  5:33 ` pault at gcc dot gnu dot org
2006-04-23  5:42 ` 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).