Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pedantic: use of C VLAs is forbidden by ISO C++ #784

Closed
program-- opened this issue Mar 29, 2024 · 0 comments · Fixed by #791
Closed

Pedantic: use of C VLAs is forbidden by ISO C++ #784

program-- opened this issue Mar 29, 2024 · 0 comments · Fixed by #791
Labels
bug Something isn't working

Comments

@program--
Copy link
Contributor

utilities/parallel_utils.h makes use of C VLAs in at least 6 places, as outputted by GCC 13.2.1.

An expedient solution would be to replace VLAs with std::vector.

In file included from src/NGen.cpp:51:
include/utilities/parallel_utils.h: In function ‘void parallel::get_hosts_array(int, int, int*)’:
include/utilities/parallel_utils.h:161:13: error: ISO C++ forbids variable length array ‘actualHostnameCStrLength’ [-Wvla]
  161 |         int actualHostnameCStrLength[mpi_num_procs];
      |             ^~~~~~~~~~~~~~~~~~~~~~~~
include/utilities/parallel_utils.h:178:13: error: ISO C++ forbids variable length array ‘recvDisplacements’ [-Wvla]
  178 |         int recvDisplacements[mpi_num_procs];
      |             ^~~~~~~~~~~~~~~~~
include/utilities/parallel_utils.h:190:14: error: ISO C++ forbids variable length array ‘hostnames’ [-Wvla]
  190 |         char hostnames[totalLength];
      |              ^~~~~~~~~
include/utilities/parallel_utils.h: In function ‘bool parallel::mpi_send_text_file(const char*, int, int)’:
include/utilities/parallel_utils.h:243:14: error: ISO C++ forbids variable length array ‘buf’ [-Wvla]
  243 |         char buf[bufSize];
      |              ^~~
include/utilities/parallel_utils.h: In function ‘bool parallel::mpi_recv_text_file(const char*, int, int)’:
include/utilities/parallel_utils.h:332:14: error: ISO C++ forbids variable length array ‘buf’ [-Wvla]
  332 |         char buf[bufSize];
      |              ^~~
include/utilities/parallel_utils.h: In function ‘bool parallel::subdivide_hydrofabric(int, int, const std::string&, const std::string&, const std::string&)’:
include/utilities/parallel_utils.h:525:17: error: ISO C++ forbids variable length array ‘hostIdForRank’ [-Wvla]
  525 |             int hostIdForRank[mpi_num_procs];
      |                 ^~~~~~~~~~~~~
@program-- program-- added the bug Something isn't working label Mar 29, 2024
program-- added a commit to program--/ngen that referenced this issue Apr 8, 2024
@program-- program-- mentioned this issue Apr 8, 2024
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant