develooper Front page | perl.perl5.porters | Postings from September 2014

[perl #122861] [PATCH] for storage of NVs, use "IV in sv_u in head no-body trick" where possible

Thread Previous | Thread Next
From:
Father Chrysostomos via RT
Date:
September 28, 2014 17:49
Subject:
[perl #122861] [PATCH] for storage of NVs, use "IV in sv_u in head no-body trick" where possible
Message ID:
rt-4.0.18-16248-1411926538-1144.122861-15-0@perl.org
On Sun Sep 28 10:37:37 2014, sprout wrote:
> However, clang is not happy about the change from size_t to U32 for
> arena_size:
> 
> sv.c:959:32: warning: implicit conversion from 'unsigned long' to
> 'U32'
>       (aka 'unsigned int') changes value from 18446744073709551600 to
> 4294967280
>       [-Wconstant-conversion]
>       FIT_ARENA(0, sizeof(XPV) - STRUCT_OFFSET(XPV, xpv_cur)) },
>                 ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> sv.c:923:26: note: expanded from macro 'FIT_ARENA'
>     ? FIT_ARENAn (count, body_size)                     \
>                          ^
> sv.c:919:15: note: expanded from macro 'FIT_ARENAn'
>     ? count * body_size                                 \
>               ^
> 
> While I can go ahead and add the cast (I plan to), this
> 18446744073709551600 confuses me.  Where is that number coming from?
> How did sizeof(XPV) - STRUCT_OFFSET(XPV, xpv_cur) end up negative (if
> that is what is happening)?

And this is what actually gets placed in bodies_by_type for SVt_PV (courtesy of gdb):

{
    body_size = 16 '\020', 
    copy = 16 '\020', 
    offset = 16 '\020', 
    type = 3, 
    cant_upgrade = 0, 
    zero_nv = 1, 
    arena = 1, 
    arena_size = 3536
},

Is there a bug in the clang warning, so I can just ignore it and cast to suppress it?

-- 

Father Chrysostomos


---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=122861

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About