public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/69636] ICE(s) on using option -fmodule-private
       [not found] <bug-69636-4@http.gcc.gnu.org/bugzilla/>
@ 2023-02-07 21:19 ` anlauf at gcc dot gnu.org
  2023-02-08 20:10 ` anlauf at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 4+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-02-07 21:19 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

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

--- Comment #7 from anlauf at gcc dot gnu.org ---
The ICE for the reduced testcase in comment#2 is fixed by:

diff --git a/gcc/fortran/intrinsic.cc b/gcc/fortran/intrinsic.cc
index 68f481473b4..97ff1d640d7 100644
--- a/gcc/fortran/intrinsic.cc
+++ b/gcc/fortran/intrinsic.cc
@@ -5419,7 +5419,9 @@ gfc_convert_chartype (gfc_expr *expr, gfc_typespec *ts)
   gcc_assert (expr->ts.type == BT_CHARACTER && ts->type == BT_CHARACTER);

   sym = find_char_conv (&expr->ts, ts);
-  gcc_assert (sym);
+  if (sym == NULL)
+    return false;
+//  gcc_assert (sym);

   /* Insert a pre-resolved function call to the right function.  */
   old_where = expr->where;

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

* [Bug fortran/69636] ICE(s) on using option -fmodule-private
       [not found] <bug-69636-4@http.gcc.gnu.org/bugzilla/>
  2023-02-07 21:19 ` [Bug fortran/69636] ICE(s) on using option -fmodule-private anlauf at gcc dot gnu.org
@ 2023-02-08 20:10 ` anlauf at gcc dot gnu.org
  2023-02-08 20:40 ` anlauf at gcc dot gnu.org
  2023-02-09 20:22 ` cvs-commit at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-02-08 20:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from anlauf at gcc dot gnu.org ---
A slightly reduced & rewritten variant of the code in comment#6:

module m
  implicit none
  private
  public  :: cx, operator(+)
  private :: cx_plus_int        ! <- why does this make a difference?
  type cx
    integer :: re
  end type
  interface operator (+)
    module procedure cx_plus_int
  end interface
contains
  function cx_plus_int (z, r)
  entry    int_plus_cx (r, z)   ! <- why does this make a difference?
    type(cx), intent(in) :: z
    integer,  intent(in) :: r
    type(cx)             :: cx_plus_int, int_plus_cx
    cx_plus_int%re = z%re + r
  end function
end module

program p
  use m
  type(cx) :: a = cx(1)
  print *, (a + 2)
end

So there are multiple issues at work:
- the explicit "private :: cx_plus_int" should not make a difference;
  I think I've seen a related PR
- adding an entry that is otherwise unused changes the module
- the modified module when read seems to obstruct finding cx_plus_int,
  although the symbols still appears to be there...

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

* [Bug fortran/69636] ICE(s) on using option -fmodule-private
       [not found] <bug-69636-4@http.gcc.gnu.org/bugzilla/>
  2023-02-07 21:19 ` [Bug fortran/69636] ICE(s) on using option -fmodule-private anlauf at gcc dot gnu.org
  2023-02-08 20:10 ` anlauf at gcc dot gnu.org
@ 2023-02-08 20:40 ` anlauf at gcc dot gnu.org
  2023-02-09 20:22 ` cvs-commit at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-02-08 20:40 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid

--- Comment #9 from anlauf at gcc dot gnu.org ---
(In reply to anlauf from comment #8)

Commenting out this line:

>   private :: cx_plus_int        ! <- why does this make a difference?

and adding in the main:

  print *, cx_plus_int(a, 2)

make the code compile, while I believe it shouldn't due to the "private"
statement in m.  (This version is rejected by other compilers.)

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

* [Bug fortran/69636] ICE(s) on using option -fmodule-private
       [not found] <bug-69636-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2023-02-08 20:40 ` anlauf at gcc dot gnu.org
@ 2023-02-09 20:22 ` cvs-commit at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-02-09 20:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 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:a618b45ac41cf480f54c4fa4014aed6218931290

commit r13-5760-ga618b45ac41cf480f54c4fa4014aed6218931290
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Thu Feb 9 21:16:14 2023 +0100

    Fortran: catch invalid kind in character conversion [PR69636,PR103779]

    gcc/fortran/ChangeLog:

            PR fortran/69636
            PR fortran/103779
            * intrinsic.cc (gfc_convert_chartype): Recover on invalid character
            kind in conversion instead of generating an internal error.

    gcc/testsuite/ChangeLog:

            PR fortran/69636
            PR fortran/103779
            * gfortran.dg/pr103779.f90: New test.

    Co-authored-by: Steven G. Kargl <kargl@gcc.gnu.org>

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

end of thread, other threads:[~2023-02-09 20:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-69636-4@http.gcc.gnu.org/bugzilla/>
2023-02-07 21:19 ` [Bug fortran/69636] ICE(s) on using option -fmodule-private anlauf at gcc dot gnu.org
2023-02-08 20:10 ` anlauf at gcc dot gnu.org
2023-02-08 20:40 ` anlauf at gcc dot gnu.org
2023-02-09 20:22 ` cvs-commit 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).