* [Patch, fortran] PR94246 - [9/10 Regression] valgrind error for ./gfortran.dg/bessel_5.f90 since r9-1566-g87c789f1c0b2df41
@ 2020-03-26 11:20 Paul Richard Thomas
2020-03-26 11:37 ` Tobias Burnus
0 siblings, 1 reply; 4+ messages in thread
From: Paul Richard Thomas @ 2020-03-26 11:20 UTC (permalink / raw)
To: fortran, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 1843 bytes --]
This turned out to be relatively trivial, following a fair amount of
head scratching:-(
Regtests on FC31/x64_86 - OK for both branches?
Paul
2020-03-26 Paul Thomas <pault@gcc.gnu.org>
PR fortran/94246
* expr.c (scalarize_intrinsic_call): Remove the error checking.
Make a copy of the expression to be simplified and only replace
the original if the simplification succeeds.
2020-03-26 Paul Thomas <pault@gcc.gnu.org>
PR fortran/94246
* gfortran.dg/bessel_5_redux.f90 : New test.
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index 79e00b4112a..1106341df91 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -2296,9 +2296,8 @@ scalarize_intrinsic_call (gfc_expr *e, bool init_flag)
gfc_constructor_base ctor;
gfc_constructor *args[5] = {}; /* Avoid uninitialized warnings. */
gfc_constructor *ci, *new_ctor;
- gfc_expr *expr, *old;
+ gfc_expr *expr, *old, *p;
int n, i, rank[5], array_arg;
- int errors = 0;
if (e == NULL)
return false;
@@ -2366,8 +2365,6 @@ scalarize_intrinsic_call (gfc_expr *e, bool init_flag)
n++;
}
- gfc_get_errors (NULL, &errors);
-
/* Using the array argument as the master, step through the array
calling the function for each element and advancing the array
constructors together. */
@@ -2401,8 +2398,12 @@ scalarize_intrinsic_call (gfc_expr *e, bool init_flag)
/* Simplify the function calls. If the simplification fails, the
error will be flagged up down-stream or the library will deal
with it. */
- if (errors == 0)
- gfc_simplify_expr (new_ctor->expr, 0);
+ p = gfc_copy_expr (new_ctor->expr);
+
+ if (!gfc_simplify_expr (p, init_flag))
+ gfc_free_expr (p);
+ else
+ gfc_replace_expr (new_ctor->expr, p);
for (i = 0; i < n; i++)
if (args[i])
[-- Attachment #2: bessel_5_redux.f90 --]
[-- Type: text/x-fortran, Size: 1896 bytes --]
! { dg-do compile }
! { dg-options "-Wall" }
!
! Check fix for PR94246 in which the errors in line 63 caused a segfault
! because the cleanup was not done correctly without the -fno-range-check option.
!
! This is a copy of bessel_5.f90 with the error messages added.
!
! -Wall has been specified to disabled -pedantic, which warns about the
! negative order (GNU extension) to the order of the Bessel functions of
! first and second kind.
!
implicit none
integer :: i
! Difference to mpfr_jn <= 1 epsilon
if (any (abs (BESSEL_JN(2, 5, 2.457) - [(BESSEL_JN(i, 2.457), i = 2, 5)]) &
> epsilon(0.0))) then
print *, 'FAIL 1'
STOP 1
end if
! Difference to mpfr_yn <= 4 epsilon
if (any (abs (BESSEL_YN(2, 5, 2.457) - [(BESSEL_YN(i, 2.457), i = 2, 5)]) &
> epsilon(0.0)*4)) then
STOP 2
end if
! Difference to mpfr_jn <= 1 epsilon
if (any (abs (BESSEL_JN(0, 10, 4.457) &
- [ (BESSEL_JN(i, 4.457), i = 0, 10) ]) &
> epsilon(0.0))) then
STOP 3
end if
! Difference to mpfr_yn <= 192 epsilon
if (any (abs (BESSEL_YN(0, 10, 4.457) &
- [ (BESSEL_YN(i, 4.457), i = 0, 10) ]) &
> epsilon(0.0)*192)) then
STOP 4
end if
! Difference to mpfr_jn: None. (Special case: X = 0.0)
if (any (BESSEL_JN(0, 10, 0.0) /= [ (BESSEL_JN(i, 0.0), i = 0, 10) ])) &
then
STOP 5
end if
! Difference to mpfr_yn: None. (Special case: X = 0.0)
if (any (BESSEL_YN(0, 10, 0.0) /= [ (BESSEL_YN(i, 0.0), i = 0, 10) ])) & ! { dg-error "overflows|-INF" }
then
STOP 6
end if
! Difference to mpfr_jn <= 1 epsilon
if (any (abs (BESSEL_JN(0, 10, 1.0) &
- [ (BESSEL_JN(i, 1.0), i = 0, 10) ]) &
> epsilon(0.0)*1)) then
STOP 7
end if
! Difference to mpfr_yn <= 32 epsilon
if (any (abs (BESSEL_YN(0, 10, 1.0) &
- [ (BESSEL_YN(i, 1.0), i = 0, 10) ]) &
> epsilon(0.0)*32)) then
STOP 8
end if
end
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Patch, fortran] PR94246 - [9/10 Regression] valgrind error for ./gfortran.dg/bessel_5.f90 since r9-1566-g87c789f1c0b2df41
2020-03-26 11:20 [Patch, fortran] PR94246 - [9/10 Regression] valgrind error for ./gfortran.dg/bessel_5.f90 since r9-1566-g87c789f1c0b2df41 Paul Richard Thomas
@ 2020-03-26 11:37 ` Tobias Burnus
2020-03-29 12:25 ` H.J. Lu
0 siblings, 1 reply; 4+ messages in thread
From: Tobias Burnus @ 2020-03-26 11:37 UTC (permalink / raw)
To: Paul Richard Thomas, fortran, gcc-patches
Dear Paul,
OK – thanks for the patch.
Tobias
PS: I assume that the spacing issue in the patch
is due to the mail program.
On 3/26/20 12:20 PM, Paul Richard Thomas via Fortran wrote:
> This turned out to be relatively trivial, following a fair amount of
> head scratching:-(
>
> Regtests on FC31/x64_86 - OK for both branches?
>
> Paul
>
> 2020-03-26 Paul Thomas <pault@gcc.gnu.org>
>
> PR fortran/94246
> * expr.c (scalarize_intrinsic_call): Remove the error checking.
> Make a copy of the expression to be simplified and only replace
> the original if the simplification succeeds.
>
> 2020-03-26 Paul Thomas <pault@gcc.gnu.org>
>
> PR fortran/94246
> * gfortran.dg/bessel_5_redux.f90 : New test.
>
> diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
> index 79e00b4112a..1106341df91 100644
> --- a/gcc/fortran/expr.c
> +++ b/gcc/fortran/expr.c
> @@ -2296,9 +2296,8 @@ scalarize_intrinsic_call (gfc_expr *e, bool init_flag)
> gfc_constructor_base ctor;
> gfc_constructor *args[5] = {}; /* Avoid uninitialized warnings. */
> gfc_constructor *ci, *new_ctor;
> - gfc_expr *expr, *old;
> + gfc_expr *expr, *old, *p;
> int n, i, rank[5], array_arg;
> - int errors = 0;
>
> if (e == NULL)
> return false;
> @@ -2366,8 +2365,6 @@ scalarize_intrinsic_call (gfc_expr *e, bool init_flag)
> n++;
> }
>
> - gfc_get_errors (NULL, &errors);
> -
> /* Using the array argument as the master, step through the array
> calling the function for each element and advancing the array
> constructors together. */
> @@ -2401,8 +2398,12 @@ scalarize_intrinsic_call (gfc_expr *e, bool init_flag)
> /* Simplify the function calls. If the simplification fails, the
> error will be flagged up down-stream or the library will deal
> with it. */
> - if (errors == 0)
> - gfc_simplify_expr (new_ctor->expr, 0);
> + p = gfc_copy_expr (new_ctor->expr);
> +
> + if (!gfc_simplify_expr (p, init_flag))
> + gfc_free_expr (p);
> + else
> + gfc_replace_expr (new_ctor->expr, p);
>
> for (i = 0; i < n; i++)
> if (args[i])
-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Patch, fortran] PR94246 - [9/10 Regression] valgrind error for ./gfortran.dg/bessel_5.f90 since r9-1566-g87c789f1c0b2df41
2020-03-26 11:37 ` Tobias Burnus
@ 2020-03-29 12:25 ` H.J. Lu
2020-03-29 12:29 ` H.J. Lu
0 siblings, 1 reply; 4+ messages in thread
From: H.J. Lu @ 2020-03-29 12:25 UTC (permalink / raw)
To: Tobias Burnus; +Cc: Paul Richard Thomas, fortran, gcc-patches
On Thu, Mar 26, 2020 at 4:38 AM Tobias Burnus <tobias@codesourcery.com> wrote:
>
> Dear Paul,
>
> OK – thanks for the patch.
>
> Tobias
>
> PS: I assume that the spacing issue in the patch
> is due to the mail program.
>
> On 3/26/20 12:20 PM, Paul Richard Thomas via Fortran wrote:
>
> > This turned out to be relatively trivial, following a fair amount of
> > head scratching:-(
> >
> > Regtests on FC31/x64_86 - OK for both branches?
> >
> > Paul
> >
> > 2020-03-26 Paul Thomas <pault@gcc.gnu.org>
> >
> > PR fortran/94246
> > * expr.c (scalarize_intrinsic_call): Remove the error checking.
> > Make a copy of the expression to be simplified and only replace
> > the original if the simplification succeeds.
> >
> > 2020-03-26 Paul Thomas <pault@gcc.gnu.org>
> >
> > PR fortran/94246
> > * gfortran.dg/bessel_5_redux.f90 : New test.
> >
This caused:
FAIL: gfortran.dg/pr93365.f90 -O0 (internal compiler error)
FAIL: gfortran.dg/pr93365.f90 -O0 (test for excess errors)
FAIL: gfortran.dg/pr93365.f90 -O1 (internal compiler error)
FAIL: gfortran.dg/pr93365.f90 -O1 (test for excess errors)
FAIL: gfortran.dg/pr93365.f90 -O2 (internal compiler error)
FAIL: gfortran.dg/pr93365.f90 -O2 (test for excess errors)
FAIL: gfortran.dg/pr93365.f90 -O3 -fomit-frame-pointer
-funroll-loops -fpeel-loops -ftracer -finline-functions (internal
compiler error)
FAIL: gfortran.dg/pr93365.f90 -O3 -fomit-frame-pointer
-funroll-loops -fpeel-loops -ftracer -finline-functions (test for
excess errors)
FAIL: gfortran.dg/pr93365.f90 -O3 -g (internal compiler error)
FAIL: gfortran.dg/pr93365.f90 -O3 -g (test for excess errors)
FAIL: gfortran.dg/pr93365.f90 -Os (internal compiler error)
FAIL: gfortran.dg/pr93365.f90 -Os (test for excess errors)
FAIL: gfortran.dg/pr93600_1.f90 -O (internal compiler error)
FAIL: gfortran.dg/pr93600_1.f90 -O (test for errors, line 6)
FAIL: gfortran.dg/pr93600_1.f90 -O (test for errors, line 7)
FAIL: gfortran.dg/pr93600_1.f90 -O (test for excess errors)
FAIL: gfortran.dg/pr93600_2.f90 -O0 (internal compiler error)
FAIL: gfortran.dg/pr93600_2.f90 -O0 (test for excess errors)
FAIL: gfortran.dg/pr93600_2.f90 -O1 (internal compiler error)
FAIL: gfortran.dg/pr93600_2.f90 -O1 (test for excess errors)
FAIL: gfortran.dg/pr93600_2.f90 -O2 (internal compiler error)
FAIL: gfortran.dg/pr93600_2.f90 -O2 (test for excess errors)
FAIL: gfortran.dg/pr93600_2.f90 -O3 -fomit-frame-pointer
-funroll-loops -fpeel-loops -ftracer -finline-functions (internal
compiler error)
FAIL: gfortran.dg/pr93600_2.f90 -O3 -fomit-frame-pointer
-funroll-loops -fpeel-loops -ftracer -finline-functions (test for
excess errors)
FAIL: gfortran.dg/pr93600_2.f90 -O3 -g (internal compiler error)
FAIL: gfortran.dg/pr93600_2.f90 -O3 -g (test for excess errors)
FAIL: gfortran.dg/pr93600_2.f90 -Os (internal compiler error)
FAIL: gfortran.dg/pr93600_2.f90 -Os (test for excess errors)
--
H.J.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Patch, fortran] PR94246 - [9/10 Regression] valgrind error for ./gfortran.dg/bessel_5.f90 since r9-1566-g87c789f1c0b2df41
2020-03-29 12:25 ` H.J. Lu
@ 2020-03-29 12:29 ` H.J. Lu
0 siblings, 0 replies; 4+ messages in thread
From: H.J. Lu @ 2020-03-29 12:29 UTC (permalink / raw)
To: Tobias Burnus; +Cc: Paul Richard Thomas, fortran, gcc-patches
On Sun, Mar 29, 2020 at 5:25 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Thu, Mar 26, 2020 at 4:38 AM Tobias Burnus <tobias@codesourcery.com> wrote:
> >
> > Dear Paul,
> >
> > OK – thanks for the patch.
> >
> > Tobias
> >
> > PS: I assume that the spacing issue in the patch
> > is due to the mail program.
> >
> > On 3/26/20 12:20 PM, Paul Richard Thomas via Fortran wrote:
> >
> > > This turned out to be relatively trivial, following a fair amount of
> > > head scratching:-(
> > >
> > > Regtests on FC31/x64_86 - OK for both branches?
> > >
> > > Paul
> > >
> > > 2020-03-26 Paul Thomas <pault@gcc.gnu.org>
> > >
> > > PR fortran/94246
> > > * expr.c (scalarize_intrinsic_call): Remove the error checking.
> > > Make a copy of the expression to be simplified and only replace
> > > the original if the simplification succeeds.
> > >
> > > 2020-03-26 Paul Thomas <pault@gcc.gnu.org>
> > >
> > > PR fortran/94246
> > > * gfortran.dg/bessel_5_redux.f90 : New test.
> > >
>
> This caused:
>
> FAIL: gfortran.dg/pr93365.f90 -O0 (internal compiler error)
> FAIL: gfortran.dg/pr93365.f90 -O0 (test for excess errors)
> FAIL: gfortran.dg/pr93365.f90 -O1 (internal compiler error)
> FAIL: gfortran.dg/pr93365.f90 -O1 (test for excess errors)
> FAIL: gfortran.dg/pr93365.f90 -O2 (internal compiler error)
> FAIL: gfortran.dg/pr93365.f90 -O2 (test for excess errors)
> FAIL: gfortran.dg/pr93365.f90 -O3 -fomit-frame-pointer
> -funroll-loops -fpeel-loops -ftracer -finline-functions (internal
> compiler error)
> FAIL: gfortran.dg/pr93365.f90 -O3 -fomit-frame-pointer
> -funroll-loops -fpeel-loops -ftracer -finline-functions (test for
> excess errors)
> FAIL: gfortran.dg/pr93365.f90 -O3 -g (internal compiler error)
> FAIL: gfortran.dg/pr93365.f90 -O3 -g (test for excess errors)
> FAIL: gfortran.dg/pr93365.f90 -Os (internal compiler error)
> FAIL: gfortran.dg/pr93365.f90 -Os (test for excess errors)
> FAIL: gfortran.dg/pr93600_1.f90 -O (internal compiler error)
> FAIL: gfortran.dg/pr93600_1.f90 -O (test for errors, line 6)
> FAIL: gfortran.dg/pr93600_1.f90 -O (test for errors, line 7)
> FAIL: gfortran.dg/pr93600_1.f90 -O (test for excess errors)
> FAIL: gfortran.dg/pr93600_2.f90 -O0 (internal compiler error)
> FAIL: gfortran.dg/pr93600_2.f90 -O0 (test for excess errors)
> FAIL: gfortran.dg/pr93600_2.f90 -O1 (internal compiler error)
> FAIL: gfortran.dg/pr93600_2.f90 -O1 (test for excess errors)
> FAIL: gfortran.dg/pr93600_2.f90 -O2 (internal compiler error)
> FAIL: gfortran.dg/pr93600_2.f90 -O2 (test for excess errors)
> FAIL: gfortran.dg/pr93600_2.f90 -O3 -fomit-frame-pointer
> -funroll-loops -fpeel-loops -ftracer -finline-functions (internal
> compiler error)
> FAIL: gfortran.dg/pr93600_2.f90 -O3 -fomit-frame-pointer
> -funroll-loops -fpeel-loops -ftracer -finline-functions (test for
> excess errors)
> FAIL: gfortran.dg/pr93600_2.f90 -O3 -g (internal compiler error)
> FAIL: gfortran.dg/pr93600_2.f90 -O3 -g (test for excess errors)
> FAIL: gfortran.dg/pr93600_2.f90 -Os (internal compiler error)
> FAIL: gfortran.dg/pr93600_2.f90 -Os (test for excess errors)
>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94386
--
H.J.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-03-29 12:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-26 11:20 [Patch, fortran] PR94246 - [9/10 Regression] valgrind error for ./gfortran.dg/bessel_5.f90 since r9-1566-g87c789f1c0b2df41 Paul Richard Thomas
2020-03-26 11:37 ` Tobias Burnus
2020-03-29 12:25 ` H.J. Lu
2020-03-29 12:29 ` H.J. Lu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).