This is the mail archive of the gcc-bugs@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]
Other format: [Raw text]

[Bug ada/24533] FAIL: a85013b: *** glibc detected *** free(): invalid pointer: 0x00062a00 ***



------- Comment #15 from dave at hiauly1 dot hia dot nrc dot ca  2006-01-17 03:49 -------
Subject: Re:  FAIL:   a85013b: *** glibc detected *** free(): invalid pointer:
0x00062a00 ***

> ------- 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;


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24533


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