public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/107074] New: ICE: Bad IO basetype (8)
@ 2022-09-28 17:34 gscfq@t-online.de
  2022-09-28 18:53 ` [Bug fortran/107074] " anlauf at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: gscfq@t-online.de @ 2022-09-28 17:34 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 107074
           Summary: ICE: Bad IO basetype (8)
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gscfq@t-online.de
  Target Milestone: ---

Affects versions down to at least r5 :
(a is a procedure/function)


$ cat z1.f90
program p
   implicit none
   integer :: a
   print *, a(1)
   print *, merge(a, a, .true.)
end


$ cat z2.f90
program p
   implicit none
   integer :: a
   print *, a()
   print *, merge(a, a, .true.)
end


$ gfortran-13-20220925 -c z1.f90
f951: internal compiler error: Bad IO basetype (8)
0x7f4459 gfc_report_diagnostic
        ../../gcc/fortran/error.cc:883
0x7f5fd7 gfc_internal_error(char const*, ...)
        ../../gcc/fortran/error.cc:1503
0x9308f6 transfer_expr
        ../../gcc/fortran/trans-io.cc:2532
0x934b3e gfc_trans_transfer(gfc_code*)
        ../../gcc/fortran/trans-io.cc:2686
0x8b1cd7 trans_code
        ../../gcc/fortran/trans.cc:2170
0x9323d2 build_dt
        ../../gcc/fortran/trans-io.cc:2051
0x8b1cf7 trans_code
        ../../gcc/fortran/trans.cc:2142
0x8e95d9 gfc_generate_function_code(gfc_namespace*)
        ../../gcc/fortran/trans-decl.cc:7655
0x85afae translate_all_program_units
        ../../gcc/fortran/parse.cc:6671
0x85afae gfc_parse_file()
        ../../gcc/fortran/parse.cc:6977
0x8a925f gfc_be_parse_file
        ../../gcc/fortran/f95-lang.cc:229

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

* [Bug fortran/107074] ICE: Bad IO basetype (8)
  2022-09-28 17:34 [Bug fortran/107074] New: ICE: Bad IO basetype (8) gscfq@t-online.de
@ 2022-09-28 18:53 ` anlauf at gcc dot gnu.org
  2022-09-28 19:10 ` anlauf at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-09-28 18:53 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2022-09-28

--- Comment #1 from anlauf at gcc dot gnu.org ---
Confirmed.

(gdb) p ts->type 
$3 = BT_PROCEDURE

We don't have an implementation for printing the address(?) of a procedure,
which is what NVidia does.

Intel does not like the code, but for different reasons.

Looking at the standard, I only found:

C1233 (R1217) An expression that is an output-item shall not have a value that
is a procedure pointer.

While a is not a procedure pointer, I don't see why such a procedure reference
can be allowed.

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

* [Bug fortran/107074] ICE: Bad IO basetype (8)
  2022-09-28 17:34 [Bug fortran/107074] New: ICE: Bad IO basetype (8) gscfq@t-online.de
  2022-09-28 18:53 ` [Bug fortran/107074] " anlauf at gcc dot gnu.org
@ 2022-09-28 19:10 ` anlauf at gcc dot gnu.org
  2022-10-03 20:31 ` anlauf at gcc dot gnu.org
  2022-10-04 19:35 ` anlauf at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-09-28 19:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from anlauf at gcc dot gnu.org ---
We also crash in the same place on:

program p
  implicit none
  procedure(real), pointer :: a
  print *, merge(a, a, .true.)
end

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

* [Bug fortran/107074] ICE: Bad IO basetype (8)
  2022-09-28 17:34 [Bug fortran/107074] New: ICE: Bad IO basetype (8) gscfq@t-online.de
  2022-09-28 18:53 ` [Bug fortran/107074] " anlauf at gcc dot gnu.org
  2022-09-28 19:10 ` anlauf at gcc dot gnu.org
@ 2022-10-03 20:31 ` anlauf at gcc dot gnu.org
  2022-10-04 19:35 ` anlauf at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-10-03 20:31 UTC (permalink / raw)
  To: gcc-bugs

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

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 ---
Potential fix:

diff --git a/gcc/fortran/trans-io.cc b/gcc/fortran/trans-io.cc
index 9f86815388c..2f1a7be04aa 100644
--- a/gcc/fortran/trans-io.cc
+++ b/gcc/fortran/trans-io.cc
@@ -2529,6 +2529,17 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree
addr_expr,
        }
       gcc_fallthrough ();
     default:
+      if (ts->type == BT_PROCEDURE
+         && code->expr1
+         && code->expr1->symtree
+         && code->expr1->symtree->n.sym)
+       {
+         if (code->expr1->symtree->n.sym->attr.proc_pointer)
+           gfc_error ("Procedure pointer at %C cannot be an output item");
+         else
+           gfc_error ("Procedure at %C cannot be an output item");
+         return;
+       }
       gfc_internal_error ("Bad IO basetype (%d)", ts->type);
     }

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

* [Bug fortran/107074] ICE: Bad IO basetype (8)
  2022-09-28 17:34 [Bug fortran/107074] New: ICE: Bad IO basetype (8) gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2022-10-03 20:31 ` anlauf at gcc dot gnu.org
@ 2022-10-04 19:35 ` anlauf at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-10-04 19:35 UTC (permalink / raw)
  To: gcc-bugs

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

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-October/058278.html

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

end of thread, other threads:[~2022-10-04 19:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-28 17:34 [Bug fortran/107074] New: ICE: Bad IO basetype (8) gscfq@t-online.de
2022-09-28 18:53 ` [Bug fortran/107074] " anlauf at gcc dot gnu.org
2022-09-28 19:10 ` anlauf at gcc dot gnu.org
2022-10-03 20:31 ` anlauf at gcc dot gnu.org
2022-10-04 19:35 ` 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).