Encoding of files generated by f2py-f90wrap
bputigny opened this issue · comments
Hello,
I have an issue with f2py-f90wrap
wrapper script: files generated by this script do not seem to have the correct encoding. It results in the following error when they get compiled:
PGC-S-0024-Illegal character constant (/tmp/tmpy0fk3koa/src.linux-ppc64le-3.7/_pymylibmodule.c: 37)
The code section causing the issue is the following:
void f90wrap_abort_(char *message, int len_message)
{
strncpy(abort_message, message, len_message);
abort_message[len_message] = '^@';
longjmp(environment_buffer, 0);
}
I don't know how this ^@
got here... Since in the f2py-f90wrap
script it is a regular \0
that is inserted. Anyway I managed to have things working as expected by replacing the '\0'
by a simple 0
(line 88 and 97 of f2py-f90wrap
).
I believe this is an encoding error:
$ file /tmp/tmpy0fk3koa/src.linux-ppc64le-3.7/_pymylibmodule.c
/tmp/tmpy0fk3koa/src.linux-ppc64le-3.7/_pymylibmodule.c: data
But other generated files seems to have the correct encoding:
file f90wrap_m_scalar_field.f90
f90wrap_m_scalar_field.f90: ASCII text
I am using:
- PGI compiler for C and Fortran (version 19.9-0)
- numpy 1.18.2
- f90wrap v0.2.2
Do you have any idea where things can go wrong?
Best,
Bertrand
Thanks for reporting, I agree this looks like an encoding error. I'll see if I can reproduce.