[Bug fortran/91649] New: ICE in gfc_resolve_findloc, at fortran/iresolve.c:1827

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

[Bug fortran/91649] New: ICE in gfc_resolve_findloc, at fortran/iresolve.c:1827

danglin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91649

            Bug ID: 91649
           Summary: ICE in gfc_resolve_findloc, at fortran/iresolve.c:1827
           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: ---

The ICE slipped in between 20181021 and 20181028 :


$ cat z1.f90
program p
   logical :: back = .true.
   integer :: x(1) = findloc([1, 2, 1], '1', back=back)
   print *, x
end


$ cat z2.f90
program p
   type t
   end type
   logical :: back = .false.
   integer :: x(1) = findloc([1, 2, 1], t(), back=back)
   print *, x
end


$ cat z3.f90
program p
   character(4) :: c = '1234'
   integer :: x(1) = findloc([1, 2, 1], c, back=.true.)
   print *, x
end


$ gfortran-10-20190901 -c z1.f90
z1.f90:3:40:

    3 |    integer :: x(1) = findloc([1, 2, 1], '1', back=back)
      |                                        1
internal compiler error: Cannot convert 'CHARACTER(1)' to 'INTEGER(4)' at (1)
0x61c001 gfc_internal_error(char const*, ...)
        ../../gcc/fortran/error.c:1363
0x63aa36 gfc_convert_type_warn(gfc_expr*, gfc_typespec*, int, int)
        ../../gcc/fortran/intrinsic.c:5241
0x64600a gfc_resolve_findloc(gfc_expr*, gfc_expr*, gfc_expr*, gfc_expr*,
gfc_expr*, gfc_expr*, gfc_expr*)
        ../../gcc/fortran/iresolve.c:1827
0x62f99d resolve_intrinsic
        ../../gcc/fortran/intrinsic.c:4477
0x62f99d do_simplify
        ../../gcc/fortran/intrinsic.c:4596
0x639fde gfc_intrinsic_func_interface(gfc_expr*, int)
        ../../gcc/fortran/intrinsic.c:4941
0x6916e1 resolve_unknown_f
        ../../gcc/fortran/resolve.c:2896
0x6916e1 resolve_function
        ../../gcc/fortran/resolve.c:3233
0x68db05 gfc_resolve_expr(gfc_expr*)
        ../../gcc/fortran/resolve.c:6954
0x61fe84 gfc_reduce_init_expr(gfc_expr*)
        ../../gcc/fortran/expr.c:3037
0x623030 gfc_match_init_expr(gfc_expr**)
        ../../gcc/fortran/expr.c:3085
0x60f2a2 variable_decl
        ../../gcc/fortran/decl.c:2835
0x60f2a2 gfc_match_data_decl()
        ../../gcc/fortran/decl.c:6062
0x66f983 match_word
        ../../gcc/fortran/parse.c:65
0x66f983 decode_statement
        ../../gcc/fortran/parse.c:376
0x6713ca next_free
        ../../gcc/fortran/parse.c:1251
0x6713ca next_statement
        ../../gcc/fortran/parse.c:1483
0x6729eb parse_spec
        ../../gcc/fortran/parse.c:3881
0x6757dc parse_progunit
        ../../gcc/fortran/parse.c:5799
0x676ea9 gfc_parse_file()
        ../../gcc/fortran/parse.c:6339
Reply | Threaded
Open this post in threaded view
|

[Bug fortran/91649] ICE in gfc_resolve_findloc, at fortran/iresolve.c:1827

danglin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91649

G. Steinmetz <[hidden email]> changed:

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

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

Some more (e.g. accepts a non-conformant type value) :


$ cat z4.f90
program p
   integer :: x(1) = findloc([1, 2, 1], '1', back=.true.)
   print *, x
end


$ cat z5.f90
program p
   type t
   end type
   integer :: x(1) = findloc([1, 2, 1], t(), back=.true.)
   print *, x
end


$ cat z6.f90
program p
   logical :: back = .true.
   integer :: x(1) = findloc([1, 2, 1], 2.0, back=back)
   print *, x
end


$ gfortran-10-20190901 -c z4.f90
$ gfortran-10-20190901 -c z5.f90
$ gfortran-10-20190901 -c z6.f90
z6.f90:3:50:

    3 |    integer :: x(1) = findloc([1, 2, 1], 2.0, back=back)
      |                                                  1
Error: Parameter 'back' at (1) has not been declared or is a variable, which
does not reduce to a constant expression
Reply | Threaded
Open this post in threaded view
|

[Bug fortran/91649] ICE in gfc_resolve_findloc, at fortran/iresolve.c:1827

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2019-09-16
     Ever confirmed|0                           |1
Reply | Threaded
Open this post in threaded view
|

[Bug fortran/91649] ICE in gfc_resolve_findloc, at fortran/iresolve.c:1827

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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4
                 CC|                            |kargl at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |kargl at gcc dot gnu.org

--- Comment #2 from kargl at gcc dot gnu.org ---
(In reply to G. Steinmetz from comment #1)

> $ cat z6.f90
> program p
>    logical :: back = .true.
>    integer :: x(1) = findloc([1, 2, 1], 2.0, back=back)
>    print *, x
> end
>
>
> $ gfortran-10-20190901 -c z4.f90
> $ gfortran-10-20190901 -c z5.f90
> $ gfortran-10-20190901 -c z6.f90
> z6.f90:3:50:
>
>     3 |    integer :: x(1) = findloc([1, 2, 1], 2.0, back=back)
>       |                                                  1
> Error: Parameter 'back' at (1) has not been declared or is a variable, which
> does not reduce to a constant expression

I think the error message here is correct.  BACK is
a variable.  It is not a named constant.  Of course,
I could be missing something.
Reply | Threaded
Open this post in threaded view
|

[Bug fortran/91649] ICE in gfc_resolve_findloc, at fortran/iresolve.c:1827

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

--- Comment #3 from kargl at gcc dot gnu.org ---
Author: kargl
Date: Fri Oct 11 18:05:35 2019
New Revision: 276900

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

        PR fortran/91649
        check.c (gfc_check_findloc): Additional checking for valid arguments

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

        PR fortran/91649
        * gfortran.dg/pr91649.f90: New test.

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

[Bug fortran/91649] ICE in gfc_resolve_findloc, at fortran/iresolve.c:1827

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

--- Comment #4 from kargl at gcc dot gnu.org ---
Author: kargl
Date: Fri Oct 11 20:06:15 2019
New Revision: 276904

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

        PR fortran/91649
        check.c (gfc_check_findloc): Additional checking for valid arguments

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

        PR fortran/91649
        * gfortran.dg/pr91649.f90: New test.

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

[Bug fortran/91649] ICE in gfc_resolve_findloc, at fortran/iresolve.c:1827

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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |9.3

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