[llvm-commits] Windows compilation warnings

Villmow, Micah Micah.Villmow at amd.com
Thu Jul 15 19:00:12 PDT 2010


Here is a new patch set.

This patch set makes Windows build cleanly for 32bit binaries from a 64bit machine. I'll have to supply a second patchset for the 64bit binaries from a 64bit machine. The changes are quite extensive.

Some thoughts about what I saw while doing this.

size_t is not used in places where it should be, return value of size(), input value of resize().
getZExtValue()/getSExtValue() need 32bit explicit versions, this would remove probably 60% of truncation casts.
uint64_t is overused in places where uint32_t is sufficient.
unsigned/signed is used where uint32_t/int32_t should be used. 

Should there be something the developers notes about these? I think it is better to explicitly specify the integer size instead on relying on the compiler to pick the size.

Thanks,
Micah

-----Original Message-----
From: llvm-commits-bounces at cs.uiuc.edu [mailto:llvm-commits-bounces at cs.uiuc.edu] On Behalf Of Villmow, Micah
Sent: Thursday, July 15, 2010 4:11 PM
To: Dimitry Andric
Cc: llvm-commits
Subject: Re: [llvm-commits] Windows compilation warnings

Dimitry, might want to hold off a little bit.
I can provide another patch in an hour or so that should fix ALL of the x64 build warnings. Most of them I'm dealing with by casting them away for now. When I get more time I'll go through and fix the silent 64-to-32 bit truncations. In many of the places, I don't see why there is a need for 64bit integers to be used where either size_t or uint32_t should be used instead.

Micah

-----Original Message-----
From: Dimitry Andric [mailto:dimitry at andric.com] 
Sent: Thursday, July 15, 2010 4:06 PM
To: Villmow, Micah
Cc: llvm-commits
Subject: Re: [llvm-commits] Windows compilation warnings

On 2010-07-15 20:45, Villmow, Micah wrote:
> There are a bunch of windows warnings, here is a patch that fixes some of them.

I assume these are warning fixes for the x64 build on Windows?  Because
the Win32 ToT build just has some warnings about enum values being
truncated, and a few switch statements that only have a default case.

If these fixes are indeed for the Windows x64 build, I would propose not
to simply "cast away" some of those warnings, as they might hide real
issues.

There are *lot* of silent 64-to-32 bit truncations in the codebase, for
example where lengths (usually a size_t) are stuffed into plain int or
unsigned, and ideally these should all be checked to verify there is no
problem with that truncation.

That said, I will apply your patch to an x64 build, and see how many of
the (very many :) warnings go away.



_______________________________________________
llvm-commits mailing list
llvm-commits at cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

-------------- next part --------------
A non-text attachment was scrubbed...
Name: windows_32bit_on_64bit.diff
Type: application/octet-stream
Size: 323383 bytes
Desc: windows_32bit_on_64bit.diff
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20100715/76a49d32/attachment.obj>


More information about the llvm-commits mailing list