public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/95398] New: ICE on invalid code
@ 2020-05-28 21:33 kargl at gcc dot gnu.org
  2020-05-28 21:35 ` [Bug fortran/95398] " sgk at troutmask dot apl.washington.edu
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: kargl at gcc dot gnu.org @ 2020-05-28 21:33 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95398
           Summary: ICE on invalid code
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kargl at gcc dot gnu.org
  Target Milestone: ---

Code posted at 

https://groups.google.com/forum/#!topic/comp.lang.fortran/mW1gV6tyxXk

leads to

% gfcx -c a.f90
a.f90:32:16:

   32 |          foo => array1(2,U)
      |                1
Error: Pointer assignment target is neither TARGET nor POINTER at (1)
a.f90:34:16:

   34 |          foo => array2(2,U)
      |                1
Error: Pointer assignment target is neither TARGET nor POINTER at (1)
f951: internal compiler error: Segmentation fault
0xdf6e3a crash_signal
        ../../gccx/gcc/toplev.c:328
0x83fb5c resolve_select_type
        ../../gccx/gcc/fortran/resolve.c:9169
0x83c9a4 gfc_resolve_code(gfc_code*, gfc_namespace*)
        ../../gccx/gcc/fortran/resolve.c:11908
0x840f78 resolve_codes
        ../../gccx/gcc/fortran/resolve.c:17197
0x82ba33 gfc_resolve(gfc_namespace*)
        ../../gccx/gcc/fortran/resolve.c:17232
0x82ba33 gfc_resolve(gfc_namespace*)
        ../../gccx/gcc/fortran/resolve.c:17211
0x81de68 resolve_all_program_units
        ../../gccx/gcc/fortran/parse.c:6241
0x81de68 gfc_parse_file()
        ../../gccx/gcc/fortran/parse.c:6488
0x871858 gfc_be_parse_file
        ../../gccx/gcc/fortran/f95-lang.c:210
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

This patch fixes the ICE. Do with it what you want.


Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c       (revision 280157)
+++ gcc/fortran/resolve.c       (working copy)
s@@ -9166,7 +9172,9 @@ resolve_select_type (gfc_code *code, gfc_namespace *ol
          selector_type = CLASS_DATA (code->expr2)->ts.u.derived;
        }

-      if (code->expr2->rank && CLASS_DATA (code->expr1)->as)
+      if (code->expr2->rank
+         && code->expr1->ts.type == BT_CLASS
+         && CLASS_DATA (code->expr1)->as)
        CLASS_DATA (code->expr1)->as->rank = code->expr2->rank;

       /* F2008: C803 The selector expression must not be coindexed.  */

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

end of thread, other threads:[~2023-06-21 16:06 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-28 21:33 [Bug fortran/95398] New: ICE on invalid code kargl at gcc dot gnu.org
2020-05-28 21:35 ` [Bug fortran/95398] " sgk at troutmask dot apl.washington.edu
2020-06-04 12:08 ` dominiq at lps dot ens.fr
2020-09-01  9:57 ` cvs-commit at gcc dot gnu.org
2020-09-01 13:58 ` cvs-commit at gcc dot gnu.org
2020-09-01 13:59 ` markeggleston at gcc dot gnu.org
2023-06-21 16:06 ` 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).