public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/30374] New: aliasing amoung dummy arguments: possibly missing optimization
@ 2007-01-04 21:29 burnus at gcc dot gnu dot org
2007-01-04 22:29 ` [Bug fortran/30374] " pinskia 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-01-04 21:29 UTC (permalink / raw)
To: gcc-bugs
The following program is (more or less) well-defined for the human reader, but
non-standard Fortran (which cannot be easily detected at compile time, cf. PR
30373).
gfortran outputs:
1 1 1
while ifort, NAG f95 and sunf95 output the expected:
4 5 6
program test
implicit none
integer, dimension(3,3) :: n
n(:,1)=(/1,2,3/)
n(:,2)=(/1,2,3/)
n(:,3)=(/1,2,3/)
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(in) :: b
a=(/4,5,6/)
end subroutine
end program test
Expected:
- Give same result as the other compilers ?
- Check, whether one could do some code-generation improvements; Richard Main
wrote:
"in this particular case, there is are simple optimizations that would avoid
problems. Some compilers might do variants of those optimizations. In
particular, passing a non-contiguous array slice (such as a row) here is likely
to cause copy-in/copy-out. Such copy-in/copy-out is one of the things that
the standard is explicitly written to allow; it is also sometimes the source of
behavior that can be surprising. (Or conversely, in other situations, the lack
of copy-in/copy-out can result in behavior that might seem surprising to some.)
"I suspect that some compilers avoid the copy out here, possibly because of the
intent(in), or possibly because of b being unused (in which case, even the copy
in could be avoided). It seems an obvious enough optimization provided that the
compiler has the right information at the right time to do it. However, the
standard does *NOT* require this optimization. Failure to do the optimization
does not constitute a compiler bug in terms of implementing the standard
(though it might indicate that the compiler has room to improve its
optimization)."
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/2b4df0a44e704b7f/70c44bc5ea8cafb0
--
Summary: aliasing amoung dummy arguments: possibly missing
optimization
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
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=30374
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/30374] aliasing amoung dummy arguments: possibly missing optimization
2007-01-04 21:29 [Bug fortran/30374] New: aliasing amoung dummy arguments: possibly missing optimization burnus at gcc dot gnu dot org
@ 2007-01-04 22:29 ` pinskia at gcc dot gnu dot org
2007-01-05 9:31 ` pault at gcc dot gnu dot org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-01-04 22:29 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2007-01-04 22:29 -------
What GCC is doing is calling _gfortran_internal_pack/_gfortran_internal_unpack
in a different order than most other compilers.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30374
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/30374] aliasing amoung dummy arguments: possibly missing optimization
2007-01-04 21:29 [Bug fortran/30374] New: aliasing amoung dummy arguments: possibly missing optimization burnus at gcc dot gnu dot org
2007-01-04 22:29 ` [Bug fortran/30374] " pinskia at gcc dot gnu dot org
@ 2007-01-05 9:31 ` pault at gcc dot gnu dot org
2007-10-26 7:25 ` jv244 at cam dot ac dot uk
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-01-05 9:31 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pault at gcc dot gnu dot org 2007-01-05 09:30 -------
(In reply to comment #1)
> What GCC is doing is calling _gfortran_internal_pack/_gfortran_internal_unpack
> in a different order than most other compilers.
It should not call _gfortran_internal_unpack at all for the intent in variable
- this is the missed optimisation to which Richard was referring. I am
regetesting a patch with the patches for PR23232, PR27996 and PR27998.
Paul
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30374
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/30374] aliasing amoung dummy arguments: possibly missing optimization
2007-01-04 21:29 [Bug fortran/30374] New: aliasing amoung dummy arguments: possibly missing optimization burnus at gcc dot gnu dot org
2007-01-04 22:29 ` [Bug fortran/30374] " pinskia at gcc dot gnu dot org
2007-01-05 9:31 ` pault at gcc dot gnu dot org
@ 2007-10-26 7:25 ` jv244 at cam dot ac dot uk
2009-05-21 8:35 ` [Bug fortran/30374] unpacking intent(IN) arguments jv244 at cam dot ac dot uk
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: jv244 at cam dot ac dot uk @ 2007-10-26 7:25 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from jv244 at cam dot ac dot uk 2007-10-26 07:25 -------
paul, the patch you have been regtesting (9 months ;-) seems not yet in. I've
marked this as a missed-optimization.
--
jv244 at cam dot ac dot uk changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pault at gcc dot gnu dot org
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Keywords| |missed-optimization
Last reconfirmed|0000-00-00 00:00:00 |2007-10-26 07:25:36
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30374
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/30374] unpacking intent(IN) arguments
2007-01-04 21:29 [Bug fortran/30374] New: aliasing amoung dummy arguments: possibly missing optimization burnus at gcc dot gnu dot org
` (2 preceding siblings ...)
2007-10-26 7:25 ` jv244 at cam dot ac dot uk
@ 2009-05-21 8:35 ` jv244 at cam dot ac dot uk
2009-05-21 8:40 ` jv244 at cam dot ac dot uk
2009-05-21 8:45 ` jv244 at cam dot ac dot uk
5 siblings, 0 replies; 7+ messages in thread
From: jv244 at cam dot ac dot uk @ 2009-05-21 8:35 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from jv244 at cam dot ac dot uk 2009-05-21 08:34 -------
Paul, 2 years ago you had a (one liner?) patch for this one, but gfortran still
seem to unpack for intent(IN) data:
MODULE M1
CONTAINS
SUBROUTINE S1(I)
INTEGER, DIMENSION(3), INTENT(IN) :: I
END SUBROUTINE
END MODULE
USE M1
INTEGER, TARGET, DIMENSION(9) :: I
INTEGER, DIMENSION(:), POINTER :: IP
IP=>I(1:9:3)
CALL S1(IP)
END
--
jv244 at cam dot ac dot uk changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to fail| |4.5.0
Last reconfirmed|2007-10-26 07:25:36 |2009-05-21 08:34:53
date| |
Summary|aliasing amoung dummy |unpacking intent(IN)
|arguments: possibly missing |arguments
|optimization |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30374
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/30374] unpacking intent(IN) arguments
2007-01-04 21:29 [Bug fortran/30374] New: aliasing amoung dummy arguments: possibly missing optimization burnus at gcc dot gnu dot org
` (3 preceding siblings ...)
2009-05-21 8:35 ` [Bug fortran/30374] unpacking intent(IN) arguments jv244 at cam dot ac dot uk
@ 2009-05-21 8:40 ` jv244 at cam dot ac dot uk
2009-05-21 8:45 ` jv244 at cam dot ac dot uk
5 siblings, 0 replies; 7+ messages in thread
From: jv244 at cam dot ac dot uk @ 2009-05-21 8:40 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from jv244 at cam dot ac dot uk 2009-05-21 08:40 -------
(In reply to comment #4)
> Paul, 2 years ago you had a (one liner?) patch for this one, but gfortran still
> seem to unpack for intent(IN) data:
ugh... no. I tested with 4.3 instead of 4.5. Instead we can close this, as this
seems solved.
--
jv244 at cam dot ac dot uk changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to fail|4.5.0 |
Known to work| |4.5.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30374
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/30374] unpacking intent(IN) arguments
2007-01-04 21:29 [Bug fortran/30374] New: aliasing amoung dummy arguments: possibly missing optimization burnus at gcc dot gnu dot org
` (4 preceding siblings ...)
2009-05-21 8:40 ` jv244 at cam dot ac dot uk
@ 2009-05-21 8:45 ` jv244 at cam dot ac dot uk
5 siblings, 0 replies; 7+ messages in thread
From: jv244 at cam dot ac dot uk @ 2009-05-21 8:45 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from jv244 at cam dot ac dot uk 2009-05-21 08:45 -------
fixed
--
jv244 at cam dot ac dot uk changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30374
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-05-21 8:45 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-04 21:29 [Bug fortran/30374] New: aliasing amoung dummy arguments: possibly missing optimization burnus at gcc dot gnu dot org
2007-01-04 22:29 ` [Bug fortran/30374] " pinskia at gcc dot gnu dot org
2007-01-05 9:31 ` pault at gcc dot gnu dot org
2007-10-26 7:25 ` jv244 at cam dot ac dot uk
2009-05-21 8:35 ` [Bug fortran/30374] unpacking intent(IN) arguments jv244 at cam dot ac dot uk
2009-05-21 8:40 ` jv244 at cam dot ac dot uk
2009-05-21 8:45 ` jv244 at cam dot ac dot uk
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).