lucy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Karman <pe...@peknet.com>
Subject Re: 64-bit linux errors with t/core/032-string_helper.t
Date Wed, 20 Jan 2010 03:13:35 GMT
Marvin Humphrey wrote on 1/19/10 2:45 PM:
> On Tue, Jan 19, 2010 at 02:14:17PM -0600, Peter Karman wrote:
> 
>> I do get the same result.
> 
> Good, 'cause working around that class of bug would have been a huge PITA -- I
> threw up my hands at that NetBSD bug.
> 
> Maybe it's macro expansion weirdness?  Try changing "ASSERT_INT_EQ" to
> "kino_TestBatch_int_equals" and "StrHelp_UTF8_SKIP" to
> "kino_StrHelp_UTF8_SKIP".
> 
> I'm also not totally satisfied that we've ruled out vararg argument passing.
> What if we do something like this?
> 
>     bool_t condition = StrHelp_UTF8_SKIP[i] == 1 ? true : false;
>     ASSERT_TRUE(batch, condition, "UTF8_SKIP ascii %d", (int)i);
> 

I added a new function to the core/KinoSearch/Test/Util/TestStringHelper.c file 
as below:

static void
test_SKIP_and_TRAILING_local()
{
     u8_t i, max;

     for (i=0, max=255; i < max; i++) {
         printf("i == %d\n", i);
         printf("UTF8_SKIP[%d] == %d\n", i, StrHelp_UTF8_SKIP[i]);
         printf("i == %d\n", i);
         printf("UTF8_TRAILING[%d] == %d\n", i, StrHelp_UTF8_TRAILING[i]);
         printf("i == %d size %d\n", i, sizeof(i));
     }
     printf("finally: i == %d\n", i);
}

output:

$ perl -Mblib t/core/032-string_helper.t
<...snip regular test output...>
i == 0
UTF8_SKIP[0] == 1
i == 0
UTF8_TRAILING[0] == 0
i == 0 size 1
finally: i == 255

Notice that 'i' just skips straight from 0 to 255.

When I comment out either of the UTF8_*[..] calls, then it works fine. It's the 
combination of the two that causes the problem.

So there are no macros to affect that _local() function, and no vararg oddities.

However, when I put the same code into a standalone file and run it, it works 
(see the test app I sent earlier in this thread with the UTF8 arrays hardcoded).

I have tried this on two different RHEL 4 boxes, both with gcc version 3.4.6 
20060404 (Red Hat 3.4.6-3).

I'm going to go drink a beer and try not to think about this madness for awhile 
and hope that the answer just comes to me in my sleep.
-- 
Peter Karman  .  http://peknet.com/  .  peter@peknet.com

Mime
View raw message