public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/67987] New: ICE on declaring and initializing character with negative len
@ 2015-10-16 14:08 gerhard.steinmetz.fortran@t-online.de
  2015-10-16 17:01 ` [Bug fortran/67987] " kargl at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: gerhard.steinmetz.fortran@t-online.de @ 2015-10-16 14:08 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 67987
           Summary: ICE on declaring and initializing character with
                    negative len
           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: ---

Declaring and initializing a character with negative len (< -1)
requests memory of about 2^64 (= 18446744073709551616) :


$ cat z1.f90
program p
   character(-8) :: c = ' '
end


$ gfortran -g -O0 -Wall -fcheck=all -fno-frontend-optimize z1.f90
f951: out of memory allocating 18446744073709551588 bytes after a total of
434176 bytes

---

Warning without assignment :

$ cat z2.f90
program p
   character(-8) :: c
end

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

    character(-8) :: c
             1
Warning: CHARACTER variable at (1) has negative length -8, the length has been
set to zero [-Wsurprising]

---

With len = -1, reaction depends on used compiler options :

$ cat z3.f90
program p
   character(-1) :: c = 'c'
end

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

---

Same issue with "character parameter".


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

end of thread, other threads:[~2015-10-19 18:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-16 14:08 [Bug fortran/67987] New: ICE on declaring and initializing character with negative len gerhard.steinmetz.fortran@t-online.de
2015-10-16 17:01 ` [Bug fortran/67987] " kargl at gcc dot gnu.org
2015-10-16 18:03 ` kargl at gcc dot gnu.org
2015-10-16 18:31 ` sgk at troutmask dot apl.washington.edu
2015-10-16 19:16 ` kargl at gcc dot gnu.org
2015-10-17 16:51 ` kargl at gcc dot gnu.org
2015-10-19 18:17 ` 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).