public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "anlauf at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/95375] ICE in add_use_op, Error: mismatching comparison operand types Date: Fri, 08 Jul 2022 20:10:36 +0000 [thread overview] Message-ID: <bug-95375-4-4OkKrWxtpQ@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-95375-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95375 anlauf at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |anlauf at gcc dot gnu.org --- Comment #3 from anlauf at gcc dot gnu.org --- I am wondering why we simply warn in check_against_globals, instead of emitting an error: 5832 buf[0] = 0; 5833 gfc_compare_interfaces (sym, def_sym, sym->name, 0, 1, buf, sizeof(buf), 5834 NULL, NULL, NULL); 5835 if (buf[0] != 0) 5836 { 5837 gfc_warning (0, "%s between %L and %L", buf, &def_sym->declared_at, 5838 &sym->declared_at); 5839 sym->error = 1; 5840 def_sym->error = 1; 5841 } There is also the question why we handle interface checks differently for bind(c) the way we do now. If I e.g. revert commit r0-127463, which added one line in resolve_global_procedure: 2612 if ((sym->attr.if_source == IFSRC_UNKNOWN 2613 || sym->attr.if_source == IFSRC_IFBODY) 2614 && gsym->type != GSYM_UNKNOWN 2615 && !gsym->binding_label <=== this one here! 2616 && gsym->ns 2617 && gsym->ns->proc_name 2618 && not_in_recursive (sym, gsym->ns) 2619 && not_entry_self_reference (sym, gsym->ns)) 2620 { to disable the global interface check for bind(c), the ICE goes away. (However, we then regress on gfortran.dg/bind_c_procs_2.f90). Hackish fix (not regtested): diff --git a/gcc/fortran/frontend-passes.cc b/gcc/fortran/frontend-passes.cc index 612c12d233d..41adfe5b715 100644 --- a/gcc/fortran/frontend-passes.cc +++ b/gcc/fortran/frontend-passes.cc @@ -5834,8 +5834,12 @@ check_against_globals (gfc_symbol *sym) NULL, NULL, NULL); if (buf[0] != 0) { - gfc_warning (0, "%s between %L and %L", buf, &def_sym->declared_at, + if (sym->binding_label) + gfc_error ("%s between %L and %L", buf, &def_sym->declared_at, &sym->declared_at); + else + gfc_warning (0, "%s between %L and %L", buf, &def_sym->declared_at, + &sym->declared_at); sym->error = 1; def_sym->error = 1; } There is another issue in that we do not detect that function f() result(n) bind(c) class(*), allocatable :: n end is likely illegal, i.e. not interoperable. Intel says: pr95375.f90(1): error #8522: A result variable of a BIND(C) procedure cannot have either the ALLOCATABLE or the POINTER attribute. [F] function f() result(n) bind(c) ---------^ pr95375.f90(1): error #8624: The result variable of an interoperable function must itself be interoperable; derived type must be declared with BIND(C). [F] function f() result(n) bind(c) ---------^ compilation aborted for pr95375.f90 (code 1) This should be tracked elsewhere.
next prev parent reply other threads:[~2022-07-08 20:10 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-05-27 19:04 [Bug fortran/95375] New: " gscfq@t-online.de 2020-06-09 10:51 ` [Bug fortran/95375] " dominiq at lps dot ens.fr 2021-10-24 23:54 ` sandra at gcc dot gnu.org 2022-07-08 20:10 ` anlauf at gcc dot gnu.org [this message] 2022-12-20 20:41 ` anlauf at gcc dot gnu.org 2022-12-20 21:24 ` cvs-commit at gcc dot gnu.org 2022-12-20 21:27 ` anlauf 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-95375-4-4OkKrWxtpQ@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).