public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/45244] New: Incorrect passing of character string array argument triggers an internal compiler error
@ 2010-08-10 2:07 Eric dot Zurcher at csiro dot au
2010-08-10 2:17 ` [Bug fortran/45244] " Eric dot Zurcher at csiro dot au
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Eric dot Zurcher at csiro dot au @ 2010-08-10 2:07 UTC (permalink / raw)
To: gcc-bugs
--
Summary: Incorrect passing of character string array argument
triggers an internal compiler error
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: Eric dot Zurcher at csiro dot au
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45244
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/45244] Incorrect passing of character string array argument triggers an internal compiler error
2010-08-10 2:07 [Bug fortran/45244] New: Incorrect passing of character string array argument triggers an internal compiler error Eric dot Zurcher at csiro dot au
@ 2010-08-10 2:17 ` Eric dot Zurcher at csiro dot au
2010-08-10 2:37 ` kargl at gcc dot gnu dot org
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Eric dot Zurcher at csiro dot au @ 2010-08-10 2:17 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from Eric dot Zurcher at csiro dot au 2010-08-10 02:16 -------
The FORTRAN code given below causes gfortran to fail with the message:
f951.exe: internal compiler error: Segmentation fault
I have tested this using the Mingw32 version of gfortran 4.5.0, and version
4.3.2 on SUSE Linux.
The code does contain a known error: the argument "variable" should be passed
as an array of strings, not as just the first string in the array. However,
this incorrect code should not cause the compiler to segmentation fault.
Module BugDemo
integer M
parameter (M=100)
Type aRecord
SEQUENCE
character soil_type(0:M)*20
End Type aRecord
Type (aRecord),Pointer :: p
contains
! ====================================================================
subroutine read_char_array
. (section_name, variable_name, size_of,
. units, variable, numvals)
! ====================================================================
implicit none
!+ Sub-Program Arguments
character section_name*(*) ! (INPUT) section name to search for
character variable_name*(*) ! (INPUT) Variable name to search for
integer size_of ! (INPUT) size_of of array
character units*(*) ! (INPUT) Units required by caller
character variable(*)*(*) ! (OUTPUT) Variable returned to caller
integer numvals ! (OUTPUT) Number of values returned
logical found
!- Implementation Section ----------------------------------
found = .TRUE.
return
end subroutine
subroutine dotest
!Use ReadModule
Implicit None
integer numvals
allocate(p)
call Read_char_array (
: 'init',
: 'soil_type',
: M+1,
: '(?)',
: p%soil_type(0), ! THIS IS WRONG
: numvals)
deallocate(p)
return
end subroutine
end module BugDemo
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45244
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/45244] Incorrect passing of character string array argument triggers an internal compiler error
2010-08-10 2:07 [Bug fortran/45244] New: Incorrect passing of character string array argument triggers an internal compiler error Eric dot Zurcher at csiro dot au
2010-08-10 2:17 ` [Bug fortran/45244] " Eric dot Zurcher at csiro dot au
@ 2010-08-10 2:37 ` kargl at gcc dot gnu dot org
2010-08-10 17:50 ` kargl at gcc dot gnu dot org
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: kargl at gcc dot gnu dot org @ 2010-08-10 2:37 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from kargl at gcc dot gnu dot org 2010-08-10 02:37 -------
Created an attachment (id=21444)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21444&action=view)
Reduced testcase
Reduced testcase. gdb shows
Program received signal SIGSEGV, Segmentation fault.
0x080ed4c0 in compare_actual_formal (ap=0x4969174c, formal=0x495054e8,
ranks_must_agree=0, is_elemental=0, where=0x4969171c)
at ../../gcc4x/gcc/fortran/interface.c:1606
warning: Source file is more recent than executable.
1606 if (ref->type == REF_ARRAY && ref->u.ar.type == AR_ELEMENT
(gdb) bt
#0 0x080ed4c0 in compare_actual_formal (ap=0x4969174c, formal=0x495054e8,
ranks_must_agree=0, is_elemental=0, where=0x4969171c)
at ../../gcc4x/gcc/fortran/interface.c:1606
#1 0x080eec1c in gfc_procedure_use (sym=0x496973c0, ap=0x4969174c,
where=0x4969171c) at ../../gcc4x/gcc/fortran/interface.c:2623
#2 0x0812a978 in resolve_call (c=0x49691710)
at ../../gcc4x/gcc/fortran/resolve.c:3288
#3 0x0812b341 in resolve_code (code=0x49691710, ns=0x49623200)
at ../../gcc4x/gcc/fortran/resolve.c:8617
#4 0x0812c453 in resolve_codes (ns=0x49623200)
at ../../gcc4x/gcc/fortran/resolve.c:13052
#5 0x0812c37c in resolve_codes (ns=0x49621d00)
at ../../gcc4x/gcc/fortran/resolve.c:13038
#6 0x0812c52c in gfc_resolve (ns=0x49621d00)
at ../../gcc4x/gcc/fortran/resolve.c:13079
#7 0x0811f4c7 in gfc_parse_file () at ../../gcc4x/gcc/fortran/parse.c:4379
#8 0x08153e30 in gfc_be_parse_file (set_yydebug=0)
at ../../gcc4x/gcc/fortran/f95-lang.c:236
#9 0x0848fc35 in do_compile () at ../../gcc4x/gcc/toplev.c:978
#10 0x084909c6 in toplev_main (argc=2, argv=0xbfbfe57c)
at ../../gcc4x/gcc/toplev.c:2374
#11 0x081ada92 in main (argc=4, argv=0x6) at ../../gcc4x/gcc/main.c:36
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45244
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/45244] Incorrect passing of character string array argument triggers an internal compiler error
2010-08-10 2:07 [Bug fortran/45244] New: Incorrect passing of character string array argument triggers an internal compiler error Eric dot Zurcher at csiro dot au
2010-08-10 2:17 ` [Bug fortran/45244] " Eric dot Zurcher at csiro dot au
2010-08-10 2:37 ` kargl at gcc dot gnu dot org
@ 2010-08-10 17:50 ` kargl at gcc dot gnu dot org
2010-08-10 20:19 ` kargl at gcc dot gnu dot org
2010-08-10 20:43 ` mikael at gcc dot gnu dot org
4 siblings, 0 replies; 7+ messages in thread
From: kargl at gcc dot gnu dot org @ 2010-08-10 17:50 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from kargl at gcc dot gnu dot org 2010-08-10 17:49 -------
Might as well confirm the bug.
This patch stops the segmentation fault, but I do not know
if it is the correct fix.
Index: interface.c
===================================================================
--- interface.c (revision 163075)
+++ interface.c (working copy)
@@ -1611,7 +1611,8 @@ compare_parameter (gfc_symbol *formal, g
if (formal->ts.type == BT_CHARACTER
&& (ref == NULL
|| (actual->expr_type == EXPR_VARIABLE
- && (actual->symtree->n.sym->as->type == AS_ASSUMED_SHAPE
+ && ((actual->symtree->n.sym->as
+ && actual->symtree->n.sym->as->type == AS_ASSUMED_SHAPE)
|| actual->symtree->n.sym->attr.pointer))))
{
if (where && (gfc_option.allow_std & GFC_STD_F2003) == 0)
--
kargl at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2010-08-10 17:49:56
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45244
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/45244] Incorrect passing of character string array argument triggers an internal compiler error
2010-08-10 2:07 [Bug fortran/45244] New: Incorrect passing of character string array argument triggers an internal compiler error Eric dot Zurcher at csiro dot au
` (2 preceding siblings ...)
2010-08-10 17:50 ` kargl at gcc dot gnu dot org
@ 2010-08-10 20:19 ` kargl at gcc dot gnu dot org
2010-08-10 20:43 ` mikael at gcc dot gnu dot org
4 siblings, 0 replies; 7+ messages in thread
From: kargl at gcc dot gnu dot org @ 2010-08-10 20:19 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from kargl at gcc dot gnu dot org 2010-08-10 20:19 -------
The patch in comment #4 passes regression testing on x86_64-*-freebsd.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45244
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/45244] Incorrect passing of character string array argument triggers an internal compiler error
2010-08-10 2:07 [Bug fortran/45244] New: Incorrect passing of character string array argument triggers an internal compiler error Eric dot Zurcher at csiro dot au
` (3 preceding siblings ...)
2010-08-10 20:19 ` kargl at gcc dot gnu dot org
@ 2010-08-10 20:43 ` mikael at gcc dot gnu dot org
4 siblings, 0 replies; 7+ messages in thread
From: mikael at gcc dot gnu dot org @ 2010-08-10 20:43 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from mikael at gcc dot gnu dot org 2010-08-10 20:42 -------
(In reply to comment #3)
> Might as well confirm the bug.
>
> This patch stops the segmentation fault, but I do not know
> if it is the correct fix.
>
I think the correct fix here is to take the array spec (and maybe the pointer
attribute as well) from the derived type component instead of the symbol.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45244
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/45244] Incorrect passing of character string array argument triggers an internal compiler error
[not found] <bug-45244-4@http.gcc.gnu.org/bugzilla/>
@ 2011-02-12 20:27 ` burnus at gcc dot gnu.org
0 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-02-12 20:27 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45244
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |burnus at gcc dot gnu.org
Resolution| |DUPLICATE
--- Comment #6 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-02-12 19:28:14 UTC ---
The problem reported in this PR is a bit different from the one in PR 47569,
but the patch for it also fixes this PR.
See bug 47569 comment 8 and 9 - or the patch at
http://gcc.gnu.org/ml/fortran/2011-02/msg00087.html
Thanks for the bug report - and sorry for the delay. And thanks for Dominique
for pointing out that the patch for PR 47569 also fixes this bug.
*** This bug has been marked as a duplicate of bug 47569 ***
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-02-12 19:28 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-10 2:07 [Bug fortran/45244] New: Incorrect passing of character string array argument triggers an internal compiler error Eric dot Zurcher at csiro dot au
2010-08-10 2:17 ` [Bug fortran/45244] " Eric dot Zurcher at csiro dot au
2010-08-10 2:37 ` kargl at gcc dot gnu dot org
2010-08-10 17:50 ` kargl at gcc dot gnu dot org
2010-08-10 20:19 ` kargl at gcc dot gnu dot org
2010-08-10 20:43 ` mikael at gcc dot gnu dot org
[not found] <bug-45244-4@http.gcc.gnu.org/bugzilla/>
2011-02-12 20:27 ` burnus 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).