public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/35470]  New: Valid pointer assigment code gives compilation errors
@ 2008-03-05 11:09 antony at cosmologist dot info
  2008-03-05 22:00 ` [Bug fortran/35470] " fxcoudert at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: antony at cosmologist dot info @ 2008-03-05 11:09 UTC (permalink / raw)
  To: gcc-bugs

This code compiles fine on all other known f95 compilers but gives an error in
gfortran (code compiled with __GFORTRAN__ works, alternative does not):



  type real_pointer
    real, dimension(:), pointer :: p
  end type real_pointer


...
      recursive subroutine QuickSortArr_Real(Arr, Lin, R, index)
      !Sorts an array of pointers to arrays of reals by the value of the
index'th entry
      integer, intent(in) :: Lin, R, index
#ifdef __GFORTRAN__
      type(real_pointer), dimension(:) :: Arr
#else
      type(real_pointer), dimension(*) :: Arr
#endif
      integer I, J, L
      real P
      type(real_pointer) :: temp

      L = Lin
      do

      I = L
      J = R
      P = Arr((L + R)/2)%p(index)

      do
      do while (Arr(I)%p(index) <  P) 
         I = I + 1
      end do

      do while (Arr(J)%p(index) > P) 
         J = J - 1
      end do

      if (I <= J) then

       Temp%p => Arr(I)%p
       Arr(I)%p => Arr(J)%p
       Arr(J)%p => Temp%p
       I = I + 1
       J = J - 1
      end if
      if (I > J) exit

      end do
    if (L < J) call QuickSortArr_Real(Arr, L, J, index);
    L = I
    if (I >= R) exit
    end do

    end subroutine QuickSortArr_Real


-- 
           Summary: Valid pointer assigment code gives compilation errors
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: antony at cosmologist dot info


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


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

* [Bug fortran/35470] Valid pointer assigment code gives compilation errors
  2008-03-05 11:09 [Bug fortran/35470] New: Valid pointer assigment code gives compilation errors antony at cosmologist dot info
@ 2008-03-05 22:00 ` fxcoudert at gcc dot gnu dot org
  2008-03-15 18:08 ` jvdelisle at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2008-03-05 22:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from fxcoudert at gcc dot gnu dot org  2008-03-05 22:00 -------
Confirmed as rejecting valid code, reduced testcase is:

subroutine sub(arr)
  type real_pointer
    real, pointer :: p(:)
  end type real_pointer
  type(real_pointer), dimension(*) :: arr
  real, pointer :: p(:)

  p => arr(1)%p
end subroutine

$ gfortran -c a.f90
a.f90:9.7:

  p => arr(1)%p
      1
Error: The upper bound in the last dimension must appear in the reference to
the assumed size array 'arr' at (1)


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |rejects-valid
   Last reconfirmed|0000-00-00 00:00:00         |2008-03-05 22:00:12
               date|                            |


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


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

* [Bug fortran/35470] Valid pointer assigment code gives compilation errors
  2008-03-05 11:09 [Bug fortran/35470] New: Valid pointer assigment code gives compilation errors antony at cosmologist dot info
  2008-03-05 22:00 ` [Bug fortran/35470] " fxcoudert at gcc dot gnu dot org
@ 2008-03-15 18:08 ` jvdelisle at gcc dot gnu dot org
  2008-03-15 18:11 ` jvdelisle at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2008-03-15 18:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jvdelisle at gcc dot gnu dot org  2008-03-15 18:07 -------
Think I have a fix.  Regression testing.

Index: resolve.c
===================================================================
--- resolve.c   (revision 133251)
+++ resolve.c   (working copy)
@@ -967,7 +967,7 @@ check_assumed_size_reference (gfc_symbol
        last = (ref->u.ar.end[dim] == NULL)
               && (ref->u.ar.type == DIMEN_ELEMENT);

-  if (last)
+  if (need_full_assumed_size && last)
     {
       gfc_error ("The upper bound in the last dimension must "
                 "appear in the reference to the assumed size "


-- 

jvdelisle at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jvdelisle at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2008-03-05 22:00:12         |2008-03-15 18:07:40
               date|                            |


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


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

* [Bug fortran/35470] Valid pointer assigment code gives compilation errors
  2008-03-05 11:09 [Bug fortran/35470] New: Valid pointer assigment code gives compilation errors antony at cosmologist dot info
  2008-03-05 22:00 ` [Bug fortran/35470] " fxcoudert at gcc dot gnu dot org
  2008-03-15 18:08 ` jvdelisle at gcc dot gnu dot org
@ 2008-03-15 18:11 ` jvdelisle at gcc dot gnu dot org
  2008-03-15 22:36 ` pault at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2008-03-15 18:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jvdelisle at gcc dot gnu dot org  2008-03-15 18:10 -------
Jumped too soon. Several failures with that pacth


-- 


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


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

* [Bug fortran/35470] Valid pointer assigment code gives compilation errors
  2008-03-05 11:09 [Bug fortran/35470] New: Valid pointer assigment code gives compilation errors antony at cosmologist dot info
                   ` (2 preceding siblings ...)
  2008-03-15 18:11 ` jvdelisle at gcc dot gnu dot org
@ 2008-03-15 22:36 ` pault at gcc dot gnu dot org
  2008-03-15 22:37 ` pault at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pault at gcc dot gnu dot org @ 2008-03-15 22:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pault at gcc dot gnu dot org  2008-03-15 22:36 -------
(In reply to comment #1)
> Confirmed as rejecting valid code, reduced testcase is:

This fixes it and is regtesting as I write.

Paul


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|jvdelisle at gcc dot gnu dot|pault at gcc dot gnu dot org
                   |org                         |
   Last reconfirmed|2008-03-15 18:07:40         |2008-03-15 22:36:11
               date|                            |


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


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

* [Bug fortran/35470] Valid pointer assigment code gives compilation errors
  2008-03-05 11:09 [Bug fortran/35470] New: Valid pointer assigment code gives compilation errors antony at cosmologist dot info
                   ` (3 preceding siblings ...)
  2008-03-15 22:36 ` pault at gcc dot gnu dot org
@ 2008-03-15 22:37 ` pault at gcc dot gnu dot org
  2008-03-16  5:01 ` jvdelisle at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pault at gcc dot gnu dot org @ 2008-03-15 22:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pault at gcc dot gnu dot org  2008-03-15 22:37 -------
(In reply to comment #1)
> Confirmed as rejecting valid code, reduced testcase is:

This fixes it and is regtesting as I write.

Paul(In reply to comment #4)
> (In reply to comment #1)
> > Confirmed as rejecting valid code, reduced testcase is:
> 
> This fixes it and is regtesting as I write.
> 
> Paul
> 

If only 'this' would fix things:)

Index: /svn/trunk/gcc/fortran/resolve.c
===================================================================
*** /svn/trunk/gcc/fortran/resolve.c    (revision 133062)
--- /svn/trunk/gcc/fortran/resolve.c    (working copy)
*************** check_assumed_size_reference (gfc_symbol
*** 965,970 ****
--- 965,971 ----
      if (ref->type == REF_ARRAY)
        for (dim = 0; dim < ref->u.ar.as->rank; dim++)
        last = (ref->u.ar.end[dim] == NULL)
+              && (ref->u.ar.as->type == AS_ASSUMED_SIZE)
               && (ref->u.ar.type == DIMEN_ELEMENT);

    if (last)


-- 


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


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

* [Bug fortran/35470] Valid pointer assigment code gives compilation errors
  2008-03-05 11:09 [Bug fortran/35470] New: Valid pointer assigment code gives compilation errors antony at cosmologist dot info
                   ` (4 preceding siblings ...)
  2008-03-15 22:37 ` pault at gcc dot gnu dot org
@ 2008-03-16  5:01 ` jvdelisle at gcc dot gnu dot org
  2008-03-16  7:16 ` pault at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2008-03-16  5:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jvdelisle at gcc dot gnu dot org  2008-03-16 05:00 -------
You r 'this' is better than my 'Think' Passed regression testing here on
x86-64.


-- 


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


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

* [Bug fortran/35470] Valid pointer assigment code gives compilation errors
  2008-03-05 11:09 [Bug fortran/35470] New: Valid pointer assigment code gives compilation errors antony at cosmologist dot info
                   ` (5 preceding siblings ...)
  2008-03-16  5:01 ` jvdelisle at gcc dot gnu dot org
@ 2008-03-16  7:16 ` pault at gcc dot gnu dot org
  2008-03-16 19:15 ` pault at gcc dot gnu dot org
  2008-03-16 19:16 ` pault at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: pault at gcc dot gnu dot org @ 2008-03-16  7:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pault at gcc dot gnu dot org  2008-03-16 07:15 -------
(In reply to comment #6)
> You r 'this' is better than my 'Think' Passed regression testing here on
> x86-64.
> 
Jerry,

I did not see that you were working on it - sorry that I trampled on your toes.
I took a copy of this the moment that it was posted to keep me amused during a
meeting.

Cheers

Paul


-- 


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


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

* [Bug fortran/35470] Valid pointer assigment code gives compilation errors
  2008-03-05 11:09 [Bug fortran/35470] New: Valid pointer assigment code gives compilation errors antony at cosmologist dot info
                   ` (6 preceding siblings ...)
  2008-03-16  7:16 ` pault at gcc dot gnu dot org
@ 2008-03-16 19:15 ` pault at gcc dot gnu dot org
  2008-03-16 19:16 ` pault at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: pault at gcc dot gnu dot org @ 2008-03-16 19:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from pault at gcc dot gnu dot org  2008-03-16 19:15 -------
Subject: Bug 35470

Author: pault
Date: Sun Mar 16 19:14:17 2008
New Revision: 133279

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=133279
Log:
2008-03-16  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/35470
        * resolve.c (check_assumed_size_reference):  Only visit the
        first reference and look directly at the highest dimension.

2008-03-16  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/35470
        * gfortran.dg/subref_array_pointer_3.f90 : New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/subref_array_pointer_3.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/resolve.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/35470] Valid pointer assigment code gives compilation errors
  2008-03-05 11:09 [Bug fortran/35470] New: Valid pointer assigment code gives compilation errors antony at cosmologist dot info
                   ` (7 preceding siblings ...)
  2008-03-16 19:15 ` pault at gcc dot gnu dot org
@ 2008-03-16 19:16 ` pault at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: pault at gcc dot gnu dot org @ 2008-03-16 19:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from pault at gcc dot gnu dot org  2008-03-16 19:15 -------
Fixed on trunk

Thanks for the report

Paul


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2008-03-16 19:16 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-05 11:09 [Bug fortran/35470] New: Valid pointer assigment code gives compilation errors antony at cosmologist dot info
2008-03-05 22:00 ` [Bug fortran/35470] " fxcoudert at gcc dot gnu dot org
2008-03-15 18:08 ` jvdelisle at gcc dot gnu dot org
2008-03-15 18:11 ` jvdelisle at gcc dot gnu dot org
2008-03-15 22:36 ` pault at gcc dot gnu dot org
2008-03-15 22:37 ` pault at gcc dot gnu dot org
2008-03-16  5:01 ` jvdelisle at gcc dot gnu dot org
2008-03-16  7:16 ` pault at gcc dot gnu dot org
2008-03-16 19:15 ` pault at gcc dot gnu dot org
2008-03-16 19:16 ` pault at gcc dot gnu dot 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).