* [Bug fortran/106987] [10/11/12/13 Regression] ICE in simplify_intrinsic_op, at fortran/expr.cc:1305
2022-09-20 17:37 [Bug fortran/106987] New: [10/11/12/13 Regression] ICE in simplify_intrinsic_op, at fortran/expr.cc:1305 gscfq@t-online.de
@ 2022-09-20 17:38 ` gscfq@t-online.de
2022-09-20 18:54 ` anlauf at gcc dot gnu.org
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: gscfq@t-online.de @ 2022-09-20 17:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106987
--- Comment #1 from G. Steinmetz <gscfq@t-online.de> ---
Compiles with scalars :
$ cat z2.f90
program p
! integer, parameter :: a = 31
integer, parameter :: b = 32
integer, parameter :: c = 33
! print *, 2**a
print *, 2**b
print *, 2**c
end
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/106987] [10/11/12/13 Regression] ICE in simplify_intrinsic_op, at fortran/expr.cc:1305
2022-09-20 17:37 [Bug fortran/106987] New: [10/11/12/13 Regression] ICE in simplify_intrinsic_op, at fortran/expr.cc:1305 gscfq@t-online.de
2022-09-20 17:38 ` [Bug fortran/106987] " gscfq@t-online.de
@ 2022-09-20 18:54 ` anlauf at gcc dot gnu.org
2022-09-21 7:50 ` rguenth at gcc dot gnu.org
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-09-20 18:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106987
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Last reconfirmed| |2022-09-20
Status|UNCONFIRMED |NEW
Keywords| |ice-on-invalid-code
--- Comment #2 from anlauf at gcc dot gnu.org ---
Confirmed.
We are not really good at recovering from arithmetic errors.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/106987] [10/11/12/13 Regression] ICE in simplify_intrinsic_op, at fortran/expr.cc:1305
2022-09-20 17:37 [Bug fortran/106987] New: [10/11/12/13 Regression] ICE in simplify_intrinsic_op, at fortran/expr.cc:1305 gscfq@t-online.de
2022-09-20 17:38 ` [Bug fortran/106987] " gscfq@t-online.de
2022-09-20 18:54 ` anlauf at gcc dot gnu.org
@ 2022-09-21 7:50 ` rguenth at gcc dot gnu.org
2023-07-07 10:44 ` [Bug fortran/106987] [11/12/13/14 " rguenth at gcc dot gnu.org
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-09-21 7:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106987
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P4
Target Milestone|--- |10.5
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/106987] [11/12/13/14 Regression] ICE in simplify_intrinsic_op, at fortran/expr.cc:1305
2022-09-20 17:37 [Bug fortran/106987] New: [10/11/12/13 Regression] ICE in simplify_intrinsic_op, at fortran/expr.cc:1305 gscfq@t-online.de
` (2 preceding siblings ...)
2022-09-21 7:50 ` rguenth at gcc dot gnu.org
@ 2023-07-07 10:44 ` rguenth at gcc dot gnu.org
2024-03-06 16:57 ` cvs-commit at gcc dot gnu.org
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07 10:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106987
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|10.5 |11.5
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10 branch is being closed.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/106987] [11/12/13/14 Regression] ICE in simplify_intrinsic_op, at fortran/expr.cc:1305
2022-09-20 17:37 [Bug fortran/106987] New: [10/11/12/13 Regression] ICE in simplify_intrinsic_op, at fortran/expr.cc:1305 gscfq@t-online.de
` (3 preceding siblings ...)
2023-07-07 10:44 ` [Bug fortran/106987] [11/12/13/14 " rguenth at gcc dot gnu.org
@ 2024-03-06 16:57 ` cvs-commit at gcc dot gnu.org
2024-03-31 12:19 ` pault at gcc dot gnu.org
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-03-06 16:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106987
--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Harald Anlauf <anlauf@gcc.gnu.org>:
https://gcc.gnu.org/g:93e1d4d24ed014387da97e2ce11556d68fe98e66
commit r14-9340-g93e1d4d24ed014387da97e2ce11556d68fe98e66
Author: Harald Anlauf <anlauf@gmx.de>
Date: Tue Mar 5 21:54:26 2024 +0100
Fortran: error recovery while simplifying expressions [PR103707,PR106987]
When an exception is encountered during simplification of arithmetic
expressions, the result may depend on whether range-checking is active
(-frange-check) or not. However, the code path in the front-end should
stay the same for "soft" errors for which the exception is triggered by the
check, while "hard" errors should always terminate the simplification, so
that error recovery is independent of the flag. Separation of arithmetic
error codes into "hard" and "soft" errors shall be done consistently via
is_hard_arith_error().
PR fortran/103707
PR fortran/106987
gcc/fortran/ChangeLog:
* arith.cc (is_hard_arith_error): New helper function to determine
whether an arithmetic error is "hard" or not.
(check_result): Use it.
(gfc_arith_divide): Set "Division by zero" only for regular
numerators of real and complex divisions.
(reduce_unary): Use is_hard_arith_error to determine whether a hard
or (recoverable) soft error was encountered. Terminate immediately
on hard error, otherwise remember code of first soft error.
(reduce_binary_ac): Likewise.
(reduce_binary_ca): Likewise.
(reduce_binary_aa): Likewise.
gcc/testsuite/ChangeLog:
* gfortran.dg/pr99350.f90:
* gfortran.dg/arithmetic_overflow_3.f90: New test.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/106987] [11/12/13/14 Regression] ICE in simplify_intrinsic_op, at fortran/expr.cc:1305
2022-09-20 17:37 [Bug fortran/106987] New: [10/11/12/13 Regression] ICE in simplify_intrinsic_op, at fortran/expr.cc:1305 gscfq@t-online.de
` (4 preceding siblings ...)
2024-03-06 16:57 ` cvs-commit at gcc dot gnu.org
@ 2024-03-31 12:19 ` pault at gcc dot gnu.org
2024-04-01 20:42 ` anlauf at gcc dot gnu.org
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pault at gcc dot gnu.org @ 2024-03-31 12:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106987
Paul Thomas <pault at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pault at gcc dot gnu.org
Assignee|unassigned at gcc dot gnu.org |anlauf at gcc dot gnu.org
--- Comment #5 from Paul Thomas <pault at gcc dot gnu.org> ---
Hi Harald,
I am pinning this one on you since it needs backporting to 13-branch, at least.
It also keeps the audit trail clean.
Cheers
Paul
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/106987] [11/12/13/14 Regression] ICE in simplify_intrinsic_op, at fortran/expr.cc:1305
2022-09-20 17:37 [Bug fortran/106987] New: [10/11/12/13 Regression] ICE in simplify_intrinsic_op, at fortran/expr.cc:1305 gscfq@t-online.de
` (5 preceding siblings ...)
2024-03-31 12:19 ` pault at gcc dot gnu.org
@ 2024-04-01 20:42 ` anlauf at gcc dot gnu.org
2024-04-02 13:32 ` paul.richard.thomas at gmail dot com
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: anlauf at gcc dot gnu.org @ 2024-04-01 20:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106987
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
--- Comment #6 from anlauf at gcc dot gnu.org ---
(In reply to Paul Thomas from comment #5)
> Hi Harald,
>
> I am pinning this one on you since it needs backporting to 13-branch, at
> least. It also keeps the audit trail clean.
Hi Paul,
this one is at the top of my backport list.
It depends on backporting r14-8902 (mine), and has weak conflict if
r14-1629 (yours) is not backported, as testcase gfortran.dg/pr99350.f90
was introduced in that commit.
I could amend backporting the fix for the current PR as well as r14-8902
to 13-branch by removing the changes to pr99350.f90 from the backport.
That is likely the most simple solution, as backporting r14-1629 might
introduce regressions.
Nevertheless, the current fixes can only be backported to 13-branch,
as some of the infrastructure changes for better error recovery after
arithmetic errors and when array ctors are involved are to risky to
backport to 12-branch.
What do you think?
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/106987] [11/12/13/14 Regression] ICE in simplify_intrinsic_op, at fortran/expr.cc:1305
2022-09-20 17:37 [Bug fortran/106987] New: [10/11/12/13 Regression] ICE in simplify_intrinsic_op, at fortran/expr.cc:1305 gscfq@t-online.de
` (6 preceding siblings ...)
2024-04-01 20:42 ` anlauf at gcc dot gnu.org
@ 2024-04-02 13:32 ` paul.richard.thomas at gmail dot com
2024-04-02 14:40 ` paul.richard.thomas at gmail dot com
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: paul.richard.thomas at gmail dot com @ 2024-04-02 13:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106987
--- Comment #7 from paul.richard.thomas at gmail dot com <paul.richard.thomas at gmail dot com> ---
Hi Harald,
I will have a stab at backporting r14-1629 later this afternoon and will
let you know what happens. I am just rebuilding after applying the fix for
pr112407 (yes, I did add -std=f2008 :-) ).
I don't think that there is any point in going back to 12-branch at this
point in the release cycle.
Cheers
Paul
On Mon, 1 Apr 2024 at 21:42, anlauf at gcc dot gnu.org <
gcc-bugzilla@gcc.gnu.org> wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106987
>
> anlauf at gcc dot gnu.org changed:
>
> What |Removed |Added
>
> ----------------------------------------------------------------------------
> Status|NEW |ASSIGNED
>
> --- Comment #6 from anlauf at gcc dot gnu.org ---
> (In reply to Paul Thomas from comment #5)
> > Hi Harald,
> >
> > I am pinning this one on you since it needs backporting to 13-branch, at
> > least. It also keeps the audit trail clean.
>
> Hi Paul,
>
> this one is at the top of my backport list.
>
> It depends on backporting r14-8902 (mine), and has weak conflict if
> r14-1629 (yours) is not backported, as testcase gfortran.dg/pr99350.f90
> was introduced in that commit.
>
> I could amend backporting the fix for the current PR as well as r14-8902
> to 13-branch by removing the changes to pr99350.f90 from the backport.
> That is likely the most simple solution, as backporting r14-1629 might
> introduce regressions.
>
> Nevertheless, the current fixes can only be backported to 13-branch,
> as some of the infrastructure changes for better error recovery after
> arithmetic errors and when array ctors are involved are to risky to
> backport to 12-branch.
>
> What do you think?
>
> --
> You are receiving this mail because:
> You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/106987] [11/12/13/14 Regression] ICE in simplify_intrinsic_op, at fortran/expr.cc:1305
2022-09-20 17:37 [Bug fortran/106987] New: [10/11/12/13 Regression] ICE in simplify_intrinsic_op, at fortran/expr.cc:1305 gscfq@t-online.de
` (7 preceding siblings ...)
2024-04-02 13:32 ` paul.richard.thomas at gmail dot com
@ 2024-04-02 14:40 ` paul.richard.thomas at gmail dot com
2024-04-02 17:07 ` cvs-commit at gcc dot gnu.org
2024-04-02 17:38 ` anlauf at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: paul.richard.thomas at gmail dot com @ 2024-04-02 14:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106987
--- Comment #8 from paul.richard.thomas at gmail dot com <paul.richard.thomas at gmail dot com> ---
Hi Harald,
After a lot of messing around, I managed to backport the patch; essentially
by hand. However, two of the testcases ICEd in trans-array.cc and so there
were obviously dependences that I had missed.
I will not be backporting r14-1629, if for no other reason than it is not a
regression but also because the amount of work that would be involved
doesn't warrant it. It's a pity that I didn't keep 13-branch up to speed
with mainline on the associate fixes but we will just have to live with it
now.
Regards
Paul
On Tue, 2 Apr 2024 at 14:32, Paul Richard Thomas <
paul.richard.thomas@gmail.com> wrote:
> Hi Harald,
>
> I will have a stab at backporting r14-1629 later this afternoon and will
> let you know what happens. I am just rebuilding after applying the fix for
> pr112407 (yes, I did add -std=f2008 :-) ).
>
> I don't think that there is any point in going back to 12-branch at this
> point in the release cycle.
>
> Cheers
>
> Paul
>
>
>
>
> On Mon, 1 Apr 2024 at 21:42, anlauf at gcc dot gnu.org <
> gcc-bugzilla@gcc.gnu.org> wrote:
>
>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106987
>>
>> anlauf at gcc dot gnu.org changed:
>>
>> What |Removed |Added
>>
>> ----------------------------------------------------------------------------
>> Status|NEW |ASSIGNED
>>
>> --- Comment #6 from anlauf at gcc dot gnu.org ---
>> (In reply to Paul Thomas from comment #5)
>> > Hi Harald,
>> >
>> > I am pinning this one on you since it needs backporting to 13-branch, at
>> > least. It also keeps the audit trail clean.
>>
>> Hi Paul,
>>
>> this one is at the top of my backport list.
>>
>> It depends on backporting r14-8902 (mine), and has weak conflict if
>> r14-1629 (yours) is not backported, as testcase gfortran.dg/pr99350.f90
>> was introduced in that commit.
>>
>> I could amend backporting the fix for the current PR as well as r14-8902
>> to 13-branch by removing the changes to pr99350.f90 from the backport.
>> That is likely the most simple solution, as backporting r14-1629 might
>> introduce regressions.
>>
>> Nevertheless, the current fixes can only be backported to 13-branch,
>> as some of the infrastructure changes for better error recovery after
>> arithmetic errors and when array ctors are involved are to risky to
>> backport to 12-branch.
>>
>> What do you think?
>>
>> --
>> You are receiving this mail because:
>> You are on the CC list for the bug.
>
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/106987] [11/12/13/14 Regression] ICE in simplify_intrinsic_op, at fortran/expr.cc:1305
2022-09-20 17:37 [Bug fortran/106987] New: [10/11/12/13 Regression] ICE in simplify_intrinsic_op, at fortran/expr.cc:1305 gscfq@t-online.de
` (8 preceding siblings ...)
2024-04-02 14:40 ` paul.richard.thomas at gmail dot com
@ 2024-04-02 17:07 ` cvs-commit at gcc dot gnu.org
2024-04-02 17:38 ` anlauf at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-04-02 17:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106987
--- Comment #9 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Harald Anlauf
<anlauf@gcc.gnu.org>:
https://gcc.gnu.org/g:2808797fc4da7cc455803e2b69368b52db857b4c
commit r13-8559-g2808797fc4da7cc455803e2b69368b52db857b4c
Author: Harald Anlauf <anlauf@gmx.de>
Date: Tue Mar 5 21:54:26 2024 +0100
Fortran: error recovery while simplifying expressions [PR103707,PR106987]
When an exception is encountered during simplification of arithmetic
expressions, the result may depend on whether range-checking is active
(-frange-check) or not. However, the code path in the front-end should
stay the same for "soft" errors for which the exception is triggered by the
check, while "hard" errors should always terminate the simplification, so
that error recovery is independent of the flag. Separation of arithmetic
error codes into "hard" and "soft" errors shall be done consistently via
is_hard_arith_error().
PR fortran/103707
PR fortran/106987
gcc/fortran/ChangeLog:
* arith.cc (is_hard_arith_error): New helper function to determine
whether an arithmetic error is "hard" or not.
(check_result): Use it.
(gfc_arith_divide): Set "Division by zero" only for regular
numerators of real and complex divisions.
(reduce_unary): Use is_hard_arith_error to determine whether a hard
or (recoverable) soft error was encountered. Terminate immediately
on hard error, otherwise remember code of first soft error.
(reduce_binary_ac): Likewise.
(reduce_binary_ca): Likewise.
(reduce_binary_aa): Likewise.
gcc/testsuite/ChangeLog:
* gfortran.dg/arithmetic_overflow_3.f90: New test.
(cherry picked from commit 93e1d4d24ed014387da97e2ce11556d68fe98e66)
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/106987] [11/12/13/14 Regression] ICE in simplify_intrinsic_op, at fortran/expr.cc:1305
2022-09-20 17:37 [Bug fortran/106987] New: [10/11/12/13 Regression] ICE in simplify_intrinsic_op, at fortran/expr.cc:1305 gscfq@t-online.de
` (9 preceding siblings ...)
2024-04-02 17:07 ` cvs-commit at gcc dot gnu.org
@ 2024-04-02 17:38 ` anlauf at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: anlauf at gcc dot gnu.org @ 2024-04-02 17:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106987
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Target Milestone|11.5 |13.3
Resolution|--- |FIXED
--- Comment #10 from anlauf at gcc dot gnu.org ---
(In reply to paul.richard.thomas@gmail.com from comment #8)
> Hi Harald,
>
> After a lot of messing around, I managed to backport the patch; essentially
> by hand. However, two of the testcases ICEd in trans-array.cc and so there
> were obviously dependences that I had missed.
>
> I will not be backporting r14-1629, if for no other reason than it is not a
> regression but also because the amount of work that would be involved
> doesn't warrant it. It's a pity that I didn't keep 13-branch up to speed
> with mainline on the associate fixes but we will just have to live with it
> now.
Hi Paul,
no problem, I manually removed the conflict and pushed after regtesting.
Thanks for trying!
As I said before, I will close this one as fixed with target milestone 13.3,
as it does not make sense to try to backport all needed dependencies to 12,
and this one is an ICE-on-invalid.
@Gerhard: thanks for the report!
^ permalink raw reply [flat|nested] 12+ messages in thread