Your message dated Wed, 16 Jul 2014 22:33:31 +0200
with message-id <53c6e19b.2030...@net-b.de>
and subject line Re: Bug#700301: gfortran: Fails to assign slice to allocatable 
array of derived type
has caused the Debian Bug report #700301,
regarding gfortran: Fails to assign slice to allocatable array of derived type
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ow...@bugs.debian.org
immediately.)


-- 
700301: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=700301
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
Package: gfortran
Version: 4:4.7.2-1
Severity: normal

Dear Maintainer,

The code below leads to segmentaion fault:

program allocatables

   implicit none

   integer, parameter :: CH_ = 4 
   type with_character
       character(kind=CH_)   :: Post = CH__" "
       integer                :: i = 0
   end type
   
   type with_string
       character(4, kind=CH_)   :: Post = CH__" "
       integer                :: i = 0
   end type

   type(with_character) :: CharList(10)
   type(with_string) :: StringList(10)
   type(with_character), allocatable :: CharAlloc(:)
   type(with_string), allocatable :: StringAlloc(:)

   CharAlloc%Post = CharList%Post
   CharAlloc = Pack(CharAlloc(2:), .true.) ! First segmentation fault.

   StringAlloc%Post = StringList%Post
   StringAlloc = Pack(StringList(2:), .true.) ! Second segmentation fault of 
another type.
end program allocatables

=========================
First segmentation fault:
 malloc.c:3096: sYSMALLOc: Assertion `(old_top == (((mbinptr) (((char *)
 &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct
 malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size)
 >= (unsigned long)((((__builtin_offsetof (struct malloc_chunk,
 >fd_nextsize))+((2 * (sizeof(size_t))) - 1)) & ~((2 * (sizeof(size_t)))
 >- 1))) && ((old_top)->size & 0x1) && ((unsigned long)old_end &
 >pagemask) == 0)' failed.

 Program received signal SIGABRT: Process abort signal.

 Backtrace for this error:

==========================
Second segmentation fault:

*** glibc detected *** ./lab_1_3.exe: free(): invalid next size
(normal): 0x00000000022690d0 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x76d76)[0x2b7871151d76]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x6c)[0x2b7871156aac]
../lab_1_3.exe[0x400fa7]
../lab_1_3.exe[0x400ff3]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xfd)[0x2b78710f9ead]
../lab_1_3.exe[0x400969]
======= Memory map: ========
00400000-00402000 r-xp 00000000 08:02 1843005
/home/stanislav/tmp/lab_1_3/bin/lab_1_3.exe
00601000-00602000 rw-p 00001000 08:02 1843005
/home/stanislav/tmp/lab_1_3/bin/lab_1_3.exe
02266000-02287000 rw-p 00000000 00:00 0
[heap]
2b78704d5000-2b78704f5000 r-xp 00000000 08:01 1450064
/lib/x86_64-linux-gnu/ld-2.13.so
2b78704f5000-2b78704f7000 rw-p 00000000 00:00 0 
2b78706f4000-2b78706f5000 r--p 0001f000 08:01 1450064
/lib/x86_64-linux-gnu/ld-2.13.so
2b78706f5000-2b78706f6000 rw-p 00020000 08:01 1450064
/lib/x86_64-linux-gnu/ld-2.13.so
2b78706f6000-2b78706f7000 rw-p 00000000 00:00 0 
2b78706f7000-2b787080b000 r-xp 00000000 08:01 1308169
/usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0
2b787080b000-2b7870a0b000 ---p 00114000 08:01 1308169
/usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0
2b7870a0b000-2b7870a0d000 rw-p 00114000 08:01 1308169
/usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0
2b7870a0d000-2b7870a8e000 r-xp 00000000 08:01 1450058
/lib/x86_64-linux-gnu/libm-2.13.so
2b7870a8e000-2b7870c8d000 ---p 00081000 08:01 1450058
/lib/x86_64-linux-gnu/libm-2.13.so
2b7870c8d000-2b7870c8e000 r--p 00080000 08:01 1450058
/lib/x86_64-linux-gnu/libm-2.13.so
2b7870c8e000-2b7870c8f000 rw-p 00081000 08:01 1450058
/lib/x86_64-linux-gnu/libm-2.13.so
2b7870c8f000-2b7870c90000 rw-p 00000000 00:00 0 
2b7870c90000-2b7870ca5000 r-xp 00000000 08:01 1439008
/lib/x86_64-linux-gnu/libgcc_s.so.1
2b7870ca5000-2b7870ea5000 ---p 00015000 08:01 1439008
/lib/x86_64-linux-gnu/libgcc_s.so.1
2b7870ea5000-2b7870ea6000 rw-p 00015000 08:01 1439008
/lib/x86_64-linux-gnu/libgcc_s.so.1
2b7870ea6000-2b7870edb000 r-xp 00000000 08:01 1311727
/usr/lib/x86_64-linux-gnu/libquadmath.so.0.0.0
2b7870edb000-2b78710da000 ---p 00035000 08:01 1311727
/usr/lib/x86_64-linux-gnu/libquadmath.so.0.0.0
2b78710da000-2b78710db000 rw-p 00034000 08:01 1311727
/usr/lib/x86_64-linux-gnu/libquadmath.so.0.0.0
2b78710db000-2b787125b000 r-xp 00000000 08:01 1450061
/lib/x86_64-linux-gnu/libc-2.13.so
2b787125b000-2b787145b000 ---p 00180000 08:01 1450061
/lib/x86_64-linux-gnu/libc-2.13.so
2b787145b000-2b787145f000 r--p 00180000 08:01 1450061
/lib/x86_64-linux-gnu/libc-2.13.so
2b787145f000-2b7871460000 rw-p 00184000 08:01 1450061
/lib/x86_64-linux-gnu/libc-2.13.so
2b7871460000-2b7871467000 rw-p 00000000 00:00 0 
2b7874000000-2b7874021000 rw-p 00000000 00:00 0 
2b7874021000-2b7878000000 ---p 00000000 00:00 0 
7fffa2f9d000-7fffa2fbe000 rw-p 00000000 00:00 0
[stack]
7fffa2fff000-7fffa3000000 r-xp 00000000 00:00 0
[vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0
[vsyscall]

Program received signal SIGABRT: Process abort signal.

Backtrace for this error:

================================

First error doesn't apears if CH_ = 1 in code.

-- System Information:
Debian Release: 6.0.6
  APT prefers stable
  APT policy: (990, 'stable'), (500, 'stable-updates'), (500, 
'proposed-updates'), (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=ru_RU.UTF-8, LC_CTYPE=ru_RU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages gfortran depends on:
ii  cpp           4:4.7.2-1
ii  gcc           4:4.7.2-1
ii  gfortran-4.7  4.7.2-5

gfortran recommends no packages.

Versions of packages gfortran suggests:
ii  gfortran-doc       5:4
pn  gfortran-multilib  <none>

-- no debconf information

--- End Message ---
--- Begin Message ---
Stanislav Fyodorov wrote:
The code below leads to segmentaion fault:
[...]
    type(with_character) :: CharList(10)
    type(with_string) :: StringList(10)
    type(with_character), allocatable :: CharAlloc(:)
    type(with_string), allocatable :: StringAlloc(:)

    CharAlloc%Post = CharList%Post
[...]
    StringAlloc%Post = StringList%Post
    StringAlloc = Pack(StringList(2:), .true.) ! Second segmentation fault of 
another type.

The assignment "CharAlloc%Post =" is invalid as "CharAlloc" hasn't been allocated. Ditto for "StringAlloc%Post =".

Solution: Either (manually) allocate "CharAlloc" before the assignment – or assign to "CharAlloc" instead of to "CharAlloc%Post", i.e. use "CharAlloc = CharList" instead.

If I remove the "%Post" from the two assignments, it works here with both GCC 4.8.1 and GCC 4.10; I don't have GCC 4.7 at hand. (GCC 4.7 is also be no longer supported.)

Thus, after fixing the INVALID test case, it WORKS FOR ME.

Tobias

--- End Message ---

Reply via email to