[libcxx] test fixes <locale>

Steve MacKenzie stevemac321 at live.com
Wed Oct 22 09:16:47 PDT 2014

Not sure I follow.
The code is testing <locale> money_get.  Agree that the last argument is 
an input-output argument.

long double ex;
do_get(..., ex); // money_get writes to ex
assert(ex == <expected_value>); // tests for expected value

The test is passing, so I am assuming that money_get is writing the 
expected value to 'ex'.

However, scan-build is flagging the test expression:
assert(ex == expected_value)
as a "garbage value", which is true of an uninitialized variable.

So, initializing the variable removes the "garbage", and it is my 
understanding that the last argument is used as a buffer and that the 
actual value passed in has no impact on what gets written to it as an 

So that is my understanding, if that is wrong, please provide concrete 
guidance that corrects my misunderstanding and I'd be happy to 
investigate further.


On 10/22/2014 06:22 AM, Jonathan Roelofs wrote:
> Steve,
> IIRC, the last parameter of these get functions is supposed to be a write-only
> return argument. Did you diagnose why the lack of initialization is causing
> problems (because that's what should be fixed, not this test)?
> Cheers,
> Jon
> On 10/21/14 9:05 PM, Steve MacKenzie wrote:
>> My scan-build run against libc++ tests and headers continues.. up to and
>> including localization tests.
>> The diff is applicable to libcxx/test/localization tests only, all fixes address
>> dead initialization.
>> Three suspected scan-build false positive bugs were opened as
>> well:21326,21333,21335.
>> Progress of the run is published here:
>> http://stevemac123.wordpress.com/static-analysis-run/
>> Thanks,
>> Steve MacKenzie
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

More information about the cfe-commits mailing list