Skip to content

Commit

Permalink
Silence stringop overread warning
Browse files Browse the repository at this point in the history
GCC 11.2 differentiates between TYPE* abc and TYPE abc[]
(cf. pmodels/mpich#5749). Therefore, we use
the explicit pointer declaration to silence string overread warnings
for GCC 11.2.
  • Loading branch information
tim-griesbach committed Sep 29, 2022
1 parent 41d47e2 commit f8cb274
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions src/p4est_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ static int p4est_file_error_code (int errcode, int *p4est_errcode);

p4est_file_context_t *
p4est_file_open_create (p4est_t * p4est, const char *filename,
const char user_string[P4EST_FILE_USER_STRING_BYTES],
const char* user_string,
int *errcode)
{
int mpiret, count, count_error, mpisize;
Expand Down Expand Up @@ -795,7 +795,7 @@ p4est_file_open_read (p4est_t * p4est, const char *filename,
p4est_file_context_t *
p4est_file_write_header (p4est_file_context_t * fc, size_t header_size,
const void *header_data,
const char user_string[P4EST_FILE_USER_STRING_BYTES],
const char* user_string,
int *errcode)
{
size_t num_pad_bytes;
Expand Down Expand Up @@ -1167,7 +1167,7 @@ p4est_file_read_header (p4est_file_context_t * fc,

p4est_file_context_t *
p4est_file_write_field (p4est_file_context_t * fc, sc_array_t * quadrant_data,
const char user_string[P4EST_FILE_USER_STRING_BYTES],
const char* user_string,
int *errcode)
{
size_t bytes_to_write, num_pad_bytes, array_size;
Expand Down
10 changes: 5 additions & 5 deletions src/p4est_io.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ p4est_file_error_t;
*/
p4est_file_context_t *p4est_file_open_create
(p4est_t * p4est, const char *filename,
const char user_string[P4EST_FILE_USER_STRING_BYTES], int *errcode);
const char* user_string, int *errcode);

/** Open a file for reading and read its user string on rank zero.
* The user string is broadcasted to all ranks after reading.
Expand Down Expand Up @@ -290,9 +290,9 @@ p4est_file_context_t *p4est_file_open_read (p4est_t * p4est,
p4est_file_context_t *p4est_file_write_header (p4est_file_context_t * fc,
size_t header_size,
const void *header_data,
const char
const char*
user_string
[P4EST_FILE_USER_STRING_BYTES],
,
int *errcode);

/** Read a header block from an opened file.
Expand Down Expand Up @@ -386,9 +386,9 @@ p4est_file_context_t *p4est_file_read_header (p4est_file_context_t * fc,
*/
p4est_file_context_t *p4est_file_write_field (p4est_file_context_t * fc,
sc_array_t * quadrant_data,
const char
const char*
user_string
[P4EST_FILE_USER_STRING_BYTES],
,
int *errcode);

/** Read one (more) per-quadrant data set from a parallel input file.
Expand Down
10 changes: 5 additions & 5 deletions src/p8est_io.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ p8est_file_error_t;
*/
p8est_file_context_t *p8est_file_open_create
(p8est_t * p8est, const char *filename,
const char user_string[P8EST_FILE_USER_STRING_BYTES], int *errcode);
const char* user_string, int *errcode);

/** Open a file for reading and read its user string on rank zero.
* The user string is broadcasted to all ranks after reading.
Expand Down Expand Up @@ -290,9 +290,9 @@ p8est_file_context_t *p8est_file_open_read (p8est_t * p8est,
p8est_file_context_t *p8est_file_write_header (p8est_file_context_t * fc,
size_t header_size,
const void *header_data,
const char
const char*
user_string
[P8EST_FILE_USER_STRING_BYTES],
,
int *errcode);

/** Read a header block from an opened file.
Expand Down Expand Up @@ -386,9 +386,9 @@ p8est_file_context_t *p8est_file_read_header (p8est_file_context_t * fc,
*/
p8est_file_context_t *p8est_file_write_field (p8est_file_context_t * fc,
sc_array_t * quadrant_data,
const char
const char*
user_string
[P8EST_FILE_USER_STRING_BYTES],
,
int *errcode);

/** Read one (more) per-quadrant data set from a parallel input file.
Expand Down

0 comments on commit f8cb274

Please sign in to comment.