public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/30373] New: Option for run-time checking for aliasing amoung dummy arguments
@ 2007-01-04 21:14 burnus at gcc dot gnu dot org
2007-01-07 22:33 ` [Bug fortran/30373] " tkoenig at gcc dot gnu dot org
0 siblings, 1 reply; 2+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-01-04 21:14 UTC (permalink / raw)
To: gcc-bugs
Some compilers (such as Pathscale, cf.
http://www.pathscale.com/docs/UserGuide.pdf, section 3.10.2) have an option to
check at run-time for aliasing among Fortran dummy arguments.
(This option "has several friends, and when a customer sees a wrong answer, the
first thing we do (or the customer does, if they've read the docs) is compile
with all of these options, which will quickly lead them to the type of bug.",
Greg Lindahl in c.l.f)
The following examples are invalid (and ill-defined too). Richard Main writes
in c.l.f (link below):
"The code is nonstandard. Some people overstate the restriction in question by
saying that aliasing is disallowed. Aliasing is allowed, but there are
restrictions on it. One of those restrictions is that you may not modify the
value of either of the aliased variables. Thus there is no correct answer and
the compilers are free to do anything they want with it. This is not an error
that compilers are required to catch."
Example 1 (based on the example in the Pathscale manual):
program bar
implicit none
real c(100)
c = 5
call foo(c,c)
print *,c(1:5)
contains
subroutine foo(a,b)
integer i
real a(100), b(100)
do i = 2, 100
a(i) = b(i) - b(i-1)
enddo
end subroutine foo
end program bar
Example 2, based on the first post in
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/2b4df0a44e704b7f/70c44bc5ea8cafb0
program test
implicit none
integer, dimension(3,3) :: n
call sub(n(1,:),n(1,:))
write(6,*) n(1,:)
contains
subroutine sub(a,b)
implicit none
integer, dimension(3), intent(inout) :: a
integer, dimension(3), intent(inout) :: b
a=(/4,5,6/)
b=(/-4,-5,-6/)
end subroutine
end program test
--
Summary: Option for run-time checking for aliasing amoung dummy
arguments
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: enhancement
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=30373
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug fortran/30373] Option for run-time checking for aliasing amoung dummy arguments
2007-01-04 21:14 [Bug fortran/30373] New: Option for run-time checking for aliasing amoung dummy arguments burnus at gcc dot gnu dot org
@ 2007-01-07 22:33 ` tkoenig at gcc dot gnu dot org
0 siblings, 0 replies; 2+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2007-01-07 22:33 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from tkoenig at gcc dot gnu dot org 2007-01-07 22:33 -------
This would definitely be useful.
Confirmed.
--
tkoenig 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 |2007-01-07 22:33:23
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30373
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-01-07 22:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-04 21:14 [Bug fortran/30373] New: Option for run-time checking for aliasing amoung dummy arguments burnus at gcc dot gnu dot org
2007-01-07 22:33 ` [Bug fortran/30373] " tkoenig 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).