g:22afa4947584c701633a79fd8750c9ceeaa96711, r13-5479-g22afa4947584c7 This is occuring on our big endian machines. make -k check-gcc-fortran RUNTESTFLAGS="dg.exp=gfortran.dg/pr108527.f90" FAIL: gfortran.dg/pr108527.f90 -O (internal compiler error: Segmentation fault) FAIL: gfortran.dg/pr108527.f90 -O (test for errors, line 6) FAIL: gfortran.dg/pr108527.f90 -O (test for errors, line 7) FAIL: gfortran.dg/pr108527.f90 -O (test for excess errors) # of unexpected failures 4 Executing on host: /home/seurer/gcc/git/build/gcc-test/gcc/testsuite/gfortran/../../gfortran -B/home/seurer/gcc/git/build/gcc-test/gcc/testsuite/gfortran/../../ -B/home/seurer/gcc/git/build/gcc-test/powerpc64-unknown-linux-gnu/./libgfortran/ /home/seurer/gcc/git/gcc-test/gcc/testsuite/gfortran.dg/pr108527.f90 -fdiagnostics-plain-output -fdiagnostics-plain-output -O -pedantic-errors -S -o pr108527.s (timeout = 300) spawn -ignore SIGHUP /home/seurer/gcc/git/build/gcc-test/gcc/testsuite/gfortran/../../gfortran -B/home/seurer/gcc/git/build/gcc-test/gcc/testsuite/gfortran/../../ -B/home/seurer/gcc/git/build/gcc-test/powerpc64-unknown-linux-gnu/./libgfortran/ /home/seurer/gcc/git/gcc-test/gcc/testsuite/gfortran.dg/pr108527.f90 -fdiagnostics-plain-output -fdiagnostics-plain-output -O -pedantic-errors -S -o pr108527.s^M f951: internal compiler error: Segmentation fault^M 0x10cf542b crash_signal^M /home/seurer/gcc/git/gcc-test/gcc/toplev.cc:314^M 0x123e8720 __gmpn_sub_n^M /home/seurer/gcc/git/build/gcc-test/gmp/mpn/sub_n.c:48^M 0x123e598b __gmpn_sub^M ../gmp.h:2197^M 0x123e598b __gmpz_sub^M /home/seurer/gcc/git/gcc-test/gmp/mpz/aors.h:89^M 0x1031055b find_array_section^M /home/seurer/gcc/git/gcc-test/gcc/fortran/expr.cc:1665^M 0x1031356b simplify_const_ref^M /home/seurer/gcc/git/gcc-test/gcc/fortran/expr.cc:1938^M 0x10314227 gfc_simplify_expr(gfc_expr*, int)^M /home/seurer/gcc/git/gcc-test/gcc/fortran/expr.cc:2330^M 0x10314963 simplify_parameter_variable^M /home/seurer/gcc/git/gcc-test/gcc/fortran/expr.cc:2158^M 0x10314963 simplify_parameter_variable^M /home/seurer/gcc/git/gcc-test/gcc/fortran/expr.cc:2092^M 0x10313297 gfc_reduce_init_expr(gfc_expr*)^M /home/seurer/gcc/git/gcc-test/gcc/fortran/expr.cc:3170^M 0x103174cb gfc_match_init_expr(gfc_expr**)^M /home/seurer/gcc/git/gcc-test/gcc/fortran/expr.cc:3216^M 0x102e8ef3 gfc_match_kind_spec(gfc_typespec*, bool)^M /home/seurer/gcc/git/gcc-test/gcc/fortran/decl.cc:3273^M 0x102f301b gfc_match_decl_type_spec(gfc_typespec*, int)^M /home/seurer/gcc/git/gcc-test/gcc/fortran/decl.cc:4706^M 0x102f4ed3 gfc_match_data_decl()^M /home/seurer/gcc/git/gcc-test/gcc/fortran/decl.cc:6264^M 0x10391767 match_word^M /home/seurer/gcc/git/gcc-test/gcc/fortran/parse.cc:67^M 0x103925cf decode_statement^M /home/seurer/gcc/git/gcc-test/gcc/fortran/parse.cc:378^M 0x10398ca7 next_free^M /home/seurer/gcc/git/gcc-test/gcc/fortran/parse.cc:1403^M 0x10398ca7 next_statement^M /home/seurer/gcc/git/gcc-test/gcc/fortran/parse.cc:1635^M 0x1039c31f parse_spec^M /home/seurer/gcc/git/gcc-test/gcc/fortran/parse.cc:4191^M 0x103a0923 parse_progunit^M /home/seurer/gcc/git/gcc-test/gcc/fortran/parse.cc:6262^M commit 22afa4947584c701633a79fd8750c9ceeaa96711 Author: Harald Anlauf <anlauf@gmx.de> Date: Tue Jan 24 22:36:25 2023 +0100 Fortran: fix ICE in compare_bound_int [PR108527] gcc/fortran/ChangeLog:
Created attachment 54377 [details] Patch Bill, can you please try the attached patch? It adds a check in find_array_section to prevent interpreting an mpz non-integer constant as an integer. This should provide a cleaner error recovery. Regtested on x86_64-pc-linux-gnu. And thanks for the traceback. valgrind did not show anything.
I tried the patch and it seems to work fine. make -k check-gcc-fortran RUNTESTFLAGS="dg.exp=gfortran.dg/pr108527.f90" # of expected passes 3
The master branch has been updated by Harald Anlauf <anlauf@gcc.gnu.org>: https://gcc.gnu.org/g:88a2a09dd4529107e7ef7a6e7ce43acf96457173 commit r13-5636-g88a2a09dd4529107e7ef7a6e7ce43acf96457173 Author: Harald Anlauf <anlauf@gmx.de> Date: Wed Feb 1 21:01:32 2023 +0100 Fortran: error recovery on invalid array section [PR108609] The testcase for PR108527 uncovered a latent issue with invalid array sections that resulted in different paths being taken on different architectures. Detect the invalid array declaration for a clean recovery. gcc/fortran/ChangeLog: PR fortran/108609 * expr.cc (find_array_section): Add check to prevent interpreting an mpz non-integer constant as an integer. gcc/testsuite/ChangeLog: PR fortran/108609 * gfortran.dg/pr108527.f90: Adjust test pattern.
The releases/gcc-12 branch has been updated by Harald Anlauf <anlauf@gcc.gnu.org>: https://gcc.gnu.org/g:1e60e9124543fd002f3e6dad8172cff8aa1b24b3 commit r12-9107-g1e60e9124543fd002f3e6dad8172cff8aa1b24b3 Author: Harald Anlauf <anlauf@gmx.de> Date: Wed Feb 1 21:01:32 2023 +0100 Fortran: error recovery on invalid array section [PR108609] The testcase for PR108527 uncovered a latent issue with invalid array sections that resulted in different paths being taken on different architectures. Detect the invalid array declaration for a clean recovery. gcc/fortran/ChangeLog: PR fortran/108609 * expr.cc (find_array_section): Add check to prevent interpreting an mpz non-integer constant as an integer. gcc/testsuite/ChangeLog: PR fortran/108609 * gfortran.dg/pr108527.f90: Adjust test pattern. (cherry picked from commit 88a2a09dd4529107e7ef7a6e7ce43acf96457173)
The releases/gcc-11 branch has been updated by Harald Anlauf <anlauf@gcc.gnu.org>: https://gcc.gnu.org/g:f4efceac1741c03bc3c86f95e4bcd8918ec8ebe6 commit r11-10515-gf4efceac1741c03bc3c86f95e4bcd8918ec8ebe6 Author: Harald Anlauf <anlauf@gmx.de> Date: Wed Feb 1 21:01:32 2023 +0100 Fortran: error recovery on invalid array section [PR108609] The testcase for PR108527 uncovered a latent issue with invalid array sections that resulted in different paths being taken on different architectures. Detect the invalid array declaration for a clean recovery. gcc/fortran/ChangeLog: PR fortran/108609 * expr.c (find_array_section): Add check to prevent interpreting an mpz non-integer constant as an integer. gcc/testsuite/ChangeLog: PR fortran/108609 * gfortran.dg/pr108527.f90: Adjust test pattern. (cherry picked from commit 88a2a09dd4529107e7ef7a6e7ce43acf96457173)
The releases/gcc-10 branch has been updated by Harald Anlauf <anlauf@gcc.gnu.org>: https://gcc.gnu.org/g:684a5a8734c4269786089f5d4ba0fbf79f190f3a commit r10-11207-g684a5a8734c4269786089f5d4ba0fbf79f190f3a Author: Harald Anlauf <anlauf@gmx.de> Date: Wed Feb 1 21:01:32 2023 +0100 Fortran: error recovery on invalid array section [PR108609] The testcase for PR108527 uncovered a latent issue with invalid array sections that resulted in different paths being taken on different architectures. Detect the invalid array declaration for a clean recovery. gcc/fortran/ChangeLog: PR fortran/108609 * expr.c (find_array_section): Add check to prevent interpreting an mpz non-integer constant as an integer. gcc/testsuite/ChangeLog: PR fortran/108609 * gfortran.dg/pr108527.f90: Adjust test pattern. (cherry picked from commit 88a2a09dd4529107e7ef7a6e7ce43acf96457173)
Fixed.