in reply to Re: C4244 Warning in inline.h file while using Win64 configuration
in thread C4244 Warning in inline.h file while using Win64 configuration
Severity Code Description Project File Line Suppression State Warning C4244 '=': conversion from '__int64' to 'I32', possible loss of data C:\Strawberry\perl\lib\CORE\inline.h 2165
Above is the warning we are getting.
When you go to link 2165 of inline.h this is line of code: PL_curstackinfo->si_cxsubix = cx - PL_curstackinfo->si_cxstack; Looking at PL_curstackinfoyou get (from cop.h):
struct stackinfo { AV * si_stack; /* stack for current + runlevel */ PERL_CONTEXT * si_cxstack; /* context stack for r +unlevel */ struct stackinfo * si_prev; struct stackinfo * si_next; I32 si_cxix; /* current conte +xt index */ I32 si_cxmax; /* m +aximum allocated index */ I32 si_cxsubix; /* to +pmost sub/eval/format */ I32 si_type; /* type of runle +vel */ I32 si_markoff; /* of +fset where markstack begins for us. + * currently used only with DEBUGGING, + * but not #ifdef-ed for bincompat */ #if defined DEBUGGING && !defined DEBUGGING_RE_ONLY /* high water mark: for checking if the stack was correctly extended / * tested for extension by each pp function */ SSize_t si_stack_hwm; #endif };
Here we can see that si_sxsubix is defined as an I32 which is typdef long I32. si_cxstack is a pointer to a PERL_CONTEXT. The key here is the fact it’s a pointer.
PERL_CONTEXT *cx
Going back to the line of code that is getting the warning:
PL_curstackinfo->si_cxsubix = cx - PL_curstackinfo->si_cxstack;
cx is going to be the address to a PERL_CONTEXT The problem is that when compiling for 64bit systems an address is going to be 64bits so now when doing the subtraction and putting it into the 32bit si_cxsubix there’s a conversation issue because the 64bit subtraction is being put into a 32bit value.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: C4244 Warning in inline.h file while using Win64 configuration
by hv (Prior) on Feb 22, 2023 at 00:20 UTC |