public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/39865]  New: ICE in gfc_conv_scalarized_array_ref
@ 2009-04-23 12:41 jakub at gcc dot gnu dot org
  2009-04-23 12:47 ` [Bug fortran/39865] " jakub at gcc dot gnu dot org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-04-23 12:41 UTC (permalink / raw)
  To: gcc-bugs

module mod
  type t
    real :: v(50)
  end type t
  type (t), target, allocatable :: v1(:)
  integer :: v2, v3, v4
  character(len=8), target, allocatable :: v5(:)
end module mod

subroutine test
  use mod
  integer :: i
  write (*,v5(1:v3)) (v1(i)%v(v2), i=2, v4)
end subroutine test

ICEs in gfc_conv_scalarized_array_ref, se->loop is NULL, yet it is trying to
read from se->loop->order[0].
ICEs with 4.1, 4.2, 4.3, 4.4 and trunk f951.


-- 
           Summary: ICE in gfc_conv_scalarized_array_ref
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org


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


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

* [Bug fortran/39865] ICE in gfc_conv_scalarized_array_ref
  2009-04-23 12:41 [Bug fortran/39865] New: ICE in gfc_conv_scalarized_array_ref jakub at gcc dot gnu dot org
@ 2009-04-23 12:47 ` jakub at gcc dot gnu dot org
  2009-04-23 13:07 ` dominiq at lps dot ens dot fr
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-04-23 12:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jakub at gcc dot gnu dot org  2009-04-23 12:47 -------
Actually, module isn't needed for the ICE:

subroutine test (v1, v2, v3, v4)
  integer, target, allocatable :: v1(:)
  character(len=8), target, allocatable :: v2(:)
  integer :: v3, v4, v5
  write (*,v2(1:v3)) (v1(i), i=2, v4)
end subroutine test

ICEs as well.


-- 


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


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

* [Bug fortran/39865] ICE in gfc_conv_scalarized_array_ref
  2009-04-23 12:41 [Bug fortran/39865] New: ICE in gfc_conv_scalarized_array_ref jakub at gcc dot gnu dot org
  2009-04-23 12:47 ` [Bug fortran/39865] " jakub at gcc dot gnu dot org
@ 2009-04-23 13:07 ` dominiq at lps dot ens dot fr
  2009-04-23 13:18 ` jakub at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: dominiq at lps dot ens dot fr @ 2009-04-23 13:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from dominiq at lps dot ens dot fr  2009-04-23 13:07 -------
This may be a stupid question, but are the codes in comments #0 and #1 valid?
The allocatable variables are used without being allocated, isn't it?


-- 


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


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

* [Bug fortran/39865] ICE in gfc_conv_scalarized_array_ref
  2009-04-23 12:41 [Bug fortran/39865] New: ICE in gfc_conv_scalarized_array_ref jakub at gcc dot gnu dot org
  2009-04-23 12:47 ` [Bug fortran/39865] " jakub at gcc dot gnu dot org
  2009-04-23 13:07 ` dominiq at lps dot ens dot fr
@ 2009-04-23 13:18 ` jakub at gcc dot gnu dot org
  2009-04-23 13:33 ` jakub at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-04-23 13:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jakub at gcc dot gnu dot org  2009-04-23 13:18 -------
Whether this is valid or not I have no idea.
Just bear in mind that this is a distilled compile time testcase, not intended
as runtime testcase, for runtime testcase obviously something would need to
allocate the allocatable arrays, initialize the variables etc.
In the original sources (680KB), the allocatables were initialized in module
subroutines.


-- 


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


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

* [Bug fortran/39865] ICE in gfc_conv_scalarized_array_ref
  2009-04-23 12:41 [Bug fortran/39865] New: ICE in gfc_conv_scalarized_array_ref jakub at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2009-04-23 13:18 ` jakub at gcc dot gnu dot org
@ 2009-04-23 13:33 ` jakub at gcc dot gnu dot org
  2009-04-23 13:50 ` jakub at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-04-23 13:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jakub at gcc dot gnu dot org  2009-04-23 13:33 -------
allocatable and target attributes aren't needed btw, the following ICEs as
well:
subroutine test (v1, v2, v3, v4)
  integer :: v1(:)
  character(len=8) :: v2(:)
  integer :: v3, v4, v5
  write (*,v2(1:v3)) (v1(i), v5=2, v4)
end subroutine test


-- 


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


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

* [Bug fortran/39865] ICE in gfc_conv_scalarized_array_ref
  2009-04-23 12:41 [Bug fortran/39865] New: ICE in gfc_conv_scalarized_array_ref jakub at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2009-04-23 13:33 ` jakub at gcc dot gnu dot org
@ 2009-04-23 13:50 ` jakub at gcc dot gnu dot org
  2009-04-23 13:57 ` burnus at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-04-23 13:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jakub at gcc dot gnu dot org  2009-04-23 13:50 -------
subroutine test (v)
  character(len=8) :: v(:)
  write (*, v) 3
  write (*, v(:)) 3
  write (*, v(1:size (v))) 3
end subroutine test

ICEs too (on the second or third write stmt).


-- 


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


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

* [Bug fortran/39865] ICE in gfc_conv_scalarized_array_ref
  2009-04-23 12:41 [Bug fortran/39865] New: ICE in gfc_conv_scalarized_array_ref jakub at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2009-04-23 13:50 ` jakub at gcc dot gnu dot org
@ 2009-04-23 13:57 ` burnus at gcc dot gnu dot org
  2009-04-23 14:19 ` jakub at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-04-23 13:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from burnus at gcc dot gnu dot org  2009-04-23 13:57 -------
Shorter, but gives not an error message but simply segfaults. (By the way, for
all tests I tried, gfortran 4.1 to 4.4 crashes, i.e. it is no regression.)

Seemingly, no one had tried before to pass an array to the FMT= argument of a
data transfer statement.

F2003 has: "9.5.1.1 FMT= specifier in a data transfer statement" [...] "If
default-char-expr is an array, it is treated as if all of the elements of the
array were specified in array element order and were concatenated."

subroutine test (v2)
  character(len=8) :: v2(:)
  write (*,v2(1:1)) 1
end subroutine test

==21619== Invalid read of size 4
==21619==    at 0x5317FF: gfc_conv_scalarized_array_ref (trans-array.c:2411)
==21619==    by 0x5322F4: gfc_conv_array_ref (trans-array.c:2460)
==21619==    by 0x54C971: gfc_conv_variable (trans-expr.c:679)
==21619==    by 0x559C4C: set_string (trans-io.c:595)
==21619==    by 0x55B8C5: build_dt (trans-io.c:1746)


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |ice-on-valid-code
   Last reconfirmed|0000-00-00 00:00:00         |2009-04-23 13:57:12
               date|                            |


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


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

* [Bug fortran/39865] ICE in gfc_conv_scalarized_array_ref
  2009-04-23 12:41 [Bug fortran/39865] New: ICE in gfc_conv_scalarized_array_ref jakub at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2009-04-23 13:57 ` burnus at gcc dot gnu dot org
@ 2009-04-23 14:19 ` jakub at gcc dot gnu dot org
  2009-04-23 14:51 ` jakub at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-04-23 14:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from jakub at gcc dot gnu dot org  2009-04-23 14:19 -------
Well, gfc_convert_array_to_string seems to handle AR_FULL arrays correctly, but
probably just the other arrays does not.


-- 


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


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

* [Bug fortran/39865] ICE in gfc_conv_scalarized_array_ref
  2009-04-23 12:41 [Bug fortran/39865] New: ICE in gfc_conv_scalarized_array_ref jakub at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2009-04-23 14:19 ` jakub at gcc dot gnu dot org
@ 2009-04-23 14:51 ` jakub at gcc dot gnu dot org
  2009-04-23 17:34 ` burnus at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-04-23 14:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from jakub at gcc dot gnu dot org  2009-04-23 14:51 -------
A different testcase that segfaults even a little bit earlier:
subroutine test()
  interface
    function f()
      character(len=1) :: f(5)
    end function f
  end interface
  write (*, f()) 1
end subroutine test

Here upon entry to gfc_convert_array_to_string e->ref == NULL, so it crashes
already in that function.
If the array is packed, guess all we want is compute the address of its first
element and its SIZEOF (could we use the SIZEOF intrinsic expansion for that)?
If it is not packed, I'm afraid we need to pack it and then do what we do for
packed arrays.


-- 


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


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

* [Bug fortran/39865] ICE in gfc_conv_scalarized_array_ref
  2009-04-23 12:41 [Bug fortran/39865] New: ICE in gfc_conv_scalarized_array_ref jakub at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2009-04-23 14:51 ` jakub at gcc dot gnu dot org
@ 2009-04-23 17:34 ` burnus at gcc dot gnu dot org
  2009-05-11 17:30 ` jakub at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-04-23 17:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from burnus at gcc dot gnu dot org  2009-04-23 17:33 -------
Paul, this PR might interest you - esp. as you have most experience in that
part of the compiler. (If you are/feel swamped, feel free to de-CC yourself.)


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pault at gcc dot gnu dot org


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


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

* [Bug fortran/39865] ICE in gfc_conv_scalarized_array_ref
  2009-04-23 12:41 [Bug fortran/39865] New: ICE in gfc_conv_scalarized_array_ref jakub at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2009-04-23 17:34 ` burnus at gcc dot gnu dot org
@ 2009-05-11 17:30 ` jakub at gcc dot gnu dot org
  2009-05-12 13:20 ` jakub at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-05-11 17:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from jakub at gcc dot gnu dot org  2009-05-11 17:30 -------
Testcase:

subroutine f1 (a)
  character(len=1) :: a(7:)
  character(len=12) :: b
  character(len=1) :: c(2:10)
  write (b, a) 'Hell', 'o wo', 'rld!'
  if (b .ne. 'Hello world!') call abort
  write (b, a(:)) 'Hell', 'o wo', 'rld!'
  if (b .ne. 'Hello world!') call abort
  write (b, a(8:)) 'Hell', 'o wo', 'rld!'
  if (b .ne. 'Hello world!') call abort
  c(2) = ' '
  c(3) = '('
  c(4) = '3'
  c(5) = 'A'
  c(6) = '4'
  c(7) = ')'
  write (b, c) 'Hell', 'o wo', 'rld!'
  if (b .ne. 'Hello world!') call abort
  write (b, c(:)) 'Hell', 'o wo', 'rld!'
  if (b .ne. 'Hello world!') call abort
  write (b, c(3:)) 'Hell', 'o wo', 'rld!'
  if (b .ne. 'Hello world!') call abort
end subroutine f1

subroutine f2 (a)
  character(len=1) :: a(10:,20:)
  character(len=12) :: b
  write (b, a) 'Hell', 'o wo', 'rld!'
  if (b .ne. 'Hello world!') call abort
  write (b, a) 'Hell', 'o wo', 'rld!'
  if (b .ne. 'Hello world!') call abort
end subroutine f2

  interface
    subroutine f1 (a)
      character(len=1) :: a(:)
    end
  end interface
  interface
    subroutine f2 (a)
      character(len=1) :: a(:,:)
    end
  end interface
  integer :: i, j
  character(len=1) :: e (6, 7:9), f (3,2), g (10)
  e = 'X'
  e(2,8) = ' '
  e(3,8) = '('
  e(4,8) = '3'
  e(2,9) = 'A'
  e(3,9) = '4'
  e(4,9) = ')'
  f = e(2:4,8:9)
  g = 'X'
  g(2) = ' '
  g(3) = '('
  g(4) = '3'
  g(5) = 'A'
  g(6) = '4'
  g(7) = ')'
  call f1 (g(2:7))
  call f2 (f)
  call f2 (e(2:4,8:9))
end


-- 


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


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

* [Bug fortran/39865] ICE in gfc_conv_scalarized_array_ref
  2009-04-23 12:41 [Bug fortran/39865] New: ICE in gfc_conv_scalarized_array_ref jakub at gcc dot gnu dot org
                   ` (9 preceding siblings ...)
  2009-05-11 17:30 ` jakub at gcc dot gnu dot org
@ 2009-05-12 13:20 ` jakub at gcc dot gnu dot org
  2009-05-14  0:01 ` jakub at gcc dot gnu dot org
  2009-05-14  6:46 ` jakub at gcc dot gnu dot org
  12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-05-12 13:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from jakub at gcc dot gnu dot org  2009-05-12 13:19 -------
Partial fix:
http://gcc.gnu.org/ml/gcc-patches/2009-05/msg00637.html


-- 


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


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

* [Bug fortran/39865] ICE in gfc_conv_scalarized_array_ref
  2009-04-23 12:41 [Bug fortran/39865] New: ICE in gfc_conv_scalarized_array_ref jakub at gcc dot gnu dot org
                   ` (10 preceding siblings ...)
  2009-05-12 13:20 ` jakub at gcc dot gnu dot org
@ 2009-05-14  0:01 ` jakub at gcc dot gnu dot org
  2009-05-14  6:46 ` jakub at gcc dot gnu dot org
  12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-05-14  0:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from jakub at gcc dot gnu dot org  2009-05-14 00:00 -------
Subject: Bug 39865

Author: jakub
Date: Thu May 14 00:00:27 2009
New Revision: 147507

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=147507
Log:
        PR fortran/39865
        * io.c (resolve_tag_format): CHARACTER array in FMT= argument
        isn't an extension.  Reject non-CHARACTER array element of
        assumed shape or pointer or assumed size array.
        * trans-array.c (array_parameter_size): New function.
        (gfc_conv_array_parameter): Add size argument.  Call
        array_parameter_size if it is non-NULL.
        * trans-array.h (gfc_conv_array_parameter): Adjust prototype.
        * trans-expr.c (gfc_conv_function_call, gfc_trans_arrayfunc_assign):
        Adjust callers.
        * trans-intrinsic.c (gfc_conv_intrinsic_loc): Likewise.
        * trans-io.c (gfc_convert_array_to_string): Rewritten.

        * gfortran.dg/pr39865.f90: New test.
        * gfortran.dg/hollerith.f90: Don't expect errors for CHARACTER
        arrays in FMT=.
        * gfortran.dg/hollerith_f95.f90: Likewise.
        * gfortran.dg/hollerith6.f90: New test.
        * gfortran.dg/hollerith7.f90: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/hollerith6.f90
    trunk/gcc/testsuite/gfortran.dg/hollerith7.f90
    trunk/gcc/testsuite/gfortran.dg/pr39865.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/io.c
    trunk/gcc/fortran/trans-array.c
    trunk/gcc/fortran/trans-array.h
    trunk/gcc/fortran/trans-expr.c
    trunk/gcc/fortran/trans-intrinsic.c
    trunk/gcc/fortran/trans-io.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/hollerith.f90
    trunk/gcc/testsuite/gfortran.dg/hollerith_f95.f90


-- 


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


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

* [Bug fortran/39865] ICE in gfc_conv_scalarized_array_ref
  2009-04-23 12:41 [Bug fortran/39865] New: ICE in gfc_conv_scalarized_array_ref jakub at gcc dot gnu dot org
                   ` (11 preceding siblings ...)
  2009-05-14  0:01 ` jakub at gcc dot gnu dot org
@ 2009-05-14  6:46 ` jakub at gcc dot gnu dot org
  12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-05-14  6:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from jakub at gcc dot gnu dot org  2009-05-14 06:45 -------
Fixed.


-- 

jakub at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2009-05-14  6:46 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-23 12:41 [Bug fortran/39865] New: ICE in gfc_conv_scalarized_array_ref jakub at gcc dot gnu dot org
2009-04-23 12:47 ` [Bug fortran/39865] " jakub at gcc dot gnu dot org
2009-04-23 13:07 ` dominiq at lps dot ens dot fr
2009-04-23 13:18 ` jakub at gcc dot gnu dot org
2009-04-23 13:33 ` jakub at gcc dot gnu dot org
2009-04-23 13:50 ` jakub at gcc dot gnu dot org
2009-04-23 13:57 ` burnus at gcc dot gnu dot org
2009-04-23 14:19 ` jakub at gcc dot gnu dot org
2009-04-23 14:51 ` jakub at gcc dot gnu dot org
2009-04-23 17:34 ` burnus at gcc dot gnu dot org
2009-05-11 17:30 ` jakub at gcc dot gnu dot org
2009-05-12 13:20 ` jakub at gcc dot gnu dot org
2009-05-14  0:01 ` jakub at gcc dot gnu dot org
2009-05-14  6:46 ` jakub 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).