This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: local var alignment on hppa



> On Fri, Oct 19, 2001 at 10:57:17AM -0600, law@redhat.com wrote:
> > Maybe I'm in the dark ages, but what value is having a lock on the stack?
> > ie, when is it ever useful to use ldcw on automatic storage?
>
> When you allocate a structure from automatic storage, link it
> in to global data structures, then sleep til someone wakes you.
>

In addition to the above scenario, there is the case where a lock
is passed into a common routine that might take a pointer to either

storage is passed in, the lock might not be necessary if it is not
visible to other threads, but the common procedure is not aware of
that.

The particular case that caused us to find this problem is that glibc
implements sprintf on top of fprintf.  The sprintf code creates a dummy
FILE structure on the stack, sets the buffer pointer in the FILE structure
to point to the string buffer, and then calls fprintf.  The FILE structure
has a lock field that fprintf uses.  On some parisc boxes we get into an
infinite loop here due to the unaligned lock field, even though the
lock was initialized properly.

John Marvin
jsm@fc.hp.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]