<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/76799>76799</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Large array in COMMON (2^30 4-byte elements), assignment to element, leads to segfault at runtime.
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            flang
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          harishch4
      </td>
    </tr>
</table>

<pre>
    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
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyEVF2vozYQ_TXmZZTIGSDAAw8pWaRK3W7U9qVPkYEB3Gvse22zm-TXVybs5n60WoRk4TNfZ2YOwjk5aKKSpb-w9BiJ2Y_GlqOw0o3tmESN6a7lAb6SvYISdiBw3lgRTnqZSbcEDHNkeGB4iDlcINk0V09AiibS3jEsQGoQ0JppMhoaZdonUCQ6B96AoyGYCS-Nhl7MyoPwYGft5URbxo-MH_4aCRpS5hs8WzNYMcE3Y58c9FJTiH0eemO9FZph1apAqd30SujhDEJ3cJYBPkMze-iFVA6MBqW-TncjYPEBRu-fHYsPDGuG9WC6xii_NXZgWN8Y1n9fTtkpi-3LvSK25-u7fJ7Wsjw5f177c3b0cm7kcLeAX7WngSzDCk7Ciok82ZA5JHc3YPERfjRxdQGAP0io71YXhrm7MSxWuFr6ybAOjWVYXx5uJyu1hyVc5W6P-xBix-IDcs7DXELWBN_i7rbB79imKB5gJZSCTvb9xzwZw5whmieGwTdcrDaV0V5I7R4-f86NNbMPo3sb7C3b6zu2y_Oe8vU1-LqYPt_u1kKwWmMttB4On3T3f7UE6Ocj_bEDUVfGXREXIqJyl_EEsyTP82gs07YRRZNSXzRFj-0u6Xietfui3WOHeZdHskSOCd_xmBfJDvNtm8StwCRtijQVWbdjCadJSLUN6xrWMZLOzVRm-6woIiUaUm6RLuKyy6H_6TGy5bLezTw4lnAlnXePCF56ReVvi5aFteIaJFR9-fz5y-93KaefYv4fKg6dvP8uwk3Q7goG4LWeP6g4mq0q3ylM-nFutq0JYwylrcfm2Zp_qPUM64WpY1gvZP8NAAD__2AeZsI">