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

             Bug #: 50201
           Summary: gfortran with -static causes seg fault at runtime for
                    writing double prec array with precision increased to
                    kind=16
    Classification: Unclassified
           Product: gcc
           Version: 4.6.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: lo...@cray.com


It appears that the combination of -static and promoting 'double precision' to
kind=16 causes problems for writing an double precision array.  Either changing
from array to scalar, or removing -static avoids the problem. 

Writing quad scalar with -static is fine:

> cat fdp2.f90
double precision :: x
x = 3.4
print *, kind(x)
write (*, "(f10.3)" ) x
end
> gfortran -fdefault-real-8 -static fdp2.f90
> ./a.out
          16
     3.400

Writing quad array with -static -> segfault.

> cat fdp1.f90
double precision :: x(4)
x = 3.4
print *, kind(x)
write (*, "(4f10.3)" ) x
end
> gfortran -fdefault-real-8 -static fdp1.f90
> ./a.out
          16
Segmentation fault

But is OK without -static:

> gfortran -fdefault-real-8  fdp1.f90
> ./a.out
          16
     3.400     3.400     3.400     3.400
>

Reply via email to