libAtoms / QUIP

libAtoms/QUIP molecular dynamics framework: https://libatoms.github.io
348 stars 122 forks source link

make libquip.a fails on GCC-14 (darwin_arm64_gfortran) #656

Closed stenczelt closed 3 months ago

stenczelt commented 3 months ago

Problem

I have noticed that I can't build that public branch with gcc-14 on an ARM Mac. Tried on commit 7c428af0fb8b60f73051720c24e9a40ee5484a1c

Compiler & OS versions:

My (unsafe?) patch locally

If I add -Wno-error=return-mismatch to the CFLAGS then this goes away, but compiling everything with that setting may not be the wisest solution. What do you think we should do?

Error log

$make libquip.a                                                                                                                                                                                                                                
Using QUIP_ARCH=darwin_arm64_gfortran, MODULES=libAtoms GAP Potentials Utils, QUIP_ROOT=/Users/tks32/research/castep/opt/QUIP
********************************************

 Making libAtoms 

********************************************
rm -f /Users/tks32/research/castep/opt/QUIP/build/darwin_arm64_gfortran/Makefile
cp /Users/tks32/research/castep/opt/QUIP/src/libAtoms/Makefile /Users/tks32/research/castep/opt/QUIP/build/darwin_arm64_gfortran/Makefile
make -C /Users/tks32/research/castep/opt/QUIP/build/darwin_arm64_gfortran QUIP_ROOT=/Users/tks32/research/castep/opt/QUIP VPATH=/Users/tks32/research/castep/opt/QUIP/src/libAtoms -I/Users/tks32/research/castep/opt/QUIP -I/Users/tks32/research/castep/opt/QUIP/arch
make[1]: Entering directory '/Users/tks32/research/castep/opt/QUIP/build/darwin_arm64_gfortran'
gcc -fPIC -I/Users/tks32/research/castep/opt/QUIP/src/libAtoms -I/Users/tks32/research/castep/opt/QUIP/src/fox/objs.darwin_arm64_gfortran/finclude -O3  -DFORTRAN_UNDERSCORE  -DGETARG_F2003 -DGETENV_F2003 -DGFORTRAN -DDARWIN -fPIC -D'GIT_VERSION="https://github.com/libAtoms/QUIP,7c428af-dirty"' -D'GAP_VERSION=1686220958' -D'QUIP_ARCH="darwin_arm64_gfortran"' -D'SIZEOF_FORTRAN_T=2' -DHAVE_GAP -DHAVE_PRECON -DHAVE_QR  -c /Users/tks32/research/castep/opt/QUIP/src/libAtoms/xyz.c
In file included from /Users/tks32/research/castep/opt/QUIP/src/libAtoms/xyz.c:50:
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/xyz.c: In function 'xyz_find_index':
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/libatoms.h:127:303: error: 'return' with no value, in function returning non-void [-Wreturn-mismatch]
  127 | #define RAISE_ERROR_WITH_KIND(kind, info, ...) sprintf(error_h_info, info, ## __VA_ARGS__ ); error_h_line = __LINE__; error_h_kind = kind; c_push_error_with_info_(error_h_info, __FILE__, &error_h_line, &error_h_kind, strlen(error_h_info), strlen(__FILE__)); if (error != NULL) { *error = error_h_kind; return; } else c_error_abort_(error)
      |                                                                                                                                                                                                                                                                                                               ^~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/xyz.c:180:5: note: in expansion of macro 'RAISE_ERROR_WITH_KIND'
  180 |     RAISE_ERROR_WITH_KIND(ERROR_IO, "Cannot access xyz file %s\n", fname);
      |     ^~~~~~~~~~~~~~~~~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/xyz.c:169:5: note: declared here
  169 | int xyz_find_index(char *fname, char *indexname, int *do_update, int *error) {
      |     ^~~~~~~~~~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/libatoms.h:127:303: error: 'return' with no value, in function returning non-void [-Wreturn-mismatch]
  127 | #define RAISE_ERROR_WITH_KIND(kind, info, ...) sprintf(error_h_info, info, ## __VA_ARGS__ ); error_h_line = __LINE__; error_h_kind = kind; c_push_error_with_info_(error_h_info, __FILE__, &error_h_line, &error_h_kind, strlen(error_h_info), strlen(__FILE__)); if (error != NULL) { *error = error_h_kind; return; } else c_error_abort_(error)
      |                                                                                                                                                                                                                                                                                                               ^~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/xyz.c:203:7: note: in expansion of macro 'RAISE_ERROR_WITH_KIND'
  203 |       RAISE_ERROR_WITH_KIND(ERROR_IO, "Cannot stat xyz file %s\n", fname);
      |       ^~~~~~~~~~~~~~~~~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/xyz.c:169:5: note: declared here
  169 | int xyz_find_index(char *fname, char *indexname, int *do_update, int *error) {
      |     ^~~~~~~~~~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/libatoms.h:127:303: error: 'return' with no value, in function returning non-void [-Wreturn-mismatch]
  127 | #define RAISE_ERROR_WITH_KIND(kind, info, ...) sprintf(error_h_info, info, ## __VA_ARGS__ ); error_h_line = __LINE__; error_h_kind = kind; c_push_error_with_info_(error_h_info, __FILE__, &error_h_line, &error_h_kind, strlen(error_h_info), strlen(__FILE__)); if (error != NULL) { *error = error_h_kind; return; } else c_error_abort_(error)
      |                                                                                                                                                                                                                                                                                                               ^~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/xyz.c:206:7: note: in expansion of macro 'RAISE_ERROR_WITH_KIND'
  206 |       RAISE_ERROR_WITH_KIND(ERROR_IO, "Cannot stat xyz.idx file %s\n", fname);
      |       ^~~~~~~~~~~~~~~~~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/xyz.c:169:5: note: declared here
  169 | int xyz_find_index(char *fname, char *indexname, int *do_update, int *error) {
      |     ^~~~~~~~~~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/xyz.c: In function 'xyz_read_index':
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/libatoms.h:127:303: error: 'return' with no value, in function returning non-void [-Wreturn-mismatch]
  127 | #define RAISE_ERROR_WITH_KIND(kind, info, ...) sprintf(error_h_info, info, ## __VA_ARGS__ ); error_h_line = __LINE__; error_h_kind = kind; c_push_error_with_info_(error_h_info, __FILE__, &error_h_line, &error_h_kind, strlen(error_h_info), strlen(__FILE__)); if (error != NULL) { *error = error_h_kind; return; } else c_error_abort_(error)
      |                                                                                                                                                                                                                                                                                                               ^~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/xyz.c:224:5: note: in expansion of macro 'RAISE_ERROR_WITH_KIND'
  224 |     RAISE_ERROR_WITH_KIND(ERROR_IO, "Index file %s cannot be opened\n", indexname);
      |     ^~~~~~~~~~~~~~~~~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/xyz.c:214:5: note: declared here
  214 | int xyz_read_index(char *indexname, long **frames, int **atoms, int *frames_array_size, int *error) {
      |     ^~~~~~~~~~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/libatoms.h:127:303: error: 'return' with no value, in function returning non-void [-Wreturn-mismatch]
  127 | #define RAISE_ERROR_WITH_KIND(kind, info, ...) sprintf(error_h_info, info, ## __VA_ARGS__ ); error_h_line = __LINE__; error_h_kind = kind; c_push_error_with_info_(error_h_info, __FILE__, &error_h_line, &error_h_kind, strlen(error_h_info), strlen(__FILE__)); if (error != NULL) { *error = error_h_kind; return; } else c_error_abort_(error)
      |                                                                                                                                                                                                                                                                                                               ^~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/xyz.c:227:5: note: in expansion of macro 'RAISE_ERROR_WITH_KIND'
  227 |     RAISE_ERROR_WITH_KIND(ERROR_IO, "Index file %s is empty\n",indexname);
      |     ^~~~~~~~~~~~~~~~~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/xyz.c:214:5: note: declared here
  214 | int xyz_read_index(char *indexname, long **frames, int **atoms, int *frames_array_size, int *error) {
      |     ^~~~~~~~~~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/libatoms.h:127:303: error: 'return' with no value, in function returning non-void [-Wreturn-mismatch]
  127 | #define RAISE_ERROR_WITH_KIND(kind, info, ...) sprintf(error_h_info, info, ## __VA_ARGS__ ); error_h_line = __LINE__; error_h_kind = kind; c_push_error_with_info_(error_h_info, __FILE__, &error_h_line, &error_h_kind, strlen(error_h_info), strlen(__FILE__)); if (error != NULL) { *error = error_h_kind; return; } else c_error_abort_(error)
      |                                                                                                                                                                                                                                                                                                               ^~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/xyz.c:233:7: note: in expansion of macro 'RAISE_ERROR_WITH_KIND'
  233 |       RAISE_ERROR_WITH_KIND(ERROR_IO, "Premature end of indexfile %s\n",indexname);
      |       ^~~~~~~~~~~~~~~~~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/xyz.c:214:5: note: declared here
  214 | int xyz_read_index(char *indexname, long **frames, int **atoms, int *frames_array_size, int *error) {
      |     ^~~~~~~~~~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/xyz.c: In function 'xyz_update_index':
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/libatoms.h:127:303: error: 'return' with no value, in function returning non-void [-Wreturn-mismatch]
  127 | #define RAISE_ERROR_WITH_KIND(kind, info, ...) sprintf(error_h_info, info, ## __VA_ARGS__ ); error_h_line = __LINE__; error_h_kind = kind; c_push_error_with_info_(error_h_info, __FILE__, &error_h_line, &error_h_kind, strlen(error_h_info), strlen(__FILE__)); if (error != NULL) { *error = error_h_kind; return; } else c_error_abort_(error)
      |                                                                                                                                                                                                                                                                                                               ^~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/xyz.c:250:5: note: in expansion of macro 'RAISE_ERROR_WITH_KIND'
  250 |     RAISE_ERROR_WITH_KIND(ERROR_IO, "xyz_update_index: cannot open %s for reading", fname);
      |     ^~~~~~~~~~~~~~~~~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/xyz.c:243:5: note: declared here
  243 | int xyz_update_index(char *fname, char *indexname, long **frames, int **atoms, int *frames_array_size, int nframes, int *error) {
      |     ^~~~~~~~~~~~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/libatoms.h:127:303: error: 'return' with no value, in function returning non-void [-Wreturn-mismatch]
  127 | #define RAISE_ERROR_WITH_KIND(kind, info, ...) sprintf(error_h_info, info, ## __VA_ARGS__ ); error_h_line = __LINE__; error_h_kind = kind; c_push_error_with_info_(error_h_info, __FILE__, &error_h_line, &error_h_kind, strlen(error_h_info), strlen(__FILE__)); if (error != NULL) { *error = error_h_kind; return; } else c_error_abort_(error)
      |                                                                                                                                                                                                                                                                                                               ^~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/xyz.c:281:7: note: in expansion of macro 'RAISE_ERROR_WITH_KIND'
  281 |       RAISE_ERROR_WITH_KIND(ERROR_IO, "xyz_find_frames: malformed XYZ file %s at frame %d\n",fname,nframes);
      |       ^~~~~~~~~~~~~~~~~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/xyz.c:243:5: note: declared here
  243 | int xyz_update_index(char *fname, char *indexname, long **frames, int **atoms, int *frames_array_size, int nframes, int *error) {
      |     ^~~~~~~~~~~~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/xyz.c: In function 'xyz_find_frames':
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/libatoms.h:128:155: error: 'return' with no value, in function returning non-void [-Wreturn-mismatch]
  128 | #define PASS_ERROR if (error != NULL && *error != ERROR_NONE) { error_h_line = __LINE__; c_push_error_(__FILE__, &error_h_line, error, strlen(__FILE__)); return; }
      |                                                                                                                                                           ^~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/xyz.c:346:3: note: in expansion of macro 'PASS_ERROR'
  346 |   PASS_ERROR;
      |   ^~~~~~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/xyz.c:337:5: note: declared here
  337 | int xyz_find_frames(char *fname, long **frames, int **atoms, int *frames_array_size, int *error) {
      |     ^~~~~~~~~~~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/libatoms.h:128:155: error: 'return' with no value, in function returning non-void [-Wreturn-mismatch]
  128 | #define PASS_ERROR if (error != NULL && *error != ERROR_NONE) { error_h_line = __LINE__; c_push_error_(__FILE__, &error_h_line, error, strlen(__FILE__)); return; }
      |                                                                                                                                                           ^~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/xyz.c:351:5: note: in expansion of macro 'PASS_ERROR'
  351 |     PASS_ERROR;
      |     ^~~~~~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/xyz.c:337:5: note: declared here
  337 | int xyz_find_frames(char *fname, long **frames, int **atoms, int *frames_array_size, int *error) {
      |     ^~~~~~~~~~~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/libatoms.h:128:155: error: 'return' with no value, in function returning non-void [-Wreturn-mismatch]
  128 | #define PASS_ERROR if (error != NULL && *error != ERROR_NONE) { error_h_line = __LINE__; c_push_error_(__FILE__, &error_h_line, error, strlen(__FILE__)); return; }
      |                                                                                                                                                           ^~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/xyz.c:356:5: note: in expansion of macro 'PASS_ERROR'
  356 |     PASS_ERROR;
      |     ^~~~~~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/xyz.c:337:5: note: declared here
  337 | int xyz_find_frames(char *fname, long **frames, int **atoms, int *frames_array_size, int *error) {
      |     ^~~~~~~~~~~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/libatoms.h:126:300: error: 'return' with no value, in function returning non-void [-Wreturn-mismatch]
  126 | #define RAISE_ERROR(info, ...) sprintf(error_h_info, info, ## __VA_ARGS__ ); error_h_line = __LINE__; error_h_kind = ERROR_UNSPECIFIED; c_push_error_with_info_(error_h_info, __FILE__, &error_h_line, &error_h_kind, strlen(error_h_info), strlen(__FILE__)); if (error != NULL) { *error = error_h_kind; return; } else c_error_abort_(error)
      |                                                                                                                                                                                                                                                                                                            ^~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/xyz.c:359:7: note: in expansion of macro 'RAISE_ERROR'
  359 |       RAISE_ERROR("xyz_find_frames: empty file!");
      |       ^~~~~~~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/xyz.c:337:5: note: declared here
  337 | int xyz_find_frames(char *fname, long **frames, int **atoms, int *frames_array_size, int *error) {
      |     ^~~~~~~~~~~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/libatoms.h:128:155: error: 'return' with no value, in function returning non-void [-Wreturn-mismatch]
  128 | #define PASS_ERROR if (error != NULL && *error != ERROR_NONE) { error_h_line = __LINE__; c_push_error_(__FILE__, &error_h_line, error, strlen(__FILE__)); return; }
      |                                                                                                                                                           ^~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/xyz.c:363:5: note: in expansion of macro 'PASS_ERROR'
  363 |     PASS_ERROR;
      |     ^~~~~~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/xyz.c:337:5: note: declared here
  337 | int xyz_find_frames(char *fname, long **frames, int **atoms, int *frames_array_size, int *error) {
      |     ^~~~~~~~~~~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/xyz.c: In function 'get_line':
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/libatoms.h:127:303: error: 'return' with no value, in function returning non-void [-Wreturn-mismatch]
  127 | #define RAISE_ERROR_WITH_KIND(kind, info, ...) sprintf(error_h_info, info, ## __VA_ARGS__ ); error_h_line = __LINE__; error_h_kind = kind; c_push_error_with_info_(error_h_info, __FILE__, &error_h_line, &error_h_kind, strlen(error_h_info), strlen(__FILE__)); if (error != NULL) { *error = error_h_kind; return; } else c_error_abort_(error)
      |                                                                                                                                                                                                                                                                                                               ^~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/xyz.c:413:7: note: in expansion of macro 'RAISE_ERROR_WITH_KIND'
  413 |       RAISE_ERROR_WITH_KIND(ERROR_IO_EOF, info);
      |       ^~~~~~~~~~~~~~~~~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/xyz.c:405:7: note: declared here
  405 | char* get_line(char *linebuffer, int string, int string_length, char *orig_stringp, char *stringp, char **prev_stringp,
      |       ^~~~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/libatoms.h:127:303: error: 'return' with no value, in function returning non-void [-Wreturn-mismatch]
  127 | #define RAISE_ERROR_WITH_KIND(kind, info, ...) sprintf(error_h_info, info, ## __VA_ARGS__ ); error_h_line = __LINE__; error_h_kind = kind; c_push_error_with_info_(error_h_info, __FILE__, &error_h_line, &error_h_kind, strlen(error_h_info), strlen(__FILE__)); if (error != NULL) { *error = error_h_kind; return; } else c_error_abort_(error)
      |                                                                                                                                                                                                                                                                                                               ^~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/xyz.c:425:9: note: in expansion of macro 'RAISE_ERROR_WITH_KIND'
  425 |         RAISE_ERROR_WITH_KIND(ERROR_IO, "cannot strip prefix from line <%s>", linebuffer);
      |         ^~~~~~~~~~~~~~~~~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/xyz.c:405:7: note: declared here
  405 | char* get_line(char *linebuffer, int string, int string_length, char *orig_stringp, char *stringp, char **prev_stringp,
      |       ^~~~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/libatoms.h:127:303: error: 'return' with no value, in function returning non-void [-Wreturn-mismatch]
  127 | #define RAISE_ERROR_WITH_KIND(kind, info, ...) sprintf(error_h_info, info, ## __VA_ARGS__ ); error_h_line = __LINE__; error_h_kind = kind; c_push_error_with_info_(error_h_info, __FILE__, &error_h_line, &error_h_kind, strlen(error_h_info), strlen(__FILE__)); if (error != NULL) { *error = error_h_kind; return; } else c_error_abort_(error)
      |                                                                                                                                                                                                                                                                                                               ^~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/xyz.c:431:7: note: in expansion of macro 'RAISE_ERROR_WITH_KIND'
  431 |       RAISE_ERROR_WITH_KIND(ERROR_IO_EOF, info);
      |       ^~~~~~~~~~~~~~~~~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/xyz.c:405:7: note: declared here
  405 | char* get_line(char *linebuffer, int string, int string_length, char *orig_stringp, char *stringp, char **prev_stringp,
      |       ^~~~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/libatoms.h:127:303: error: 'return' with no value, in function returning non-void [-Wreturn-mismatch]
  127 | #define RAISE_ERROR_WITH_KIND(kind, info, ...) sprintf(error_h_info, info, ## __VA_ARGS__ ); error_h_line = __LINE__; error_h_kind = kind; c_push_error_with_info_(error_h_info, __FILE__, &error_h_line, &error_h_kind, strlen(error_h_info), strlen(__FILE__)); if (error != NULL) { *error = error_h_kind; return; } else c_error_abort_(error)
      |                                                                                                                                                                                                                                                                                                               ^~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/xyz.c:438:9: note: in expansion of macro 'RAISE_ERROR_WITH_KIND'
  438 |         RAISE_ERROR_WITH_KIND(ERROR_IO, "cannot strip prefix from line <%s>", linebuffer);
      |         ^~~~~~~~~~~~~~~~~~~~~
/Users/tks32/research/castep/opt/QUIP/src/libAtoms/xyz.c:405:7: note: declared here
  405 | char* get_line(char *linebuffer, int string, int string_length, char *orig_stringp, char *stringp, char **prev_stringp,
      |       ^~~~~~~~
make[1]: *** [Makefile:141: xyz.o] Error 1
make[1]: Leaving directory '/Users/tks32/research/castep/opt/QUIP/build/darwin_arm64_gfortran'
make: *** [Makefile:155: libAtoms] Error 2
~/research/castep/opt/QUIP public +1 !1 ❯                                                                                                                                                                                                                                               05:52:44 pm
jameskermode commented 3 months ago

We should just change those return statements into return 0

stenczelt commented 3 months ago

much appreciated!