[Users] GCC 8 -- may need to update Cactus configure script

Roland Haas rhaas at illinois.edu
Wed May 2 11:45:55 CDT 2018


Hello all,

thank you for noticing this!

> In other words, strings can now be longer than 2e9 characters. This is
> a good change. To make this possible, the length of strings is now
> passed as ptrdiff_t instead of as int, and consequently, the C/Fortran
> interoperability mechanism in Cactus may need to be updated. Without
> this, there might be a segfault e.g. when calling CCTK_INFO from
> Fortran. (It might also be that things just work most of the time,
> although this would be an unreliable coincidence.)
I expect that they (unfortunately) probably work most of the time since
on a little endian machine (ie a Intel sytem) both a ptrdiff_t and an
int will have the same first 4 bytes on the stack (and likely the next
four bytes are zero given that zero is the most common value for any
byte) and the string length is the last argument on the stack so its
incorrect size is not visible due to eg other arguments having the
wrong location.

Something similar to this happened before when we forgot to
properly declare strdup() in code which led to it being implicitly
declared to return an int which is then cast to char* which actually
often worked (namely whenever the returned address what less than 2GB).

So we need to carefully check the Cactus code to see what it assumes
about the string passing convention.

Yours,
Roland

-- 
My email is as private as my paper mail. I therefore support encrypting
and signing email messages. Get my PGP key from http://pgp.mit.edu .
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
Url : http://lists.einsteintoolkit.org/pipermail/users/attachments/20180502/f0f4b4b7/attachment-0001.bin 


More information about the Users mailing list