public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/103779] New: ICE in gfc_convert_chartype, at fortran/intrinsic.c:5400
@ 2021-12-20 17:55 gscfq@t-online.de
  2021-12-22 23:24 ` [Bug fortran/103779] " kargl at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: gscfq@t-online.de @ 2021-12-20 17:55 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103779
           Summary: ICE in gfc_convert_chartype, at
                    fortran/intrinsic.c:5400
           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: ---

Affects versions down to at least r5 :
(gcc configured with --enable-checking=yes)


$ cat z1.f90
character(1,) function f()
   f = 'a'
end


$ cat z2.f90
character(1, kind=) function f()
   f = 'a'
end


$ cat z3.f90
character(1,n) function f()
   f = 'a'
end


$ gfortran-12-20211219 -c z1.f90
z1.f90:1:13:

    1 | character(1,) function f()
      |             1
Error: Expected initialization expression at (1)
z1.f90:1:0:

    1 | character(1,) function f()
      |
Error: Bad kind expression for function 'f' at (1)
f951: internal compiler error: in gfc_convert_chartype, at
fortran/intrinsic.c:5400
0x7fde0a gfc_convert_chartype(gfc_expr*, gfc_typespec*)
        ../../gcc/fortran/intrinsic.c:5400
0x84e195 resolve_ordinary_assign
        ../../gcc/fortran/resolve.c:11183
0x85648c gfc_resolve_code(gfc_code*, gfc_namespace*)
        ../../gcc/fortran/resolve.c:12042
0x8589e7 resolve_codes
        ../../gcc/fortran/resolve.c:17532
0x858aae gfc_resolve(gfc_namespace*)
        ../../gcc/fortran/resolve.c:17567
0x840dd4 resolve_all_program_units
        ../../gcc/fortran/parse.c:6586
0x840dd4 gfc_parse_file()
        ../../gcc/fortran/parse.c:6842
0x88efcf gfc_be_parse_file
        ../../gcc/fortran/f95-lang.c:216

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

* [Bug fortran/103779] ICE in gfc_convert_chartype, at fortran/intrinsic.c:5400
  2021-12-20 17:55 [Bug fortran/103779] New: ICE in gfc_convert_chartype, at fortran/intrinsic.c:5400 gscfq@t-online.de
@ 2021-12-22 23:24 ` kargl at gcc dot gnu.org
  2021-12-22 23:25 ` kargl at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: kargl at gcc dot gnu.org @ 2021-12-22 23:24 UTC (permalink / raw)
  To: gcc-bugs

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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
           Priority|P3                          |P4
     Ever confirmed|0                           |1
                 CC|                            |kargl at gcc dot gnu.org
   Last reconfirmed|                            |2021-12-22

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

* [Bug fortran/103779] ICE in gfc_convert_chartype, at fortran/intrinsic.c:5400
  2021-12-20 17:55 [Bug fortran/103779] New: ICE in gfc_convert_chartype, at fortran/intrinsic.c:5400 gscfq@t-online.de
  2021-12-22 23:24 ` [Bug fortran/103779] " kargl at gcc dot gnu.org
@ 2021-12-22 23:25 ` kargl at gcc dot gnu.org
  2023-02-09 19:59 ` anlauf at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: kargl at gcc dot gnu.org @ 2021-12-22 23:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from kargl at gcc dot gnu.org ---
Created attachment 52047
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52047&action=edit
remove an assert() that causes an ICE in the face of invalid code

The attach patch removes an assert() and now has the
function 'return false' if sym == NULL.  Invalid code
can cause this condition.  See the bug report.

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

* [Bug fortran/103779] ICE in gfc_convert_chartype, at fortran/intrinsic.c:5400
  2021-12-20 17:55 [Bug fortran/103779] New: ICE in gfc_convert_chartype, at fortran/intrinsic.c:5400 gscfq@t-online.de
  2021-12-22 23:24 ` [Bug fortran/103779] " kargl at gcc dot gnu.org
  2021-12-22 23:25 ` kargl at gcc dot gnu.org
@ 2023-02-09 19:59 ` anlauf at gcc dot gnu.org
  2023-02-09 20:22 ` cvs-commit at gcc dot gnu.org
  2023-02-09 20:30 ` anlauf at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-02-09 19:59 UTC (permalink / raw)
  To: gcc-bugs

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

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

--- Comment #2 from anlauf at gcc dot gnu.org ---
(In reply to kargl from comment #1)
> Created attachment 52047 [details]
> remove an assert() that causes an ICE in the face of invalid code
> 
> The attach patch removes an assert() and now has the
> function 'return false' if sym == NULL.  Invalid code
> can cause this condition.  See the bug report.

This is the same fix as in pr69636#c7.

I'll take care of it.

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

* [Bug fortran/103779] ICE in gfc_convert_chartype, at fortran/intrinsic.c:5400
  2021-12-20 17:55 [Bug fortran/103779] New: ICE in gfc_convert_chartype, at fortran/intrinsic.c:5400 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2023-02-09 19:59 ` anlauf at gcc dot gnu.org
@ 2023-02-09 20:22 ` cvs-commit at gcc dot gnu.org
  2023-02-09 20:30 ` anlauf at gcc dot gnu.org
  4 siblings, 0 replies; 6+ 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=103779

--- Comment #3 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] 6+ messages in thread

* [Bug fortran/103779] ICE in gfc_convert_chartype, at fortran/intrinsic.c:5400
  2021-12-20 17:55 [Bug fortran/103779] New: ICE in gfc_convert_chartype, at fortran/intrinsic.c:5400 gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2023-02-09 20:22 ` cvs-commit at gcc dot gnu.org
@ 2023-02-09 20:30 ` anlauf at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-02-09 20:30 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

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

--- Comment #4 from anlauf at gcc dot gnu.org ---
Fixed on mainline for gcc-13.

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

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

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-20 17:55 [Bug fortran/103779] New: ICE in gfc_convert_chartype, at fortran/intrinsic.c:5400 gscfq@t-online.de
2021-12-22 23:24 ` [Bug fortran/103779] " kargl at gcc dot gnu.org
2021-12-22 23:25 ` kargl at gcc dot gnu.org
2023-02-09 19:59 ` anlauf at gcc dot gnu.org
2023-02-09 20:22 ` cvs-commit at gcc dot gnu.org
2023-02-09 20:30 ` 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).