Csound Csound-dev Csound-tekno Search About

[Cs-dev] _sync_fetch_and_add problem with i386

Date2013-08-22 11:56
FromVictor Lazzarini
Subject[Cs-dev] _sync_fetch_and_add problem with i386
It appears that there is a problem with _sync_fetch_and_add  in the i386 architecture. I am
get segfaults at bus.c:586

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00000000
0x0003fe98 in chnget_opcode_perf_k (csound=0x800000, p=0x894a78) at /Users/victor/src/csound6/OOps/bus.c:586
586	    x.i = __sync_fetch_and_add((MYFLT_INT_TYPE *) p->fp, 0);

Compiling without any optimisation appears to stop the segfault, and the code seems to work. So if it was
the case that the intrinsic did not exist for int64_t in i386, it would not suddenly start to work.

Not sure how to solve this.

gcc version 4.2.1 (Apple Inc. build 5666) 

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2013-08-22 16:12
FromFelipe Sateler
SubjectRe: [Cs-dev] _sync_fetch_and_add problem with i386
That gcc is fairly old. Does this problem happen with a newer version?

On Thu, Aug 22, 2013 at 6:56 AM, Victor Lazzarini
 wrote:
> It appears that there is a problem with _sync_fetch_and_add  in the i386 architecture. I am
> get segfaults at bus.c:586
>
> Program received signal EXC_BAD_ACCESS, Could not access memory.
> Reason: KERN_PROTECTION_FAILURE at address: 0x00000000
> 0x0003fe98 in chnget_opcode_perf_k (csound=0x800000, p=0x894a78) at /Users/victor/src/csound6/OOps/bus.c:586
> 586         x.i = __sync_fetch_and_add((MYFLT_INT_TYPE *) p->fp, 0);
>
> Compiling without any optimisation appears to stop the segfault, and the code seems to work. So if it was
> the case that the intrinsic did not exist for int64_t in i386, it would not suddenly start to work.
>
> Not sure how to solve this.
>
> gcc version 4.2.1 (Apple Inc. build 5666)
>
> Dr Victor Lazzarini
> Senior Lecturer
> Dept. of Music
> NUI Maynooth Ireland
> tel.: +353 1 708 3545
> Victor dot Lazzarini AT nuim dot ie
>
>
>
>
> ------------------------------------------------------------------------------
> Introducing Performance Central, a new site from SourceForge and
> AppDynamics. Performance Central is your source for news, insights,
> analysis and resources for efficient Application Performance Management.
> Visit us today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel



-- 

Saludos,
Felipe Sateler

------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2013-08-22 16:28
FromSteven Yi
SubjectRe: [Cs-dev] _sync_fetch_and_add problem with i386
Have you tried compiling with clang?  I've had problems with the
atomic stuff on Windows i386, but that was in linking. (Didn't even
get to runtime. :P ).

On Thu, Aug 22, 2013 at 6:56 AM, Victor Lazzarini
 wrote:
> It appears that there is a problem with _sync_fetch_and_add  in the i386 architecture. I am
> get segfaults at bus.c:586
>
> Program received signal EXC_BAD_ACCESS, Could not access memory.
> Reason: KERN_PROTECTION_FAILURE at address: 0x00000000
> 0x0003fe98 in chnget_opcode_perf_k (csound=0x800000, p=0x894a78) at /Users/victor/src/csound6/OOps/bus.c:586
> 586         x.i = __sync_fetch_and_add((MYFLT_INT_TYPE *) p->fp, 0);
>
> Compiling without any optimisation appears to stop the segfault, and the code seems to work. So if it was
> the case that the intrinsic did not exist for int64_t in i386, it would not suddenly start to work.
>
> Not sure how to solve this.
>
> gcc version 4.2.1 (Apple Inc. build 5666)
>
> Dr Victor Lazzarini
> Senior Lecturer
> Dept. of Music
> NUI Maynooth Ireland
> tel.: +353 1 708 3545
> Victor dot Lazzarini AT nuim dot ie
>
>
>
>
> ------------------------------------------------------------------------------
> Introducing Performance Central, a new site from SourceForge and
> AppDynamics. Performance Central is your source for news, insights,
> analysis and resources for efficient Application Performance Management.
> Visit us today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2013-08-22 18:55
FromVictor Lazzarini
SubjectRe: [Cs-dev] _sync_fetch_and_add problem with i386
Not sure I can get a later version.
On 22 Aug 2013, at 16:12, Felipe Sateler wrote:

> That gcc is fairly old. Does this problem happen with a newer version?
> 
> On Thu, Aug 22, 2013 at 6:56 AM, Victor Lazzarini
>  wrote:
>> It appears that there is a problem with _sync_fetch_and_add  in the i386 architecture. I am
>> get segfaults at bus.c:586
>> 
>> Program received signal EXC_BAD_ACCESS, Could not access memory.
>> Reason: KERN_PROTECTION_FAILURE at address: 0x00000000
>> 0x0003fe98 in chnget_opcode_perf_k (csound=0x800000, p=0x894a78) at /Users/victor/src/csound6/OOps/bus.c:586
>> 586         x.i = __sync_fetch_and_add((MYFLT_INT_TYPE *) p->fp, 0);
>> 
>> Compiling without any optimisation appears to stop the segfault, and the code seems to work. So if it was
>> the case that the intrinsic did not exist for int64_t in i386, it would not suddenly start to work.
>> 
>> Not sure how to solve this.
>> 
>> gcc version 4.2.1 (Apple Inc. build 5666)
>> 
>> Dr Victor Lazzarini
>> Senior Lecturer
>> Dept. of Music
>> NUI Maynooth Ireland
>> tel.: +353 1 708 3545
>> Victor dot Lazzarini AT nuim dot ie
>> 
>> 
>> 
>> 
>> ------------------------------------------------------------------------------
>> Introducing Performance Central, a new site from SourceForge and
>> AppDynamics. Performance Central is your source for news, insights,
>> analysis and resources for efficient Application Performance Management.
>> Visit us today!
>> http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
> 
> 
> 
> -- 
> 
> Saludos,
> Felipe Sateler
> 
> ------------------------------------------------------------------------------
> Introducing Performance Central, a new site from SourceForge and 
> AppDynamics. Performance Central is your source for news, insights, 
> analysis and resources for efficient Application Performance Management. 
> Visit us today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2013-08-22 18:56
FromVictor Lazzarini
SubjectRe: [Cs-dev] _sync_fetch_and_add problem with i386
No, but for the moment, I am not doing i386 anymore.
On 22 Aug 2013, at 16:28, Steven Yi wrote:

> Have you tried compiling with clang?  I've had problems with the
> atomic stuff on Windows i386, but that was in linking. (Didn't even
> get to runtime. :P ).
> 
> On Thu, Aug 22, 2013 at 6:56 AM, Victor Lazzarini
>  wrote:
>> It appears that there is a problem with _sync_fetch_and_add  in the i386 architecture. I am
>> get segfaults at bus.c:586
>> 
>> Program received signal EXC_BAD_ACCESS, Could not access memory.
>> Reason: KERN_PROTECTION_FAILURE at address: 0x00000000
>> 0x0003fe98 in chnget_opcode_perf_k (csound=0x800000, p=0x894a78) at /Users/victor/src/csound6/OOps/bus.c:586
>> 586         x.i = __sync_fetch_and_add((MYFLT_INT_TYPE *) p->fp, 0);
>> 
>> Compiling without any optimisation appears to stop the segfault, and the code seems to work. So if it was
>> the case that the intrinsic did not exist for int64_t in i386, it would not suddenly start to work.
>> 
>> Not sure how to solve this.
>> 
>> gcc version 4.2.1 (Apple Inc. build 5666)
>> 
>> Dr Victor Lazzarini
>> Senior Lecturer
>> Dept. of Music
>> NUI Maynooth Ireland
>> tel.: +353 1 708 3545
>> Victor dot Lazzarini AT nuim dot ie
>> 
>> 
>> 
>> 
>> ------------------------------------------------------------------------------
>> Introducing Performance Central, a new site from SourceForge and
>> AppDynamics. Performance Central is your source for news, insights,
>> analysis and resources for efficient Application Performance Management.
>> Visit us today!
>> http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
> 
> ------------------------------------------------------------------------------
> Introducing Performance Central, a new site from SourceForge and 
> AppDynamics. Performance Central is your source for news, insights, 
> analysis and resources for efficient Application Performance Management. 
> Visit us today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2013-08-22 20:01
FromSteven Yi
SubjectRe: [Cs-dev] _sync_fetch_and_add problem with i386
I'm assuming that the pd lib I'm building will also fail then. Not
sure of a solution either.

On Thu, Aug 22, 2013 at 1:56 PM, Victor Lazzarini
 wrote:
> No, but for the moment, I am not doing i386 anymore.
> On 22 Aug 2013, at 16:28, Steven Yi wrote:
>
>> Have you tried compiling with clang?  I've had problems with the
>> atomic stuff on Windows i386, but that was in linking. (Didn't even
>> get to runtime. :P ).
>>
>> On Thu, Aug 22, 2013 at 6:56 AM, Victor Lazzarini
>>  wrote:
>>> It appears that there is a problem with _sync_fetch_and_add  in the i386 architecture. I am
>>> get segfaults at bus.c:586
>>>
>>> Program received signal EXC_BAD_ACCESS, Could not access memory.
>>> Reason: KERN_PROTECTION_FAILURE at address: 0x00000000
>>> 0x0003fe98 in chnget_opcode_perf_k (csound=0x800000, p=0x894a78) at /Users/victor/src/csound6/OOps/bus.c:586
>>> 586         x.i = __sync_fetch_and_add((MYFLT_INT_TYPE *) p->fp, 0);
>>>
>>> Compiling without any optimisation appears to stop the segfault, and the code seems to work. So if it was
>>> the case that the intrinsic did not exist for int64_t in i386, it would not suddenly start to work.
>>>
>>> Not sure how to solve this.
>>>
>>> gcc version 4.2.1 (Apple Inc. build 5666)
>>>
>>> Dr Victor Lazzarini
>>> Senior Lecturer
>>> Dept. of Music
>>> NUI Maynooth Ireland
>>> tel.: +353 1 708 3545
>>> Victor dot Lazzarini AT nuim dot ie
>>>
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Introducing Performance Central, a new site from SourceForge and
>>> AppDynamics. Performance Central is your source for news, insights,
>>> analysis and resources for efficient Application Performance Management.
>>> Visit us today!
>>> http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>> ------------------------------------------------------------------------------
>> Introducing Performance Central, a new site from SourceForge and
>> AppDynamics. Performance Central is your source for news, insights,
>> analysis and resources for efficient Application Performance Management.
>> Visit us today!
>> http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
> Dr Victor Lazzarini
> Senior Lecturer
> Dept. of Music
> NUI Maynooth Ireland
> tel.: +353 1 708 3545
> Victor dot Lazzarini AT nuim dot ie
>
>
>
>
> ------------------------------------------------------------------------------
> Introducing Performance Central, a new site from SourceForge and
> AppDynamics. Performance Central is your source for news, insights,
> analysis and resources for efficient Application Performance Management.
> Visit us today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2013-08-22 21:50
FromTito Latini
SubjectRe: [Cs-dev] _sync_fetch_and_add problem with i386
AttachmentsNone  

Date2013-08-22 21:58
FromVictor Lazzarini
SubjectRe: [Cs-dev] _sync_fetch_and_add problem with i386
yes, but  we need  __sync_lock_test_and_set() on the other side of the channel connection,
and that fails too with int64_t.

On 22 Aug 2013, at 21:50, Tito Latini wrote:

> a simple full barrier ?
> 
> static int chnget_opcode_perf_k(CSOUND *csound, CHNGET *p)
> {
> #ifdef HAVE_ATOMIC_BUILTIN
>    __sync_synchronize();
> #endif
>    *(p->arg) = *(p->fp);
>    return OK;
> }
> 
> On Thu, Aug 22, 2013 at 03:01:35PM -0400, Steven Yi wrote:
>> I'm assuming that the pd lib I'm building will also fail then. Not
>> sure of a solution either.
>> 
>> On Thu, Aug 22, 2013 at 1:56 PM, Victor Lazzarini
>>  wrote:
>>> No, but for the moment, I am not doing i386 anymore.
>>> On 22 Aug 2013, at 16:28, Steven Yi wrote:
>>> 
>>>> Have you tried compiling with clang?  I've had problems with the
>>>> atomic stuff on Windows i386, but that was in linking. (Didn't even
>>>> get to runtime. :P ).
>>>> 
>>>> On Thu, Aug 22, 2013 at 6:56 AM, Victor Lazzarini
>>>>  wrote:
>>>>> It appears that there is a problem with _sync_fetch_and_add  in the i386 architecture. I am
>>>>> get segfaults at bus.c:586
>>>>> 
>>>>> Program received signal EXC_BAD_ACCESS, Could not access memory.
>>>>> Reason: KERN_PROTECTION_FAILURE at address: 0x00000000
>>>>> 0x0003fe98 in chnget_opcode_perf_k (csound=0x800000, p=0x894a78) at /Users/victor/src/csound6/OOps/bus.c:586
>>>>> 586         x.i = __sync_fetch_and_add((MYFLT_INT_TYPE *) p->fp, 0);
>>>>> 
>>>>> Compiling without any optimisation appears to stop the segfault, and the code seems to work. So if it was
>>>>> the case that the intrinsic did not exist for int64_t in i386, it would not suddenly start to work.
>>>>> 
>>>>> Not sure how to solve this.
>>>>> 
>>>>> gcc version 4.2.1 (Apple Inc. build 5666)
>>>>> 
>>>>> Dr Victor Lazzarini
>>>>> Senior Lecturer
>>>>> Dept. of Music
>>>>> NUI Maynooth Ireland
>>>>> tel.: +353 1 708 3545
>>>>> Victor dot Lazzarini AT nuim dot ie
>>>>> 
> 
> ------------------------------------------------------------------------------
> Introducing Performance Central, a new site from SourceForge and 
> AppDynamics. Performance Central is your source for news, insights, 
> analysis and resources for efficient Application Performance Management. 
> Visit us today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2013-08-22 22:37
FromTito Latini
SubjectRe: [Cs-dev] _sync_fetch_and_add problem with i386
AttachmentsNone