public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/33850]  New: Unneeded temporary generated for LHS index of array assignment
@ 2007-10-21 12:38 burnus at gcc dot gnu dot org
  2007-10-21 12:40 ` [Bug fortran/33850] " burnus at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-10-21 12:38 UTC (permalink / raw)
  To: gcc-bugs

For
   integer(4) :: p(4) = (/2,4,1,3/)
   integer(4) :: q(4) = (/2,4,1,3/)
   p(q) = (/(i, i = 1, 4)/)

gfortran generates an unneeded temporary, which is only needed for
   integer(4) :: p(4) = (/2,4,1,3/)
   p(p) = (/(i, i = 1, 4)/)

Cf. PR 33749


-- 
           Summary: Unneeded temporary generated for LHS index of array
                    assignment
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          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=33850


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

* [Bug fortran/33850] Unneeded temporary generated for LHS index of array assignment
  2007-10-21 12:38 [Bug fortran/33850] New: Unneeded temporary generated for LHS index of array assignment burnus at gcc dot gnu dot org
@ 2007-10-21 12:40 ` burnus at gcc dot gnu dot org
  2007-10-23 15:34 ` pault at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-10-21 12:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2007-10-21 12:40 -------
See also http://gcc.gnu.org/ml/fortran/2007-10/msg00298.html


-- 


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


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

* [Bug fortran/33850] Unneeded temporary generated for LHS index of array assignment
  2007-10-21 12:38 [Bug fortran/33850] New: Unneeded temporary generated for LHS index of array assignment burnus at gcc dot gnu dot org
  2007-10-21 12:40 ` [Bug fortran/33850] " burnus at gcc dot gnu dot org
@ 2007-10-23 15:34 ` pault at gcc dot gnu dot org
  2007-11-27 20:48 ` pault at gcc dot gnu dot org
  2007-11-27 20:54 ` pault at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-10-23 15:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pault at gcc dot gnu dot org  2007-10-23 15:34 -------
As the cause of this, I had better confirm it at least!

I am working on the problems with the FORALL patch and have seen a way to fix
this problem at the same time.  It'll be at least a few days yet, so watch this
space.

Cheers

Paul


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pault at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-10-23 15:34:00
               date|                            |


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


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

* [Bug fortran/33850] Unneeded temporary generated for LHS index of array assignment
  2007-10-21 12:38 [Bug fortran/33850] New: Unneeded temporary generated for LHS index of array assignment burnus at gcc dot gnu dot org
  2007-10-21 12:40 ` [Bug fortran/33850] " burnus at gcc dot gnu dot org
  2007-10-23 15:34 ` pault at gcc dot gnu dot org
@ 2007-11-27 20:48 ` pault at gcc dot gnu dot org
  2007-11-27 20:54 ` pault at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-11-27 20:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pault at gcc dot gnu dot org  2007-11-27 20:48 -------
Subject: Bug 33850

Author: pault
Date: Tue Nov 27 20:47:55 2007
New Revision: 130472

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=130472
Log:
2007-11-27  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/29389
        *resolve.c (resolve_ordinary_assign): Use find_sym_in_expr to
        test if a temporary should be written for a vector subscript
        on the lhs.

        PR fortran/33850
        * restore.c (pure_stmt_function): Add prototype and new
        function. Calls impure_stmt_fcn.
        (pure_function): Call it.
        (impure_stmt_fcn): New function.

        * expr.c (gfc_traverse_expr): Call *func for all expression
        types, not just variables. Add traversal of character lengths,
        iterators and component character lengths and arrayspecs.
        (expr_set_symbols_referenced): Return false if not a variable.
        * trans-stmt.c (forall_replace, forall_restore): Ditto.
        * resolve.c (forall_index): Ditto.
        (sym_in_expr): New function.
        (find_sym_in_expr): Rewrite to traverse expression calling
        sym_in_expr.
        *trans-decl.c (expr_decls): New function.
        (generate_expr_decls): Rewrite to traverse expression calling
        expr_decls.
        *match.c (check_stmt_fcn): New function.
        (recursive_stmt_fcn): Rewrite to traverse expression calling
        check_stmt_fcn.

2007-11-27  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/29389
        * gfortran.dg/stfunc_6.f90: New test.

        PR fortran/33850
        * gfortran.dg/assign_10.f90: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/assign_10.f90
    trunk/gcc/testsuite/gfortran.dg/stfunc_6.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/expr.c
    trunk/gcc/fortran/match.c
    trunk/gcc/fortran/resolve.c
    trunk/gcc/fortran/trans-decl.c
    trunk/gcc/fortran/trans-stmt.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/33850] Unneeded temporary generated for LHS index of array assignment
  2007-10-21 12:38 [Bug fortran/33850] New: Unneeded temporary generated for LHS index of array assignment burnus at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2007-11-27 20:48 ` pault at gcc dot gnu dot org
@ 2007-11-27 20:54 ` pault at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-11-27 20:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pault at gcc dot gnu dot org  2007-11-27 20:54 -------
Fixed on trunk.

Paul

PS Note the need to get the kind right for the index vector in order to
eliminate the temporary.


-- 

pault at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2007-11-27 20:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-21 12:38 [Bug fortran/33850] New: Unneeded temporary generated for LHS index of array assignment burnus at gcc dot gnu dot org
2007-10-21 12:40 ` [Bug fortran/33850] " burnus at gcc dot gnu dot org
2007-10-23 15:34 ` pault at gcc dot gnu dot org
2007-11-27 20:48 ` pault at gcc dot gnu dot org
2007-11-27 20:54 ` pault 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).