diff --git a/src/common/callerid.c b/src/common/callerid.c
index e0b24854223b356a0a9b78f65e4d340f6da6ad49..734ba2dc170daf248e20ccefe927956a85197105 100644
--- a/src/common/callerid.c
+++ b/src/common/callerid.c
@@ -113,7 +113,7 @@ static int _match_conn(callerid_conn_t *conn_search, ino_t *inode_result,
 	   )
 		return SLURM_FAILURE;
 
-	debug3("_match_conn matched inode %lu", (ino_t)inode_row);
+	debug3("_match_conn matched inode %lu", (long unsigned int)inode_row);
 	*inode_result = inode_row;
 	return SLURM_SUCCESS;
 }
@@ -154,7 +154,7 @@ static int _find_match_in_tcp_file(
 
 	while( fgets(line, 1024, fp) != NULL ) {
 		matches = sscanf(line,
-			"%*s %[0-9A-Z]:%x %[0-9A-Z]:%x %*s %*s %*s %*s %*s %*s %lu",
+			"%*s %[0-9A-Z]:%x %[0-9A-Z]:%x %*s %*s %*s %*s %*s %*s %"PRIu64"",
 			ip_dst_str, &conn_row.port_dst, ip_src_str,
 			&conn_row.port_src, &inode_row);
 
@@ -189,9 +189,9 @@ static int _find_match_in_tcp_file(
 					INET6_ADDRSTRLEN);
 			inet_ntop(af, &conn->ip_dst, ip_dst_str,
 					INET6_ADDRSTRLEN);
-			debug("network_callerid matched %s:%d => %s:%d with inode %lu",
-					ip_src_str, conn->port_src, ip_dst_str,
-					conn->port_dst, (ino_t)inode);
+			debug("network_callerid matched %s:%lu => %s:%lu with inode %lu",
+			      ip_src_str, conn->port_src, ip_dst_str,
+			      conn->port_dst, (long unsigned int)inode);
 			break;
 		}
 	}
@@ -245,7 +245,7 @@ static int _find_inode_in_fddir(pid_t pid, ino_t inode)
 			continue;
 		if (statbuf.st_ino == inode) {
 			debug3("_find_inode_in_fddir: found %lu at %s",
-					(ino_t)inode, fdpath);
+			       (long unsigned int)inode, fdpath);
 			rc = SLURM_SUCCESS;
 			break;
 		}
diff --git a/src/plugins/jobcomp/elasticsearch/jobcomp_elasticsearch.c b/src/plugins/jobcomp/elasticsearch/jobcomp_elasticsearch.c
index b442a521bc76043b1c37039b3bd075731408c2e5..eec15c94067dd74371d60e570b42b2ab18074e84 100644
--- a/src/plugins/jobcomp/elasticsearch/jobcomp_elasticsearch.c
+++ b/src/plugins/jobcomp/elasticsearch/jobcomp_elasticsearch.c
@@ -363,7 +363,7 @@ static int _index_job(const char *jobcomp)
 			} else {
 				token = strtok(NULL, " ");
 				if ((xstrcmp(token, "100") == 0)) {
-					token = strtok(NULL, " ");
+					(void)  strtok(NULL, " ");
 					token = strtok(NULL, " ");
 				}
 				if ((xstrcmp(token, "200") != 0)
@@ -377,7 +377,7 @@ static int _index_job(const char *jobcomp)
 					rc = SLURM_ERROR;
 				} else {
 					token = strtok((char *)jobcomp, ",");
-					token = strtok(token, ":");
+					(void)  strtok(token, ":");
 					token = strtok(NULL, ":");
 					debug("Jobcomp data related to jobid %s"
 					      " indexed into elasticsearch",
@@ -476,7 +476,7 @@ static int _save_state(void)
 		      new_file);
 		rc = SLURM_ERROR;
 	} else {
-		int pos = 0, nwrite, amount;
+		int pos = 0, nwrite, amount, rc2;
 		char *data;
 		fd_set_close_on_exec(fd);
 		nwrite = get_buf_offset(buffer);
@@ -492,7 +492,8 @@ static int _save_state(void)
 			nwrite -= amount;
 			pos += amount;
 		}
-		rc = fsync_and_close(fd, save_state_file);
+		if ((rc2 = fsync_and_close(fd, save_state_file)))
+			rc = rc2;
 	}
 
 	if (rc == SLURM_ERROR)
@@ -685,7 +686,7 @@ extern int slurm_jobcomp_log_record(struct job_record *job_ptr)
 {
 	int nwritten, nparents, B_SIZE = 1024, rc = SLURM_SUCCESS;
 	char usr_str[32], grp_str[32], start_str[32], end_str[32];
-	char submit_str[32], *script, *cluster, *qos, *state_string;
+	char submit_str[32], *script, *cluster = NULL, *qos, *state_string;
 	char *script_str;
 	char *parent_accounts;
 	char **acc_aux;
diff --git a/src/plugins/select/cons_res/job_test.c b/src/plugins/select/cons_res/job_test.c
index 0c12061354af82a9c0c12e32955475c1eb3cef5f..8e6aab5cb862e802dae294a65a6075fe94e70129 100644
--- a/src/plugins/select/cons_res/job_test.c
+++ b/src/plugins/select/cons_res/job_test.c
@@ -2177,7 +2177,7 @@ static int _eval_nodes_dfly(struct job_record *job_ptr, bitstr_t *bitmap,
 	int i, j, rc = SLURM_SUCCESS;
 	int best_fit_inx, first, last;
 	int best_fit_nodes, best_fit_cpus;
-	int best_fit_location = 0, best_fit_sufficient;
+	int best_fit_location = 0;
 	bool sufficient;
 	long time_waiting = 0;
 	int req_switch_cnt = 0;
@@ -2416,7 +2416,7 @@ static int _eval_nodes_dfly(struct job_record *job_ptr, bitstr_t *bitmap,
 	/* Select resources from leafs on a best-fit or round-robin basis */
 	while ((max_nodes > 0) && ((rem_nodes > 0) || (rem_cpus > 0))) {
 		int *cpus_array = NULL, array_len;
-		best_fit_cpus = best_fit_nodes = best_fit_sufficient = 0;
+		best_fit_cpus = best_fit_nodes = 0;
 		for (j = 0; j < switch_record_cnt; j++) {
 			if (switches_node_cnt[j] == 0)
 				continue;
@@ -2435,7 +2435,6 @@ static int _eval_nodes_dfly(struct job_record *job_ptr, bitstr_t *bitmap,
 				best_fit_cpus =  switches_cpu_cnt[j];
 				best_fit_nodes = switches_node_cnt[j];
 				best_fit_location = j;
-				best_fit_sufficient = sufficient;
 			}
 		}
 
diff --git a/src/plugins/select/linear/select_linear.c b/src/plugins/select/linear/select_linear.c
index d8fd78c598b9ac97174a169af58023728215c382..5af3eeb13ab45cc7ce5747a589ee609af55018f1 100644
--- a/src/plugins/select/linear/select_linear.c
+++ b/src/plugins/select/linear/select_linear.c
@@ -1662,7 +1662,7 @@ static int _job_test_dfly(struct job_record *job_ptr, bitstr_t *bitmap,
 	int i, j, rc = SLURM_SUCCESS;
 	int best_fit_inx, first, last;
 	int best_fit_nodes, best_fit_cpus;
-	int best_fit_location = 0, best_fit_sufficient;
+	int best_fit_location = 0;
 	bool sufficient;
 	long time_waiting = 0;
 	int leaf_switch_count = 0;	/* Count of leaf node switches used */
@@ -1844,8 +1844,7 @@ static int _job_test_dfly(struct job_record *job_ptr, bitstr_t *bitmap,
 	/* Select resources from leafs on a best-fit or round-robin basis */
 	while ((alloc_nodes <= max_nodes) &&
 	       ((alloc_nodes < want_nodes) || (rem_cpus > 0))) {
-		best_fit_cpus = best_fit_nodes = best_fit_sufficient = 0;
-		i = min_nodes - alloc_nodes; /* use it as a temp. int */
+		best_fit_cpus = best_fit_nodes = 0;
 		for (j = 0; j < switch_record_cnt; j++) {
 			if (switches_node_cnt[j] == 0)
 				continue;
@@ -1863,7 +1862,6 @@ static int _job_test_dfly(struct job_record *job_ptr, bitstr_t *bitmap,
 				best_fit_cpus =  switches_cpu_cnt[j];
 				best_fit_nodes = switches_node_cnt[j];
 				best_fit_location = j;
-				best_fit_sufficient = sufficient;
 			}
 		}
 #if SELECT_DEBUG
@@ -2192,8 +2190,7 @@ static int _job_test_topo(struct job_record *job_ptr, bitstr_t *bitmap,
 	/* Compute best-switch nodes available array */
 	while ((alloc_nodes <= max_nodes) &&
 	       ((alloc_nodes < want_nodes) || (rem_cpus > 0))) {
-		best_fit_cpus = best_fit_nodes = best_fit_sufficient = 0;
-		i = min_nodes - alloc_nodes; /* use it as a temp. int */
+		best_fit_cpus = best_fit_nodes = 0;
 		for (j=0; j<switch_record_cnt; j++) {
 			if (switches_node_cnt[j] == 0)
 				continue;
@@ -2209,7 +2206,6 @@ static int _job_test_topo(struct job_record *job_ptr, bitstr_t *bitmap,
 				best_fit_cpus =  switches_cpu_cnt[j];
 				best_fit_nodes = switches_node_cnt[j];
 				best_fit_location = j;
-				best_fit_sufficient = sufficient;
 			}
 		}
 #if SELECT_DEBUG
diff --git a/src/plugins/task/cgroup/task_cgroup_cpuset.c b/src/plugins/task/cgroup/task_cgroup_cpuset.c
index fb1acd31042707d0f82a0b2dd27a684d85f3f388..65ef49c4943988ab12fffebc1922e82f9b6a42ac 100644
--- a/src/plugins/task/cgroup/task_cgroup_cpuset.c
+++ b/src/plugins/task/cgroup/task_cgroup_cpuset.c
@@ -689,7 +689,6 @@ static int _task_cgroup_cpuset_dist_cyclic(
 				}
 			}
 		}
-		s = 0;
 		if (hwtype == HWLOC_OBJ_PU) {
 			for (i = 0; i <= ntskip && i < npus; i++) {
 				if (bit_test(spec_threads, i))
@@ -802,7 +801,8 @@ static int _task_cgroup_cpuset_dist_block(
 	hwdepth = hwloc_get_type_depth(topology, hwtype);
 	if ((job->job_core_spec != (uint16_t) NO_VAL) &&
 	    (job->job_core_spec &  CORE_SPEC_THREAD)  &&
-	    (job->job_core_spec != CORE_SPEC_THREAD)){
+	    (job->job_core_spec != CORE_SPEC_THREAD)  &&
+	    (cores != 0) && (nsockets != 0)) {
 		/* Skip specialized threads as needed */
 		int i, t, c, s;
 		int cores = ncores / nsockets;
@@ -822,7 +822,6 @@ static int _task_cgroup_cpuset_dist_block(
 				}
 			}
 		}
-		s = 0;
 		if (hwtype == HWLOC_OBJ_PU) {
 			for (i = 0; i <= pfirst && i < npus; i++) {
 				if (bit_test(spec_threads, i))
diff --git a/src/slurmd/slurmd/req.c b/src/slurmd/slurmd/req.c
index 1520623492eecca9af7e0f9c1878636235d8617b..4df09052be1b97286aa024aaacedb31206e01dd2 100644
--- a/src/slurmd/slurmd/req.c
+++ b/src/slurmd/slurmd/req.c
@@ -2788,7 +2788,7 @@ _callerid_find_job(callerid_conn_t conn, uint32_t *job_id)
 		debug3("network_callerid inode not found");
 		return ESLURM_INVALID_JOB_ID;
 	}
-	debug3("network_callerid found inode %lu", (ino_t)inode);
+	debug3("network_callerid found inode %lu", (long unsigned int)inode);
 
 	rc = find_pid_by_inode(&pid, inode);
 	if (rc != SLURM_SUCCESS) {