possible signedness issue in aic7xxx

Alexander Best arundel at freebsd.org
Fri Apr 6 10:47:13 UTC 2012


hi there,

i noticed the following worning from clang when building HEAD:

===> sys/modules/aic7xxx/aicasm (obj,build-tools)
/usr/github-freebsd-head/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm.c:604:5: warning: passing 'int *' to parameter of type 'unsigned int *' converts between pointers to integer types with different sign [-Wpointer-sign]
                                &skip_addr, func_values) == 0) {
                                ^~~~~~~~~~
/usr/github-freebsd-head/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm.c:83:24: note: passing argument to parameter 'skip_addr' here
                       unsigned int *skip_addr, int *func_vals);
                                     ^
1 warning generated.

will the attached patch take care of the problem?

cheers.
alex
-------------- next part --------------
diff --git a/sys/dev/aic7xxx/aicasm/aicasm.c b/sys/dev/aic7xxx/aicasm/aicasm.c
index 1b88ba0..08a540f 100644
--- a/sys/dev/aic7xxx/aicasm/aicasm.c
+++ b/sys/dev/aic7xxx/aicasm/aicasm.c
@@ -353,7 +353,7 @@ output_code(void)
 	patch_t *cur_patch;
 	critical_section_t *cs;
 	symbol_node_t *cur_node;
-	int instrcount;
+	unsigned int instrcount;
 
 	instrcount = 0;
 	fprintf(ofile,
@@ -455,7 +455,7 @@ output_code(void)
 "static const int num_critical_sections = sizeof(critical_sections)\n"
 "				       / sizeof(*critical_sections);\n");
 
-	fprintf(stderr, "%s: %d instructions used\n", appname, instrcount);
+	fprintf(stderr, "%s: %u instructions used\n", appname, instrcount);
 }
 
 static void
@@ -526,11 +526,11 @@ output_listing(char *ifilename)
 	patch_t *cur_patch;
 	symbol_node_t *cur_func;
 	int *func_values;
-	int instrcount;
+	unsigned int instrcount;
 	int instrptr;
 	unsigned int line;
 	int func_count;
-	int skip_addr;
+	unsigned int skip_addr;
 
 	instrcount = 0;
 	instrptr = 0;


More information about the freebsd-hackers mailing list