[compiler-rt] r204521 - Avoid GCC's "cast from pointer to integer of different size" warning.

Duncan P. N. Exon Smith dexonsmith at apple.com
Sat Mar 22 19:24:39 PDT 2014


On 2014 Mar 21, at 14:45, David Blaikie <dblaikie at gmail.com> wrote:

> Author: dblaikie
> Date: Fri Mar 21 16:45:49 2014
> New Revision: 204521
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=204521&view=rev
> Log:
> Avoid GCC's "cast from pointer to integer of different size" warning.
> 
> This is a bit of a stab in the dark as I'm not sure I've got these
> source files compiling correctly locally. (and the warning only
> reproduces on a 32bit build anyway)
> 
> Modified:
>    compiler-rt/trunk/lib/profile/InstrProfilingBuffer.c
>    compiler-rt/trunk/lib/profile/InstrProfilingFile.c
> 
> Modified: compiler-rt/trunk/lib/profile/InstrProfilingBuffer.c
> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfilingBuffer.c?rev=204521&r1=204520&r2=204521&view=diff
> ==============================================================================
> --- compiler-rt/trunk/lib/profile/InstrProfilingBuffer.c (original)
> +++ compiler-rt/trunk/lib/profile/InstrProfilingBuffer.c Fri Mar 21 16:45:49 2014
> @@ -41,8 +41,8 @@ int __llvm_profile_write_buffer(char *Bu
>     DataSize,
>     CountersSize,
>     NamesSize,
> -    (uint64_t)CountersBegin,
> -    (uint64_t)NamesBegin
> +    (uintptr_t)CountersBegin,
> +    (uintptr_t)NamesBegin

Thanks for the fix!  It looks like it leaves the behaviour unmodified, which is correct.

I wasn’t seeing that warning from clang on 64-bit :).

>   };
> 
>   /* Write the data. */
> 
> Modified: compiler-rt/trunk/lib/profile/InstrProfilingFile.c
> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfilingFile.c?rev=204521&r1=204520&r2=204521&view=diff
> ==============================================================================
> --- compiler-rt/trunk/lib/profile/InstrProfilingFile.c (original)
> +++ compiler-rt/trunk/lib/profile/InstrProfilingFile.c Fri Mar 21 16:45:49 2014
> @@ -33,8 +33,8 @@ static int writeFile(FILE *File) {
>     DataSize,
>     CountersSize,
>     NamesSize,
> -    (uint64_t)CountersBegin,
> -    (uint64_t)NamesBegin
> +    (uintptr_t)CountersBegin,
> +    (uintptr_t)NamesBegin
>   };
> 
>   /* Write the data. */
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits





More information about the llvm-commits mailing list