public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "janus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/49213] [OOP] gfortran rejects structure constructor expression
Date: Thu, 10 Jan 2013 15:46:00 -0000 [thread overview]
Message-ID: <bug-49213-4-IWqsTPWAkw@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-49213-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49213
--- Comment #8 from janus at gcc dot gnu.org 2013-01-10 15:46:12 UTC ---
(In reply to comment #7)
> I want to emphasize again that the error I wanted to report was that gfortran
> is rejecting valid structure constructor expressions (see comment 3).
Here is a slightly reduced version of comment 3:
type :: S
integer :: n
end type
type(S) :: Sobj
type :: T
class(S), allocatable :: x
end type
Sobj = S(1)
call pass_it (T(Sobj))
contains
subroutine pass_it (foo)
type(T) :: foo
end subroutine
end
One can get past the error message with the following patch:
Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c (revision 194927)
+++ gcc/fortran/resolve.c (working copy)
@@ -1103,7 +1103,7 @@ resolve_structure_cons (gfc_expr *expr, int init)
/* If we don't have the right type, try to convert it. */
if (!comp->attr.proc_pointer &&
- !gfc_compare_types (&cons->expr->ts, &comp->ts))
+ !gfc_compare_types (&comp->ts, &cons->expr->ts))
{
t = FAILURE;
if (strcmp (comp->name, "_extends") == 0)
but the one runs into an ICE:
internal compiler error: in fold_convert_loc, at fold-const.c:1986
call pass_it (T(Sobj))
^
0x845634 fold_convert_loc(unsigned int, tree_node*, tree_node*)
/home/jweil/gcc48/trunk/gcc/fold-const.c:1986
0x671aa9 gfc_trans_subcomponent_assign
/home/jweil/gcc48/trunk/gcc/fortran/trans-expr.c:6001
0x671e10 gfc_trans_structure_assign
/home/jweil/gcc48/trunk/gcc/fortran/trans-expr.c:6068
0x671f46 gfc_conv_structure(gfc_se*, gfc_expr*, int)
/home/jweil/gcc48/trunk/gcc/fortran/trans-expr.c:6095
next prev parent reply other threads:[~2013-01-10 15:46 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-28 18:15 [Bug fortran/49213] New: " neil.n.carlson at gmail dot com
2011-06-16 19:44 ` [Bug fortran/49213] [OOP][F2008] " janus at gcc dot gnu.org
2011-06-16 19:50 ` [Bug fortran/49213] [OOP] " janus at gcc dot gnu.org
2011-06-16 20:36 ` neil.n.carlson at gmail dot com
2011-06-16 20:50 ` neil.n.carlson at gmail dot com
2011-06-16 21:29 ` janus at gcc dot gnu.org
2011-06-16 22:14 ` neil.n.carlson at gmail dot com
2011-06-16 22:18 ` neil.n.carlson at gmail dot com
2013-01-10 15:46 ` janus at gcc dot gnu.org [this message]
2013-01-10 16:07 ` janus at gcc dot gnu.org
2013-01-10 20:40 ` janus at gcc dot gnu.org
2013-01-11 12:04 ` janus at gcc dot gnu.org
2013-08-05 9:08 ` janus at gcc dot gnu.org
2013-08-05 9:22 ` janus at gcc dot gnu.org
2013-08-05 11:14 ` janus at gcc dot gnu.org
2013-08-06 8:42 ` janus at gcc dot gnu.org
2013-08-06 9:13 ` janus at gcc dot gnu.org
2013-08-06 10:50 ` janus at gcc dot gnu.org
2013-08-08 16:54 ` dominiq at lps dot ens.fr
2013-08-11 17:03 ` dominiq at lps dot ens.fr
2015-01-24 11:52 ` dominiq at lps dot ens.fr
2015-01-24 16:32 ` dominiq at lps dot ens.fr
2015-01-24 19:05 ` janus at gcc dot gnu.org
2015-02-05 8:09 ` pault at gcc dot gnu.org
2020-03-12 11:58 ` jakub at gcc dot gnu.org
2021-04-16 20:03 ` vladimir.fuka at gmail dot com
2021-06-01 8:05 ` rguenth at gcc dot gnu.org
2022-05-27 9:12 ` rguenth at gcc dot gnu.org
2023-06-22 16:45 ` pault at gcc dot gnu.org
2023-06-28 11:39 ` cvs-commit at gcc dot gnu.org
2023-10-31 8:23 ` pault at gcc dot gnu.org
2023-10-31 8:24 ` pault at gcc dot gnu.org
2023-10-31 8:29 ` pault at gcc dot gnu.org
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-49213-4-IWqsTPWAkw@http.gcc.gnu.org/bugzilla/ \
--to=gcc-bugzilla@gcc.gnu.org \
--cc=gcc-bugs@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).