public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/26834]  New: gfc_todo: Not Implemented: Unable to determine rank of expression
@ 2006-03-23 21:56 anlauf at gmx dot de
  2006-03-23 22:45 ` [Bug fortran/26834] " pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: anlauf at gmx dot de @ 2006-03-23 21:56 UTC (permalink / raw)
  To: gcc-bugs

Howdy,

the subject says it all:

% cat gfcbug34.f90
subroutine gfcbug34 ()
  implicit none

  type t
     integer, pointer :: i (:) => NULL ()
  end type t
  type(t), save :: gf

  write(*,*) 'ubound:', ubound (gf% i)
  write(*,*) 'lbound:', lbound (gf% i)
end subroutine gfcbug34
% gfc -c gfcbug34.f90
gfcbug34.f90: In function 'gfcbug34':
gfcbug34.f90:9: fatal error: gfc_todo: Not Implemented: Unable to determine
rank of expression
compilation terminated.

Cheers,
-ha


-- 
           Summary: gfc_todo: Not Implemented: Unable to determine rank of
                    expression
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: anlauf at gmx dot de
  GCC host triplet: i686-pc-linux-gnu


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


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

* [Bug fortran/26834] gfc_todo: Not Implemented: Unable to determine rank of expression
  2006-03-23 21:56 [Bug fortran/26834] New: gfc_todo: Not Implemented: Unable to determine rank of expression anlauf at gmx dot de
@ 2006-03-23 22:45 ` pinskia at gcc dot gnu dot org
  2006-04-12 14:32 ` paul dot richard dot thomas at cea dot fr
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-23 22:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-03-23 22:45 -------
Confirmed, PR 25669 and bug 18003 are very closely related (it might turn out
this is a dup of one of them).


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|                            |18003, 25669
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-03-23 22:45:05
               date|                            |


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


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

* [Bug fortran/26834] gfc_todo: Not Implemented: Unable to determine rank of expression
  2006-03-23 21:56 [Bug fortran/26834] New: gfc_todo: Not Implemented: Unable to determine rank of expression anlauf at gmx dot de
  2006-03-23 22:45 ` [Bug fortran/26834] " pinskia at gcc dot gnu dot org
@ 2006-04-12 14:32 ` paul dot richard dot thomas at cea dot fr
  2006-04-12 19:55 ` patchapp at dberlin dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: paul dot richard dot thomas at cea dot fr @ 2006-04-12 14:32 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 3694 bytes --]



------- Comment #2 from paul dot richard dot thomas at cea dot fr  2006-04-12 14:32 -------
(In reply to comment #1)
> Confirmed, PR 25669 and bug 18003 are very closely related (it might turn out
> this is a dup of one of them).

They are indeed the same.  Attached below is a patch that fixes all three and a
testcase that demonstrates that this is so.  The patch is still testing but I
am pretty sure it is OK (ie. this is a path that ICEd previously).  I will
submit tonight, if all is well.

Paul

Index: gcc/fortran/trans-array.c
===================================================================
--- gcc/fortran/trans-array.c   (révision 112853)
+++ gcc/fortran/trans-array.c   (copie de travail)
@@ -2393,6 +2393,19 @@
          loop->dimen = ss->data.info.dimen;
          break;

+       /* Cope with the likes of PRINT *, lbound (a), where nothing
+          better is available.  */
+       case GFC_SS_INTRINSIC:
+         switch (ss->expr->value.function.isym->generic_id)
+           {
+           case GFC_ISYM_LBOUND:
+           case GFC_ISYM_UBOUND:
+             loop->dimen = ss->data.info.dimen;
+
+           default:
+             break;
+           }
+
        default:
          break;
        }
@@ -2418,6 +2431,15 @@
            gfc_conv_section_startstride (loop, ss, n);
          break;

+       case GFC_SS_INTRINSIC:
+         switch (ss->expr->value.function.isym->generic_id)
+           {
+           case GFC_ISYM_LBOUND:
+           case GFC_ISYM_UBOUND:
+             break;
+           default:
+             continue;
+           }
        case GFC_SS_CONSTRUCTOR:
        case GFC_SS_FUNCTION:
          for (n = 0; n < ss->data.info.dimen; n++)
Index: gcc/fortran/trans-intrinsic.c
===================================================================
--- gcc/fortran/trans-intrinsic.c       (révision 112853)
+++ gcc/fortran/trans-intrinsic.c       (copie de travail)
@@ -3710,6 +3710,7 @@
   newss->type = GFC_SS_INTRINSIC;
   newss->expr = expr;
   newss->next = ss;
+  newss->data.info.dimen = 1;

   return newss;
 }

! { dg-do compile }
! This tests the fix for PRs 26834, 25669 and 18803, in which
! shape information for the lbound and ubound intrinsics was not
! transferred to the scalarizer.  For this reason, an ICE would
! ensue, whenever these functions were used in temporaries.
!
! The tests are lifted from the PRs and some further checks are
! done to make sure that nothing is broken.
!
! This is PR26834
subroutine gfcbug34 ()
  implicit none
  type t
     integer, pointer :: i (:) => NULL ()
  end type t
  type(t), save :: gf
  allocate (gf%i(20))
  write(*,*) 'ubound:', ubound (gf% i)
  write(*,*) 'lbound:', lbound (gf% i)
end subroutine gfcbug34

! This is PR25669
subroutine foo (a)
  real a(*)
  call bar (a, LBOUND(a),2)
end subroutine foo
subroutine bar (b, i, j)
  real b(i:j)
  print *, i, j
  print *, b(i:j)
end subroutine bar

! This is PR18003
subroutine io_bug()
  integer :: a(10)
  print *, ubound(a)
end subroutine io_bug

! This checks that lbound and ubound are OK in  temporary
! expressions.
subroutine io_bug_plus()
  integer :: a(10, 10), b(2)
  print *, ubound(a)*(/1,2/)
  print *, (/1,2/)*ubound(a)
end subroutine io_bug_plus

  character(4) :: ch(2), ech(2) = (/'ABCD', 'EFGH'/)
  real(4) :: a(2)
  equivalence (ech,a)
  integer(1) :: i(8) = (/(j, j = 1,8)/)

! Check that the bugs have gone
  call io_bug ()
  call io_bug_plus ()
  call foo ((/1.0,2.0,3.0/))
  call gfcbug34 ()

! Check that we have not broken other intrinsics.
  print *, cos ((/1.0,2.0/))
  print *, transfer (a, ch)
  print *, i(1:4) * transfer (a, i, 4) * 2
end


-- 


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


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

* [Bug fortran/26834] gfc_todo: Not Implemented: Unable to determine rank of expression
  2006-03-23 21:56 [Bug fortran/26834] New: gfc_todo: Not Implemented: Unable to determine rank of expression anlauf at gmx dot de
  2006-03-23 22:45 ` [Bug fortran/26834] " pinskia at gcc dot gnu dot org
  2006-04-12 14:32 ` paul dot richard dot thomas at cea dot fr
@ 2006-04-12 19:55 ` patchapp at dberlin dot org
  2006-04-15 11:23 ` pault at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: patchapp at dberlin dot org @ 2006-04-12 19:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from patchapp at dberlin dot org  2006-04-12 19:55 -------
Subject: Bug number PR26834

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2006-04/msg00469.html


-- 


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


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

* [Bug fortran/26834] gfc_todo: Not Implemented: Unable to determine rank of expression
  2006-03-23 21:56 [Bug fortran/26834] New: gfc_todo: Not Implemented: Unable to determine rank of expression anlauf at gmx dot de
                   ` (2 preceding siblings ...)
  2006-04-12 19:55 ` patchapp at dberlin dot org
@ 2006-04-15 11:23 ` pault at gcc dot gnu dot org
  2006-04-16  3:45 ` pault at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-04-15 11:23 UTC (permalink / raw)
  To: gcc-bugs



-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pault at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED


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


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

* [Bug fortran/26834] gfc_todo: Not Implemented: Unable to determine rank of expression
  2006-03-23 21:56 [Bug fortran/26834] New: gfc_todo: Not Implemented: Unable to determine rank of expression anlauf at gmx dot de
                   ` (3 preceding siblings ...)
  2006-04-15 11:23 ` pault at gcc dot gnu dot org
@ 2006-04-16  3:45 ` pault at gcc dot gnu dot org
  2006-04-23  5:33 ` pault at gcc dot gnu dot org
  2006-04-23  5:43 ` pault at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-04-16  3:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pault at gcc dot gnu dot org  2006-04-16 03:45 -------
Subject: Bug 26834

Author: pault
Date: Sun Apr 16 03:45:24 2006
New Revision: 112981

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

        PR fortran/26822
        * intrinsic.c (add_functions): Mark LOGICAL as elemental.

        PR fortran/26787
        * expr.c (gfc_check_assign): Extend scope of error to include
        assignments to a procedure in the main program or, from a
        module or internal procedure that is not that represented by
        the lhs symbol. Use VARIABLE rather than l-value in message.

        PR fortran/27096
        * trans-array.c (gfc_trans_deferred_array): If the backend_decl
        is not a descriptor, dereference and then test and use the type.

        PR fortran/25597
        * trans-decl.c (gfc_trans_deferred_vars): Check if an array
        result, is also automatic character length.  If so, process
        the character length.

        PR fortran/18803
        PR fortran/25669
        PR fortran/26834
        * trans_intrinsic.c (gfc_walk_intrinsic_bound): Set
        data.info.dimen for bound intrinsics.
        * trans_array.c (gfc_conv_ss_startstride): Pick out LBOUND and
        UBOUND intrinsics and supply their shape information to the ss
        and the loop.

        PR fortran/27124
        * trans_expr.c (gfc_trans_function_call):  Add a new block, post,
        in to which all the argument post blocks are put.  Add this block
        to se->pre after a byref call or to se->post, otherwise.

2006-04-16  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/26787
        * gfortran.dg/proc_assign_1.f90: New test.
        * gfortran.dg/procedure_lvalue.f90: Change message.
        * gfortran.dg/namelist_4.f90: Add new error.

        PR fortran/27096
        * gfortran.dg/auto_pointer_array_result_1.f90

        PR fortran/27089
        * gfortran.dg/specification_type_resolution_1.f90

        PR fortran/18803
        PR fortran/25669
        PR fortran/26834
        * gfortran.dg/bounds_temporaries_1.f90: New test.

        PR fortran/27124
        * gfortran.dg/array_return_value_1.f90: New test.



Added:
    trunk/gcc/testsuite/gfortran.dg/array_return_value_1.f90
    trunk/gcc/testsuite/gfortran.dg/auto_char_pointer_array_result_1.f90
    trunk/gcc/testsuite/gfortran.dg/auto_pointer_array_result_1.f90
    trunk/gcc/testsuite/gfortran.dg/bounds_temporaries_1.f90
    trunk/gcc/testsuite/gfortran.dg/proc_assign_1.f90
    trunk/gcc/testsuite/gfortran.dg/specification_type_resolution_1.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/expr.c
    trunk/gcc/fortran/intrinsic.c
    trunk/gcc/fortran/resolve.c
    trunk/gcc/fortran/trans-array.c
    trunk/gcc/fortran/trans-decl.c
    trunk/gcc/fortran/trans-expr.c
    trunk/gcc/fortran/trans-intrinsic.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/namelist_4.f90
    trunk/gcc/testsuite/gfortran.dg/procedure_lvalue.f90


-- 


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


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

* [Bug fortran/26834] gfc_todo: Not Implemented: Unable to determine rank of expression
  2006-03-23 21:56 [Bug fortran/26834] New: gfc_todo: Not Implemented: Unable to determine rank of expression anlauf at gmx dot de
                   ` (4 preceding siblings ...)
  2006-04-16  3:45 ` pault at gcc dot gnu dot org
@ 2006-04-23  5:33 ` pault at gcc dot gnu dot org
  2006-04-23  5:43 ` pault at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-04-23  5:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pault at gcc dot gnu dot org  2006-04-23 05:33 -------
Subject: Bug 26834

Author: pault
Date: Sun Apr 23 05:33:16 2006
New Revision: 113191

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113191
Log:
2006-04-23  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/27122
        * resolve.c (resolve_function): Remove general restriction on auto
        character length function interfaces.
        (gfc_resolve_uops): Check restrictions on defined operator
        procedures.
        (resolve_types): Call the check for defined operators.

        PR fortran/27113
        * trans-array.c (get_array_ctor_var_strlen): Remove typo in enum.
        Part of the fix in 4.2, which does not work in 4.1 because the
        divergence is now too great.

        PR fortran/26822
        * intrinsic.c (add_functions): Mark LOGICAL as elemental.

        PR fortran/26787
        * expr.c (gfc_check_assign): Extend scope of error to include
        assignments to a procedure in the main program or, from a
        module or internal procedure that is not that represented by
        the lhs symbol. Use VARIABLE rather than l-value in message.

        PR fortran/25597
        * trans-decl.c (gfc_trans_deferred_vars): Check if an array
        result, is also automatic character length.  If so, process
        the character length. Note that this fixes the bug in 4.2
        but not here in 4.1 because the trees have diverged too much.
        Manifestly correct, so applied anyway.

        PR fortran/18803
        PR fortran/25669
        PR fortran/26834
        * trans_intrinsic.c (gfc_walk_intrinsic_bound): Set
        data.info.dimen for bound intrinsics.
        * trans_array.c (gfc_conv_ss_startstride): Pick out LBOUND and
        UBOUND intrinsics and supply their shape information to the ss
        and the loop.

        PR fortran/27124
        * trans_expr.c (gfc_trans_function_call):  Add a new block, post,
        in to which all the argument post blocks are put.  Add this block
        to se->pre after a byref call or to se->post, otherwise.

2006-04-23  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/27122
        * gfortran.dg/defined_operators_1.f90: New test.
        * gfortran.dg/assumed_charlen_function_1.f90: Add new error and
        remove old ones associated, incorrectly, with Note 5.46.

        PR fortran/26787
        * gfortran.dg/proc_assign_1.f90: New test.
        * gfortran.dg/procedure_lvalue.f90: Change message.
        * gfortran.dg/namelist_4.f90: Add new error.

        PR fortran/27089
        * gfortran.dg/specification_type_resolution_1.f90

        PR fortran/18803
        PR fortran/25669
        PR fortran/26834
        * gfortran.dg/bounds_temporaries_1.f90: New test.

        PR fortran/27124
        * gfortran.dg/array_return_value_1.f90: New test.



Added:
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/array_return_value_1.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/bounds_temporaries_1.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/defined_operators_1.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/proc_assign_1.f90
   
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/specification_type_resolution_1.f90
Modified:
    branches/gcc-4_1-branch/gcc/fortran/ChangeLog
    branches/gcc-4_1-branch/gcc/fortran/expr.c
    branches/gcc-4_1-branch/gcc/fortran/intrinsic.c
    branches/gcc-4_1-branch/gcc/fortran/resolve.c
    branches/gcc-4_1-branch/gcc/fortran/trans-array.c
    branches/gcc-4_1-branch/gcc/fortran/trans-decl.c
    branches/gcc-4_1-branch/gcc/fortran/trans-expr.c
    branches/gcc-4_1-branch/gcc/fortran/trans-intrinsic.c
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
   
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/assumed_charlen_function_1.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/namelist_4.f90
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/procedure_lvalue.f90


-- 


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


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

* [Bug fortran/26834] gfc_todo: Not Implemented: Unable to determine rank of expression
  2006-03-23 21:56 [Bug fortran/26834] New: gfc_todo: Not Implemented: Unable to determine rank of expression anlauf at gmx dot de
                   ` (5 preceding siblings ...)
  2006-04-23  5:33 ` pault at gcc dot gnu dot org
@ 2006-04-23  5:43 ` pault at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-04-23  5:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pault at gcc dot gnu dot org  2006-04-23 05:43 -------
Fixed on trunk and 4.1

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=26834


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

end of thread, other threads:[~2006-04-23  5:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-23 21:56 [Bug fortran/26834] New: gfc_todo: Not Implemented: Unable to determine rank of expression anlauf at gmx dot de
2006-03-23 22:45 ` [Bug fortran/26834] " pinskia at gcc dot gnu dot org
2006-04-12 14:32 ` paul dot richard dot thomas at cea dot fr
2006-04-12 19:55 ` patchapp at dberlin dot org
2006-04-15 11:23 ` pault at gcc dot gnu dot org
2006-04-16  3:45 ` pault at gcc dot gnu dot org
2006-04-23  5:33 ` pault at gcc dot gnu dot org
2006-04-23  5:43 ` 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).