public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/38859]  New: ubound and lbound treat structure component references as whole arrays
@ 2009-01-15 19:47 dick dot hendrickson at gmail dot com
  2009-01-15 20:04 ` [Bug fortran/38859] [4.3/4.4 Regression] " burnus at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: dick dot hendrickson at gmail dot com @ 2009-01-15 19:47 UTC (permalink / raw)
  To: gcc-bugs

The UBOUND and LBOUND intrinsics treat a reference to an array structure
component as if they were inquires on a whole array.  

Dick Hendrickson


       program try_jg_15_18

! fails on Windows XP
! gcc version 4.4.0 20081219 (experimental) [trunk revision 142842] (GCC)

       type x
         integer I
       end type x
       type (x) A(0:5, 2:8)
       integer ida(2)

       ida = lbound(a)
       if (any(ida /= (/0,2/))) print *, 'base array', ida

!note that a%i is neither a whole array nor an array structure component

       ida = lbound(a%i)
       if (any(ida /= (/1,1/))) print *, 'lbound    ', ida

       ida = ubound(a)
       if (any(ida /= (/6,7/))) print *, 'ubound    ', ida

       end


C:\gfortran>gfortran try_jg_15_18.f

C:\gfortran>a
 lbound               0           2
 ubound               5           8


-- 
           Summary: ubound and lbound treat structure component references
                    as whole arrays
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dick dot hendrickson at gmail dot com


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


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

* [Bug fortran/38859] [4.3/4.4 Regression] ubound and lbound treat structure component references as whole arrays
  2009-01-15 19:47 [Bug fortran/38859] New: ubound and lbound treat structure component references as whole arrays dick dot hendrickson at gmail dot com
@ 2009-01-15 20:04 ` burnus at gcc dot gnu dot org
  2009-01-15 20:11 ` burnus at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-01-15 20:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2009-01-15 20:04 -------
Confirm. This is a regression with regards to 4.2.1; it fails at least since
20071008 (my oldest 4.3 trunk version).

Thanks for the report!


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
OtherBugsDependingO|                            |32834
              nThis|                            |
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |wrong-code
      Known to fail|                            |4.3.0 4.3.2 4.4.0
      Known to work|                            |4.2.1 4.1.3
           Priority|P3                          |P4
   Last reconfirmed|0000-00-00 00:00:00         |2009-01-15 20:04:20
               date|                            |
            Summary|ubound and lbound treat     |[4.3/4.4 Regression] ubound
                   |structure component         |and lbound treat structure
                   |references as whole arrays  |component references as
                   |                            |whole arrays
   Target Milestone|---                         |4.3.4


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


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

* [Bug fortran/38859] [4.3/4.4 Regression] ubound and lbound treat structure component references as whole arrays
  2009-01-15 19:47 [Bug fortran/38859] New: ubound and lbound treat structure component references as whole arrays dick dot hendrickson at gmail dot com
  2009-01-15 20:04 ` [Bug fortran/38859] [4.3/4.4 Regression] " burnus at gcc dot gnu dot org
@ 2009-01-15 20:11 ` burnus at gcc dot gnu dot org
  2009-01-15 21:30 ` mikael at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-01-15 20:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from burnus at gcc dot gnu dot org  2009-01-15 20:10 -------
       ida = lbound(a%i)
       if (any(ida /= (/1,1/))) print *, 'lbound    ', ida

Here, gfortran prints:
   lbound  0  2
Correct would be
   lbound  1  1


       ida = ubound(a)
>>>>>>>>>>>>>>>>>>>^^^
Here a "%i" is missing otherwise the following line does not make sense:

       if (any(ida /= (/6,7/))) print *, 'ubound    ', ida

For ubound(a) the result should be "5 8" which is also gfortran's result.
For ubound(a%i):
  gfortran: 5 8
  correct:  6 7


-- 


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


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

* [Bug fortran/38859] [4.3/4.4 Regression] ubound and lbound treat structure component references as whole arrays
  2009-01-15 19:47 [Bug fortran/38859] New: ubound and lbound treat structure component references as whole arrays dick dot hendrickson at gmail dot com
  2009-01-15 20:04 ` [Bug fortran/38859] [4.3/4.4 Regression] " burnus at gcc dot gnu dot org
  2009-01-15 20:11 ` burnus at gcc dot gnu dot org
@ 2009-01-15 21:30 ` mikael at gcc dot gnu dot org
  2009-01-17 15:00 ` mikael at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: mikael at gcc dot gnu dot org @ 2009-01-15 21:30 UTC (permalink / raw)
  To: gcc-bugs

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



------- Comment #3 from mikael at gcc dot gnu dot org  2009-01-15 21:30 -------
quick fix:

Index: simplify.c
===================================================================
--- simplify.c  (révision 143354)
+++ simplify.c  (copie de travail)
@@ -2253,7 +2253,8 @@ simplify_bound (gfc_expr *array, gfc_expr *dim, gf
            case AR_FULL:
              /* We're done because 'as' has already been set in the
                 previous iteration.  */
-             goto done;
+             if (!ref->next)
+               goto done;

            case AR_SECTION:
            case AR_UNKNOWN:


-- 


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


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

* [Bug fortran/38859] [4.3/4.4 Regression] ubound and lbound treat structure component references as whole arrays
  2009-01-15 19:47 [Bug fortran/38859] New: ubound and lbound treat structure component references as whole arrays dick dot hendrickson at gmail dot com
                   ` (2 preceding siblings ...)
  2009-01-15 21:30 ` mikael at gcc dot gnu dot org
@ 2009-01-17 15:00 ` mikael at gcc dot gnu dot org
  2009-01-17 15:45 ` burnus at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: mikael at gcc dot gnu dot org @ 2009-01-17 15:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from mikael at gcc dot gnu dot org  2009-01-17 14:59 -------
shouldn't this be fixed for 4.3.3?


-- 


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


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

* [Bug fortran/38859] [4.3/4.4 Regression] ubound and lbound treat structure component references as whole arrays
  2009-01-15 19:47 [Bug fortran/38859] New: ubound and lbound treat structure component references as whole arrays dick dot hendrickson at gmail dot com
                   ` (3 preceding siblings ...)
  2009-01-17 15:00 ` mikael at gcc dot gnu dot org
@ 2009-01-17 15:45 ` burnus at gcc dot gnu dot org
  2009-01-19 22:20 ` mikael at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-01-17 15:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from burnus at gcc dot gnu dot org  2009-01-17 15:45 -------
> shouldn't this be fixed for 4.3.3?
Too late - the release is too soon (freeze; release-candidate build is
running). Regarding 4.4.0: Do you plan to submit a patch soonish?


-- 


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


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

* [Bug fortran/38859] [4.3/4.4 Regression] ubound and lbound treat structure component references as whole arrays
  2009-01-15 19:47 [Bug fortran/38859] New: ubound and lbound treat structure component references as whole arrays dick dot hendrickson at gmail dot com
                   ` (4 preceding siblings ...)
  2009-01-17 15:45 ` burnus at gcc dot gnu dot org
@ 2009-01-19 22:20 ` mikael at gcc dot gnu dot org
  2009-01-20  5:55 ` [Bug fortran/38859] [4.3 " pault at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: mikael at gcc dot gnu dot org @ 2009-01-19 22:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from mikael at gcc dot gnu dot org  2009-01-19 22:19 -------
Subject: Bug 38859

Author: mikael
Date: Mon Jan 19 22:19:34 2009
New Revision: 143501

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=143501
Log:
2009-01-19  Mikael Morin  <mikael.morin@tele2.fr>

        PR fortran/38859
        * simplify.c (simplify_bound): Don't use array specification
        if variable or component has subsequent references.

2009-01-19  Mikael Morin  <mikael.morin@tele2.fr>

        PR fortran/38859
        * gfortran.dg/bound_5.f90: New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/bound_5.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/simplify.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/38859] [4.3 Regression] ubound and lbound treat structure component references as whole arrays
  2009-01-15 19:47 [Bug fortran/38859] New: ubound and lbound treat structure component references as whole arrays dick dot hendrickson at gmail dot com
                   ` (5 preceding siblings ...)
  2009-01-19 22:20 ` mikael at gcc dot gnu dot org
@ 2009-01-20  5:55 ` pault at gcc dot gnu dot org
  2009-01-26  5:44 ` pault at gcc dot gnu dot org
  2009-01-26  5:45 ` pault at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: pault at gcc dot gnu dot org @ 2009-01-20  5:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pault at gcc dot gnu dot org  2009-01-20 05:54 -------
Ticked off 4.4...:-)

Cheers

Paul


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.3/4.4 Regression] ubound |[4.3 Regression] ubound and
                   |and lbound treat structure  |lbound treat structure
                   |component references as     |component references as
                   |whole arrays                |whole arrays


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


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

* [Bug fortran/38859] [4.3 Regression] ubound and lbound treat structure component references as whole arrays
  2009-01-15 19:47 [Bug fortran/38859] New: ubound and lbound treat structure component references as whole arrays dick dot hendrickson at gmail dot com
                   ` (6 preceding siblings ...)
  2009-01-20  5:55 ` [Bug fortran/38859] [4.3 " pault at gcc dot gnu dot org
@ 2009-01-26  5:44 ` pault at gcc dot gnu dot org
  2009-01-26  5:45 ` pault at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: pault at gcc dot gnu dot org @ 2009-01-26  5:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from pault at gcc dot gnu dot org  2009-01-26 05:43 -------
Subject: Bug 38859

Author: pault
Date: Mon Jan 26 05:43:44 2009
New Revision: 143670

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=143670
Log:
2009-01-26  Mikael Morin  <mikael.morin@tele2.fr>

        PR fortran/38859
        Backport from trunk
        * simplify.c (simplify_bound): Don't use array specification
        if variable or component has subsequent references.

2009-01-26  Mikael Morin  <mikael.morin@tele2.fr>

        PR fortran/38859
        Backport from trunk
        * gfortran.dg/bound_5.f90: New test.


Added:
    branches/gcc-4_3-branch/gcc/testsuite/gfortran.dg/bounds_5.f90
Modified:
    branches/gcc-4_3-branch/gcc/fortran/ChangeLog
    branches/gcc-4_3-branch/gcc/fortran/simplify.c
    branches/gcc-4_3-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/38859] [4.3 Regression] ubound and lbound treat structure component references as whole arrays
  2009-01-15 19:47 [Bug fortran/38859] New: ubound and lbound treat structure component references as whole arrays dick dot hendrickson at gmail dot com
                   ` (7 preceding siblings ...)
  2009-01-26  5:44 ` pault at gcc dot gnu dot org
@ 2009-01-26  5:45 ` pault at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: pault at gcc dot gnu dot org @ 2009-01-26  5:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from pault at gcc dot gnu dot org  2009-01-26 05:44 -------
Closed on trunk and 4.3.

Once again, thanks for the report.

Paul


-- 

pault at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2009-01-26  5:45 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-15 19:47 [Bug fortran/38859] New: ubound and lbound treat structure component references as whole arrays dick dot hendrickson at gmail dot com
2009-01-15 20:04 ` [Bug fortran/38859] [4.3/4.4 Regression] " burnus at gcc dot gnu dot org
2009-01-15 20:11 ` burnus at gcc dot gnu dot org
2009-01-15 21:30 ` mikael at gcc dot gnu dot org
2009-01-17 15:00 ` mikael at gcc dot gnu dot org
2009-01-17 15:45 ` burnus at gcc dot gnu dot org
2009-01-19 22:20 ` mikael at gcc dot gnu dot org
2009-01-20  5:55 ` [Bug fortran/38859] [4.3 " pault at gcc dot gnu dot org
2009-01-26  5:44 ` pault at gcc dot gnu dot org
2009-01-26  5:45 ` 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).