public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/42053] New: [OOP] SELECT TYPE: reject duplicate CLASS IS blocks
@ 2009-11-15 20:03 janus at gcc dot gnu dot org
2009-11-22 13:47 ` [Bug fortran/42053] " janus at gcc dot gnu dot org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-11-15 20:03 UTC (permalink / raw)
To: gcc-bugs
>From the Fortran 2003 standard:
C817 (R823) For a given select-type-construct, the same type and kind type
parameter values shall not be specified in more than one TYPE IS
type-guard-stmt and shall not be specified in more than one CLASS IS
type-guard-stmt.
This check is missing for CLASS IS blocks, as the following program is
currently accepted (by the fortran-dev branch):
type :: t
integer :: i
end type
CLASS(t),pointer :: x
select type (x)
class is (t)
print *,"a"
class is (t)
print *,"b"
end select
end
--
Summary: [OOP] SELECT TYPE: reject duplicate CLASS IS blocks
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Keywords: accepts-invalid
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: janus at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42053
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/42053] [OOP] SELECT TYPE: reject duplicate CLASS IS blocks
2009-11-15 20:03 [Bug fortran/42053] New: [OOP] SELECT TYPE: reject duplicate CLASS IS blocks janus at gcc dot gnu dot org
@ 2009-11-22 13:47 ` janus at gcc dot gnu dot org
2009-11-23 8:47 ` janus at gcc dot gnu dot org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-11-22 13:47 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from janus at gcc dot gnu dot org 2009-11-22 13:46 -------
Draft patch:
Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c (revision 154423)
+++ gcc/fortran/resolve.c (working copy)
@@ -7035,6 +7035,14 @@ resolve_select_type (gfc_code *code)
for (c1 = &class_is; (*c1) && (*c1)->block; c1 = &((*c1)->block))
{
c2 = (*c1)->block;
+ /* F03:C817 (check for doubles). */
+ if ((*c1)->ext.case_list->ts.u.derived->hash_value
+ == c2->ext.case_list->ts.u.derived->hash_value)
+ {
+ gfc_error ("Double CLASS IS block in SELECT TYPE "
+ "statement at %L", &c2->ext.case_list->where);
+ return;
+ }
if ((*c1)->ext.case_list->ts.u.derived->attr.extension
< c2->ext.case_list->ts.u.derived->attr.extension)
{
--
janus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |janus at gcc dot gnu dot org
|dot org |
Status|UNCONFIRMED |ASSIGNED
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2009-11-22 13:46:59
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42053
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/42053] [OOP] SELECT TYPE: reject duplicate CLASS IS blocks
2009-11-15 20:03 [Bug fortran/42053] New: [OOP] SELECT TYPE: reject duplicate CLASS IS blocks janus at gcc dot gnu dot org
2009-11-22 13:47 ` [Bug fortran/42053] " janus at gcc dot gnu dot org
@ 2009-11-23 8:47 ` janus at gcc dot gnu dot org
2009-11-23 8:49 ` janus at gcc dot gnu dot org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-11-23 8:47 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from janus at gcc dot gnu dot org 2009-11-23 08:47 -------
Subject: Bug 42053
Author: janus
Date: Mon Nov 23 08:47:14 2009
New Revision: 154432
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=154432
Log:
2009-11-23 Janus Weil <janus@gcc.gnu.org>
PR fortran/42053
* resolve.c (resolve_select_type): Check for duplicate CLASS IS blocks.
2009-11-23 Janus Weil <janus@gcc.gnu.org>
PR fortran/42053
* gfortran.dg/select_type_9.f03: New.
Added:
branches/fortran-dev/gcc/testsuite/gfortran.dg/select_type_9.f03
Modified:
branches/fortran-dev/gcc/fortran/ChangeLog.fortran-dev
branches/fortran-dev/gcc/fortran/resolve.c
branches/fortran-dev/gcc/testsuite/ChangeLog.fortran-dev
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42053
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/42053] [OOP] SELECT TYPE: reject duplicate CLASS IS blocks
2009-11-15 20:03 [Bug fortran/42053] New: [OOP] SELECT TYPE: reject duplicate CLASS IS blocks janus at gcc dot gnu dot org
2009-11-22 13:47 ` [Bug fortran/42053] " janus at gcc dot gnu dot org
2009-11-23 8:47 ` janus at gcc dot gnu dot org
@ 2009-11-23 8:49 ` janus at gcc dot gnu dot org
2009-11-30 20:43 ` janus at gcc dot gnu dot org
2009-11-30 21:24 ` janus at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-11-23 8:49 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from janus at gcc dot gnu dot org 2009-11-23 08:49 -------
Fixed with r154432. Closing.
--
janus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42053
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/42053] [OOP] SELECT TYPE: reject duplicate CLASS IS blocks
2009-11-15 20:03 [Bug fortran/42053] New: [OOP] SELECT TYPE: reject duplicate CLASS IS blocks janus at gcc dot gnu dot org
` (2 preceding siblings ...)
2009-11-23 8:49 ` janus at gcc dot gnu dot org
@ 2009-11-30 20:43 ` janus at gcc dot gnu dot org
2009-11-30 21:24 ` janus at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-11-30 20:43 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from janus at gcc dot gnu dot org 2009-11-30 20:43 -------
Subject: Bug 42053
Author: janus
Date: Mon Nov 30 20:43:06 2009
New Revision: 154840
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=154840
Log:
merge from fortran-dev branch:
gcc/fortran/
2009-11-30 Janus Weil <janus@gcc.gnu.org>
PR fortran/42053
* resolve.c (resolve_select_type): Check for duplicate CLASS IS blocks.
2009-11-30 Janus Weil <janus@gcc.gnu.org>
PR fortran/41631
* decl.c (gfc_match_derived_decl): Set extension level.
* gfortran.h (symbol_attribute): Expand 'extension' bit field to 8 bit.
* iresolve.c (gfc_resolve_extends_type_of): Return value of
'is_extension_of' has kind=4.
* match.c (select_type_set_tmp,gfc_match_class_is): Create temporary
for CLASS IS blocks.
* module.c (MOD_VERSION): Bump module version.
(ab_attribute,attr_bits): Remove AB_EXTENSION.
(mio_symbol_attribute): Handle expanded 'extension' field.
* resolve.c (resolve_select_type): Implement CLASS IS blocks.
(resolve_fl_variable_derived): Show correct type name.
* symbol.c (gfc_build_class_symbol): Set extension level.
2009-11-30 Janus Weil <janus@gcc.gnu.org>
* intrinsic.h (gfc_resolve_extends_type_of): Add prototype.
* intrinsic.c (add_functions): Use 'gfc_resolve_extends_type_of'.
* iresolve.c (gfc_resolve_extends_type_of): New function, which
replaces the call to EXTENDS_TYPE_OF by the library function
'is_extension_of' and modifies the arguments.
* trans-intrinsic.c (gfc_conv_extends_type_of): Removed.
(gfc_conv_intrinsic_function): FOR EXTENDS_TYPE_OF, don't call
gfc_conv_extends_type_of but gfc_conv_intrinsic_funcall.
2009-11-30 Paul Thomas <pault@gcc.gnu.org>
Janus Weil <janus@gcc.gnu.org>
* decl.c (encapsulate_class_symbol): Replaced by
'gfc_build_class_symbol'.
(build_sym,build_struct): Call 'gfc_build_class_symbol'.
(gfc_match_derived_decl): Replace vindex by hash_value.
* dump-parse-tree.c (show_symbol): Replace vindex by hash_value.
* gfortran.h (symbol_attribute): Add field 'vtab'.
(gfc_symbol): Replace vindex by hash_value.
(gfc_class_esym_list): Ditto.
(gfc_get_derived_type,gfc_build_class_symbol,gfc_find_derived_vtab):
New prototypes.
* module.c (mio_symbol): Replace vindex by hash_value.
* resolve.c (vindex_expr): Rename to 'hash_value_expr'.
(resolve_class_compcall,resolve_class_typebound_call): Renamed
'vindex_expr'.
(resolve_select_type): Replace $vindex by $vptr->$hash.
* symbol.c (gfc_add_save): Handle vtab symbols.
(gfc_type_compatible): Rewrite.
(gfc_build_class_symbol): New function which replaces
'encapsulate_class_symbol'.
(gfc_find_derived_vtab): New function to set up a vtab symbol for a
derived type.
* trans-decl.c (gfc_create_module_variable): Handle vtab symbols.
* trans-expr.c (select_class_proc): Replace vindex by hash_value.
(gfc_conv_derived_to_class): New function to construct a temporary
CLASS variable from a derived type expression.
(gfc_conv_procedure_call): Call 'gfc_conv_derived_to_class'.
(gfc_conv_structure): Initialize the $extends and $size fields of
vtab symbols.
(gfc_trans_class_assign): Replace $vindex by $vptr. Remove the $size
assignment.
* trans-intrinsic.c (gfc_conv_same_type_as): Replace $vindex by
$vptr->$hash, and replace vindex by hash_value.
* trans-stmt.c (gfc_trans_allocate): Insert $vptr references, replace
$vindex by $vptr. Remove the $size assignment.
* trans-types.c (gfc_get_derived_type): Make it non-static.
gcc/testsuite/
2009-11-30 Janus Weil <janus@gcc.gnu.org>
PR fortran/42053
* gfortran.dg/select_type_9.f03: New.
2009-11-30 Janus Weil <janus@gcc.gnu.org>
PR fortran/41631
* gfortran.dg/extends_type_of_1.f03: Fix invalid test case.
* gfortran.dg/module_md5_1.f90: Adjusted MD5 sum.
* gfortran.dg/select_type_1.f03: Remove FIXMEs.
* gfortran.dg/select_type_2.f03: Ditto.
* gfortran.dg/select_type_8.f03: New test.
2009-11-30 Janus Weil <janus@gcc.gnu.org>
* gfortran.dg/extends_type_of_1.f03: New test.
* gfortran.dg/same_type_as_1.f03: Extended.
2009-11-30 Paul Thomas <pault@gcc.gnu.org>
* gfortran.dg/class_4c.f03: Add dg-additional-sources.
* gfortran.dg/class_4d.f03: Rename module. Cleanup modules.
libgfortran/
2009-11-30 Janus Weil <janus@gcc.gnu.org>
* gfortran.map: Add _gfortran_is_extension_of.
* Makefile.am: Add intrinsics/extends_type_of.c.
* Makefile.in: Regenerated.
* intrinsics/extends_type_of.c: New file.
Added:
trunk/gcc/testsuite/gfortran.dg/extends_type_of_1.f03
trunk/gcc/testsuite/gfortran.dg/select_type_8.f03
trunk/gcc/testsuite/gfortran.dg/select_type_9.f03
trunk/libgfortran/intrinsics/extends_type_of.c
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/decl.c
trunk/gcc/fortran/dump-parse-tree.c
trunk/gcc/fortran/gfortran.h
trunk/gcc/fortran/intrinsic.c
trunk/gcc/fortran/intrinsic.h
trunk/gcc/fortran/iresolve.c
trunk/gcc/fortran/match.c
trunk/gcc/fortran/module.c
trunk/gcc/fortran/resolve.c
trunk/gcc/fortran/symbol.c
trunk/gcc/fortran/trans-decl.c
trunk/gcc/fortran/trans-expr.c
trunk/gcc/fortran/trans-intrinsic.c
trunk/gcc/fortran/trans-stmt.c
trunk/gcc/fortran/trans-types.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gfortran.dg/class_4c.f03
trunk/gcc/testsuite/gfortran.dg/class_4d.f03
trunk/gcc/testsuite/gfortran.dg/module_md5_1.f90
trunk/gcc/testsuite/gfortran.dg/same_type_as_1.f03
trunk/gcc/testsuite/gfortran.dg/select_type_1.f03
trunk/gcc/testsuite/gfortran.dg/select_type_2.f03
trunk/libgfortran/ChangeLog
trunk/libgfortran/Makefile.am
trunk/libgfortran/Makefile.in
trunk/libgfortran/gfortran.map
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42053
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/42053] [OOP] SELECT TYPE: reject duplicate CLASS IS blocks
2009-11-15 20:03 [Bug fortran/42053] New: [OOP] SELECT TYPE: reject duplicate CLASS IS blocks janus at gcc dot gnu dot org
` (3 preceding siblings ...)
2009-11-30 20:43 ` janus at gcc dot gnu dot org
@ 2009-11-30 21:24 ` janus at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-11-30 21:24 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from janus at gcc dot gnu dot org 2009-11-30 21:24 -------
Fixed on trunk with r154840.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42053
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-11-30 21:24 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-15 20:03 [Bug fortran/42053] New: [OOP] SELECT TYPE: reject duplicate CLASS IS blocks janus at gcc dot gnu dot org
2009-11-22 13:47 ` [Bug fortran/42053] " janus at gcc dot gnu dot org
2009-11-23 8:47 ` janus at gcc dot gnu dot org
2009-11-23 8:49 ` janus at gcc dot gnu dot org
2009-11-30 20:43 ` janus at gcc dot gnu dot org
2009-11-30 21:24 ` janus 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).