public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/98472] New: internal compiler error: in gfc_conv_expr_descriptor, at fortran/trans-array.c:7352
@ 2020-12-29 15:41 ruicoelhopedro at hotmail dot com
  2021-01-02 17:18 ` [Bug fortran/98472] " dominiq at lps dot ens.fr
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: ruicoelhopedro at hotmail dot com @ 2020-12-29 15:41 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98472
           Summary: internal compiler error: in gfc_conv_expr_descriptor,
                    at fortran/trans-array.c:7352
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ruicoelhopedro at hotmail dot com
  Target Milestone: ---

This occurs during an allocation whose source is the result of an elemental
function in a polymorphic class.
Tested in versions 7.5.0, 9.2.1 and 10.2.0, report below is shown for version
10.2.0




$ cat mwe.f90
module a
        type, abstract :: base
        contains
                procedure(elem_func), deferred, nopass :: add
        end type base

        type, extends(base) :: derived
        contains
                procedure, nopass :: add => add_derived
        end type derived

        abstract interface
                elemental function elem_func(x, y) result(out)
                        integer, intent(in) :: x, y
                        integer :: out
                end function elem_func
        end interface

contains
        elemental function add_derived(x, y) result(out)
                integer, intent(in) :: x, y
                integer :: out
                out = x + y
        end function add_derived
end module a

program main
        use a
        integer, dimension(:), allocatable :: vec
        class(base), allocatable :: instance
        allocate(derived :: instance)
        allocate(vec, source=instance%add([1, 2], [1, 2]))
end program main




$ gfortran mwe.f90
mwe.f90:32:0:

   32 |         allocate(vec, source=instance%add([1, 2], [1, 2]))
      | 
internal compiler error: in gfc_conv_expr_descriptor, at
fortran/trans-array.c:7352
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://bugs.archlinux.org/> for instructions.




$ gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib
--libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++,d --with-isl
--with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit
--enable-cet=auto --enable-checking=release --enable-clocale=gnu
--enable-default-pie --enable-default-ssp --enable-gnu-indirect-function
--enable-gnu-unique-object --enable-install-libiberty --enable-linker-build-id
--enable-lto --enable-multilib --enable-plugin --enable-shared
--enable-threads=posix --disable-libssp --disable-libstdcxx-pch
--disable-libunwind-exceptions --disable-werror
gdc_include_dir=/usr/include/dlang/gdc
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.2.0 (GCC)

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

* [Bug fortran/98472] internal compiler error: in gfc_conv_expr_descriptor, at fortran/trans-array.c:7352
  2020-12-29 15:41 [Bug fortran/98472] New: internal compiler error: in gfc_conv_expr_descriptor, at fortran/trans-array.c:7352 ruicoelhopedro at hotmail dot com
@ 2021-01-02 17:18 ` dominiq at lps dot ens.fr
  2021-01-04 12:15 ` marxin at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: dominiq at lps dot ens.fr @ 2021-01-02 17:18 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-01-02
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Confirmed from at least GCC7 up to GCC11.

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

* [Bug fortran/98472] internal compiler error: in gfc_conv_expr_descriptor, at fortran/trans-array.c:7352
  2020-12-29 15:41 [Bug fortran/98472] New: internal compiler error: in gfc_conv_expr_descriptor, at fortran/trans-array.c:7352 ruicoelhopedro at hotmail dot com
  2021-01-02 17:18 ` [Bug fortran/98472] " dominiq at lps dot ens.fr
@ 2021-01-04 12:15 ` marxin at gcc dot gnu.org
  2021-01-25 14:39 ` pault at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-01-04 12:15 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

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

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Yes, GCC 4.8.0 is also affected.

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

* [Bug fortran/98472] internal compiler error: in gfc_conv_expr_descriptor, at fortran/trans-array.c:7352
  2020-12-29 15:41 [Bug fortran/98472] New: internal compiler error: in gfc_conv_expr_descriptor, at fortran/trans-array.c:7352 ruicoelhopedro at hotmail dot com
  2021-01-02 17:18 ` [Bug fortran/98472] " dominiq at lps dot ens.fr
  2021-01-04 12:15 ` marxin at gcc dot gnu.org
@ 2021-01-25 14:39 ` pault at gcc dot gnu.org
  2021-01-25 14:51 ` dominiq at lps dot ens.fr
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pault at gcc dot gnu.org @ 2021-01-25 14:39 UTC (permalink / raw)
  To: gcc-bugs

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

Paul Thomas <pault at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |pault at gcc dot gnu.org
                 CC|                            |pault at gcc dot gnu.org

--- Comment #3 from Paul Thomas <pault at gcc dot gnu.org> ---
This is a case of a gcc_assert too many. Deleting the following cures the
problem:

          if (ss_expr != expr)
            /* Elemental function.  */
            gcc_assert ((expr->value.function.esym != NULL
                         && expr->value.function.esym->attr.elemental)
                        || (expr->value.function.isym != NULL
                            && expr->value.function.isym->elemental)
                        || gfc_inline_intrinsic_function_p (expr));
          else
            gcc_assert (ss_type == GFC_SS_INTRINSIC);

The preceeding if statement, has
      if (ss_expr != expr || ss_type != GFC_SS_FUNCTION)

so the second assert is redundant. I am disinclined to add any more clauses to
the first :-)

This change regtests OK.

However adding:

|| (gfc_expr_attr (expr).proc_pointer && gfc_expr_attr (expr).elemental)

does the job and regtests too.

Paul

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

* [Bug fortran/98472] internal compiler error: in gfc_conv_expr_descriptor, at fortran/trans-array.c:7352
  2020-12-29 15:41 [Bug fortran/98472] New: internal compiler error: in gfc_conv_expr_descriptor, at fortran/trans-array.c:7352 ruicoelhopedro at hotmail dot com
                   ` (2 preceding siblings ...)
  2021-01-25 14:39 ` pault at gcc dot gnu.org
@ 2021-01-25 14:51 ` dominiq at lps dot ens.fr
  2021-01-27  9:13 ` cvs-commit at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: dominiq at lps dot ens.fr @ 2021-01-25 14:51 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED

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

* [Bug fortran/98472] internal compiler error: in gfc_conv_expr_descriptor, at fortran/trans-array.c:7352
  2020-12-29 15:41 [Bug fortran/98472] New: internal compiler error: in gfc_conv_expr_descriptor, at fortran/trans-array.c:7352 ruicoelhopedro at hotmail dot com
                   ` (3 preceding siblings ...)
  2021-01-25 14:51 ` dominiq at lps dot ens.fr
@ 2021-01-27  9:13 ` cvs-commit at gcc dot gnu.org
  2021-09-10 19:55 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-01-27  9:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Paul Thomas <pault@gcc.gnu.org>:

https://gcc.gnu.org/g:003f0414291d595d2126e6d2e24b281f38f3448f

commit r11-6924-g003f0414291d595d2126e6d2e24b281f38f3448f
Author: Paul Thomas <pault@gcc.gnu.org>
Date:   Wed Jan 27 09:12:16 2021 +0000

    Fortran: Fix ICE due to elemental procedure pointers [PR98472].

    2021-01-27  Paul Thomas  <pault@gcc.gnu.org>

    gcc/fortran
            PR fortran/98472
            * trans-array.c (gfc_conv_expr_descriptor): Include elemental
            procedure pointers in the assert under the comment 'elemental
            function' and eliminate the second, spurious assert.

    gcc/testsuite/
            PR fortran/98472
            * gfortran.dg/elemental_function_5.f90 : New test.

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

* [Bug fortran/98472] internal compiler error: in gfc_conv_expr_descriptor, at fortran/trans-array.c:7352
  2020-12-29 15:41 [Bug fortran/98472] New: internal compiler error: in gfc_conv_expr_descriptor, at fortran/trans-array.c:7352 ruicoelhopedro at hotmail dot com
                   ` (4 preceding siblings ...)
  2021-01-27  9:13 ` cvs-commit at gcc dot gnu.org
@ 2021-09-10 19:55 ` cvs-commit at gcc dot gnu.org
  2021-09-10 19:57 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-09-10 19:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 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:0a79a5457a1a982dd05b8ae33e1320d040a20ccd

commit r10-10107-g0a79a5457a1a982dd05b8ae33e1320d040a20ccd
Author: Paul Thomas <pault@gcc.gnu.org>
Date:   Wed Jan 27 09:12:16 2021 +0000

    Fortran: Fix ICE due to elemental procedure pointers [PR98472].

    2021-01-27  Paul Thomas  <pault@gcc.gnu.org>

    gcc/fortran
            PR fortran/98472
            * trans-array.c (gfc_conv_expr_descriptor): Include elemental
            procedure pointers in the assert under the comment 'elemental
            function' and eliminate the second, spurious assert.

    gcc/testsuite/
            PR fortran/98472
            * gfortran.dg/elemental_function_5.f90 : New test.

    (cherry picked from commit 003f0414291d595d2126e6d2e24b281f38f3448f)

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

* [Bug fortran/98472] internal compiler error: in gfc_conv_expr_descriptor, at fortran/trans-array.c:7352
  2020-12-29 15:41 [Bug fortran/98472] New: internal compiler error: in gfc_conv_expr_descriptor, at fortran/trans-array.c:7352 ruicoelhopedro at hotmail dot com
                   ` (5 preceding siblings ...)
  2021-09-10 19:55 ` cvs-commit at gcc dot gnu.org
@ 2021-09-10 19:57 ` cvs-commit at gcc dot gnu.org
  2021-09-10 19:58 ` anlauf at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-09-10 19:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 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:c101105e7852a940f967137f6b9e0a97d7f2c3c3

commit r9-9719-gc101105e7852a940f967137f6b9e0a97d7f2c3c3
Author: Paul Thomas <pault@gcc.gnu.org>
Date:   Wed Jan 27 09:12:16 2021 +0000

    Fortran: Fix ICE due to elemental procedure pointers [PR98472].

    2021-01-27  Paul Thomas  <pault@gcc.gnu.org>

    gcc/fortran
            PR fortran/98472
            * trans-array.c (gfc_conv_expr_descriptor): Include elemental
            procedure pointers in the assert under the comment 'elemental
            function' and eliminate the second, spurious assert.

    gcc/testsuite/
            PR fortran/98472
            * gfortran.dg/elemental_function_5.f90 : New test.

    (cherry picked from commit 003f0414291d595d2126e6d2e24b281f38f3448f)

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

* [Bug fortran/98472] internal compiler error: in gfc_conv_expr_descriptor, at fortran/trans-array.c:7352
  2020-12-29 15:41 [Bug fortran/98472] New: internal compiler error: in gfc_conv_expr_descriptor, at fortran/trans-array.c:7352 ruicoelhopedro at hotmail dot com
                   ` (6 preceding siblings ...)
  2021-09-10 19:57 ` cvs-commit at gcc dot gnu.org
@ 2021-09-10 19:58 ` anlauf at gcc dot gnu.org
  2021-09-11  6:42 ` pinskia at gcc dot gnu.org
  2022-01-09 23:23 ` pinskia at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-09-10 19:58 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
                 CC|                            |anlauf at gcc dot gnu.org

--- Comment #7 from anlauf at gcc dot gnu.org ---
Backported to remaining open branches after verifying that it works.  Closing.

Thanks to everybody involved!

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

* [Bug fortran/98472] internal compiler error: in gfc_conv_expr_descriptor, at fortran/trans-array.c:7352
  2020-12-29 15:41 [Bug fortran/98472] New: internal compiler error: in gfc_conv_expr_descriptor, at fortran/trans-array.c:7352 ruicoelhopedro at hotmail dot com
                   ` (7 preceding siblings ...)
  2021-09-10 19:58 ` anlauf at gcc dot gnu.org
@ 2021-09-11  6:42 ` pinskia at gcc dot gnu.org
  2022-01-09 23:23 ` pinskia at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-11  6:42 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |9.5

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

* [Bug fortran/98472] internal compiler error: in gfc_conv_expr_descriptor, at fortran/trans-array.c:7352
  2020-12-29 15:41 [Bug fortran/98472] New: internal compiler error: in gfc_conv_expr_descriptor, at fortran/trans-array.c:7352 ruicoelhopedro at hotmail dot com
                   ` (8 preceding siblings ...)
  2021-09-11  6:42 ` pinskia at gcc dot gnu.org
@ 2022-01-09 23:23 ` pinskia at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-09 23:23 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ffadrique at gmail dot com

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 103957 has been marked as a duplicate of this bug. ***

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

end of thread, other threads:[~2022-01-09 23:23 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-29 15:41 [Bug fortran/98472] New: internal compiler error: in gfc_conv_expr_descriptor, at fortran/trans-array.c:7352 ruicoelhopedro at hotmail dot com
2021-01-02 17:18 ` [Bug fortran/98472] " dominiq at lps dot ens.fr
2021-01-04 12:15 ` marxin at gcc dot gnu.org
2021-01-25 14:39 ` pault at gcc dot gnu.org
2021-01-25 14:51 ` dominiq at lps dot ens.fr
2021-01-27  9:13 ` cvs-commit at gcc dot gnu.org
2021-09-10 19:55 ` cvs-commit at gcc dot gnu.org
2021-09-10 19:57 ` cvs-commit at gcc dot gnu.org
2021-09-10 19:58 ` anlauf at gcc dot gnu.org
2021-09-11  6:42 ` pinskia at gcc dot gnu.org
2022-01-09 23:23 ` pinskia 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).