public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/82314] internal compiler error: in gfc_conv_expr_descriptor, at fortran/trans-array.c:6972
       [not found] <bug-82314-4@http.gcc.gnu.org/bugzilla/>
@ 2020-06-03 15:41 ` gscfq@t-online.de
  2020-06-30 20:26 ` anlauf at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: gscfq@t-online.de @ 2020-06-03 15:41 UTC (permalink / raw)
  To: gcc-bugs

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

G. Steinmetz <gscfq@t-online.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gscfq@t-online.de

--- Comment #5 from G. Steinmetz <gscfq@t-online.de> ---

Also related :


$ cat z1.f90
program p
   integer, parameter :: a(merge(2,3,.true.)) = 1, b = size(a)
   print *, rank(b)
end


$ cat z2.f90
program p
   integer, parameter :: a(merge(2,3,.true.)) = 1
   integer, parameter :: b = size(a)
   print *, rank(b)
end


$ gfortran-11-20200531 -c z2.f90
f951: internal compiler error: Segmentation fault
0xbc37bf crash_signal
        ../../gcc/toplev.c:328
0x62d62b gfc_check_rank(gfc_expr*)
        ../../gcc/fortran/check.c:4577
0x669a0c do_check
        ../../gcc/fortran/intrinsic.c:4737
0x669a0c check_specific
        ../../gcc/fortran/intrinsic.c:4750
0x673d04 gfc_intrinsic_func_interface(gfc_expr*, int)
        ../../gcc/fortran/intrinsic.c:4987
0x6c1bf3 resolve_unknown_f
        ../../gcc/fortran/resolve.c:2902
0x6c1bf3 resolve_function
        ../../gcc/fortran/resolve.c:3246
0x6c1bf3 gfc_resolve_expr(gfc_expr*)
        ../../gcc/fortran/resolve.c:7040
0x6c872c gfc_resolve_expr(gfc_expr*)
        ../../gcc/fortran/resolve.c:7007
0x6c872c gfc_resolve_code(gfc_code*, gfc_namespace*)
        ../../gcc/fortran/resolve.c:11742
0x6d186f gfc_resolve_blocks(gfc_code*, gfc_namespace*)
        ../../gcc/fortran/resolve.c:10769
0x6c7508 gfc_resolve_code(gfc_code*, gfc_namespace*)
        ../../gcc/fortran/resolve.c:11732
0x6c9d97 resolve_codes
        ../../gcc/fortran/resolve.c:17257
0x6c9e5e gfc_resolve(gfc_namespace*)
        ../../gcc/fortran/resolve.c:17292
0x6b1f9c resolve_all_program_units
        ../../gcc/fortran/parse.c:6245
0x6b1f9c gfc_parse_file()
        ../../gcc/fortran/parse.c:6492
0x6fdfff gfc_be_parse_file
        ../../gcc/fortran/f95-lang.c:210

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

* [Bug fortran/82314] internal compiler error: in gfc_conv_expr_descriptor, at fortran/trans-array.c:6972
       [not found] <bug-82314-4@http.gcc.gnu.org/bugzilla/>
  2020-06-03 15:41 ` [Bug fortran/82314] internal compiler error: in gfc_conv_expr_descriptor, at fortran/trans-array.c:6972 gscfq@t-online.de
@ 2020-06-30 20:26 ` anlauf at gcc dot gnu.org
  2020-11-12 20:05 ` anlauf at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2020-06-30 20:26 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

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

--- Comment #6 from anlauf at gcc dot gnu.org ---
(In reply to G. Steinmetz from comment #5)
> Also related :

The ICEs in comment#5 are fixed by

diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c
index de9a45fe4f9..57c7eb8e1f0 100644
--- a/gcc/fortran/check.c
+++ b/gcc/fortran/check.c
@@ -4577,7 +4577,8 @@ gfc_check_rank (gfc_expr *a)
   if (a->expr_type == EXPR_FUNCTION)
     is_variable = a->value.function.esym
                  ? a->value.function.esym->result->attr.pointer
-                 : a->symtree->n.sym->result->attr.pointer;
+                 : (a->symtree->n.sym->result
+                    && a->symtree->n.sym->result->attr.pointer);

   if (a->expr_type == EXPR_OP
       || a->expr_type == EXPR_NULL

giving an (invalid) error message:

    3 |    print *, rank(b)
      |                 1
Error: The argument of the RANK intrinsic at (1) must be a data object

Therefore *not* related.

The ICE from comment#0 remains.

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

* [Bug fortran/82314] internal compiler error: in gfc_conv_expr_descriptor, at fortran/trans-array.c:6972
       [not found] <bug-82314-4@http.gcc.gnu.org/bugzilla/>
  2020-06-03 15:41 ` [Bug fortran/82314] internal compiler error: in gfc_conv_expr_descriptor, at fortran/trans-array.c:6972 gscfq@t-online.de
  2020-06-30 20:26 ` anlauf at gcc dot gnu.org
@ 2020-11-12 20:05 ` anlauf at gcc dot gnu.org
  2021-09-07 20:32 ` anlauf at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2020-11-12 20:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from anlauf at gcc dot gnu.org ---
The ICE in comment#0 vanishes when one replaces

  integer,parameter::iarray(merge(2,3,.true.)) = 1

with

  integer,parameter::iarray(merge(2,3,.true.)) = [ 1, 1 ]

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

* [Bug fortran/82314] internal compiler error: in gfc_conv_expr_descriptor, at fortran/trans-array.c:6972
       [not found] <bug-82314-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2020-11-12 20:05 ` anlauf at gcc dot gnu.org
@ 2021-09-07 20:32 ` anlauf at gcc dot gnu.org
  2021-09-07 21:45 ` anlauf at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-09-07 20:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from anlauf at gcc dot gnu.org ---
I am testing the following patch which fixes comment#0:

diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 2e49a673e15..f2e8896b562 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -2169,6 +2169,24 @@ add_init_expr_to_sym (const char *name, gfc_expr
**initp, locus *var_locus)
          sym->as->type = AS_EXPLICIT;
        }

+      /* Ensure that explicit bounds are simplified.  */
+      if (sym->attr.flavor == FL_PARAMETER && sym->attr.dimension
+         && sym->as->type == AS_EXPLICIT)
+       {
+         for (int dim = 0; dim < sym->as->rank; ++dim)
+           {
+             gfc_expr *e;
+
+             e = sym->as->lower[dim];
+             if (e->expr_type != EXPR_CONSTANT)
+               gfc_reduce_init_expr (e);
+
+             e = sym->as->upper[dim];
+             if (e->expr_type != EXPR_CONSTANT)
+               gfc_reduce_init_expr (e);
+           }
+       }
+
       /* Need to check if the expression we initialized this
         to was one of the iso_c_binding named constants.  If so,
         and we're a parameter (constant), let it be iso_c.

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

* [Bug fortran/82314] internal compiler error: in gfc_conv_expr_descriptor, at fortran/trans-array.c:6972
       [not found] <bug-82314-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2021-09-07 20:32 ` anlauf at gcc dot gnu.org
@ 2021-09-07 21:45 ` anlauf at gcc dot gnu.org
  2021-09-13 17:28 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-09-07 21:45 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |anlauf at gcc dot gnu.org

--- Comment #9 from anlauf at gcc dot gnu.org ---
Patch: https://gcc.gnu.org/pipermail/fortran/2021-September/056492.html

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

* [Bug fortran/82314] internal compiler error: in gfc_conv_expr_descriptor, at fortran/trans-array.c:6972
       [not found] <bug-82314-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2021-09-07 21:45 ` anlauf at gcc dot gnu.org
@ 2021-09-13 17:28 ` cvs-commit at gcc dot gnu.org
  2021-09-16 18:18 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-09-13 17:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- 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:104c05c5284b7822d770ee51a7d91946c7e56d50

commit r12-3500-g104c05c5284b7822d770ee51a7d91946c7e56d50
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Mon Sep 13 19:28:10 2021 +0200

    Fortran - ensure simplification of bounds of array-valued named constants

    gcc/fortran/ChangeLog:

            PR fortran/82314
            * decl.c (add_init_expr_to_sym): For proper initialization of
            array-valued named constants the array bounds need to be
            simplified before adding the initializer.

    gcc/testsuite/ChangeLog:

            PR fortran/82314
            * gfortran.dg/pr82314.f90: New test.

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

* [Bug fortran/82314] internal compiler error: in gfc_conv_expr_descriptor, at fortran/trans-array.c:6972
       [not found] <bug-82314-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2021-09-13 17:28 ` cvs-commit at gcc dot gnu.org
@ 2021-09-16 18:18 ` cvs-commit at gcc dot gnu.org
  2021-09-30 19:04 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-09-16 18:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 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:58c76fb477b51adeb9241de0b175a817e9c73b8a

commit r11-9008-g58c76fb477b51adeb9241de0b175a817e9c73b8a
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Mon Sep 13 19:28:10 2021 +0200

    Fortran - ensure simplification of bounds of array-valued named constants

    gcc/fortran/ChangeLog:

            PR fortran/82314
            * decl.c (add_init_expr_to_sym): For proper initialization of
            array-valued named constants the array bounds need to be
            simplified before adding the initializer.

    gcc/testsuite/ChangeLog:

            PR fortran/82314
            * gfortran.dg/pr82314.f90: New test.

    (cherry picked from commit 104c05c5284b7822d770ee51a7d91946c7e56d50)

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

* [Bug fortran/82314] internal compiler error: in gfc_conv_expr_descriptor, at fortran/trans-array.c:6972
       [not found] <bug-82314-4@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2021-09-16 18:18 ` cvs-commit at gcc dot gnu.org
@ 2021-09-30 19:04 ` cvs-commit at gcc dot gnu.org
  2021-09-30 19:08 ` cvs-commit at gcc dot gnu.org
  2021-09-30 19:09 ` anlauf at gcc dot gnu.org
  9 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-09-30 19:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 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:39b948a8f404aa0bfb632d7b26bb0692b18f60c9

commit r10-10156-g39b948a8f404aa0bfb632d7b26bb0692b18f60c9
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Mon Sep 13 19:28:10 2021 +0200

    Fortran - ensure simplification of bounds of array-valued named constants

    gcc/fortran/ChangeLog:

            PR fortran/82314
            * decl.c (add_init_expr_to_sym): For proper initialization of
            array-valued named constants the array bounds need to be
            simplified before adding the initializer.

    gcc/testsuite/ChangeLog:

            PR fortran/82314
            * gfortran.dg/pr82314.f90: New test.

    (cherry picked from commit 104c05c5284b7822d770ee51a7d91946c7e56d50)

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

* [Bug fortran/82314] internal compiler error: in gfc_conv_expr_descriptor, at fortran/trans-array.c:6972
       [not found] <bug-82314-4@http.gcc.gnu.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2021-09-30 19:04 ` cvs-commit at gcc dot gnu.org
@ 2021-09-30 19:08 ` cvs-commit at gcc dot gnu.org
  2021-09-30 19:09 ` anlauf at gcc dot gnu.org
  9 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-09-30 19:08 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:3a70195d7da49fe793ce3eb0e839b9ceea96c97a

commit r9-9749-g3a70195d7da49fe793ce3eb0e839b9ceea96c97a
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Mon Sep 13 19:28:10 2021 +0200

    Fortran - ensure simplification of bounds of array-valued named constants

    gcc/fortran/ChangeLog:

            PR fortran/82314
            * decl.c (add_init_expr_to_sym): For proper initialization of
            array-valued named constants the array bounds need to be
            simplified before adding the initializer.

    gcc/testsuite/ChangeLog:

            PR fortran/82314
            * gfortran.dg/pr82314.f90: New test.

    (cherry picked from commit 104c05c5284b7822d770ee51a7d91946c7e56d50)

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

* [Bug fortran/82314] internal compiler error: in gfc_conv_expr_descriptor, at fortran/trans-array.c:6972
       [not found] <bug-82314-4@http.gcc.gnu.org/bugzilla/>
                   ` (8 preceding siblings ...)
  2021-09-30 19:08 ` cvs-commit at gcc dot gnu.org
@ 2021-09-30 19:09 ` anlauf at gcc dot gnu.org
  9 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-09-30 19:09 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |9.5
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #14 from anlauf at gcc dot gnu.org ---
Fixed on all open branches.  Closing.

Thanks for the report!

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

end of thread, other threads:[~2021-09-30 19:09 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-82314-4@http.gcc.gnu.org/bugzilla/>
2020-06-03 15:41 ` [Bug fortran/82314] internal compiler error: in gfc_conv_expr_descriptor, at fortran/trans-array.c:6972 gscfq@t-online.de
2020-06-30 20:26 ` anlauf at gcc dot gnu.org
2020-11-12 20:05 ` anlauf at gcc dot gnu.org
2021-09-07 20:32 ` anlauf at gcc dot gnu.org
2021-09-07 21:45 ` anlauf at gcc dot gnu.org
2021-09-13 17:28 ` cvs-commit at gcc dot gnu.org
2021-09-16 18:18 ` cvs-commit at gcc dot gnu.org
2021-09-30 19:04 ` cvs-commit at gcc dot gnu.org
2021-09-30 19:08 ` cvs-commit at gcc dot gnu.org
2021-09-30 19:09 ` 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).