public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/99853] New: ICE: Cannot convert 'LOGICAL(4)' to 'INTEGER(8)' (etc.)
@ 2021-03-31 17:35 gscfq@t-online.de
  2021-03-31 17:36 ` [Bug fortran/99853] " gscfq@t-online.de
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: gscfq@t-online.de @ 2021-03-31 17:35 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99853
           Summary: ICE: Cannot convert 'LOGICAL(4)' to 'INTEGER(8)'
                    (etc.)
           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: ---

With option -std=f95, -std=f2003, -std=f2008 or -std=f2018 :
(affects versions down to at least r5)


$ cat z1.f90
program p
   select case (.true.)
   case (1_8)
   end select
end


$ gfortran-11-20210328 -c z1.f90
z1.f90:2:16:

    2 |    select case (.true.)
      |                1
Warning: Extension: Conversion from LOGICAL(4) to INTEGER(8) at (1)


$ gfortran-11-20210328 -c z1.f90 -std=f2008
z1.f90:2:16:

    2 |    select case (.true.)
      |                1
internal compiler error: Cannot convert 'LOGICAL(4)' to 'INTEGER(8)' at (1)
0x6c38d9 gfc_report_diagnostic
        ../../gcc/fortran/error.c:782
0x6c4ffa gfc_internal_error(char const*, ...)
        ../../gcc/fortran/error.c:1402
0x6e4808 gfc_convert_type_warn(gfc_expr*, gfc_typespec*, int, int, bool)
        ../../gcc/fortran/intrinsic.c:5397
0x72f277 resolve_select
        ../../gcc/fortran/resolve.c:8714
0x738b97 gfc_resolve_code(gfc_code*, gfc_namespace*)
        ../../gcc/fortran/resolve.c:12055
0x73a9f7 resolve_codes
        ../../gcc/fortran/resolve.c:17395
0x73aabe gfc_resolve(gfc_namespace*)
        ../../gcc/fortran/resolve.c:17430
0x723024 resolve_all_program_units
        ../../gcc/fortran/parse.c:6290
0x723024 gfc_parse_file()
        ../../gcc/fortran/parse.c:6542
0x7705ff gfc_be_parse_file
        ../../gcc/fortran/f95-lang.c:212

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

* [Bug fortran/99853] ICE: Cannot convert 'LOGICAL(4)' to 'INTEGER(8)' (etc.)
  2021-03-31 17:35 [Bug fortran/99853] New: ICE: Cannot convert 'LOGICAL(4)' to 'INTEGER(8)' (etc.) gscfq@t-online.de
@ 2021-03-31 17:36 ` gscfq@t-online.de
  2021-03-31 18:09 ` kargl at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: gscfq@t-online.de @ 2021-03-31 17:36 UTC (permalink / raw)
  To: gcc-bugs

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

G. Steinmetz <gscfq@t-online.de> changed:

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

--- Comment #1 from G. Steinmetz <gscfq@t-online.de> ---

More test cases :


$ cat z2.f90
program p
   select case (.true.)
   case (1_16)
   end select
end


$ cat z3.f90
program p
   select case (.true._1)
   case (1_2)
   end select
end


$ cat z4.f90
program p
   select case (.true._8)
   case (1_16)
   end select
end


$ cat z5.f90
program p
   select case (1_2)
   case (.true.)
   end select
end


$ cat z6.f90
program p
   select case (1_4)
   case (.true._8)
   end select
end


---


While cases like the following give :


$ cat z0.f90
program p
   select case (.true.)
   case (1)
   end select
end


$ cat z0b.f90
program p
   select case (.true.)
   case (1_1)
   end select
end


$ cat z0c.f90
program p
   select case (.true._16)
   case (1_8)
   end select
end


$ gfortran-11-20210328 -c z0.f90 -std=f2008
z0.f90:3:9:

    3 |    case (1)
      |         1
Error: Expression in CASE statement at (1) must be of type LOGICAL

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

* [Bug fortran/99853] ICE: Cannot convert 'LOGICAL(4)' to 'INTEGER(8)' (etc.)
  2021-03-31 17:35 [Bug fortran/99853] New: ICE: Cannot convert 'LOGICAL(4)' to 'INTEGER(8)' (etc.) gscfq@t-online.de
  2021-03-31 17:36 ` [Bug fortran/99853] " gscfq@t-online.de
@ 2021-03-31 18:09 ` kargl at gcc dot gnu.org
  2021-10-28 21:04 ` anlauf at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: kargl at gcc dot gnu.org @ 2021-03-31 18:09 UTC (permalink / raw)
  To: gcc-bugs

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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4
   Last reconfirmed|                            |2021-03-31
                 CC|                            |kargl at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #2 from kargl at gcc dot gnu.org ---
Patch.  No need to ICE here.

diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index b936c98a211..425150126fd 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -8711,11 +8711,11 @@ resolve_select (gfc_code *code, bool select_type)

              if (cp->low != NULL
                  && case_expr->ts.kind != gfc_kind_max(case_expr, cp->low))
-               gfc_convert_type_warn (case_expr, &cp->low->ts, 2, 0);
+               gfc_convert_type_warn (case_expr, &cp->low->ts, 1, 0);

              if (cp->high != NULL
                  && case_expr->ts.kind != gfc_kind_max(case_expr, cp->high))
-               gfc_convert_type_warn (case_expr, &cp->high->ts, 2, 0);
+               gfc_convert_type_warn (case_expr, &cp->high->ts, 1, 0);
            }
         }
     }

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

* [Bug fortran/99853] ICE: Cannot convert 'LOGICAL(4)' to 'INTEGER(8)' (etc.)
  2021-03-31 17:35 [Bug fortran/99853] New: ICE: Cannot convert 'LOGICAL(4)' to 'INTEGER(8)' (etc.) gscfq@t-online.de
  2021-03-31 17:36 ` [Bug fortran/99853] " gscfq@t-online.de
  2021-03-31 18:09 ` kargl at gcc dot gnu.org
@ 2021-10-28 21:04 ` anlauf at gcc dot gnu.org
  2021-10-28 21:21 ` sgk at troutmask dot apl.washington.edu
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-10-28 21:04 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |anlauf at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |anlauf at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #3 from anlauf at gcc dot gnu.org ---
Packaged: https://gcc.gnu.org/pipermail/fortran/2021-October/056833.html

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

* [Bug fortran/99853] ICE: Cannot convert 'LOGICAL(4)' to 'INTEGER(8)' (etc.)
  2021-03-31 17:35 [Bug fortran/99853] New: ICE: Cannot convert 'LOGICAL(4)' to 'INTEGER(8)' (etc.) gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2021-10-28 21:04 ` anlauf at gcc dot gnu.org
@ 2021-10-28 21:21 ` sgk at troutmask dot apl.washington.edu
  2021-10-30 16:22 ` cvs-commit at gcc dot gnu.org
  2021-10-30 18:21 ` anlauf at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: sgk at troutmask dot apl.washington.edu @ 2021-10-28 21:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Thu, Oct 28, 2021 at 09:04:01PM +0000, anlauf at gcc dot gnu.org wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99853
> 
> anlauf at gcc dot gnu.org changed:
> 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                  CC|                            |anlauf at gcc dot gnu.org
>            Assignee|unassigned at gcc dot gnu.org      |anlauf at gcc dot gnu.org
>              Status|NEW                         |ASSIGNED
> 
> --- Comment #3 from anlauf at gcc dot gnu.org ---
> Packaged: https://gcc.gnu.org/pipermail/fortran/2021-October/056833.html
> 

Looks okay to me.

With 2 sets of eyes (yours and mine) and the 
simplicity of the change, I think you can 
commit this as obvious.

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

* [Bug fortran/99853] ICE: Cannot convert 'LOGICAL(4)' to 'INTEGER(8)' (etc.)
  2021-03-31 17:35 [Bug fortran/99853] New: ICE: Cannot convert 'LOGICAL(4)' to 'INTEGER(8)' (etc.) gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2021-10-28 21:21 ` sgk at troutmask dot apl.washington.edu
@ 2021-10-30 16:22 ` cvs-commit at gcc dot gnu.org
  2021-10-30 18:21 ` anlauf at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-10-30 16:22 UTC (permalink / raw)
  To: gcc-bugs

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

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

commit r12-4802-gd18e4cc416b832fa98ca8af13b09cf7fe904ba8f
Author: Steve Kargl <kargl@gcc.gnu.org>
Date:   Sat Oct 30 18:22:19 2021 +0200

    Fortran: generate regular error on invalid conversions of CASE expressions

    gcc/fortran/ChangeLog:

            PR fortran/99853
            * resolve.c (resolve_select): Generate regular gfc_error on
            invalid conversions instead of an gfc_internal_error.

    gcc/testsuite/ChangeLog:

            PR fortran/99853
            * gfortran.dg/pr99853.f90: New test.

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

* [Bug fortran/99853] ICE: Cannot convert 'LOGICAL(4)' to 'INTEGER(8)' (etc.)
  2021-03-31 17:35 [Bug fortran/99853] New: ICE: Cannot convert 'LOGICAL(4)' to 'INTEGER(8)' (etc.) gscfq@t-online.de
                   ` (4 preceding siblings ...)
  2021-10-30 16:22 ` cvs-commit at gcc dot gnu.org
@ 2021-10-30 18:21 ` anlauf at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-10-30 18:21 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

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

--- Comment #6 from anlauf at gcc dot gnu.org ---
Fixed on mainline for gcc-12.

Thanks for the report!

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

end of thread, other threads:[~2021-10-30 18:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-31 17:35 [Bug fortran/99853] New: ICE: Cannot convert 'LOGICAL(4)' to 'INTEGER(8)' (etc.) gscfq@t-online.de
2021-03-31 17:36 ` [Bug fortran/99853] " gscfq@t-online.de
2021-03-31 18:09 ` kargl at gcc dot gnu.org
2021-10-28 21:04 ` anlauf at gcc dot gnu.org
2021-10-28 21:21 ` sgk at troutmask dot apl.washington.edu
2021-10-30 16:22 ` cvs-commit at gcc dot gnu.org
2021-10-30 18:21 ` 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).