Skip to content

Reproducer for gfortran bug 98141#7

Open
dhnza wants to merge 1 commit into
nncarlson:masterfrom
dhnza:GNU98141
Open

Reproducer for gfortran bug 98141#7
dhnza wants to merge 1 commit into
nncarlson:masterfrom
dhnza:GNU98141

Conversation

@dhnza

@dhnza dhnza commented Dec 4, 2020

Copy link
Copy Markdown

This PR adds a minimal reproducer for gfortran bug 98141.

Comment thread gfortran-bugs/CMakeLists.txt Outdated

project(gfortran-bug Fortran)

add_compiler_test(SOURCES gfortran-20201204.f90 RUN_ONLY LABELS PR98141)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing this should be RUN_ONLY, since I expect it to compile but to segfault when run.

@nncarlson

Copy link
Copy Markdown
Owner

Looking at your example and drawing on past experience, I suspected that the problem was with the sourced allocation statement, and that does appear the case (although there may be multiple compiler bugs here). Here's a minimal example that triggers a segfault:

class(*), allocatable :: a, b
allocate(character(len=0)::a)
allocate(b, source=a)
end

@dhnza

dhnza commented Dec 4, 2020

Copy link
Copy Markdown
Author

Looking at your example and drawing on past experience, I suspected that the problem was with the sourced allocation statement, and that does appear the case (although there may be multiple compiler bugs here). Here's a minimal example that triggers a segfault:

class(*), allocatable :: a, b
allocate(character(len=0)::a)
allocate(b, source=a)
end

Nice! Strangely, this doesn't work

program foo
  class(*), allocatable :: a, b
  allocate(a, source='')  !! No problem
  allocate(b, source=a)  !! Segfaults                                                                                                                                                                                     
end program

I'll add these examples to the bug report.

@dhnza

dhnza commented Dec 4, 2020

Copy link
Copy Markdown
Author

I'll also pare down the example in this MR and add the new examples.

@dhnza

dhnza commented Dec 4, 2020

Copy link
Copy Markdown
Author

This does work, however:

program foo
  class(*), allocatable :: a
  character(len=0) :: s
  allocate(a, source=s)
end program

@dhnza

dhnza commented Dec 4, 2020

Copy link
Copy Markdown
Author

This latest version has the minimal examples we found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants