This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/68147] Potential incorrect code generation for string self-assignment


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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-10-29
                 CC|                            |pault at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Confirmed from 4.8 up to trunk (6.0). The following code

program test
  implicit none
  character(len=:),allocatable ::name, tmp
  name="./a.out"
  print *, name
  print *, name(3:)
  if (index(name,"/")  /=  0) THEN
    tmp=name(3:)
!    name=name(3:)
    name=tmp
    print *,name
  endif
end program

outputs

 ./a.out
 a.out
 a.out

so it seems the assignment "name=name(3:)" is missing a temporary.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]