public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/54070] New: Wrong code with allocatable deferred-length (array) function results
@ 2012-07-23  9:33 burnus at gcc dot gnu.org
  2012-07-23 10:23 ` [Bug fortran/54070] " burnus at gcc dot gnu.org
                   ` (19 more replies)
  0 siblings, 20 replies; 21+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-07-23  9:33 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54070

             Bug #: 54070
           Summary: Wrong code with allocatable deferred-length (array)
                    function results
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org
                CC: damian@rouson.net, pault@gcc.gnu.org


As reported by Damian at http://gcc.gnu.org/ml/fortran/2012-07/msg00117.html ,
allocatable deferred-length (array) function results have issues.


The following code gives a segfault - or with tree checking:
gfc_add_modify_loc, at fortran/trans.c:160

function f()
  character(len=:),allocatable :: f
  f ="ABC"
end function


The following (invalid) program gives an ICE:
  in gimplify_var_or_parm_decl, at gimplify.c:2048
(the program is invalid as one assigns a scalar to an unallocated array)

function f(a)
  character(len=*) :: a
  character(len=:),allocatable :: f(:)
  f = a
end function



One gets the same ICE for the original example. Looking at the dump, there is
no (re)allocation - but there should be one!

module deferred_length_char_array
contains
  function return_string(argument)
    character(*) :: argument
    character(:), dimension(:), allocatable :: return_string
    return_string = argument
  end function 
end module


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

end of thread, other threads:[~2015-09-03 21:16 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-23  9:33 [Bug fortran/54070] New: Wrong code with allocatable deferred-length (array) function results burnus at gcc dot gnu.org
2012-07-23 10:23 ` [Bug fortran/54070] " burnus at gcc dot gnu.org
2012-07-24  9:28 ` burnus at gcc dot gnu.org
2012-07-24 14:40 ` burnus at gcc dot gnu.org
2013-07-15  6:26 ` zeccav at gmail dot com
2014-01-07 11:15 ` dominiq at lps dot ens.fr
2014-03-23  0:26 ` [Bug fortran/54070] [4.8/4.9 Regression] " dominiq at lps dot ens.fr
2014-03-24  5:29 ` rouson at stanford dot edu
2014-03-31  8:56 ` rguenth at gcc dot gnu.org
2014-03-31  9:09 ` rguenth at gcc dot gnu.org
2014-05-22  9:05 ` [Bug fortran/54070] [4.8/4.9/4.10 " rguenth at gcc dot gnu.org
2014-11-16 15:31 ` [Bug fortran/54070] [4.8/4.9/5 " dominiq at lps dot ens.fr
2014-11-16 15:33 ` dominiq at lps dot ens.fr
2014-12-08 23:22 ` dominiq at lps dot ens.fr
2014-12-19 13:26 ` jakub at gcc dot gnu.org
2015-03-10 17:58 ` dominiq at lps dot ens.fr
2015-06-23  8:19 ` [Bug fortran/54070] [4.8/4.9/5/6 " rguenth at gcc dot gnu.org
2015-06-26 19:54 ` [Bug fortran/54070] [4.9/5/6 " jakub at gcc dot gnu.org
2015-06-26 20:27 ` jakub at gcc dot gnu.org
2015-08-31 16:45 ` zeccav at gmail dot com
2015-09-03 21:16 ` dominiq at lps dot ens.fr

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