public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/38487]  New: Bogus Warning: INTENT(INOUT) actual argument might interfere with actual argument
@ 2008-12-11 15:39 anlauf at gmx dot de
  2008-12-11 16:08 ` [Bug fortran/38487] " burnus at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: anlauf at gmx dot de @ 2008-12-11 15:39 UTC (permalink / raw)
  To: gcc-bugs

Hi,

somewhere between gfortran 4.3.1 and 4.3.3/4.4.0 the following bogus warning
crept in:

% cat gfcbug82.f90
module gfcbug82
  implicit none
  type t
    real, pointer :: q(:) =>NULL()
    real, pointer :: r(:) =>NULL()
  end type t
  type (t), save :: x, y
contains
  elemental subroutine add (q, r)
    real, intent (inout) :: q
    real, intent (in)    :: r
    q = q + r
  end subroutine add

  subroutine foo ()
      call add (y% q, x% r)
  end subroutine foo
end module gfcbug82
% gfc4x -c gfcbug82.f90
gfcbug82.f90:16.16-21:

      call add (y% q, x% r)
               1    2
Warning: INTENT(INOUT) actual argument at (1) might interfere with actual
argument at (2).


I don't see anything wrong with the above reduced example.


-- 
           Summary: Bogus Warning: INTENT(INOUT) actual argument might
                    interfere with actual argument
           Product: gcc
           Version: 4.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: anlauf at gmx dot de


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


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

* [Bug fortran/38487] Bogus Warning: INTENT(INOUT) actual argument might interfere with actual argument
  2008-12-11 15:39 [Bug fortran/38487] New: Bogus Warning: INTENT(INOUT) actual argument might interfere with actual argument anlauf at gmx dot de
@ 2008-12-11 16:08 ` burnus at gcc dot gnu dot org
  2008-12-11 22:27 ` anlauf at gmx dot de
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-12-11 16:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2008-12-11 16:07 -------
Mikael added this as part of PR 35681 with check in
http://gcc.gnu.org/viewcvs?view=rev&revision=141931

See:
http://gcc.gnu.org/viewcvs/trunk/gcc/fortran/dependency.c?r1=141931&r2=141930&pathrev=141931

I think the warning is OK in the sense that the pointer could point to the same
memory address which could potentially make trouble, but still the warning
feels too strong. However, I have not studied neither the test case not
dependency.c in details.

Mikael, what do you think?


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mikael at gcc dot gnu dot
                   |                            |org


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


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

* [Bug fortran/38487] Bogus Warning: INTENT(INOUT) actual argument might interfere with actual argument
  2008-12-11 15:39 [Bug fortran/38487] New: Bogus Warning: INTENT(INOUT) actual argument might interfere with actual argument anlauf at gmx dot de
  2008-12-11 16:08 ` [Bug fortran/38487] " burnus at gcc dot gnu dot org
@ 2008-12-11 22:27 ` anlauf at gmx dot de
  2008-12-13 14:30 ` mikael at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: anlauf at gmx dot de @ 2008-12-11 22:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from anlauf at gmx dot de  2008-12-11 22:25 -------
(In reply to comment #1)
> I think the warning is OK in the sense that the pointer could point to the same
> memory address which could potentially make trouble, but still the warning
> feels too strong.

I don't mind a warning which is emitted with -Wall, but
there is too much noise with standard compilation flags,
given that the trouble you mention is just potential, but
need not be real.

Note that with standard F95 one does not have allocatable
derived type components, so in the original code where the
example is derived from pointers are the only possibility.


-- 


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


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

* [Bug fortran/38487] Bogus Warning: INTENT(INOUT) actual argument might interfere with actual argument
  2008-12-11 15:39 [Bug fortran/38487] New: Bogus Warning: INTENT(INOUT) actual argument might interfere with actual argument anlauf at gmx dot de
  2008-12-11 16:08 ` [Bug fortran/38487] " burnus at gcc dot gnu dot org
  2008-12-11 22:27 ` anlauf at gmx dot de
@ 2008-12-13 14:30 ` mikael at gcc dot gnu dot org
  2008-12-15 18:11 ` mikael at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mikael at gcc dot gnu dot org @ 2008-12-13 14:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from mikael at gcc dot gnu dot org  2008-12-13 14:29 -------
Both the warning and the temporary creation depend on the same dependency
checking code. 
While it makes sense in the case of pointers to assume the worst (and create a
temporary, even if it's actually not needed), a warning should probably not be
emitted as it would point real problems in very few cases. 

About activating the warning with a flag (-Waliasing?), I would prefer to keep
the warning by default because it does quite a good job in non-pointer cases. 
But I don't feel very strong about it, as in my opinion, -Waliasing too should
be activated by default (are there too many false positive to do so?). 

Apart for cray pointers (see below), I don't think there are other cases where
the warning would be unwanted. 


Some random thoughts, more or less related:
- As far as I know, cray pointers are not supported by the dependency code.
- -Waliasing doesn't support elemental functions, and seems to catch full
arrays only: on elemental_dependency_1.f90, there is only one (false positive)
warning from -Waliasing. 


-- 

mikael at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-12-13 14:29:02
               date|                            |


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


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

* [Bug fortran/38487] Bogus Warning: INTENT(INOUT) actual argument might interfere with actual argument
  2008-12-11 15:39 [Bug fortran/38487] New: Bogus Warning: INTENT(INOUT) actual argument might interfere with actual argument anlauf at gmx dot de
                   ` (2 preceding siblings ...)
  2008-12-13 14:30 ` mikael at gcc dot gnu dot org
@ 2008-12-15 18:11 ` mikael at gcc dot gnu dot org
  2008-12-21 16:05 ` mikael at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mikael at gcc dot gnu dot org @ 2008-12-15 18:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from mikael at gcc dot gnu dot org  2008-12-15 18:10 -------
Subject: Bug 38487

Author: mikael
Date: Mon Dec 15 18:08:42 2008
New Revision: 142766

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=142766
Log:
2008-12-15  Mikael Morin  <mikael.morin@tele2.fr>

        PR fortran/38487
        * gfortran.dg/elemental_dependency_2.f90: New test.

2008-12-15  Mikael Morin  <mikael.morin@tele2.fr>

        PR fortran/38487
        * dependency.c (gfc_is_data_pointer): New function.
        (gfc_check_argument_var_dependency): Disable the warning
        in the pointer case.
        (gfc_check_dependency): Use gfc_is_data_pointer.


Added:
    trunk/gcc/testsuite/gfortran.dg/elemental_dependency_2.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/dependency.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/38487] Bogus Warning: INTENT(INOUT) actual argument might interfere with actual argument
  2008-12-11 15:39 [Bug fortran/38487] New: Bogus Warning: INTENT(INOUT) actual argument might interfere with actual argument anlauf at gmx dot de
                   ` (3 preceding siblings ...)
  2008-12-15 18:11 ` mikael at gcc dot gnu dot org
@ 2008-12-21 16:05 ` mikael at gcc dot gnu dot org
  2008-12-21 16:21 ` mikael at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mikael at gcc dot gnu dot org @ 2008-12-21 16:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from mikael at gcc dot gnu dot org  2008-12-21 16:04 -------
Subject: Bug 38487

Author: mikael
Date: Sun Dec 21 16:03:01 2008
New Revision: 142864

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=142864
Log:
2008-12-21  Mikael Morin  <mikael.morin@tele2.fr>

        PR fortran/38487
        * dependency.c (gfc_is_data_pointer): New function.
        (gfc_check_argument_var_dependency): Disable the warning
        in the pointer case.
        (gfc_check_dependency): Use gfc_is_data_pointer.

2008-12-21  Mikael Morin  <mikael.morin@tele2.fr>

        PR fortran/38487
        * gfortran.dg/elemental_dependency_2.f90: New test.


Added:
   
branches/gcc-4_3-branch/gcc/testsuite/gfortran.dg/elemental_dependency_2.f90
Modified:
    branches/gcc-4_3-branch/gcc/fortran/ChangeLog
    branches/gcc-4_3-branch/gcc/fortran/dependency.c
    branches/gcc-4_3-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/38487] Bogus Warning: INTENT(INOUT) actual argument might interfere with actual argument
  2008-12-11 15:39 [Bug fortran/38487] New: Bogus Warning: INTENT(INOUT) actual argument might interfere with actual argument anlauf at gmx dot de
                   ` (4 preceding siblings ...)
  2008-12-21 16:05 ` mikael at gcc dot gnu dot org
@ 2008-12-21 16:21 ` mikael at gcc dot gnu dot org
  2009-01-04 19:12 ` mikael at gcc dot gnu dot org
  2009-01-14 20:53 ` mikael at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: mikael at gcc dot gnu dot org @ 2008-12-21 16:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from mikael at gcc dot gnu dot org  2008-12-21 16:19 -------
Fixed on trunk(4.4) and 4.3.
Thanks for the report.


-- 

mikael at gcc dot gnu dot org changed:

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


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


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

* [Bug fortran/38487] Bogus Warning: INTENT(INOUT) actual argument might interfere with actual argument
  2008-12-11 15:39 [Bug fortran/38487] New: Bogus Warning: INTENT(INOUT) actual argument might interfere with actual argument anlauf at gmx dot de
                   ` (5 preceding siblings ...)
  2008-12-21 16:21 ` mikael at gcc dot gnu dot org
@ 2009-01-04 19:12 ` mikael at gcc dot gnu dot org
  2009-01-14 20:53 ` mikael at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: mikael at gcc dot gnu dot org @ 2009-01-04 19:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from mikael at gcc dot gnu dot org  2009-01-04 19:12 -------
Subject: Bug 38487

Author: mikael
Date: Sun Jan  4 19:12:16 2009
New Revision: 143057

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=143057
Log:
2009-01-04  Mikael Morin  <mikael.morin@tele2.fr>

        PR fortran/35681
        * ChangeLog-2008: Fix function name.

        PR fortran/38487
        * dependency.c (gfc_check_argument_var_dependency):
        Move the check for pointerness inside the if block
        so that it doesn't affect the return value.

        PR fortran/38669
        * trans-stmt.c (gfc_trans_call):
        Add the dependency code after the loop bounds calculation one.

2009-01-04  Mikael Morin  <mikael.morin@tele2.fr>

        PR fortran/38669
        * gfortran.dg/elemental_dependency_3.f90: New test.
        * gfortran.dg/elemental_subroutine_7.f90: New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/elemental_dependency_3.f90
    trunk/gcc/testsuite/gfortran.dg/elemental_subroutine_7.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/ChangeLog-2008
    trunk/gcc/fortran/dependency.c
    trunk/gcc/fortran/trans-stmt.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/38487] Bogus Warning: INTENT(INOUT) actual argument might interfere with actual argument
  2008-12-11 15:39 [Bug fortran/38487] New: Bogus Warning: INTENT(INOUT) actual argument might interfere with actual argument anlauf at gmx dot de
                   ` (6 preceding siblings ...)
  2009-01-04 19:12 ` mikael at gcc dot gnu dot org
@ 2009-01-14 20:53 ` mikael at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: mikael at gcc dot gnu dot org @ 2009-01-14 20:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from mikael at gcc dot gnu dot org  2009-01-14 20:53 -------
Subject: Bug 38487

Author: mikael
Date: Wed Jan 14 20:53:18 2009
New Revision: 143383

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=143383
Log:
2009-01-14  Mikael Morin  <mikael.morin@tele2.fr>

        PR fortran/35681
        * ChangeLog: Fix function name.

        PR fortran/38487
        * dependency.c (gfc_check_argument_var_dependency):
        Move the check for pointerness inside the if block
        so that it doesn't affect the return value.

        PR fortran/38669
        * trans-stmt.c (gfc_trans_call):
        Add the dependency code after the loop bounds calculation one.

2009-01-14  Mikael Morin  <mikael.morin@tele2.fr>

        PR fortran/38669
        * gfortran.dg/elemental_dependency_3.f90: New test.
        * gfortran.dg/elemental_subroutine_7.f90: New test.


Added:
   
branches/gcc-4_3-branch/gcc/testsuite/gfortran.dg/elemental_dependency_3.f90
   
branches/gcc-4_3-branch/gcc/testsuite/gfortran.dg/elemental_subroutine_7.f90
Modified:
    branches/gcc-4_3-branch/gcc/fortran/ChangeLog
    branches/gcc-4_3-branch/gcc/fortran/dependency.c
    branches/gcc-4_3-branch/gcc/fortran/trans-stmt.c
    branches/gcc-4_3-branch/gcc/testsuite/ChangeLog


-- 


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


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

end of thread, other threads:[~2009-01-14 20:53 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-11 15:39 [Bug fortran/38487] New: Bogus Warning: INTENT(INOUT) actual argument might interfere with actual argument anlauf at gmx dot de
2008-12-11 16:08 ` [Bug fortran/38487] " burnus at gcc dot gnu dot org
2008-12-11 22:27 ` anlauf at gmx dot de
2008-12-13 14:30 ` mikael at gcc dot gnu dot org
2008-12-15 18:11 ` mikael at gcc dot gnu dot org
2008-12-21 16:05 ` mikael at gcc dot gnu dot org
2008-12-21 16:21 ` mikael at gcc dot gnu dot org
2009-01-04 19:12 ` mikael at gcc dot gnu dot org
2009-01-14 20:53 ` mikael 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).