public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libfortran/35001]  New: shape for negative sizes
@ 2008-01-28 19:45 tkoenig at gcc dot gnu dot org
  2008-01-28 20:44 ` [Bug libfortran/35001] " tkoenig at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2008-01-28 19:45 UTC (permalink / raw)
  To: gcc-bugs

>From PR 34980, comment#7 by Tobias Burnus:

a) The following should print "1 0" but it prints "1 -8":

integer :: i,j, a(10,10),res(2)
j = 1
i = 10
res = shape(a(1:1,i:j:1))
print *, res
res = shape(a(1:1,j:i:-1))
print *, res
end

Not a regression.


-- 
           Summary: shape for negative sizes
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: libfortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tkoenig at gcc dot gnu dot org


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


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

* [Bug libfortran/35001] shape for negative sizes
  2008-01-28 19:45 [Bug libfortran/35001] New: shape for negative sizes tkoenig at gcc dot gnu dot org
@ 2008-01-28 20:44 ` tkoenig at gcc dot gnu dot org
  2008-01-31 22:19 ` tkoenig at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2008-01-28 20:44 UTC (permalink / raw)
  To: gcc-bugs



-- 

tkoenig at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |tkoenig at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-01-28 19:08:24
               date|                            |


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


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

* [Bug libfortran/35001] shape for negative sizes
  2008-01-28 19:45 [Bug libfortran/35001] New: shape for negative sizes tkoenig at gcc dot gnu dot org
  2008-01-28 20:44 ` [Bug libfortran/35001] " tkoenig at gcc dot gnu dot org
@ 2008-01-31 22:19 ` tkoenig at gcc dot gnu dot org
  2008-02-01  1:38 ` jvdelisle at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2008-01-31 22:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from tkoenig at gcc dot gnu dot org  2008-01-31 21:10 -------
A patch for when trunk reopens.

Index: m4/shape.m4
===================================================================
--- m4/shape.m4 (revision 131915)
+++ m4/shape.m4 (working copy)
@@ -46,6 +46,7 @@ shape_'rtype_kind` ('rtype` * const rest
 {
   int n;
   index_type stride;
+  index_type extent;

   stride = ret->dim[0].stride;

@@ -54,8 +55,8 @@ shape_'rtype_kind` ('rtype` * const rest

   for (n = 0; n < GFC_DESCRIPTOR_RANK (array); n++)
     {
-      ret->data[n * stride] =
-        array->dim[n].ubound + 1 - array->dim[n].lbound;
+      extent = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      ret->data[n * stride] = extent > 0 ? extent : 0 ;
     }
 }


-- 


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


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

* [Bug libfortran/35001] shape for negative sizes
  2008-01-28 19:45 [Bug libfortran/35001] New: shape for negative sizes tkoenig at gcc dot gnu dot org
  2008-01-28 20:44 ` [Bug libfortran/35001] " tkoenig at gcc dot gnu dot org
  2008-01-31 22:19 ` tkoenig at gcc dot gnu dot org
@ 2008-02-01  1:38 ` jvdelisle at gcc dot gnu dot org
  2008-02-02 13:52 ` tkoenig at gcc dot gnu dot org
  2008-02-02 13:52 ` tkoenig at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2008-02-01  1:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jvdelisle at gcc dot gnu dot org  2008-02-01 01:37 -------
Thomas, this is OK to commit since it is fixing a wrong code bug, assuming you
have regression tested. (Discussed with Richi on IRC.)


-- 


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


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

* [Bug libfortran/35001] shape for negative sizes
  2008-01-28 19:45 [Bug libfortran/35001] New: shape for negative sizes tkoenig at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2008-02-02 13:52 ` tkoenig at gcc dot gnu dot org
@ 2008-02-02 13:52 ` tkoenig at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2008-02-02 13:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from tkoenig at gcc dot gnu dot org  2008-02-02 13:51 -------
Subject: Bug 35001

Author: tkoenig
Date: Sat Feb  2 13:50:55 2008
New Revision: 132070

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=132070
Log:
2008-02-02  Thomas Koenig  <tkoenig@gcc.gnu.org>

        PR libfortran/35001
        * m4/shape.m4:  Return 0 for extents <= 0.
        * generated/shape_i4.c:  Regenerated.
        * generated/shape_i8.c:  Regenerated.
        * generated/shape_i16.c:  Regenerated.

2008-02-02  Thomas Koenig  <tkoenig@gcc.gnu.org>

        PR libfortran/35001
        * gfortran.dg/shape_4.f90:  New test.

Fixed in regression-only mode by special dispense (see the PR).


Added:
    trunk/gcc/testsuite/gfortran.dg/shape_4.f90
Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/libgfortran/ChangeLog
    trunk/libgfortran/generated/shape_i16.c
    trunk/libgfortran/generated/shape_i4.c
    trunk/libgfortran/generated/shape_i8.c
    trunk/libgfortran/m4/shape.m4


-- 


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


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

* [Bug libfortran/35001] shape for negative sizes
  2008-01-28 19:45 [Bug libfortran/35001] New: shape for negative sizes tkoenig at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2008-02-01  1:38 ` jvdelisle at gcc dot gnu dot org
@ 2008-02-02 13:52 ` tkoenig at gcc dot gnu dot org
  2008-02-02 13:52 ` tkoenig at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2008-02-02 13:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from tkoenig at gcc dot gnu dot org  2008-02-02 13:51 -------
(In reply to comment #2)
> Thomas, this is OK to commit since it is fixing a wrong code bug, assuming you
> have regression tested. (Discussed with Richi on IRC.)

Yes, I had done so.

Commited to trunk.  Thanks!

Closing.


-- 

tkoenig at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2008-02-02 13:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-28 19:45 [Bug libfortran/35001] New: shape for negative sizes tkoenig at gcc dot gnu dot org
2008-01-28 20:44 ` [Bug libfortran/35001] " tkoenig at gcc dot gnu dot org
2008-01-31 22:19 ` tkoenig at gcc dot gnu dot org
2008-02-01  1:38 ` jvdelisle at gcc dot gnu dot org
2008-02-02 13:52 ` tkoenig at gcc dot gnu dot org
2008-02-02 13:52 ` tkoenig 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).