Skip to content

Commit

Permalink
Merge pull request #15763 from ronawho/gcc-10-compat
Browse files Browse the repository at this point in the history
Fix gcc 10 incompatibilities

[reviewed by @gbtitus]

Fix gcc 10 incompatibilities

- Cast some compiler memcpy's to void* to avoid -Werror=class-memaccess
  - gcc 10 is catching more cases, but we ran into this with gcc 9 too.
    See a0904cd for more info.

- Make globals in runtime headers extern
  - GCC 10 made -fno-common the default, and there were a couple places
    where we were relying on -fcommon behavior. Fix this by making our
    declarations in .h files extern and adding the definitions in the .c
    files. See https://gcc.gnu.org/gcc-10/porting_to.html for more info

Resolves #15657
Resolves #15761
  • Loading branch information
ronawho authored and jhoole committed Jun 15, 2020
1 parent aea3d0a commit 79e715e
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 7 deletions.
4 changes: 2 additions & 2 deletions compiler/include/vec.h
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ Vec<C,S>::move_internal(Vec<C,S> &vv) {
i = vv.i;
v = vv.v;
if (vv.v == &vv.e[0]) {
memcpy(e, &vv.e[0], sizeof(e));
memcpy((void*)e, &vv.e[0], sizeof(e));
v = e;
} else
vv.v = 0;
Expand All @@ -331,7 +331,7 @@ Vec<C,S>::copy(const Vec<C,S> &vv) {
n = vv.n;
i = vv.i;
if (vv.v == &vv.e[0]) {
memcpy(e, &vv.e[0], sizeof(e));
memcpy((void*)e, &vv.e[0], sizeof(e));
v = e;
} else {
if (vv.v)
Expand Down
2 changes: 1 addition & 1 deletion runtime/include/chpl-comm-callbacks-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
// }
//

int chpl_comm_callback_counts[chpl_comm_cb_num_event_kinds];
extern int chpl_comm_callback_counts[chpl_comm_cb_num_event_kinds];

static inline
int chpl_comm_have_callbacks(chpl_comm_cb_event_kind_t event_kind) {
Expand Down
4 changes: 2 additions & 2 deletions runtime/include/chpl-comm-diags.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ typedef struct _chpl_atomic_commDiagnostics {
#undef _COMM_DIAGS_DECL_ATOMIC
} chpl_atomic_commDiagnostics;

chpl_atomic_commDiagnostics chpl_comm_diags_counters;
atomic_int_least16_t chpl_comm_diags_disable_flag;
extern chpl_atomic_commDiagnostics chpl_comm_diags_counters;
extern atomic_int_least16_t chpl_comm_diags_disable_flag;

static inline
void chpl_comm_diags_init(void) {
Expand Down
2 changes: 1 addition & 1 deletion runtime/include/chpl-tasks-callbacks-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
// Don't refer to this directly. It's only here in public to support
// reducing overhead by inlining the test for >0.
//
int chpl_task_callback_counts[chpl_task_cb_num_event_kinds];
extern int chpl_task_callback_counts[chpl_task_cb_num_event_kinds];


void chpl_task_do_callbacks_internal(chpl_task_cb_event_kind_t,
Expand Down
3 changes: 3 additions & 0 deletions runtime/src/chpl-comm-diags.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ int chpl_verbose_comm = 0;
int chpl_comm_diagnostics = 0;
int chpl_comm_diags_print_unstable = 0;

atomic_int_least16_t chpl_comm_diags_disable_flag;
chpl_atomic_commDiagnostics chpl_comm_diags_counters;

static pthread_once_t bcastPrintUnstable_once = PTHREAD_ONCE_INIT;


Expand Down
3 changes: 2 additions & 1 deletion runtime/src/chpl-tasks-callbacks.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#include "chpl-tasks-callbacks.h"
#include "chpl-tasks-callbacks-internal.h"


//
// Tasking callback support.
//
Expand All @@ -39,6 +38,8 @@ static struct cb_info {
chpl_task_cb_info_kind_t info_kinds[MAX_CBS_PER_EVENT];
} cb_info[chpl_task_cb_num_event_kinds];

int chpl_task_callback_counts[chpl_task_cb_num_event_kinds] = {0};


//
// Tasking callback support.
Expand Down

0 comments on commit 79e715e

Please sign in to comment.