Index: uspace/lib/libc/arch/ia64/include/ddi.h
===================================================================
--- uspace/lib/libc/arch/ia64/include/ddi.h	(revision 3149fc05326068309a4f1f7e327f4c0c15cbd733)
+++ uspace/lib/libc/arch/ia64/include/ddi.h	(revision 36e9cd186877d97860a6d53672806bfac213cfa4)
@@ -39,5 +39,5 @@
 #include <libarch/types.h>
 
-#define IO_SPACE_BOUNDARY	(64 * 1024)
+#define IO_SPACE_BOUNDARY	((void *) (64 * 1024))
 
 uint64_t get_ia64_iospace_address(void);
Index: uspace/lib/libc/arch/sparc64/include/ddi.h
===================================================================
--- uspace/lib/libc/arch/sparc64/include/ddi.h	(revision 3149fc05326068309a4f1f7e327f4c0c15cbd733)
+++ uspace/lib/libc/arch/sparc64/include/ddi.h	(revision 36e9cd186877d97860a6d53672806bfac213cfa4)
@@ -37,7 +37,10 @@
 #include <libarch/types.h>
 
-static inline memory_barrier(void)
+static inline void memory_barrier(void)
 {
-	asm volatile ("membar #LoadLoad | #StoreStore\n" ::: "memory");
+	asm volatile (
+		"membar #LoadLoad | #StoreStore\n"
+		::: "memory"
+	);
 }
 
Index: uspace/lib/libc/arch/sparc64/include/fibril.h
===================================================================
--- uspace/lib/libc/arch/sparc64/include/fibril.h	(revision 3149fc05326068309a4f1f7e327f4c0c15cbd733)
+++ uspace/lib/libc/arch/sparc64/include/fibril.h	(revision 36e9cd186877d97860a6d53672806bfac213cfa4)
@@ -48,5 +48,5 @@
 		    STACK_ALIGNMENT) - (STACK_BIAS + SP_DELTA); \
 		(c)->fp = -STACK_BIAS; \
-		(c)->tp = ptls; \
+		(c)->tp = (uint64_t) ptls; \
 	} while (0)
 	
Index: uspace/lib/libc/generic/clipboard.c
===================================================================
--- uspace/lib/libc/generic/clipboard.c	(revision 3149fc05326068309a4f1f7e327f4c0c15cbd733)
+++ uspace/lib/libc/generic/clipboard.c	(revision 36e9cd186877d97860a6d53672806bfac213cfa4)
@@ -148,5 +148,5 @@
 			aid_t req = async_send_1(clip_phone, CLIPBOARD_GET_DATA, tag, NULL);
 			rc = async_data_read_start(clip_phone, (void *) sbuf, size);
-			if (rc == EOVERFLOW) {
+			if ((int) rc == EOVERFLOW) {
 				/*
 				 * The data in the clipboard has changed since
Index: uspace/lib/libc/generic/fibril.c
===================================================================
--- uspace/lib/libc/generic/fibril.c	(revision 3149fc05326068309a4f1f7e327f4c0c15cbd733)
+++ uspace/lib/libc/generic/fibril.c	(revision 36e9cd186877d97860a6d53672806bfac213cfa4)
@@ -41,4 +41,5 @@
 #include <unistd.h>
 #include <stdio.h>
+#include <arch/barrier.h>
 #include <libarch/faddr.h>
 #include <futex.h>
@@ -133,26 +134,27 @@
 int fibril_switch(fibril_switch_type_t stype)
 {
-	fibril_t *srcf, *dstf;
 	int retval = 0;
 	
 	futex_down(&fibril_futex);
-
+	
 	if (stype == FIBRIL_PREEMPT && list_empty(&ready_list))
 		goto ret_0;
-
+	
 	if (stype == FIBRIL_FROM_MANAGER) {
-		if (list_empty(&ready_list) && list_empty(&serialized_list))
+		if ((list_empty(&ready_list)) && (list_empty(&serialized_list)))
 			goto ret_0;
+		
 		/*
 		 * Do not preempt if there is not enough threads to run the
 		 * ready fibrils which are not serialized.
 		 */
-		if (list_empty(&serialized_list) &&
-		    threads_in_manager <= serialized_threads) {
+		if ((list_empty(&serialized_list)) &&
+		    (threads_in_manager <= serialized_threads)) {
 			goto ret_0;
 		}
 	}
+	
 	/* If we are going to manager and none exists, create it */
-	if (stype == FIBRIL_TO_MANAGER || stype == FIBRIL_FROM_DEAD) {
+	if ((stype == FIBRIL_TO_MANAGER) || (stype == FIBRIL_FROM_DEAD)) {
 		while (list_empty(&manager_list)) {
 			futex_up(&fibril_futex);
@@ -162,10 +164,12 @@
 	}
 	
-	srcf = __tcb_get()->fibril_data;
+	fibril_t *srcf = __tcb_get()->fibril_data;
 	if (stype != FIBRIL_FROM_DEAD) {
+		
 		/* Save current state */
 		if (!context_save(&srcf->ctx)) {
 			if (serialization_count)
 				srcf->flags &= ~FIBRIL_SERIALIZED;
+			
 			if (srcf->clean_after_me) {
 				/*
@@ -173,5 +177,5 @@
 				 * restored context here.
 				 */
-				void *stack = srcf->clean_after_me->stack; 
+				void *stack = srcf->clean_after_me->stack;
 				if (stack) {
 					/*
@@ -188,7 +192,8 @@
 				srcf->clean_after_me = NULL;
 			}
+			
 			return 1;	/* futex_up already done here */
 		}
-
+		
 		/* Save myself to the correct run list */
 		if (stype == FIBRIL_PREEMPT)
@@ -197,5 +202,5 @@
 			list_append(&srcf->link, &manager_list);
 			threads_in_manager--;
-		} else {	
+		} else {
 			/*
 			 * If stype == FIBRIL_TO_MANAGER, don't put ourselves to
@@ -206,6 +211,10 @@
 	}
 	
+	/* Avoid srcf being clobbered by context_save() */
+	srcf = __tcb_get()->fibril_data;
+	
 	/* Choose a new fibril to run */
-	if (stype == FIBRIL_TO_MANAGER || stype == FIBRIL_FROM_DEAD) {
+	fibril_t *dstf;
+	if ((stype == FIBRIL_TO_MANAGER) || (stype == FIBRIL_FROM_DEAD)) {
 		dstf = list_get_instance(manager_list.next, fibril_t, link);
 		if (serialization_count && stype == FIBRIL_TO_MANAGER) {
@@ -214,5 +223,5 @@
 		}
 		threads_in_manager++;
-
+		
 		if (stype == FIBRIL_FROM_DEAD) 
 			dstf->clean_after_me = srcf;
@@ -228,9 +237,9 @@
 	}
 	list_remove(&dstf->link);
-
+	
 	futex_up(&fibril_futex);
 	context_restore(&dstf->ctx);
 	/* not reached */
-
+	
 ret_0:
 	futex_up(&fibril_futex);
Index: uspace/lib/libc/generic/ipc.c
===================================================================
--- uspace/lib/libc/generic/ipc.c	(revision 3149fc05326068309a4f1f7e327f4c0c15cbd733)
+++ uspace/lib/libc/generic/ipc.c	(revision 36e9cd186877d97860a6d53672806bfac213cfa4)
@@ -728,10 +728,11 @@
     int *flags)
 {
-	int res;
-	sysarg_t tmp_flags;
-	res = ipc_call_sync_3_2(phoneid, IPC_M_SHARE_IN, (ipcarg_t) dst,
+	sysarg_t tmp_flags = 0;
+	int res = ipc_call_sync_3_2(phoneid, IPC_M_SHARE_IN, (ipcarg_t) dst,
 	    (ipcarg_t) size, arg, NULL, &tmp_flags);
+	
 	if (flags)
 		*flags = tmp_flags;
+	
 	return res;
 }
Index: uspace/lib/libc/include/macros.h
===================================================================
--- uspace/lib/libc/include/macros.h	(revision 3149fc05326068309a4f1f7e327f4c0c15cbd733)
+++ uspace/lib/libc/include/macros.h	(revision 36e9cd186877d97860a6d53672806bfac213cfa4)
@@ -48,6 +48,6 @@
 #define STRING_ARG(arg)  #arg
 
-#define LOWER32(arg)  ((arg) & 0xffffffff)
-#define UPPER32(arg)  (((arg) >> 32) & 0xffffffff)
+#define LOWER32(arg)  (((uint64_t) (arg)) & 0xffffffff)
+#define UPPER32(arg)  (((((uint64_t) arg)) >> 32) & 0xffffffff)
 
 #define MERGE_LOUP32(lo, up) \
