public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/100971] New: ICE: Bad IO basetype (7)
@ 2021-06-08 17:13 gscfq@t-online.de
  2021-06-20 20:35 ` [Bug fortran/100971] " jvdelisle2 at gmail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: gscfq@t-online.de @ 2021-06-08 17:13 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100971
           Summary: ICE: Bad IO basetype (7)
           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: ---

This invalid code z1 affects versions down to at least r5.
For reference, the case z0 is already rejected.


$ cat z0.f90
program p
   type t
   end type
   class(t), allocatable :: a
   print *, a
end


$ cat z1.f90
program p
   type t
   end type
   class(t), allocatable :: a
   print *, [a]
end


$ gfortran-12-20210606 -c z0.f90
z0.f90:5:13:

    5 |    print *, a
      |             1
Error: Data transfer element at (1) cannot be polymorphic unless it is
processed by a defined input/output procedure


$ gfortran-12-20210606 -c z1.f90
f951: internal compiler error: Bad IO basetype (7)
0x6ea049 gfc_report_diagnostic
        ../../gcc/fortran/error.c:782
0x6eb76a gfc_internal_error(char const*, ...)
        ../../gcc/fortran/error.c:1402
0x7f9e09 transfer_expr
        ../../gcc/fortran/trans-io.c:2507
0x7fd430 gfc_trans_transfer(gfc_code*)
        ../../gcc/fortran/trans-io.c:2661
0x79e6c7 trans_code
        ../../gcc/fortran/trans.c:2138
0x7faefe build_dt
        ../../gcc/fortran/trans-io.c:2026
0x79e6a7 trans_code
        ../../gcc/fortran/trans.c:2110
0x7c4bc4 gfc_generate_function_code(gfc_namespace*)
        ../../gcc/fortran/trans-decl.c:6893
0x74b3f6 translate_all_program_units
        ../../gcc/fortran/parse.c:6461
0x74b3f6 gfc_parse_file()
        ../../gcc/fortran/parse.c:6730
0x79772f gfc_be_parse_file
        ../../gcc/fortran/f95-lang.c:212

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

* [Bug fortran/100971] ICE: Bad IO basetype (7)
  2021-06-08 17:13 [Bug fortran/100971] New: ICE: Bad IO basetype (7) gscfq@t-online.de
@ 2021-06-20 20:35 ` jvdelisle2 at gmail dot com
  2021-06-21 19:04 ` dominiq at lps dot ens.fr
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jvdelisle2 at gmail dot com @ 2021-06-20 20:35 UTC (permalink / raw)
  To: gcc-bugs

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

Jerry DeLisle <jvdelisle2 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jvdelisle2 at gmail dot com

--- Comment #1 from Jerry DeLisle <jvdelisle2 at gmail dot com> ---
I can confirm this bug.

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

* [Bug fortran/100971] ICE: Bad IO basetype (7)
  2021-06-08 17:13 [Bug fortran/100971] New: ICE: Bad IO basetype (7) gscfq@t-online.de
  2021-06-20 20:35 ` [Bug fortran/100971] " jvdelisle2 at gmail dot com
@ 2021-06-21 19:04 ` dominiq at lps dot ens.fr
  2022-10-06 20:58 ` anlauf at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: dominiq at lps dot ens.fr @ 2021-06-21 19:04 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-06-21

--- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> I can confirm this bug.

Me too!

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

* [Bug fortran/100971] ICE: Bad IO basetype (7)
  2021-06-08 17:13 [Bug fortran/100971] New: ICE: Bad IO basetype (7) gscfq@t-online.de
  2021-06-20 20:35 ` [Bug fortran/100971] " jvdelisle2 at gmail dot com
  2021-06-21 19:04 ` dominiq at lps dot ens.fr
@ 2022-10-06 20:58 ` anlauf at gcc dot gnu.org
  2022-10-09 18:57 ` 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-10-06 20:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from anlauf at gcc dot gnu.org ---
Just from a purely technical point, the following would allow to trigger the
proper check, as it allows to look into arrays, and regtests OK:

diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc
index d9d101775f6..bcf951ad756 100644
--- a/gcc/fortran/resolve.cc
+++ b/gcc/fortran/resolve.cc
@@ -10017,6 +10017,7 @@ resolve_transfer (gfc_code *code)

   if (exp == NULL || (exp->expr_type != EXPR_VARIABLE
                      && exp->expr_type != EXPR_FUNCTION
+                     && exp->expr_type != EXPR_ARRAY
                      && exp->expr_type != EXPR_STRUCTURE))
     return;

@@ -10030,6 +10031,7 @@ resolve_transfer (gfc_code *code)

   const gfc_typespec *ts = exp->expr_type == EXPR_STRUCTURE
                        || exp->expr_type == EXPR_FUNCTION
+                       || exp->expr_type == EXPR_ARRAY
                         ? &exp->ts : &exp->symtree->n.sym->ts;

   /* Go to actual component transferred.  */
@@ -10128,6 +10130,9 @@ resolve_transfer (gfc_code *code)
   if (exp->expr_type == EXPR_STRUCTURE)
     return;

+  if (exp->expr_type == EXPR_ARRAY)
+    return;
+
   sym = exp->symtree->n.sym;

   if (sym->as != NULL && sym->as->type == AS_ASSUMED_SIZE && exp->ref

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

* [Bug fortran/100971] ICE: Bad IO basetype (7)
  2021-06-08 17:13 [Bug fortran/100971] New: ICE: Bad IO basetype (7) gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2022-10-06 20:58 ` anlauf at gcc dot gnu.org
@ 2022-10-09 18:57 ` anlauf at gcc dot gnu.org
  2022-10-14 20:17 ` cvs-commit at gcc dot gnu.org
  2022-10-14 20:21 ` anlauf at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-10-09 18:57 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |anlauf at gcc dot gnu.org
           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-October/058305.html

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

* [Bug fortran/100971] ICE: Bad IO basetype (7)
  2021-06-08 17:13 [Bug fortran/100971] New: ICE: Bad IO basetype (7) gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2022-10-09 18:57 ` anlauf at gcc dot gnu.org
@ 2022-10-14 20:17 ` cvs-commit at gcc dot gnu.org
  2022-10-14 20:21 ` anlauf at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-10-14 20:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- 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:89f20c9ae4641f9b2e87e47f7dab3dc197faa0aa

commit r13-3309-g89f20c9ae4641f9b2e87e47f7dab3dc197faa0aa
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Sun Oct 9 20:43:32 2022 +0200

    Fortran: fix check of polymorphic elements in data transfers [PR100971]

    gcc/fortran/ChangeLog:

            PR fortran/100971
            * resolve.cc (resolve_transfer): Extend check for permissibility
            of polymorphic elements in a data transfer to arrays.

    gcc/testsuite/ChangeLog:

            PR fortran/100971
            * gfortran.dg/der_io_5.f90: New test.

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

* [Bug fortran/100971] ICE: Bad IO basetype (7)
  2021-06-08 17:13 [Bug fortran/100971] New: ICE: Bad IO basetype (7) gscfq@t-online.de
                   ` (4 preceding siblings ...)
  2022-10-14 20:17 ` cvs-commit at gcc dot gnu.org
@ 2022-10-14 20:21 ` anlauf at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-10-14 20:21 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
   Target Milestone|---                         |13.0
         Resolution|---                         |FIXED

--- Comment #6 from anlauf at gcc dot gnu.org ---
Fixed for gcc-13.  Closing.

Thanks for the report!

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

end of thread, other threads:[~2022-10-14 20:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-08 17:13 [Bug fortran/100971] New: ICE: Bad IO basetype (7) gscfq@t-online.de
2021-06-20 20:35 ` [Bug fortran/100971] " jvdelisle2 at gmail dot com
2021-06-21 19:04 ` dominiq at lps dot ens.fr
2022-10-06 20:58 ` anlauf at gcc dot gnu.org
2022-10-09 18:57 ` anlauf at gcc dot gnu.org
2022-10-14 20:17 ` cvs-commit at gcc dot gnu.org
2022-10-14 20:21 ` 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).