I just tried to compile the package pspdftool with the GNU C compiler version 4.5 snapshot 20100107 and the compiler said gcc -DHAVE_CONFIG_H -I. -std=gnu99 -O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -MT pdf_parser.o -MD -MP -MF .deps/pdf_parser.Tpo -c -o pdf_parser.o pdf_parser.c pdf_parser.c: In function 'pdf_count_size_object': pdf_parser.c:1030:1: error: type mismatch in binary expression int int unsigned int add_acc.43_71 = add_acc.43_57 + 96; pdf_parser.c:1030:1: 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. Preprocessed source code attached. Flag -O2 required.
Created attachment 19601 [details] C source code
(In reply to comment #1) > Created an attachment (id=19601) [edit] > C source code > It works for me with 4.5.0 20100114 (experimental) [trunk revision 155925] on Linux/x86-64.
(In reply to comment #2) > It works for me with 4.5.0 20100114 (experimental) [trunk revision 155925] > on Linux/x86-64. I upgraded to the latest snapshot (20010114), trunk revision 155915 and it still seems broken to me. Either one of the ten revisions fixed it, or somethings gone wrong for me locally. I'll try a raw build of 20010114 and report back.
Confirmed. Reducing.
struct pdf_object { int val; }; int pdf_count_size_object (struct pdf_object * p_obj) { return pdf_count_size_object(p_obj) + 2 * sizeof(struct pdf_object); }
It is caused by revision 146831: http://gcc.gnu.org/ml/gcc-cvs/2009-04/msg01473.html
(In reply to comment #6) > It is caused by revision 146831: Exposed by, not really caused in this case. The bug was there before the extra checking was added. I am looking into fixing tailr. Note we do go from an overflowing being wrapping to be undefined too. So there is more than just fixing types too.
This is harder than I thought. CCing the original author of this part of the code.
Indeed it's harder that I thought originally as well ;) I wonder why we re-create a simple form of the return value adjustment instead of just copying the existing statements.
/* Reject a tailcall if the type conversion might need 285 additional code. */ 286 if (gimple_assign_cast_p (stmt) 287 && TYPE_MODE (TREE_TYPE (dest)) != TYPE_MODE (TREE_TYPE (src_var))) 288 return false; This is suspicious; replacing the weird TYPE_MODE check with useless_type_conversion_p fixes the problem.
Subject: Re: [4.5 Regression] -O2 and verify_stmts failed again On Sat, 16 Jan 2010, rakdver at gcc dot gnu dot org wrote: > > > ------- Comment #10 from rakdver at gcc dot gnu dot org 2010-01-16 12:53 ------- > /* Reject a tailcall if the type conversion might need > 285 additional code. */ > 286 if (gimple_assign_cast_p (stmt) > 287 && TYPE_MODE (TREE_TYPE (dest)) != TYPE_MODE > (TREE_TYPE (src_var))) > 288 return false; > > This is suspicious; replacing the weird TYPE_MODE check with > useless_type_conversion_p fixes the problem. Correct, but for useless_type_conversion_p we can reject any conversions in the IL since only !useless_type_conversion_p remain. I suppose the code was explicitly trying to allow sign-changing (but not precision changing as it does), or conversion to/from pointers. Thus, if you want to go the useless_type_conversion_p route simply reject all conversions and only allow plain SSA name copies... Richard.
Subject: Re: [4.5 Regression] -O2 and verify_stmts failed again > > ------- Comment #10 from rakdver at gcc dot gnu dot org 2010-01-16 12:53 ------- > > /* Reject a tailcall if the type conversion might need > > 285 additional code. */ > > 286 if (gimple_assign_cast_p (stmt) > > 287 && TYPE_MODE (TREE_TYPE (dest)) != TYPE_MODE > > (TREE_TYPE (src_var))) > > 288 return false; > > > > This is suspicious; replacing the weird TYPE_MODE check with > > useless_type_conversion_p fixes the problem. > > Correct, but for useless_type_conversion_p we can reject any conversions > in the IL since only !useless_type_conversion_p remain. right > I suppose the code was explicitly trying to allow sign-changing > (but not precision changing as it does), or conversion to/from > pointers. > > Thus, if you want to go the useless_type_conversion_p route simply > reject all conversions and only allow plain SSA name copies... this might be overly restrictive; it should be quite easy to add the appropriate casts, instead.
FWIW a very similar error occurs when building mysql 5.5.1-m2, almost certainly the same bug opt_range.cc: In member function 'int SEL_ARG::store_min_key(KEY_PART*, uchar**, uint*, uint)': opt_range.cc:11812:42: error: type mismatch in binary expression int int uint add_acc.811_37 = add_acc.811_49 + res_15; opt_range.cc:11812:42: internal compiler error: verify_stmts failed
I have a patch.
Subject: Bug 42749 Author: rguenth Date: Mon Feb 22 14:09:26 2010 New Revision: 156960 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=156960 Log: 2010-02-22 Richard Guenther <rguenther@suse.de> PR tree-optimization/42749 * tree-tailcall.c (adjust_return_value_with_ops): Drop update parameter. Do arithmetic in the original type. (update_accumulator_with_ops): Likewise. (adjust_accumulator_values): Adjust. * gcc.c-torture/compile/pr42749.c: New testcase. Added: trunk/gcc/testsuite/gcc.c-torture/compile/pr42749.c Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-tailcall.c
Fixed.
*** Bug 42923 has been marked as a duplicate of this bug. ***
Subject: Bug 42749 Author: hjl Date: Tue Feb 23 17:02:26 2010 New Revision: 157010 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=157010 Log: Backport testcases from mainline. 2010-02-23 H.J. Lu <hongjiu.lu@intel.com> Backport from mainline: 2010-02-22 Richard Guenther <rguenther@suse.de> PR tree-optimization/42749 * gcc.c-torture/compile/pr42749.c: New testcase. 2010-02-21 Dodji Seketeli <dodji@redhat.com> PR c++/42824 * g++.dg/template/memclass4.C: New test. 2010-02-20 Paul Thomas <pault@gcc.gnu.org> PR fortran/43111 * gfortran.dg/internal_pack_8.f90: New test. 2010-02-18 Jason Merrill <jason@redhat.com> PR c++/43109 * g++.dg/parse/namespace12.C: New. 2010-02-18 Martin Jambor <mjambor@suse.cz> PR tree-optimization/43066 * gcc.c-torture/compile/pr43066.c: New test. 2010-02-17 Jason Merrill <jason@redhat.com> PR c++/43069 * g++.dg/parse/namespace11.C: New. PR c++/43093 * g++.dg/ext/attrib37.C: New. PR c++/43079 * g++.dg/template/ptrmem20.C: New. 2010-02-16 Jason Merrill <jason@redhat.com> PR c++/43031 * g++.dg/ext/attrib36.C: New. 2010-02-15 Richard Guenther <rguenther@suse.de> PR middle-end/43068 * g++.dg/torture/pr43068.C: New testcase. 2010-02-11 Richard Guenther <rguenther@suse.de> PR tree-optimization/42998 * gcc.c-torture/compile/pr42998.c: New testcase. 2010-02-10 Richard Guenther <rguenther@suse.de> PR tree-optimization/43017 * gcc.dg/torture/pr43017.c: New testcase. 2010-02-10 Richard Guenther <rguenther@suse.de> PR c/43007 * gcc.c-torture/execute/20100209-1.c: New testcase. * gcc.dg/fold-div-3.c: Likewise. 2010-02-09 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/42999 * gfortran.dg/array_constructor_35.f90: New test. 2010-02-09 Richard Guenther <rguenther@suse.de> PR tree-optimization/43008 * gcc.c-torture/execute/pr43008.c: New testcase. 2010-02-09 Richard Guenther <rguenther@suse.de> PR tree-optimization/43000 * gcc.dg/torture/pr43000.c: New testcase. * gcc.dg/torture/pr43002.c: Likewise. 2010-02-06 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/42742 * gfortran.dg/fmt_cache_2.f: New test. 2010-02-03 Jason Merrill <jason@redhat.com> PR c++/42870 * g++.dg/ext/dllexport3.C: New. Added: branches/gcc-4_4-branch/gcc/testsuite/g++.dg/ext/attrib36.C - copied unchanged from r157009, trunk/gcc/testsuite/g++.dg/ext/attrib36.C branches/gcc-4_4-branch/gcc/testsuite/g++.dg/ext/attrib37.C - copied unchanged from r157009, trunk/gcc/testsuite/g++.dg/ext/attrib37.C branches/gcc-4_4-branch/gcc/testsuite/g++.dg/ext/dllexport3.C - copied unchanged from r157009, trunk/gcc/testsuite/g++.dg/ext/dllexport3.C branches/gcc-4_4-branch/gcc/testsuite/g++.dg/parse/namespace11.C - copied unchanged from r157009, trunk/gcc/testsuite/g++.dg/parse/namespace11.C branches/gcc-4_4-branch/gcc/testsuite/g++.dg/parse/namespace12.C - copied unchanged from r157009, trunk/gcc/testsuite/g++.dg/parse/namespace12.C branches/gcc-4_4-branch/gcc/testsuite/g++.dg/template/memclass4.C - copied unchanged from r157009, trunk/gcc/testsuite/g++.dg/template/memclass4.C branches/gcc-4_4-branch/gcc/testsuite/g++.dg/template/ptrmem20.C - copied unchanged from r157009, trunk/gcc/testsuite/g++.dg/template/ptrmem20.C branches/gcc-4_4-branch/gcc/testsuite/g++.dg/torture/pr43068.C - copied unchanged from r157009, trunk/gcc/testsuite/g++.dg/torture/pr43068.C branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr42749.c - copied unchanged from r157009, trunk/gcc/testsuite/gcc.c-torture/compile/pr42749.c branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr42998.c - copied unchanged from r157009, trunk/gcc/testsuite/gcc.c-torture/compile/pr42998.c branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr43066.c - copied unchanged from r157009, trunk/gcc/testsuite/gcc.c-torture/compile/pr43066.c branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/execute/20100209-1.c - copied unchanged from r157009, trunk/gcc/testsuite/gcc.c-torture/execute/20100209-1.c branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/execute/pr43008.c - copied unchanged from r157009, trunk/gcc/testsuite/gcc.c-torture/execute/pr43008.c branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/fold-div-3.c - copied unchanged from r157009, trunk/gcc/testsuite/gcc.dg/fold-div-3.c branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/torture/pr43000.c - copied unchanged from r157009, trunk/gcc/testsuite/gcc.dg/torture/pr43000.c branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/torture/pr43002.c - copied unchanged from r157009, trunk/gcc/testsuite/gcc.dg/torture/pr43002.c branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/array_constructor_35.f90 - copied unchanged from r157009, trunk/gcc/testsuite/gfortran.dg/array_constructor_35.f90 branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/fmt_cache_2.f - copied unchanged from r157009, trunk/gcc/testsuite/gfortran.dg/fmt_cache_2.f branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/internal_pack_8.f90 - copied unchanged from r157009, trunk/gcc/testsuite/gfortran.dg/internal_pack_8.f90 Modified: branches/gcc-4_4-branch/gcc/testsuite/ChangeLog