GNU bug report logs -
#65491
[PATCH] Improve performance allocating vectors
Previous Next
Full log
View this message in rfc822 format
> From: Mattias EngdegÄrd <mattias.engdegard <at> gmail.com>
> Date: Sat, 16 Sep 2023 18:32:31 +0200
> Cc: 65491 <at> debbugs.gnu.org,
> monnier <at> iro.umontreal.ca
>
> The new XUNTAG is:
>
> #define XUNTAG(a, type, ctype) ((ctype *) \
> ((uintptr_t) XLP (a) - LISP_WORD_TAG (type)))
>
> so you get a warning from what, conversion of a 64-bit number to (ctype *)?
Yes, I think so:
In file included from dispnew.c:27:
lisp.h: In function 'PSEUDOVECTORP':
lisp.h:813:33: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
813 | #define XUNTAG(a, type, ctype) ((ctype *) \
| ^
lisp.h:374:6: note: in expansion of macro 'XUNTAG'
374 | ((XUNTAG ((a), Lisp_Vectorlike, union vectorlike_header)->size \
| ^~~~~~
lisp.h:1127:10: note: in expansion of macro 'lisp_h_PSEUDOVECTORP'
1127 | return lisp_h_PSEUDOVECTORP (a, code);
| ^~~~~~~~~~~~~~~~~~~~
lisp.h: In function 'XSYMBOL_WITH_POS':
lisp.h:813:33: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
813 | #define XUNTAG(a, type, ctype) ((ctype *) \
| ^
lisp.h:1152:12: note: in expansion of macro 'XUNTAG'
1152 | return XUNTAG (a, Lisp_Vectorlike, struct Lisp_Symbol_With_Pos);
| ^~~~~~
lisp.h: In function 'XBARE_SYMBOL':
lisp.h:813:33: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
813 | #define XUNTAG(a, type, ctype) ((ctype *) \
| ^
lisp.h:1159:27: note: in expansion of macro 'XUNTAG'
1159 | intptr_t i = (intptr_t) XUNTAG (a, Lisp_Symbol, struct Lisp_Symbol);
| ^~~~~~
> Does changing the definition to
>
> #define XUNTAG(a, type, ctype) \
> ((ctype *) ((uintptr_t) XLP (a) - (uintptr_t)LISP_WORD_TAG (type)))
>
> help? (That is, cast the LISP_WORD_TAG return value to uintptr_t.)
It does, but LISP_WORD_TAG(type) is a 64=bit type with the only bits
set above 32 bit, so how casting it to uintptr_t is TRT?
Why did you need to change the original cast in the first place?
This bug report was last modified 1 year and 264 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.