On Thursday 11 of December 2014 09:35:00 Pavel Raiskup wrote:
> Thanks for the report, however this is not reproducible on my GNU/Linux box.

Yes, I'm aware this does not happen on x86 platforms, but I've seen it on 
Solaris SPARC and on HP-UX IA64.

> Would you be able to use the debugger and see, where the problem actually is? 
>  
> You could start at 'read_and' function and than step over 'decode_header' and 
> see why the process skips 'do_something()' call.

Yes, I did a bit of debugging and spotted the issue. The problem is in the 
ISFOUND macro, defined in common.h .

The macro is defined like this:

#define ISFOUND(c) ((occurrence_option == 0) ? (c)->found_count : \
                    (c)->found_count == occurrence_option)

The problem is, on my compiler, if I do something like:

bool is_found = ISFOUND (cursor);

the compiler downgrades cursor->found_count to a bool type (8 bit), so if 
cursor->found_count is a multiple of 256 then ISFOUND returns 0.
I modified the macro this way:

#define ISFOUND(c) ((occurrence_option == 0) ? (c)->found_count > 0 : \
                    (c)->found_count == occurrence_option)

and the behaviour is now correct for me.
Also, the WASFOUND macro in the same file has a similar issue.

Regards,
 Romano


Reply via email to