[Bug 1618799] [NEW] gfortran and equivalence produces internal compiler error

Rolf Sander 1618799 at bugs.launchpad.net
Wed Aug 31 09:42:49 UTC 2016


Public bug reported:

Hello,

I encountered an internal compiler error with gfortran (Ubuntu
5.4.0-6ubuntu1~16.04.2) and the error message suggests to submit a GCC
bug report:

-----------
gfortran gfortran_test_equivalence.f90
gfortran_test_equivalence.f90:14:0:

 PROGRAM test
 1
internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-5/README.Bugs> for instructions.
-----------

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(array1(1),array2(1))
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.

** Affects: gcc-5 (Ubuntu)
     Importance: Undecided
         Status: New

** Attachment added: "gfortran_test_equivalence.f90"
   https://bugs.launchpad.net/bugs/1618799/+attachment/4731455/+files/gfortran_test_equivalence.f90

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to gcc-5 in Ubuntu.
https://bugs.launchpad.net/bugs/1618799

Title:
  gfortran and equivalence produces internal compiler error

Status in gcc-5 package in Ubuntu:
  New

Bug description:
  Hello,

  I encountered an internal compiler error with gfortran (Ubuntu
  5.4.0-6ubuntu1~16.04.2) and the error message suggests to submit a GCC
  bug report:

  -----------
  gfortran gfortran_test_equivalence.f90
  gfortran_test_equivalence.f90:14:0:

   PROGRAM test
   1
  internal compiler error: Segmentation fault
  Please submit a full bug report,
  with preprocessed source if appropriate.
  See <file:///usr/share/doc/gcc-5/README.Bugs> for instructions.
  -----------

  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(array1(1),array2(1))
  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.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1618799/+subscriptions



More information about the foundations-bugs mailing list