public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/91726] [8/9 Regression] ICE in gfc_conv_array_ref, at fortran/trans-array.c:3612
       [not found] <bug-91726-4@http.gcc.gnu.org/bugzilla/>
@ 2020-05-06 13:14 ` jrfsousa at gmail dot com
  2021-01-08 18:40 ` pault at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: jrfsousa at gmail dot com @ 2020-05-06 13:14 UTC (permalink / raw)
  To: gcc-bugs

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

José Rui Faustino de Sousa <jrfsousa at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jrfsousa at gmail dot com

--- Comment #7 from José Rui Faustino de Sousa <jrfsousa at gmail dot com> ---
Hi all!

Still ICEs with 9/10/11 using -ftrapv -fcheck=bounds

Best regards,
José Rui

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

* [Bug fortran/91726] [8/9 Regression] ICE in gfc_conv_array_ref, at fortran/trans-array.c:3612
       [not found] <bug-91726-4@http.gcc.gnu.org/bugzilla/>
  2020-05-06 13:14 ` [Bug fortran/91726] [8/9 Regression] ICE in gfc_conv_array_ref, at fortran/trans-array.c:3612 jrfsousa at gmail dot com
@ 2021-01-08 18:40 ` pault at gcc dot gnu.org
  2021-04-01 18:19 ` jrfsousa at gmail dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: pault at gcc dot gnu.org @ 2021-01-08 18:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Paul Thomas <pault at gcc dot gnu.org> ---
(In reply to José Rui Faustino de Sousa from comment #7)
> Hi all!
> 
> Still ICEs with 9/10/11 using -ftrapv -fcheck=bounds
> 
> Best regards,
> José Rui

Yes, indeed. This with those compile options

module m
   type s
      class(*), allocatable :: a[:]    ! This ICEd
   end type
end

gives

../pr91726/pr91726.f90:5:3:

    5 | end
      |   ^
Error: mismatching comparison operand types
integer(kind=8)
unsigned long
if (_10 != 1) goto <D.4205>; else goto <D.4206>;
../pr91726/pr91726.f90:5:3: internal compiler error: ‘verify_gimple’ failed
0xec247d verify_gimple_in_seq(gimple*)
        ../../gcc/gcc/tree-cfg.c:5119

The problem appears to lie in the bounds checking in
trans-expr.c(gfc_copy_class_to_class) at line 1425 in master. It is produced by
the vtable _copy function.

For some reason that I cannot see from the code, 10-branch compiles this
snippet just fine, while 9-branch produces a completely different error.

It's now in my spreadsheet as an intersting one!

Paul

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

* [Bug fortran/91726] [8/9 Regression] ICE in gfc_conv_array_ref, at fortran/trans-array.c:3612
       [not found] <bug-91726-4@http.gcc.gnu.org/bugzilla/>
  2020-05-06 13:14 ` [Bug fortran/91726] [8/9 Regression] ICE in gfc_conv_array_ref, at fortran/trans-array.c:3612 jrfsousa at gmail dot com
  2021-01-08 18:40 ` pault at gcc dot gnu.org
@ 2021-04-01 18:19 ` jrfsousa at gmail dot com
  2021-05-14  9:52 ` [Bug fortran/91726] [9 " jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: jrfsousa at gmail dot com @ 2021-04-01 18:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from José Rui Faustino de Sousa <jrfsousa at gmail dot com> ---
Hi Paul!

This seems to fix the ICE generated by using -ftrapv -fcheck=bounds

Fixes "nelems" type and adds an optional assert to make sure it stays fixed.

Best regards,
José Rui


diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index be5eb89350f..7954b138605 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -9375,7 +9375,7 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
                                                        nelems));
                }
              else
-               nelems = build_int_cst (size_type_node, 1);
+               nelems = build_int_cst (gfc_array_index_type, 1);

              if (CLASS_DATA (c)->attr.dimension
                  || CLASS_DATA (c)->attr.codimension)

diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 2fa17b36c03..258e885faaa 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -1446,6 +1452,7 @@ gfc_copy_class_to_class (tree from, tree to, tree nelems,
bool unlimited)
            name = (const char *)(DECL_NAME (to)->identifier.id.str);

          from_len = gfc_conv_descriptor_size (from_data, 1);
+         gcc_assert (TREE_TYPE (orig_nelems) == gfc_array_index_type);
          tmp = fold_build2_loc (input_location, NE_EXPR,
                                  logical_type_node, from_len, orig_nelems);
          msg = xasprintf ("Array bound mismatch for dimension %d "

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

* [Bug fortran/91726] [9 Regression] ICE in gfc_conv_array_ref, at fortran/trans-array.c:3612
       [not found] <bug-91726-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2021-04-01 18:19 ` jrfsousa at gmail dot com
@ 2021-05-14  9:52 ` jakub at gcc dot gnu.org
  2021-06-01  8:15 ` rguenth at gcc dot gnu.org
  2022-05-27  8:38 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-05-14  9:52 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|8.5                         |9.4

--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 8 branch is being closed.

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

* [Bug fortran/91726] [9 Regression] ICE in gfc_conv_array_ref, at fortran/trans-array.c:3612
       [not found] <bug-91726-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2021-05-14  9:52 ` [Bug fortran/91726] [9 " jakub at gcc dot gnu.org
@ 2021-06-01  8:15 ` rguenth at gcc dot gnu.org
  2022-05-27  8:38 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-06-01  8:15 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|9.4                         |9.5

--- Comment #11 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9.4 is being released, retargeting bugs to GCC 9.5.

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

* [Bug fortran/91726] [9 Regression] ICE in gfc_conv_array_ref, at fortran/trans-array.c:3612
       [not found] <bug-91726-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2021-06-01  8:15 ` rguenth at gcc dot gnu.org
@ 2022-05-27  8:38 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-27  8:38 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|9.5                         |10.0

--- Comment #12 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed in GCC 10.

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

end of thread, other threads:[~2022-05-27  8:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-91726-4@http.gcc.gnu.org/bugzilla/>
2020-05-06 13:14 ` [Bug fortran/91726] [8/9 Regression] ICE in gfc_conv_array_ref, at fortran/trans-array.c:3612 jrfsousa at gmail dot com
2021-01-08 18:40 ` pault at gcc dot gnu.org
2021-04-01 18:19 ` jrfsousa at gmail dot com
2021-05-14  9:52 ` [Bug fortran/91726] [9 " jakub at gcc dot gnu.org
2021-06-01  8:15 ` rguenth at gcc dot gnu.org
2022-05-27  8:38 ` rguenth 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).