* [PATCH][C++] Type fixes for the C++ frontend
@ 2007-07-26 11:53 Richard Guenther
2007-08-06 3:30 ` Mark Mitchell
0 siblings, 1 reply; 3+ messages in thread
From: Richard Guenther @ 2007-07-26 11:53 UTC (permalink / raw)
To: gcc-patches
These are all that remain in my tree for now. With these the C++
and libstdc++ testsuites are regression-free for a types checking
enabled tree.
Bootstrapped and tested on x86_64-unknown-linux-gnu.
Ok for mainline?
Thanks,
Richard.
2007-07-13 Richard Guenther <rguenther@suse.de>
PR c++/22369
PR c++/22451
* call.c (build_new_method_call): Convert initializer to
the basetype.
* init.c (build_aggr_init): Do not fiddle with types.
(build_vec_delete_1): Use correct type for POINTER_PLUS_EXPR.
* except.c (build_throw): Do not drop qualifiers for the
pointer type.
* typeck.c (get_member_function_from_ptrfunc): Do not
fiddle with types, instead convert.
(build_ptrmemfunc1): Convert to the target type for
initialization.
(gfc_trans_allocate): Convert result to target type.
* cp-objcp-common.c (cxx_get_alias_set): Pointers to
pointer-to-member structures shall have alias set zero as well.
Index: gcc/cp/call.c
===================================================================
*** gcc/cp/call.c.orig 2007-07-26 12:26:08.000000000 +0200
--- gcc/cp/call.c 2007-07-26 12:28:35.000000000 +0200
*************** build_new_method_call (tree instance, tr
*** 5503,5508 ****
--- 5503,5515 ----
name = complete_dtor_identifier;
}
+ if (DECL_CONSTRUCTOR_P (fn))
+ {
+ tree type = build_pointer_type (basetype);
+ if (!same_type_p (type, TREE_TYPE (instance_ptr)))
+ instance_ptr = build_nop (type, instance_ptr);
+ }
+
class_type = (conversion_path ? BINFO_TYPE (conversion_path) : NULL_TREE);
mem_args = tree_cons (NULL_TREE, instance_ptr, args);
Index: gcc/cp/init.c
===================================================================
*** gcc/cp/init.c.orig 2007-07-26 12:26:08.000000000 +0200
--- gcc/cp/init.c 2007-07-26 12:28:35.000000000 +0200
*************** build_aggr_init (tree exp, tree init, in
*** 1135,1141 ****
/* Just know that we've seen something for this node. */
TREE_USED (exp) = 1;
- TREE_TYPE (exp) = TYPE_MAIN_VARIANT (type);
is_global = begin_init_stmts (&stmt_expr, &compound_stmt);
destroy_temps = stmts_are_full_exprs_p ();
current_stmt_tree ()->stmts_are_full_exprs_p = 0;
--- 1135,1140 ----
*************** build_aggr_init (tree exp, tree init, in
*** 1143,1149 ****
init, LOOKUP_NORMAL|flags);
stmt_expr = finish_init_stmts (is_global, stmt_expr, compound_stmt);
current_stmt_tree ()->stmts_are_full_exprs_p = destroy_temps;
- TREE_TYPE (exp) = type;
TREE_READONLY (exp) = was_const;
TREE_THIS_VOLATILE (exp) = was_volatile;
--- 1142,1147 ----
*************** build_vec_delete_1 (tree base, tree maxi
*** 2322,2328 ****
tbase = create_temporary_var (ptype);
tbase_init = build_modify_expr (tbase, NOP_EXPR,
fold_build2 (POINTER_PLUS_EXPR, ptype,
! base,
virtual_size));
DECL_REGISTER (tbase) = 1;
controller = build3 (BIND_EXPR, void_type_node, tbase,
--- 2320,2326 ----
tbase = create_temporary_var (ptype);
tbase_init = build_modify_expr (tbase, NOP_EXPR,
fold_build2 (POINTER_PLUS_EXPR, ptype,
! fold_convert (ptype, base),
virtual_size));
DECL_REGISTER (tbase) = 1;
controller = build3 (BIND_EXPR, void_type_node, tbase,
Index: gcc/cp/except.c
===================================================================
*** gcc/cp/except.c.orig 2007-07-26 12:26:08.000000000 +0200
--- gcc/cp/except.c 2007-07-26 12:28:35.000000000 +0200
*************** build_throw (tree exp)
*** 683,689 ****
respectively. */
temp_type = is_bitfield_expr_with_lowered_type (exp);
if (!temp_type)
! temp_type = type_decays_to (TYPE_MAIN_VARIANT (TREE_TYPE (exp)));
/* OK, this is kind of wacky. The standard says that we call
terminate when the exception handling mechanism, after
--- 683,689 ----
respectively. */
temp_type = is_bitfield_expr_with_lowered_type (exp);
if (!temp_type)
! temp_type = type_decays_to (TREE_TYPE (exp));
/* OK, this is kind of wacky. The standard says that we call
terminate when the exception handling mechanism, after
Index: gcc/cp/typeck.c
===================================================================
*** gcc/cp/typeck.c.orig 2007-07-26 12:26:08.000000000 +0200
--- gcc/cp/typeck.c 2007-07-26 12:28:35.000000000 +0200
*************** get_member_function_from_ptrfunc (tree *
*** 2639,2645 ****
e2 = build1 (NOP_EXPR, TREE_TYPE (e2),
build_unary_op (ADDR_EXPR, e2, /*noconvert=*/1));
! TREE_TYPE (e2) = TREE_TYPE (e3);
e1 = build_conditional_expr (e1, e2, e3);
/* Make sure this doesn't get evaluated first inside one of the
--- 2639,2645 ----
e2 = build1 (NOP_EXPR, TREE_TYPE (e2),
build_unary_op (ADDR_EXPR, e2, /*noconvert=*/1));
! e2 = fold_convert (TREE_TYPE (e3), e2);
e1 = build_conditional_expr (e1, e2, e3);
/* Make sure this doesn't get evaluated first inside one of the
*************** build_ptrmemfunc1 (tree type, tree delta
*** 6047,6052 ****
--- 6047,6055 ----
/* Make sure DELTA has the type we want. */
delta = convert_and_check (delta_type_node, delta);
+ /* Convert to the correct target type if necessary. */
+ pfn = fold_convert (TREE_TYPE (pfn_field), pfn);
+
/* Finish creating the initializer. */
v = VEC_alloc(constructor_elt, gc, 2);
CONSTRUCTOR_APPEND_ELT(v, pfn_field, pfn);
Index: gcc/cp/cp-objcp-common.c
===================================================================
*** gcc/cp/cp-objcp-common.c.orig 2007-07-26 12:26:08.000000000 +0200
--- gcc/cp/cp-objcp-common.c 2007-07-26 12:28:35.000000000 +0200
*************** cxx_get_alias_set (tree t)
*** 45,51 ****
return get_alias_set (TYPE_CONTEXT (t));
/* Punt on PMFs until we canonicalize functions properly. */
! if (TYPE_PTRMEMFUNC_P (t))
return 0;
return c_common_get_alias_set (t);
--- 45,53 ----
return get_alias_set (TYPE_CONTEXT (t));
/* Punt on PMFs until we canonicalize functions properly. */
! if (TYPE_PTRMEMFUNC_P (t)
! || (POINTER_TYPE_P (t)
! && TYPE_PTRMEMFUNC_P (TREE_TYPE (t))))
return 0;
return c_common_get_alias_set (t);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH][C++] Type fixes for the C++ frontend
2007-07-26 11:53 [PATCH][C++] Type fixes for the C++ frontend Richard Guenther
@ 2007-08-06 3:30 ` Mark Mitchell
2007-08-20 12:57 ` Richard Guenther
0 siblings, 1 reply; 3+ messages in thread
From: Mark Mitchell @ 2007-08-06 3:30 UTC (permalink / raw)
To: Richard Guenther; +Cc: gcc-patches
Richard Guenther wrote:
> 2007-07-13 Richard Guenther <rguenther@suse.de>
>
> PR c++/22369
> PR c++/22451
> * call.c (build_new_method_call): Convert initializer to
> the basetype.
> * init.c (build_aggr_init): Do not fiddle with types.
> (build_vec_delete_1): Use correct type for POINTER_PLUS_EXPR.
> * except.c (build_throw): Do not drop qualifiers for the
> pointer type.
> * typeck.c (get_member_function_from_ptrfunc): Do not
> fiddle with types, instead convert.
> (build_ptrmemfunc1): Convert to the target type for
> initialization.
> (gfc_trans_allocate): Convert result to target type.
> * cp-objcp-common.c (cxx_get_alias_set): Pointers to
> pointer-to-member structures shall have alias set zero as well.
OK with one minor change.
> Index: gcc/cp/call.c
> ===================================================================
> *** gcc/cp/call.c.orig 2007-07-26 12:26:08.000000000 +0200
> --- gcc/cp/call.c 2007-07-26 12:28:35.000000000 +0200
> *************** build_new_method_call (tree instance, tr
> *** 5503,5508 ****
> --- 5503,5515 ----
> name = complete_dtor_identifier;
> }
>
> + if (DECL_CONSTRUCTOR_P (fn))
> + {
> + tree type = build_pointer_type (basetype);
> + if (!same_type_p (type, TREE_TYPE (instance_ptr)))
> + instance_ptr = build_nop (type, instance_ptr);
> + }
> +
This duplicates the code just above it; please share the code. Is the
rationale the same as well, i.e., that this is about cv-qualification?
(We shouldn't have any differences other than cv-qualification at this
point, I should hope...)
--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH][C++] Type fixes for the C++ frontend
2007-08-06 3:30 ` Mark Mitchell
@ 2007-08-20 12:57 ` Richard Guenther
0 siblings, 0 replies; 3+ messages in thread
From: Richard Guenther @ 2007-08-20 12:57 UTC (permalink / raw)
To: Mark Mitchell; +Cc: gcc-patches
On Sun, 5 Aug 2007, Mark Mitchell wrote:
> Richard Guenther wrote:
>
> > 2007-07-13 Richard Guenther <rguenther@suse.de>
> >
> > PR c++/22369
> > PR c++/22451
> > * call.c (build_new_method_call): Convert initializer to
> > the basetype.
> > * init.c (build_aggr_init): Do not fiddle with types.
> > (build_vec_delete_1): Use correct type for POINTER_PLUS_EXPR.
> > * except.c (build_throw): Do not drop qualifiers for the
> > pointer type.
> > * typeck.c (get_member_function_from_ptrfunc): Do not
> > fiddle with types, instead convert.
> > (build_ptrmemfunc1): Convert to the target type for
> > initialization.
> > (gfc_trans_allocate): Convert result to target type.
> > * cp-objcp-common.c (cxx_get_alias_set): Pointers to
> > pointer-to-member structures shall have alias set zero as well.
>
> OK with one minor change.
>
> > Index: gcc/cp/call.c
> > ===================================================================
> > *** gcc/cp/call.c.orig 2007-07-26 12:26:08.000000000 +0200
> > --- gcc/cp/call.c 2007-07-26 12:28:35.000000000 +0200
> > *************** build_new_method_call (tree instance, tr
> > *** 5503,5508 ****
> > --- 5503,5515 ----
> > name = complete_dtor_identifier;
> > }
> >
> > + if (DECL_CONSTRUCTOR_P (fn))
> > + {
> > + tree type = build_pointer_type (basetype);
> > + if (!same_type_p (type, TREE_TYPE (instance_ptr)))
> > + instance_ptr = build_nop (type, instance_ptr);
> > + }
> > +
>
> This duplicates the code just above it; please share the code. Is the
> rationale the same as well, i.e., that this is about cv-qualification?
> (We shouldn't have any differences other than cv-qualification at this
> point, I should hope...)
Yes, they are all about CV qualifications. Done and committed as r127647.
Richard.
--
Richard Guenther <rguenther@suse.de>
Novell / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746 - GF: Markus Rex
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-08-20 12:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-26 11:53 [PATCH][C++] Type fixes for the C++ frontend Richard Guenther
2007-08-06 3:30 ` Mark Mitchell
2007-08-20 12:57 ` Richard Guenther
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).