[Bug fortran/91785] New: ICE in check_assumed_size_reference, at fortran/resolve.c:1601

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug fortran/91785] New: ICE in check_assumed_size_reference, at fortran/resolve.c:1601

marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91785

            Bug ID: 91785
           Summary: ICE in check_assumed_size_reference, at
                    fortran/resolve.c:1601
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: [hidden email]
  Target Milestone: ---

With an invalid declaration since gfortran-9 :


$ cat z1.f90
program p
   complex :: a(*)
   real :: b(2)
   b = a%im
end


$ gfortran-10-20190915 -c z1.f90
0x61adfe gfc_format_decoder
        ../../gcc/fortran/error.c:947
0x139bf3e pp_format(pretty_printer*, text_info*)
        ../../gcc/pretty-print.c:1390
0x1391845 diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info*)
        ../../gcc/diagnostic.c:1025
0x61ac9c gfc_error_opt
        ../../gcc/fortran/error.c:1313
0x61c260 gfc_error(char const*, ...)
        ../../gcc/fortran/error.c:1342
0x67fc82 check_assumed_size_reference
        ../../gcc/fortran/resolve.c:1601
0x68edd3 resolve_variable
        ../../gcc/fortran/resolve.c:5655
0x68edd3 gfc_resolve_expr(gfc_expr*)
        ../../gcc/fortran/resolve.c:6954
0x61df91 find_inquiry_ref
        ../../gcc/fortran/expr.c:1776
0x62136d simplify_ref_chain
        ../../gcc/fortran/expr.c:2023
0x620c87 gfc_simplify_expr(gfc_expr*, int)
        ../../gcc/fortran/expr.c:2220
0x67b4b9 gfc_match_varspec(gfc_expr*, int, bool, bool)
        ../../gcc/fortran/primary.c:2334
0x67ce50 gfc_match_rvalue(gfc_expr**)
        ../../gcc/fortran/primary.c:3570
0x65412e match_primary
        ../../gcc/fortran/matchexp.c:157
0x65412e match_level_1
        ../../gcc/fortran/matchexp.c:211
0x65412e match_mult_operand
        ../../gcc/fortran/matchexp.c:267
0x654378 match_add_operand
        ../../gcc/fortran/matchexp.c:356
0x6545cc match_level_2
        ../../gcc/fortran/matchexp.c:480
0x654722 match_level_3
        ../../gcc/fortran/matchexp.c:551
0x654814 match_level_4
        ../../gcc/fortran/matchexp.c:599
Reply | Threaded
Open this post in threaded view
|

[Bug fortran/91785] ICE in check_assumed_size_reference, at fortran/resolve.c:1601

marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91785

G. Steinmetz <[hidden email]> changed:

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

--- Comment #1 from G. Steinmetz <[hidden email]> ---

$ cat z2.f90      # for reference
program p
   complex :: a(*)
   real :: b(2)
   b = aimag(a)
end


$ gfortran-10-20190915 -c z2.f90
z2.f90:2:18:

    2 |    complex :: a(*)
      |                  1
Error: Assumed size array at (1) must be a dummy argument
z2.f90:4:13:

    4 |    b = aimag(a)
      |             1
Error: The upper bound in the last dimension must appear in the reference to
the assumed size array 'a' at (1)
Reply | Threaded
Open this post in threaded view
|

[Bug fortran/91785] ICE in check_assumed_size_reference, at fortran/resolve.c:1601

marxin at gcc dot gnu.org
In reply to this post by marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91785

kargl at gcc dot gnu.org changed:

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

--- Comment #2 from kargl at gcc dot gnu.org ---
Index: gcc/fortran/primary.c
===================================================================
--- gcc/fortran/primary.c       (revision 275969)
+++ gcc/fortran/primary.c       (working copy)
@@ -2331,6 +2331,8 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag,

       if (tmp && tmp->type == REF_INQUIRY)
        {
+         if (!primary->where.lb || !primary->where.nextc)
+           primary->where = gfc_current_locus;
          gfc_simplify_expr (primary, 0);

          if (primary->expr_type == EXPR_CONSTANT)
Reply | Threaded
Open this post in threaded view
|

[Bug fortran/91785] ICE in check_assumed_size_reference, at fortran/resolve.c:1601

marxin at gcc dot gnu.org
In reply to this post by marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91785

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4
           Assignee|unassigned at gcc dot gnu.org      |kargl at gcc dot gnu.org
   Target Milestone|---                         |9.3
Reply | Threaded
Open this post in threaded view
|

[Bug fortran/91785] ICE in check_assumed_size_reference, at fortran/resolve.c:1601

marxin at gcc dot gnu.org
In reply to this post by marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91785

--- Comment #3 from kargl at gcc dot gnu.org ---
Author: kargl
Date: Wed Oct  2 17:09:45 2019
New Revision: 276473

URL: https://gcc.gnu.org/viewcvs?rev=276473&root=gcc&view=rev
Log:
2019-10-02  Steven G. Kargl  <[hidden email]>

        PR fortran/91785
        * primary.c (gfc_match_varspec): Ensure an inquiry parameter has
        it locus set.

2019-10-02  Steven G. Kargl  <[hidden email]>

        PR fortran/91785
        * gfortran.dg/pr91785.f90: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/pr91785.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/primary.c
    trunk/gcc/testsuite/ChangeLog
Reply | Threaded
Open this post in threaded view
|

[Bug fortran/91785] ICE in check_assumed_size_reference, at fortran/resolve.c:1601

marxin at gcc dot gnu.org
In reply to this post by marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91785

--- Comment #4 from kargl at gcc dot gnu.org ---
Author: kargl
Date: Sat Oct  5 03:55:05 2019
New Revision: 276619

URL: https://gcc.gnu.org/viewcvs?rev=276619&root=gcc&view=rev
Log:
2019-10-04  Steven G. Kargl  <[hidden email]>

        PR fortran/91785
        * primary.c (gfc_match_varspec): Ensure an inquiry parameter has
        it locus set.

2019-10-04  Steven G. Kargl  <[hidden email]>

        PR fortran/91785
        * gfortran.dg/pr91785.f90: New test.

Added:
    branches/gcc-9-branch/gcc/testsuite/gfortran.dg/pr91785.f90
Modified:
    branches/gcc-9-branch/gcc/fortran/ChangeLog
    branches/gcc-9-branch/gcc/fortran/primary.c
    branches/gcc-9-branch/gcc/testsuite/ChangeLog
Reply | Threaded
Open this post in threaded view
|

[Bug fortran/91785] ICE in check_assumed_size_reference, at fortran/resolve.c:1601

marxin at gcc dot gnu.org
In reply to this post by marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91785

kargl at gcc dot gnu.org changed:

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

--- Comment #5 from kargl at gcc dot gnu.org ---
Fixed on trunk and 9-branch. Closing.