incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <se...@roguewave.com>
Subject Re: svn commit: r659253 - in /stdcxx/branches/4.2.x: examples/manual/ src/ tests/algorithms/ tests/containers/ tests/localization/ tests/numerics/ tests/regress/ tests/src/ tests/strings/ util/
Date Fri, 23 May 2008 17:37:08 GMT
elemings@apache.org wrote:
> Author: elemings
> Date: Thu May 22 13:54:39 2008
> New Revision: 659253
> 
> URL: http://svn.apache.org/viewvc?rev=659253&view=rev
> Log:
> 2008-05-22  Eric Lemings <eric.lemings@roguewave.com>
> 
> 	STDCXX-550
[...]
> 	* tests/src/23.containers.cpp (_rw_sigcat, _rw_argno): Explicitly
> 	cast `which' value from `size_t' type to `int' type used by
> 	`argmap' variable.
[...]
> Modified: stdcxx/branches/4.2.x/tests/src/23.containers.cpp
> URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/src/23.containers.cpp?rev=659253&r1=659252&r2=659253&view=diff
> ==============================================================================
> --- stdcxx/branches/4.2.x/tests/src/23.containers.cpp (original)
> +++ stdcxx/branches/4.2.x/tests/src/23.containers.cpp Thu May 22 13:54:39 2008
> @@ -174,7 +174,7 @@
>      const bool is_member = 0 != (Ids::bit_member & which);
>  
>      // get the bitmap describing the function's argument types
> -    int argmap = (which & ~Ids::bit_member) >> Ids::fid_bits;
> +    int argmap = (int (which) & ~Ids::bit_member) >> Ids::fid_bits;

FYI: The cast above changes the semantics of the expression
by slicing the high 32-bits of which (when it's 64 bits wide)
before shifting the result right, potentially causing it to
lose its high order bits. I don't think the code is really
unsafe since which is 32 bits wide in ILP32 but a more robust
fix (should the type of which change to 64 bits in the future)
would be to cast the result of the shift expression.

Martin

Mime
View raw message