public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/95979] New: [10/11 Regression] ICE in get_kind, at fortran/simplify.c:129
@ 2020-06-29 17:52 gscfq@t-online.de
  2020-06-29 20:21 ` [Bug fortran/95979] " anlauf at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: gscfq@t-online.de @ 2020-06-29 17:52 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95979
           Summary: [10/11 Regression] ICE in get_kind, at
                    fortran/simplify.c:129
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gscfq@t-online.de
  Target Milestone: ---

Changed between 20191215 and 20200105 :


$ cat z1.f90
program p
   integer :: a = index('abcd', 'c', [.true.], kind=1)
end


$ cat z2.f90
program p
   integer :: a = index('abcd', 'c', [.true.], kind=4)
end


$ cat z3.f90
program p
   integer :: a(1) = index('abcd', 'c', [.true.])
   integer :: b(1) = index('abcd', 'c', [.true.], kind=1)
   print *, a
   print *, b
end


$ gfortran-10-20191215 -c z1.f90
z1.f90:2:15:

    2 |    integer :: a = index('abcd', 'c', [.true.], kind=1)
      |               1
Error: Incompatible ranks 0 and 1 in assignment at (1)


$ gfortran-11-20200628 -c z1.f90
0xbd215f crash_signal
        ../../gcc/toplev.c:328
0x65730f gfc_format_decoder
        ../../gcc/fortran/error.c:981
0x1504fce pp_format(pretty_printer*, text_info*)
        ../../gcc/pretty-print.c:1475
0x14f96df diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info*)
        ../../gcc/diagnostic.c:1159
0x657489 gfc_report_diagnostic
        ../../gcc/fortran/error.c:782
0x65759b gfc_error_opt
        ../../gcc/fortran/error.c:1352
0x658aa0 gfc_error(char const*, ...)
        ../../gcc/fortran/error.c:1381
0x6db27a get_kind
        ../../gcc/fortran/simplify.c:129
0x6e4ce1 gfc_simplify_index(gfc_expr*, gfc_expr*, gfc_expr*, gfc_expr*)
        ../../gcc/fortran/simplify.c:3479
0x66c997 do_simplify
        ../../gcc/fortran/intrinsic.c:4634
0x677178 gfc_intrinsic_func_interface(gfc_expr*, int)
        ../../gcc/fortran/intrinsic.c:4899
0x65d5f9 gfc_simplify_expr(gfc_expr*, int)
        ../../gcc/fortran/expr.c:2180
0x65e03a scalarize_intrinsic_call
        ../../gcc/fortran/expr.c:2422
0x65c82b gfc_check_init_expr(gfc_expr*)
        ../../gcc/fortran/expr.c:2934
0x65cb07 gfc_reduce_init_expr(gfc_expr*)
        ../../gcc/fortran/expr.c:3087
0x65fd70 gfc_match_init_expr(gfc_expr**)
        ../../gcc/fortran/expr.c:3133
0x64b5f4 variable_decl
        ../../gcc/fortran/decl.c:2886
0x64b5f4 gfc_match_data_decl()
        ../../gcc/fortran/decl.c:6197
0x6ae0a3 match_word
        ../../gcc/fortran/parse.c:65
0x6ae0a3 decode_statement
        ../../gcc/fortran/parse.c:376

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

* [Bug fortran/95979] [10/11 Regression] ICE in get_kind, at fortran/simplify.c:129
  2020-06-29 17:52 [Bug fortran/95979] New: [10/11 Regression] ICE in get_kind, at fortran/simplify.c:129 gscfq@t-online.de
@ 2020-06-29 20:21 ` anlauf at gcc dot gnu.org
  2020-06-29 20:35 ` dominiq at lps dot ens.fr
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2020-06-29 20:21 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4
   Last reconfirmed|                            |2020-06-29
                 CC|                            |anlauf at gcc dot gnu.org
   Target Milestone|---                         |10.2
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

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

* [Bug fortran/95979] [10/11 Regression] ICE in get_kind, at fortran/simplify.c:129
  2020-06-29 17:52 [Bug fortran/95979] New: [10/11 Regression] ICE in get_kind, at fortran/simplify.c:129 gscfq@t-online.de
  2020-06-29 20:21 ` [Bug fortran/95979] " anlauf at gcc dot gnu.org
@ 2020-06-29 20:35 ` dominiq at lps dot ens.fr
  2020-07-23  6:52 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: dominiq at lps dot ens.fr @ 2020-06-29 20:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
I don't see the ICE on a standard GCC11, but its instrumented version gives

../../work/gcc/fortran/simplify.c:127:10: runtime error: load of value
4294967295, which is not a valid value for type 'expr_t'
../../work/gcc/fortran/error.c:970:2: runtime error: member access within
misaligned address 0x000000000002 for type 'struct gfc_linebuf', which requires
8 byte alignment
0x000000000002: note: pointer points here
<memory cannot be printed>
../../work/gcc/fortran/error.c:971:46: runtime error: member access within
misaligned address 0x000000000002 for type 'struct gfc_linebuf', which requires
8 byte alignment
0x000000000002: note: pointer points here
<memory cannot be printed>
../../work/gcc/fortran/error.c:979:42: runtime error: member access within
misaligned address 0x000000000002 for type 'struct gfc_linebuf', which requires
8 byte alignment
0x000000000002: note: pointer points here

The instrumented GCC9 and 10 give the expected error.

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

* [Bug fortran/95979] [10/11 Regression] ICE in get_kind, at fortran/simplify.c:129
  2020-06-29 17:52 [Bug fortran/95979] New: [10/11 Regression] ICE in get_kind, at fortran/simplify.c:129 gscfq@t-online.de
  2020-06-29 20:21 ` [Bug fortran/95979] " anlauf at gcc dot gnu.org
  2020-06-29 20:35 ` dominiq at lps dot ens.fr
@ 2020-07-23  6:52 ` rguenth at gcc dot gnu.org
  2020-08-25 20:44 ` anlauf at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-07-23  6:52 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.2                        |10.3

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10.2 is released, adjusting target milestone.

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

* [Bug fortran/95979] [10/11 Regression] ICE in get_kind, at fortran/simplify.c:129
  2020-06-29 17:52 [Bug fortran/95979] New: [10/11 Regression] ICE in get_kind, at fortran/simplify.c:129 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2020-07-23  6:52 ` rguenth at gcc dot gnu.org
@ 2020-08-25 20:44 ` anlauf at gcc dot gnu.org
  2020-10-05 20:09 ` anlauf at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2020-08-25 20:44 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code

--- Comment #3 from anlauf at gcc dot gnu.org ---
Only examples z1 and z2 are invalid code, z3 is actually valid code.
Adjusting keywords.

Maybe the issue is related to PR87711, where the optional KIND argument
causes havoc with the elementalness of an intrinsic. (There it is LEN_TRIM).

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

* [Bug fortran/95979] [10/11 Regression] ICE in get_kind, at fortran/simplify.c:129
  2020-06-29 17:52 [Bug fortran/95979] New: [10/11 Regression] ICE in get_kind, at fortran/simplify.c:129 gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2020-08-25 20:44 ` anlauf at gcc dot gnu.org
@ 2020-10-05 20:09 ` anlauf at gcc dot gnu.org
  2020-10-08 18:47 ` anlauf at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2020-10-05 20:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from anlauf at gcc dot gnu.org ---
(In reply to anlauf from comment #3)
> Maybe the issue is related to PR87711, where the optional KIND argument
> causes havoc with the elementalness of an intrinsic. (There it is LEN_TRIM).

Replying to myself: it seems to be that simplification fails when one of
the arguments to INDEX is array-valued.  Might be a general issue.

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

* [Bug fortran/95979] [10/11 Regression] ICE in get_kind, at fortran/simplify.c:129
  2020-06-29 17:52 [Bug fortran/95979] New: [10/11 Regression] ICE in get_kind, at fortran/simplify.c:129 gscfq@t-online.de
                   ` (4 preceding siblings ...)
  2020-10-05 20:09 ` anlauf at gcc dot gnu.org
@ 2020-10-08 18:47 ` anlauf at gcc dot gnu.org
  2020-10-16 20:18 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2020-10-08 18:47 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |anlauf at gcc dot gnu.org
      Known to work|                            |7.4.1, 8.4.1, 9.3.1
             Status|NEW                         |ASSIGNED
      Known to fail|                            |10.2.1, 11.0

--- Comment #5 from anlauf at gcc dot gnu.org ---
Patch: https://gcc.gnu.org/pipermail/fortran/2020-October/055162.html

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

* [Bug fortran/95979] [10/11 Regression] ICE in get_kind, at fortran/simplify.c:129
  2020-06-29 17:52 [Bug fortran/95979] New: [10/11 Regression] ICE in get_kind, at fortran/simplify.c:129 gscfq@t-online.de
                   ` (5 preceding siblings ...)
  2020-10-08 18:47 ` anlauf at gcc dot gnu.org
@ 2020-10-16 20:18 ` cvs-commit at gcc dot gnu.org
  2020-10-22 20:41 ` cvs-commit at gcc dot gnu.org
  2020-10-23 19:51 ` anlauf at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-10-16 20:18 UTC (permalink / raw)
  To: gcc-bugs

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

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

commit r11-4020-g02629b116eed7c6911ef0eb2ef97e1883e9fb1de
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Fri Oct 16 22:17:46 2020 +0200

    PR fortran/95979 - ICE in get_kind, at fortran/simplify.c:129

    Simplification of the elemental intrinsic INDEX with constant array-valued
    arguments failed with an ICE or did not reduce to a constant array,
depending
    also on the presence of the optional KIND argument.  Add a further attempt
of
    simplification in the case of elemental intrinsics, and make sure the KIND
    argument is not removed prematurely during simplification of INDEX.

    gcc/fortran/ChangeLog:

            PR fortran/95979
            * expr.c (gfc_check_init_expr): Fix check of return code from
            gfc_intrinsic_func_interface.
            * intrinsic.c (gfc_intrinsic_func_interface): Add further attempt
            of simplification of elemental intrinsics with array arguments.
            * iresolve.c (gfc_resolve_index_func): Keep optional KIND argument
            for simplification of elemental use of INDEX.

    gcc/testsuite/ChangeLog:

            PR fortran/95979
            * gfortran.dg/index_4.f90: New test.

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

* [Bug fortran/95979] [10/11 Regression] ICE in get_kind, at fortran/simplify.c:129
  2020-06-29 17:52 [Bug fortran/95979] New: [10/11 Regression] ICE in get_kind, at fortran/simplify.c:129 gscfq@t-online.de
                   ` (6 preceding siblings ...)
  2020-10-16 20:18 ` cvs-commit at gcc dot gnu.org
@ 2020-10-22 20:41 ` cvs-commit at gcc dot gnu.org
  2020-10-23 19:51 ` anlauf at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-10-22 20:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 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:90b83a25b3499ff50a9b7afc0e84e1355191c220

commit r10-8939-g90b83a25b3499ff50a9b7afc0e84e1355191c220
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Fri Oct 16 22:17:46 2020 +0200

    PR fortran/95979 - ICE in get_kind, at fortran/simplify.c:129

    Simplification of the elemental intrinsic INDEX with constant array-valued
    arguments failed with an ICE or did not reduce to a constant array,
depending
    also on the presence of the optional KIND argument.  Add a further attempt
of
    simplification in the case of elemental intrinsics, and make sure the KIND
    argument is not removed prematurely during simplification of INDEX.

    gcc/fortran/ChangeLog:

            PR fortran/95979
            * expr.c (gfc_check_init_expr): Fix check of return code from
            gfc_intrinsic_func_interface.
            * intrinsic.c (gfc_intrinsic_func_interface): Add further attempt
            of simplification of elemental intrinsics with array arguments.
            * iresolve.c (gfc_resolve_index_func): Keep optional KIND argument
            for simplification of elemental use of INDEX.

    gcc/testsuite/ChangeLog:

            PR fortran/95979
            * gfortran.dg/index_4.f90: New test.

    (cherry picked from commit 02629b116eed7c6911ef0eb2ef97e1883e9fb1de)

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

* [Bug fortran/95979] [10/11 Regression] ICE in get_kind, at fortran/simplify.c:129
  2020-06-29 17:52 [Bug fortran/95979] New: [10/11 Regression] ICE in get_kind, at fortran/simplify.c:129 gscfq@t-online.de
                   ` (7 preceding siblings ...)
  2020-10-22 20:41 ` cvs-commit at gcc dot gnu.org
@ 2020-10-23 19:51 ` anlauf at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2020-10-23 19:51 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

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

--- Comment #8 from anlauf at gcc dot gnu.org ---
Fixed on master for gcc-11, and on 10-branch.  Closing.

Thanks for the report!

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

end of thread, other threads:[~2020-10-23 19:51 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-29 17:52 [Bug fortran/95979] New: [10/11 Regression] ICE in get_kind, at fortran/simplify.c:129 gscfq@t-online.de
2020-06-29 20:21 ` [Bug fortran/95979] " anlauf at gcc dot gnu.org
2020-06-29 20:35 ` dominiq at lps dot ens.fr
2020-07-23  6:52 ` rguenth at gcc dot gnu.org
2020-08-25 20:44 ` anlauf at gcc dot gnu.org
2020-10-05 20:09 ` anlauf at gcc dot gnu.org
2020-10-08 18:47 ` anlauf at gcc dot gnu.org
2020-10-16 20:18 ` cvs-commit at gcc dot gnu.org
2020-10-22 20:41 ` cvs-commit at gcc dot gnu.org
2020-10-23 19:51 ` 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).