public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/103287] New: [12 Regression] ICE in argument_rank_mismatch, at fortran/interface.c:2240
@ 2021-11-16 18:41 gscfq@t-online.de
  2021-11-16 18:42 ` [Bug fortran/103287] " gscfq@t-online.de
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: gscfq@t-online.de @ 2021-11-16 18:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103287

            Bug ID: 103287
           Summary: [12 Regression] ICE in argument_rank_mismatch, at
                    fortran/interface.c:2240
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gscfq@t-online.de
  Target Milestone: ---

Changed between 20210919 and 20210926 :
(gcc configured with --enable-checking=yes)


$ cat z1.f90
subroutine g
   call s([1])
end
subroutine h(x)
   integer, pointer :: x(..)
   call s(x)
end


$ gfortran-12-20211114 -c z1.f90
z1.f90:6:10:

    6 |    call s(x)
      |          1
Error: Assumed-rank argument requires an explicit interface at (1)
f951: internal compiler error: in argument_rank_mismatch, at
fortran/interface.c:2240
0x7e3746 argument_rank_mismatch
        ../../gcc/fortran/interface.c:2240
0x7e7325 compare_parameter
        ../../gcc/fortran/interface.c:2666
0x7e7325 gfc_compare_actual_formal(gfc_actual_arglist**, gfc_formal_arglist*,
int, int, bool, locus*)
        ../../gcc/fortran/interface.c:3200
0x94c266 check_externals_procedure
        ../../gcc/fortran/frontend-passes.c:5725
0x950f59 gfc_code_walker(gfc_code**, int (*)(gfc_code**, int*, void*), int
(*)(gfc_expr**, int*, void*), void*)
        ../../gcc/fortran/frontend-passes.c:5333
0x9527bb gfc_check_externals0
        ../../gcc/fortran/frontend-passes.c:5844
0x953644 gfc_check_externals(gfc_namespace*)
        ../../gcc/fortran/frontend-passes.c:5866
0x83b732 gfc_parse_file()
        ../../gcc/fortran/parse.c:6856
0x8896bf gfc_be_parse_file
        ../../gcc/fortran/f95-lang.c:216

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/103287] [12 Regression] ICE in argument_rank_mismatch, at fortran/interface.c:2240
  2021-11-16 18:41 [Bug fortran/103287] New: [12 Regression] ICE in argument_rank_mismatch, at fortran/interface.c:2240 gscfq@t-online.de
@ 2021-11-16 18:42 ` gscfq@t-online.de
  2021-11-16 20:05 ` kargl at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: gscfq@t-online.de @ 2021-11-16 18:42 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103287

G. Steinmetz <gscfq@t-online.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-invalid-code

--- Comment #1 from G. Steinmetz <gscfq@t-online.de> ---

It should be added that following variant started with r10,
between 20190908 and 20190915 :


$ cat z2.f90
subroutine g
   call s(1)
end
subroutine h(x)
   integer, pointer :: x(..)
   call s(x)
end

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/103287] [12 Regression] ICE in argument_rank_mismatch, at fortran/interface.c:2240
  2021-11-16 18:41 [Bug fortran/103287] New: [12 Regression] ICE in argument_rank_mismatch, at fortran/interface.c:2240 gscfq@t-online.de
  2021-11-16 18:42 ` [Bug fortran/103287] " gscfq@t-online.de
@ 2021-11-16 20:05 ` kargl at gcc dot gnu.org
  2021-11-16 20:08 ` kargl at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: kargl at gcc dot gnu.org @ 2021-11-16 20:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103287

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-11-16
     Ever confirmed|0                           |1
                 CC|                            |kargl at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW

--- Comment #2 from kargl at gcc dot gnu.org ---
Change an assert to an if-statement and simply return.

diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
index 30c99ef3938..8bd507be67c 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -2237,7 +2237,9 @@ argument_rank_mismatch (const char *name, locus *where,
     }
   else
     {
-      gcc_assert (rank2 != -1);
+      if (rank2 == -1)
+       return;
+
       if (rank1 == 0)
        gfc_error_opt (0, "Rank mismatch between actual argument at %L "
                       "and actual argument at %L (scalar and rank-%d)",

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/103287] [12 Regression] ICE in argument_rank_mismatch, at fortran/interface.c:2240
  2021-11-16 18:41 [Bug fortran/103287] New: [12 Regression] ICE in argument_rank_mismatch, at fortran/interface.c:2240 gscfq@t-online.de
  2021-11-16 18:42 ` [Bug fortran/103287] " gscfq@t-online.de
  2021-11-16 20:05 ` kargl at gcc dot gnu.org
@ 2021-11-16 20:08 ` kargl at gcc dot gnu.org
  2021-11-18  7:40 ` rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: kargl at gcc dot gnu.org @ 2021-11-16 20:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103287

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/103287] [12 Regression] ICE in argument_rank_mismatch, at fortran/interface.c:2240
  2021-11-16 18:41 [Bug fortran/103287] New: [12 Regression] ICE in argument_rank_mismatch, at fortran/interface.c:2240 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2021-11-16 20:08 ` kargl at gcc dot gnu.org
@ 2021-11-18  7:40 ` rguenth at gcc dot gnu.org
  2021-11-18 10:35 ` marxin at gcc dot gnu.org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-11-18  7:40 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103287

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.0

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/103287] [12 Regression] ICE in argument_rank_mismatch, at fortran/interface.c:2240
  2021-11-16 18:41 [Bug fortran/103287] New: [12 Regression] ICE in argument_rank_mismatch, at fortran/interface.c:2240 gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2021-11-18  7:40 ` rguenth at gcc dot gnu.org
@ 2021-11-18 10:35 ` marxin at gcc dot gnu.org
  2021-12-13  1:48 ` sandra at gcc dot gnu.org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-11-18 10:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103287

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marxin at gcc dot gnu.org,
                   |                            |sandra at codesourcery dot com

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r12-3827-g7a40f2e74815a926, it was rejected before the revision.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/103287] [12 Regression] ICE in argument_rank_mismatch, at fortran/interface.c:2240
  2021-11-16 18:41 [Bug fortran/103287] New: [12 Regression] ICE in argument_rank_mismatch, at fortran/interface.c:2240 gscfq@t-online.de
                   ` (4 preceding siblings ...)
  2021-11-18 10:35 ` marxin at gcc dot gnu.org
@ 2021-12-13  1:48 ` sandra at gcc dot gnu.org
  2021-12-13  2:11 ` kargl at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: sandra at gcc dot gnu.org @ 2021-12-13  1:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103287

sandra at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sandra at gcc dot gnu.org

--- Comment #4 from sandra at gcc dot gnu.org ---
The proposed fix in comment 2 looks OK to me, although I'd like to see a
comment here like

"This case corresponds to an assumed-rank actual passed to a function without
an explicit interface, which is diagnosed in gfc_procedure_use."

to explain what is going on.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/103287] [12 Regression] ICE in argument_rank_mismatch, at fortran/interface.c:2240
  2021-11-16 18:41 [Bug fortran/103287] New: [12 Regression] ICE in argument_rank_mismatch, at fortran/interface.c:2240 gscfq@t-online.de
                   ` (5 preceding siblings ...)
  2021-12-13  1:48 ` sandra at gcc dot gnu.org
@ 2021-12-13  2:11 ` kargl at gcc dot gnu.org
  2022-01-06 20:46 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: kargl at gcc dot gnu.org @ 2021-12-13  2:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103287

--- Comment #5 from kargl at gcc dot gnu.org ---
(In reply to sandra from comment #4)
> The proposed fix in comment 2 looks OK to me, although I'd like to see a
> comment here like
> 
> "This case corresponds to an assumed-rank actual passed to a function
> without an explicit interface, which is diagnosed in gfc_procedure_use."
> 
> to explain what is going on.

I no longer commit patches.  Feel free to do whatever you want here;
although, I think the comment is unwarranted.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/103287] [12 Regression] ICE in argument_rank_mismatch, at fortran/interface.c:2240
  2021-11-16 18:41 [Bug fortran/103287] New: [12 Regression] ICE in argument_rank_mismatch, at fortran/interface.c:2240 gscfq@t-online.de
                   ` (6 preceding siblings ...)
  2021-12-13  2:11 ` kargl at gcc dot gnu.org
@ 2022-01-06 20:46 ` cvs-commit at gcc dot gnu.org
  2022-01-06 20:47 ` sandra at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-01-06 20:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103287

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Sandra Loosemore <sandra@gcc.gnu.org>:

https://gcc.gnu.org/g:8e2771069ed0c157cca825d6af5792e94c4407c1

commit r12-6322-g8e2771069ed0c157cca825d6af5792e94c4407c1
Author: Sandra Loosemore <sandra@codesourcery.com>
Date:   Wed Jan 5 13:18:10 2022 -0800

    Fortran: Fix ICE in argument_rank_mismatch [PR103287]

    This patch removes an incorrect assertion.  A user-friendly error for this
    case is already given elsewhere.

    2022-01-05  Steve Kargl  <kargl@gcc.gnu.org>
                Sandra Loosemore  <sandra@codesourcery.com>

            PR fortran/103287

            gcc/fortran/
            * interface.c (argument_rank_mismatch): Replace incorrect assertion
            with return.

            gcc/testsuite/
            * gfortran.dg/c-interop/pr103287-1.f90: new.
            * gfortran.dg/c-interop/pr103287-2.f90: new.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/103287] [12 Regression] ICE in argument_rank_mismatch, at fortran/interface.c:2240
  2021-11-16 18:41 [Bug fortran/103287] New: [12 Regression] ICE in argument_rank_mismatch, at fortran/interface.c:2240 gscfq@t-online.de
                   ` (7 preceding siblings ...)
  2022-01-06 20:46 ` cvs-commit at gcc dot gnu.org
@ 2022-01-06 20:47 ` sandra at gcc dot gnu.org
  2022-09-16 20:12 ` anlauf at gcc dot gnu.org
  2022-09-16 20:12 ` anlauf at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: sandra at gcc dot gnu.org @ 2022-01-06 20:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103287

sandra at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #7 from sandra at gcc dot gnu.org ---
Should be fixed now.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/103287] [12 Regression] ICE in argument_rank_mismatch, at fortran/interface.c:2240
  2021-11-16 18:41 [Bug fortran/103287] New: [12 Regression] ICE in argument_rank_mismatch, at fortran/interface.c:2240 gscfq@t-online.de
                   ` (8 preceding siblings ...)
  2022-01-06 20:47 ` sandra at gcc dot gnu.org
@ 2022-09-16 20:12 ` anlauf at gcc dot gnu.org
  2022-09-16 20:12 ` anlauf at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-09-16 20:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103287

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jrfsousa at gcc dot gnu.org

--- Comment #8 from anlauf at gcc dot gnu.org ---
*** Bug 100024 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/103287] [12 Regression] ICE in argument_rank_mismatch, at fortran/interface.c:2240
  2021-11-16 18:41 [Bug fortran/103287] New: [12 Regression] ICE in argument_rank_mismatch, at fortran/interface.c:2240 gscfq@t-online.de
                   ` (9 preceding siblings ...)
  2022-09-16 20:12 ` anlauf at gcc dot gnu.org
@ 2022-09-16 20:12 ` anlauf at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-09-16 20:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103287

--- Comment #9 from anlauf at gcc dot gnu.org ---
*** Bug 100025 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2022-09-16 20:12 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-16 18:41 [Bug fortran/103287] New: [12 Regression] ICE in argument_rank_mismatch, at fortran/interface.c:2240 gscfq@t-online.de
2021-11-16 18:42 ` [Bug fortran/103287] " gscfq@t-online.de
2021-11-16 20:05 ` kargl at gcc dot gnu.org
2021-11-16 20:08 ` kargl at gcc dot gnu.org
2021-11-18  7:40 ` rguenth at gcc dot gnu.org
2021-11-18 10:35 ` marxin at gcc dot gnu.org
2021-12-13  1:48 ` sandra at gcc dot gnu.org
2021-12-13  2:11 ` kargl at gcc dot gnu.org
2022-01-06 20:46 ` cvs-commit at gcc dot gnu.org
2022-01-06 20:47 ` sandra at gcc dot gnu.org
2022-09-16 20:12 ` anlauf at gcc dot gnu.org
2022-09-16 20:12 ` 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).