#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> 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:

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