Andrew Haley wrote:
If so, it's a gcc bug either way. Both caller and callee were compiled
by gcc. But we don't have enough information to determine what the cause
of the problem really is.
Sorry that I'm not taking the time to get a copy of the called code and
I'm instead speculating.
But, it is perfectly possible for the reported symptom to be a bug in
the called code, rather than in gcc. Here is the simplest bug the
called code might have fitting all described symptoms (not saying it has
this bug, just saying we haven't checked that it doesn't).
It could internally use a reference to the passed CARD32 and then cast
that (CARD32&) to a (long&) before using the value.
In a 32 bit build, that would always work, because a long is 32 bits.
In a 64 bit build, that would usually work, because most ways that the
compilation of the calling code might place a 32 bit value in a 64 bit
location would clear the high bits as an (unnecessary I think) side
effect. But sometimes it would fail. And always it would be a bug,
because the C++ standard doesn't let you expect defined behavior from
such an action.