public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/61138] New: Wrong code with pointer-bounds remapping
@ 2014-05-10  8:30 burnus at gcc dot gnu.org
  2014-05-10  9:13 ` [Bug fortran/61138] [4.8/4.9/4.10 Regression] " dominiq at lps dot ens.fr
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: burnus at gcc dot gnu.org @ 2014-05-10  8:30 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 61138
           Summary: Wrong code with pointer-bounds remapping
           Product: gcc
           Version: 4.10.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org

Follow up to http://gcc.gnu.org/ml/fortran/2014-05/msg00023.html

The following code should print:
 6,  -5
 5,  6,  7,  8,  9,  10

and it does so with the Cray compiler. With GCC 4.10, however, it prints the
*whole* array:
  10  -5
   1   2   3   4   5   6   7   8   9  10



implicit none
integer, target :: tgt(10)
integer, target, allocatable :: tgt2(:)
integer, pointer :: ptr(:)

tgt = [1,2,3,4,5,6,7,8,9,10]
tgt2 = [1,2,3,4,5,6,7,8,9,10]


ptr(-5:) => tgt(5:)  ! Okay

if (size(ptr) /= 6 .or. lbound(ptr,1) /= -5) call abort()
if (any (ptr /= [5,6,7,8,9,10])) call abort()


ptr(-5:) => tgt2(5:)  ! wrongly associates the whole array

print '(*(i4))', size(ptr), lbound(ptr)
print '(*(i4))', ptr

if (size(ptr) /= 6 .or. lbound(ptr,1) /= -5) call abort()
if (any (ptr /= [5,6,7,8,9,10])) call abort()
end


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

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

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-10  8:30 [Bug fortran/61138] New: Wrong code with pointer-bounds remapping burnus at gcc dot gnu.org
2014-05-10  9:13 ` [Bug fortran/61138] [4.8/4.9/4.10 Regression] " dominiq at lps dot ens.fr
2014-05-13  9:55 ` rguenth at gcc dot gnu.org
2014-05-22  9:06 ` rguenth at gcc dot gnu.org
2014-05-25 12:28 ` mikael at gcc dot gnu.org
2014-12-19 13:34 ` [Bug fortran/61138] [4.8/4.9/5 " jakub at gcc dot gnu.org
2015-02-06 21:00 ` mikael at gcc dot gnu.org
2015-02-09 12:57 ` mikael at gcc dot gnu.org
2015-03-14 12:24 ` mikael at gcc dot gnu.org
2015-03-21 15:47 ` mikael at gcc dot gnu.org
2015-03-21 18:16 ` mikael at gcc dot gnu.org
2015-03-21 18:20 ` mikael 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).