public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/88486] ICE in gfc_conv_scalarized_array_ref, at fortran/trans-array.c:3401
       [not found] <bug-88486-4@http.gcc.gnu.org/bugzilla/>
@ 2021-08-28 19:14 ` anlauf at gcc dot gnu.org
  2023-05-28 18:20 ` kargl at gcc dot gnu.org
  2023-05-28 18:52 ` kargl at gcc dot gnu.org
  2 siblings, 0 replies; 3+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-08-28 19:14 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

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

--- Comment #3 from anlauf at gcc dot gnu.org ---
Further reduced:

subroutine s(x)
  character(:), allocatable :: x(:)
  character(:), allocatable :: y(:)
  y = [x//'a']
end

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

* [Bug fortran/88486] ICE in gfc_conv_scalarized_array_ref, at fortran/trans-array.c:3401
       [not found] <bug-88486-4@http.gcc.gnu.org/bugzilla/>
  2021-08-28 19:14 ` [Bug fortran/88486] ICE in gfc_conv_scalarized_array_ref, at fortran/trans-array.c:3401 anlauf at gcc dot gnu.org
@ 2023-05-28 18:20 ` kargl at gcc dot gnu.org
  2023-05-28 18:52 ` kargl at gcc dot gnu.org
  2 siblings, 0 replies; 3+ messages in thread
From: kargl at gcc dot gnu.org @ 2023-05-28 18:20 UTC (permalink / raw)
  To: gcc-bugs

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

kargl at gcc dot gnu.org changed:

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

--- Comment #4 from kargl at gcc dot gnu.org ---
(In reply to anlauf from comment #3)
> Further reduced:
> 
> subroutine s(x)
>   character(:), allocatable :: x(:)
>   character(:), allocatable :: y(:)
>   y = [x//'a']
> end

This compiles with GNU Fortran (GCC) 13.0.1 20230408 (experimental).
This has an ICE with GNU Fortran (FreeBSD Ports Collection) 12.2.0.

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

* [Bug fortran/88486] ICE in gfc_conv_scalarized_array_ref, at fortran/trans-array.c:3401
       [not found] <bug-88486-4@http.gcc.gnu.org/bugzilla/>
  2021-08-28 19:14 ` [Bug fortran/88486] ICE in gfc_conv_scalarized_array_ref, at fortran/trans-array.c:3401 anlauf at gcc dot gnu.org
  2023-05-28 18:20 ` kargl at gcc dot gnu.org
@ 2023-05-28 18:52 ` kargl at gcc dot gnu.org
  2 siblings, 0 replies; 3+ messages in thread
From: kargl at gcc dot gnu.org @ 2023-05-28 18:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from kargl at gcc dot gnu.org ---
(In reply to G. Steinmetz from comment #0)
> Affects versions down to at least gfortran-5.
> Under the hood related to pr85686.
> 
> 
> $ cat z1.f90
> subroutine s(x)
>    character(:), allocatable :: x(:)
>    x = ['bcd']
>    x = ['a'//x//'e']
>    print *, x
> end
> 

This compiles with GNU Fortran (GCC) 13.0.1 20230408 (experimental).
This has an ICE with GNU Fortran (FreeBSD Ports Collection) 12.2.0.

Filling out the code to something that actually does something
reveals a wrong-code issue with an array constructor.  There are
a boat load of warnings of uninitialized variables, e.g., 
a.f90:53:34:

   53 |          x = [ ('a' // x // 'e') ]
      |                                  ^
Warning: '__var_1_realloc_string.dim[0].ubound' is used uninitialized
[-Wuninitialized]
a.f90:1:11:

    1 | program foo
      |           ^
note: '__var_1_realloc_string' declared here
a.f90:3:36:

    3 |    character(:), allocatable :: a(:)
      |                                    ^
Warning: '.a' is used uninitialized [-Wuninitialized]
a.f90:34:22:

   34 |       end subroutine s
      |                      ^
note: '.a' declared here


program foo

   character(:), allocatable :: a(:)

   call s(a)
   print '(A,1X,2(I0,1X),/)', 'a: >>' // a // '<<', size(a), len(a(1))
   if (allocated(a)) deallocate(a)

   call t(a)
   print '(A,1X,2(I0,1X),/)', 'a: >>' // a // '<<', size(a), len(a(1))
   if (allocated(a)) deallocate(a)

   call u(a)
   print '(A,1X,2(I0,1X),/)', 'a: >>' // a // '<<', size(a), len(a(1))
   if (allocated(a)) deallocate(a)

   call v(a)
   print '(A,1X,2(I0,1X),/)', 'a: >>' // a // '<<', size(a), len(a(1))
   if (allocated(a)) deallocate(a)

   call w(a)
   print '(A,1X,2(I0,1X),/)', 'a: >>' // a // '<<', size(a), len(a(1))
   if (allocated(a)) deallocate(a)

   contains

      subroutine s(x)
         character(:), allocatable :: x(:)
         x = ['bcd']
         x = ['a' // x // 'e']
         print '(A,1X,2(I0,1X))', 's: >>' // x // '<<', size(x), len(x(1))
      end subroutine s

      subroutine t(x)
         character(:), allocatable :: x(:)
         x = ['bcd']
         x = 'a' // x // 'e'
         print '(A,1X,2(I0,1X))', 't: >>' // x // '<<', size(x), len(x(1))
      end subroutine t

      subroutine u(x)
         character(:), allocatable :: x(:)
         x = ['bcd']
         x = [ ('a' // x // 'e') ]
         print '(A,1X,2(I0,1X))', 'u: >>' // x // '<<', size(x), len(x(1))
      end subroutine u

      subroutine v(x)
         character(:), allocatable, intent(out) :: x(:)
         x = ['bcd']
         x = [ ('a' // x // 'e') ]
         print '(A,1X,2(I0,1X))', 'v: >>' // x // '<<', size(x), len(x(1))
      end subroutine v

      subroutine w(x)
         character(:), allocatable, intent(out) :: x(:)
         x = [ 'a' // ['bcd'] // 'e' ]
         print '(A,1X,2(I0,1X))', 'w: >>' // x // '<<', size(x), len(x(1))
      end subroutine w

end program foo


s: >>abcde<< 1 5
a: >>abc<< 1 3    <--- whoops

t: >>abcde<< 1 5
a: >>abcde<< 1 5

u: >>abcde<< 1 5
a: >>abc<< 1 3    <--- whoops

v: >>abcde<< 1 5
a: >>abc<< 1 3    <--- whoops

w: >>abcde<< 1 5
a: >>abcde<< 1 5

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

end of thread, other threads:[~2023-05-28 18:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-88486-4@http.gcc.gnu.org/bugzilla/>
2021-08-28 19:14 ` [Bug fortran/88486] ICE in gfc_conv_scalarized_array_ref, at fortran/trans-array.c:3401 anlauf at gcc dot gnu.org
2023-05-28 18:20 ` kargl at gcc dot gnu.org
2023-05-28 18:52 ` kargl 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).