This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: C++: Letting compiler know asm block can call function that can throw?
- From: Michael Matz <matz at suse dot de>
- To: Jan Hubicka <hubicka at ucw dot cz>
- Cc: Richard Guenther <richard dot guenther at gmail dot com>, Richard Henderson <rth at redhat dot com>, Stephan Bergmann <sbergman at redhat dot com>, gcc at gcc dot gnu dot org
- Date: Mon, 2 Apr 2012 16:07:59 +0200 (CEST)
- Subject: Re: C++: Letting compiler know asm block can call function that can throw?
- References: <4F7409B9.2010407@redhat.com> <4F748A47.4070306@redhat.com> <20120329171639.GD18490@atrey.karlin.mff.cuni.cz> <4F74AB1F.2020607@redhat.com> <CAFiYyc3Z00jGmQFVjotK4bF7_Br6uUkP=2ka=rs_UAtXGnqHtw@mail.gmail.com> <20120330122106.GE8468@kam.mff.cuni.cz> <CAFiYyc2ryHLbzXP_67ngHnB7NGOGkBkjnFO8b8DBYdMAxcmZUQ@mail.gmail.com> <20120330154537.GB1340@kam.mff.cuni.cz>
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
> inlined into arbitrary code w/o potential risk of ICEs.
The syscall sequence doesn't consist of multiple independend instructions,
but rather is one asm with the right constraints. So gcc has no chance to
move something between the register setup (which only is explicit after
reload) and the syscall instruction. If syscall sequences were
implemented like this:
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 miscompilations here and there.
Ciao,
Michael.