This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[C++] PR c++/22494: Fix type mismatch in array destructor


The following simple patch resolves PR c++/22494 which is an internal
tree type mismatch detected by Andrew Pinski's strict type checking
patches.  The trivial fix is to insert an additional call to fold
convert.  This routine is given a pointer to an array, BASE, of type
TYPE, but internally manipulates pointers using PTYPE which is a
pointers to "complete_type (TYPE)".  Hence the patch below casts
pointers such as T[2]* into the more generic T* (i.e. PTYPE) for use
in equality comparisons.


The following patch has been tested on x86_64-unknown-linux-gnu with
a full "make bootstrap", all default languages, and regression tested
with a top-level "make -k check" with no new failures.

Ok for mainline?



2006-03-27  Roger Sayle  <roger@eyesopen.com>

	PR c++/22494
	* init.c (build_vec_delete_1): Convert BASE pointer's type to
	the base pointer type to avoid a type mismatch in the EQ_EXPR.


Index: init.c
===================================================================
*** init.c	(revision 112052)
--- init.c	(working copy)
*************** build_vec_delete_1 (tree base, tree maxi
*** 2212,2218 ****
    TREE_SIDE_EFFECTS (controller) = 1;

    body = build1 (EXIT_EXPR, void_type_node,
! 		 build2 (EQ_EXPR, boolean_type_node, base, tbase));
    body = build_compound_expr
      (body, build_modify_expr (tbase, NOP_EXPR,
  			      build2 (MINUS_EXPR, ptype, tbase, size_exp)));
--- 2212,2219 ----
    TREE_SIDE_EFFECTS (controller) = 1;

    body = build1 (EXIT_EXPR, void_type_node,
! 		 build2 (EQ_EXPR, boolean_type_node, tbase,
! 			 fold_convert (ptype, base)));
    body = build_compound_expr
      (body, build_modify_expr (tbase, NOP_EXPR,
  			      build2 (MINUS_EXPR, ptype, tbase, size_exp)));


Roger
--


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]