public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/68155] ICE on initializing character array in type (len_lhs <> len_rhs)
  2015-10-29 18:35 [Bug fortran/68155] New: ICE on initializing character array in type (len_lhs <> len_rhs) gerhard.steinmetz.fortran@t-online.de
@ 2015-10-29 18:35 ` gerhard.steinmetz.fortran@t-online.de
  2015-10-29 18:37 ` gerhard.steinmetz.fortran@t-online.de
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: gerhard.steinmetz.fortran@t-online.de @ 2015-10-29 18:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Gerhard Steinmetz <gerhard.steinmetz.fortran@t-online.de> ---
Works with len_lhs == len_rhs :

$ cat z2t.f90
program p
   type t
      character(2) :: z(1) = 'a' // ['y']
   end type
   type(t) :: z
   print *, z
end

$ gfortran -g -O0 -Wall -fcheck=all z2t.f90
$ a.out
 ay


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

* [Bug fortran/68155] New: ICE on initializing character array in type (len_lhs <> len_rhs)
@ 2015-10-29 18:35 gerhard.steinmetz.fortran@t-online.de
  2015-10-29 18:35 ` [Bug fortran/68155] " gerhard.steinmetz.fortran@t-online.de
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: gerhard.steinmetz.fortran@t-online.de @ 2015-10-29 18:35 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 68155
           Summary: ICE on initializing character array in type (len_lhs
                    <> len_rhs)
           Product: gcc
           Version: 5.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gerhard.steinmetz.fortran@t-online.de
  Target Milestone: ---

Embedded in a type :

$ cat z1t.f90
program p
   type t
      character(2) :: z(1) = '' // ['y']
   end type
   type(t) :: z
   print *, z
end

$ gfortran -g -O0 -Wall -fcheck=all z1t.f90
f951: internal compiler error: Segmentation fault

---

Simplified and correct :

$ cat z1c.f90
program p
   character(2) :: z(1) = '' // ['y']
   print *, '>>' // z // '<<'
end

$ gfortran -g -O0 -Wall -fcheck=all z1c.f90
$ a.out
 >>y <<


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

* [Bug fortran/68155] ICE on initializing character array in type (len_lhs <> len_rhs)
  2015-10-29 18:35 [Bug fortran/68155] New: ICE on initializing character array in type (len_lhs <> len_rhs) gerhard.steinmetz.fortran@t-online.de
  2015-10-29 18:35 ` [Bug fortran/68155] " gerhard.steinmetz.fortran@t-online.de
@ 2015-10-29 18:37 ` gerhard.steinmetz.fortran@t-online.de
  2015-10-29 23:03 ` dominiq at lps dot ens.fr
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: gerhard.steinmetz.fortran@t-online.de @ 2015-10-29 18:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Gerhard Steinmetz <gerhard.steinmetz.fortran@t-online.de> ---
Fails (again len_lhs <> len_rhs) :

$ cat z3t.f90
program p
   type t
      character(2) :: z(1) = 'ab' // ['y']
   end type
   type(t) :: z
   print *, z
end

$ gfortran -g -O0 -Wall -fcheck=all z3t.f90
z3t.f90:3:28:

       character(2) :: z(1) = 'ab' // ['y']
                            1
Warning: CHARACTER expression at (1) is being truncated (3/2)
[-Wcharacter-truncation]
f951: internal compiler error: Segmentation fault

---

Again, works without type :

$ cat z3c.f90
program p
   character(2) :: z(1) = 'ab' // ['y']
   print *, z
end

$ gfortran -g -O0 -Wall -fcheck=all z3c.f90
z3c.f90:2:25:

    character(2) :: z(1) = 'ab' // ['y']
                         1
Warning: CHARACTER expression at (1) is being truncated (3/2)
[-Wcharacter-truncation]

$ a.out
 ab

---

Eventually one of the recent patches cures this one too.


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

* [Bug fortran/68155] ICE on initializing character array in type (len_lhs <> len_rhs)
  2015-10-29 18:35 [Bug fortran/68155] New: ICE on initializing character array in type (len_lhs <> len_rhs) gerhard.steinmetz.fortran@t-online.de
  2015-10-29 18:35 ` [Bug fortran/68155] " gerhard.steinmetz.fortran@t-online.de
  2015-10-29 18:37 ` gerhard.steinmetz.fortran@t-online.de
@ 2015-10-29 23:03 ` dominiq at lps dot ens.fr
  2023-09-19 17:30 ` pault at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-10-29 23:03 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-10-29
     Ever confirmed|0                           |1

--- Comment #3 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Confirmed from 4.8 up to trunk (6.0).


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

* [Bug fortran/68155] ICE on initializing character array in type (len_lhs <> len_rhs)
  2015-10-29 18:35 [Bug fortran/68155] New: ICE on initializing character array in type (len_lhs <> len_rhs) gerhard.steinmetz.fortran@t-online.de
                   ` (2 preceding siblings ...)
  2015-10-29 23:03 ` dominiq at lps dot ens.fr
@ 2023-09-19 17:30 ` pault at gcc dot gnu.org
  2023-09-24  8:01 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pault at gcc dot gnu.org @ 2023-09-19 17:30 UTC (permalink / raw)
  To: gcc-bugs

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

Paul Thomas <pault at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pault at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |pault at gcc dot gnu.org

--- Comment #12 from Paul Thomas <pault at gcc dot gnu.org> ---
Created attachment 55938
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55938&action=edit
Fix for the test in comment #11

This patch needs checking against all the other comments and a suitable
dejagnu-ified testcase developing. It does regtest cleanly.

Paul

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

* [Bug fortran/68155] ICE on initializing character array in type (len_lhs <> len_rhs)
  2015-10-29 18:35 [Bug fortran/68155] New: ICE on initializing character array in type (len_lhs <> len_rhs) gerhard.steinmetz.fortran@t-online.de
                   ` (3 preceding siblings ...)
  2023-09-19 17:30 ` pault at gcc dot gnu.org
@ 2023-09-24  8:01 ` cvs-commit at gcc dot gnu.org
  2023-09-24 14:26 ` cvs-commit at gcc dot gnu.org
  2023-09-24 14:27 ` pault at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-09-24  8:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #13 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Paul Thomas <pault@gcc.gnu.org>:

https://gcc.gnu.org/g:c23ce23e9ce162c49bca8900c8a20079b49501c9

commit r14-4242-gc23ce23e9ce162c49bca8900c8a20079b49501c9
Author: Paul Thomas <pault@gcc.gnu.org>
Date:   Sun Sep 24 09:00:52 2023 +0100

    Fortran: Pad mismatched charlens in component initializers [PR68155]

    2023-09-24  Paul Thomas  <pault@gcc.gnu.org>

    gcc/fortran
            PR fortran/68155
            * decl.cc (fix_initializer_charlen): New function broken out of
            add_init_expr_to_sym.
            (add_init_expr_to_sym, build_struct): Call the new function.

            PR fortran/111271
            * trans-expr.cc (gfc_conv_intrinsic_to_class): Remove repeated
            condition.

    gcc/testsuite/
            PR fortran/68155
            * gfortran.dg/pr68155.f90: New test.

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

* [Bug fortran/68155] ICE on initializing character array in type (len_lhs <> len_rhs)
  2015-10-29 18:35 [Bug fortran/68155] New: ICE on initializing character array in type (len_lhs <> len_rhs) gerhard.steinmetz.fortran@t-online.de
                   ` (4 preceding siblings ...)
  2023-09-24  8:01 ` cvs-commit at gcc dot gnu.org
@ 2023-09-24 14:26 ` cvs-commit at gcc dot gnu.org
  2023-09-24 14:27 ` pault at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-09-24 14:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #14 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Paul Thomas <pault@gcc.gnu.org>:

https://gcc.gnu.org/g:8c1925ece0193058120e94614e99360e9600777e

commit r13-7833-g8c1925ece0193058120e94614e99360e9600777e
Author: Paul Thomas <pault@gcc.gnu.org>
Date:   Sun Sep 24 15:26:01 2023 +0100

    Fortran: Pad mismatched charlens in component initializers [PR68155]

    2023-09-24  Paul Thomas  <pault@gcc.gnu.org>

    gcc/fortran
            PR fortran/68155
            * decl.cc (fix_initializer_charlen): New function broken out of
            add_init_expr_to_sym.
            (add_init_expr_to_sym, build_struct): Call the new function.

    gcc/testsuite/
            PR fortran/68155
            * gfortran.dg/pr68155.f90: New test.

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

* [Bug fortran/68155] ICE on initializing character array in type (len_lhs <> len_rhs)
  2015-10-29 18:35 [Bug fortran/68155] New: ICE on initializing character array in type (len_lhs <> len_rhs) gerhard.steinmetz.fortran@t-online.de
                   ` (5 preceding siblings ...)
  2023-09-24 14:26 ` cvs-commit at gcc dot gnu.org
@ 2023-09-24 14:27 ` pault at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: pault at gcc dot gnu.org @ 2023-09-24 14:27 UTC (permalink / raw)
  To: gcc-bugs

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

Paul Thomas <pault at gcc dot gnu.org> changed:

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

--- Comment #15 from Paul Thomas <pault at gcc dot gnu.org> ---
Fixed on 13-branch and mainline.

Thanks for the report and sorry that it has taken a little while to fix.

Regards

Paul

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

end of thread, other threads:[~2023-09-24 14:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-29 18:35 [Bug fortran/68155] New: ICE on initializing character array in type (len_lhs <> len_rhs) gerhard.steinmetz.fortran@t-online.de
2015-10-29 18:35 ` [Bug fortran/68155] " gerhard.steinmetz.fortran@t-online.de
2015-10-29 18:37 ` gerhard.steinmetz.fortran@t-online.de
2015-10-29 23:03 ` dominiq at lps dot ens.fr
2023-09-19 17:30 ` pault at gcc dot gnu.org
2023-09-24  8:01 ` cvs-commit at gcc dot gnu.org
2023-09-24 14:26 ` cvs-commit at gcc dot gnu.org
2023-09-24 14:27 ` pault 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).