<html>#2571: runtime failure due to useing character*8 in DECLARE_CCTK_ARGUMENTS_CHECKED macro
<table style='border-spacing: 1ex 0pt; '>
<tr><td style='text-align:right'> Reporter:</td><td>Roland Haas</td></tr>
<tr><td style='text-align:right'>   Status:</td><td>new</td></tr>
<tr><td style='text-align:right'>Milestone:</td><td></td></tr>
<tr><td style='text-align:right'>  Version:</td><td>development version</td></tr>
<tr><td style='text-align:right'>     Type:</td><td>bug</td></tr>
<tr><td style='text-align:right'> Priority:</td><td>major</td></tr>
<tr><td style='text-align:right'>Component:</td><td>Cactus</td></tr>
</table>

<p>Comment (by Erik Schnetter):</p>
<p>The problem is caused by bounds checking, in particular the <code>-fcheck=bounds</code> option that is used in debug mode.</p>
<p>See &lt;<a data-is-external-link="true" href="https://godbolt.org/z/zhGv3bjj6" rel="nofollow">https://godbolt.org/z/zhGv3bjj6</a>&gt; for a shortened example. The error message and the comparison (line 8 ) are clearly visible.</p>
<p>I assume what happens is that gfortran stores the actual string length in memory, presumably just before the actual string. With bounds checking enabled, the string length is checked. Cactus never sets up the string length since it just reinterprets pointers, assuming that gfortran’s string layout mimics that of C.</p>
<p>You could define a new type (“struct”) instead of using <code>character*8</code>:</p>
<div class="codehilite language-fortran"><pre><span></span><span class="k">subroutine </span><span class="n">sub</span><span class="p">(</span><span class="n">beta</span><span class="p">)</span>
  <span class="k">implicit none</span>
<span class="k">  type </span><span class="n">empty</span>
  <span class="k">end type</span>
<span class="k">  type</span><span class="p">(</span><span class="n">empty</span><span class="p">)</span> <span class="n">beta</span>
<span class="k">end subroutine </span><span class="n">sub</span>
</pre></div>


<p>However, this wouldn’t allow the <code>kind</code> trick to make the function argument appear used.</p>
<p>--<br/>
Ticket URL: <a href='https://bitbucket.org/einsteintoolkit/tickets/issues/2571/runtime-failure-due-to-useing-character-8'>https://bitbucket.org/einsteintoolkit/tickets/issues/2571/runtime-failure-due-to-useing-character-8</a></p>
</html>