public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/105633] New: ICE in find_array_section, at fortran/expr.cc:1582
@ 2022-05-17 18:44 gscfq@t-online.de
  2022-05-17 19:12 ` [Bug fortran/105633] " kargl at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: gscfq@t-online.de @ 2022-05-17 18:44 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105633
           Summary: ICE in find_array_section, at fortran/expr.cc:1582
           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 :
(follow-up of pr105230)


$ cat z1.f90
program p
   integer, parameter :: a(:) = [1,2]
   print *, [a([1,2])]
end


$ cat z2.f90
program p
   integer, parameter :: a(:) = [1,2,2]
   print *, reshape([1,2,3,4], a([3,2]))
end


$ gfortran-13-20220515 -c z1.f90
z1.f90:2:29:

    2 |    integer, parameter :: a(:) = [1,2]
      |                             1
Error: Parameter array 'a' at (1) cannot be automatic or of deferred shape
f951: internal compiler error: Segmentation fault
0xe7b33f crash_signal
        ../../gcc/toplev.cc:322
0x73877d find_array_section
        ../../gcc/fortran/expr.cc:1582
0x739f0a simplify_const_ref
        ../../gcc/fortran/expr.cc:1934
0x73aa3e gfc_simplify_expr(gfc_expr*, int)
        ../../gcc/fortran/expr.cc:2325
0x73acab simplify_parameter_variable
        ../../gcc/fortran/expr.cc:2154
0x73a9d5 gfc_simplify_expr(gfc_expr*, int)
        ../../gcc/fortran/expr.cc:2292
0x701228 expand_constructor
        ../../gcc/fortran/array.cc:1827
0x703517 gfc_array_size(gfc_expr*, __mpz_struct (*) [1])
        ../../gcc/fortran/array.cc:2677
0x7a61df expression_shape
        ../../gcc/fortran/resolve.cc:5519
0x7a61df gfc_expression_rank(gfc_expr*)
        ../../gcc/fortran/resolve.cc:5593
0x7a7aaf gfc_resolve_expr(gfc_expr*)
        ../../gcc/fortran/resolve.cc:7223
0x7afb9c gfc_resolve_expr(gfc_expr*)
        ../../gcc/fortran/resolve.cc:7154
0x7afb9c gfc_resolve_code(gfc_code*, gfc_namespace*)
        ../../gcc/fortran/resolve.cc:11966
0x7ae62f gfc_resolve_blocks(gfc_code*, gfc_namespace*)
        ../../gcc/fortran/resolve.cc:10965
0x7ae988 gfc_resolve_code(gfc_code*, gfc_namespace*)
        ../../gcc/fortran/resolve.cc:11956
0x7b1717 resolve_codes
        ../../gcc/fortran/resolve.cc:17602
0x7b17de gfc_resolve(gfc_namespace*)
        ../../gcc/fortran/resolve.cc:17637
0x799664 resolve_all_program_units
        ../../gcc/fortran/parse.cc:6604
0x799664 gfc_parse_file()
        ../../gcc/fortran/parse.cc:6860
0x7e7eef gfc_be_parse_file
        ../../gcc/fortran/f95-lang.cc:216

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

* [Bug fortran/105633] ICE in find_array_section, at fortran/expr.cc:1582
  2022-05-17 18:44 [Bug fortran/105633] New: ICE in find_array_section, at fortran/expr.cc:1582 gscfq@t-online.de
@ 2022-05-17 19:12 ` kargl at gcc dot gnu.org
  2022-10-19 20:16 ` anlauf at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: kargl at gcc dot gnu.org @ 2022-05-17 19:12 UTC (permalink / raw)
  To: gcc-bugs

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

kargl at gcc dot gnu.org changed:

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

--- Comment #1 from kargl at gcc dot gnu.org ---
diff --git a/gcc/fortran/expr.cc b/gcc/fortran/expr.cc
index be94c18c836..eb1afb62e06 100644
--- a/gcc/fortran/expr.cc
+++ b/gcc/fortran/expr.cc
@@ -1552,6 +1552,12 @@ find_array_section (gfc_expr *expr, gfc_ref *ref)
       lower = ref->u.ar.as->lower[d];
       upper = ref->u.ar.as->upper[d];

+      if (!lower || !upper)
+       {
+         t = false;
+         goto cleanup;
+       }
+
       if (ref->u.ar.dimen_type[d] == DIMEN_VECTOR)  /* Vector subscript.  */
        {
          gfc_constructor *ci;

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

* [Bug fortran/105633] ICE in find_array_section, at fortran/expr.cc:1582
  2022-05-17 18:44 [Bug fortran/105633] New: ICE in find_array_section, at fortran/expr.cc:1582 gscfq@t-online.de
  2022-05-17 19:12 ` [Bug fortran/105633] " kargl at gcc dot gnu.org
@ 2022-10-19 20:16 ` anlauf at gcc dot gnu.org
  2022-10-19 20:50 ` anlauf at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-10-19 20:16 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |anlauf at gcc dot gnu.org
             Status|NEW                         |ASSIGNED
           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)
> diff --git a/gcc/fortran/expr.cc b/gcc/fortran/expr.cc
> index be94c18c836..eb1afb62e06 100644
> --- a/gcc/fortran/expr.cc
> +++ b/gcc/fortran/expr.cc
> @@ -1552,6 +1552,12 @@ find_array_section (gfc_expr *expr, gfc_ref *ref)
>        lower = ref->u.ar.as->lower[d];
>        upper = ref->u.ar.as->upper[d];
>  
> +      if (!lower || !upper)
> +	{
> +	  t = false;
> +	  goto cleanup;
> +	}
> +
>        if (ref->u.ar.dimen_type[d] == DIMEN_VECTOR)  /* Vector subscript.  */
>  	{
>  	  gfc_constructor *ci;

Taking it.

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

* [Bug fortran/105633] ICE in find_array_section, at fortran/expr.cc:1582
  2022-05-17 18:44 [Bug fortran/105633] New: ICE in find_array_section, at fortran/expr.cc:1582 gscfq@t-online.de
  2022-05-17 19:12 ` [Bug fortran/105633] " kargl at gcc dot gnu.org
  2022-10-19 20:16 ` anlauf at gcc dot gnu.org
@ 2022-10-19 20:50 ` anlauf at gcc dot gnu.org
  2022-10-20 20:20 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-10-19 20:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from anlauf at gcc dot gnu.org ---
Here it goes: https://gcc.gnu.org/pipermail/fortran/2022-October/058369.html

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

* [Bug fortran/105633] ICE in find_array_section, at fortran/expr.cc:1582
  2022-05-17 18:44 [Bug fortran/105633] New: ICE in find_array_section, at fortran/expr.cc:1582 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2022-10-19 20:50 ` anlauf at gcc dot gnu.org
@ 2022-10-20 20:20 ` cvs-commit at gcc dot gnu.org
  2022-10-20 20:23 ` anlauf at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-10-20 20:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 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:ecb20df4fa6d99daa635c7fb662dc0554610777e

commit r13-3421-gecb20df4fa6d99daa635c7fb662dc0554610777e
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Wed Oct 19 22:37:56 2022 +0200

    Fortran: error recovery with references of bad array constructors
[PR105633]

    gcc/fortran/ChangeLog:

            PR fortran/105633
            * expr.cc (find_array_section): Move check for NULL pointers so
            that both subscript triplets and vector subscripts are covered.

    gcc/testsuite/ChangeLog:

            PR fortran/105633
            * gfortran.dg/pr105633.f90: New test.

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

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

* [Bug fortran/105633] ICE in find_array_section, at fortran/expr.cc:1582
  2022-05-17 18:44 [Bug fortran/105633] New: ICE in find_array_section, at fortran/expr.cc:1582 gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2022-10-20 20:20 ` cvs-commit at gcc dot gnu.org
@ 2022-10-20 20:23 ` anlauf at gcc dot gnu.org
  2022-10-23 19:56 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-10-20 20:23 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from anlauf at gcc dot gnu.org ---
Fixed on mainline.

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

* [Bug fortran/105633] ICE in find_array_section, at fortran/expr.cc:1582
  2022-05-17 18:44 [Bug fortran/105633] New: ICE in find_array_section, at fortran/expr.cc:1582 gscfq@t-online.de
                   ` (4 preceding siblings ...)
  2022-10-20 20:23 ` anlauf at gcc dot gnu.org
@ 2022-10-23 19:56 ` cvs-commit at gcc dot gnu.org
  2022-10-23 19:59 ` cvs-commit at gcc dot gnu.org
  2022-10-23 20:17 ` cvs-commit at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-10-23 19:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Harald Anlauf
<anlauf@gcc.gnu.org>:

https://gcc.gnu.org/g:e3c997824f17dd6a4f7eb8d668b9ed2ef84408fc

commit r12-8860-ge3c997824f17dd6a4f7eb8d668b9ed2ef84408fc
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Wed Oct 19 22:37:56 2022 +0200

    Fortran: error recovery with references of bad array constructors
[PR105633]

    gcc/fortran/ChangeLog:

            PR fortran/105633
            * expr.cc (find_array_section): Move check for NULL pointers so
            that both subscript triplets and vector subscripts are covered.

    gcc/testsuite/ChangeLog:

            PR fortran/105633
            * gfortran.dg/pr105633.f90: New test.

    Co-authored-by: Steven G. Kargl <kargl@gcc.gnu.org>
    (cherry picked from commit ecb20df4fa6d99daa635c7fb662dc0554610777e)

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

* [Bug fortran/105633] ICE in find_array_section, at fortran/expr.cc:1582
  2022-05-17 18:44 [Bug fortran/105633] New: ICE in find_array_section, at fortran/expr.cc:1582 gscfq@t-online.de
                   ` (5 preceding siblings ...)
  2022-10-23 19:56 ` cvs-commit at gcc dot gnu.org
@ 2022-10-23 19:59 ` cvs-commit at gcc dot gnu.org
  2022-10-23 20:17 ` cvs-commit at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-10-23 19:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Harald Anlauf
<anlauf@gcc.gnu.org>:

https://gcc.gnu.org/g:c6ff6ca2fcefdd5edc37011a2ba8412a466d9b0b

commit r11-10330-gc6ff6ca2fcefdd5edc37011a2ba8412a466d9b0b
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Wed Oct 19 22:37:56 2022 +0200

    Fortran: error recovery with references of bad array constructors
[PR105633]

    gcc/fortran/ChangeLog:

            PR fortran/105633
            * expr.c (find_array_section): Move check for NULL pointers so
            that both subscript triplets and vector subscripts are covered.

    gcc/testsuite/ChangeLog:

            PR fortran/105633
            * gfortran.dg/pr105633.f90: New test.

    Co-authored-by: Steven G. Kargl <kargl@gcc.gnu.org>
    (cherry picked from commit ecb20df4fa6d99daa635c7fb662dc0554610777e)

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

* [Bug fortran/105633] ICE in find_array_section, at fortran/expr.cc:1582
  2022-05-17 18:44 [Bug fortran/105633] New: ICE in find_array_section, at fortran/expr.cc:1582 gscfq@t-online.de
                   ` (6 preceding siblings ...)
  2022-10-23 19:59 ` cvs-commit at gcc dot gnu.org
@ 2022-10-23 20:17 ` cvs-commit at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-10-23 20:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Harald Anlauf
<anlauf@gcc.gnu.org>:

https://gcc.gnu.org/g:910156619c93ff988587762b446542c4dfbb00a2

commit r10-11055-g910156619c93ff988587762b446542c4dfbb00a2
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Wed Oct 19 22:37:56 2022 +0200

    Fortran: error recovery with references of bad array constructors
[PR105633]

    gcc/fortran/ChangeLog:

            PR fortran/105633
            * expr.c (find_array_section): Move check for NULL pointers so
            that both subscript triplets and vector subscripts are covered.

    gcc/testsuite/ChangeLog:

            PR fortran/105633
            * gfortran.dg/pr105633.f90: New test.

    Co-authored-by: Steven G. Kargl <kargl@gcc.gnu.org>
    (cherry picked from commit ecb20df4fa6d99daa635c7fb662dc0554610777e)

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

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

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-17 18:44 [Bug fortran/105633] New: ICE in find_array_section, at fortran/expr.cc:1582 gscfq@t-online.de
2022-05-17 19:12 ` [Bug fortran/105633] " kargl at gcc dot gnu.org
2022-10-19 20:16 ` anlauf at gcc dot gnu.org
2022-10-19 20:50 ` anlauf at gcc dot gnu.org
2022-10-20 20:20 ` cvs-commit at gcc dot gnu.org
2022-10-20 20:23 ` anlauf at gcc dot gnu.org
2022-10-23 19:56 ` cvs-commit at gcc dot gnu.org
2022-10-23 19:59 ` cvs-commit at gcc dot gnu.org
2022-10-23 20:17 ` 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).