[Bug fortran/45244] Incorrect passing of character string array argument triggers an internal compiler error
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45244 Tobias Burnus changed: What|Removed |Added Status|NEW |RESOLVED CC||burnus at gcc dot gnu.org Resolution||DUPLICATE --- Comment #6 from Tobias Burnus 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 ***
[Bug fortran/45244] Incorrect passing of character string array argument triggers an internal compiler error
--- 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
[Bug fortran/45244] Incorrect passing of character string array argument triggers an internal compiler error
--- 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
[Bug fortran/45244] Incorrect passing of character string array argument triggers an internal compiler error
--- 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|-00-00 00:00:00 |2010-08-10 17:49:56 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45244
[Bug fortran/45244] Incorrect passing of character string array argument triggers an internal compiler error
--- 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. 1606if (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
[Bug fortran/45244] Incorrect passing of character string array argument triggers an internal compiler error
--- 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 charactersoil_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