Skip to content

Large array in COMMON (2^30 4-byte elements), assignment to element, leads to segfault at runtime. #76799

Open
@harishch4

Description

@harishch4

A very large storage sequence (2**30 x 4-byte elements) in a common block leads to segmentation fault at runtime.
The below program works fine in gfortran,classic-flang and ifort but fails on llvm-flang : https://godbolt.org/z/YxP7P73rq

Program test_storage_seq_big
    Integer, Parameter :: sz = 2**30
    Real :: x(sz)
    Common/comm/x
    Print *,sz
    x(1:2000) = 42
    x(sz-2) = -99
    Call diff
    Print '("ok")'
  Contains
    Subroutine diff
      Real :: y(sz)
      Common/comm/y
      Print '(f8.1)', y(sz-2)
    End Subroutine diff
  End Program test_storage_seq_big

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviorflangFlang issues not falling into any other categoryflang:runtime

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions