[Bug fortran/36517] Type-spec in array constructor: Invalid error for -std=f2003/f2008
--- Comment #5 from domob at gcc dot gnu dot org 2008-06-18 13:54 --- Subject: Bug 36517 Author: domob Date: Wed Jun 18 13:53:32 2008 New Revision: 136894 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=136894 Log: 2008-06-18 Daniel Kraft [EMAIL PROTECTED] PR fortran/36517, fortran/36492 * gfortran.dg/array_constructor_25.f03: New test. * gfortran.dg/array_constructor_26.f03: New test. * gfortran.dg/array_constructor_27.f03: New test. * gfortran.dg/array_constructor_28.f03: New test. * gfortran.dg/array_constructor_29.f03: New test. * gfortran.dg/array_constructor_30.f03: New test. * gfortran.dg/array_constructor_type_19.f03: New test. * gfortran.dg/array_constructor_type_20.f03: New test. * gfortran.dg/array_constructor_type_21.f03: New test. 2008-06-18 Daniel Kraft [EMAIL PROTECTED] PR fortran/36517, fortran/36492 * array.c (gfc_resolve_character_array_constructor): Call gfc_set_constant_character_len with changed length-chec argument. * decl.c (gfc_set_constant_character_len): Changed array argument to be a generic length-checking argument that can be used for correct checking with typespec and in special cases where the should-be length is different from the target length. (build_struct): Call gfc_set_constant_character_len with changed length checking argument and introduced additional checks for exceptional conditions on invalid code. (add_init_expr_to_sym), (do_parm): Call gfc_set_constant_character_len with changed argument. * match.h (gfc_set_constant_character_len): Changed third argument to int for the should-be length rather than bool. Added: trunk/gcc/testsuite/gfortran.dg/array_constructor_25.f03 trunk/gcc/testsuite/gfortran.dg/array_constructor_26.f03 trunk/gcc/testsuite/gfortran.dg/array_constructor_27.f03 trunk/gcc/testsuite/gfortran.dg/array_constructor_28.f03 trunk/gcc/testsuite/gfortran.dg/array_constructor_29.f03 trunk/gcc/testsuite/gfortran.dg/array_constructor_30.f03 trunk/gcc/testsuite/gfortran.dg/array_constructor_type_19.f03 trunk/gcc/testsuite/gfortran.dg/array_constructor_type_20.f03 trunk/gcc/testsuite/gfortran.dg/array_constructor_type_21.f03 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/array.c trunk/gcc/fortran/decl.c trunk/gcc/fortran/match.h trunk/gcc/testsuite/ChangeLog -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36517
[Bug fortran/36517] Type-spec in array constructor: Invalid error for -std=f2003/f2008
--- Comment #6 from domob at gcc dot gnu dot org 2008-06-18 13:56 --- Fixed. -- domob at gcc dot gnu dot org changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution||FIXED Target Milestone|--- |4.4.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36517
[Bug fortran/36517] Type-spec in array constructor: Invalid error for -std=f2003/f2008
--- Comment #1 from burnus at gcc dot gnu dot org 2008-06-13 09:54 --- Also occurs for -std=f2003 with print *, [ character(len=2) :: 'a', 'bb' ] - adjust bug summary -- burnus at gcc dot gnu dot org changed: What|Removed |Added Summary|Type-spec in array |Type-spec in array |constructor ignored for |constructor: Invalid error |PARAMETER |for -std=f2003/f2008 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36517
[Bug fortran/36517] Type-spec in array constructor: Invalid error for -std=f2003/f2008
--- Comment #2 from burnus at gcc dot gnu dot org 2008-06-13 13:30 --- Daniel, as you have implemented the constructor with type spec, maybe you have an idea how to fix this best. The error message is generated in decl.c's gfc_set_constant_character_len. The problem is that for -std=f2003 the same error is generated as if no type-spec were present; gfc_set_constant_character_len is called at three places (with argument array=true). I believe we forgot to test character string when implementing it - and characters are always special due to the LENGTH type parameter. (The length-type parameter of derived types will also be fun, but it will probably not be implemented soon.) -- burnus at gcc dot gnu dot org changed: What|Removed |Added CC||d at domob dot eu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36517
[Bug fortran/36517] Type-spec in array constructor: Invalid error for -std=f2003/f2008
--- Comment #3 from d at domob dot eu 2008-06-13 17:04 --- Confirmed. I'll try to get this fixed! Might be funny, as I can't yet think of any reason why -std= should affect such a behaviour... But I also haven't looked at the code for this one deeper, so hopefully I'll find out soon! -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36517
[Bug fortran/36517] Type-spec in array constructor: Invalid error for -std=f2003/f2008
--- Comment #4 from d at domob dot eu 2008-06-13 17:53 --- Created an attachment (id=15770) -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15770action=view) Probably obvious fix. Attached a simple fix by disabling this error if we are inside an array-constructor with typespec; the two tests above are included in the patch and work now. Regression-testing is just running, but I don't expect any errors there. If it succeeds, I'll submit the patch to gcc-patches. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36517