[Bug 1720699] [NEW] gfortran segfault on continuation at end of program followed by two or more newlines

Andrew Gaspar 1720699 at bugs.launchpad.net
Sun Oct 1 22:41:08 UTC 2017


Public bug reported:

If you end a FORTRAN program with the continuation character '&'
followed by two newlines, gfortran SEGFAULTs when attempting to compile
the program.

This issue has a very minimal repro:

file: test.f90
```
end program &


```

The two newlines at the end are significant. The problem does not repro
with 1 or 0 newlines, though it does repro with more newlines. The
problem also repros when any of the lines following the continuation
contain a comment. The problem repros with both LF and CRLF line
endings.

I believe this program should compile without error.

Putting a token anywhere after the continuation, even separated by 2 or
more newlines, results in the expected error messages.

I'm running this on Windows Subsystem for Linux, though it's not likely
that is causing this bug.

The SEGFAULT error encountered:
```
andre at ANDREW-DESKTOP:/mnt/c/Users/andre/Projects/scratch$ gfortran test.f90 -o hello
f951: 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.
```

gfortran --version
```
andre at ANDREW-DESKTOP:/mnt/c/Users/andre/Projects/scratch$ gfortran --version
GNU Fortran (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
```

lsb_release -rd
```
andre at ANDREW-DESKTOP:/mnt/c/Users/andre/Projects/scratch$ lsb_release -rd
Description:    Ubuntu 16.04.3 LTS
Release:        16.04
```

apt-cache policy gfortran
```
andre at ANDREW-DESKTOP:/mnt/c/Users/andre/Projects/scratch$ apt-cache policy gfortran
gfortran:
  Installed: 4:5.3.1-1ubuntu1
  Candidate: 4:5.3.1-1ubuntu1
  Version table:
 *** 4:5.3.1-1ubuntu1 500
        500 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages
        100 /var/lib/dpkg/status
```

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

-- 
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/1720699

Title:
  gfortran segfault on continuation at end of program followed by two or
  more newlines

Status in gcc-5 package in Ubuntu:
  New

Bug description:
  If you end a FORTRAN program with the continuation character '&'
  followed by two newlines, gfortran SEGFAULTs when attempting to
  compile the program.

  This issue has a very minimal repro:

  file: test.f90
  ```
  end program &

  
  ```

  The two newlines at the end are significant. The problem does not
  repro with 1 or 0 newlines, though it does repro with more newlines.
  The problem also repros when any of the lines following the
  continuation contain a comment. The problem repros with both LF and
  CRLF line endings.

  I believe this program should compile without error.

  Putting a token anywhere after the continuation, even separated by 2
  or more newlines, results in the expected error messages.

  I'm running this on Windows Subsystem for Linux, though it's not
  likely that is causing this bug.

  The SEGFAULT error encountered:
  ```
  andre at ANDREW-DESKTOP:/mnt/c/Users/andre/Projects/scratch$ gfortran test.f90 -o hello
  f951: 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.
  ```

  gfortran --version
  ```
  andre at ANDREW-DESKTOP:/mnt/c/Users/andre/Projects/scratch$ gfortran --version
  GNU Fortran (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
  Copyright (C) 2015 Free Software Foundation, Inc.
  ```

  lsb_release -rd
  ```
  andre at ANDREW-DESKTOP:/mnt/c/Users/andre/Projects/scratch$ lsb_release -rd
  Description:    Ubuntu 16.04.3 LTS
  Release:        16.04
  ```

  apt-cache policy gfortran
  ```
  andre at ANDREW-DESKTOP:/mnt/c/Users/andre/Projects/scratch$ apt-cache policy gfortran
  gfortran:
    Installed: 4:5.3.1-1ubuntu1
    Candidate: 4:5.3.1-1ubuntu1
    Version table:
   *** 4:5.3.1-1ubuntu1 500
          500 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages
          100 /var/lib/dpkg/status
  ```

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



More information about the foundations-bugs mailing list