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

    <tr>
        <th>Summary</th>
        <td>
            [flang] out of memory optimizing character with negative length
        </td>
    </tr>

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

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

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

<pre>
    Two tests in the gfortran test suite attempt to create a character array with negative length: 
- https://github.com/llvm/llvm-test-suite/blob/main/Fortran/gfortran/regression/char_length_20.f90
- https://github.com/llvm/llvm-test-suite/blob/main/Fortran/gfortran/regression/char_length_21.f90

Both of these tests can be built successfully without optimisation, but at `-O1` my compilation crashed after the memory consumption went over 90GB compiling one translation unit.

These tests are currently disabled by the testing infrastructure in llvm-test-suite, but it is useful sometimes to run even disabled tests to gather statistics about remaining issues. These tests block us from doing this with optimization enabled (which enables several more passes in flang and so hopefully shakes out more bugs).

My flang-new compiler is a release with assertions build from 16c4843d32
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzEVL2O4zYQfhqqGdigKFlrFyp2s1CqIM31B4oaScxRpMEZ2nCePiDlzW6QFOmu8Q8xw-9vOJrILh6xF6c3cXqvdOI1xJ5Hp9dqDNOj_3YPwEhMYD3wirDMIXLUvpwCJcsImhm3KwMHMBF1PgGz6qgNYwQdo37A3fIKHhfN9obg0C-8iuYVhHwX8vUAK_OVRPMq1CDUsFhe03g0YRNqcO728XXIqIeCKtQwujAKNWzaeqGGYSeWu-e_f0ZcIhLZkP9kTt936O9KHueL_Gno9Sf6_vkWeIUwZ48Jn5Yb7WFEGJN12WpjkGhOzu1uhsQQrmw3S5oLxC8wJgbNIDp5-L0WnYTtASZsV-tKCZioacUJ9JyTyXluuIWYizyl7VqK7ugZwg0jXOSvb89-6xcIHiEro-dtyVs-fhXx7Qt5HRFMihE9uwdMlvTocILxUWBzTb7S-jlq4pgMp4h5yP5l9K7KMliCRDgnBxQ2ZLsh5ZGLyQPe0H9i7AQ4wKJ5xQjEmi2xNQR6zLZFzKkVfKKEdISvzEcXzA9IBHMMG0wh1_FqaZ_h3fI_dwfQ74hCne-rNevzgIDwhlE72EJEuGoiLC9odtovoP0EFGANV9zjpFX_QIJMrTSMaSGhLv_w9rfH3n3weH9mgjF7oiGiQ02488tYMZOjMjjTrqLuTHtum6lR1dQ306W56Ar7-kV2L-e2Uadq7evmZFo0bdeMXafrrtVmvnTtKOez6sx5qmyvpGqlknUt21N9OpqLNhLlrKaLbM54Fq3MxrpjzvAY4lIVe_uzVC-ycnpER2XVKFWkCKXy1ol9ybyIbqWzxPR5A1t2ZT_tHaf34lKYPwb3GUfO6HPl_NeyqVJ0_f9859cY_kDDQg37fAg1FA1_BQAA__9HKstY">