This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Bug ada/24533] FAIL: a85013b: *** glibc detected *** free(): invalid pointer: 0x00062a00 ***
- From: John David Anglin <dave at hiauly1 dot hia dot nrc dot ca>
- To: hainque at adacore dot com <gcc-bugzilla at gcc dot gnu dot org>
- Cc: danglin at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Mon, 16 Jan 2006 20:19:35 -0500
- Subject: Re: [Bug ada/24533] FAIL: a85013b: *** glibc detected *** free(): invalid pointer: 0x00062a00 ***
- References: <bug-24533-276@http.gcc.gnu.org/bugzilla/> <20060103162505.22226.qmail@sourceware.org>
> ------- Comment #8 from hainque at adacore dot com 2006-01-03 16:25 -------
> Subject: Re: FAIL: a85013b: *** glibc detected *** free(): invalid pointer:
> 0x00062a00 ***
> Right. Preliminary attempts at fixing this a while ago made it necessary
> to touch expand_expr and is_alignin_offset, fairly deep in the back end.
As I understand the situation, fixing the above problem is quite involved.
When the parisc-linux project moved to libc6 2.3.5, free was changed and
the above error changed.
The enclosed change is a work-around for the above problem. The problem
is that the alignment provided by malloc is less than that needed for
atomic_lock_t objects. This causes the ada runtime to round the pointer
that it receives from malloc; but it doesn't retain the adjustment and the
free operation has a 50% chance of failing.
The linux libc code can accomodate an unaligned atomic_lock_t object
under most circumstances. The main issue is that ada may detemine
an incorrect struct layout.
I have tested the above change on hppa-unknown-linux-gnu, 4.0 through
trunk. Without this change, ada is essentially unusable. Thus, I
recommend installing the change as a work-around until a proper fix
can be developed.
OK?
Dave
--
J. David Anglin dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6602)
2006-01-16 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
PR ada/24533
* s-osinte-linux-hppa.ads: Reduce alignment of atomic_lock_t to 8.
Index: s-osinte-linux-hppa.ads
===================================================================
--- s-osinte-linux-hppa.ads (revision 109788)
+++ s-osinte-linux-hppa.ads (working copy)
@@ -508,7 +508,7 @@
lock : lock_array;
end record;
pragma Convention (C, atomic_lock_t);
- for atomic_lock_t'Alignment use 16;
+ for atomic_lock_t'Alignment use 8;
type struct_pthread_fast_lock is record
spinlock : atomic_lock_t;