public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/28167]  New: ICE: in fold_binary, at fold-const.c:8239 (temporary character array?)
@ 2006-06-26  7:53 anlauf at gmx dot de
  2006-06-26  8:24 ` [Bug fortran/28167] " anlauf at gmx dot de
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: anlauf at gmx dot de @ 2006-06-26  7:53 UTC (permalink / raw)
  To: gcc-bugs

Here's another ICE, probably related to temporary character arrays:

gfcbug34.f90: In function 'MAIN__':
gfcbug34.f90:1: internal compiler error: in fold_binary, at fold-const.c:8239

It dies on:

  call foo ( (/ (' ',i=1,m) /) )

Testcase attached.

Cheers,
-ha


-- 
           Summary: ICE: in fold_binary, at fold-const.c:8239 (temporary
                    character array?)
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: anlauf at gmx dot de
  GCC host triplet: i686-pc-linux-gnu


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


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

* [Bug fortran/28167] ICE: in fold_binary, at fold-const.c:8239 (temporary character array?)
  2006-06-26  7:53 [Bug fortran/28167] New: ICE: in fold_binary, at fold-const.c:8239 (temporary character array?) anlauf at gmx dot de
@ 2006-06-26  8:24 ` anlauf at gmx dot de
  2006-06-26  9:45 ` rguenth at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: anlauf at gmx dot de @ 2006-06-26  8:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from anlauf at gmx dot de  2006-06-26 07:53 -------
Created an attachment (id=11755)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11755&action=view)
Testcase


-- 


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


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

* [Bug fortran/28167] ICE: in fold_binary, at fold-const.c:8239 (temporary character array?)
  2006-06-26  7:53 [Bug fortran/28167] New: ICE: in fold_binary, at fold-const.c:8239 (temporary character array?) anlauf at gmx dot de
  2006-06-26  8:24 ` [Bug fortran/28167] " anlauf at gmx dot de
@ 2006-06-26  9:45 ` rguenth at gcc dot gnu dot org
  2006-06-27 14:20 ` paul dot richard dot thomas at cea dot fr
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-06-26  9:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rguenth at gcc dot gnu dot org  2006-06-26 08:24 -------
Confirmed.  We end up in gfc_trans_create_temp_array

      size = fold_build2 (MULT_EXPR, gfc_array_index_type, size,
                          TYPE_SIZE_UNIT (gfc_get_element_type (type)));

with type being a record type 'struct array1_unknown', so TYPE_SIZE_UNIT
(gfc_get_element_type (type)) returns zero.  gfc_get_element_type (type)
returns charD.14[1:] (!??), so maybe the fix is to use TYPE_SIZE_UNIT
(TREE_TYPE (... ))) here.  (This doesn't fix it, we also pass size == 0 to the
MULT_EXPR,
so we'll end up with a size of zero here)

So maybe the bug is that size and nelem are both zero...  who knows ;)


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |ice-on-valid-code
   Last reconfirmed|0000-00-00 00:00:00         |2006-06-26 08:24:32
               date|                            |


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


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

* [Bug fortran/28167] ICE: in fold_binary, at fold-const.c:8239 (temporary character array?)
  2006-06-26  7:53 [Bug fortran/28167] New: ICE: in fold_binary, at fold-const.c:8239 (temporary character array?) anlauf at gmx dot de
  2006-06-26  8:24 ` [Bug fortran/28167] " anlauf at gmx dot de
  2006-06-26  9:45 ` rguenth at gcc dot gnu dot org
@ 2006-06-27 14:20 ` paul dot richard dot thomas at cea dot fr
  2006-06-28 22:30 ` pault at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: paul dot richard dot thomas at cea dot fr @ 2006-06-27 14:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from paul dot richard dot thomas at cea dot fr  2006-06-27 14:17 -------
I believe that a frontend problem is involved, even if it is only part of the
story.  This exhibits the same symptoms as Harald's testcase:

  call foo ( (/( 'a',i=1,2 )/) )
end

but this works fine:

  call foo ( (/'a', 'b'/) )
end

Both expand the constructor just fine.  However the second makes just one call
to resolve_expr and leaves with a value for the string length. The first calls
resolve_expr twice and has lost the string length between the first and second
calls.  I am blowed if I can see where this happens for the moment but I am
looking furiously!

Paul 


-- 


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


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

* [Bug fortran/28167] ICE: in fold_binary, at fold-const.c:8239 (temporary character array?)
  2006-06-26  7:53 [Bug fortran/28167] New: ICE: in fold_binary, at fold-const.c:8239 (temporary character array?) anlauf at gmx dot de
                   ` (2 preceding siblings ...)
  2006-06-27 14:20 ` paul dot richard dot thomas at cea dot fr
@ 2006-06-28 22:30 ` pault at gcc dot gnu dot org
  2006-07-04 20:16 ` pault at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-06-28 22:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pault at gcc dot gnu dot org  2006-06-28 22:00 -------
Created an attachment (id=11776)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11776&action=view)
Fixes the problem and some

The attached patch fixes the PR and fixes character valued functions in array
constructors.

This works:
  character(4), dimension(4) :: c1, c2
  integer m
  m = 4
! Test the original problem
  call foo ((/( 'a',i=1,m )/), c2)
  if (any(c2(:)(1:1) .ne. (/'a','a','a','a'/))) call abort ()

! Now get a bit smarter
  call foo ((/"abcd", "efgh", "ijkl", "mnop"/), c1) ! worked before
  call foo ((/(c1(i), i = m,1,-1)/), c2)            ! was broken
  if (any(c2(4:1:-1) .ne. c1)) call abort ()

! gfc_todo: Not Implemented: complex character array constructors
!  call foo ((/(c1(i)(2:3), i = 1,4)/), c2)

! Check functions in the constructor
  call foo ((/(achar(64+i)//achar(68+i)//achar(72+i)// &
               achar(76+i),i=1,4 )/), c1)           ! was broken
  if (any (c1 .ne. (/"AEIM","BFJN","CGKO","DHLP"/))) call abort ()
contains
  subroutine foo (chr1, chr2)
    character(*), dimension(:) :: chr1, chr2
    chr2 = chr1
  end subroutine foo
end

Paul

PS Do not worry - I had not forgotten PR28174!


-- 


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


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

* [Bug fortran/28167] ICE: in fold_binary, at fold-const.c:8239 (temporary character array?)
  2006-06-26  7:53 [Bug fortran/28167] New: ICE: in fold_binary, at fold-const.c:8239 (temporary character array?) anlauf at gmx dot de
                   ` (3 preceding siblings ...)
  2006-06-28 22:30 ` pault at gcc dot gnu dot org
@ 2006-07-04 20:16 ` pault at gcc dot gnu dot org
  2006-07-04 20:36 ` pault at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-07-04 20:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pault at gcc dot gnu dot org  2006-07-04 20:16 -------
Subject: Bug 28167

Author: pault
Date: Tue Jul  4 20:15:52 2006
New Revision: 115182

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=115182
Log:
2006-07-04  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/28174
        * trans-array.c (gfc_conv_expr_descriptor): When building temp,
        ensure that the substring reference uses a new charlen.
        * trans-expr.c (gfc_conv_aliased_arg): Add the formal intent to
        the argument list, lift the treatment of missing string lengths
        from the above and implement the use of the intent.
        (gfc_conv_function_call): Add the extra argument to the call to
        the above.

        PR fortran/28167
        * trans-array.c (get_array_ctor_var_strlen): Treat a constant
        substring reference.
        * array.c (gfc_resolve_character_array_constructor): Remove 
        static attribute and add the gfc_ prefix, make use of element
        charlens for the expression and pick up constant string lengths
        for expressions that are not themselves constant.
        * gfortran.h : resolve_character_array_constructor prototype
        added.
        * resolve.c (gfc_resolve_expr): Call resolve_character_array_
        constructor again after expanding the constructor, to ensure
        that the character length is passed to the expression.

2006-07-04  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/28174
        * gfortran.dg/actual_array_substr_2.f90: New test.

        PR fortran/28167
        * gfortran.dg/actual_array_constructor_2.f90: New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/actual_array_constructor_2.f90
    trunk/gcc/testsuite/gfortran.dg/actual_array_substr_2.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/array.c
    trunk/gcc/fortran/gfortran.h
    trunk/gcc/fortran/resolve.c
    trunk/gcc/fortran/trans-array.c
    trunk/gcc/fortran/trans-expr.c


-- 


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


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

* [Bug fortran/28167] ICE: in fold_binary, at fold-const.c:8239 (temporary character array?)
  2006-06-26  7:53 [Bug fortran/28167] New: ICE: in fold_binary, at fold-const.c:8239 (temporary character array?) anlauf at gmx dot de
                   ` (4 preceding siblings ...)
  2006-07-04 20:16 ` pault at gcc dot gnu dot org
@ 2006-07-04 20:36 ` pault at gcc dot gnu dot org
  2006-07-06 15:35 ` pault at gcc dot gnu dot org
  2006-07-06 15:38 ` pault at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-07-04 20:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pault at gcc dot gnu dot org  2006-07-04 20:36 -------
Subject: Bug 28167

Author: pault
Date: Tue Jul  4 20:36:15 2006
New Revision: 115187

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=115187
Log:
2006-07-04  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/28174
        * gfortran.dg/actual_array_substr_2.f90: New test.

        PR fortran/28167
        * gfortran.dg/actual_array_constructor_2.f90: New test.


Modified:
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/28167] ICE: in fold_binary, at fold-const.c:8239 (temporary character array?)
  2006-06-26  7:53 [Bug fortran/28167] New: ICE: in fold_binary, at fold-const.c:8239 (temporary character array?) anlauf at gmx dot de
                   ` (5 preceding siblings ...)
  2006-07-04 20:36 ` pault at gcc dot gnu dot org
@ 2006-07-06 15:35 ` pault at gcc dot gnu dot org
  2006-07-06 15:38 ` pault at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-07-06 15:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pault at gcc dot gnu dot org  2006-07-06 15:35 -------
Subject: Bug 28167

Author: pault
Date: Thu Jul  6 15:35:24 2006
New Revision: 115222

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=115222
Log:
2006-07-06  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/28174
        * trans-array.c (gfc_conv_expr_descriptor): When building temp,
        ensure that the substring reference uses a new charlen.
        * trans-expr.c (gfc_conv_aliased_arg): Add the formal intent to
        the argument list, lift the treatment of missing string lengths
        from the above and implement the use of the intent.
        (gfc_conv_function_call): Add the extra argument to the call to
        the above.

        PR fortran/28167
        * trans-array.c (get_array_ctor_var_strlen): Treat a constant
        substring reference.
        * array.c (gfc_resolve_character_array_constructor): Remove 
        static attribute and add the gfc_ prefix, make use of element
        charlens for the expression and pick up constant string lengths
        for expressions that are not themselves constant.
        * gfortran.h : resolve_character_array_constructor prototype
        added.
        * resolve.c (gfc_resolve_expr): Call resolve_character_array_
        constructor again after expanding the constructor, to ensure
        that the character length is passed to the expression.

2006-07-06  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/28174
        * gfortran.dg/actual_array_substr_2.f90: New test.

        PR fortran/28167
        * gfortran.dg/actual_array_constructor_2.f90: New test.


Modified:
    branches/gcc-4_1-branch/gcc/fortran/ChangeLog
    branches/gcc-4_1-branch/gcc/fortran/array.c
    branches/gcc-4_1-branch/gcc/fortran/gfortran.h
    branches/gcc-4_1-branch/gcc/fortran/resolve.c
    branches/gcc-4_1-branch/gcc/fortran/trans-array.c
    branches/gcc-4_1-branch/gcc/fortran/trans-expr.c
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/28167] ICE: in fold_binary, at fold-const.c:8239 (temporary character array?)
  2006-06-26  7:53 [Bug fortran/28167] New: ICE: in fold_binary, at fold-const.c:8239 (temporary character array?) anlauf at gmx dot de
                   ` (6 preceding siblings ...)
  2006-07-06 15:35 ` pault at gcc dot gnu dot org
@ 2006-07-06 15:38 ` pault at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-07-06 15:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from pault at gcc dot gnu dot org  2006-07-06 15:38 -------
Fixed on trunk and 4.1

Paul


-- 

pault at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2006-07-06 15:38 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-26  7:53 [Bug fortran/28167] New: ICE: in fold_binary, at fold-const.c:8239 (temporary character array?) anlauf at gmx dot de
2006-06-26  8:24 ` [Bug fortran/28167] " anlauf at gmx dot de
2006-06-26  9:45 ` rguenth at gcc dot gnu dot org
2006-06-27 14:20 ` paul dot richard dot thomas at cea dot fr
2006-06-28 22:30 ` pault at gcc dot gnu dot org
2006-07-04 20:16 ` pault at gcc dot gnu dot org
2006-07-04 20:36 ` pault at gcc dot gnu dot org
2006-07-06 15:35 ` pault at gcc dot gnu dot org
2006-07-06 15:38 ` pault 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).