This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PR 87339, testsuite] Fix failure of gcc.dg/warn-abs-1.c on some targets
- From: Christophe Lyon <christophe dot lyon at linaro dot org>
- To: Martin Jambor <mjambor at suse dot cz>
- Cc: christophe lyon St <christophe dot lyon at st dot com>, "Joseph S. Myers" <joseph at codesourcery dot com>, gcc Patches <gcc-patches at gcc dot gnu dot org>, Mike Stump <mikestump at comcast dot net>
- Date: Wed, 10 Oct 2018 14:44:08 +0200
- Subject: Re: [PR 87339, testsuite] Fix failure of gcc.dg/warn-abs-1.c on some targets
- References: <ri6tvmehgzp.fsf@suse.cz> <CAKdteOao-3kFe7RPZfWGET3NeJ1zCrLLquoofs1w7L23H9Vsow@mail.gmail.com> <ri6tvmdfuen.fsf@suse.cz> <CAKdteOZNgY1aWe+EzQh8r-AU0+CAL2BYDAfXZ0HiHO4atXRNyQ@mail.gmail.com> <ri6in2sffez.fsf@suse.cz> <alpine.DEB.2.21.1809261704080.9033@digraph.polyomino.org.uk> <ri68t36vynl.fsf@suse.cz> <c26e8e06-0d9e-dc58-6725-2a24d620bfe1@st.com> <ri64lduvv28.fsf@suse.cz>
On Wed, 10 Oct 2018 at 14:35, Martin Jambor <mjambor@suse.cz> wrote:
>
> Hi,
>
> On Wed, Oct 10 2018, Christophe Lyon wrote:
> > On 10/10/2018 13:17, Martin Jambor wrote:
> >> Hi,
> >>
> >> On Wed, Sep 26 2018, Joseph Myers wrote:
> >>> On Wed, 26 Sep 2018, Martin Jambor wrote:
> >>>
> >>>> I see, I guess the easiest is to skip the test on targets that do not
> >>>> really have long double, although if someone thinks that is too
> >>>> restrictive, I can also split the test again and move long double bits
> >>>> to a separate test.
> >>> You should be able to use
> >>>
> >>> { dg-warning "warning regex" "test name" { target { large_long_double } } }
> >>>
> >>> to make the expectation of a warning conditional without making the whole
> >>> test conditional.
> >> I hoped that Christophe would try this out because I do not have an easy
> >> access to a problematic architecture, but I can at least confirm that
> >> the following still passes on x86_64-linux (and should also pass on
> >> archs without long double, if I understood Joseph well).
> >
> > I did: https://gcc.gnu.org/ml/gcc-patches/2018-09/msg01713.html
> > Sorry if I wasn't explicit enough
>
> Oh, sorry, I somehow completely missed that. Thanks for testing then.
>
> >> @@ -57,7 +57,7 @@ void tst_notcomplex (int *pi, long *pl, long double *pld)
> >> void tst_cplx_size (complex double *pcd, complex long double *pcld)
> >> {
> >> *pcd = cabsf (*pcd); /* { dg-warning "may cause truncation of value" } */
> >> - *pcld = cabs (*pcld); /* { dg-warning "may cause truncation of value" } */
> >> + *pcld = cabs (*pcld); /* { /* { dg-warning "may cause truncation of value" "cabs trunc" { target {
> >
> > OK for me, except that you have an extra '/*' in the line above.
> >
>
> Silly me, the fixed patch is below. OK for trunk?
>
OK for me.
> Martin
>
>
> 2018-10-10 Martin Jambor <mjambor@suse.cz>
>
> testsuite/
> * gcc.dg/warn-abs-1.c: Guard tests assuming size of long double is
> greater that the size of double by target large_long double.
> ---
> gcc/testsuite/gcc.dg/warn-abs-1.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/gcc/testsuite/gcc.dg/warn-abs-1.c b/gcc/testsuite/gcc.dg/warn-abs-1.c
> index 1c487270042..c016ff620c4 100644
> --- a/gcc/testsuite/gcc.dg/warn-abs-1.c
> +++ b/gcc/testsuite/gcc.dg/warn-abs-1.c
> @@ -43,7 +43,7 @@ void
> tst_float_size (double *pd, long double *pld)
> {
> *pd = fabsf (*pd); /* { dg-warning "may cause truncation of value" } */
> - *pld = fabs (*pld); /* { dg-warning "may cause truncation of value" } */
> + *pld = fabs (*pld); /* { dg-warning "may cause truncation of value" "fabs trunc" { target { large_long_double } } } */
> *pld = fabs ((double) *pld);
> }
>
> @@ -57,7 +57,7 @@ void tst_notcomplex (int *pi, long *pl, long double *pld)
> void tst_cplx_size (complex double *pcd, complex long double *pcld)
> {
> *pcd = cabsf (*pcd); /* { dg-warning "may cause truncation of value" } */
> - *pcld = cabs (*pcld); /* { dg-warning "may cause truncation of value" } */
> + *pcld = cabs (*pcld); /* { dg-warning "may cause truncation of value" "cabs trunc" { target { large_long_double } } } */
> *pcld = cabs ((complex double) *pcld);
> }
>
> --
> 2.19.0
>