public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libfortran/20074] New: reshape of pointer array segfaults at runtime
@ 2005-02-19 18:27 Thomas dot Koenig at online dot de
  2005-02-22  0:30 ` [Bug libfortran/20074] " pinskia at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Thomas dot Koenig at online dot de @ 2005-02-19 18:27 UTC (permalink / raw)
  To: gcc-bugs

>From a posting to comp.lang.fortran.

$ cat tryresh.f90
! From: "Alfredo Buttari" <pitagoras@tin.it>
! Newsgroups: comp.lang.fortran
! Subject: reshape problem
! Date: 18 Feb 2005 09:54:35 -0800

program tryreshape

  integer,allocatable :: vect1(:),resh1(:,:)
  integer,pointer :: vect(:),resh(:,:)
  integer :: vect2(2*4), resh2(2,4)
  integer :: r, s(2)

  r=2;  nb=4

  s(:)=(/r,nb/)

  allocate(vect(nb*r),vect1(nb*r))
  allocate(resh(r,nb),resh1(r,nb))

  vect =1
  vect1=1
  vect2=1

  write(*,'("Reshaping to  ",1(i1.1,"x"),i2.2)')s

! THIS WORKS
  resh2 = reshape(vect2,s)
  write(*,'("resh2: ",1(i3,2x))')resh2(1,1)

! THIS WORKS
  resh1 = reshape(vect1,s)
  write(*,'("resh1: ",1(i3,2x))')resh1(1,1)

! THIS DOESN'T
  resh = reshape(vect,s)
  write(*,'("resh : ",1(i3,2x))')resh(1,1)

end program tryreshape
$ gfortran -g tryresh.f90
$ ./a.out
Reshaping to  2x04
resh2:   1
resh1:   1
Segmentation fault
$ gdb ./a.out
GNU gdb 6.3-debian
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-linux"...Using host libthread_db library
"/lib/tls/libthread_db.so.1".

(gdb) r
Starting program: /home/ig25/Krempel/a.out
Reshaping to  2x04
resh2:   1
resh1:   1

Program received signal SIGSEGV, Segmentation fault.
0x40127cef in memcpy () from /lib/tls/libc.so.6
(gdb) bt
#0  0x40127cef in memcpy () from /lib/tls/libc.so.6
#1  0x40056f08 in *_gfortrani_reshape_packed (ret=0x0, rsize=32,
    source=0x20 <Address 0x20 out of bounds>, ssize=32, pad=0x0, psize=4)
    at ../../../gcc/libgfortran/intrinsics/reshape_packed.c:45
#2  0x40044b8b in *_gfortran_reshape_4 (ret=0xbffff4c4, source=Variable "source"
is not available.
)
    at ../../../gcc/libgfortran/generated/reshape_i4.c:160
#3  0x08048d6f in MAIN__ () at tryresh.f90:35
#4  0x08048f43 in main (argc=32, argv=0x20)
    at ../../../gcc/libgfortran/fmain.c:18
(gdb) q
The program is running.  Exit anyway? (y or n) y
$ gfortran -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/home/ig25 --enable-languages=c,f95
Thread model: posix
gcc version 4.0.0 20050219 (experimental)

-- 
           Summary: reshape of pointer array segfaults at runtime
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libfortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: Thomas dot Koenig at online dot de
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug libfortran/20074] reshape of pointer array segfaults at runtime
  2005-02-19 18:27 [Bug libfortran/20074] New: reshape of pointer array segfaults at runtime Thomas dot Koenig at online dot de
@ 2005-02-22  0:30 ` pinskia at gcc dot gnu dot org
  2005-04-22 20:03 ` cvs-commit at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-22  0:30 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-02-21 21:32 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-02-21 21:32:11
               date|                            |


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


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

* [Bug libfortran/20074] reshape of pointer array segfaults at runtime
  2005-02-19 18:27 [Bug libfortran/20074] New: reshape of pointer array segfaults at runtime Thomas dot Koenig at online dot de
  2005-02-22  0:30 ` [Bug libfortran/20074] " pinskia at gcc dot gnu dot org
@ 2005-04-22 20:03 ` cvs-commit at gcc dot gnu dot org
  2005-04-29  7:29 ` [Bug libfortran/20074] [4.0 only] " tkoenig at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-04-22 20:03 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-04-22 20:02 -------
Subject: Bug 20074

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	tkoenig@gcc.gnu.org	2005-04-22 20:02:44

Modified files:
	gcc/testsuite  : ChangeLog 
	libgfortran    : ChangeLog 
	libgfortran/generated: reshape_i4.c reshape_i8.c 
	libgfortran/intrinsics: reshape_generic.c 
	libgfortran/m4 : reshape.m4 
Added files:
	gcc/testsuite/gfortran.dg: nested_reshape.f90 reshape-alloc.f90 
	                           reshape.f90 

Log message:
	05-04-22  Thomas Koenig  <Thomas.Koenig@online.de>
	
	PR libfortran/20074
	PR libfortran/20436
	PR libfortran/21108
	* gfortran.dg/nested_reshape.f90: new test
	* gfortran.dg/reshape-alloc.f90: new test
	* gfortran.dg/reshape.f90: new test
	
	2005-04-22  Thomas Koenig  <Thomas.Koenig@online.de>
	
	PR libfortran/20074
	PR libfortran/20436
	PR libfortran/21108
	* m4/reshape.m4 (reshape_`'rtype_kind):  rs, rex:  New
	variables, to be used in calculation of return array sizes.
	Populate return array descriptor if ret->data is NULL.
	Fix condition for early return (it used to test something
	undefined if order was used).
	Remove duplicate check wether pad is used.
	* intrinsics/reshape_generic.c (reshape_generic): Likewise.
	Fix a few places where the wrong variables were set.
	* generated/reshape_i4.c: Regenerated.
	* generated/reshape_i8.c: Regenerated.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/nested_reshape.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/reshape-alloc.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/reshape.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5383&r2=1.5384
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/ChangeLog.diff?cvsroot=gcc&r1=1.198&r2=1.199
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/reshape_i4.c.diff?cvsroot=gcc&r1=1.6&r2=1.7
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/reshape_i8.c.diff?cvsroot=gcc&r1=1.6&r2=1.7
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/intrinsics/reshape_generic.c.diff?cvsroot=gcc&r1=1.7&r2=1.8
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/m4/reshape.m4.diff?cvsroot=gcc&r1=1.7&r2=1.8



-- 


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


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

* [Bug libfortran/20074] [4.0 only] reshape of pointer array segfaults at runtime
  2005-02-19 18:27 [Bug libfortran/20074] New: reshape of pointer array segfaults at runtime Thomas dot Koenig at online dot de
  2005-02-22  0:30 ` [Bug libfortran/20074] " pinskia at gcc dot gnu dot org
  2005-04-22 20:03 ` cvs-commit at gcc dot gnu dot org
@ 2005-04-29  7:29 ` tkoenig at gcc dot gnu dot org
  2005-05-21 19:57 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2005-04-29  7:29 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From tkoenig at gcc dot gnu dot org  2005-04-29 07:29 -------
Fixed in 4.1, should be merged with 4.0

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |4.0.0
      Known to work|                            |4.1.0
            Summary|reshape of pointer array    |[4.0 only] reshape of
                   |segfaults at runtime        |pointer array segfaults at
                   |                            |runtime
   Target Milestone|---                         |4.0.1


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


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

* [Bug libfortran/20074] [4.0 only] reshape of pointer array segfaults at runtime
  2005-02-19 18:27 [Bug libfortran/20074] New: reshape of pointer array segfaults at runtime Thomas dot Koenig at online dot de
                   ` (2 preceding siblings ...)
  2005-04-29  7:29 ` [Bug libfortran/20074] [4.0 only] " tkoenig at gcc dot gnu dot org
@ 2005-05-21 19:57 ` cvs-commit at gcc dot gnu dot org
  2005-05-21 20:30 ` tkoenig at gcc dot gnu dot org
  2005-07-30 22:29 ` cvs-commit at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-05-21 19:57 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-05-21 19:57 -------
Subject: Bug 20074

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	tkoenig@gcc.gnu.org	2005-05-21 19:56:44

Modified files:
	libgfortran/generated: reshape_c4.c reshape_c8.c reshape_i4.c 
	                       reshape_i8.c 
	libgfortran/intrinsics: reshape_generic.c 
	libgfortran/m4 : reshape.m4 
	libgfortran    : ChangeLog 
	gcc/testsuite  : ChangeLog 

Log message:
	005-05-21  Thomas Koenig  <Thomas.Koenig@online.de>
	
	PR libfortran/20074
	PR libfortran/20436
	PR libfortran/21108
	* m4/reshape.m4 (reshape_`'rtype_kind):  rs, rex:  New
	variables, to be used in calculation of return array sizes.
	Populate return array descriptor if ret->data is NULL.
	Fix condition for early return (it used to test something
	undefined if order was used).
	Remove duplicate check wether pad is used.
	* intrinsics/reshape_generic.c (reshape_generic): Likewise.
	Fix a few places where the wrong variables were set.
	* generated/reshape_i4.c: Regenerated.
	* generated/reshape_i8.c: Regenerated.
	
	2005-05-21  Thomas Koenig  <Thomas.Koenig@online.de>
	
	PR libfortran/20074
	PR libfortran/20436
	PR libfortran/21108
	* gfortran.dg/nested_reshape.f90: new test
	* gfortran.dg/reshape-alloc.f90: new test
	* gfortran.dg/reshape.f90: new test

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/reshape_c4.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.1.2.1&r2=1.1.2.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/reshape_c8.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.1.2.1&r2=1.1.2.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/reshape_i4.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5&r2=1.5.12.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/reshape_i8.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5&r2=1.5.12.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/intrinsics/reshape_generic.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.6&r2=1.6.12.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/m4/reshape.m4.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.6.12.1&r2=1.6.12.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.163.2.35&r2=1.163.2.36
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5084.2.192&r2=1.5084.2.193



-- 


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


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

* [Bug libfortran/20074] [4.0 only] reshape of pointer array segfaults at runtime
  2005-02-19 18:27 [Bug libfortran/20074] New: reshape of pointer array segfaults at runtime Thomas dot Koenig at online dot de
                   ` (3 preceding siblings ...)
  2005-05-21 19:57 ` cvs-commit at gcc dot gnu dot org
@ 2005-05-21 20:30 ` tkoenig at gcc dot gnu dot org
  2005-07-30 22:29 ` cvs-commit at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2005-05-21 20:30 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From tkoenig at gcc dot gnu dot org  2005-05-21 20:29 -------
Fixed in 4.0.

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


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


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

* [Bug libfortran/20074] [4.0 only] reshape of pointer array segfaults at runtime
  2005-02-19 18:27 [Bug libfortran/20074] New: reshape of pointer array segfaults at runtime Thomas dot Koenig at online dot de
                   ` (4 preceding siblings ...)
  2005-05-21 20:30 ` tkoenig at gcc dot gnu dot org
@ 2005-07-30 22:29 ` cvs-commit at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-07-30 22:29 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-07-30 22:29 -------
Subject: Bug 20074

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	tkoenig@gcc.gnu.org	2005-07-30 22:29:25

Modified files:
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gfortran.dg: nested_reshape.f90 reshape-alloc.f90 
	                           reshape.f90 

Log message:
	2005-07-30  Thomas Koenig  <Thomas.Koenig@online.de>
	
	Backport from mainline:
	PR libfortran/20074
	PR libfortran/20436
	PR libfortran/21108
	* gfortran.dg/nested_reshape.f90:  Actually commit.
	* gfortran.dg/reshape-alloc.f90:  Actually commit.
	* gfortran.dg/reshape.f90:  Actually commit.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5084.2.311&r2=1.5084.2.312
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/nested_reshape.f90.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.14.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/reshape-alloc.f90.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.14.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/reshape.f90.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.14.1



-- 


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


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

end of thread, other threads:[~2005-07-30 22:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-19 18:27 [Bug libfortran/20074] New: reshape of pointer array segfaults at runtime Thomas dot Koenig at online dot de
2005-02-22  0:30 ` [Bug libfortran/20074] " pinskia at gcc dot gnu dot org
2005-04-22 20:03 ` cvs-commit at gcc dot gnu dot org
2005-04-29  7:29 ` [Bug libfortran/20074] [4.0 only] " tkoenig at gcc dot gnu dot org
2005-05-21 19:57 ` cvs-commit at gcc dot gnu dot org
2005-05-21 20:30 ` tkoenig at gcc dot gnu dot org
2005-07-30 22:29 ` cvs-commit 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).