public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/67884] New: Missing error message on required allocatable attribute
@ 2015-10-07 18:59 gerhard.steinmetz.fortran@t-online.de
  2015-10-07 19:02 ` [Bug fortran/67884] " gerhard.steinmetz.fortran@t-online.de
  0 siblings, 1 reply; 2+ messages in thread
From: gerhard.steinmetz.fortran@t-online.de @ 2015-10-07 18:59 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 67884
           Summary: Missing error message on required allocatable
                    attribute
           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: ---

This definition of f is incomplete :

$ cat z2a.f90
program p
   integer i
   print *, [(f(i), i=1,3)]
contains
   function f(n)
      integer :: n
      character(:) :: f
      character(3) :: c = 'abc'
      f = c(n:n)
   end
end

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


With additional/different options other effects may occur.
Only sometimes. Needs running a.out many times.
For example :

$ gfortran -g -O0 -fcheck=all -fstack-protector z2a.f90
$ a.out
Operating system error: Cannot allocate memory
Memory allocation failed


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

* [Bug fortran/67884] Missing error message on required allocatable attribute
  2015-10-07 18:59 [Bug fortran/67884] New: Missing error message on required allocatable attribute gerhard.steinmetz.fortran@t-online.de
@ 2015-10-07 19:02 ` gerhard.steinmetz.fortran@t-online.de
  0 siblings, 0 replies; 2+ messages in thread
From: gerhard.steinmetz.fortran@t-online.de @ 2015-10-07 19:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Gerhard Steinmetz <gerhard.steinmetz.fortran@t-online.de> ---
Whereas, detected with explicit result variable :

$ cat z5a.f90
program p
   integer i
   print *, [(f(i), i=1,3)]
contains
   function f(n) result(z)
      integer :: n
      character(:) :: z
      character(3) :: c = 'abc'
      z = c(n:n)
   end
end

$ gfortran -g -O0 -Wall -fcheck=all z5a.f90
z5a.f90:5:26:

    function f(n) result(z)
                          1
Error: Entity 'z' at (1) has a deferred type parameter and requires either the
pointer or allocatable attribute


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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-07 18:59 [Bug fortran/67884] New: Missing error message on required allocatable attribute gerhard.steinmetz.fortran@t-online.de
2015-10-07 19:02 ` [Bug fortran/67884] " gerhard.steinmetz.fortran@t-online.de

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).