Bug 23634 - temporary array of character ICE with non constant size
Summary: temporary array of character ICE with non constant size
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.0.1
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
: 26057 (view as bug list)
Depends on:
Blocks: Fortran_character 15502 25619
  Show dependency treegraph
 
Reported: 2005-08-30 13:01 UTC by william.mitchell
Modified: 2006-04-17 15:32 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-02-01 01:48:48


Attachments
Fortran 90 source file that demonstrates bug (11.93 KB, text/plain)
2005-08-30 13:06 UTC, william.mitchell
Details

Note You need to log in before you can comment on or make changes to this bug.
Description william.mitchell 2005-08-30 13:01:05 UTC
GNU F95 version 4.0.1 (i686-pc-linux-gnu)
        compiled by GNU C version 4.0.1.

Fedora Core 1

Linux looneyjr.cam.nist.gov 2.4.25 #2 Wed Apr 21 12:08:18 EDT 2004 i686 i686
i386 GNU/Linux

mitchell@looneyjr> gfortran -v -c stopwatch.f90
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.0.1/configure
--prefix=/local/home/mitchell/tmp/gcc-4.0.1-install
-with-local-prefix=/local/home/mitchell/tmp/gcc-4.0.1-include
Thread model: posix
gcc version 4.0.1
 /local/home/mitchell/tmp/gcc-4.0.1-install/libexec/gcc/i686-pc-linux-gnu/4.0.1/f951
stopwatch.f90 -quiet -dumpbase stopwatch.f90 -mtune=pentiumpro -auxbase
stopwatch -version -o /tmp/ccK2OQTb.s
GNU F95 version 4.0.1 (i686-pc-linux-gnu)
        compiled by GNU C version 4.0.1.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
stopwatch.f90: In function ‘which_clocks_s’:
stopwatch.f90:3289: internal compiler error: in gfc_conv_expr_descriptor, at
fortran/trans-array.c:3633
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

This is my first time using Bugzilla, and I don't see where/how to attach the
source file to the report.  I hope that when I hit "commit" it will ask for it!
Comment 1 william.mitchell 2005-08-30 13:06:18 UTC
Created attachment 9622 [details]
Fortran 90 source file that demonstrates bug

Here is the source code that should have been included with this bug report. 
How was I supposed to attach it in the original report?
Comment 2 Andrew Pinski 2005-08-30 14:33:43 UTC
Confirmed, reduced testcase:
subroutine option_stopwatch_s(default_clock)
character(len=*), intent(in) :: default_clock
   call option_stopwatch_a((/default_clock/))
end subroutine option_stopwatch_s
Comment 3 Andrew Pinski 2006-01-02 03:11:37 UTC
Another testcase:
subroutine option_stopwatch_s(n)
integer :: n
character(len=1) :: default_clock
   call option_stopwatch_a((/default_clock/))
end subroutine option_stopwatch_s
Comment 4 Andrew Pinski 2006-01-02 03:12:20 UTC
(In reply to comment #3)
> Another testcase:
Ignore that one.
The correct one is:
subroutine option_stopwatch_s(n)
integer :: n
character(len=n) :: default_clock
   call option_stopwatch_a((/default_clock/))
end subroutine option_stopwatch_s 

Comment 5 Andrew Pinski 2006-02-01 01:43:11 UTC
*** Bug 26057 has been marked as a duplicate of this bug. ***
Comment 6 H.J. Lu 2006-02-01 01:48:48 UTC
I saw

Starting program: /export/build/gnu/gcc-fortran/build-x86_64-linux/gcc/f951 foo.f90 -quiet -dumpbase foo.f90 -mtune=generic -auxbase foo -version -o foo.s
GNU F95 version 4.2.0 20060131 (experimental) [trunk revision 110440 clean] (x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.2.0 20060131 (experimental) [trunk revision 110440 clean].
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072

Breakpoint 1, gfc_conv_expr_descriptor (se=0x7fbffff110, expr=0xb69130,
    ss=0xb692f0)
    at /net/gnu-13/export/gnu/src/gcc/gcc/gcc/fortran/trans-array.c:3918
3918              loop.temp_ss->string_length = gfc_conv_mpz_to_tree
(gdb) p *expr->ts.cl
$14 = {length = 0x0, next = 0x0, backend_decl = 0x2a983f3640, resolved = 1}
(gdb)
Comment 7 hjl@gcc.gnu.org 2006-04-05 04:47:54 UTC
Subject: Bug 23634

Author: hjl
Date: Wed Apr  5 04:47:51 2006
New Revision: 112695

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=112695
Log:
gcc/fortran/

2006-04-04  H.J. Lu  <hongjiu.lu@intel.com>

	PR fortran/25619
	* trans-array.c (gfc_conv_expr_descriptor): Only dereference
	character pointer when copying temporary.

	PR fortran/23634
	* trans-array.c (gfc_conv_expr_descriptor): Properly copy
	temporary character with non constant size.

gcc/testsuite/

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

	PR fortran/23634
	PR fortran/25619
	* gfortran.dg/actual_array_constructor_1.f90: New testcase.

Added:
    trunk/gcc/testsuite/gfortran.dg/actual_array_constructor_1.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-array.c
    trunk/gcc/testsuite/ChangeLog

Comment 8 hjl@gcc.gnu.org 2006-04-12 20:58:10 UTC
Subject: Bug 23634

Author: hjl
Date: Wed Apr 12 20:58:04 2006
New Revision: 112899

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=112899
Log:
gcc/fortran/

2006-04-12  H.J. Lu  <hongjiu.lu@intel.com>

	PR fortran/25619
	Backport from mainline
	2006-04-04  H.J. Lu  <hongjiu.lu@intel.com>

	* trans-array.c (gfc_conv_expr_descriptor): Only dereference
	character pointer when copying temporary.

	PR fortran/23634
	Backport from mainline
	2006-04-04  H.J. Lu  <hongjiu.lu@intel.com>

	* trans-array.c (gfc_conv_expr_descriptor): Properly copy
	temporary character with non constant size.

gcc/testsuite/

2006-04-12  H.J. Lu  <hongjiu.lu@intel.com>

	PR fortran/23634
	PR fortran/25619
	Backport from mainline
	2006-04-04  Paul Thomas  <pault@gcc.gnu.org>

	* gfortran.dg/actual_array_constructor_1.f90: New testcase.

Added:
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/actual_array_constructor_1.f90
Modified:
    branches/gcc-4_1-branch/gcc/fortran/ChangeLog
    branches/gcc-4_1-branch/gcc/fortran/trans-array.c
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog

Comment 9 Paul Thomas 2006-04-17 15:32:35 UTC
HJ has fixed this one.

Paul