public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/38112]  New: unneeded temporary
@ 2008-11-14  8:48 jv244 at cam dot ac dot uk
  2008-11-14  8:52 ` [Bug fortran/38112] " jv244 at cam dot ac dot uk
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: jv244 at cam dot ac dot uk @ 2008-11-14  8:48 UTC (permalink / raw)
  To: gcc-bugs

since b is an allocatable without the target attribute, there is no way it can
'alias' a. No need for a temp thus

SUBROUTINE S(a)
INTEGER, POINTER, DIMENSION(:) :: a
INTEGER, DIMENSION(:), ALLOCATABLE :: b
ALLOCATE(b(10))
b(a)=1
END SUBROUTINE S

gfortran -c -Warray-temporaries test.f90
test.f90:5.2:

b(a)=1
 1
Warning: Creating array temporary at (1)


-- 
           Summary: unneeded temporary
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jv244 at cam dot ac dot uk
OtherBugsDependingO 36854
             nThis:


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


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

* [Bug fortran/38112] unneeded temporary
  2008-11-14  8:48 [Bug fortran/38112] New: unneeded temporary jv244 at cam dot ac dot uk
@ 2008-11-14  8:52 ` jv244 at cam dot ac dot uk
  2008-11-18 20:02 ` pault at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jv244 at cam dot ac dot uk @ 2008-11-14  8:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jv244 at cam dot ac dot uk  2008-11-14 08:50 -------
that might be an even simpler case:

SUBROUTINE S(a,i,j)
INTEGER, POINTER, DIMENSION(:) :: a
INTEGER, DIMENSION(:), ALLOCATABLE :: b
INTEGER :: i,j
ALLOCATE(b(10))
b(i:j)=a(i:j)
END SUBROUTINE S


-- 


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


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

* [Bug fortran/38112] unneeded temporary
  2008-11-14  8:48 [Bug fortran/38112] New: unneeded temporary jv244 at cam dot ac dot uk
  2008-11-14  8:52 ` [Bug fortran/38112] " jv244 at cam dot ac dot uk
@ 2008-11-18 20:02 ` pault at gcc dot gnu dot org
  2010-02-22  5:49 ` pault at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pault at gcc dot gnu dot org @ 2008-11-18 20:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pault at gcc dot gnu dot org  2008-11-18 20:00 -------
Nice catch!

Thanks

Paul


-- 

pault 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-11-18 20:00:54
               date|                            |


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


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

* [Bug fortran/38112] unneeded temporary
  2008-11-14  8:48 [Bug fortran/38112] New: unneeded temporary jv244 at cam dot ac dot uk
  2008-11-14  8:52 ` [Bug fortran/38112] " jv244 at cam dot ac dot uk
  2008-11-18 20:02 ` pault at gcc dot gnu dot org
@ 2010-02-22  5:49 ` pault at gcc dot gnu dot org
  2010-02-22  8:58 ` burnus at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pault at gcc dot gnu dot org @ 2010-02-22  5:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pault at gcc dot gnu dot org  2010-02-22 05:48 -------
Fixed on trunk.  Thanks for reportimg the problem, Joost.

Paul


-- 

pault at gcc dot gnu dot org changed:

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


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


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

* [Bug fortran/38112] unneeded temporary
  2008-11-14  8:48 [Bug fortran/38112] New: unneeded temporary jv244 at cam dot ac dot uk
                   ` (2 preceding siblings ...)
  2010-02-22  5:49 ` pault at gcc dot gnu dot org
@ 2010-02-22  8:58 ` burnus at gcc dot gnu dot org
  2010-02-22  9:06 ` paul dot richard dot thomas at gmail dot com
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-02-22  8:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from burnus at gcc dot gnu dot org  2010-02-22 08:58 -------
Paul, for the test case in comment 0 we still create a temporary:

  b(a)=1

where "a" is a simple-contiguous rank-one array without target/pointer
attribute, which thus cannot alias with "b". Do you think this is fixable?


-- 

burnus at gcc dot gnu dot org changed:

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


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


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

* [Bug fortran/38112] unneeded temporary
  2008-11-14  8:48 [Bug fortran/38112] New: unneeded temporary jv244 at cam dot ac dot uk
                   ` (3 preceding siblings ...)
  2010-02-22  8:58 ` burnus at gcc dot gnu dot org
@ 2010-02-22  9:06 ` paul dot richard dot thomas at gmail dot com
  2010-02-23  8:45 ` burnus at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: paul dot richard dot thomas at gmail dot com @ 2010-02-22  9:06 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1149 bytes --]



------- Comment #5 from paul dot richard dot thomas at gmail dot com  2010-02-22 09:06 -------
Subject: Re:  unneeded temporary

Tobias,

I'll take a look tonight.

Cheers

Paul

On Mon, Feb 22, 2010 at 9:58 AM, burnus at gcc dot gnu dot org
<gcc-bugzilla@gcc.gnu.org> wrote:
>
>
> ------- Comment #4 from burnus at gcc dot gnu dot org  2010-02-22 08:58 -------
> Paul, for the test case in comment 0 we still create a temporary:
>
>  b(a)=1
>
> where "a" is a simple-contiguous rank-one array without target/pointer
> attribute, which thus cannot alias with "b". Do you think this is fixable?
>
>
> --
>
> burnus at gcc dot gnu dot org changed:
>
>           What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                 CC|                            |pault at gcc dot gnu dot org
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38112
>
> ------- You are receiving this mail because: -------
> You are on the CC list for the bug, or are watching someone who is.
>


-- 


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


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

* [Bug fortran/38112] unneeded temporary
  2008-11-14  8:48 [Bug fortran/38112] New: unneeded temporary jv244 at cam dot ac dot uk
                   ` (4 preceding siblings ...)
  2010-02-22  9:06 ` paul dot richard dot thomas at gmail dot com
@ 2010-02-23  8:45 ` burnus at gcc dot gnu dot org
  2010-02-24  6:46 ` pault at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-02-23  8:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from burnus at gcc dot gnu dot org  2010-02-23 08:45 -------
Just to make sure it won't get forgotten: REOPEN.

(In reply to comment #4)
> Paul, for the test case in comment 0 we still create a temporary:
> 
>   b(a)=1
> 
> where "a" is a simple-contiguous rank-one array without target/pointer
> attribute, which thus cannot alias with "b". Do you think this is fixable?

(In reply to comment #5)
> I'll take a look tonight.


-- 

burnus at gcc dot gnu dot org changed:

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


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


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

* [Bug fortran/38112] unneeded temporary
  2008-11-14  8:48 [Bug fortran/38112] New: unneeded temporary jv244 at cam dot ac dot uk
                   ` (5 preceding siblings ...)
  2010-02-23  8:45 ` burnus at gcc dot gnu dot org
@ 2010-02-24  6:46 ` pault at gcc dot gnu dot org
  2010-05-09 20:51 ` dfranke at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pault at gcc dot gnu dot org @ 2010-02-24  6:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pault at gcc dot gnu dot org  2010-02-24 06:46 -------
(In reply to comment #6)
> Just to make sure it won't get forgotten: REOPEN.
> 
> (In reply to comment #4)
> > Paul, for the test case in comment 0 we still create a temporary:
> > 
> >   b(a)=1
> > 

Tobias,

Not if 'a' has the right KIND.  Try

SUBROUTINE S(a, b)
INTEGER(8), POINTER, DIMENSION(:) :: a
INTEGER, DIMENSION(:) :: b
b(a)=1
END SUBROUTINE S

See trans-array.c:5099 - that's where the temporary is generated, when a is
default kind.

This could be fixed but, right now, I am not sure how :-(

Paul


-- 


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


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

* [Bug fortran/38112] unneeded temporary
  2008-11-14  8:48 [Bug fortran/38112] New: unneeded temporary jv244 at cam dot ac dot uk
                   ` (6 preceding siblings ...)
  2010-02-24  6:46 ` pault at gcc dot gnu dot org
@ 2010-05-09 20:51 ` dfranke at gcc dot gnu dot org
  2010-05-25 20:52 ` mikael at gcc dot gnu dot org
  2010-05-25 20:57 ` paul dot richard dot thomas at gmail dot com
  9 siblings, 0 replies; 11+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2010-05-09 20:51 UTC (permalink / raw)
  To: gcc-bugs



-- 

dfranke at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
   Last reconfirmed|2008-11-18 20:00:54         |2010-05-09 20:51:13
               date|                            |


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


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

* [Bug fortran/38112] unneeded temporary
  2008-11-14  8:48 [Bug fortran/38112] New: unneeded temporary jv244 at cam dot ac dot uk
                   ` (7 preceding siblings ...)
  2010-05-09 20:51 ` dfranke at gcc dot gnu dot org
@ 2010-05-25 20:52 ` mikael at gcc dot gnu dot org
  2010-05-25 20:57 ` paul dot richard dot thomas at gmail dot com
  9 siblings, 0 replies; 11+ messages in thread
From: mikael at gcc dot gnu dot org @ 2010-05-25 20:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from mikael at gcc dot gnu dot org  2010-05-25 20:52 -------
(In reply to comment #7)
> This could be fixed but, right now, I am not sure how :-(

It seems to be fixed now.
probably http://gcc.gnu.org/viewcvs?view=revision&revision=158632


-- 

mikael at gcc dot gnu dot org changed:

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


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


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

* [Bug fortran/38112] unneeded temporary
  2008-11-14  8:48 [Bug fortran/38112] New: unneeded temporary jv244 at cam dot ac dot uk
                   ` (8 preceding siblings ...)
  2010-05-25 20:52 ` mikael at gcc dot gnu dot org
@ 2010-05-25 20:57 ` paul dot richard dot thomas at gmail dot com
  9 siblings, 0 replies; 11+ messages in thread
From: paul dot richard dot thomas at gmail dot com @ 2010-05-25 20:57 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1197 bytes --]



------- Comment #9 from paul dot richard dot thomas at gmail dot com  2010-05-25 20:57 -------
Subject: Re:  unneeded temporary

Mikael,

Yes, I am sure that you are right about the <<un-culprit>>.

Let's close it :-)

Paul

On Tue, May 25, 2010 at 10:52 PM, mikael at gcc dot gnu dot org
<gcc-bugzilla@gcc.gnu.org> wrote:
>
>
> ------- Comment #8 from mikael at gcc dot gnu dot org  2010-05-25 20:52 -------
> (In reply to comment #7)
>> This could be fixed but, right now, I am not sure how :-(
>
> It seems to be fixed now.
> probably http://gcc.gnu.org/viewcvs?view=revision&revision=158632
>
>
> --
>
> mikael at gcc dot gnu dot org changed:
>
>           What    |Removed                     |Added
> ----------------------------------------------------------------------------
>             Status|REOPENED                    |RESOLVED
>         Resolution|                            |FIXED
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38112
>
> ------- You are receiving this mail because: -------
> You are on the CC list for the bug, or are watching someone who is.
>


-- 


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


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

end of thread, other threads:[~2010-05-25 20:57 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-14  8:48 [Bug fortran/38112] New: unneeded temporary jv244 at cam dot ac dot uk
2008-11-14  8:52 ` [Bug fortran/38112] " jv244 at cam dot ac dot uk
2008-11-18 20:02 ` pault at gcc dot gnu dot org
2010-02-22  5:49 ` pault at gcc dot gnu dot org
2010-02-22  8:58 ` burnus at gcc dot gnu dot org
2010-02-22  9:06 ` paul dot richard dot thomas at gmail dot com
2010-02-23  8:45 ` burnus at gcc dot gnu dot org
2010-02-24  6:46 ` pault at gcc dot gnu dot org
2010-05-09 20:51 ` dfranke at gcc dot gnu dot org
2010-05-25 20:52 ` mikael at gcc dot gnu dot org
2010-05-25 20:57 ` paul dot richard dot thomas at gmail dot com

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).