public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/95682] New: Default assignment fails with allocatable array of deferred-length strings
@ 2020-06-15 14:06 federico.perini at gmail dot com
  2020-07-08 10:57 ` [Bug fortran/95682] [9/10/11 Regression] " dominiq at lps dot ens.fr
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: federico.perini at gmail dot com @ 2020-06-15 14:06 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95682
           Summary: Default assignment fails with allocatable array of
                    deferred-length strings
           Product: gcc
           Version: 9.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: federico.perini at gmail dot com
  Target Milestone: ---

Created attachment 48734
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48734&action=edit
Test program

The attached code below just copies a variable into another one using the
default derived type assignment: 

module m
      implicit none

      type, public :: t
              character(len=:), allocatable :: x(:)
      end type t

end module m

program test
   use m
   integer :: i
   type(t) :: t1,t2

   allocate(character(len=20) :: t1%x(3))
   t1%x(1) = 'one'
   t1%x(2) = 'two'
   t1%x(3) = 'three'

   t2 = t1

   do i=1,3
      if (t1%x(i)==t2%x(i)) cycle
      print *, 'i=',i,' t1=',t1%x(i),' t2=',t2%x(i),' DO NOT MATCH! '
   end do

end program test

It should produce no output as the two variables have to be identical. However,
apparently values in the character array are only copied correctly from the
first element in the array. 

Output with gfortran 9.2.0 is:

$ a.exe
 i=           2  t1=two                  t2=    ─ó0╖++  └w≈      DO NOT MATCH!
 i=           3  t1=three                t2=                     DO NOT MATCH!

Thanks,

Federico

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

* [Bug fortran/95682] [9/10/11 Regression] Default assignment fails with allocatable array of deferred-length strings
  2020-06-15 14:06 [Bug fortran/95682] New: Default assignment fails with allocatable array of deferred-length strings federico.perini at gmail dot com
@ 2020-07-08 10:57 ` dominiq at lps dot ens.fr
  2021-02-05 20:07 ` anlauf at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: dominiq at lps dot ens.fr @ 2020-07-08 10:57 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Target Milestone|---                         |9.4
   Last reconfirmed|                            |2020-07-08
           Priority|P3                          |P4
     Ever confirmed|0                           |1
      Known to work|                            |8.4.1
      Known to fail|                            |10.1.0, 11.0, 9.3.0
            Summary|Default assignment fails    |[9/10/11 Regression]
                   |with allocatable array of   |Default assignment fails
                   |deferred-length strings     |with allocatable array of
                   |                            |deferred-length strings

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
The change occurred between revisions r264542 (2018-09-24, OK) and r264595
(2018-09-26, wrong code).

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

* [Bug fortran/95682] [9/10/11 Regression] Default assignment fails with allocatable array of deferred-length strings
  2020-06-15 14:06 [Bug fortran/95682] New: Default assignment fails with allocatable array of deferred-length strings federico.perini at gmail dot com
  2020-07-08 10:57 ` [Bug fortran/95682] [9/10/11 Regression] " dominiq at lps dot ens.fr
@ 2021-02-05 20:07 ` anlauf at gcc dot gnu.org
  2021-06-01  8:17 ` [Bug fortran/95682] [9/10/11/12 " rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-02-05 20:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from anlauf at gcc dot gnu.org ---
Adding some printout after initializing the t1%x(:),

  do i = 1, size(t1%x)
     print *, len_trim (t1%x(i)), t1%x(i)
  end do

I get for gcc-8:

           5 three     
           5 three     
           5 three     

and for 9,10,11:

           3 one       
           3 two       
           5 three     

That's not a typical regression, but rather wrong code replaced by other wrong
code.

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

* [Bug fortran/95682] [9/10/11/12 Regression] Default assignment fails with allocatable array of deferred-length strings
  2020-06-15 14:06 [Bug fortran/95682] New: Default assignment fails with allocatable array of deferred-length strings federico.perini at gmail dot com
  2020-07-08 10:57 ` [Bug fortran/95682] [9/10/11 Regression] " dominiq at lps dot ens.fr
  2021-02-05 20:07 ` anlauf at gcc dot gnu.org
@ 2021-06-01  8:17 ` rguenth at gcc dot gnu.org
  2022-05-27  9:42 ` [Bug fortran/95682] [10/11/12/13 " rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-06-01  8:17 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|9.4                         |9.5

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9.4 is being released, retargeting bugs to GCC 9.5.

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

* [Bug fortran/95682] [10/11/12/13 Regression] Default assignment fails with allocatable array of deferred-length strings
  2020-06-15 14:06 [Bug fortran/95682] New: Default assignment fails with allocatable array of deferred-length strings federico.perini at gmail dot com
                   ` (2 preceding siblings ...)
  2021-06-01  8:17 ` [Bug fortran/95682] [9/10/11/12 " rguenth at gcc dot gnu.org
@ 2022-05-27  9:42 ` rguenth at gcc dot gnu.org
  2022-06-28 10:41 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-27  9:42 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|9.5                         |10.4

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9 branch is being closed

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

* [Bug fortran/95682] [10/11/12/13 Regression] Default assignment fails with allocatable array of deferred-length strings
  2020-06-15 14:06 [Bug fortran/95682] New: Default assignment fails with allocatable array of deferred-length strings federico.perini at gmail dot com
                   ` (3 preceding siblings ...)
  2022-05-27  9:42 ` [Bug fortran/95682] [10/11/12/13 " rguenth at gcc dot gnu.org
@ 2022-06-28 10:41 ` jakub at gcc dot gnu.org
  2023-07-07 10:37 ` [Bug fortran/95682] [11/12/13/14 " rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-28 10:41 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.4                        |10.5

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 10.4 is being released, retargeting bugs to GCC 10.5.

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

* [Bug fortran/95682] [11/12/13/14 Regression] Default assignment fails with allocatable array of deferred-length strings
  2020-06-15 14:06 [Bug fortran/95682] New: Default assignment fails with allocatable array of deferred-length strings federico.perini at gmail dot com
                   ` (4 preceding siblings ...)
  2022-06-28 10:41 ` jakub at gcc dot gnu.org
@ 2023-07-07 10:37 ` rguenth at gcc dot gnu.org
  2024-04-15 20:22 ` [Bug fortran/95682] [11/12 " anlauf at gcc dot gnu.org
  2024-04-25 13:55 ` pault at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07 10:37 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.5                        |11.5

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10 branch is being closed.

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

* [Bug fortran/95682] [11/12 Regression] Default assignment fails with allocatable array of deferred-length strings
  2020-06-15 14:06 [Bug fortran/95682] New: Default assignment fails with allocatable array of deferred-length strings federico.perini at gmail dot com
                   ` (5 preceding siblings ...)
  2023-07-07 10:37 ` [Bug fortran/95682] [11/12/13/14 " rguenth at gcc dot gnu.org
@ 2024-04-15 20:22 ` anlauf at gcc dot gnu.org
  2024-04-25 13:55 ` pault at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: anlauf at gcc dot gnu.org @ 2024-04-15 20:22 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |13.2.1, 14.0
            Summary|[11/12/13/14 Regression]    |[11/12 Regression] Default
                   |Default assignment fails    |assignment fails with
                   |with allocatable array of   |allocatable array of
                   |deferred-length strings     |deferred-length strings
      Known to fail|                            |12.3.0
           Keywords|                            |wrong-code

--- Comment #7 from anlauf at gcc dot gnu.org ---
Works on 14-mainline and on 13-branch (at r13-8285 and newer).

Adjusting known-to work/known-to-fail versions.

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

* [Bug fortran/95682] [11/12 Regression] Default assignment fails with allocatable array of deferred-length strings
  2020-06-15 14:06 [Bug fortran/95682] New: Default assignment fails with allocatable array of deferred-length strings federico.perini at gmail dot com
                   ` (6 preceding siblings ...)
  2024-04-15 20:22 ` [Bug fortran/95682] [11/12 " anlauf at gcc dot gnu.org
@ 2024-04-25 13:55 ` pault at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: pault at gcc dot gnu.org @ 2024-04-25 13:55 UTC (permalink / raw)
  To: gcc-bugs

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

Paul Thomas <pault at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |WONTFIX
                 CC|                            |pault at gcc dot gnu.org
             Status|NEW                         |RESOLVED

--- Comment #8 from Paul Thomas <pault at gcc dot gnu.org> ---
(In reply to anlauf from comment #2)
> Adding some printout after initializing the t1%x(:),
> 
>   do i = 1, size(t1%x)
>      print *, len_trim (t1%x(i)), t1%x(i)
>   end do
> 
> I get for gcc-8:
> 
>            5 three     
>            5 three     
>            5 three     
> 
> and for 9,10,11:
> 
>            3 one       
>            3 two       
>            5 three     
> 
> That's not a typical regression, but rather wrong code replaced by other
> wrong
> code.

Since this was not really a regression, as you remark, and the testcase works
correctly from 12-branch through mainline, I am closing as a WONTFIX.

Paul

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

end of thread, other threads:[~2024-04-25 13:55 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-15 14:06 [Bug fortran/95682] New: Default assignment fails with allocatable array of deferred-length strings federico.perini at gmail dot com
2020-07-08 10:57 ` [Bug fortran/95682] [9/10/11 Regression] " dominiq at lps dot ens.fr
2021-02-05 20:07 ` anlauf at gcc dot gnu.org
2021-06-01  8:17 ` [Bug fortran/95682] [9/10/11/12 " rguenth at gcc dot gnu.org
2022-05-27  9:42 ` [Bug fortran/95682] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:41 ` jakub at gcc dot gnu.org
2023-07-07 10:37 ` [Bug fortran/95682] [11/12/13/14 " rguenth at gcc dot gnu.org
2024-04-15 20:22 ` [Bug fortran/95682] [11/12 " anlauf at gcc dot gnu.org
2024-04-25 13:55 ` pault 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).