[Bug fortran/58913] New: Segmentation fault on real128 array

rrodrigues at poli dot ufrj.br gcc-bugzilla@gcc.gnu.org
Tue Oct 29 17:46:00 GMT 2013


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

            Bug ID: 58913
           Summary: Segmentation fault on real128 array
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rrodrigues at poli dot ufrj.br

I cannot "write" a variable which contains an array of real(kind=real128).
Scalars seem to work right.
I got this behavior when running this simple program:

01  program main
02    use iso_fortran_env
03    real(real128), dimension(2) :: a
04    a = (/0., 1./)
05    write(*,*) a
06  end program

>gfortran main.txt -o main    #successfully compiles!
>main                         #runtime error!

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

Backtrace for this error:
#0 ffffffff

Same error is obtained if I:
I)   change real(real128) to real(16) in line 03
II)  change line 04 to a = (/0._real128, 1._real128)
III) change line 04 to a = real((/0., 1./), kind=real128)
IV)  declare a variable "b", assign b = a and try to write "b"
V)   try to write the value of a pointer pointing to a
VI)  make variable "a" PARAMETER, SAVE, TARGET or ALLOCATABLE

More weird is that the program successfully run if I:
a)   change line 05 to write(*,*) a(1)
b)   change line 05 to write(*,*) (/0., 1./)
b)   change line 05 to write(*,*) 2*a or any other expression whose result IS
NOT a direct reference to "a" or any other variable with real128 array.
c)   put a write statement with a value or scalar variable of kind=real128
anywhere in the program's body, no matter if before, after or even inside the
write statement of line 05
d)   change real(real128) to any other real kind in line 03
e)   make "a" scalar

Any ideas?



More information about the Gcc-bugs mailing list