public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/36517] New: Type-spec in array constructor ignored for PARAMETER
@ 2008-06-13 6:12 burnus at gcc dot gnu dot org
2008-06-13 9:55 ` [Bug fortran/36517] Type-spec in array constructor: Invalid error for -std=f2003/f2008 burnus at gcc dot gnu dot org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-06-13 6:12 UTC (permalink / raw)
To: gcc-bugs
Type spec support for constructors was implemented in PR27997, however, it is
not honored for the -std=f* checking for PARAMETERs.
The following program works with default options, however, using -std=f2003 one
gets the follow error message:
Error: The CHARACTER elements of the array constructor at (1) must have the
same length (1/3)
(To compile the first two lines, the patch of PR36476 is needed.)
CHARACTER (len=*) MY_STRING(1:3)
PARAMETER ( MY_STRING = (/CHARACTER (len=3) :: "AC" , "B", "C" /) )
character(len=*), parameter :: str(2) = [character(len=3):: 'A','cc']
end
--
Summary: Type-spec in array constructor ignored for PARAMETER
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: burnus at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36517
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/36517] Type-spec in array constructor: Invalid error for -std=f2003/f2008
2008-06-13 6:12 [Bug fortran/36517] New: Type-spec in array constructor ignored for PARAMETER burnus at gcc dot gnu dot org
@ 2008-06-13 9:55 ` burnus at gcc dot gnu dot org
2008-06-13 13:30 ` burnus at gcc dot gnu dot org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-06-13 9:55 UTC (permalink / raw)
To: gcc-bugs
------- 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
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/36517] Type-spec in array constructor: Invalid error for -std=f2003/f2008
2008-06-13 6:12 [Bug fortran/36517] New: Type-spec in array constructor ignored for PARAMETER burnus at gcc dot gnu dot org
2008-06-13 9:55 ` [Bug fortran/36517] Type-spec in array constructor: Invalid error for -std=f2003/f2008 burnus at gcc dot gnu dot org
@ 2008-06-13 13:30 ` burnus at gcc dot gnu dot org
2008-06-13 17:04 ` d at domob dot eu
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-06-13 13:30 UTC (permalink / raw)
To: gcc-bugs
------- 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
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/36517] Type-spec in array constructor: Invalid error for -std=f2003/f2008
2008-06-13 6:12 [Bug fortran/36517] New: Type-spec in array constructor ignored for PARAMETER burnus at gcc dot gnu dot org
2008-06-13 9:55 ` [Bug fortran/36517] Type-spec in array constructor: Invalid error for -std=f2003/f2008 burnus at gcc dot gnu dot org
2008-06-13 13:30 ` burnus at gcc dot gnu dot org
@ 2008-06-13 17:04 ` d at domob dot eu
2008-06-13 17:54 ` d at domob dot eu
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: d at domob dot eu @ 2008-06-13 17:04 UTC (permalink / raw)
To: gcc-bugs
------- 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
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/36517] Type-spec in array constructor: Invalid error for -std=f2003/f2008
2008-06-13 6:12 [Bug fortran/36517] New: Type-spec in array constructor ignored for PARAMETER burnus at gcc dot gnu dot org
` (2 preceding siblings ...)
2008-06-13 17:04 ` d at domob dot eu
@ 2008-06-13 17:54 ` d at domob dot eu
2008-06-18 13:55 ` domob at gcc dot gnu dot org
2008-06-18 13:57 ` domob at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: d at domob dot eu @ 2008-06-13 17:54 UTC (permalink / raw)
To: gcc-bugs
------- 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=15770&action=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
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/36517] Type-spec in array constructor: Invalid error for -std=f2003/f2008
2008-06-13 6:12 [Bug fortran/36517] New: Type-spec in array constructor ignored for PARAMETER burnus at gcc dot gnu dot org
` (3 preceding siblings ...)
2008-06-13 17:54 ` d at domob dot eu
@ 2008-06-18 13:55 ` domob at gcc dot gnu dot org
2008-06-18 13:57 ` domob at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: domob at gcc dot gnu dot org @ 2008-06-18 13:55 UTC (permalink / raw)
To: gcc-bugs
------- 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=gcc&view=rev&rev=136894
Log:
2008-06-18 Daniel Kraft <d@domob.eu>
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 <d@domob.eu>
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/36517] Type-spec in array constructor: Invalid error for -std=f2003/f2008
2008-06-13 6:12 [Bug fortran/36517] New: Type-spec in array constructor ignored for PARAMETER burnus at gcc dot gnu dot org
` (4 preceding siblings ...)
2008-06-18 13:55 ` domob at gcc dot gnu dot org
@ 2008-06-18 13:57 ` domob at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: domob at gcc dot gnu dot org @ 2008-06-18 13:57 UTC (permalink / raw)
To: gcc-bugs
------- 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
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2008-06-18 13:57 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-13 6:12 [Bug fortran/36517] New: Type-spec in array constructor ignored for PARAMETER burnus at gcc dot gnu dot org
2008-06-13 9:55 ` [Bug fortran/36517] Type-spec in array constructor: Invalid error for -std=f2003/f2008 burnus at gcc dot gnu dot org
2008-06-13 13:30 ` burnus at gcc dot gnu dot org
2008-06-13 17:04 ` d at domob dot eu
2008-06-13 17:54 ` d at domob dot eu
2008-06-18 13:55 ` domob at gcc dot gnu dot org
2008-06-18 13:57 ` domob 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).