Message ID | 92672f08-a2f6-f45b-334f-f7650aa78e56@netcologne.de |
---|---|
State | New |
Headers | show |
Series | [fortran] Fix PR 68009, wrong prototype in runtime_error | expand |
Hi Thomas! On Sun, 17 Mar 2019 13:04:14 +0100, Thomas Koenig <tkoenig@netcologne.de> wrote: > this fixes a 7/8/9 regression. The problem is that front-end inlining > of matmul could generate calls to _gfortran_runtime_error which were > called as non-variadic. This fixes the problem by setting the > backend_decl on the resovled symbol, so it always uses the right one. Thanks for looking into this. > No test case, because there is not really a good way to check for this. Tested-by: Thomas Schwinge <thomas@codesourcery.com> For nvptx target testing, I see: [-FAIL:-]{+PASS:+} gfortran.dg/bounds_check_20.f90 -O (test for excess errors) [-UNRESOLVED:-]{+FAIL:+} gfortran.dg/bounds_check_20.f90 -O [-compilation failed to produce executable-]{+execution test+} ... which before complained about "Inconsistent redefinition of '_gfortran_runtime_error', number of parameters differs". (The "execution test" FAIL now is "Prototype doesn't match for '_gfortran_matmul_r4'", which -- expectedly so -- is not addressed by your patch; not sure if there's a PR open for that.) Your patch generally resolves all the "Prototype doesn't match for '_gfortran_runtime_error'" FAILs, and effects the following progressions: @@ -23499,29 +23500,19 @@ nvptx-run: cuLinkAddData failed: unknown error (CUDA_ERROR_UNKNOWN, 999) , should match Fortran runtime error: Array bound mismatch for dimension 1 of array.* PASS: gfortran.dg/matmul_bounds_10.f90 -O1 (test for excess errors) PASS: gfortran.dg/matmul_bounds_10.f90 -O1 execution test [-FAIL:-]{+PASS:+} gfortran.dg/matmul_bounds_10.f90 -O1 output pattern test,[-is error : Prototype doesn't match for '_gfortran_runtime_error' in 'input file 3 at offset 8110', first defined in 'input file 1 at offset 1805'^M-] [-nvptx-run: cuLinkAddData failed: unknown error (CUDA_ERROR_UNKNOWN, 999)^M-] [-, should match-] Fortran runtime error: Array bound mismatch for dimension 1 of array.* PASS: gfortran.dg/matmul_bounds_10.f90 -O2 (test for excess errors) PASS: gfortran.dg/matmul_bounds_10.f90 -O2 execution test [-FAIL:-]{+PASS:+} gfortran.dg/matmul_bounds_10.f90 -O2 output pattern test,[-is error : Prototype doesn't match for '_gfortran_runtime_error' in 'input file 3 at offset 7382', first defined in 'input file 1 at offset 1805'^M-] [-nvptx-run: cuLinkAddData failed: unknown error (CUDA_ERROR_UNKNOWN, 999)^M-] [-, should match-] Fortran runtime error: Array bound mismatch for dimension 1 of array.* PASS: gfortran.dg/matmul_bounds_10.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions (test for excess errors) PASS: gfortran.dg/matmul_bounds_10.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test [-FAIL:-]{+PASS:+} gfortran.dg/matmul_bounds_10.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions output pattern test,[-is error : Prototype doesn't match for '_gfortran_runtime_error' in 'input file 3 at offset 6778', first defined in 'input file 1 at offset 1805'^M-] [-nvptx-run: cuLinkAddData failed: unknown error (CUDA_ERROR_UNKNOWN, 999)^M-] [-, should match-] Fortran runtime error: Array bound mismatch for dimension 1 of array.* PASS: gfortran.dg/matmul_bounds_10.f90 -O3 -g (test for excess errors) PASS: gfortran.dg/matmul_bounds_10.f90 -O3 -g execution test [-FAIL:-]{+PASS:+} gfortran.dg/matmul_bounds_10.f90 -O3 -g output pattern test,[-is error : Prototype doesn't match for '_gfortran_runtime_error' in 'input file 3 at offset 6981', first defined in 'input file 1 at offset 1805'^M-] [-nvptx-run: cuLinkAddData failed: unknown error (CUDA_ERROR_UNKNOWN, 999)^M-] [-, should match-] Fortran runtime error: Array bound mismatch for dimension 1 of array.* PASS: gfortran.dg/matmul_bounds_10.f90 -Os (test for excess errors) PASS: gfortran.dg/matmul_bounds_10.f90 -Os execution test [-FAIL:-]{+PASS:+} gfortran.dg/matmul_bounds_10.f90 -Os output pattern test,[-is error : Prototype doesn't match for '_gfortran_runtime_error' in 'input file 3 at offset 7803', first defined in 'input file 1 at offset 1805'^M-] [-nvptx-run: cuLinkAddData failed: unknown error (CUDA_ERROR_UNKNOWN, 999)^M-] [-, should match-] Fortran runtime error: Array bound mismatch for dimension 1 of array.* FAIL: gfortran.dg/matmul_bounds_11.f90 -O0 (test for excess errors) UNRESOLVED: gfortran.dg/matmul_bounds_11.f90 -O0 compilation failed to produce executable FAIL: gfortran.dg/matmul_bounds_11.f90 -O1 (test for excess errors) @@ -23574,29 +23565,19 @@ nvptx-run: cuLinkAddData failed: unknown error (CUDA_ERROR_UNKNOWN, 999) , should match Fortran runtime error: Array bound mismatch for dimension 2 of array.* PASS: gfortran.dg/matmul_bounds_2.f90 -O1 (test for excess errors) PASS: gfortran.dg/matmul_bounds_2.f90 -O1 execution test [-FAIL:-]{+PASS:+} gfortran.dg/matmul_bounds_2.f90 -O1 output pattern test,[-is error : Prototype doesn't match for '_gfortran_runtime_error' in 'input file 3 at offset 7854', first defined in 'input file 1 at offset 1805'^M-] [-nvptx-run: cuLinkAddData failed: unknown error (CUDA_ERROR_UNKNOWN, 999)^M-] [-, should match-] Fortran runtime error: Array bound mismatch for dimension 2 of array.* PASS: gfortran.dg/matmul_bounds_2.f90 -O2 (test for excess errors) PASS: gfortran.dg/matmul_bounds_2.f90 -O2 execution test [-FAIL:-]{+PASS:+} gfortran.dg/matmul_bounds_2.f90 -O2 output pattern test,[-is error : Prototype doesn't match for '_gfortran_runtime_error' in 'input file 3 at offset 6458', first defined in 'input file 1 at offset 1805'^M-] [-nvptx-run: cuLinkAddData failed: unknown error (CUDA_ERROR_UNKNOWN, 999)^M-] [-, should match-] Fortran runtime error: Array bound mismatch for dimension 2 of array.* PASS: gfortran.dg/matmul_bounds_2.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions (test for excess errors) PASS: gfortran.dg/matmul_bounds_2.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test [-FAIL:-]{+PASS:+} gfortran.dg/matmul_bounds_2.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions output pattern test,[-is error : Prototype doesn't match for '_gfortran_runtime_error' in 'input file 3 at offset 6168', first defined in 'input file 1 at offset 1805'^M-] [-nvptx-run: cuLinkAddData failed: unknown error (CUDA_ERROR_UNKNOWN, 999)^M-] [-, should match-] Fortran runtime error: Array bound mismatch for dimension 2 of array.* PASS: gfortran.dg/matmul_bounds_2.f90 -O3 -g (test for excess errors) PASS: gfortran.dg/matmul_bounds_2.f90 -O3 -g execution test [-FAIL:-]{+PASS:+} gfortran.dg/matmul_bounds_2.f90 -O3 -g output pattern test,[-is error : Prototype doesn't match for '_gfortran_runtime_error' in 'input file 3 at offset 6358', first defined in 'input file 1 at offset 1805'^M-] [-nvptx-run: cuLinkAddData failed: unknown error (CUDA_ERROR_UNKNOWN, 999)^M-] [-, should match-] Fortran runtime error: Array bound mismatch for dimension 2 of array.* PASS: gfortran.dg/matmul_bounds_2.f90 -Os (test for excess errors) PASS: gfortran.dg/matmul_bounds_2.f90 -Os execution test [-FAIL:-]{+PASS:+} gfortran.dg/matmul_bounds_2.f90 -Os output pattern test,[-is error : Prototype doesn't match for '_gfortran_runtime_error' in 'input file 3 at offset 7523', first defined in 'input file 1 at offset 1805'^M-] [-nvptx-run: cuLinkAddData failed: unknown error (CUDA_ERROR_UNKNOWN, 999)^M-] [-, should match-] Fortran runtime error: Array bound mismatch for dimension 2 of array.* PASS: gfortran.dg/matmul_bounds_3.f90 -O0 (test for excess errors) PASS: gfortran.dg/matmul_bounds_3.f90 -O0 execution test FAIL: gfortran.dg/matmul_bounds_3.f90 -O0 output pattern test, is error : Prototype doesn't match for '_gfortran_matmul_r4' in 'input file 4 at offset 20477', first defined in 'input file 4 at offset 20477' @@ -23604,29 +23585,19 @@ nvptx-run: cuLinkAddData failed: unknown error (CUDA_ERROR_UNKNOWN, 999) , should match Fortran runtime error: Array bound mismatch for dimension 1 of array PASS: gfortran.dg/matmul_bounds_3.f90 -O1 (test for excess errors) PASS: gfortran.dg/matmul_bounds_3.f90 -O1 execution test [-FAIL:-]{+PASS:+} gfortran.dg/matmul_bounds_3.f90 -O1 output pattern test,[-is error : Prototype doesn't match for '_gfortran_runtime_error' in 'input file 3 at offset 8109', first defined in 'input file 1 at offset 1805'^M-] [-nvptx-run: cuLinkAddData failed: unknown error (CUDA_ERROR_UNKNOWN, 999)^M-] [-, should match-] Fortran runtime error: Array bound mismatch for dimension 1 of array PASS: gfortran.dg/matmul_bounds_3.f90 -O2 (test for excess errors) PASS: gfortran.dg/matmul_bounds_3.f90 -O2 execution test [-FAIL:-]{+PASS:+} gfortran.dg/matmul_bounds_3.f90 -O2 output pattern test,[-is error : Prototype doesn't match for '_gfortran_runtime_error' in 'input file 3 at offset 7381', first defined in 'input file 1 at offset 1805'^M-] [-nvptx-run: cuLinkAddData failed: unknown error (CUDA_ERROR_UNKNOWN, 999)^M-] [-, should match-] Fortran runtime error: Array bound mismatch for dimension 1 of array PASS: gfortran.dg/matmul_bounds_3.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions (test for excess errors) PASS: gfortran.dg/matmul_bounds_3.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test [-FAIL:-]{+PASS:+} gfortran.dg/matmul_bounds_3.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions output pattern test,[-is error : Prototype doesn't match for '_gfortran_runtime_error' in 'input file 3 at offset 6778', first defined in 'input file 1 at offset 1805'^M-] [-nvptx-run: cuLinkAddData failed: unknown error (CUDA_ERROR_UNKNOWN, 999)^M-] [-, should match-] Fortran runtime error: Array bound mismatch for dimension 1 of array PASS: gfortran.dg/matmul_bounds_3.f90 -O3 -g (test for excess errors) PASS: gfortran.dg/matmul_bounds_3.f90 -O3 -g execution test [-FAIL:-]{+PASS:+} gfortran.dg/matmul_bounds_3.f90 -O3 -g output pattern test,[-is error : Prototype doesn't match for '_gfortran_runtime_error' in 'input file 3 at offset 6980', first defined in 'input file 1 at offset 1805'^M-] [-nvptx-run: cuLinkAddData failed: unknown error (CUDA_ERROR_UNKNOWN, 999)^M-] [-, should match-] Fortran runtime error: Array bound mismatch for dimension 1 of array PASS: gfortran.dg/matmul_bounds_3.f90 -Os (test for excess errors) PASS: gfortran.dg/matmul_bounds_3.f90 -Os execution test [-FAIL:-]{+PASS:+} gfortran.dg/matmul_bounds_3.f90 -Os output pattern test,[-is error : Prototype doesn't match for '_gfortran_runtime_error' in 'input file 3 at offset 7802', first defined in 'input file 1 at offset 1805'^M-] [-nvptx-run: cuLinkAddData failed: unknown error (CUDA_ERROR_UNKNOWN, 999)^M-] [-, should match-] Fortran runtime error: Array bound mismatch for dimension 1 of array PASS: gfortran.dg/matmul_bounds_4.f90 -O0 (test for excess errors) PASS: gfortran.dg/matmul_bounds_4.f90 -O0 execution test FAIL: gfortran.dg/matmul_bounds_4.f90 -O0 output pattern test, is error : Prototype doesn't match for '_gfortran_matmul_r4' in 'input file 4 at offset 19478', first defined in 'input file 4 at offset 19478' @@ -23634,29 +23605,19 @@ nvptx-run: cuLinkAddData failed: unknown error (CUDA_ERROR_UNKNOWN, 999) , should match Fortran runtime error: Array bound mismatch for dimension 1 of array PASS: gfortran.dg/matmul_bounds_4.f90 -O1 (test for excess errors) PASS: gfortran.dg/matmul_bounds_4.f90 -O1 execution test [-FAIL:-]{+PASS:+} gfortran.dg/matmul_bounds_4.f90 -O1 output pattern test,[-is error : Prototype doesn't match for '_gfortran_runtime_error' in 'input file 3 at offset 7620', first defined in 'input file 1 at offset 1805'^M-] [-nvptx-run: cuLinkAddData failed: unknown error (CUDA_ERROR_UNKNOWN, 999)^M-] [-, should match-] Fortran runtime error: Array bound mismatch for dimension 1 of array PASS: gfortran.dg/matmul_bounds_4.f90 -O2 (test for excess errors) PASS: gfortran.dg/matmul_bounds_4.f90 -O2 execution test [-FAIL:-]{+PASS:+} gfortran.dg/matmul_bounds_4.f90 -O2 output pattern test,[-is error : Prototype doesn't match for '_gfortran_runtime_error' in 'input file 3 at offset 6285', first defined in 'input file 1 at offset 1805'^M-] [-nvptx-run: cuLinkAddData failed: unknown error (CUDA_ERROR_UNKNOWN, 999)^M-] [-, should match-] Fortran runtime error: Array bound mismatch for dimension 1 of array PASS: gfortran.dg/matmul_bounds_4.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions (test for excess errors) PASS: gfortran.dg/matmul_bounds_4.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test [-FAIL:-]{+PASS:+} gfortran.dg/matmul_bounds_4.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions output pattern test,[-is error : Prototype doesn't match for '_gfortran_runtime_error' in 'input file 3 at offset 6161', first defined in 'input file 1 at offset 1805'^M-] [-nvptx-run: cuLinkAddData failed: unknown error (CUDA_ERROR_UNKNOWN, 999)^M-] [-, should match-] Fortran runtime error: Array bound mismatch for dimension 1 of array PASS: gfortran.dg/matmul_bounds_4.f90 -O3 -g (test for excess errors) PASS: gfortran.dg/matmul_bounds_4.f90 -O3 -g execution test [-FAIL:-]{+PASS:+} gfortran.dg/matmul_bounds_4.f90 -O3 -g output pattern test,[-is error : Prototype doesn't match for '_gfortran_runtime_error' in 'input file 3 at offset 6351', first defined in 'input file 1 at offset 1805'^M-] [-nvptx-run: cuLinkAddData failed: unknown error (CUDA_ERROR_UNKNOWN, 999)^M-] [-, should match-] Fortran runtime error: Array bound mismatch for dimension 1 of array PASS: gfortran.dg/matmul_bounds_4.f90 -Os (test for excess errors) PASS: gfortran.dg/matmul_bounds_4.f90 -Os execution test [-FAIL:-]{+PASS:+} gfortran.dg/matmul_bounds_4.f90 -Os output pattern test,[-is error : Prototype doesn't match for '_gfortran_runtime_error' in 'input file 3 at offset 7349', first defined in 'input file 1 at offset 1805'^M-] [-nvptx-run: cuLinkAddData failed: unknown error (CUDA_ERROR_UNKNOWN, 999)^M-] [-, should match-] Fortran runtime error: Array bound mismatch for dimension 1 of array PASS: gfortran.dg/matmul_bounds_5.f90 -O0 (test for excess errors) PASS: gfortran.dg/matmul_bounds_5.f90 -O0 execution test FAIL: gfortran.dg/matmul_bounds_5.f90 -O0 output pattern test, is error : Prototype doesn't match for '_gfortran_matmul_r4' in 'input file 4 at offset 19416', first defined in 'input file 4 at offset 19416' @@ -23664,29 +23625,19 @@ nvptx-run: cuLinkAddData failed: unknown error (CUDA_ERROR_UNKNOWN, 999) , should match Fortran runtime error: Array bound mismatch for dimension 1 of array PASS: gfortran.dg/matmul_bounds_5.f90 -O1 (test for excess errors) PASS: gfortran.dg/matmul_bounds_5.f90 -O1 execution test [-FAIL:-]{+PASS:+} gfortran.dg/matmul_bounds_5.f90 -O1 output pattern test,[-is error : Prototype doesn't match for '_gfortran_runtime_error' in 'input file 3 at offset 6926', first defined in 'input file 1 at offset 1805'^M-] [-nvptx-run: cuLinkAddData failed: unknown error (CUDA_ERROR_UNKNOWN, 999)^M-] [-, should match-] Fortran runtime error: Array bound mismatch for dimension 1 of array PASS: gfortran.dg/matmul_bounds_5.f90 -O2 (test for excess errors) PASS: gfortran.dg/matmul_bounds_5.f90 -O2 execution test [-FAIL:-]{+PASS:+} gfortran.dg/matmul_bounds_5.f90 -O2 output pattern test,[-is error : Prototype doesn't match for '_gfortran_runtime_error' in 'input file 3 at offset 6161', first defined in 'input file 1 at offset 1805'^M-] [-nvptx-run: cuLinkAddData failed: unknown error (CUDA_ERROR_UNKNOWN, 999)^M-] [-, should match-] Fortran runtime error: Array bound mismatch for dimension 1 of array PASS: gfortran.dg/matmul_bounds_5.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions (test for excess errors) PASS: gfortran.dg/matmul_bounds_5.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test [-FAIL:-]{+PASS:+} gfortran.dg/matmul_bounds_5.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions output pattern test,[-is error : Prototype doesn't match for '_gfortran_runtime_error' in 'input file 3 at offset 6161', first defined in 'input file 1 at offset 1805'^M-] [-nvptx-run: cuLinkAddData failed: unknown error (CUDA_ERROR_UNKNOWN, 999)^M-] [-, should match-] Fortran runtime error: Array bound mismatch for dimension 1 of array PASS: gfortran.dg/matmul_bounds_5.f90 -O3 -g (test for excess errors) PASS: gfortran.dg/matmul_bounds_5.f90 -O3 -g execution test [-FAIL:-]{+PASS:+} gfortran.dg/matmul_bounds_5.f90 -O3 -g output pattern test,[-is error : Prototype doesn't match for '_gfortran_runtime_error' in 'input file 3 at offset 6351', first defined in 'input file 1 at offset 1805'^M-] [-nvptx-run: cuLinkAddData failed: unknown error (CUDA_ERROR_UNKNOWN, 999)^M-] [-, should match-] Fortran runtime error: Array bound mismatch for dimension 1 of array PASS: gfortran.dg/matmul_bounds_5.f90 -Os (test for excess errors) PASS: gfortran.dg/matmul_bounds_5.f90 -Os execution test [-FAIL:-]{+PASS:+} gfortran.dg/matmul_bounds_5.f90 -Os output pattern test,[-is error : Prototype doesn't match for '_gfortran_runtime_error' in 'input file 3 at offset 6161', first defined in 'input file 1 at offset 1805'^M-] [-nvptx-run: cuLinkAddData failed: unknown error (CUDA_ERROR_UNKNOWN, 999)^M-] [-, should match-] Fortran runtime error: Array bound mismatch for dimension 1 of array FAIL: gfortran.dg/matmul_bounds_6.f90 -O0 (test for excess errors) UNRESOLVED: gfortran.dg/matmul_bounds_6.f90 -O0 compilation failed to produce executable PASS: gfortran.dg/matmul_bounds_6.f90 -O1 (test for excess errors) @@ -23718,41 +23669,31 @@ nvptx-run: cuLinkAddData failed: unknown error (CUDA_ERROR_UNKNOWN, 999) , should match Fortran runtime error: Array bound mismatch for dimension 2 of array PASS: gfortran.dg/matmul_bounds_8.f90 -O1 (test for excess errors) PASS: gfortran.dg/matmul_bounds_8.f90 -O1 execution test [-FAIL:-]{+PASS:+} gfortran.dg/matmul_bounds_8.f90 -O1 output pattern test,[-is error : Prototype doesn't match for '_gfortran_runtime_error' in 'input file 3 at offset 8110', first defined in 'input file 1 at offset 1805'^M-] [-nvptx-run: cuLinkAddData failed: unknown error (CUDA_ERROR_UNKNOWN, 999)^M-] [-, should match-] Fortran runtime error: Array bound mismatch for dimension 2 of array PASS: gfortran.dg/matmul_bounds_8.f90 -O2 (test for excess errors) PASS: gfortran.dg/matmul_bounds_8.f90 -O2 execution test [-FAIL:-]{+PASS:+} gfortran.dg/matmul_bounds_8.f90 -O2 output pattern test,[-is error : Prototype doesn't match for '_gfortran_runtime_error' in 'input file 3 at offset 7382', first defined in 'input file 1 at offset 1805'^M-] [-nvptx-run: cuLinkAddData failed: unknown error (CUDA_ERROR_UNKNOWN, 999)^M-] [-, should match-] Fortran runtime error: Array bound mismatch for dimension 2 of array PASS: gfortran.dg/matmul_bounds_8.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions (test for excess errors) PASS: gfortran.dg/matmul_bounds_8.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test [-FAIL:-]{+PASS:+} gfortran.dg/matmul_bounds_8.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions output pattern test,[-is error : Prototype doesn't match for '_gfortran_runtime_error' in 'input file 3 at offset 6778', first defined in 'input file 1 at offset 1805'^M-] [-nvptx-run: cuLinkAddData failed: unknown error (CUDA_ERROR_UNKNOWN, 999)^M-] [-, should match-] Fortran runtime error: Array bound mismatch for dimension 2 of array PASS: gfortran.dg/matmul_bounds_8.f90 -O3 -g (test for excess errors) PASS: gfortran.dg/matmul_bounds_8.f90 -O3 -g execution test [-FAIL:-]{+PASS:+} gfortran.dg/matmul_bounds_8.f90 -O3 -g output pattern test,[-is error : Prototype doesn't match for '_gfortran_runtime_error' in 'input file 3 at offset 6980', first defined in 'input file 1 at offset 1805'^M-] [-nvptx-run: cuLinkAddData failed: unknown error (CUDA_ERROR_UNKNOWN, 999)^M-] [-, should match-] Fortran runtime error: Array bound mismatch for dimension 2 of array PASS: gfortran.dg/matmul_bounds_8.f90 -Os (test for excess errors) PASS: gfortran.dg/matmul_bounds_8.f90 -Os execution test [-FAIL:-]{+PASS:+} gfortran.dg/matmul_bounds_8.f90 -Os output pattern test,[-is error : Prototype doesn't match for '_gfortran_runtime_error' in 'input file 3 at offset 7803', first defined in 'input file 1 at offset 1805'^M-] [-nvptx-run: cuLinkAddData failed: unknown error (CUDA_ERROR_UNKNOWN, 999)^M-] [-, should match-] Fortran runtime error: Array bound mismatch for dimension 2 of array PASS: gfortran.dg/matmul_bounds_9.f90 -O0 (test for excess errors) PASS: gfortran.dg/matmul_bounds_9.f90 -O0 execution test [-FAIL:-]{+PASS:+} gfortran.dg/matmul_bounds_9.f90 -O1 (test for excess errors) [-UNRESOLVED:-]{+PASS:+} gfortran.dg/matmul_bounds_9.f90 -O1 [-compilation failed to produce executable-] [-FAIL:-]{+execution test+} {+PASS:+} gfortran.dg/matmul_bounds_9.f90 -O2 (test for excess errors) [-UNRESOLVED:-]{+PASS:+} gfortran.dg/matmul_bounds_9.f90 -O2 [-compilation failed to produce executable-] [-FAIL:-]{+execution test+} {+PASS:+} gfortran.dg/matmul_bounds_9.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions (test for excess errors) [-UNRESOLVED:-]{+PASS:+} gfortran.dg/matmul_bounds_9.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions [-compilation failed to produce executable-] [-FAIL:-]{+execution test+} {+PASS:+} gfortran.dg/matmul_bounds_9.f90 -O3 -g (test for excess errors) [-UNRESOLVED:-]{+PASS:+} gfortran.dg/matmul_bounds_9.f90 -O3 -g [-compilation failed to produce executable-] [-FAIL:-]{+execution test+} {+PASS:+} gfortran.dg/matmul_bounds_9.f90 -Os (test for excess errors) [-UNRESOLVED:-]{+PASS:+} gfortran.dg/matmul_bounds_9.f90 -Os [-compilation failed to produce executable-]{+execution test+} Grüße Thomas
On Sun, Mar 17, 2019 at 2:04 PM Thomas Koenig <tkoenig@netcologne.de> wrote: > > Hello world, > > this fixes a 7/8/9 regression. The problem is that front-end inlining > of matmul could generate calls to _gfortran_runtime_error which were > called as non-variadic. This fixes the problem by setting the > backend_decl on the resovled symbol, so it always uses the right one. > > Putting it into the resolution stage seems a bit strange, but I tried > several other methods such as putting it into the global symbol table, > and nothing else I tried worked. > > You can check on x86_64 if the patch works by doing > > $ cat nn.f90 > module x > contains > subroutine mm(a,b,c) > real, dimension(:) :: a, c > real, dimension(:,:) :: b > c = matmul(a,b) > end subroutine mm > end module x > > $ gfortran -S -O -fcheck=bounds nn.f90 > > and then looking for code snippets like > > movl $89, %ecx > movq %rdi, %rdx > movl $.LC0, %edi > movl $0, %eax > call _gfortran_runtime_error > > where setting %eax to zero indicates that we are indeed using > varargs, because %eax contains the number of float arguments, > which is zero. > > No test case, because there is not really a good way to check for this. > > So, OK for trunk? > > Regards > > Thomas > > 2019-03-17 Thomas Koenig <tkoeng@gcc.gnu.org> > > PR fortran/68009 > * iresolve.c: Include trans.h. > (gfc_resolve_fe_runtine_error): Set backend_decl on > resolved_sym. Ok for trunk/7/8. Thanks!
Index: iresolve.c =================================================================== --- iresolve.c (Revision 269624) +++ iresolve.c (Arbeitskopie) @@ -35,6 +35,7 @@ along with GCC; see the file COPYING3. If not see #include "intrinsic.h" #include "constructor.h" #include "arith.h" +#include "trans.h" /* Given printf-like arguments, return a stable version of the result string. @@ -2495,6 +2496,10 @@ gfc_resolve_fe_runtime_error (gfc_code *c) a->name = "%VAL"; c->resolved_sym = gfc_get_intrinsic_sub_symbol (name); + /* We set the backend_decl here because runtime_error is a + variadic function and we would use the wrong calling + convention otherwise. */ + c->resolved_sym->backend_decl = gfor_fndecl_runtime_error; } void