public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/95707] New: ICE in finish_equivalences, at fortran/trans-common.c:1319
@ 2020-06-16 18:51 gscfq@t-online.de
  2020-06-16 20:15 ` [Bug fortran/95707] " anlauf at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: gscfq@t-online.de @ 2020-06-16 18:51 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95707
           Summary: ICE in finish_equivalences, at
                    fortran/trans-common.c:1319
           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: ---

Happens between name length 35 (ok) and 36 (ICE) :


$ cat z1_35.f90
module m2345678901234567890123456789012345
   interface
      module subroutine s2345678901234567890123456789012345
      end
   end interface
end
submodule(m2345678901234567890123456789012345) &
   n2345678901234567890123456789012345
   real :: a(4), u(3,2)
   real :: b(4), v(4,2)
   equivalence (a(1),u(1,1)), (b(1),v(1,1))
end


$ cat z1_36.f90
module m23456789012345678901234567890123456
   interface
      module subroutine s23456789012345678901234567890123456
      end
   end interface
end
submodule(m23456789012345678901234567890123456) &
   n23456789012345678901234567890123456
   real :: a(4), u(3,2)
   real :: b(4), v(4,2)
   equivalence (a(1),u(1,1)), (b(1),v(1,1))
end


$ cat z1_63.f90
module m23456789012345678901234567890123456789012345678901234567890123
   interface
      module subroutine
s23456789012345678901234567890123456789012345678901234567890123
      end
   end interface
end
submodule(m23456789012345678901234567890123456789012345678901234567890123) &
   n23456789012345678901234567890123456789012345678901234567890123
   real :: a(4), u(3,2)
   real :: b(4), v(4,2)
   equivalence (a(1),u(1,1)), (b(1),v(1,1))
end


$ gfortran-11-20200614 -c z1_35.f90
$
$ gfortran-11-20200614 -c z1_36.f90
f951: internal compiler error: in finish_equivalences, at
fortran/trans-common.c:1319
0x71f615 finish_equivalences
        ../../gcc/fortran/trans-common.c:1319
0x71f615 gfc_trans_common(gfc_namespace*)
        ../../gcc/fortran/trans-common.c:1363
0x72c977 gfc_generate_module_vars(gfc_namespace*)
        ../../gcc/fortran/trans-decl.c:5796
0x707684 gfc_generate_module_code(gfc_namespace*)
        ../../gcc/fortran/trans.c:2238
0x6b4501 translate_all_program_units
        ../../gcc/fortran/parse.c:6293
0x6b4501 gfc_parse_file()
        ../../gcc/fortran/parse.c:6545
0x70036f gfc_be_parse_file
        ../../gcc/fortran/f95-lang.c:212

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

* [Bug fortran/95707] ICE in finish_equivalences, at fortran/trans-common.c:1319
  2020-06-16 18:51 [Bug fortran/95707] New: ICE in finish_equivalences, at fortran/trans-common.c:1319 gscfq@t-online.de
@ 2020-06-16 20:15 ` anlauf at gcc dot gnu.org
  2020-06-17 19:28 ` anlauf at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: anlauf at gcc dot gnu.org @ 2020-06-16 20:15 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-06-16
     Ever confirmed|0                           |1
                 CC|                            |anlauf at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
           Priority|P3                          |P4

--- Comment #1 from anlauf at gcc dot gnu.org ---
The ICE is fixed by the patch:

diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index c12a8bef277..836e0b3063d 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -1677,8 +1677,8 @@ typedef struct gfc_common_head
   char use_assoc, saved, threadprivate;
   unsigned char omp_declare_target : 1;
   unsigned char omp_declare_target_link : 1;
-  /* Provide sufficient space to hold "symbol.eq.1234567890".  */
-  char name[GFC_MAX_SYMBOL_LEN + 1 + 14];
+  /* Provide sufficient space to hold "symbol.symbol.eq.1234567890".  */
+  char name[2*GFC_MAX_SYMBOL_LEN + 1 + 14 + 1];
   struct gfc_symbol *head;
   const char* binding_label;
   int is_bind_c;

However, I then get a possibly unrelated error:

pr95707.f90:8:73:

    8 |          
n2345678901234567890123456789012345678901234567890123456789_123
      |                                                                        
1
Warning: Named COMMON block
'm2345678901234567890123456789012345678901234567890123456789_123.n2345678901234567890123456789012345678901234567890123456789_123.eq.1'
at (1) shall be of the same size as elsewhere (24 vs 32 bytes)

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

* [Bug fortran/95707] ICE in finish_equivalences, at fortran/trans-common.c:1319
  2020-06-16 18:51 [Bug fortran/95707] New: ICE in finish_equivalences, at fortran/trans-common.c:1319 gscfq@t-online.de
  2020-06-16 20:15 ` [Bug fortran/95707] " anlauf at gcc dot gnu.org
@ 2020-06-17 19:28 ` anlauf at gcc dot gnu.org
  2020-06-20 14:15 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: anlauf at gcc dot gnu.org @ 2020-06-17 19:28 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

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

--- Comment #2 from anlauf at gcc dot gnu.org ---
Patch posted for review:

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

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

* [Bug fortran/95707] ICE in finish_equivalences, at fortran/trans-common.c:1319
  2020-06-16 18:51 [Bug fortran/95707] New: ICE in finish_equivalences, at fortran/trans-common.c:1319 gscfq@t-online.de
  2020-06-16 20:15 ` [Bug fortran/95707] " anlauf at gcc dot gnu.org
  2020-06-17 19:28 ` anlauf at gcc dot gnu.org
@ 2020-06-20 14:15 ` cvs-commit at gcc dot gnu.org
  2020-06-22 19:30 ` cvs-commit at gcc dot gnu.org
  2020-06-23 20:47 ` anlauf at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-06-20 14:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- 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:3345e74299687de6144b87c0632018cafd4ccf3b

commit r11-1570-g3345e74299687de6144b87c0632018cafd4ccf3b
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Sat Jun 20 16:15:16 2020 +0200

    PR fortran/95707 - ICE in finish_equivalences, at
fortran/trans-common.c:1319

    With submodules and equivalence declarations, name mangling may result in
    long internal symbols overflowing internal buffers.  We now check that
    we do not exceed the enlarged buffer sizes.

    gcc/fortran/
            PR fortran/95707
            * gfortran.h (gfc_common_head): Enlarge buffer.
            * trans-common.c (gfc_sym_mangled_common_id): Enlarge temporary
            buffers, and add check on length on mangled name to prevent
            overflow.

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

* [Bug fortran/95707] ICE in finish_equivalences, at fortran/trans-common.c:1319
  2020-06-16 18:51 [Bug fortran/95707] New: ICE in finish_equivalences, at fortran/trans-common.c:1319 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2020-06-20 14:15 ` cvs-commit at gcc dot gnu.org
@ 2020-06-22 19:30 ` cvs-commit at gcc dot gnu.org
  2020-06-23 20:47 ` anlauf at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-06-22 19:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- 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:4dd2fd9c4350529947fffc6bf257b5e22379554b

commit r10-8341-g4dd2fd9c4350529947fffc6bf257b5e22379554b
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Sat Jun 20 16:15:16 2020 +0200

    PR fortran/95707 - ICE in finish_equivalences, at
fortran/trans-common.c:1319

    With submodules and equivalence declarations, name mangling may result in
    long internal symbols overflowing internal buffers.  We now check that
    we do not exceed the enlarged buffer sizes.

    gcc/fortran/
            PR fortran/95707
            * gfortran.h (gfc_common_head): Enlarge buffer.
            * trans-common.c (gfc_sym_mangled_common_id): Enlarge temporary
            buffers, and add check on length on mangled name to prevent
            overflow.

    (cherry picked from commit 3345e74299687de6144b87c0632018cafd4ccf3b)

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

* [Bug fortran/95707] ICE in finish_equivalences, at fortran/trans-common.c:1319
  2020-06-16 18:51 [Bug fortran/95707] New: ICE in finish_equivalences, at fortran/trans-common.c:1319 gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2020-06-22 19:30 ` cvs-commit at gcc dot gnu.org
@ 2020-06-23 20:47 ` anlauf at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: anlauf at gcc dot gnu.org @ 2020-06-23 20:47 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

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

--- Comment #5 from anlauf at gcc dot gnu.org ---
Fixed on master for GCC-11, and backported to 10-branch.

Backporting further would involve backports from other PRs and is probably
not worth it.  Thus closing.

Thanks for the report!

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

end of thread, other threads:[~2020-06-23 20:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-16 18:51 [Bug fortran/95707] New: ICE in finish_equivalences, at fortran/trans-common.c:1319 gscfq@t-online.de
2020-06-16 20:15 ` [Bug fortran/95707] " anlauf at gcc dot gnu.org
2020-06-17 19:28 ` anlauf at gcc dot gnu.org
2020-06-20 14:15 ` cvs-commit at gcc dot gnu.org
2020-06-22 19:30 ` cvs-commit at gcc dot gnu.org
2020-06-23 20:47 ` 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).