C++: Letting compiler know asm block can call function that can throw?

2012-03-29 Thread Stephan Bergmann
Hi all, In LibreOffice's ever-beloved low-level code to synthesize calls to C++ virtual functions, I'm having the following problem (on Linux x86_64). The function callVirtualMethod at

Re: C++: Letting compiler know asm block can call function that can throw?

2012-03-29 Thread Jakub Jelinek
On Thu, Mar 29, 2012 at 09:05:29AM +0200, Stephan Bergmann wrote: > In LibreOffice's ever-beloved low-level code to synthesize calls to > C++ virtual functions, I'm having the following problem (on Linux > x86_64). The function callVirtualMethod at >

Re: C++: Letting compiler know asm block can call function that can throw?

2012-03-29 Thread Stephan Bergmann
On 03/29/2012 09:44 AM, Jakub Jelinek wrote: On Thu, Mar 29, 2012 at 09:05:29AM +0200, Stephan Bergmann wrote: In LibreOffice's ever-beloved low-level code to synthesize calls to C++ virtual functions, I'm having the following problem (on Linux x86_64). The function callVirtualMethod at

Re: C++: Letting compiler know asm block can call function that can throw?

2012-03-29 Thread Richard Guenther
On Thu, Mar 29, 2012 at 10:47 AM, Stephan Bergmann wrote: > On 03/29/2012 09:44 AM, Jakub Jelinek wrote: >> >> On Thu, Mar 29, 2012 at 09:05:29AM +0200, Stephan Bergmann wrote: >>> >>> In LibreOffice's ever-beloved low-level code to synthesize calls to >>> C++ virtual functions, I'm having the fol

Re: C++: Letting compiler know asm block can call function that can throw?

2012-03-29 Thread Stephan Bergmann
On 03/29/2012 11:16 AM, Richard Guenther wrote: On Thu, Mar 29, 2012 at 10:47 AM, Stephan Bergmann wrote: So an explicit -fnon-call-exceptions on the command line seems to indeed help. Unfortunately, moving that into a #pragma GCC optimize ("non-call-exceptions") at the top of the source f

Re: C++: Letting compiler know asm block can call function that can throw?

2012-03-29 Thread Michael Matz
Hi, On Thu, 29 Mar 2012, Stephan Bergmann wrote: > > > Anyway, would it be worthwhile filing an RFE for an asm annotation > > > telling the compiler that it contains code that can throw? > > > > I suppose yes. > > "RFE: Letting > compiler kno

Re: C++: Letting compiler know asm block can call function that can throw?

2012-03-29 Thread Andrew Haley
On 03/29/2012 02:59 PM, Michael Matz wrote: > Actually, with -fnon-call-exceptions volatile asms are already supposed to > be throwing. It's just that this got lost with tree-ssa. With the patch > and -fnon-call-exceptions a simple "__asm__ volatile (...)" is regarded as > possibly throwing. >

Re: C++: Letting compiler know asm block can call function that can throw?

2012-03-29 Thread Stephan Bergmann
On 03/29/2012 04:12 PM, Andrew Haley wrote: On 03/29/2012 02:59 PM, Michael Matz wrote: Actually, with -fnon-call-exceptions volatile asms are already supposed to be throwing. It's just that this got lost with tree-ssa. With the patch and -fnon-call-exceptions a simple "__asm__ volatile (...)"

Re: C++: Letting compiler know asm block can call function that can throw?

2012-03-29 Thread Michael Matz
Hi, On Thu, 29 Mar 2012, Andrew Haley wrote: > On 03/29/2012 02:59 PM, Michael Matz wrote: > > Actually, with -fnon-call-exceptions volatile asms are already supposed to > > be throwing. It's just that this got lost with tree-ssa. With the patch > > and -fnon-call-exceptions a simple "__asm__

Re: C++: Letting compiler know asm block can call function that can throw?

2012-03-29 Thread Richard Henderson
On 03/29/2012 03:05 AM, Stephan Bergmann wrote: > Hi all, > > In LibreOffice's ever-beloved low-level code to synthesize calls to > C++ virtual functions, I'm having the following problem (on Linux > x86_64). The function callVirtualMethod at >

Re: C++: Letting compiler know asm block can call function that can throw?

2012-03-29 Thread Jan Hubicka
> On 03/29/2012 03:05 AM, Stephan Bergmann wrote: > > Hi all, > > > > In LibreOffice's ever-beloved low-level code to synthesize calls to > > C++ virtual functions, I'm having the following problem (on Linux > > x86_64). The function callVirtualMethod at > >

Re: C++: Letting compiler know asm block can call function that can throw?

2012-03-29 Thread Richard Henderson
On 03/29/2012 01:16 PM, Jan Hubicka wrote: >> Of course, there's still the problem of getting the unwind data correct at >> the point of the asm. I commented about that in the PR you filed. > > I think i386 still has the problem that it is small register class target and > if you > set rdi/rax a

Re: C++: Letting compiler know asm block can call function that can throw?

2012-03-29 Thread Eric Botcazou
> non-call-exceptions is a relatively big hammer. It marks _all_ > non-trivial instructions as throwing. The "all" goes against the "relatively" here, and "relatively" is more correct. Not all non-trivial instructions are marked as throwing, e.g. loads and stores from/to the stack aren't. -- E

Re: C++: Letting compiler know asm block can call function that can throw?

2012-03-30 Thread Richard Guenther
On Thu, Mar 29, 2012 at 8:34 PM, Richard Henderson wrote: > On 03/29/2012 01:16 PM, Jan Hubicka wrote: >>> Of course, there's still the problem of getting the unwind data correct at >>> the point of the asm.  I commented about that in the PR you filed. >> >> I think i386 still has the problem that

Re: C++: Letting compiler know asm block can call function that can throw?

2012-03-30 Thread Richard Guenther
On Thu, Mar 29, 2012 at 3:59 PM, Michael Matz wrote: > Hi, > > On Thu, 29 Mar 2012, Stephan Bergmann wrote: > >> > > Anyway, would it be worthwhile filing an RFE for an asm annotation >> > > telling the compiler that it contains code that can throw? >> > >> > I suppose yes. >> >>

Re: C++: Letting compiler know asm block can call function that can throw?

2012-03-30 Thread Jan Hubicka
> On Thu, Mar 29, 2012 at 8:34 PM, Richard Henderson wrote: > > On 03/29/2012 01:16 PM, Jan Hubicka wrote: > >>> Of course, there's still the problem of getting the unwind data correct at > >>> the point of the asm.  I commented about that in the PR you filed. > >> > >> I think i386 still has the

Re: C++: Letting compiler know asm block can call function that can throw?

2012-03-30 Thread Richard Guenther
2012/3/30 Jan Hubicka : >> On Thu, Mar 29, 2012 at 8:34 PM, Richard Henderson wrote: >> > On 03/29/2012 01:16 PM, Jan Hubicka wrote: >> >>> Of course, there's still the problem of getting the unwind data correct >> >>> at >> >>> the point of the asm.  I commented about that in the PR you filed. >

Re: C++: Letting compiler know asm block can call function that can throw?

2012-03-30 Thread Jan Hubicka
> > Motion across hardreg sets/uses are not restricted. And I would not expect > an optimizing compiler to do that (it's your own fault to use hardregs in > complex C code). Well, the syscall sequence is an example of somehting that should be inlined into arbitrary code w/o potential risk of ICE

Re: C++: Letting compiler know asm block can call function that can throw?

2012-04-02 Thread Michael Matz
Hi, On Fri, 30 Mar 2012, Jan Hubicka wrote: > > Motion across hardreg sets/uses are not restricted. And I would not expect > > an optimizing compiler to do that (it's your own fault to use hardregs in > > complex C code). > > Well, the syscall sequence is an example of somehting that should be

Re: C++: Letting compiler know asm block can call function that can throw?

2012-04-02 Thread Jakub Jelinek
On Mon, Apr 02, 2012 at 04:07:59PM +0200, Michael Matz wrote: > On Fri, 30 Mar 2012, Jan Hubicka wrote: > > > > Motion across hardreg sets/uses are not restricted. And I would not > > > expect > > > an optimizing compiler to do that (it's your own fault to use hardregs in > > > complex C code).

Re: C++: Letting compiler know asm block can call function that can throw?

2012-04-02 Thread Michael Matz
Hi, On Mon, 2 Apr 2012, Jakub Jelinek wrote: > > inline int syscall1(int number, long arg1) { > > register int ax __asm__("eax"); > > register long di __asm__("rdi"); > > ax = number; > > di = arg1; > > __asm__ volatile ("syscall"); > > } > > > > _then_ we would probably get miscompila

Re: C++: Letting compiler know asm block can call function that can throw?

2012-04-16 Thread Hans-Peter Nilsson
On Mon, 2 Apr 2012, Michael Matz wrote: > On Mon, 2 Apr 2012, Jakub Jelinek wrote: > > > > inline int syscall1(int number, long arg1) { > > > register int ax __asm__("eax"); > > > register long di __asm__("rdi"); > > > ax = number; > > > di = arg1; > > > __asm__ volatile ("syscall"); > >