public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/48058] New: [4.6 Regression] reallocation of array during constructor assignement
@ 2011-03-10 12:05 xarthisius.kk at gmail dot com
  2011-03-10 14:08 ` [Bug fortran/48058] " dominiq at lps dot ens.fr
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: xarthisius.kk at gmail dot com @ 2011-03-10 12:05 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: [4.6 Regression] reallocation of array during
                    constructor assignement
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: xarthisius.kk@gmail.com


Assigning [...] constructor to allocatable array changes size of that array, if
size([...]) is not equal to size(array)

program ala
   implicit none
   integer, dimension(:), allocatable :: ivec

   allocate(ivec(3));  write(*,*) shape(ivec)
   ivec = [1,2];       write(*,*) shape(ivec) !!!!!!

end program ala

Target: x86_64-pc-linux-gnu
Configured with:
/dev/shm/portage/sys-devel/gcc-4.6.0_alpha20110226/work/gcc-4.6-20110226/configure
--prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.6.0-alpha20110226
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.0-alpha20110226/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.6.0-alpha20110226
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.6.0-alpha20110226/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.6.0-alpha20110226/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.0-alpha20110226/include/g++-v4
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec
--disable-fixed-point --with-ppl --with-cloog --disable-ppl-version-check
--with-cloog-include=/usr/include/cloog-ppl --enable-lto --enable-nls
--without-included-gettext --with-system-zlib --disable-werror
--enable-secureplt --enable-multilib --enable-libmudflap --disable-libssp
--enable-libgomp --enable-cld
--with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.6.0-alpha20110226/python
--enable-checking=release --disable-libgcj --enable-languages=c,c++,fortran
--enable-shared --enable-threads=posix --enable-__cxa_atexit
--enable-clocale=gnu --with-bugurl=http://bugs.gentoo.org/
--with-pkgversion='Gentoo 4.6.0_alpha20110226'
Thread model: posix
gcc version 4.6.0-alpha20110226 20110226 (experimental) (Gentoo
4.6.0_alpha20110226)


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

* [Bug fortran/48058] [4.6 Regression] reallocation of array during constructor assignement
  2011-03-10 12:05 [Bug fortran/48058] New: [4.6 Regression] reallocation of array during constructor assignement xarthisius.kk at gmail dot com
@ 2011-03-10 14:08 ` dominiq at lps dot ens.fr
  2011-03-10 14:34 ` xarthisius.kk at gmail dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: dominiq at lps dot ens.fr @ 2011-03-10 14:08 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus@net-b.de, pault at
                   |                            |gcc dot gnu.org

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2011-03-10 14:07:49 UTC ---
> Assigning [...] constructor to allocatable array changes size of that array, if
> size([...]) is not equal to size(array)

As far as I understand "reallocation on assignment, this is the expected
behavior (default that you can override with -fno-realloc-lhs).

There may be a missing error in

[macbook] f90/bug% gfc -fno-realloc-lhs -fcheck=all pr48058.f90
[macbook] f90/bug% a.out
           3
           3

where a length 2 vector is assigned to a length 3 one(?).


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

* [Bug fortran/48058] [4.6 Regression] reallocation of array during constructor assignement
  2011-03-10 12:05 [Bug fortran/48058] New: [4.6 Regression] reallocation of array during constructor assignement xarthisius.kk at gmail dot com
  2011-03-10 14:08 ` [Bug fortran/48058] " dominiq at lps dot ens.fr
@ 2011-03-10 14:34 ` xarthisius.kk at gmail dot com
  2011-03-10 15:24 ` kargl at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: xarthisius.kk at gmail dot com @ 2011-03-10 14:34 UTC (permalink / raw)
  To: gcc-bugs

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

Kacper Kowalik <xarthisius.kk at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID

--- Comment #2 from Kacper Kowalik <xarthisius.kk at gmail dot com> 2011-03-10 14:34:21 UTC ---
Somehow, I've missed this in ChangeLog. Sorry for the noise


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

* [Bug fortran/48058] [4.6 Regression] reallocation of array during constructor assignement
  2011-03-10 12:05 [Bug fortran/48058] New: [4.6 Regression] reallocation of array during constructor assignement xarthisius.kk at gmail dot com
  2011-03-10 14:08 ` [Bug fortran/48058] " dominiq at lps dot ens.fr
  2011-03-10 14:34 ` xarthisius.kk at gmail dot com
@ 2011-03-10 15:24 ` kargl at gcc dot gnu.org
  2012-02-28 16:00 ` therobbot at gmail dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: kargl at gcc dot gnu.org @ 2011-03-10 15:24 UTC (permalink / raw)
  To: gcc-bugs

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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org

--- Comment #3 from kargl at gcc dot gnu.org 2011-03-10 15:24:29 UTC ---
(In reply to comment #2)
> Somehow, I've missed this in ChangeLog. Sorry for the noise

ChangeLog is a horrible place to look at the new features
in gfortran.  It would be better to look on the gfortran
wiki.

http://gcc.gnu.org/wiki/GFortran#news


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

* [Bug fortran/48058] [4.6 Regression] reallocation of array during constructor assignement
  2011-03-10 12:05 [Bug fortran/48058] New: [4.6 Regression] reallocation of array during constructor assignement xarthisius.kk at gmail dot com
                   ` (2 preceding siblings ...)
  2011-03-10 15:24 ` kargl at gcc dot gnu.org
@ 2012-02-28 16:00 ` therobbot at gmail dot com
  2012-02-28 16:14 ` burnus at gcc dot gnu.org
  2012-02-28 16:41 ` therobbot at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: therobbot at gmail dot com @ 2012-02-28 16:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Robert Hayward <therobbot at gmail dot com> 2012-02-28 15:53:05 UTC ---
Created attachment 26770
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26770
test program to reproduce bug


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

* [Bug fortran/48058] [4.6 Regression] reallocation of array during constructor assignement
  2011-03-10 12:05 [Bug fortran/48058] New: [4.6 Regression] reallocation of array during constructor assignement xarthisius.kk at gmail dot com
                   ` (3 preceding siblings ...)
  2012-02-28 16:00 ` therobbot at gmail dot com
@ 2012-02-28 16:14 ` burnus at gcc dot gnu.org
  2012-02-28 16:41 ` therobbot at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-02-28 16:14 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org,
                   |                            |therobbot at gmail dot com

--- Comment #5 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-02-28 16:11:08 UTC ---
Robert Hayward wrote in comment #4:
> Created attachment 26770 [details]
> test program to reproduce bug

Please do not attach test cases to random bugreports! But create a new bug
report and put more information in the report. -- Except that both issues are
related to Fortran 2003's (re)allocation on intrinsic assignment, they do not
have anything in common.

The issue of comment 4 / Robert Hayward's issue is a bug in gfortran 4.6/4.7,
which has been been reported in PR 52012 and fixed around 2012-01-31. Please
try a newer version of GCC 4.6/4.7 - or use -fno-realloc-lhs as work around.



(The issue in comment 0 is a bug in the original reporter's program for Fortran
90/95: The shape on the right and on the left have to be the same. The proper
assignment should have been one of the following:
  ivec(1:2) = [1,2]
  ivec(2:3) = [1,2]
  ivec(1:2:2) = [1,2] ! or   ivec([1,3]) = [1,2]

With Fortran 2003, the program became valid - as the compiler reallocated
"ivec" with the shape of the right side.

With -std=f95 or if the left-hand side weren't allocatable, -fcheck=bounds had
given a run-time error.)


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

* [Bug fortran/48058] [4.6 Regression] reallocation of array during constructor assignement
  2011-03-10 12:05 [Bug fortran/48058] New: [4.6 Regression] reallocation of array during constructor assignement xarthisius.kk at gmail dot com
                   ` (4 preceding siblings ...)
  2012-02-28 16:14 ` burnus at gcc dot gnu.org
@ 2012-02-28 16:41 ` therobbot at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: therobbot at gmail dot com @ 2012-02-28 16:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Robert Hayward <therobbot at gmail dot com> 2012-02-28 16:36:52 UTC ---
48058(In reply to comment #4)
> Created attachment 26770 [details]
> test program to reproduce bug

Sorry about that, attached to the wrong bug. It was meant for 52151.


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

end of thread, other threads:[~2012-02-28 16:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-10 12:05 [Bug fortran/48058] New: [4.6 Regression] reallocation of array during constructor assignement xarthisius.kk at gmail dot com
2011-03-10 14:08 ` [Bug fortran/48058] " dominiq at lps dot ens.fr
2011-03-10 14:34 ` xarthisius.kk at gmail dot com
2011-03-10 15:24 ` kargl at gcc dot gnu.org
2012-02-28 16:00 ` therobbot at gmail dot com
2012-02-28 16:14 ` burnus at gcc dot gnu.org
2012-02-28 16:41 ` therobbot at gmail dot com

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).