Web lists-archives.com

Re: [Mingw-users] GCC-4.9.3 is now our current release




Its a nasty hack indeed :) atm im looking at a small patch against 
libstdc++ instead,
since thats where most of  the problem lies using pthreads-w32 (< no 
such operator in thread).

If it works its a small price to pay, gcc needs multiple patches 
allready just to build,
so one more small patch will probably not break the camels back.

Den 16-03-2016 kl. 03:51 skrev K. Frank:
> Hello Ralph!
>
> On Tue, Mar 15, 2016 at 12:57 PM, ralph engels <ralphengels@xxxxxxxxx> wrote:
>> Needed some changes but i can report that gcc now builds with
>> pthreads-w32 again.
>>
>> Three things that needed changes.
>> ...
>> pthread_t is cast from a struct but gcc expects it to be of scalar
>> integer type, again restrict to build time and cast pthread_t to
>> unsigned int for release (should be uintptr_t but since this patch is
>> against a strictly 32 bit compiler i left it at that).
> Disclaimer: I am looking at code from about five years ago and I
> haven't looked at you patch, so my comments might not be relevant.
>
> Based on old (about five years ago) pthreads-win32 and mingw gcc
> 4.6, I see a problem with your approach, and I'm surprised it works.
>
> pthread_t maps (is typedef'ed) to ptw32_handle_t which is a struct:
>
>     typedef struct {
>         void * p;                   /* Pointer to actual object */
>         unsigned int x;             /* Extra information - reuse count etc */
>     } ptw32_handle_t;
>
> gcc's threading model uses a "gthread" abstraction layer that is very
> similar to pthreads and follows, as you noted, the standard linux
> approach (not technically consistent with posix, but the de facto
> standard) of having __gthread_t be pthread_t, which is assumed to
> be a scalar type (in fact a pointer).
>
> I just don't see how you can cast from ptw32_handle_t (a two-member
> struct) to an unsigned int, and not break all kinds of stuff.
>
> I do see member x being used in the pthreads code (so it's not just
> "dead" data), e.g., in pthread_equal:
>
>     pthread_equal (pthread_t t1, pthread_t t2)
>     {
>       int result;
>       result = ( t1.p == t2.p && t1.x == t2.x );
>       return (result);
>     }
>
> So unless the guts of gthread and pthreads-win32 have changed
> a lot since I last looked at it, your cast-pthread_t-to-unsigned-int
> work-around looks really risky.
>
>> ...
>> I have sent a patch to Keith with my changes.
>> ...
>
> Happy Multi-Threaded Hacking!
>
>
> K. Frank
>
> ------------------------------------------------------------------------------
> Transform Data into Opportunity.
> Accelerate data analysis in your applications with
> Intel Data Analytics Acceleration Library.
> Click to learn more.
> http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
> _______________________________________________
> MinGW-users mailing list
> MinGW-users@xxxxxxxxxxxxxxxxxxxxx
>
> This list observes the Etiquette found at
> http://www.mingw.org/Mailing_Lists.
> We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.
>
> _______________________________________________
> You may change your MinGW Account Options or unsubscribe at:
> https://lists.sourceforge.net/lists/listinfo/mingw-users
> Also: mailto:mingw-users-request@xxxxxxxxxxxxxxxxxxxxx?subject=unsubscribe


------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
_______________________________________________
MinGW-users mailing list
MinGW-users@xxxxxxxxxxxxxxxxxxxxx

This list observes the Etiquette found at 
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:mingw-users-request@xxxxxxxxxxxxxxxxxxxxx?subject=unsubscribe