gfortran and equivalence produces internal compiler error
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
gcc-5 (Ubuntu) |
Confirmed
|
Medium
|
Unassigned |
Bug Description
Hello,
I encountered an internal compiler error with gfortran (Ubuntu
5.4.0-6ubuntu1~
bug report:
-----------
gfortran gfortran_
gfortran_
PROGRAM test
1
internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:/
-----------
I was able to boil down the problem to the following simple code:
-----------
MODULE test_equivalence
REAL, PRIVATE, DIMENSION(100) :: array1
REAL, PRIVATE, DIMENSION(100) :: array2
EQUIVALENCE(
END MODULE test_equivalence
MODULE mymodule
USE test_equivalence
! declare a local variable with the same name as the (private!)
! variable in module test_equivalence:
REAL, DIMENSION(:), ALLOCATABLE :: array1
END MODULE mymodule
PROGRAM test
USE mymodule
END PROGRAM test
-----------
AFAICS, this code is correct Fortran90. The private arrays in MODULE
test_equivalence should be separate from those in MODULE mymodule.
However, it seems that gfortran turns array1 into a public variable
because of the EQUIVALENCE statement.
Asking a colleague, I was told that the bug also occurs in version 6.2.0
but not in 4.3.4, 4.8.1, and 4.9.4.
(gdb) bt function_ code(gfc_ namespace* ) ()
#0 0x0000000000643a8e in ?? ()
#1 0x0000000000643898 in ?? ()
#2 0x00000000006427f2 in ?? ()
#3 0x0000000000d4e6fe in gfc_generate_
#4 0x0000000000d2c6b6 in gfc_parse_file() ()
#5 0x00000000011e6166 in ?? ()
#6 0x0000000001236373 in ?? ()
#7 0x0000000000d0ca69 in toplev::main(int, char**) ()
#8 0x0000000000d0cdba in main ()
this is fixed in gcc-5 in zesty and in gcc-6.