public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/33888] New: ICE - CHARACTER expression using an ELEMENTAL FUNCTION as actual arg
@ 2007-10-25 1:34 w6ws at earthlink dot net
2007-10-25 6:30 ` [Bug fortran/33888] " burnus at gcc dot gnu dot org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: w6ws at earthlink dot net @ 2007-10-25 1:34 UTC (permalink / raw)
To: gcc-bugs
The following causes an ICE:
$ cat ftn95bug.f90
program ftn95bug
implicit none
character(8) :: indata(4) = (/ &
'12344321', '98766789', 'abcdefgh', 'ABCDEFGH' &
/)
call process (myfunc (indata)) ! <- This causes a gfortran ICE !
contains
elemental function myfunc (s)
character(*), intent(in) :: s
character(len (s)) :: myfunc
myfunc = s
end function
subroutine process (strings)
character(*), intent(in) :: strings(:)
print *, strings
end subroutine
end program
wws@gallifrey /cygdrive/d/usr/wws/fortran/utils
$ gfortran --version
GNU Fortran (GCC) 4.3.0 20071005 (experimental) [trunk revision 127783]
Copyright (C) 2007 Free Software Foundation, Inc.
GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Fortran
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING
wws@gallifrey /cygdrive/d/usr/wws/fortran/utils
$ gfortran ftn95bug.f90
ftn95bug.f90:8: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
wws@gallifrey /cygdrive/d/usr/wws/fortran/utils
$
--
Summary: ICE - CHARACTER expression using an ELEMENTAL FUNCTION
as actual arg
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: w6ws at earthlink dot net
GCC build triplet: i686-pc-cygwin
GCC host triplet: i686-pc-cygwin
GCC target triplet: i686-pc-cygwin
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33888
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/33888] ICE - CHARACTER expression using an ELEMENTAL FUNCTION as actual arg
2007-10-25 1:34 [Bug fortran/33888] New: ICE - CHARACTER expression using an ELEMENTAL FUNCTION as actual arg w6ws at earthlink dot net
@ 2007-10-25 6:30 ` burnus at gcc dot gnu dot org
2007-10-25 9:20 ` pault at gcc dot gnu dot org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-10-25 6:30 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from burnus at gcc dot gnu dot org 2007-10-25 06:30 -------
Valgrind:
==28333== Invalid read of size 8
==28333== at 0x73B006: get_frame_type (tree-nested.c:198)
==28333== by 0x73B387: get_chain_decl (tree-nested.c:304)
==28333== by 0x73C55C: get_nonlocal_debug_decl (tree-nested.c:851)
==28333== by 0x7401EA: convert_nonlocal_reference (tree-nested.c:922)
==28333== by 0x872C1C: walk_tree_1 (tree.c:8369)
where in gcc/tree-nested.c:
get_frame_type (struct nesting_info *info)
{
tree type = info->frame_type; // <------- line 198
--
burnus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |burnus at gcc dot gnu dot
| |org
OtherBugsDependingO| |32834
nThis| |
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
GCC build triplet|i686-pc-cygwin |
GCC host triplet|i686-pc-cygwin |
GCC target triplet|i686-pc-cygwin |
Keywords| |ice-on-valid-code
Known to fail| |4.1.2 4.2.2 4.3.0
Last reconfirmed|0000-00-00 00:00:00 |2007-10-25 06:30:06
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33888
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/33888] ICE - CHARACTER expression using an ELEMENTAL FUNCTION as actual arg
2007-10-25 1:34 [Bug fortran/33888] New: ICE - CHARACTER expression using an ELEMENTAL FUNCTION as actual arg w6ws at earthlink dot net
2007-10-25 6:30 ` [Bug fortran/33888] " burnus at gcc dot gnu dot org
@ 2007-10-25 9:20 ` pault at gcc dot gnu dot org
2007-11-30 17:05 ` pault at gcc dot gnu dot org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-10-25 9:20 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pault at gcc dot gnu dot org 2007-10-25 09:20 -------
(In reply to comment #1)
For some reason, the interface mechanism in trans-expr.c is failing for this
case of an elemental function (try a constant length for my_func or to make it
non-elemental and array valued - both work fince). You can see this in the
code that the testcase produces. The internal length variable, in my_func,
'..length' is being referenced in the main program, with inevitable
consequences!
A workaround, for now, is to write a temporary, which can be allocatable if
necessary.
character(8) :: temp(4)
......snip......
temp = myfunc (indata))
call process (temp)
A tricky alternative, to make use of automatic allocation and cleanup of
allocatable components, would be
type mytype
character(8), allocatable :: c(:)
end type mytype
type(mytype) :: temp
......snip......
temp%c = myfunc (indata))
call process (temp%c)
However, this segfaults for the same reason as the original. *sigh*
Paul
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33888
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/33888] ICE - CHARACTER expression using an ELEMENTAL FUNCTION as actual arg
2007-10-25 1:34 [Bug fortran/33888] New: ICE - CHARACTER expression using an ELEMENTAL FUNCTION as actual arg w6ws at earthlink dot net
2007-10-25 6:30 ` [Bug fortran/33888] " burnus at gcc dot gnu dot org
2007-10-25 9:20 ` pault at gcc dot gnu dot org
@ 2007-11-30 17:05 ` pault at gcc dot gnu dot org
2007-12-16 11:34 ` pault at gcc dot gnu dot org
2007-12-16 11:41 ` pault at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-11-30 17:05 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pault at gcc dot gnu dot org 2007-11-30 17:05 -------
I can see what to do - watch this spot.
Paul
--
pault at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |pault at gcc dot gnu dot org
|dot org |
Status|NEW |ASSIGNED
Last reconfirmed|2007-10-25 06:30:06 |2007-11-30 17:05:04
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33888
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/33888] ICE - CHARACTER expression using an ELEMENTAL FUNCTION as actual arg
2007-10-25 1:34 [Bug fortran/33888] New: ICE - CHARACTER expression using an ELEMENTAL FUNCTION as actual arg w6ws at earthlink dot net
` (2 preceding siblings ...)
2007-11-30 17:05 ` pault at gcc dot gnu dot org
@ 2007-12-16 11:34 ` pault at gcc dot gnu dot org
2007-12-16 11:41 ` pault at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-12-16 11:34 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from pault at gcc dot gnu dot org 2007-12-16 11:34 -------
Subject: Bug 33888
Author: pault
Date: Sun Dec 16 11:34:08 2007
New Revision: 130988
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=130988
Log:
2007-12-16 Paul Thomas <pault@gcc.gnu.org>
PR fortran/31213
PR fortran/33888
PR fortran/33998
* trans-array.c (gfc_trans_array_constructor_value): If the
iterator variable does not have a backend_decl, use a local
temporary.
(get_elemental_fcn_charlen): New function to map the character
length of an elemental function onto its actual arglist.
(gfc_conv_expr_descriptor): Call the above so that the size of
the temporary can be evaluated.
* trans-expr.c : Include arith.h and change prototype of
gfc_apply_interface_mapping_to_expr to return void. Change all
references to gfc_apply_interface_mapping_to_expr accordingly.
(gfc_free_interface_mapping): Free the 'expr' field.
(gfc_add_interface_mapping): Add an argument for the actual
argument expression. This is copied to the 'expr' field of the
mapping. Only stabilize the backend_decl if the se is present.
Copy the character length expression and only add it's backend
declaration if se is present. Return without working on the
backend declaration for the new symbol if se is not present.
(gfc_map_intrinsic_function) : To simplify intrinsics 'len',
'size', 'ubound' and 'lbound' and then to map the result.
(gfc_map_fcn_formal_to_actual): Performs the formal to actual
mapping for the case of a function found in a specification
expression in the interface being mapped.
(gfc_apply_interface_mapping_to_ref): Remove seen_result and
all its references. Remove the inline simplification of LEN
and call gfc_map_intrinsic_function instead. Change the
order of mapping of the actual arguments and simplifying
intrinsic functions. Finally, if a function maps to an
actual argument, call gfc_map_fcn_formal_to_actual.
(gfc_conv_function_call): Add 'e' to the call to
gfc_add_interface_mapping.
* dump-parse-tree.c (gfc_show_symbol_n): New function for
diagnostic purposes.
* gfortran.h : Add prototype for gfc_show_symbol_n.
* trans.h : Add 'expr' field to gfc_add_interface_mapping.
Add 'expr' to prototype for gfc_show_symbol_n.
* resolve.c (resolve_generic_f0): Set specific function as
referenced.
2007-12-16 Paul Thomas <pault@gcc.gnu.org>
PR fortran/31213
PR fortran/33888
PR fortran/33998
* gfortran.dg/mapping_1.f90: New test.
* gfortran.dg/mapping_2.f90: New test.
* gfortran.dg/mapping_3.f90: New test.
Added:
trunk/gcc/testsuite/gfortran.dg/mapping_1.f90
trunk/gcc/testsuite/gfortran.dg/mapping_2.f90
trunk/gcc/testsuite/gfortran.dg/mapping_3.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/dump-parse-tree.c
trunk/gcc/fortran/gfortran.h
trunk/gcc/fortran/resolve.c
trunk/gcc/fortran/trans-array.c
trunk/gcc/fortran/trans-expr.c
trunk/gcc/fortran/trans.h
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33888
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/33888] ICE - CHARACTER expression using an ELEMENTAL FUNCTION as actual arg
2007-10-25 1:34 [Bug fortran/33888] New: ICE - CHARACTER expression using an ELEMENTAL FUNCTION as actual arg w6ws at earthlink dot net
` (3 preceding siblings ...)
2007-12-16 11:34 ` pault at gcc dot gnu dot org
@ 2007-12-16 11:41 ` pault at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-12-16 11:41 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from pault at gcc dot gnu dot org 2007-12-16 11:41 -------
Fixed on trunk
Paul
--
pault at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33888
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-12-16 11:41 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-25 1:34 [Bug fortran/33888] New: ICE - CHARACTER expression using an ELEMENTAL FUNCTION as actual arg w6ws at earthlink dot net
2007-10-25 6:30 ` [Bug fortran/33888] " burnus at gcc dot gnu dot org
2007-10-25 9:20 ` pault at gcc dot gnu dot org
2007-11-30 17:05 ` pault at gcc dot gnu dot org
2007-12-16 11:34 ` pault at gcc dot gnu dot org
2007-12-16 11:41 ` 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).