public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/59398] New: Wrong bounds for allocatable result and for
@ 2013-12-05 18:14 loximann at gmail dot com
  2013-12-05 20:34 ` [Bug fortran/59398] " anlauf at gmx dot de
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: loximann at gmail dot com @ 2013-12-05 18:14 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 59398
           Summary: Wrong bounds for allocatable result and for
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: loximann at gmail dot com

The lower bounds of the result of an allocatable array-valued function are
always set to 1.

Also, I discovered that if LHS is allocated and has the same size as RHS, the
bounds are not changed.

This code illustrates it:
************************************************
program return_allocatable
    implicit none

    real, allocatable :: a(:)

    real, parameter :: b(-2:4)=[1,2,3,4,5,6,7]

    a=foo(3)
    print*,lbound(a),':',ubound(a)

    a=b
    print*,lbound(a),':',ubound(a)

contains
    function foo(n)
        integer :: n
        real, allocatable :: foo(:)

        allocate(foo(-3:n))

        foo=n
    end function
end program
************************************************
The expected output is
-3:3
-2:4
but instead I get
1:7
1:7


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

end of thread, other threads:[~2015-08-30 15:39 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-05 18:14 [Bug fortran/59398] New: Wrong bounds for allocatable result and for loximann at gmail dot com
2013-12-05 20:34 ` [Bug fortran/59398] " anlauf at gmx dot de
2013-12-05 20:53 ` anlauf at gmx dot de
2013-12-05 20:59 ` anlauf at gmx dot de
2013-12-09 13:47 ` loximann at gmail dot com
2014-01-06 13:14 ` dominiq at lps dot ens.fr
2014-01-06 19:50 ` anlauf at gmx dot de
2014-01-08 11:36 ` loximann at gmail dot com
2014-12-06 16:14 ` dominiq at lps dot ens.fr
2015-08-30 15:39 ` 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).