-
Notifications
You must be signed in to change notification settings - Fork 559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pointer cast to integer of different size in hv_func.h #12938
Comments
From [email protected]Created by [email protected]When compiling perl, I get many warnings about the same line in The attached patch, also changes the type of the variable on that Perl Info
|
From [email protected]0001-avoid-cast-from-pointer-to-integer-of-different-size.patchFrom a3801c134954362fb394b6c1ffbefe0d1c045d4e Mon Sep 17 00:00:00 2001
From: Robin Barker <[email protected]>
Date: Wed, 1 May 2013 18:39:26 +0100
Subject: [PATCH 1/2] avoid cast from pointer to integer of different size
---
hv_func.h | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/hv_func.h b/hv_func.h
index 0a66356..9dfe158 100644
--- a/hv_func.h
+++ b/hv_func.h
@@ -392,8 +392,8 @@ S_perl_hash_murmur3(const unsigned char * const seed, const unsigned char *ptr,
/* This CPU does not handle unaligned word access */
/* Consume enough so that the next data byte is word aligned */
- int i = -(IV)ptr & 3;
- if(i && (STRLEN)i <= len) {
+ STRLEN i = -PTR2IV(ptr) & 3;
+ if(i && i <= len) {
MURMUR_DOBYTES(i, h1, carry, bytes_in_carry, ptr, len);
}
--
1.7.5.4
|
From @demerphqSorry about that, probably my bad porting skills at fault. I will Yves On 2 May 2013 12:14, Robin Barker <perlbug-followup@perl.org> wrote:
-- |
The RT System itself - Status changed from 'new' to 'open' |
From @nwc10On Thu, May 02, 2013 at 12:23:18PM +0200, demerphq wrote:
It needs testing on Win64 first. Nicholas Clark |
From @demerphqOn 2 May 2013 12:34, Nicholas Clark <nick@ccl4.org> wrote:
Any reason Win64 is special in this regard? Yves -- |
From @nwc10On Thu, May 02, 2013 at 12:46:30PM +0200, demerphq wrote:
Because the warning is not from your code. It's from a change made to your https://rt-archive.perl.org/perl5/Ticket/Display.html?id=117687 So changing it has the potential to break their build. I'd spotted this warning a few days ago and had pushed a branch recently Also, I don't understand why it was a build *failure* on Win64, and not just Nicholas Clark |
From @demerphqOn 2 May 2013 13:07, Nicholas Clark <nick@ccl4.org> wrote:
Oh. So maybe we should leave it one of our people who can easily test Yves -- |
From @steve-m-haydemerphq wrote on 2013-05-02:
I'll give it whirl shortly... :-) |
From @sisyphus-----Original Message-----
It was I that created that ticket. I've tried Robin's patch on 5.17.11 - it's fine for me on Win64. (I haven't
It *is* strange. I also use 4.7.0 for my 32-bit builds. There was no problem there ... but, Cheers, |
From @nwc10On Thu, May 02, 2013 at 10:33:12PM +1000, sisyphus1@optusnet.com.au wrote:
Cool, thanks. I hadn't yet asked you, because I was going to verify that the
Well, they are by default. The warning is cropping up on *nix when one Also, Robin's attached *patch* has the 1 line commit message which doesn't reference the RT number (it can't - RT allocated the ticket commit 275227021431a7dbfb1c18e88a68a35ce0851161 Use PTR2IV() instead of casting a pointer to IV, to avoid warnings. Inline Patchdiff --git a/hv_func.h b/hv_func.h
index 0a66356..9dfe158 100644
--- a/hv_func.h
+++ b/hv_func.h
@@ -392,8 +392,8 @@ S_perl_hash_murmur3(const unsigned char * const seed, const
/* This CPU does not handle unaligned word access */
/* Consume enough so that the next data byte is word aligned */
- int i = -(IV)ptr & 3;
- if(i && (STRLEN)i <= len) {
+ STRLEN i = -PTR2IV(ptr) & 3;
+ if(i && i <= len) {
MURMUR_DOBYTES(i, h1, carry, bytes_in_carry, ptr, len);
}
Nicholas Clark |
From @steve-m-hayNicholas Clark wrote on 2013-05-02:
It works fine for me too, using MinGW 4.7.0 (32-bit native compiler), [...]
warnings.
pointers.
everyone
macro
I've also tested with VC++ 2010 32-bit and 64-bit native compilers. No hv_func.h(397) : warning C4267: 'initializing' : conversion from However, it already has several other warnings from that file: hv_func.h(264) : warning C4267: 'initializing' : conversion from and generally gazillions of other warnings throughout the build which I haven't tried a 32-bit build with 64-bit-ints yet, but I will do later PS. I also had Robin's other patch (RT #117837) in place throughout all |
From @steve-m-haySteve Hay wrote on 2013-05-02:
I've done 64-bit-int builds with the 32-bit MinGW and VC++ 2010 |
From @nwc10On Thu, May 02, 2013 at 06:05:58PM +0100, Steve Hay wrote:
Cool. The smoke tests all look clean. I think that we should merge this fix to blead before v5.18.0 Whilst it's only a compiler warning fix, not a build breaker, it's clear Hence I'll mark this ticket as a blocker and Ricardo can unmark it if he Nicholas Clark |
From @rjbs* Nicholas Clark <nick@ccl4.org> [2013-05-05T15:27:48]
Yes. -- |
@nwc10 - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#117835 (status was 'resolved')
Searchable as RT117835$
The text was updated successfully, but these errors were encountered: