public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "tkoenig at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/55852] [4.6/4.7/4.8 regression] internal compiler error: in gfc_build_intrinsic_call, at fortran/expr.c:4647 Date: Sun, 06 Jan 2013 21:59:00 -0000 [thread overview] Message-ID: <bug-55852-4-zVbuXqgKJj@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-55852-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55852 --- Comment #6 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2013-01-06 21:59:13 UTC --- This patch works (not regression-tested yet), but the method using the state variable seems hackish and error-prone. What do you think? Index: expr.c =================================================================== --- expr.c (Revision 194850) +++ expr.c (Arbeitskopie) @@ -4623,7 +4623,8 @@ want to add arguments but with a NULL-expression. */ gfc_expr* -gfc_build_intrinsic_call (const char* name, locus where, unsigned numarg, ...) +gfc_build_intrinsic_call (const char* name, const char *symtree_name, + locus where, unsigned numarg, ...) { gfc_expr* result; gfc_actual_arglist* atail; @@ -4641,11 +4642,17 @@ result->value.function.name = name; result->value.function.isym = isym; - result->symtree = gfc_find_symtree (gfc_current_ns->sym_root, name); - gcc_assert (result->symtree - && (result->symtree->n.sym->attr.flavor == FL_PROCEDURE - || result->symtree->n.sym->attr.flavor == FL_UNKNOWN)); + if (symtree_name == NULL) + { + result->symtree = gfc_find_symtree (gfc_current_ns->sym_root, name); + gcc_assert (result->symtree && + (result->symtree->n.sym->attr.flavor == FL_PROCEDURE + || result->symtree->n.sym->attr.flavor == FL_UNKNOWN)); + } + else + gfc_get_sym_tree (symtree_name, gfc_current_ns, &result->symtree, true); + va_start (ap, numarg); atail = NULL; for (i = 0; i < numarg; ++i) Index: simplify.c =================================================================== --- simplify.c (Revision 194850) +++ simplify.c (Arbeitskopie) @@ -33,6 +33,7 @@ gfc_expr gfc_bad_expr; +bool artificial_call = false; /* Note that 'simplification' is not just transforming expressions. For functions that are not simplified at compile time, range @@ -3248,7 +3249,10 @@ gfc_expr* dim = result; mpz_set_si (dim->value.integer, d); + artificial_call = true; result = gfc_simplify_size (array, dim, kind); + artificial_call = false; + gfc_free_expr (dim); if (!result) goto returnNull; @@ -5512,7 +5516,10 @@ { mpz_set_ui (e->value.integer, n + 1); + artificial_call = true; f = gfc_simplify_size (source, e, NULL); + artificial_call = false; + gfc_free_expr (e); if (f == NULL) { @@ -5584,11 +5591,18 @@ /* Otherwise, we build a new SIZE call. This is hopefully at least simpler than the original one. */ if (!simplified) - simplified = gfc_build_intrinsic_call ("size", array->where, 3, - gfc_copy_expr (replacement), - gfc_copy_expr (dim), - gfc_copy_expr (kind)); + { + const char *symtree_name; + if (artificial_call) + symtree_name = "__internal_size"; + else + symtree_name = NULL; + simplified = gfc_build_intrinsic_call ("size", symtree_name, array->where, 3, + gfc_copy_expr (replacement), + gfc_copy_expr (dim), + gfc_copy_expr (kind)); + } return simplified; } Index: gfortran.h =================================================================== --- gfortran.h (Revision 194850) +++ gfortran.h (Arbeitskopie) @@ -2797,7 +2797,8 @@ bool gfc_has_ultimate_allocatable (gfc_expr *); bool gfc_has_ultimate_pointer (gfc_expr *); -gfc_expr* gfc_build_intrinsic_call (const char*, locus, unsigned, ...); +gfc_expr* gfc_build_intrinsic_call (const char*, const char *, locus, + unsigned, ...); gfc_try gfc_check_vardef_context (gfc_expr*, bool, bool, bool, const char*);
next prev parent reply other threads:[~2013-01-06 21:59 UTC|newest] Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-01-03 1:08 [Bug fortran/55852] New: " latlon90180+gcc_bugzilla at gmail dot com 2013-01-03 9:39 ` [Bug fortran/55852] " janus at gcc dot gnu.org 2013-01-03 9:43 ` [Bug fortran/55852] [4.6/4.7/4.8 regression] " janus at gcc dot gnu.org 2013-01-03 11:01 ` dominiq at lps dot ens.fr 2013-01-03 11:10 ` burnus at gcc dot gnu.org 2013-01-03 11:13 ` dominiq at lps dot ens.fr 2013-01-04 17:27 ` jakub at gcc dot gnu.org 2013-01-06 20:56 ` tkoenig at gcc dot gnu.org 2013-01-06 21:59 ` tkoenig at gcc dot gnu.org [this message] 2013-01-07 11:11 ` burnus at gcc dot gnu.org 2013-01-07 15:24 ` burnus at gcc dot gnu.org 2013-01-07 19:11 ` burnus at gcc dot gnu.org 2013-01-08 16:56 ` schwab@linux-m68k.org 2013-02-13 14:39 ` burnus at gcc dot gnu.org 2013-02-13 14:44 ` janus at gcc dot gnu.org 2013-02-13 15:09 ` burnus at gcc dot gnu.org 2013-02-13 17:51 ` burnus at gcc dot gnu.org 2013-02-13 17:52 ` burnus at gcc dot gnu.org 2013-02-13 19:21 ` latlon90180+gcc_bugzilla at gmail dot com
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-55852-4-zVbuXqgKJj@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: linkBe 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).