[ET Trac] #2571: runtime failure due to useing character*8 in DECLARE_CCTK_ARGUMENTS_CHECKED macro

Erik Schnetter trac-noreply at einsteintoolkit.org
Thu Oct 21 11:35:00 CDT 2021


#2571: runtime failure due to useing character*8 in DECLARE_CCTK_ARGUMENTS_CHECKED macro

 Reporter: Roland Haas
   Status: new
Milestone: 
  Version: development version
     Type: bug
 Priority: major
Component: Cactus

Comment (by Erik Schnetter):

The problem is caused by bounds checking, in particular the `-fcheck=bounds` option that is used in debug mode.

See <[https://godbolt.org/z/zhGv3bjj6](https://godbolt.org/z/zhGv3bjj6)> for a shortened example. The error message and the comparison \(line 8 \) are clearly visible.

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.

You could define a new type \(“struct”\) instead of using `character*8`:

```fortran
subroutine sub(beta)
  implicit none
  type empty
  end type
  type(empty) beta
end subroutine sub
```

However, this wouldn’t allow the `kind` trick to make the function argument appear used.

--
Ticket URL: https://bitbucket.org/einsteintoolkit/tickets/issues/2571/runtime-failure-due-to-useing-character-8
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.einsteintoolkit.org/pipermail/trac/attachments/20211021/6abde22f/attachment.html 


More information about the Trac mailing list