This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libfortran/20832] New: Segfault in SUM


Segfault in libgfortran on both MinGW and i686-linux:

$ cat fc014.f90
! Original bug-report by Walt Brainerd, The Fortran Company
  integer,dimension(1,1) :: mis1 = 1
  logical,dimension(1,1) :: ml2 = .true.
  integer,dimension(1) :: s

!  s = sum(mis1,dim=1,mask=ml2)   ! This line works
  print *, sum(mis1,dim=1,mask=ml2)
  end

$ gfc fc014.f90 && ./a.out      
zsh: segmentation fault  ./a.out


Here is the GDB info I could gather:

(gdb) run
Starting program: /cosmic/coudert/irun/a.out 

Program received signal SIGSEGV, Segmentation fault.
*_gfortran_msum_i4 (retarray=Variable "retarray" is not available.)
    at ../../../gcc/libgfortran/generated/sum_i4.c:254
254                 *dest = result;
(gdb) where
#0  *_gfortran_msum_i4 (retarray=Variable "retarray" is not available.)
    at ../../../gcc/libgfortran/generated/sum_i4.c:254
#1  0x080482eb in MAIN__.hot_section ()
#2  0x08048363 in main (argc=1, argv=0x1)
    at ../../../gcc/libgfortran/fmain.c:18

Few observations:
  . segfault is in libgfortran
  . with a one-dimension array, it works
  . if you don't use a mask, it works
  . if you don't specify "dim=..." (that is, you sum in the whole array),
it works
  . if you don't use temporaries (example with the "s=..." line), it works

-- 
           Summary: Segfault in SUM
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libfortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fxcoudert at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]