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

Compile time error with GCC 11.3 (and most probably all other GCC versions) #60

Open
robert-mijakovic opened this issue Nov 7, 2024 · 2 comments

Comments

@robert-mijakovic
Copy link

robert-mijakovic commented Nov 7, 2024

Hi guys,

I tried to compile IMB with GCC 11.3 and link it against Intel MPI, however, it failed in the process.
Basically, the issue is with a fixed size string array (aux_string) that is insufficiently long to store a warning.
Ironically, it is supposed to show a message on an overflow, and is too large to fit into the string size.
The array is defined as:
#define out_fields 8;
#define ow_format 13;
extern char aux_string[out_fieldsow_format];
Meaning it is defined as an up to a 104 byte long message.
The message itself is 106 bytes long and needs an extra byte for null termination of a string (107 bytes).

It is guarded with a MPI1 pragma but I don't understand why it actually took that path.

I guess, this should be fixed.

Best regards,
Robert

@JuliaRS
Copy link
Contributor

JuliaRS commented Nov 7, 2024

@robert-mijakovic Thank you for your request, what warning IMB try to throw?
Do you mean this piece of code

#define ow_format 13
?

@robert-mijakovic
Copy link
Author

../src_c/IMB_output.c:346:152: error: ' int-overflow; The productio...' directive writing 106 bytes into a region of size 104 [-Werror=format-overflow=]
  346 |                 sprintf(aux_string + offset, " int-overflow; The production rank*size caused int overflow for given sample; use flag \"-data_type double\"");
      |                                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
../src_c/IMB_output.c:346:17: note: 'sprintf' output 107 bytes into a destination of size 104
  346 |                 sprintf(aux_string + offset, " int-overflow; The production rank*size caused int overflow for given sample; use flag \"-data_type double\"");
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants