This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/57991] New: Enhance "Same actual argument associated" warning (-Waliasing)
- From: "burnus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 26 Jul 2013 10:01:56 +0000
- Subject: [Bug fortran/57991] New: Enhance "Same actual argument associated" warning (-Waliasing)
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57991
Bug ID: 57991
Summary: Enhance "Same actual argument associated" warning
(-Waliasing)
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: burnus at gcc dot gnu.org
gfortran currently warns with -Waliasing for the case:
Warning: Same actual argument associated with INTENT(IN) argument 'a'
and INTENT(OUT) argument 'b' at (1)
However, I believe gfortran should also warn if both are INTENT(OUT) -
currently, it doesn't:
Program q1
Call test(x, x)
Contains
Subroutine test(a,b)
Integer, intent(out) :: a,b
a = a*10
Print *,a,b
End Subroutine
End Program
Side remark: The test case is also invalid for other reasons; it's a modified
version of
https://groups.google.com/forum/#!topic/comp.lang.fortran/1ZVmajE1Mjs
See "check_some_aliasing":
if ((f1_intent == INTENT_IN && f2_intent == INTENT_OUT)
|| (f1_intent == INTENT_OUT && f2_intent == INTENT_IN))
From F2008's "12.5.2.13 Restrictions on entities associated with dummy
arguments"
"(3) Action that aects the value of the entity or any subobject of it shall be
taken only through the dummy argument unless
(a) the dummy argument has the POINTER attribute or
(b) the dummy argument has the TARGET attribute, the dummy argument does not
have INTENT(IN), the dummy argument is a scalar object or an assumed-shape
array without the CONTIGUOUS attribute, and the actual argument is a target
other than an array section with a vector subscript."