On Fri, 25 Jul 2014, Jeff Law wrote:

> On 07/24/14 03:35, Richard Biener wrote:
> > 
> > The following fixes one of the most annoying parts of non-working -ftrapv,
> > namely that we only support >= word_mode trappings (quite annoying on
> > 64bit archs where 'int' is not handled).  At least on x86_64 libgcc
> > has all the libfuncs available for SImode so the following patch
> > arranges for them to be used.  RFC because I don't know whether
> > they are there by accident... (and thus the patch adds a requirement
> > that is not met by other targets - but a link error is better than
> > -ftrapv failure?)
> > 
> > The testcase relies on fork() to be able to capture both inline
> > and out-of-line trapv sequences.  dg-require-fork is unused but
> > present, so I use it.  I suppose we can restrict the testcase
> > to a few targets manually as well - not sure, any preferences?
> > 
> > At least the obvious testcase from PR52478 now works (until
> > you hit constant folding ... see PR61893 I just opened).
> > 
> > Bootstrap and regtest running on x86_64-unknown-linux-gnu, ok
> > for trunk?
> > 
> > Thanks,
> > Richard.
> > 
> > 
> > 2014-07-24  Richard Biener  <rguent...@suse.de>
> > 
> >     PR middle-end/52478
> >     * optabs.c (gen_int_libfunc): For -ftrapv libfuncs make
> >     sure to register SImode ones, not only >= word_mode ones.
> >     * expr.c (expand_expr_real_2): When expanding -ftrapv
> >     binops do not use OPTAB_LIB_WIDEN.
> > 
> >     * gcc.dg/torture/ftrapv-1.c: New testcase.
> I'm certainly comfortable requiring more bits in libgcc (which are often going
> to be there anyway) to get -ftrapv to work.
> 
> I'd be a little worried the testcase won't work on simulated targets. Perhaps
> limit it to native only?  I'd consider this is relatively minor issue and not
> enough to hold up the patch.

We'd have the simulator effective target to fix that, but I see no
runtime related disabling of simulator targets elsewhere so I went ahead
and committed the patch without any change.

Richard.

Reply via email to