[Bug fortran/101762] ICE with "Every subscript of the target specification must be a constant expression"
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101762 anlauf at gcc dot gnu.org changed: What|Removed |Added Target Milestone|--- |10.4 Resolution|--- |FIXED Status|ASSIGNED|RESOLVED --- Comment #10 from anlauf at gcc dot gnu.org --- Fixed on mainline for gcc-12, and on 11- and 10-branch. Backporting further is probably not necessary. Closing. Thanks for the report!
[Bug fortran/101762] ICE with "Every subscript of the target specification must be a constant expression"
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101762 --- Comment #9 from CVS Commits --- The releases/gcc-10 branch has been updated by Harald Anlauf : https://gcc.gnu.org/g:a5f7e0838e1573f4cc33a6f2c70c60187d7a63af commit r10-10419-ga5f7e0838e1573f4cc33a6f2c70c60187d7a63af Author: Harald Anlauf Date: Sun Jan 9 22:08:14 2022 +0100 Fortran: reject invalid non-constant pointer initialization targets gcc/fortran/ChangeLog: PR fortran/101762 * expr.c (gfc_check_pointer_assign): For pointer initialization targets, check that subscripts and substring indices in specifications are constant expressions. gcc/testsuite/ChangeLog: PR fortran/101762 * gfortran.dg/pr101762.f90: New test. (cherry picked from commit 2e63128306ff93d8f53119137dd6c28b2defac94)
[Bug fortran/101762] ICE with "Every subscript of the target specification must be a constant expression"
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101762 anlauf at gcc dot gnu.org changed: What|Removed |Added CC||weeks at iastate dot edu --- Comment #8 from anlauf at gcc dot gnu.org --- *** Bug 85150 has been marked as a duplicate of this bug. ***
[Bug fortran/101762] ICE with "Every subscript of the target specification must be a constant expression"
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101762 --- Comment #7 from CVS Commits --- The releases/gcc-11 branch has been updated by Harald Anlauf : https://gcc.gnu.org/g:27424f10d4ad28fbcceb1c9fc767605b4d46494c commit r11-9463-g27424f10d4ad28fbcceb1c9fc767605b4d46494c Author: Harald Anlauf Date: Sun Jan 9 22:08:14 2022 +0100 Fortran: reject invalid non-constant pointer initialization targets gcc/fortran/ChangeLog: PR fortran/101762 * expr.c (gfc_check_pointer_assign): For pointer initialization targets, check that subscripts and substring indices in specifications are constant expressions. gcc/testsuite/ChangeLog: PR fortran/101762 * gfortran.dg/pr101762.f90: New test. (cherry picked from commit 2e63128306ff93d8f53119137dd6c28b2defac94)
[Bug fortran/101762] ICE with "Every subscript of the target specification must be a constant expression"
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101762 --- Comment #6 from CVS Commits --- The master branch has been updated by Harald Anlauf : https://gcc.gnu.org/g:2e63128306ff93d8f53119137dd6c28b2defac94 commit r12-6387-g2e63128306ff93d8f53119137dd6c28b2defac94 Author: Harald Anlauf Date: Sun Jan 9 22:08:14 2022 +0100 Fortran: reject invalid non-constant pointer initialization targets gcc/fortran/ChangeLog: PR fortran/101762 * expr.c (gfc_check_pointer_assign): For pointer initialization targets, check that subscripts and substring indices in specifications are constant expressions. gcc/testsuite/ChangeLog: PR fortran/101762 * gfortran.dg/pr101762.f90: New test.
[Bug fortran/101762] ICE with "Every subscript of the target specification must be a constant expression"
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101762 anlauf at gcc dot gnu.org changed: What|Removed |Added Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |anlauf at gcc dot gnu.org --- Comment #5 from anlauf at gcc dot gnu.org --- Submitted: https://gcc.gnu.org/pipermail/fortran/2022-January/057266.html
[Bug fortran/101762] ICE with "Every subscript of the target specification must be a constant expression"
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101762 --- Comment #4 from anlauf at gcc dot gnu.org --- Created attachment 52108 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52108=edit Improved patch The previous patch was too strict. The attached version does a much better job, but needs more testing and provides more concise error messages also for substrings.
[Bug fortran/101762] ICE with "Every subscript of the target specification must be a constant expression"
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101762 anlauf at gcc dot gnu.org changed: What|Removed |Added CC||anlauf at gcc dot gnu.org --- Comment #3 from anlauf at gcc dot gnu.org --- Untested patch: diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 4971638f9b6..9d37a71abb9 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -2525,6 +2525,9 @@ match_pointer_init (gfc_expr **init, int procptr) "initialization at %C")) return MATCH_ERROR; + if (!gfc_check_init_expr (*init)) +return MATCH_ERROR; + return MATCH_YES; } This would result in: pr101762.f90:3:28: 3 | integer, pointer :: x => a(n()) |1 Error: Array 'a' at (1) is a variable, which does not reduce to a constant expression
[Bug fortran/101762] ICE with "Every subscript of the target specification must be a constant expression"
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101762 Andrew Pinski changed: What|Removed |Added Summary|ICE in ix86_push_argument, |ICE with "Every subscript |at config/i386/i386.c:4203 |of the target specification ||must be a constant ||expression" Last reconfirmed||2022-01-02 Status|UNCONFIRMED |NEW Ever confirmed|0 |1 --- Comment #2 from Andrew Pinski --- Note ifort rejects it with: /app/example.f90(4): error #8817: Every subscript of the target specification must be a constant expression. [A] integer, pointer :: x => a(n()) ^ compilation aborted for /app/example.f90 (code 1) ASM generation compiler returned: 1 Confirmed.