Summary: | [12/13 Regression] ICE in gfc_simplify_transpose, at fortran/simplify.c:8181 since r12-4967-gbcf3728abe848888 | ||
---|---|---|---|
Product: | gcc | Reporter: | G. Steinmetz <gscfq> |
Component: | fortran | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | anlauf, marxin |
Priority: | P4 | Keywords: | ice-on-invalid-code |
Version: | 12.0 | ||
Target Milestone: | 10.5 | ||
Host: | Target: | ||
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: | 2021-11-08 00:00:00 |
Description
G. Steinmetz
2021-11-08 18:36:51 UTC
Naive patch: diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c index d675f2c3aef..a4fe0c3366d 100644 --- a/gcc/fortran/simplify.c +++ b/gcc/fortran/simplify.c @@ -8174,6 +8177,9 @@ gfc_simplify_transpose (gfc_expr *matrix) gcc_assert (matrix->rank == 2); + if (matrix->shape == NULL) + return NULL; + result = gfc_get_array_expr (matrix->ts.type, matrix->ts.kind, &matrix->where); result->rank = 2; After playing with the Intel compiler, which accepts the testcase, I start to think the code could actually be valid F2018. At least I cannot find text in the F2018 standard prohibiting PARAMETER for polymorphic variables. So while the patch in comment#1 fixes the regression (ICE), it is far from complete. Started with r12-4967-gbcf3728abe848888. The master branch has been updated by Harald Anlauf <anlauf@gcc.gnu.org>: https://gcc.gnu.org/g:abc2f01914d6c4703de26c402fb579a9a2d0dba4 commit r12-5136-gabc2f01914d6c4703de26c402fb579a9a2d0dba4 Author: Harald Anlauf <anlauf@gmx.de> Date: Wed Nov 10 20:30:27 2021 +0100 Fortran: avoid NULL pointer dereferences CLASS(), PARAMETER is not yet properly implemented in gfortran. Using it in declarations could lead to subsequent NULL pointer dereferences during checking or simplification of expressions involving those CLASS variables. gcc/fortran/ChangeLog: PR fortran/103137 PR fortran/103138 * check.c (gfc_check_shape): Avoid NULL pointer dereference on missing ref. * simplify.c (gfc_simplify_cshift): Avoid NULL pointer dereference when shape not set. (gfc_simplify_transpose): Likewise. The releases/gcc-11 branch has been updated by Harald Anlauf <anlauf@gcc.gnu.org>: https://gcc.gnu.org/g:9ccc4f79f1a6dd08437e10db729694a744abb10a commit r11-9235-g9ccc4f79f1a6dd08437e10db729694a744abb10a Author: Harald Anlauf <anlauf@gmx.de> Date: Wed Nov 10 20:30:27 2021 +0100 Fortran: avoid NULL pointer dereferences CLASS(), PARAMETER is not yet properly implemented in gfortran. Using it in declarations could lead to subsequent NULL pointer dereferences during checking or simplification of expressions involving those CLASS variables. gcc/fortran/ChangeLog: PR fortran/103137 PR fortran/103138 * check.c (gfc_check_shape): Avoid NULL pointer dereference on missing ref. * simplify.c (gfc_simplify_cshift): Avoid NULL pointer dereference when shape not set. (gfc_simplify_transpose): Likewise. (cherry picked from commit abc2f01914d6c4703de26c402fb579a9a2d0dba4) The releases/gcc-10 branch has been updated by Harald Anlauf <anlauf@gcc.gnu.org>: https://gcc.gnu.org/g:651d84ae6cb4299ea91c701ff8d9a7c67e076570 commit r10-10272-g651d84ae6cb4299ea91c701ff8d9a7c67e076570 Author: Harald Anlauf <anlauf@gmx.de> Date: Wed Nov 10 20:30:27 2021 +0100 Fortran: avoid NULL pointer dereferences CLASS(), PARAMETER is not yet properly implemented in gfortran. Using it in declarations could lead to subsequent NULL pointer dereferences during checking or simplification of expressions involving those CLASS variables. gcc/fortran/ChangeLog: PR fortran/103137 PR fortran/103138 * check.c (gfc_check_shape): Avoid NULL pointer dereference on missing ref. * simplify.c (gfc_simplify_cshift): Avoid NULL pointer dereference when shape not set. (gfc_simplify_transpose): Likewise. (cherry picked from commit abc2f01914d6c4703de26c402fb579a9a2d0dba4) Thank you very much for fixing this issue (and for the other ones). GCC 12.1 is being released, retargeting bugs to GCC 12.2. The master branch has been updated by Harald Anlauf <anlauf@gcc.gnu.org>: https://gcc.gnu.org/g:4c233cabbe388a6b8957c1507e129090e9267ceb commit r13-1370-g4c233cabbe388a6b8957c1507e129090e9267ceb Author: Harald Anlauf <anlauf@gmx.de> Date: Wed Jun 29 21:36:17 2022 +0200 Fortran: error recovery on invalid CLASS(), PARAMETER declarations [PR105243] gcc/fortran/ChangeLog: PR fortran/103137 PR fortran/103138 PR fortran/103693 PR fortran/105243 * decl.cc (gfc_match_data_decl): Reject CLASS entity declaration when it is given the PARAMETER attribute. gcc/testsuite/ChangeLog: PR fortran/103137 PR fortran/103138 PR fortran/103693 PR fortran/105243 * gfortran.dg/class_58.f90: Fix test. * gfortran.dg/class_73.f90: New test. Co-authored-by: Steven G. Kargl <kargl@gcc.gnu.org> The releases/gcc-12 branch has been updated by Harald Anlauf <anlauf@gcc.gnu.org>: https://gcc.gnu.org/g:d870ce1a112c0cbdff6172346a4a164503d92573 commit r12-8544-gd870ce1a112c0cbdff6172346a4a164503d92573 Author: Harald Anlauf <anlauf@gmx.de> Date: Wed Jun 29 21:36:17 2022 +0200 Fortran: error recovery on invalid CLASS(), PARAMETER declarations [PR105243] gcc/fortran/ChangeLog: PR fortran/103137 PR fortran/103138 PR fortran/103693 PR fortran/105243 * decl.cc (gfc_match_data_decl): Reject CLASS entity declaration when it is given the PARAMETER attribute. gcc/testsuite/ChangeLog: PR fortran/103137 PR fortran/103138 PR fortran/103693 PR fortran/105243 * gfortran.dg/class_58.f90: Fix test. * gfortran.dg/class_73.f90: New test. Co-authored-by: Steven G. Kargl <kargl@gcc.gnu.org> (cherry picked from commit 4c233cabbe388a6b8957c1507e129090e9267ceb) The releases/gcc-11 branch has been updated by Harald Anlauf <anlauf@gcc.gnu.org>: https://gcc.gnu.org/g:5c293d9abc4b14e987a574fc11666809a2b8b8da commit r11-10107-g5c293d9abc4b14e987a574fc11666809a2b8b8da Author: Harald Anlauf <anlauf@gmx.de> Date: Wed Jun 29 21:36:17 2022 +0200 Fortran: error recovery on invalid CLASS(), PARAMETER declarations [PR105243] gcc/fortran/ChangeLog: PR fortran/103137 PR fortran/103138 PR fortran/103693 PR fortran/105243 * decl.c (gfc_match_data_decl): Reject CLASS entity declaration when it is given the PARAMETER attribute. gcc/testsuite/ChangeLog: PR fortran/103137 PR fortran/103138 PR fortran/103693 PR fortran/105243 * gfortran.dg/class_58.f90: Fix test. * gfortran.dg/class_73.f90: New test. Co-authored-by: Steven G. Kargl <kargl@gcc.gnu.org> (cherry picked from commit 4c233cabbe388a6b8957c1507e129090e9267ceb) The releases/gcc-10 branch has been updated by Harald Anlauf <anlauf@gcc.gnu.org>: https://gcc.gnu.org/g:290147c4c8e3d9d1f13297b511d3a0afb5e952d4 commit r10-10882-g290147c4c8e3d9d1f13297b511d3a0afb5e952d4 Author: Harald Anlauf <anlauf@gmx.de> Date: Wed Jun 29 21:36:17 2022 +0200 Fortran: error recovery on invalid CLASS(), PARAMETER declarations [PR105243] gcc/fortran/ChangeLog: PR fortran/103137 PR fortran/103138 PR fortran/103693 PR fortran/105243 * decl.c (gfc_match_data_decl): Reject CLASS entity declaration when it is given the PARAMETER attribute. gcc/testsuite/ChangeLog: PR fortran/103137 PR fortran/103138 PR fortran/103693 PR fortran/105243 * gfortran.dg/class_58.f90: Fix test. * gfortran.dg/class_73.f90: New test. Co-authored-by: Steven G. Kargl <kargl@gcc.gnu.org> (cherry picked from commit 4c233cabbe388a6b8957c1507e129090e9267ceb) Fixed on all open branches. Closing. Thanks for the report! |