diff --git a/NEWS b/NEWS
index e85bfbc0efdca109ed774fd147aa4768aec2ab5f..d82448346385a6567847ab0d52021ee03e8fce4c 100644
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,7 @@ documents those changes that are of interest to users and admins.
  -- Remove vestigial node_use (virtual or coprocessor) field from job
     request RPC.
  -- Fix mpich-gm bugs, thanks to Takao Hatazaki (HP).
+ -- Fix code for clean build with gcc 2.96, Takao Hatazaki (HP).
 
 * Changes in SLURM 0.6.0-pre2
 =============================
diff --git a/src/plugins/jobacct/log/jobacct_log.c b/src/plugins/jobacct/log/jobacct_log.c
index ef8cb2ba05d63967910153b6fd09af95440a9814..2501f821fb3e464c8198026daadfe08bd0ea7bee 100644
--- a/src/plugins/jobacct/log/jobacct_log.c
+++ b/src/plugins/jobacct/log/jobacct_log.c
@@ -855,11 +855,12 @@ static _jrec_t  *_alloc_jrec(slurmd_job_t *job)
 static _jrec_t *_get_jrec_by_jobstep(List jrecs, uint32_t jobid,
 		uint32_t stepid) {
 	_jrec_t *jrec = NULL;
+	ListIterator i;
 	if (jrecs==NULL) {
 		error("no accounting job list");
 		return jrec;
 	}
-	ListIterator i = list_iterator_create(jrecs);
+	i = list_iterator_create(jrecs);
 	while ((jrec = list_next(i))) {
 		if ( (jrec->jobid == jobid ) && (jrec->stepid == stepid)) {
 			break;
diff --git a/src/plugins/select/cons_res/select_cons_res.c b/src/plugins/select/cons_res/select_cons_res.c
index aec8f5aed2d7b830a6bb41c7072d31fae8981eeb..875bd594a99a81de8a080b96426036e1fa402efa 100644
--- a/src/plugins/select/cons_res/select_cons_res.c
+++ b/src/plugins/select/cons_res/select_cons_res.c
@@ -270,9 +270,10 @@ static int _count_cr_cpus(unsigned *bitmap, int sum)
 	sum = 0;
 
 	for (i = 0; i < node_record_count; i++) {
+		int allocated_cpus;
 		if (bit_test(bitmap, i) != 1)
 			continue;
-		int allocated_cpus = 0;
+		allocated_cpus = 0;
 		rc = select_g_get_select_nodeinfo(&node_record_table_ptr
 						  [i], SELECT_CR_USED_CPUS,
 						  &allocated_cpus);
@@ -303,6 +304,7 @@ static int _synchronize_bitmaps(bitstr_t ** partially_idle_bitmap)
 	       bit_size(avail_node_bitmap), bit_size(idle_node_bitmap));
 
 	for (i = 0; i < node_record_count; i++) {
+		int allocated_cpus;
 		if (bit_test(avail_node_bitmap, i) != 1)
 			continue;
 
@@ -311,7 +313,7 @@ static int _synchronize_bitmaps(bitstr_t ** partially_idle_bitmap)
 			continue;
 		}
 
-		int allocated_cpus = 0;
+		allocated_cpus = 0;
 		rc = select_g_get_select_nodeinfo(&node_record_table_ptr
 						  [i], SELECT_CR_USED_CPUS,
 						  &allocated_cpus);
@@ -340,6 +342,8 @@ static int _clear_select_jobinfo(struct job_record *job_ptr)
 {
 	int rc = SLURM_SUCCESS, i, j;
 	struct select_cr_job *job = NULL;
+	int job_id;
+	ListIterator iterator;
 
 	xassert(job_ptr);
 	xassert(job_ptr->magic == JOB_MAGIC);
@@ -347,8 +351,8 @@ static int _clear_select_jobinfo(struct job_record *job_ptr)
 	if (list_count(select_cr_job_list) == 0)
 		return rc;
 
-	int job_id = job_ptr->job_id;
-	ListIterator iterator = list_iterator_create(select_cr_job_list);
+	job_id = job_ptr->job_id;
+	iterator = list_iterator_create(select_cr_job_list);
 	while ((job =
 		(struct select_cr_job *) list_next(iterator)) != NULL) {
 		if (job->job_id != job_id)
@@ -559,9 +563,10 @@ extern int select_p_job_test(struct job_record *job_ptr, bitstr_t * bitmap,
 		rem_nodes = min_nodes;
 	for (index = 0; index < select_node_cnt; index++) {
 		if (bit_test(bitmap, index)) {
+			int allocated_cpus;
 			if (consec_nodes[consec_index] == 0)
 				consec_start[consec_index] = index;
-			int allocated_cpus = 0;
+			allocated_cpus = 0;
 			if (cr_enabled) {
 				error_code =
 				    select_g_get_select_nodeinfo
@@ -660,13 +665,14 @@ extern int select_p_job_test(struct job_record *job_ptr, bitstr_t * bitmap,
 			 * then down from the required nodes */
 			for (i = best_fit_req;
 			     i <= consec_end[best_fit_location]; i++) {
+				int allocated_cpus;
 				if ((rem_nodes <= 0) && (rem_cpus <= 0))
 					break;
 				if (bit_test(bitmap, i))
 					continue;
 				bit_set(bitmap, i);
 				rem_nodes--;
-				int allocated_cpus = 0;
+				allocated_cpus = 0;
 				if (cr_enabled) {
 					error_code =
 					    select_g_get_select_nodeinfo
@@ -688,6 +694,7 @@ extern int select_p_job_test(struct job_record *job_ptr, bitstr_t * bitmap,
 			}
 			for (i = (best_fit_req - 1);
 			     i >= consec_start[best_fit_location]; i--) {
+				int allocated_cpus;
 				if ((rem_nodes <= 0) && (rem_cpus <= 0))
 					break;
 				/* if (bit_test(bitmap, i)) 
@@ -695,7 +702,7 @@ extern int select_p_job_test(struct job_record *job_ptr, bitstr_t * bitmap,
 				bit_set(bitmap, i);
 				rem_nodes--;
 
-				int allocated_cpus = 0;
+				allocated_cpus = 0;
 				if (cr_enabled) {
 					error_code =
 					    select_g_get_select_nodeinfo
@@ -719,6 +726,7 @@ extern int select_p_job_test(struct job_record *job_ptr, bitstr_t * bitmap,
 		} else {
 			for (i = consec_start[best_fit_location];
 			     i <= consec_end[best_fit_location]; i++) {
+				int allocated_cpus;
 				if ((rem_nodes <= 0) && (rem_cpus <= 0))
 					break;
 				if (bit_test(bitmap, i))
@@ -726,7 +734,7 @@ extern int select_p_job_test(struct job_record *job_ptr, bitstr_t * bitmap,
 				bit_set(bitmap, i);
 				rem_nodes--;
 
-				int allocated_cpus = 0;
+				allocated_cpus = 0;
 				if (cr_enabled) {
 					error_code =
 					    select_g_get_select_nodeinfo
@@ -766,15 +774,17 @@ extern int select_p_job_test(struct job_record *job_ptr, bitstr_t * bitmap,
 		goto cleanup;
 
 	if (cr_enabled) {
+		int jobid, job_nodecnt, j;
+		bitoff_t size;
 		static struct select_cr_job *job;
 		job = xmalloc(sizeof(struct select_cr_job));
-		int jobid = job_ptr->job_id;
+		jobid = job_ptr->job_id;
 		job->job_id = jobid;
-		int job_nodecnt = bit_set_count(bitmap);
+		job_nodecnt = bit_set_count(bitmap);
 		job->nhosts = job_nodecnt;
 		job->nprocs = job_ptr->num_procs;
 
-		bitoff_t size = bit_size(bitmap);
+		size = bit_size(bitmap);
 		job->node_bitmap = (bitstr_t *) bit_alloc(size);
 		if (job->node_bitmap == NULL)
 			fatal("bit_alloc malloc failure");
@@ -788,7 +798,7 @@ extern int select_p_job_test(struct job_record *job_ptr, bitstr_t * bitmap,
 		    (char **) xmalloc(job->nhosts * sizeof(char *));
 		job->cpus = (int *) xmalloc(job->nhosts * sizeof(int));
 
-		int j = 0;
+		j = 0;
 		for (i = 0; i < node_record_count; i++) {
 			if (bit_test(bitmap, i) == 0)
 				continue;
diff --git a/src/sacct/sacct.c b/src/sacct/sacct.c
index f52d60d81ecd1e797adf22485863beb88f089915..7d41a45111a30ffd910a54160baeac1143b06df0 100644
--- a/src/sacct/sacct.c
+++ b/src/sacct/sacct.c
@@ -1234,9 +1234,6 @@ void getOptions(int argc, char **argv)
 	int c, i, optionIndex = 0;
 	char *end, *start, *acct_type;
 	struct stat stat_buf;
-
-	if ((i=getuid()))	/* default to current user unless root*/
-		opt_uid = i;
 	static struct option long_options[] = {
 		{"all", 0,0, 'a'},
 		{"brief", 0, 0, 'b'},
@@ -1266,6 +1263,9 @@ void getOptions(int argc, char **argv)
 		{0, 0, 0, 0}
 	};
 
+	if ((i=getuid()))	/* default to current user unless root*/
+		opt_uid = i;
+
 	opterr = 1;		/* Let getopt report problems to the user */
 
 	while (1) {		/* now cycle through the command line */
diff --git a/src/slurmctld/node_scheduler.c b/src/slurmctld/node_scheduler.c
index 5088997fe319765396d45bfd7105848fa63b6b9e..9adbe0a69a2934bf2ba4aff0ba66c2233cd2a22a 100644
--- a/src/slurmctld/node_scheduler.c
+++ b/src/slurmctld/node_scheduler.c
@@ -696,9 +696,10 @@ _add_node_set_info(struct node_set *node_set_ptr,
                 *cpu_cnt  += node_set_ptr->nodes * node_set_ptr->cpus_per_node;
         } else {
                 for (i = 0; i < node_record_count; i++) {
+                        int allocated_cpus;
                         if (bit_test (node_set_ptr->my_bitmap, i) == 0)
                           continue;
-                        int allocated_cpus = 0;
+                        allocated_cpus = 0;
                         error_code = select_g_get_select_nodeinfo(&node_record_table_ptr[i], 
                                                                 SELECT_CR_USED_CPUS, 
                                                                 &allocated_cpus);