public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/67802] New: ICE on initializing character with wrong len type
@ 2015-10-01 17:40 gerhard.steinmetz.fortran@t-online.de
  2015-10-01 17:42 ` [Bug fortran/67802] " gerhard.steinmetz.fortran@t-online.de
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: gerhard.steinmetz.fortran@t-online.de @ 2015-10-01 17:40 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 67802
           Summary: ICE on initializing character with wrong len type
           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: ---

With a wrong data type for len instead of a scalar-int-expr :

$ cat za2.f90
program p
   character(1.) :: c1 = ' '
   character(1d1) :: c2 = ' '
   character((0.,1.)) :: c3 = ' '
   character(.true.) :: c4 = ' '
end

$ gfortran -g -O0 -Wall -fcheck=all -fno-frontend-optimize za2.f90
f951: internal compiler error: Segmentation fault

---

Same issue for these variations :

$ cat za3.f90
program p
   character(1.), parameter :: c1 = ' '
   character(1d1), parameter :: c2 = ' '
   character((0.,1.)), parameter :: c3 = ' '
   character(.true.), parameter :: c4 = ' '
end


$ cat zp2.f90
program p
   real, parameter :: n1 = 1.
   double precision, parameter :: n2 = 1d1
   complex, parameter :: n3 = (0.,1.)
   logical, parameter :: n4 = .true.
   character(n1) :: c1 = ' '
   character(n2) :: c2 = ' '
   character(n3) :: c3 = ' '
   character(n4) :: c4 = ' '
end


$ cat zp3.f90
program p
   real, parameter :: n1 = 1.
   double precision, parameter :: n2 = 1d1
   complex, parameter :: n3 = (0.,1.)
   logical, parameter :: n4 = .true.
   character(n1), parameter :: c1 = ' '
   character(n2), parameter :: c2 = ' '
   character(n3), parameter :: c3 = ' '
   character(n4), parameter :: c4 = ' '
end


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

* [Bug fortran/67802] ICE on initializing character with wrong len type
  2015-10-01 17:40 [Bug fortran/67802] New: ICE on initializing character with wrong len type gerhard.steinmetz.fortran@t-online.de
@ 2015-10-01 17:42 ` gerhard.steinmetz.fortran@t-online.de
  2015-10-01 18:31 ` kargl at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: gerhard.steinmetz.fortran@t-online.de @ 2015-10-01 17:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Gerhard Steinmetz <gerhard.steinmetz.fortran@t-online.de> ---
Whereas, without initialization relevant errors are detected :


$ cat za1.f90
program p
   character(1.) :: c1
   character(1d1) :: c2
   character((0.,1.)) :: c3
   character(.true.) :: c4
end


$ cat zp1.f90
program p
   real, parameter :: n1 = 1.
   double precision, parameter :: n2 = 1d1
   complex, parameter :: n3 = (0.,1.)
   logical, parameter :: n4 = .true.
   character(n1) :: c1
   character(n2) :: c2
   character(n3) :: c3
   character(n4) :: c4
end


$ gfortran -g -O0 -Wall -fcheck=all -fno-frontend-optimize zp1.f90
zp1.f90:9:13:

    character(n4) :: c4
             1
Error: Expression at (1) must be of INTEGER type, found LOGICAL
zp1.f90:8:13:

    character(n3) :: c3
             1
Error: Expression at (1) must be of INTEGER type, found COMPLEX
zp1.f90:7:13:

    character(n2) :: c2
             1
Error: Expression at (1) must be of INTEGER type, found REAL
zp1.f90:6:13:

    character(n1) :: c1
             1
Error: Expression at (1) must be of INTEGER type, found REAL


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

* [Bug fortran/67802] ICE on initializing character with wrong len type
  2015-10-01 17:40 [Bug fortran/67802] New: ICE on initializing character with wrong len type gerhard.steinmetz.fortran@t-online.de
  2015-10-01 17:42 ` [Bug fortran/67802] " gerhard.steinmetz.fortran@t-online.de
@ 2015-10-01 18:31 ` kargl at gcc dot gnu.org
  2015-10-02 21:27 ` kargl at gcc dot gnu.org
  2015-10-02 21:29 ` kargl at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: kargl at gcc dot gnu.org @ 2015-10-01 18:31 UTC (permalink / raw)
  To: gcc-bugs

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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-10-01
                 CC|                            |kargl at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |kargl at gcc dot gnu.org
     Ever confirmed|0                           |1
      Known to fail|                            |4.6.4, 4.7.4, 4.8.5, 4.9.4,
                   |                            |5.2.1, 6.0

--- Comment #2 from kargl at gcc dot gnu.org ---
I have a patch.


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

* [Bug fortran/67802] ICE on initializing character with wrong len type
  2015-10-01 17:40 [Bug fortran/67802] New: ICE on initializing character with wrong len type gerhard.steinmetz.fortran@t-online.de
  2015-10-01 17:42 ` [Bug fortran/67802] " gerhard.steinmetz.fortran@t-online.de
  2015-10-01 18:31 ` kargl at gcc dot gnu.org
@ 2015-10-02 21:27 ` kargl at gcc dot gnu.org
  2015-10-02 21:29 ` kargl at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: kargl at gcc dot gnu.org @ 2015-10-02 21:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from kargl at gcc dot gnu.org ---
Author: kargl
Date: Fri Oct  2 21:27:02 2015
New Revision: 228430

URL: https://gcc.gnu.org/viewcvs?rev=228430&root=gcc&view=rev
Log:
2015-10-02  Steven G. Kargl  <kargl@gcc.gnu.org>

        PR fortran/67802
        * decl.c (add_init_expr_to_sym): Numeric constant for character
        length must be an INTEGER.

2015-10-02  Steven G. Kargl  <kargl@gcc.gnu.org>

        PR fortran/67802
        * gfortran.dg/pr67802.f90: New test.

Added:
    branches/gcc-5-branch/gcc/testsuite/gfortran.dg/pr67802.f90
Modified:
    branches/gcc-5-branch/gcc/fortran/ChangeLog
    branches/gcc-5-branch/gcc/fortran/decl.c
    branches/gcc-5-branch/gcc/testsuite/ChangeLog


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

* [Bug fortran/67802] ICE on initializing character with wrong len type
  2015-10-01 17:40 [Bug fortran/67802] New: ICE on initializing character with wrong len type gerhard.steinmetz.fortran@t-online.de
                   ` (2 preceding siblings ...)
  2015-10-02 21:27 ` kargl at gcc dot gnu.org
@ 2015-10-02 21:29 ` kargl at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: kargl at gcc dot gnu.org @ 2015-10-02 21:29 UTC (permalink / raw)
  To: gcc-bugs

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

kargl at gcc dot gnu.org changed:

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

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


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

end of thread, other threads:[~2015-10-02 21:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-01 17:40 [Bug fortran/67802] New: ICE on initializing character with wrong len type gerhard.steinmetz.fortran@t-online.de
2015-10-01 17:42 ` [Bug fortran/67802] " gerhard.steinmetz.fortran@t-online.de
2015-10-01 18:31 ` kargl at gcc dot gnu.org
2015-10-02 21:27 ` kargl at gcc dot gnu.org
2015-10-02 21:29 ` kargl 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).