[Bug fortran/36341] MATMUL: Bounds check missing (run time)
--- Comment #15 from tkoenig at gcc dot gnu dot org 2008-07-07 19:44 --- Subject: Bug 36341 Author: tkoenig Date: Mon Jul 7 19:43:33 2008 New Revision: 137594 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=137594 Log: 2008-07-07 Thomas Koenig [EMAIL PROTECTED] PR fortran/36341 PR fortran/34670 * m4/matmul.m4: Add bounds checking. * m4/matmull.m4: Likewise. * generated/matmul_c10.c: Regenerated. * generated/matmul_c16.c: Regenerated. * generated/matmul_c4.c: Regenerated. * generated/matmul_c8.c: Regenerated. * generated/matmul_i1.c: Regenerated. * generated/matmul_i16.c: Regenerated. * generated/matmul_i2.c: Regenerated. * generated/matmul_i4.c: Regenerated. * generated/matmul_i8.c: Regenerated. * generated/matmul_l16.c: Regenerated. * generated/matmul_l4.c: Regenerated. * generated/matmul_l8.c: Regenerated. * generated/matmul_r10.c: Regenerated. * generated/matmul_r16.c: Regenerated. * generated/matmul_r4.c: Regenerated. * generated/matmul_r8.c: Regenerated. 2008-07-07 Thomas Koenig [EMAIL PROTECTED] PR fortran/36341 PR fortran/34670 * gfortran.dg/matmul_bounds_2.f90: New test. * gfortran.dg/matmul_bounds_3.f90: New test. * gfortran.dg/matmul_bounds_4.f90: New test. * gfortran.dg/matmul_bounds_5.f90: New test. Added: trunk/gcc/testsuite/gfortran.dg/matmul_bounds_2.f90 trunk/gcc/testsuite/gfortran.dg/matmul_bounds_3.f90 trunk/gcc/testsuite/gfortran.dg/matmul_bounds_4.f90 trunk/gcc/testsuite/gfortran.dg/matmul_bounds_5.f90 Modified: trunk/gcc/testsuite/ChangeLog trunk/libgfortran/ChangeLog trunk/libgfortran/generated/matmul_c10.c trunk/libgfortran/generated/matmul_c16.c trunk/libgfortran/generated/matmul_c4.c trunk/libgfortran/generated/matmul_c8.c trunk/libgfortran/generated/matmul_i1.c trunk/libgfortran/generated/matmul_i16.c trunk/libgfortran/generated/matmul_i2.c trunk/libgfortran/generated/matmul_i4.c trunk/libgfortran/generated/matmul_i8.c trunk/libgfortran/generated/matmul_l16.c trunk/libgfortran/generated/matmul_l4.c trunk/libgfortran/generated/matmul_l8.c trunk/libgfortran/generated/matmul_r10.c trunk/libgfortran/generated/matmul_r16.c trunk/libgfortran/generated/matmul_r4.c trunk/libgfortran/generated/matmul_r8.c trunk/libgfortran/m4/matmul.m4 trunk/libgfortran/m4/matmull.m4 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36341
[Bug fortran/36341] MATMUL: Bounds check missing
--- Comment #16 from tkoenig at gcc dot gnu dot org 2008-07-07 19:47 --- Fixed both for compile-time and run-time on trunk. Closing. -- tkoenig at gcc dot gnu dot org changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution||FIXED Summary|MATMUL: Bounds check missing|MATMUL: Bounds check missing |(run time) | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36341
[Bug fortran/36341] MATMUL: Bounds check missing (run time)
--- Comment #14 from tkoenig at gcc dot gnu dot org 2008-07-03 21:19 --- run-time patch posted. -- tkoenig at gcc dot gnu dot org changed: What|Removed |Added OtherBugsDependingO||34670 nThis|| URL||http://gcc.gnu.org/ml/gcc- ||patches/2008- ||07/msg00099.html Keywords||patch http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36341
[Bug fortran/36341] MATMUL: Bounds check missing (run time)
--- Comment #13 from tkoenig at gcc dot gnu dot org 2008-07-02 06:54 --- Fixed for compile-time. -- tkoenig at gcc dot gnu dot org changed: What|Removed |Added Summary|MATMUL: Bounds check missing|MATMUL: Bounds check missing |(run time compile time) |(run time) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36341
[Bug fortran/36341] MATMUL: Bounds check missing (run time compile time)
--- Comment #12 from tkoenig at gcc dot gnu dot org 2008-06-29 19:06 --- Subject: Bug 36341 Author: tkoenig Date: Sun Jun 29 19:06:06 2008 New Revision: 137255 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=137255 Log: 2008-06-29 Thomas Koenig [EMAIL PROTECTED] PR fortran/36341 * iresolve.c (gfc_resolve_matmul): Copy shapes from arguments. 2008-06-29 Thomas Koenig [EMAIL PROTECTED] PR fortran/36341 * gfortran.dg/matmul_bounds_1.f90: New test. Added: trunk/gcc/testsuite/gfortran.dg/matmul_bounds_1.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/iresolve.c trunk/gcc/testsuite/ChangeLog -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36341
[Bug fortran/36341] MATMUL: Bounds check missing (run time compile time)
--- Comment #7 from tkoenig at gcc dot gnu dot org 2008-06-28 07:54 --- Created an attachment (id=15822) -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15822action=view) compile-time patch This patch works for compile-time, and passes all *matmul* regression tests. -- tkoenig at gcc dot gnu dot org changed: What|Removed |Added AssignedTo|unassigned at gcc dot gnu |tkoenig at gcc dot gnu dot |dot org |org Status|NEW |ASSIGNED http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36341
[Bug fortran/36341] MATMUL: Bounds check missing (run time compile time)
--- Comment #8 from dominiq at lps dot ens dot fr 2008-06-28 12:51 --- With the patch in comment #7 on i686-apple-darwin9, the test gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_matmul.f90 fails with v(1:2) = matmul(a, y) 1 Error: Different shape for array assignment at (1) on dimension 1 (2 and 3) FAIL: gfortran.fortran-torture/execute/intrinsic_matmul.f90 compilation, -O0 FAIL: gfortran.fortran-torture/execute/intrinsic_matmul.f90 compilation, -O1 FAIL: gfortran.fortran-torture/execute/intrinsic_matmul.f90 compilation, -O2 FAIL: gfortran.fortran-torture/execute/intrinsic_matmul.f90 compilation, -O2 -fomit-frame-pointer -finline-functions FAIL: gfortran.fortran-torture/execute/intrinsic_matmul.f90 compilation, -O2 -fomit-frame-pointer -finline-functions -funroll-loops FAIL: gfortran.fortran-torture/execute/intrinsic_matmul.f90 compilation, -O2 -fbounds-check FAIL: gfortran.fortran-torture/execute/intrinsic_matmul.f90 compilation, -O3 -g FAIL: gfortran.fortran-torture/execute/intrinsic_matmul.f90 compilation, -Os FAIL: gfortran.fortran-torture/execute/intrinsic_matmul.f90 compilation, -O2 -ftree-vectorize -msse2 Now testing with -m64. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36341
[Bug fortran/36341] MATMUL: Bounds check missing (run time compile time)
--- Comment #9 from dominiq at lps dot ens dot fr 2008-06-28 14:38 --- Should not + mpz_init_set (f-shape[0], a-shape[1]); be + mpz_init_set (f-shape[0], a-shape[0]); ? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36341
[Bug fortran/36341] MATMUL: Bounds check missing (run time compile time)
--- Comment #10 from dominiq at lps dot ens dot fr 2008-06-28 17:30 --- The failures reported in comment #8 disappear with the fix of comment #9. However I have gotten an Heisenbug for 32 bit mode: FAIL: gfortran.dg/bounds_check_11.f90 -Os (test for warnings, line 18) FAIL: gfortran.dg/bounds_check_11.f90 -Os (test for warnings, line 19) Executing on host: /opt/gcc/i686-darwin/gcc/testsuite/gfortran/../../gfortran -B/opt/gcc/i686-darwin/gcc/testsuite/gfortran/../../ /opt/gcc/gcc-4.4-work/gcc/testsuite/gfortran.dg/bounds_check_11.f90 -Os -fbounds-check -L/opt/gcc/i686-darwin/i686-apple-darwin9/./libgfortran/.libs -L/opt/gcc/i686-darwin/i686-apple-darwin9/./libgfortran/.libs -L/opt/gcc/i686-darwin/i686-apple-darwin9/./libiberty -lm -o ./bounds_check_11.exe(timeout = 300) FAIL: gfortran.dg/bounds_check_11.f90 -Os (test for warnings, line 18) FAIL: gfortran.dg/bounds_check_11.f90 -Os (test for warnings, line 19) PASS: gfortran.dg/bounds_check_11.f90 -Os (test for excess errors) Setting LD_LIBRARY_PATH to .:/opt/gcc/i686-darwin/i686-apple-darwin9/./libgfortran/.libs:/opt/gcc/i686-darwin/i686-apple-darwin9/./libgfortran/.libs:/opt/gcc/i686-darwin/gcc:.:/opt/gcc/i686-darwin/i686-apple-darwin9/./libgfortran/.libs:/opt/gcc/i686-darwin/i686-apple-darwin9/./libgfortran/.libs:/opt/gcc/i686-darwin/gcc At line 18 of file /opt/gcc/gcc-4.4-work/gcc/testsuite/gfortran.dg/bounds_check_11.f90 Fortran runtime error: Array reference out of bounds, lower bound of dimension 2 of array 'jp' exceeded (0 1) PASS: gfortran.dg/bounds_check_11.f90 -Os output pattern test, At line 18 of file .*Array reference out of bounds, lower bound of dimension 2 of array 'jp' exceeded .0 1. But the same test done manually gave: [ibook-dhum] f90/bug% /opt/gcc/i686-darwin/gcc/testsuite/gfortran/../../gfortran -B/opt/gcc/i686-darwin/gcc/testsuite/gfortran/../../ /opt/gcc/gcc-4.4-work/gcc/testsuite/gfortran.dg/bounds_check_11.f90 -Os -fbounds-check -L/opt/gcc/i686-darwin/i686-apple-darwin9/./libgfortran/.libs -L/opt/gcc/i686-darwin/i686-apple-darwin9/./libgfortran/.libs -L/opt/gcc/i686-darwin/i686-apple-darwin9/./libiberty -lm /opt/gcc/gcc-4.4-work/gcc/testsuite/gfortran.dg/bounds_check_11.f90:18.9: jp(2,0:4)=0 ! { dg-warning out of bounds } 1 Warning: Lower array reference at (1) is out of bounds (0 1) in dimension 2 /opt/gcc/gcc-4.4-work/gcc/testsuite/gfortran.dg/bounds_check_11.f90:19.7: jp(3,1:4)=0 ! { dg-warning out of bounds } 1 Warning: Array reference at (1) is out of bounds (3 2) in dimension 1 Then I did: [ibook-dhum] i686-darwin/gcc% make -k check-gfortran RUNTESTFLAGS=dg.exp=bounds_check_11.f90 Makefile:3221: warning: overriding commands for target `gt-darwin.h' ../../gcc-4.4-work/gcc/config/t-darwin:17: warning: ignoring old commands for target `gt-darwin.h' test -d testsuite || mkdir testsuite test -d testsuite/gfortran || mkdir testsuite/gfortran (rootme=`${PWDCMD-pwd}`; export rootme; \ srcdir=`cd ../../gcc-4.4-work/gcc; ${PWDCMD-pwd}` ; export srcdir ; \ cd testsuite/gfortran; \ rm -f tmp-site.exp; \ sed '/set tmpdir/ s|testsuite|testsuite/gfortran|' \ ../../site.exp tmp-site.exp; \ /bin/sh ${srcdir}/../move-if-change tmp-site.exp site.exp; \ EXPECT=`if [ -f ${rootme}/../expect/expect ] ; then echo ${rootme}/../expect/expect ; else echo expect ; fi` ; export EXPECT ; \ if [ -f ${rootme}/../expect/expect ] ; then \ TCL_LIBRARY=`cd .. ; cd ${srcdir}/../tcl/library ; ${PWDCMD-pwd}` ; \ export TCL_LIBRARY ; fi ; \ GCC_EXEC_PREFIX=/opt/gcc/gcc4.4w/lib/gcc/ ; export GCC_EXEC_PREFIX ; \ `if [ -f ${srcdir}/../dejagnu/runtest ] ; then echo ${srcdir}/../dejagnu/runtest ; else echo runtest; fi` --tool gfortran dg.exp=bounds_check_11.f90) WARNING: Couldn't find the global config file. Test Run By dominiq on Sat Jun 28 19:20:39 2008 Native configuration is i686-apple-darwin9 === gfortran tests === Schedule of variations: unix Running target unix Using /sw/share/dejagnu/baseboards/unix.exp as board description file for target. Using /sw/share/dejagnu/config/unix.exp as generic interface file for target. Using /opt/gcc/gcc-4.4-work/gcc/testsuite/config/default.exp as tool-and-target-specific interface file. Running /opt/gcc/gcc-4.4-work/gcc/testsuite/gfortran.dg/dg.exp ... === gfortran Summary === # of expected passes40 /opt/gcc/i686-darwin/gcc/testsuite/gfortran/../../gfortran version 4.4.0 [revision 137223p5] 20080628 (experimental) (GCC) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36341
[Bug fortran/36341] MATMUL: Bounds check missing (run time compile time)
--- Comment #11 from tkoenig at gcc dot gnu dot org 2008-06-28 20:37 --- (In reply to comment #9) Should not + mpz_init_set (f-shape[0], a-shape[1]); be + mpz_init_set (f-shape[0], a-shape[0]); Yes, it should be that. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36341
[Bug fortran/36341] MATMUL: Bounds check missing (run time compile time)
--- Comment #6 from tkoenig at gcc dot gnu dot org 2008-06-23 21:28 --- We should probably set the shape for arguments of known shape in gfc_resolve_matmul. -- tkoenig at gcc dot gnu dot org changed: What|Removed |Added CC||tkoenig at gcc dot gnu dot ||org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36341
[Bug fortran/36341] MATMUL: Bounds check missing (run time compile time)
--- Comment #5 from tkoenig at gcc dot gnu dot org 2008-06-12 18:20 --- This is an instance of PR 34670. -- tkoenig at gcc dot gnu dot org changed: What|Removed |Added OtherBugsDependingO|34670 | nThis|| Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Last reconfirmed|-00-00 00:00:00 |2008-06-12 18:20:08 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36341
[Bug fortran/36341] MATMUL: Bounds check missing (run time compile time)
--- Comment #3 from burnus at gcc dot gnu dot org 2008-05-27 16:34 --- gfortran should do better. NAG f95 detects at compile time: dzeta=matmul(U,B) Error: Array shapes differ in dimension 1 (extent 6 and 7) Here, dzeta is (6,12) and matmul(U,B) is (7,12). gfortran does not even detect it at run time (-fbounds-check). -- burnus at gcc dot gnu dot org changed: What|Removed |Added OtherBugsDependingO||27766 nThis|| Keywords||diagnostic Summary|Matrix assignment error not |MATMUL: Bounds check missing |detected|(run time compile time) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36341
[Bug fortran/36341] MATMUL: Bounds check missing (run time compile time)
--- Comment #4 from terry at chem dot gu dot se 2008-05-28 02:00 --- Somewhat reduced testcase that exhibits the same behaviour: program distgeom implicit none real(kind=8),dimension(7,12)::B real(kind=8),dimension(7,7)::U real(kind=8),dimension(6,12)::dzeta call random_number(U) call random_number(B) write(*,*)'A',U(1,1) dzeta=matmul(U,B) write(*,*)'B',U(1,1) end -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36341