Ken Werner reported for spu-unknown-elf: "I'm getting the following message: "error: integral result type precision does not match field size of BIT_FIELD_REF". It looks like this could be a problem of the frontend. Please find attached the complete output and let me know if you need further infos." $ /home/kwerner/dailybuild/spu-tc-2010-03-01/gcc-build/gcc/testsuite/gfortran2/../../gfortran -B/home/kwerner/dailybuild/spu-tc-2010-03-01/gcc-build/gcc/testsuite/gfortran2/../../ /home/kwerner/dailybuild/spu-tc-2010-03-01/gcc-head/src/gcc/testsuite/gfortran.dg/logical_dot_product.f90 -O3 -fomit-frame-pointer -pedantic-errors -Wl,--gc-sections -B/home/kwerner/dailybuild/spu-tc-2010-03-01/gcc-build/spu/./libgfortran/.libs -L/home/kwerner/dailybuild/spu-tc-2010-03-01/gcc-build/spu/./libgfortran/.libs -L/home/kwerner/dailybuild/spu-tc-2010-03-01/gcc-build/spu/./libiberty -Wl,--auto-overlay -Wl,--reserved-space=131072 -lm -o ./logical_dot_product.exe /home/kwerner/dailybuild/spu-tc-2010-03-01/gcc-head/src/gcc/testsuite/gfortran.dg/logical_dot_product.f90: In function 'main': /home/kwerner/dailybuild/spu-tc-2010-03-01/gcc-head/src/gcc/testsuite/gfortran.dg/logical_dot_product.f90:11:0: error: integral result type precision does not match field size of BIT_FIELD_REF BIT_FIELD_REF <vect_var_.52_105, 32, 0> f951: note: in statement stmp_var_.53_106 = BIT_FIELD_REF <vect_var_.52_105, 32, 0>; /home/kwerner/dailybuild/spu-tc-2010-03-01/gcc-head/src/gcc/testsuite/gfortran.dg/logical_dot_product.f90:11:0: error: integral result type precision does not match field size of BIT_FIELD_REF BIT_FIELD_REF <vect_var_.52_105, 32, 32> f951: note: in statement stmp_var_.53_107 = BIT_FIELD_REF <vect_var_.52_105, 32, 32>; /home/kwerner/dailybuild/spu-tc-2010-03-01/gcc-head/src/gcc/testsuite/gfortran.dg/logical_dot_product.f90:11:0: error: integral result type precision does not match field size of BIT_FIELD_REF BIT_FIELD_REF <vect_var_.52_105, 32, 64> f951: note: in statement stmp_var_.53_109 = BIT_FIELD_REF <vect_var_.52_105, 32, 64>; /home/kwerner/dailybuild/spu-tc-2010-03-01/gcc-head/src/gcc/testsuite/gfortran.dg/logical_dot_product.f90:11:0: error: integral result type precision does not match field size of BIT_FIELD_REF BIT_FIELD_REF <vect_var_.52_105, 32, 96> f951: note: in statement stmp_var_.53_111 = BIT_FIELD_REF <vect_var_.52_105, 32, 96>; /home/kwerner/dailybuild/spu-tc-2010-03-01/gcc-head/src/gcc/testsuite/gfortran.dg/logical_dot_product.f90:11:0: error: integral result type precision does not match field size of BIT_FIELD_REF BIT_FIELD_REF <vect_var_.31_73, 32, 0> f951: note: in statement stmp_var_.32_74 = BIT_FIELD_REF <vect_var_.31_73, 32, 0>; /home/kwerner/dailybuild/spu-tc-2010-03-01/gcc-head/src/gcc/testsuite/gfortran.dg/logical_dot_product.f90:11:0: error: integral result type precision does not match field size of BIT_FIELD_REF BIT_FIELD_REF <vect_var_.31_73, 32, 32> f951: note: in statement stmp_var_.32_75 = BIT_FIELD_REF <vect_var_.31_73, 32, 32>; /home/kwerner/dailybuild/spu-tc-2010-03-01/gcc-head/src/gcc/testsuite/gfortran.dg/logical_dot_product.f90:11:0: error: integral result type precision does not match field size of BIT_FIELD_REF BIT_FIELD_REF <vect_var_.31_73, 32, 64> f951: note: in statement stmp_var_.32_77 = BIT_FIELD_REF <vect_var_.31_73, 32, 64>; /home/kwerner/dailybuild/spu-tc-2010-03-01/gcc-head/src/gcc/testsuite/gfortran.dg/logical_dot_product.f90:11:0: error: integral result type precision does not match field size of BIT_FIELD_REF BIT_FIELD_REF <vect_var_.31_73, 32, 96> f951: note: in statement stmp_var_.32_79 = BIT_FIELD_REF <vect_var_.31_73, 32, 96>; /home/kwerner/dailybuild/spu-tc-2010-03-01/gcc-head/src/gcc/testsuite/gfortran.dg/logical_dot_product.f90:11:0: internal compiler error: verify_stmts failed Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions.
The complete source code (minus comments) is: logical :: l1(4) = (/.TRUE.,.FALSE.,.TRUE.,.FALSE./) logical :: l2(4) = (/.FALSE.,.TRUE.,.FALSE.,.TRUE./) if (dot_product (l1, l2)) call abort () l2 = .TRUE. if (.not.dot_product (l1, l2)) call abort () end ! <<< This is line 11
Ira, what do you think? Is this a front-end or a middle-end/vectorizer issue?
Variant which also crashes on x86-64 systems: logical :: l1(4) logical :: l2(4) l1 = (/.TRUE.,.FALSE.,.TRUE.,.FALSE./) l2 = (/.FALSE.,.TRUE.,.FALSE.,.TRUE./) if (dot_product (l1, l2)) call abort () l2 = .TRUE. if (.not.dot_product (l1, l2)) call abort () end test2.f90:8:0: error: integral result type precision does not match field size of BIT_FIELD_REF BIT_FIELD_REF <vect_var_.37_73, 32, 0> f951: note: in statement stmp_var_.36_74 = BIT_FIELD_REF <vect_var_.37_73, 32, 0>; Testing indicates with "gfortran -O3" on x86-64-linux: working 2009-07-10-r149458 failing 2009-07-17-r149734 though builds might be tainted by local patches. Thus, it looks like either a middle-end problem or at least an issue exposed by middle-end modifications.
*** Bug 43252 has been marked as a duplicate of this bug. ***
The issue is that logical(kind=4) seems to have TYPE_PRECISION of 1 (just guessing). But BIT_FIELD_REF <vect_var_.37_73, 32, 0> extracts 32bits from the vector, failing to truncate the result to 1 bit precision, possibly leading to wrong-code. What the middle-end expects here is integer(kind=4) tmp = But BIT_FIELD_REF <vect_var_.37_73, 32, 0>; res = (logical(kind=4))tmp; But I suppose this might turn out to be expensive (thus we could also refuse to build vector types from types whose precision does not match their mode bitsize).
Well. I'll just implement that given the silence.
Subject: Bug 43390 Author: rguenth Date: Mon Mar 22 12:39:04 2010 New Revision: 157624 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=157624 Log: 2010-03-22 Richard Guenther <rguenther@suse.de> PR tree-optimization/43390 * tree-vect-stmts.c (get_vectype_for_scalar_type): Make sure vector extracts are type correct. * gfortran.fortran-torture/execute/pr43390.f90: New testcase. Added: trunk/gcc/testsuite/gfortran.fortran-torture/execute/pr43390.f90 Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-vect-stmts.c
Fixed.
Subject: Bug 43390 Author: hjl Date: Thu Mar 25 16:39:51 2010 New Revision: 157726 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=157726 Log: Backport regression testcases from mainline. 2010-03-25 H.J. Lu <hongjiu.lu@intel.com> Backport from mainline: 2010-03-22 Jason Merrill <jason@redhat.com> PR c++/43333 * g++.dg/ext/is_pod_98.C: New. 2010-03-22 Michael Matz <matz@suse.de> PR middle-end/43475 * gfortran.dg/pr43475.f90: New testcase. 2010-03-22 Richard Guenther <rguenther@suse.de> PR tree-optimization/43390 * gfortran.fortran-torture/execute/pr43390.f90: New testcase. 2010-03-20 Dodji Seketeli <dodji@redhat.com> PR c++/43375 * g++.dg/abi/mangle42.C: New test. 2010-03-19 Andrew Pinski <andrew_pinski@caviumnetworks.com> PR C/43211 * gcc.dg/pr43211.c: New test. 2010-03-18 Martin Jambor <mjambor@suse.cz> PR middle-end/42450 * g++.dg/torture/pr42450.C: New test. 2010-03-18 Michael Matz <matz@suse.de> PR tree-optimization/43402 * gcc.dg/pr43402.c: New testcase. 2010-03-17 Peter Bergner <bergner@vnet.ibm.com> PR target/42427 * gcc.dg/pr42427.c: New test. 2010-03-16 Richard Guenther <rguenther@suse.de> PR middle-end/43379 * gcc.dg/pr43379.c: New testcase. 2010-03-15 Michael Matz <matz@suse.de> PR middle-end/43300 * gcc.dg/pr43300.c: New testcase. 2010-03-15 Richard Guenther <rguenther@suse.de> PR tree-optimization/43367 * gcc.c-torture/compile/pr43367.c: New testcase. Added: branches/gcc-4_4-branch/gcc/testsuite/g++.dg/abi/mangle42.C - copied unchanged from r157725, trunk/gcc/testsuite/g++.dg/abi/mangle42.C branches/gcc-4_4-branch/gcc/testsuite/g++.dg/ext/is_pod_98.C - copied unchanged from r157725, trunk/gcc/testsuite/g++.dg/ext/is_pod_98.C branches/gcc-4_4-branch/gcc/testsuite/g++.dg/torture/pr42450.C - copied unchanged from r157725, trunk/gcc/testsuite/g++.dg/torture/pr42450.C branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr43367.c - copied unchanged from r157725, trunk/gcc/testsuite/gcc.c-torture/compile/pr43367.c branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/pr42427.c - copied unchanged from r157725, trunk/gcc/testsuite/gcc.dg/pr42427.c branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/pr43211.c - copied unchanged from r157725, trunk/gcc/testsuite/gcc.dg/pr43211.c branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/pr43300.c - copied unchanged from r157725, trunk/gcc/testsuite/gcc.dg/pr43300.c branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/pr43379.c - copied unchanged from r157725, trunk/gcc/testsuite/gcc.dg/pr43379.c branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/pr43402.c - copied unchanged from r157725, trunk/gcc/testsuite/gcc.dg/pr43402.c branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/pr43475.f90 - copied unchanged from r157725, trunk/gcc/testsuite/gfortran.dg/pr43475.f90 branches/gcc-4_4-branch/gcc/testsuite/gfortran.fortran-torture/execute/pr43390.f90 - copied unchanged from r157725, trunk/gcc/testsuite/gfortran.fortran-torture/execute/pr43390.f90 Modified: branches/gcc-4_4-branch/gcc/testsuite/ChangeLog