sb-grovel uses %d where it should be using %ld
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Example failure, while compiling CLON:
CL-USER> (sb-posix:setenv "CC" "cc" 1)
0
CL-USER> (asdf:make 'com.dvlsoft.clon :force t)
WARNING: PARSE-VERSION: "1.0b23" doesn't follow asdf version numbering
convention
WARNING: Invalid :version specifier "1.0b23" for component
"com.dvlsoft.clon" from file
#P"/home/
instead
WARNING: Invalid :version specifier "1.0b23" for component
"com.dvlsoft.clon" from file
#P"/home/
instead
WARNING: PARSE-VERSION: "1.0b23" doesn't follow asdf version numbering
convention
WARNING: Invalid :version specifier "1.0b23" for component
"com.dvlsoft.
#P"/home/
NIL instead
WARNING: Invalid :version specifier "1.0b23" for component
"com.dvlsoft.
#P"/home/
NIL instead
WARNING: PARSE-VERSION: "1.0b23" doesn't follow asdf version numbering
convention
WARNING: Invalid :version specifier "1.0b23" for component
"com.dvlsoft.
#P"/home/
NIL instead
WARNING: Invalid :version specifier "1.0b23" for component
"com.dvlsoft.
#P"/home/
NIL instead
(/home/
/home/
/home/
/home/
/home/
/home/
/home/tunes/
In function ‘main’:
/home/tunes/
warning: format ‘%d’ expects argument of type ‘int’, but argument 3
has type ‘long unsigned int’ [-Wformat=]
fprintf (out, " (cl:setf (cl:gethash %d *integer-sizes*)
'sb-alien:char)\n", sizeof(char));
^
/home/tunes/
warning: format ‘%d’ expects argument of type ‘int’, but argument 3
has type ‘long unsigned int’ [-Wformat=]
fprintf (out, " (cl:setf (cl:gethash %d *integer-sizes*)
'sb-alien:
^
/home/tunes/
warning: format ‘%d’ expects argument of type ‘int’, but argument 3
has type ‘long unsigned int’ [-Wformat=]
fprintf (out, " (cl:setf (cl:gethash %d *integer-sizes*)
'sb-alien:long)\n", sizeof(long));
^
/home/tunes/
warning: format ‘%d’ expects argument of type ‘int’, but argument 3
has type ‘long unsigned int’ [-Wformat=]
fprintf (out, " (cl:setf (cl:gethash %d *integer-sizes*)
'sb-alien:int)\n", sizeof(int));
^
/home/tunes/
warning: format ‘%d’ expects argument of type ‘int’, but argument 3
has type ‘long unsigned int’ [-Wformat=]
fprintf (out, "(cl:eval-when (:compile-toplevel :load-toplevel
:execute) (sb-grovel:
winsize));
/home/tunes/
warning: format ‘%d’ expects argument of type ‘int’, but argument 3
has type ‘long unsigned int’ [-Wformat=]
fprintf (out, " %d\n", ((unsigned long)&(t.ws_row)) - ((unsigned
long)&(t)));
^
/home/tunes/
warning: format ‘%d’ expects argument of type ‘int’, but argument 3
has type ‘long unsigned int’ [-Wformat=]
fprintf (out, " %d)\n", sizeof(t.ws_row));
^
/home/tunes/
warning: format ‘%d’ expects argument of type ‘int’, but argument 3
has type ‘long unsigned int’ [-Wformat=]
fprintf (out, " %d\n", ((unsigned long)&(t.ws_col)) - ((unsigned
long)&(t)));
^
/home/tunes/
warning: format ‘%d’ expects argument of type ‘int’, but argument 3
has type ‘long unsigned int’ [-Wformat=]
fprintf (out, " %d)\n", sizeof(t.ws_col));
^
/home/tunes/
warning: format ‘%d’ expects argument of type ‘int’, but argument 3
has type ‘long unsigned int’ [-Wformat=]
fprintf (out, " %d\n", ((unsigned long)&(
((unsigned long)&(t)));
^
/home/tunes/
warning: format ‘%d’ expects argument of type ‘int’, but argument 3
has type ‘long unsigned int’ [-Wformat=]
fprintf (out, " %d)\n", sizeof(
^
/home/tunes/
warning: format ‘%d’ expects argument of type ‘int’, but argument 3
has type ‘long unsigned int’ [-Wformat=]
fprintf (out, " %d\n", ((unsigned long)&(
((unsigned long)&(t)));
^
/home/tunes/
warning: format ‘%d’ expects argument of type ‘int’, but argument 3
has type ‘long unsigned int’ [-Wformat=]
fprintf (out, " %d)\n", sizeof(
^
T
Changed in sbcl: | |
status: | Fix Committed → Fix Released |
Using %d on a long is undefined behavior, and the C compiler is allowed to reformat your hard disk and launch nuclear missiles targeted at you if you do it. Not that it will (I hope).
Here is a patch that addresses the issue, that also gets rid of a useless debug message from way back when.