public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/95503] New: ICE in gfc_is_simply_contiguous, at fortran/expr.c:5844
@ 2020-06-03 15:46 gscfq@t-online.de
  2020-06-03 18:40 ` [Bug fortran/95503] " anlauf at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: gscfq@t-online.de @ 2020-06-03 15:46 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95503
           Summary: ICE in gfc_is_simply_contiguous, at
                    fortran/expr.c:5844
           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 20181028 (error) and 20181104 (ICE) :


$ cat z1.f90
program p
   complex, target :: a = (1.0, 2.0)
   real, pointer, contiguous :: b => a%re
end


$ cat z2.f90
program p
   complex, target :: a
   real, pointer, contiguous :: b => a%re
end


$ gfortran-11-20200531 -c z1.f90
f951: internal compiler error: in gfc_is_simply_contiguous, at
fortran/expr.c:5844
0x65d5a2 gfc_is_simply_contiguous(gfc_expr*, bool, bool)
        ../../gcc/fortran/expr.c:5844
0x65e5f7 gfc_check_pointer_assign(gfc_expr*, gfc_expr*, bool, bool)
        ../../gcc/fortran/expr.c:4349
0x65e93d gfc_check_assign_symbol(gfc_symbol*, gfc_component*, gfc_expr*)
        ../../gcc/fortran/expr.c:4438
0x63d70e add_init_expr_to_sym
        ../../gcc/fortran/decl.c:1926
0x64762a variable_decl
        ../../gcc/fortran/decl.c:2990
0x64762a gfc_match_data_decl()
        ../../gcc/fortran/decl.c:6190
0x6aa9d3 match_word
        ../../gcc/fortran/parse.c:65
0x6aa9d3 decode_statement
        ../../gcc/fortran/parse.c:376
0x6ac41a next_free
        ../../gcc/fortran/parse.c:1279
0x6ac41a next_statement
        ../../gcc/fortran/parse.c:1511
0x6ada6b parse_spec
        ../../gcc/fortran/parse.c:3922
0x6b083c parse_progunit
        ../../gcc/fortran/parse.c:5851
0x6b1f19 gfc_parse_file()
        ../../gcc/fortran/parse.c:6392
0x6fdfff gfc_be_parse_file
        ../../gcc/fortran/f95-lang.c:210

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

* [Bug fortran/95503] ICE in gfc_is_simply_contiguous, at fortran/expr.c:5844
  2020-06-03 15:46 [Bug fortran/95503] New: ICE in gfc_is_simply_contiguous, at fortran/expr.c:5844 gscfq@t-online.de
@ 2020-06-03 18:40 ` anlauf at gcc dot gnu.org
  2020-06-03 22:04 ` [Bug fortran/95503] [9/10/11 Regression] " tkoenig at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: anlauf at gcc dot gnu.org @ 2020-06-03 18:40 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |7.4.1, 8.3.1
   Last reconfirmed|                            |2020-06-03
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
                 CC|                            |anlauf at gcc dot gnu.org
      Known to fail|                            |10.1.1, 11.0, 9.3.1

--- Comment #1 from anlauf at gcc dot gnu.org ---
The following patch fixes the ICE:

diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index a9fa03ad153..8daa7bb8d06 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -4346,7 +4346,9 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_expr
*rvalue,
      contiguous.  Be lenient in the definition of what counts as
      contiguous.  */

-  if (lhs_attr.contiguous && !gfc_is_simply_contiguous (rvalue, false, true))
+  if (lhs_attr.contiguous
+      && lhs_attr.dimension > 0
+      && !gfc_is_simply_contiguous (rvalue, false, true))
     gfc_warning (OPT_Wextra, "Assignment to contiguous pointer from "
                 "non-contiguous target at %L", &rvalue->where);


Not regtested though.

In some sense a 9/10/11 regression, although %re etc. did not exist
in 8 and older.

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

* [Bug fortran/95503] [9/10/11 Regression] ICE in gfc_is_simply_contiguous, at fortran/expr.c:5844
  2020-06-03 15:46 [Bug fortran/95503] New: ICE in gfc_is_simply_contiguous, at fortran/expr.c:5844 gscfq@t-online.de
  2020-06-03 18:40 ` [Bug fortran/95503] " anlauf at gcc dot gnu.org
@ 2020-06-03 22:04 ` tkoenig at gcc dot gnu.org
  2020-06-04 18:48 ` anlauf at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2020-06-03 22:04 UTC (permalink / raw)
  To: gcc-bugs

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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |9.4
            Summary|ICE in                      |[9/10/11 Regression] ICE in
                   |gfc_is_simply_contiguous,   |gfc_is_simply_contiguous,
                   |at fortran/expr.c:5844      |at fortran/expr.c:5844

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

* [Bug fortran/95503] [9/10/11 Regression] ICE in gfc_is_simply_contiguous, at fortran/expr.c:5844
  2020-06-03 15:46 [Bug fortran/95503] New: ICE in gfc_is_simply_contiguous, at fortran/expr.c:5844 gscfq@t-online.de
  2020-06-03 18:40 ` [Bug fortran/95503] " anlauf at gcc dot gnu.org
  2020-06-03 22:04 ` [Bug fortran/95503] [9/10/11 Regression] " tkoenig at gcc dot gnu.org
@ 2020-06-04 18:48 ` anlauf at gcc dot gnu.org
  2020-06-11 13:49 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: anlauf at gcc dot gnu.org @ 2020-06-04 18:48 UTC (permalink / raw)
  To: gcc-bugs

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

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 #2 from anlauf at gcc dot gnu.org ---
Patch posted for review:

https://gcc.gnu.org/pipermail/fortran/2020-June/054465.html

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

* [Bug fortran/95503] [9/10/11 Regression] ICE in gfc_is_simply_contiguous, at fortran/expr.c:5844
  2020-06-03 15:46 [Bug fortran/95503] New: ICE in gfc_is_simply_contiguous, at fortran/expr.c:5844 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2020-06-04 18:48 ` anlauf at gcc dot gnu.org
@ 2020-06-11 13:49 ` cvs-commit at gcc dot gnu.org
  2020-06-14 12:40 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-06-11 13:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 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:87af4f40453a9c84363bde5d9a58466de7fbee2e

commit r11-1236-g87af4f40453a9c84363bde5d9a58466de7fbee2e
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Thu Jun 11 15:48:56 2020 +0200

    PR fortran/95503 - Fix ICE in gfc_is_simply_contiguous, at
fortran/expr.c:5844

    The check for assigning a pointer that cannot be determined to be simply
    contiguous at compile time to a contiguous pointer does not need to be
    invoked if the lhs of the assignment is known to have conflicting
attributes.

    2020-06-11  Harald Anlauf  <anlauf@gmx.de>

    gcc/fortran/
            PR fortran/95503
            * expr.c (gfc_check_pointer_assign): Skip contiguity check of rhs
            of pointer assignment if lhs cannot be simply contiguous.

    gcc/testsuite/
            PR fortran/95503
            * gfortran.dg/pr95503.f90: New test.

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

* [Bug fortran/95503] [9/10/11 Regression] ICE in gfc_is_simply_contiguous, at fortran/expr.c:5844
  2020-06-03 15:46 [Bug fortran/95503] New: ICE in gfc_is_simply_contiguous, at fortran/expr.c:5844 gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2020-06-11 13:49 ` cvs-commit at gcc dot gnu.org
@ 2020-06-14 12:40 ` cvs-commit at gcc dot gnu.org
  2020-06-14 13:04 ` cvs-commit at gcc dot gnu.org
  2020-06-14 13:28 ` anlauf at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-06-14 12:40 UTC (permalink / raw)
  To: gcc-bugs

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

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

commit r10-8300-g8c8102817739505fe47a949fc4ec38fe62518818
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Thu Jun 11 15:48:56 2020 +0200

    PR fortran/95503 - Fix ICE in gfc_is_simply_contiguous, at
fortran/expr.c:5844

    The check for assigning a pointer that cannot be determined to be simply
    contiguous at compile time to a contiguous pointer does not need to be
    invoked if the lhs of the assignment is known to have conflicting
attributes.

    2020-06-11  Harald Anlauf  <anlauf@gmx.de>

    gcc/fortran/
            PR fortran/95503
            * expr.c (gfc_check_pointer_assign): Skip contiguity check of rhs
            of pointer assignment if lhs cannot be simply contiguous.

    gcc/testsuite/
            PR fortran/95503
            * gfortran.dg/pr95503.f90: New test.

    (cherry picked from commit 87af4f40453a9c84363bde5d9a58466de7fbee2e)

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

* [Bug fortran/95503] [9/10/11 Regression] ICE in gfc_is_simply_contiguous, at fortran/expr.c:5844
  2020-06-03 15:46 [Bug fortran/95503] New: ICE in gfc_is_simply_contiguous, at fortran/expr.c:5844 gscfq@t-online.de
                   ` (4 preceding siblings ...)
  2020-06-14 12:40 ` cvs-commit at gcc dot gnu.org
@ 2020-06-14 13:04 ` cvs-commit at gcc dot gnu.org
  2020-06-14 13:28 ` anlauf at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-06-14 13:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 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:152aaef6feb909689132c74bebb01420dc7776e3

commit r9-8677-g152aaef6feb909689132c74bebb01420dc7776e3
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Thu Jun 11 15:48:56 2020 +0200

    PR fortran/95503 - Fix ICE in gfc_is_simply_contiguous, at
fortran/expr.c:5844

    The check for assigning a pointer that cannot be determined to be simply
    contiguous at compile time to a contiguous pointer does not need to be
    invoked if the lhs of the assignment is known to have conflicting
attributes.

    2020-06-11  Harald Anlauf  <anlauf@gmx.de>

    gcc/fortran/
            PR fortran/95503
            * expr.c (gfc_check_pointer_assign): Skip contiguity check of rhs
            of pointer assignment if lhs cannot be simply contiguous.

    gcc/testsuite/
            PR fortran/95503
            * gfortran.dg/pr95503.f90: New test.

    (cherry picked from commit 87af4f40453a9c84363bde5d9a58466de7fbee2e)

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

* [Bug fortran/95503] [9/10/11 Regression] ICE in gfc_is_simply_contiguous, at fortran/expr.c:5844
  2020-06-03 15:46 [Bug fortran/95503] New: ICE in gfc_is_simply_contiguous, at fortran/expr.c:5844 gscfq@t-online.de
                   ` (5 preceding siblings ...)
  2020-06-14 13:04 ` cvs-commit at gcc dot gnu.org
@ 2020-06-14 13:28 ` anlauf at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: anlauf at gcc dot gnu.org @ 2020-06-14 13:28 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

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

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

Thanks for the report!

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

end of thread, other threads:[~2020-06-14 13:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-03 15:46 [Bug fortran/95503] New: ICE in gfc_is_simply_contiguous, at fortran/expr.c:5844 gscfq@t-online.de
2020-06-03 18:40 ` [Bug fortran/95503] " anlauf at gcc dot gnu.org
2020-06-03 22:04 ` [Bug fortran/95503] [9/10/11 Regression] " tkoenig at gcc dot gnu.org
2020-06-04 18:48 ` anlauf at gcc dot gnu.org
2020-06-11 13:49 ` cvs-commit at gcc dot gnu.org
2020-06-14 12:40 ` cvs-commit at gcc dot gnu.org
2020-06-14 13:04 ` cvs-commit at gcc dot gnu.org
2020-06-14 13:28 ` 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).