public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug fortran/95375] New: ICE in add_use_op, Error: mismatching comparison operand types @ 2020-05-27 19:04 gscfq@t-online.de 2020-06-09 10:51 ` [Bug fortran/95375] " dominiq at lps dot ens.fr ` (5 more replies) 0 siblings, 6 replies; 7+ messages in thread From: gscfq@t-online.de @ 2020-05-27 19:04 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95375 Bug ID: 95375 Summary: ICE in add_use_op, Error: mismatching comparison operand types Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: gscfq@t-online.de Target Milestone: --- An inconsistent interface hits versions down to at least r5 : (detected without bind(c)) $ cat z1.f90 function f() result(n) bind(c) class(*), allocatable :: n end program p interface function f() result(n) bind(c) integer :: n end end interface if ( f() /= 0 ) stop end $ gfortran-11-20200524 -c z1.f90 during GIMPLE pass: ssa z1.f90:11:0: 11 | end | internal compiler error: Segmentation fault 0xbc0f6f crash_signal ../../gcc/toplev.c:328 0xd0a3e0 add_use_op ../../gcc/tree-ssa-operands.c:377 0xd0a3e0 operands_scanner::finalize_ssa_uses() ../../gcc/tree-ssa-operands.c:480 0xd0a3e0 operands_scanner::finalize_ssa_stmt_operands() ../../gcc/tree-ssa-operands.c:506 0xd0a3e0 operands_scanner::build_ssa_operands() ../../gcc/tree-ssa-operands.c:1014 0xd0aa10 update_stmt_operands(function*, gimple*) ../../gcc/tree-ssa-operands.c:1155 0xc3a754 update_stmt ../../gcc/gimple-ssa.h:175 0xc3a754 mark_def_sites ../../gcc/tree-into-ssa.c:649 0xc3a754 mark_def_dom_walker::before_dom_children(basic_block_def*) ../../gcc/tree-into-ssa.c:2342 0x13a3e44 dom_walker::walk(basic_block_def*) ../../gcc/domwalk.c:309 0xc3cd85 execute ../../gcc/tree-into-ssa.c:2459 Configured with --enable-checking=yes : $ gfortran-11-20200524 -c z1.f90 z1.f90:4:0: 4 | program p | Error: mismatching comparison operand types struct __class__STAR_a integer(kind=4) if (D.3926 != 0) goto <D.3927>; else goto <D.3928>; z1.f90:4:0: internal compiler error: 'verify_gimple' failed 0xd9b27d verify_gimple_in_seq(gimple*) ../../gcc/tree-cfg.c:5113 0xa526b1 gimplify_body(tree_node*, bool) ../../gcc/gimplify.c:14919 0xa52967 gimplify_function_tree(tree_node*) ../../gcc/gimplify.c:14990 0x88d9e7 cgraph_node::analyze() ../../gcc/cgraphunit.c:671 0x890e21 analyze_functions ../../gcc/cgraphunit.c:1231 0x892042 symbol_table::finalize_compilation_unit() ../../gcc/cgraphunit.c:2975 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/95375] ICE in add_use_op, Error: mismatching comparison operand types 2020-05-27 19:04 [Bug fortran/95375] New: ICE in add_use_op, Error: mismatching comparison operand types gscfq@t-online.de @ 2020-06-09 10:51 ` dominiq at lps dot ens.fr 2021-10-24 23:54 ` sandra at gcc dot gnu.org ` (4 subsequent siblings) 5 siblings, 0 replies; 7+ messages in thread From: dominiq at lps dot ens.fr @ 2020-06-09 10:51 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95375 Dominique d'Humieres <dominiq at lps dot ens.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Last reconfirmed| |2020-06-09 --- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> --- Confirmed. ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/95375] ICE in add_use_op, Error: mismatching comparison operand types 2020-05-27 19:04 [Bug fortran/95375] New: ICE in add_use_op, Error: mismatching comparison operand types 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 ` (3 subsequent siblings) 5 siblings, 0 replies; 7+ messages in thread From: sandra at gcc dot gnu.org @ 2021-10-24 23:54 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95375 sandra at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |sandra at gcc dot gnu.org --- Comment #2 from sandra at gcc dot gnu.org --- Current behavior on master is to warn, then ICE: $ x86_64-linux-gnu-gfortran -c z1.f90 z1.f90:1:0: 1 | function f() result(n) bind(c) | ...... 6 | function f() result(n) bind(c) | 2 Warning: Type mismatch in function result (INTEGER(4)/CLASS(*)) between (1) and (2) z1.f90:4:9: 4 | program p | ^ Error: mismatching comparison operand types struct __class__STAR_a integer(kind=4) if (D.4230 != 0) goto <D.4231>; else goto <D.4232>; z1.f90:4:9: internal compiler error: 'verify_gimple' failed 0xfd471d verify_gimple_in_seq(gimple*) /scratch/sandra/x86-fsf/src/gcc-mainline/gcc/tree-cfg.c:5229 0xcee7b6 gimplify_body(tree_node*, bool) /scratch/sandra/x86-fsf/src/gcc-mainline/gcc/gimplify.c:15913 0xcee97d gimplify_function_tree(tree_node*) /scratch/sandra/x86-fsf/src/gcc-mainline/gcc/gimplify.c:15984 0xb1a3b7 cgraph_node::analyze() /scratch/sandra/x86-fsf/src/gcc-mainline/gcc/cgraphunit.c:670 0xb1cec7 analyze_functions /scratch/sandra/x86-fsf/src/gcc-mainline/gcc/cgraphunit.c:1234 0xb1db5d symbol_table::finalize_compilation_unit() /scratch/sandra/x86-fsf/src/gcc-mainline/gcc/cgraphunit.c:2508 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/95375] ICE in add_use_op, Error: mismatching comparison operand types 2020-05-27 19:04 [Bug fortran/95375] New: ICE in add_use_op, Error: mismatching comparison operand types 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 2022-12-20 20:41 ` anlauf at gcc dot gnu.org ` (2 subsequent siblings) 5 siblings, 0 replies; 7+ messages in thread From: anlauf at gcc dot gnu.org @ 2022-07-08 20:10 UTC (permalink / raw) To: gcc-bugs 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. ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/95375] ICE in add_use_op, Error: mismatching comparison operand types 2020-05-27 19:04 [Bug fortran/95375] New: ICE in add_use_op, Error: mismatching comparison operand types gscfq@t-online.de ` (2 preceding siblings ...) 2022-07-08 20:10 ` anlauf at gcc dot gnu.org @ 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 5 siblings, 0 replies; 7+ messages in thread From: anlauf at gcc dot gnu.org @ 2022-12-20 20:41 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95375 anlauf at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |anlauf at gcc dot gnu.org Status|NEW |ASSIGNED --- Comment #4 from anlauf at gcc dot gnu.org --- Submitted: https://gcc.gnu.org/pipermail/fortran/2022-December/058669.html ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/95375] ICE in add_use_op, Error: mismatching comparison operand types 2020-05-27 19:04 [Bug fortran/95375] New: ICE in add_use_op, Error: mismatching comparison operand types gscfq@t-online.de ` (3 preceding siblings ...) 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 5 siblings, 0 replies; 7+ messages in thread From: cvs-commit at gcc dot gnu.org @ 2022-12-20 21:24 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95375 --- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Harald Anlauf <anlauf@gcc.gnu.org>: https://gcc.gnu.org/g:aed5584ff6891560dc567e54517b9722dadc503e commit r13-4809-gaed5584ff6891560dc567e54517b9722dadc503e Author: Harald Anlauf <anlauf@gmx.de> Date: Tue Dec 20 21:17:08 2022 +0100 Fortran: a C interoperable function cannot have the CLASS attribute [PR95375] gcc/fortran/ChangeLog: PR fortran/95375 * decl.cc (verify_bind_c_sym): Extend interoperability check to CLASS variables. gcc/testsuite/ChangeLog: PR fortran/95375 * gfortran.dg/bind_c_procs_4.f90: New test. ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/95375] ICE in add_use_op, Error: mismatching comparison operand types 2020-05-27 19:04 [Bug fortran/95375] New: ICE in add_use_op, Error: mismatching comparison operand types gscfq@t-online.de ` (4 preceding siblings ...) 2022-12-20 21:24 ` cvs-commit at gcc dot gnu.org @ 2022-12-20 21:27 ` anlauf at gcc dot gnu.org 5 siblings, 0 replies; 7+ messages in thread From: anlauf at gcc dot gnu.org @ 2022-12-20 21:27 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95375 anlauf at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|ASSIGNED |RESOLVED Target Milestone|--- |13.0 --- Comment #6 from anlauf at gcc dot gnu.org --- Fixed on mainline for gcc-13. Closing. Thanks for the report! ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-12-20 21:27 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-05-27 19:04 [Bug fortran/95375] New: ICE in add_use_op, Error: mismatching comparison operand types 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 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
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).