public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/56867] New: Missing temporary with string array assignment
@ 2013-04-07 18:12 tkoenig at gcc dot gnu.org
  2013-04-07 20:11 ` [Bug fortran/56867] " tkoenig at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2013-04-07 18:12 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 56867
           Summary: Missing temporary with string array assignment
    Classification: Unclassified
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: tkoenig@gcc.gnu.org


And I thought we were done with missing temporaries...

ig25@linux-fd1f:~/Krempel/Dep-12> gfortran bar.f90
ig25@linux-fd1f:~/Krempel/Dep-12> ./a.out
23cd
2334
33yz
ig25@linux-fd1f:~/Krempel/Dep-12> gfortran-4.6 bar.f90
ig25@linux-fd1f:~/Krempel/Dep-12> ./a.out
23cd
2334
33yz
ig25@linux-fd1f:~/Krempel/Dep-12> gfortran-4.7 bar.f90
ig25@linux-fd1f:~/Krempel/Dep-12> ./a.out
23cd
2334
33yz

Of course, the last line of output should be

23yz.


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

* [Bug fortran/56867] Missing temporary with string array assignment
  2013-04-07 18:12 [Bug fortran/56867] New: Missing temporary with string array assignment tkoenig at gcc dot gnu.org
@ 2013-04-07 20:11 ` tkoenig at gcc dot gnu.org
  2013-04-07 20:15 ` burnus at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2013-04-07 20:11 UTC (permalink / raw)
  To: gcc-bugs


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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-04-07
             Blocks|                            |32834
     Ever Confirmed|0                           |1

--- Comment #1 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2013-04-07 20:10:58 UTC ---
Wrong code for straight F95 code.


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

* [Bug fortran/56867] Missing temporary with string array assignment
  2013-04-07 18:12 [Bug fortran/56867] New: Missing temporary with string array assignment tkoenig at gcc dot gnu.org
  2013-04-07 20:11 ` [Bug fortran/56867] " tkoenig at gcc dot gnu.org
@ 2013-04-07 20:15 ` burnus at gcc dot gnu.org
  2013-04-07 20:19 ` tkoenig at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-04-07 20:15 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-04-07 20:15:06 UTC ---
Can you attach the test case?


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

* [Bug fortran/56867] Missing temporary with string array assignment
  2013-04-07 18:12 [Bug fortran/56867] New: Missing temporary with string array assignment tkoenig at gcc dot gnu.org
  2013-04-07 20:11 ` [Bug fortran/56867] " tkoenig at gcc dot gnu.org
  2013-04-07 20:15 ` burnus at gcc dot gnu.org
@ 2013-04-07 20:19 ` tkoenig at gcc dot gnu.org
  2013-04-07 20:39 ` dominiq at lps dot ens.fr
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2013-04-07 20:19 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #3 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2013-04-07 20:19:53 UTC ---
Oops, here it is:

program main
  character(len=4) :: a
  character(len=4) :: c(3)
  c(1) = 'abcd'
  c(2) = '1234'
  c(3) = 'wxyz'
  c(:)(1:2) = c(2)(2:3)
  print '(A)',c
end program main


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

* [Bug fortran/56867] Missing temporary with string array assignment
  2013-04-07 18:12 [Bug fortran/56867] New: Missing temporary with string array assignment tkoenig at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2013-04-07 20:19 ` tkoenig at gcc dot gnu.org
@ 2013-04-07 20:39 ` dominiq at lps dot ens.fr
  2013-04-08 12:17 ` burnus at gcc dot gnu.org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: dominiq at lps dot ens.fr @ 2013-04-07 20:39 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #4 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2013-04-07 20:39:43 UTC ---
The temporary is missing as far as 4.3.1.


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

* [Bug fortran/56867] Missing temporary with string array assignment
  2013-04-07 18:12 [Bug fortran/56867] New: Missing temporary with string array assignment tkoenig at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2013-04-07 20:39 ` dominiq at lps dot ens.fr
@ 2013-04-08 12:17 ` burnus at gcc dot gnu.org
  2013-04-08 20:24 ` tkoenig at gcc dot gnu.org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-04-08 12:17 UTC (permalink / raw)
  To: gcc-bugs


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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #5 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-04-08 12:17:16 UTC ---
gfortran seems to be in good company. I get
  23cd
  2334
  33yz   <<<
using gfortran 4.1, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8, 4.9. But also using NAG,
pathf95 and pgf95.

While g95, sunf95, crayftn and ifort have the correct result:
  23cd
  2334
  23yz   <<<

The issue (or at least the fix) could be related to PR47674, where also no
temporary is generated for a substring. (That code could be handled without
temporary, but using a temporary is probably the simplest. In any case, alias
analysis fails as well.)


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

* [Bug fortran/56867] Missing temporary with string array assignment
  2013-04-07 18:12 [Bug fortran/56867] New: Missing temporary with string array assignment tkoenig at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2013-04-08 12:17 ` burnus at gcc dot gnu.org
@ 2013-04-08 20:24 ` tkoenig at gcc dot gnu.org
  2014-12-28 12:03 ` tkoenig at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2013-04-08 20:24 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #6 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2013-04-08 20:23:59 UTC ---
I stumbled across this while looking at PR 30398,
when I wanted to add some dependency checking to
make call memcpy instead of memmove if there was
no dependency.

Look for an optimization, find a bug...

I have been working on the idea to add an argument to
gfc_trans_scalar_assign (which does not know about
the gfc_expr*s any more) which indicates if there coul
be a dependency, which could be checked via gfc_check_dependency
and then passed to gfc_trans_string_copy.

This kind of analysis could also be used in PR 56594
to create a temporary.


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

* [Bug fortran/56867] Missing temporary with string array assignment
  2013-04-07 18:12 [Bug fortran/56867] New: Missing temporary with string array assignment tkoenig at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2013-04-08 20:24 ` tkoenig at gcc dot gnu.org
@ 2014-12-28 12:03 ` tkoenig at gcc dot gnu.org
  2014-12-28 12:36 ` tkoenig at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2014-12-28 12:03 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56867

--- Comment #7 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Author: tkoenig
Date: Sun Dec 28 12:03:02 2014
New Revision: 219089

URL: https://gcc.gnu.org/viewcvs?rev=219089&root=gcc&view=rev
Log:
2014-12-28  Thomas Koenig  <tkoenig@gcc.gnu.org>

    PR fortran/56867
    * trans-array.c (gfc_conv_resolve_dependencies):  Also check
    dependencies when there may be substrings of character arrays.

2014-12-28  Thomas Koenig  <tkoenig@gcc.gnu.org>

    PR fortran/56867
    * gfortran.dg/dependency_45.f90:  New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/dependency_45.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-array.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug fortran/56867] Missing temporary with string array assignment
  2013-04-07 18:12 [Bug fortran/56867] New: Missing temporary with string array assignment tkoenig at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2014-12-28 12:03 ` tkoenig at gcc dot gnu.org
@ 2014-12-28 12:36 ` tkoenig at gcc dot gnu.org
  2015-01-07 22:32 ` tkoenig at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2014-12-28 12:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56867

--- Comment #8 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
For the creation of a temporary after the fix where it is not really necessary,
see PR 64426 .


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

* [Bug fortran/56867] Missing temporary with string array assignment
  2013-04-07 18:12 [Bug fortran/56867] New: Missing temporary with string array assignment tkoenig at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2014-12-28 12:36 ` tkoenig at gcc dot gnu.org
@ 2015-01-07 22:32 ` tkoenig at gcc dot gnu.org
  2015-01-24 21:30 ` tkoenig at gcc dot gnu.org
  2015-01-24 21:32 ` tkoenig at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2015-01-07 22:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56867

--- Comment #9 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Author: tkoenig
Date: Wed Jan  7 22:31:54 2015
New Revision: 219325

URL: https://gcc.gnu.org/viewcvs?rev=219325&root=gcc&view=rev
Log:
2015-01-08  Thomas Koenig  <tkoenig@gcc.gnu.org>

    Backport from trunk
    PR fortran/56867
    * trans-array.c (gfc_conv_resolve_dependencies):  Also check
    dependencies when there may be substrings of character arrays.

2014-01-08  Thomas Koenig  <tkoenig@gcc.gnu.org>

    PR fortran/56867
    * gfortran.dg/dependency_45.f90:  New test.


Added:
    branches/gcc-4_9-branch/gcc/testsuite/gfortran.dg/dependency_45.f90
Modified:
    branches/gcc-4_9-branch/gcc/fortran/ChangeLog
    branches/gcc-4_9-branch/gcc/fortran/trans-array.c
    branches/gcc-4_9-branch/gcc/testsuite/ChangeLog


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

* [Bug fortran/56867] Missing temporary with string array assignment
  2013-04-07 18:12 [Bug fortran/56867] New: Missing temporary with string array assignment tkoenig at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2015-01-07 22:32 ` tkoenig at gcc dot gnu.org
@ 2015-01-24 21:30 ` tkoenig at gcc dot gnu.org
  2015-01-24 21:32 ` tkoenig at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2015-01-24 21:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56867

--- Comment #10 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Author: tkoenig
Date: Sat Jan 24 21:30:15 2015
New Revision: 220085

URL: https://gcc.gnu.org/viewcvs?rev=220085&root=gcc&view=rev
Log:
2015-01-24  Thomas Koenig  <tkoenig@gcc.gnu.org>

    PR fortran/56867
    * trans-array.c (gfc_conv_resolve_dependencies):  Also check
    dependencies when there may be substrings of character arrays.

2015-01-24  Thomas Koenig  <tkoenig@gcc.gnu.org>

    PR fortran/56867
    * gfortran.dg/dependency_45.f90:  New test.


Added:
    branches/gcc-4_8-branch/gcc/testsuite/gfortran.dg/dependency_45.f90
Modified:
    branches/gcc-4_8-branch/gcc/fortran/ChangeLog
    branches/gcc-4_8-branch/gcc/fortran/trans-array.c
    branches/gcc-4_8-branch/gcc/testsuite/ChangeLog


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

* [Bug fortran/56867] Missing temporary with string array assignment
  2013-04-07 18:12 [Bug fortran/56867] New: Missing temporary with string array assignment tkoenig at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2015-01-24 21:30 ` tkoenig at gcc dot gnu.org
@ 2015-01-24 21:32 ` tkoenig at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2015-01-24 21:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56867

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

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

--- Comment #11 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Fixed on all affected branches.


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

end of thread, other threads:[~2015-01-24 21:32 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-07 18:12 [Bug fortran/56867] New: Missing temporary with string array assignment tkoenig at gcc dot gnu.org
2013-04-07 20:11 ` [Bug fortran/56867] " tkoenig at gcc dot gnu.org
2013-04-07 20:15 ` burnus at gcc dot gnu.org
2013-04-07 20:19 ` tkoenig at gcc dot gnu.org
2013-04-07 20:39 ` dominiq at lps dot ens.fr
2013-04-08 12:17 ` burnus at gcc dot gnu.org
2013-04-08 20:24 ` tkoenig at gcc dot gnu.org
2014-12-28 12:03 ` tkoenig at gcc dot gnu.org
2014-12-28 12:36 ` tkoenig at gcc dot gnu.org
2015-01-07 22:32 ` tkoenig at gcc dot gnu.org
2015-01-24 21:30 ` tkoenig at gcc dot gnu.org
2015-01-24 21:32 ` tkoenig at gcc dot gnu.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).