[Bug fortran/65585] New: Implicit allocation of unallocated array with an implicit summation

dirteat at gmail dot com gcc-bugzilla@gcc.gnu.org
Thu Mar 26 16:26:00 GMT 2015


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65585

            Bug ID: 65585
           Summary: Implicit allocation of unallocated array with an
                    implicit summation
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dirteat at gmail dot com

Created attachment 35150
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35150&action=edit
10 lines code reproducing the bug

Hi there,
I did not find any bug report on this, but the small attached code compiled
with gcc-gfortran 4.9.2 implicitely allocate an non-allocated array; or
segfault, depending on how the implicit assignement is written.

Compiled with:
gfortran -c noalloc.f90; gfortran noalloc.o -o bug


With the assignemnt written as:
iamwild = iamfine

I get the following output:
 Are you fine?   1.00000000       2.00000000       3.00000000       4.00000000 
     5.00000000       6.00000000       7.00000000       8.00000000      
9.00000000       10.0000000  

With the assignment written as:
iamwild(:) = iamfine(:)

I get the expected behavior:
./bug 

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
#0  0x7F8CF04BA597
#1  0x7F8CF04BABAE
#2  0x7F8CEF9C66AF
#3  0x400BC3 in MAIN__ at noalloc.f90:?
Segmentation fault



PS: took me the day to understand why my code was not working with another
compiler... :-/



More information about the Gcc-bugs mailing list