public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/26017]  New: allocate (a(1:-1)) should yield zero-sized array
@ 2006-01-29 14:00 tkoenig at gcc dot gnu dot org
  2006-01-29 15:13 ` [Bug fortran/26017] " pinskia at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2006-01-29 14:00 UTC (permalink / raw)
  To: gcc-bugs

$ cat a3.f90
program main
  integer, allocatable :: a(:)
  allocate (a(1:-1))
end program main
$ gfortran a3.f90
$ ./a.out
Fortran runtime error: Attempt to allocate negative amount of memory.  Possible
integer overflow
$ gfortran -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../../gcc/trunk/configure --prefix=/home/ig25
--enable-languages=c,fortran
Thread model: posix
gcc version 4.2.0 20060119 (experimental)

According to 6.3.1, this program should yield a zero-sized array.

Related to PR 25031 and PR 15335.


-- 
           Summary: allocate (a(1:-1)) should yield zero-sized array
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        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=26017


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

* [Bug fortran/26017] allocate (a(1:-1)) should yield zero-sized array
  2006-01-29 14:00 [Bug fortran/26017] New: allocate (a(1:-1)) should yield zero-sized array tkoenig at gcc dot gnu dot org
@ 2006-01-29 15:13 ` pinskia at gcc dot gnu dot org
  2006-04-08 21:47 ` tkoenig at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-01-29 15:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-01-29 15:13 -------
Confirmed.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|                            |15335, 25031
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-01-29 15:13:19
               date|                            |


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


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

* [Bug fortran/26017] allocate (a(1:-1)) should yield zero-sized array
  2006-01-29 14:00 [Bug fortran/26017] New: allocate (a(1:-1)) should yield zero-sized array tkoenig at gcc dot gnu dot org
  2006-01-29 15:13 ` [Bug fortran/26017] " pinskia at gcc dot gnu dot org
@ 2006-04-08 21:47 ` tkoenig at gcc dot gnu dot org
  2006-04-09 19:37 ` tkoenig at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2006-04-08 21:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from tkoenig at gcc dot gnu dot org  2006-04-08 21:47 -------
Checking wether size is negative won't work as
a complete fix for this.

Consider the following example:

$ cat a4.f90
program main
  real, allocatable:: a(:,:)
  allocate (a(1:-1,1:-1))
  print *,size(a)
end program main

This (correctly) prints 0, but the allocated size is still nonzero
(which we probably don't want).


-- 


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


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

* [Bug fortran/26017] allocate (a(1:-1)) should yield zero-sized array
  2006-01-29 14:00 [Bug fortran/26017] New: allocate (a(1:-1)) should yield zero-sized array tkoenig at gcc dot gnu dot org
  2006-01-29 15:13 ` [Bug fortran/26017] " pinskia at gcc dot gnu dot org
  2006-04-08 21:47 ` tkoenig at gcc dot gnu dot org
@ 2006-04-09 19:37 ` tkoenig at gcc dot gnu dot org
  2006-04-09 21:03 ` tkoenig at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2006-04-09 19:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from tkoenig at gcc dot gnu dot org  2006-04-09 19:37 -------
Created an attachment (id=11228)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11228&action=view)
patch

This patch should do the trick.


-- 

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|NEW                         |ASSIGNED


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


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

* [Bug fortran/26017] allocate (a(1:-1)) should yield zero-sized array
  2006-01-29 14:00 [Bug fortran/26017] New: allocate (a(1:-1)) should yield zero-sized array tkoenig at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2006-04-09 19:37 ` tkoenig at gcc dot gnu dot org
@ 2006-04-09 21:03 ` tkoenig at gcc dot gnu dot org
  2006-04-14 17:40 ` patchapp at dberlin dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2006-04-09 21:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from tkoenig at gcc dot gnu dot org  2006-04-09 21:03 -------
Created an attachment (id=11230)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11230&action=view)
This one actually works :-)


-- 

tkoenig at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #11228|0                           |1
        is obsolete|                            |


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


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

* [Bug fortran/26017] allocate (a(1:-1)) should yield zero-sized array
  2006-01-29 14:00 [Bug fortran/26017] New: allocate (a(1:-1)) should yield zero-sized array tkoenig at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2006-04-09 21:03 ` tkoenig at gcc dot gnu dot org
@ 2006-04-14 17:40 ` patchapp at dberlin dot org
  2006-04-16 20:29 ` tkoenig at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: patchapp at dberlin dot org @ 2006-04-14 17:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from patchapp at dberlin dot org  2006-04-14 17:40 -------
Subject: Bug number PR 26017

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/msg00537.html


-- 


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


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

* [Bug fortran/26017] allocate (a(1:-1)) should yield zero-sized array
  2006-01-29 14:00 [Bug fortran/26017] New: allocate (a(1:-1)) should yield zero-sized array tkoenig at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2006-04-14 17:40 ` patchapp at dberlin dot org
@ 2006-04-16 20:29 ` tkoenig at gcc dot gnu dot org
  2006-04-29 21:02 ` tkoenig at gcc dot gnu dot org
  2006-04-29 21:05 ` tkoenig at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2006-04-16 20:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from tkoenig at gcc dot gnu dot org  2006-04-16 20:29 -------
Subject: Bug 26017

Author: tkoenig
Date: Sun Apr 16 20:29:24 2006
New Revision: 112988

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=112988
Log:
2006-04-16  Thomas Koenig  <Thomas.Koenig@online.de>

        PR fortran/26017
        * trans-array.c(gfc_array_init_size):  Introduce or_expr
        which is true if the size along any dimension
        is negative.  Create a temporary variable with base
        name size.  If or_expr is true, set the temporary to 0,
        to the normal size otherwise.

2006-04-16  Thomas Koenig  <Thomas.Koenig@online.de>

        * gfortran.dg/allocate_zerosize_1.f90:  New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/allocate_zerosize_1.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-array.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/26017] allocate (a(1:-1)) should yield zero-sized array
  2006-01-29 14:00 [Bug fortran/26017] New: allocate (a(1:-1)) should yield zero-sized array tkoenig at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2006-04-16 20:29 ` tkoenig at gcc dot gnu dot org
@ 2006-04-29 21:02 ` tkoenig at gcc dot gnu dot org
  2006-04-29 21:05 ` tkoenig at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2006-04-29 21:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from tkoenig at gcc dot gnu dot org  2006-04-29 21:02 -------
Subject: Bug 26017

Author: tkoenig
Date: Sat Apr 29 21:02:04 2006
New Revision: 113381

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113381
Log:
2006-04-29  Thomas Koenig  <Thomas.Koenig@online.de>

        PR fortran/26017
        Backport from trunk
        * trans-array.c(gfc_array_init_size):  Introduce or_expr
        which is true if the size along any dimension
        is negative.  Create a temporary variable with base
        name size.  If or_expr is true, set the temporary to 0,
        to the normal size otherwise.

2006-04-29  Thomas Koenig  <Thomas.Koenig@online.de>

        PR fortran/26017
        * gfortran.dg/allocate_zerosize.f90:  New test.


Added:
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/allocate_zerosize_1.f90
Modified:
    branches/gcc-4_1-branch/gcc/fortran/ChangeLog
    branches/gcc-4_1-branch/gcc/fortran/trans-array.c
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/26017] allocate (a(1:-1)) should yield zero-sized array
  2006-01-29 14:00 [Bug fortran/26017] New: allocate (a(1:-1)) should yield zero-sized array tkoenig at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2006-04-29 21:02 ` tkoenig at gcc dot gnu dot org
@ 2006-04-29 21:05 ` tkoenig at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2006-04-29 21:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from tkoenig at gcc dot gnu dot org  2006-04-29 21:05 -------
Fixed on 4.1 and trunk.

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


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

end of thread, other threads:[~2006-04-29 21:05 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-29 14:00 [Bug fortran/26017] New: allocate (a(1:-1)) should yield zero-sized array tkoenig at gcc dot gnu dot org
2006-01-29 15:13 ` [Bug fortran/26017] " pinskia at gcc dot gnu dot org
2006-04-08 21:47 ` tkoenig at gcc dot gnu dot org
2006-04-09 19:37 ` tkoenig at gcc dot gnu dot org
2006-04-09 21:03 ` tkoenig at gcc dot gnu dot org
2006-04-14 17:40 ` patchapp at dberlin dot org
2006-04-16 20:29 ` tkoenig at gcc dot gnu dot org
2006-04-29 21:02 ` tkoenig at gcc dot gnu dot org
2006-04-29 21:05 ` 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).