Hello, Manuel, I noticed the the warnings found below when compiling a red-black-tree implementation in hoard, a collections library I have been working on. The warnings are due to node-delete! which is defined as follows:
(define-inline (node-delete! node::%red-black-node item less-than?) (define (node=? a b less-than?) (not (or (less-than? a b) (less-than? b a)))) (bind-exit (return) (cond ((less-than? item (-> node item)) (when (and (not (-> node left red?)) (not (-> node left left red?))) (set! node (node-move-red-left! node))) (set! (-> node left) (node-delete! (-> node left) item less-than?))) (else (when (-> node left red?) (set! node (node-rotate-right! node))) (when (and (node=? item (-> node item) less-than?) (eq? (-> node right) +red-black-node-nil+)) (return +red-black-node-nil+)) (when (and (not (-> node right red?)) (not (-> node right left red?))) (set! node (node-move-red-right! node))) (if (node=? item (-> node item) less-than?) (let ((m::%red-black-node (node-min (-> node right)))) (set! (-> node item) (-> m item)) (set! (-> node right) (node-delete-min! (-> node right)))) (set! (-> node right) (node-delete! (-> node right) item less-than?))))) (node-balance! node))) What I believe is happening is that the closure representing the body of the bind-exit form captures node which results in the node being boxed. So far so good, however, the compiler then generates code where it assigns the boxed value to a %red-black-node typed variable and passes that variable to various cell related functions resulting in the warning below. Currently, my tests run successfully in the presence of these warnings, but I believe this is only due to the fact that the cell structure does not have a header field when compiling with the non-saw gc and hence casting a cell pointer to a %red-black-node pointer works because the %red-black-node pointer is the first, and only, field in the cell struct. >From my investigation, this is introduced in the integration phase of the >compiler, or at least, that is when the boxing of the node value first appears. The code for red-black-tree.scm can be found in the git repository at https://github.com/donaldsonjw/hoard in src/Llib/red-black-tree.scm. To build hoard, you need only cd into the top-leve directory and execute make. To run the tests, you will need btest at https://github.com/donaldsonjw/btest. Let me know if I can provide any additional information, and thanks for Bigloo. Best Regards,Joseph Donaldson ---- Compiler Warnings ---- In file included from /home/jwd/apps/lib/bigloo/4.3a/bigloo.h:356:0, from objs/red-black-tree_s.c:13: objs/red-black-tree_s.c: In function ‘BGl_redzd2blackzd2treezd2deletez12zc0zzhoardzf2redzd2blackzd2treezf2’: objs/red-black-tree_s.c:1466:11: warning: passing argument 1 of ‘make_cell’ from incompatible pointer type [-Wincompatible-pointer-types] MAKE_CELL(BgL_arg1194z00_133); ^ /home/jwd/apps/lib/bigloo/4.3a/bigloo_cell.h:78:40: note: in definition of macro ‘MAKE_CELL’ # define MAKE_CELL( v ) make_cell( v ) ^ /home/jwd/apps/lib/bigloo/4.3a/bigloo_cell.h:27:24: note: expected ‘obj_t {aka union scmobj *}’ but argument is of type ‘BgL_z52redzd2blackzd2nodez52_bglt {aka struct BgL_z52redzd2blackzd2nodez52_bgl *}’ BGL_RUNTIME_DECL obj_t make_cell( obj_t ); ^~~~~~~~~ objs/red-black-tree_s.c:1465:18: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types] BgL_nodez00_1676 = ^ objs/red-black-tree_s.c: In function ‘BGl_zc3exitza31613ze3ze70z64zzhoardzf2redzd2blackzd2treezf2’: objs/red-black-tree_s.c:2307:17: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types] BgL_nodez00_740 = ^ In file included from objs/red-black-tree_s.c:13:0: /home/jwd/apps/lib/bigloo/4.3a/bigloo.h:264:50: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types] # define BASSIGN( field, value, obj ) (((field) = (value)), BUNSPEC) ^ /home/jwd/apps/lib/bigloo/4.3a/bigloo_cell.h:99:26: note: in expansion of macro ‘BASSIGN’ #define CELL_SET( c, v ) BASSIGN( CELL_REF( c ), v, c ) ^~~~~~~ objs/red-black-tree_s.c:2519:1: note: in expansion of macro ‘CELL_SET’ CELL_SET(BgL_nodez00_1378, ^~~~~~~~ In file included from /home/jwd/apps/lib/bigloo/4.3a/bigloo.h:356:0, from objs/red-black-tree_s.c:13: objs/red-black-tree_s.c:2540:11: warning: passing argument 1 of ‘make_cell’ from incompatible pointer type [-Wincompatible-pointer-types] MAKE_CELL(BgL_arg1627z00_723); ^ /home/jwd/apps/lib/bigloo/4.3a/bigloo_cell.h:78:40: note: in definition of macro ‘MAKE_CELL’ # define MAKE_CELL( v ) make_cell( v ) ^ /home/jwd/apps/lib/bigloo/4.3a/bigloo_cell.h:27:24: note: expected ‘obj_t {aka union scmobj *}’ but argument is of type ‘BgL_z52redzd2blackzd2nodez52_bglt {aka struct BgL_z52redzd2blackzd2nodez52_bgl *}’ BGL_RUNTIME_DECL obj_t make_cell( obj_t ); ^~~~~~~~~ objs/red-black-tree_s.c:2539:18: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types] BgL_nodez00_1684 = ^ objs/red-black-tree_s.c:2568:17: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types] BgL_nodez00_773 = ^ In file included from objs/red-black-tree_s.c:13:0: /home/jwd/apps/lib/bigloo/4.3a/bigloo.h:264:50: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types] # define BASSIGN( field, value, obj ) (((field) = (value)), BUNSPEC) ^ /home/jwd/apps/lib/bigloo/4.3a/bigloo_cell.h:99:26: note: in expansion of macro ‘BASSIGN’ #define CELL_SET( c, v ) BASSIGN( CELL_REF( c ), v, c ) ^~~~~~~ objs/red-black-tree_s.c:2625:1: note: in expansion of macro ‘CELL_SET’ CELL_SET(BgL_nodez00_1378, ^~~~~~~~ objs/red-black-tree_s.c:2690:17: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types] BgL_nodez00_784 = ^ In file included from objs/red-black-tree_s.c:13:0: /home/jwd/apps/lib/bigloo/4.3a/bigloo.h:264:50: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types] # define BASSIGN( field, value, obj ) (((field) = (value)), BUNSPEC) ^ /home/jwd/apps/lib/bigloo/4.3a/bigloo_cell.h:99:26: note: in expansion of macro ‘BASSIGN’ #define CELL_SET( c, v ) BASSIGN( CELL_REF( c ), v, c ) ^~~~~~~ objs/red-black-tree_s.c:2844:1: note: in expansion of macro ‘CELL_SET’ CELL_SET(BgL_nodez00_1378, ^~~~~~~~ In file included from /home/jwd/apps/lib/bigloo/4.3a/bigloo.h:356:0, from objs/red-black-tree_s.c:13: objs/red-black-tree_s.c:2932:11: warning: passing argument 1 of ‘make_cell’ from incompatible pointer type [-Wincompatible-pointer-types] MAKE_CELL(BgL_arg1651z00_737); ^ /home/jwd/apps/lib/bigloo/4.3a/bigloo_cell.h:78:40: note: in definition of macro ‘MAKE_CELL’ # define MAKE_CELL( v ) make_cell( v ) ^ /home/jwd/apps/lib/bigloo/4.3a/bigloo_cell.h:27:24: note: expected ‘obj_t {aka union scmobj *}’ but argument is of type ‘BgL_z52redzd2blackzd2nodez52_bglt {aka struct BgL_z52redzd2blackzd2nodez52_bgl *}’ BGL_RUNTIME_DECL obj_t make_cell( obj_t ); ^~~~~~~~~ objs/red-black-tree_s.c:2931:18: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types] BgL_nodez00_1687 = ^ objs/red-black-tree_s.c:2952:17: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types] BgL_nodez00_810 = ^
