Commit Graph

80 Commits

Author SHA1 Message Date
Eric Botcazou
e1e5852c9f decl.c (gnat_to_gnu_entity): Try to make a packable type for fields of union types as well.
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Record_Subtype>: Try to
	make a packable type for fields of union types as well.
	<is_type>: Use RECORD_OR_UNION_TYPE_P predicate.
	(gnat_to_gnu_component_type): Try to make a packable type for fields
	of union types as well.
	(make_packable_type): Use RECORD_OR_UNION_TYPE_P predicate.
	(maybe_pad_type): Try to make a packable type for fields of union types
	as well.
	(gnat_to_gnu_field): Likewise.
	(is_variable_size): Use RECORD_OR_UNION_TYPE_P predicate.
	(set_rm_size): Likewise.
	(rm_size): Likewise.
	* gcc-interface/misc.c (gnat_type_max_size): Likewise.
	* gcc-interface/trans.c (add_decl_expr): Likewise.
	* gcc-interface/utils.c (finish_record_type): Likewise.
	* gcc-interface/utils2.c (build_simple_component_ref): Likewise.

From-SVN: r180540
2011-10-26 20:45:09 +00:00
Eric Botcazou
722356ce27 trans.c (Attribute_to_gnu): Use remove_conversions.
* gcc-interface/trans.c (Attribute_to_gnu): Use remove_conversions.
	(push_range_check_info): Likewise.
	(gnat_to_gnu) <N_Code_Statement>: Likewise.
	* gcc-interface/utils2.c (build_unary_op) <INDIRECT_REF>: Likewise.
	(gnat_invariant_expr): Likewise.
	* gcc-interface/utils.c (compute_related_constant): Likewise.
	(max_size): Fix handling of SAVE_EXPR.
	(remove_conversions): Fix formatting.

From-SVN: r179873
2011-10-12 22:09:21 +00:00
Eric Botcazou
15bf7d19d4 ada-tree.h (DECL_LOOP_PARM_P): New flag.
* gcc-interface/ada-tree.h (DECL_LOOP_PARM_P): New flag.
	(DECL_INDUCTION_VAR): New macro.
	(SET_DECL_INDUCTION_VAR): Likewise.
	* gcc-interface/gigi.h (convert_to_index_type): Declare.
	(gnat_invariant_expr): Likewise.
	* gcc-interface/decl.c (gnat_to_gnu_entity) <object>: If this is a loop
	parameter, set DECL_LOOP_PARM_P on it.
	* gcc-interface/misc.c (gnat_print_decl) <VAR_DECL>: If DECL_LOOP_PARM_P
	is set, print DECL_INDUCTION_VAR instead of DECL_RENAMED_OBJECT.
	* gcc-interface/trans.c (gnu_loop_label_stack): Delete.
	(struct range_check_info_d): New type.
	(struct loop_info_d): Likewise.
	(gnu_loop_stack): New stack.
	(Identifier_to_gnu): Set TREE_READONLY flag on the first dereference
	built for a by-double-ref read-only parameter.  If DECL_LOOP_PARM_P
	is set, do not test DECL_RENAMED_OBJECT.
	(push_range_check_info): New function.
	(Loop_Statement_to_gnu): Push a new struct loop_info_d instead of just
	the label.  Reference the label and the iteration variable from it.
	Build the special induction variable in the unsigned version of the
	size type, if it is larger than the base type.  And attach it to the
	iteration variable if the latter isn't by-ref.  In the iteration scheme
	case, initialize the invariant conditions in front of the loop if
	deemed profitable.  Use gnu_loop_stack.
	(gnat_to_gnu) <N_Exit_Statement>: Use gnu_loop_stack.
	<N_Raise_Constraint_Error>: Always process the reason.  In the range
	check and related cases, and if loop unswitching is enabled, compute
	invariant conditions and push this information onto the stack.
	Do not translate again the condition if it has been already translated.
	* gcc-interface/utils.c (record_global_renaming_pointer): Assert that
	DECL_LOOP_PARM_P isn't set.
	(convert_to_index_type): New function.
	* gcc-interface/utils2.c (build_binary_op) <ARRAY_REF>: Use it in order
	to convert the index from the base index type to sizetype.
	(gnat_invariant_expr): New function.

From-SVN: r179868
2011-10-12 22:00:14 +00:00
Eric Botcazou
bdbebf669e utils2.c (build_allocator): Set TREE_THIS_NOTRAP on the dereference of the pointer to the storage area.
* gcc-interface/utils2.c (build_allocator): Set TREE_THIS_NOTRAP on the
	dereference of the pointer to the storage area.  Remove useless type
	conversions and factor out common code.

From-SVN: r179187
2011-09-26 09:21:01 +00:00
Eric Botcazou
42acad07c0 trans.c (assoc_to_constructor): Minor tweaks.
* gcc-interface/trans.c (assoc_to_constructor): Minor tweaks.
	* gcc-interface/utils2.c (build_simple_component_ref): Fix formatting
	issues.  Use COMPLETE_TYPE_P in assertion.  Also set TREE_READONLY if
	the type of the record is TYPE_READONLY.

From-SVN: r179184
2011-09-26 08:45:36 +00:00
Eric Botcazou
a1c7d7973c ada-tree.h (DECL_CAN_NEVER_BE_NULL_P): New macro.
* gcc-interface/ada-tree.h (DECL_CAN_NEVER_BE_NULL_P): New macro.
	* gcc-interface/decl.c (gnat_to_gnu_entity) <object>: Set the flag.
	(gnat_to_gnu_param): Likewise.
	* gcc-interface/utils.c (convert) <UNCONSTRAINED_ARRAY_REF>: Invoke
	maybe_unconstrained_array instead of doing the work manually.
	(maybe_unconstrained_array): Propagate the TREE_THIS_NOTRAP flag.
	* gcc-interface/utils2.c (build_unary_op) <INDIRECT_REF>: If operand
	is a DECL with the flag, set TREE_THIS_NOTRAP on the reference.
	(gnat_stabilize_reference_1): Propagate the TREE_THIS_NOTRAP flag.
	(gnat_stabilize_reference): Likewise.

From-SVN: r179182
2011-09-26 08:26:37 +00:00
Eric Botcazou
50179d5882 ada-tree.h (TYPE_NULL_BOUNDS): New macro.
* gcc-interface/ada-tree.h (TYPE_NULL_BOUNDS): New macro.
	(SET_TYPE_NULL_BOUNDS): Likewise.
	* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Array_Type>: Set again
	TREE_THIS_NOTRAP on the INDIRECT_REF node built for the template.
	* gcc-interface/trans.c (Identifier_to_gnu): Return initializers of fat
	pointer types.
	* gcc-interface/utils.c (create_var_decl_1): If the object is external,
	check that the initializer is a valid constant expression for use in
	initializing a static variable.  Add missing guard.
	(update_pointer_to): Adjust TYPE_NULL_BOUNDS if set.
	(convert_to_fat_pointer): In the null fat pointer case, build a valid
	pointer for the bounds.
	* gcc-interface/utils2.c (compare_fat_pointers): New function.
	(build_binary_op) <EQ_EXPR>: Call it to compare fat pointers.

From-SVN: r179180
2011-09-26 07:52:58 +00:00
Eric Botcazou
dee12fcd11 decl.c (gnat_to_gnu_entity): Use XNEW instead of xmalloc.
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Access_Subtype>: Use
	XNEW instead of xmalloc.  Do not build useless pointer type.
	<E_Anonymous_Access_Subprogram_Type>: Use XNEW instead of xmalloc.
	* gcc-interface/trans.c (gnat_to_gnu) <N_Raise_Constraint_Error>: Tidy.
	* gcc-interface/utils2.c (build_unary_op): Remove local variable.

From-SVN: r179168
2011-09-25 20:15:10 +00:00
Eric Botcazou
7e16989955 utils.c (maybe_unconstrained_array): In the reference to unconstrained array case, deal with each branch of a COND_EXPR.
* gcc-interface/utils.c (maybe_unconstrained_array): In the reference
	to unconstrained array case, deal with each branch of a COND_EXPR.
	* gcc-interface/utils2.c (build_allocator): Deal with each branch of
	a COND_EXPR in the initializer, if present.

From-SVN: r178766
2011-09-11 19:14:51 +00:00
Eric Botcazou
dddf8120db gigi.h (build_call_0_expr): Delete.
* gcc-interface/gigi.h (build_call_0_expr): Delete.
	(build_call_1_expr): Likewise.
	(build_call_2_expr): Likewise.
	(build_call_n_expr): New prototype.
	* gcc-interface/decl.c (gnat_to_gnu_entity): Use build_call_n_expr.
	* gcc-interface/trans.c (establish_gnat_vms_condition_handler): Ditto.
	(Handled_Sequence_Of_Statements_to_gnu): Likewise.
	(Exception_Handler_to_gnu_zcx): Likewise.
	(gnat_to_gnu): Likewise.
	(build_binary_op_trapv): Likewise.
	* gcc-interface/utils2.c (build_call_0_expr): Delete.
	(build_call_1_expr): Likewise.
	(build_call_2_expr): Likewise.
	(build_call_n_expr): New function.
	(build_call_raise): Use build_call_n_expr.
	(build_call_raise_range): Likewise.
	(build_call_raise_column): Likewise.
	(build_call_alloc_dealloc_proc): Likewise.
	(maybe_wrap_malloc): Likewise.
	(maybe_wrap_free): Likewise.

From-SVN: r178762
2011-09-11 18:33:46 +00:00
Eric Botcazou
d8e3855467 trans.c (build_return_expr): Use void_type_node for MODIFY_EXPR.
* gcc-interface/trans.c (build_return_expr): Use void_type_node for
	MODIFY_EXPR.
	* gcc-interface/utils2.c (build_binary_op) <MODIFY_EXPR>: Assert that
	the result type is null if ENABLE_CHECKING.  Set operation_type at the
	end unconditionally if not set in the previous cases.
	Use build2 and void_type_node for MODIFY_EXPR.
	(build_allocator): Use NULL_TREE for MODIFY_EXPR.

From-SVN: r178761
2011-09-11 18:28:05 +00:00
Eric Botcazou
4f1a975cc1 ada-tree.h (TYPE_EXTRA_SUBTYPE_P): Add internal check.
* gcc-interface/ada-tree.h (TYPE_EXTRA_SUBTYPE_P): Add internal check.
	* gcc-interface/utils2.c (build_binary_op): Tighten condition.
	(build_unary_op): Likewise.

From-SVN: r178335
2011-08-30 16:46:12 +00:00
Arnaud Charlet
c5ecd6b73c [multiple changes]
2011-08-29  Thomas Quinot  <quinot@adacore.com>

	* rtsfind.ads, exp_ch3.adb (In_Runtime): Minor code improvement, use
	Is_RTU instead of using Chars comparisons.

2011-08-29  Thomas Quinot  <quinot@adacore.com>

	* exp_strm.adb (Build_Mutable_Record_Read_Procedure): Do not create a
	temporary object if the actual is constrained, and the discriminants
	read from the stream don't match.

2011-08-29  Tristan Gingold  <gingold@adacore.com>

	* sem_attr.adb, exp_attr.adb: Add handling of
	Attribute_System_Allocator_Alignment
	* snames.ads-tmpl: Add Name_System_Allocator_Alignment and
	Attribute_System_Allocator_Alignment.
	* ttypes.ads, get_targ.ads: Add Get_System_Allocator_Alignment.
	* gcc-interface/targtyps.c, gcc-interface/utils2.c,
	gcc-interface/gigi.h: Renames get_target_default_allocator_alignment to
	get_target_system_allocator_alignment.

2011-08-29  Arnaud Charlet  <charlet@adacore.com>

	* gcc-interface/Makefile.in, gcc-interface/Make-lang.in: Update
	dependencies.

From-SVN: r178176
2011-08-29 11:24:55 +02:00
Eric Botcazou
4b4cfdd5e1 utils2.c (build_binary_op): Do not mark the left operand as addressable.
* gcc-interface/utils2.c (build_binary_op) <ARRAY_REF>: Do not mark the
	left operand as addressable.

From-SVN: r176713
2011-07-24 12:50:41 +00:00
Eric Botcazou
f3d3457603 gigi.h (build_function_stub): Remove.
* gcc-interface/gigi.h (build_function_stub): Remove.
	(build_return_expr): Likewise.
	(convert_vms_descriptor): Declare.
	* gcc-interface/utils.c (convert_vms_descriptor): Make global.
	(build_function_stub): Move to...
	* gcc-interface/utils2.c (build_return_expr): Move to...
	* gcc-interface/trans.c (build_function_stub): ...here.
	(build_return_expr): ...here.
	(Subprogram_Body_to_gnu): Add local variable for language_function.
	Disconnect the parameter attributes cache, if any, once done with it.
	Call end_subprog_body only after setting the end_locus.
	Build the stub associated with the function, if any, at the very end.
	(gnat_to_gnu) <N_Return_Statement>: Remove couple of useless local
	variables and streamline control flow.

From-SVN: r176712
2011-07-24 12:45:44 +00:00
Eric Botcazou
3bfc61cf25 utils2.c (gnat_stabilize_reference): Propagate TREE_THIS_NOTRAP flag.
* gcc-interface/utils2.c (gnat_stabilize_reference): Propagate
	TREE_THIS_NOTRAP flag.

From-SVN: r174693
2011-06-06 10:37:13 +00:00
Eric Botcazou
5c4a1c7b20 utils2.c (gnat_stabilize_reference): Fix thinko.
* gcc-interface/utils2.c (gnat_stabilize_reference) <COMPOUND_EXPR>:
	Fix thinko.

From-SVN: r174690
2011-06-06 10:32:11 +00:00
Eric Botcazou
805e60a086 re PR ada/48844 (ICE on assignment of aggregate with discriminated record type)
PR ada/48844
	* gcc-interface/gigi.h (get_variant_part): Declare.
	* gcc-interface/decl.c (get_variant_part): Make global.
	* gcc-interface/utils2.c (find_common_type): Do not return T1 if the
	types have the same constant size, are record types and T1 has a
	variant part while T2 doesn't.

From-SVN: r173442
2011-05-05 16:22:16 +00:00
Eric Botcazou
8ffac116df utils2.c (build_allocator): In the unconstrained array type case...
* gcc-interface/utils2.c (build_allocator): In the unconstrained array
	type case, do not strip a padding type around the array type.

From-SVN: r171888
2011-04-02 09:38:22 +00:00
Eric Botcazou
e3c4580e40 einfo.ads (Size_Depends_On_Discriminant): Adjust description.
* einfo.ads (Size_Depends_On_Discriminant): Adjust description.
	* layout.adb (Compute_Size_Depends_On_Discriminant): New procedure
	to compute Set_Size_Depends_On_Discriminant.
	(Layout_Type): Call it on array types in back-end layout mode.
	* sem_util.adb (Requires_Transient_Scope): Return true for array
	types only if the size depends on the value of discriminants.
	* gcc-interface/utils2.c (build_binary_op) <MODIFY_EXPR>: Use the RHS
	type if the RHS is a call to a function that returns an unconstrained
	type with default discriminant.

From-SVN: r171402
2011-03-24 16:08:50 +00:00
Eric Botcazou
31a5a54750 gigi.h (fill_vms_descriptor): Take GNU_TYPE instead of GNAT_FORMAL.
* gcc-interface/gigi.h (fill_vms_descriptor): Take GNU_TYPE instead of
	GNAT_FORMAL.
	* gcc-interface/utils2.c (fill_vms_descriptor): Move from here to...
	* gcc-interface/utils.c (fill_vms_descriptor): ...here.  Take GNU_TYPE
	instead of GNAT_FORMAL.  Protect the expression against multiple uses.
	Do not generate the check directly, instead instantiate the template
	check present in the descriptor.
	(make_descriptor_field): Move around.
	(build_vms_descriptor32): Build a template check in the POINTER field.
	(build_vms_descriptor): Remove useless suffixes.
	* gcc-interface/trans.c (call_to_gnu): Adjust fill_vms_descriptor call.

From-SVN: r169788
2011-02-03 13:19:38 +00:00
Ralf Wildenhues
308e6f3a18 Fix typos in gcc/ada.
gcc/ada/:
	* projects.texi: Fix typos.
	* gnat_rm.texi: Likewise.
	* gnat_ugn.texi: Likewise.
	* sem_util.adb: Fix typo in variable, typos in comments.
	* a-btgbso.adb: Fix typos in comments.
	* a-cbdlli.adb, a-cbhase.ads, a-cdlili.adb, a-cobove.adb,
	a-coinve.adb, a-convec.adb, a-direct.ads, a-strunb-shared.adb,
	a-strunb-shared.ads, a-stuten.ads, a-stwiun-shared.adb,
	a-stwiun-shared.ads, a-stzunb-shared.adb, a-stzunb-shared.ads,
	a-suenco.adb, a-suenst.adb, a-suewst.adb, a-suezst.adb, ali.ads,
	aspects.ads, atree.ads, binde.adb, bindgen.adb, checks.adb,
	checks.ads, einfo.ads, err_vars.ads, errout.adb, errout.ads,
	exp_aggr.adb, exp_attr.adb, exp_cg.adb, exp_ch3.adb,
	exp_ch4.adb, exp_ch5.adb, exp_ch6.adb, exp_ch7.adb,
	exp_dbug.ads, exp_disp.adb, exp_fixd.ads, freeze.adb,
	g-altive.ads, g-comlin.ads, g-excact.ads, g-mbdira.adb,
	g-sechas.ads, g-sehash.ads, g-sha1.ads, g-sha224.ads,
	g-sha256.ads, g-sha384.ads, g-sha512.ads, g-shsh32.ads,
	g-shsh64.ads, g-socket.adb, g-socket.ads, g-sothco.ads,
	gcc-interface/decl.c, gcc-interface/trans.c,
	gcc-interface/utils2.c, gnat1drv.adb, init.c, inline.adb,
	link.c, locales.c, make.adb, mingw32.h, namet.ads, osint.adb,
	par-ch12.adb, par-ch13.adb, par-ch3.adb, par-ch4.adb,
	par-prag.adb, par.adb, par_sco.adb, prepcomp.adb,
	prj-conf.ads, prj-dect.adb, prj-env.adb, prj-env.ads,
	prj-nmsc.adb, prj-tree.ads, prj-util.ads, prj.adb, prj.ads,
	s-auxdec-vms-alpha.adb, s-auxdec-vms_64.ads, s-oscons-tmplt.c,
	s-osinte-vxworks.ads, s-osprim-mingw.adb, s-regexp.adb,
	s-stusta.adb, s-taprop-mingw.adb, s-taprop-solaris.adb,
	scn.adb, scos.ads, sem.adb, sem_aggr.adb, sem_attr.adb,
	sem_aux.adb, sem_aux.ads, sem_ch12.adb, sem_ch12.ads,
	sem_ch13.adb, sem_ch13.ads, sem_ch3.adb, sem_ch4.adb,
	sem_ch6.adb, sem_ch7.adb, sem_ch8.adb, sem_disp.adb,
	sem_disp.ads, sem_eval.adb, sem_intr.adb, sem_prag.adb,
	sem_res.adb, sem_scil.adb, sem_util.ads, sem_warn.adb,
	sem_warn.ads, sinfo.ads, socket.c, styleg.adb, switch.ads,
	sysdep.c, tb-alvxw.c, xoscons.adb: Likewise.

From-SVN: r168082
2010-12-20 07:26:57 +00:00
Eric Botcazou
17a3480b6a re PR ada/46574 (ada bootstrap fails with --enable-build-with-cxx.)
PR ada/46574
	* gcc-interface/utils2.c (compare_elmt_bitpos): Fix typos.

From-SVN: r167207
2010-11-27 19:07:08 +00:00
Eric Botcazou
6532e8a053 trans.c (gigi): Don't set 'pure' flag on SJLJ routines.
* gcc-interface/trans.c (gigi): Don't set 'pure' flag on SJLJ routines.
	* gcc-interface/utils2.c (compare_arrays): Add LOC parameter.  Set it
	directly on all the comparison expressions.
	(build_binary_op): Pass input_location to compare_arrays.

From-SVN: r166533
2010-11-10 12:09:46 +00:00
Eric Botcazou
cfc839a4b2 trans.c (gigi): Fix formatting issues.
* gcc-interface/trans.c (gigi): Fix formatting issues.
	(build_raise_check): Likewise.
	(gnat_to_gnu): Likewise.
	* gcc-interface/utils2.c (build_call_raise_range): Likewise.
	(build_call_raise_column): Likewise.

From-SVN: r166017
2010-10-27 21:15:06 +00:00
Richard Kenner
39ab2e8fc9 utils2.c (build_compound_expr): New function.
2010-10-26  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>

	* gcc-interface/utils2.c (build_compound_expr): New function.
	* gcc-interface/gigi.h (build_compound_expr): Declare it.
	* gcc-interface/trans.c (Attribute_to_gnu, call_to_gnu): Use it.
	(gnat_to_gnu, case N_Expression_With_Actions): Likewise.

From-SVN: r165958
2010-10-26 15:06:34 +02:00
Eric Botcazou
f2be3ce484 utils2.c: Include flags.h and remove prototypes.
* gcc-interface/utils2.c: Include flags.h and remove prototypes.
	(build_unary_op) <TRUTH_NOT_EXPR>: When not optimizing, fold the result
	of the call to invert_truthvalue_loc.
	* gcc-interface/Make-lang.in (utils2.o): Add $(FLAGS_H).

From-SVN: r165928
2010-10-25 19:29:10 +00:00
Arnaud Charlet
437f8c1ebe [multiple changes]
2010-10-19  Robert Dewar  <dewar@adacore.com>

	* sem_eval.adb: Minor reformatting.

2010-10-19  Tristan Gingold  <gingold@adacore.com>

	* exp_ch4.adb (Expand_N_And_Op, Expand_N_Or_Op, Expand_N_Xor_Op): Call
	Expand_Intrinsic_Call if the function is intrinsic.
	* exp_intr_adb (Expand_Binary_Operator): Handle VMS case for logical
	binary operator on the unsigned_quadword record.
	* exp_intr.ads (Expand_Intrinsic_Call): Update comments.

2010-10-19  Geert Bosch  <bosch@adacore.com>

	* gnat_rm.texi (pragma Float_Representation): Fix typo.

2010-10-19  Arnaud Charlet  <charlet@adacore.com>

	* switch-c.adb (Scan_Front_End_Switches): Add handling of -gnateE.
	* fe.h (Exception_Extra_Info): Declare.
	* usage.adb (usage): Add -gnateE doc.
	* checks.adb (Install_Null_Excluding_Check): Use better sloc.
	* sem_util.adb (Insert_Explicit_Dereference): Ditto.
	* gnat_ugn.texi: Document -gnateE switch.
	* a-except.adb (Set_Exception_C_Msg): New parameter Column.
	* a-except-2005.adb (Set_Exception_C_Msg): New parameter Column.
	(Raise_Constraint_Error_Msg): Ditto.
	(Image): New helper function.
	(Rcheck_00_Ext, Rcheck_05_Ext, Rcheck_12_Ext): New procedure with more
	detailed exception information.
	Adjust calls to Set_Exception_C_Msg and Raise_Constraint_Error_Msg.
	* a-exexda.adb (Set_Exception_C_Msg): New parameter Column.
	* opt.ads (Exception_Extra_Info): New flag.
	* gcc-interface/utils.c (gnat_raise_decls_ext): New.
	* gcc-interface/utils2.c (build_call_raise_range,
	build_call_raise_column): New functions.
	* gcc-interface/gigi.h (exception_info_kind, gnat_raise_decls_ext,
	build_call_raise_range, build_call_raise_column): Declare.
	gcc-interface/trans.c (build_raise_check): New function.
	(gigi): Initialize gnat_raise_decls_ext.
	(gnat_to_gnu): Add initial support for -gnateE switch.
	* gcc-interface/Make-lang.in: Update dependencies.

From-SVN: r165696
2010-10-19 12:54:58 +02:00
Eric Botcazou
a61c3633ec sched-deps.c (sched_insn_is_legitimate_for_speculation): Invoke may_trap_or_fault_p instead of may_trap_p predicate.
* sched-deps.c (sched_insn_is_legitimate_for_speculation): Invoke
	may_trap_or_fault_p instead of may_trap_p predicate.
	* tree.c (substitute_in_expr): Propagate the TREE_THIS_NOTRAP flag.
	(substitute_placeholder_in_expr): Likewise.
	* tree-inline.c (remap_gimple_op_r): Propagate the TREE_THIS_NOTRAP
	flag on MEM_REF nodes.
	(copy_tree_body_r): Propagate the TREE_READONLY and TREE_THIS_NOTRAP
	flags on INDIRECT_REF nodes.
ada/
	* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Array_Type>: Set
	TREE_THIS_NOTRAP on the INDIRECT_REF node built for the template.
	* gcc-interface/trans.c (Identifier_to_gnu): Set TREE_THIS_NOTRAP on
	the INDIRECT_REF node built for objects used by reference.
	* gcc-interface/utils2.c (build_binary_op): Add short-circuit for
	constant result. Set TREE_THIS_NOTRAP on ARRAY_REF and ARRAY_RANGE_REF.
	(gnat_stabilize_reference_1): Propagate the TREE_THIS_NOTRAP flag.

From-SVN: r165468
2010-10-14 13:39:18 +00:00
Nathan Froyd
5095da95bd vec.h (VEC_qsort): Define.
gcc/
	* vec.h (VEC_qsort): Define.
	* dbxout.c (output_used_types): Use it.
	* df-scan.c (df_sort_and_compress_refs): Likewise.
	(df_sort_and_compress_mws): Likewise.
	* genautomata.c (uniq_sort_alt_states): Likewise.
	(evaluate_equiv_classes): Likewise.
	(output_trans_table): Likewise.
	(output_state): Likewise.
	* gimplify.c (compare_case_labels): Likewise.
	* graphite-sese-to-poly.c (graphite_sort_dominated_info): Likewise.
	* ipa.c (build_cdtor_fns): Likewise.
	* lto.c (lto_wpa_write_files): Likewise.
	* sel-sched.c (fill_vec_av_set): Likewise.
	* tree-predcom.c (determine_roots_comp): Likewise.
	* tree-sra.c (sort_and_spliace_var_accesses): Likewise.
	(splice_param_accesses): Likewise.
	* tree-ssa-live.c (dump_enumerated_decls): Likewise.
	* tree-ssa-reassoc.c (undistribute_ops_list): Likewise.
	(reassociate_bb): Likewise.
	* tree-ssa-sccvn.c (sort_scc): Likewise.
	* tree-ssa-structalias.c (sort_fieldstack): Likewise.

gcc/ada/
	* gcc-interface/utils2.c (gnat_build_constructor): Use VEC_qsort.

From-SVN: r165314
2010-10-11 15:08:28 +00:00
Tristan Gingold
9c8e862b2e utils2.c (maybe_wrap_malloc): Fix crash when allocating very large object on VMS.
2010-10-11  Tristan Gingold  <gingold@adacore.com>

	* gcc-interface/utils2.c (maybe_wrap_malloc): Fix crash when allocating
	very large object on VMS.

From-SVN: r165288
2010-10-11 11:49:37 +02:00
Eric Botcazou
658a41acf0 trans.c (gnat_to_gnu): Use invert_truthvalue_loc instead of invert_truthvalue.
* gcc-interface/trans.c (gnat_to_gnu) <N_Not_In>: Use
	invert_truthvalue_loc instead of invert_truthvalue.
	* gcc-interface/utils2.c (build_binary_op) <NE_EXPR>: Likewise.
	(build_unary_op) <TRUTH_NOT_EXPR>: Likewise.

From-SVN: r165253
2010-10-10 12:29:16 +00:00
Eric Botcazou
50a6af053a decl.c (gnat_to_gnu_entity): Look into expressions for external constants that are aggregates.
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Constant>: Look into
	expressions for external constants that are aggregates.
	* gcc-interface/utils2.c (build_simple_component_ref): If the field
	is an inherited component in an extension, look through the extension.

From-SVN: r164414
2010-09-19 13:12:13 +00:00
Nathan Froyd
910ad8dee5 tree.h (DECL_CHAIN): Define.
gcc/
	* tree.h (DECL_CHAIN): Define.
	* alias.c: Carefully replace TREE_CHAIN with DECL_CHAIN.
	* c-decl.c: Likewise.
	* c-parser.c: Likewise.
	* c-typeck.c: Likewise.
	* cfgexpand.c: Likewise.
	* cgraph.c: Likewise.
	* cgraphunit.c: Likewise.
	* combine.c: Likewise.
	* config/alpha/alpha.c: Likewise.
	* config/arm/arm.c: Likewise.
	* config/frv/frv.c: Likewise.
	* config/i386/i386.c: Likewise.
	* config/i386/winnt-cxx.c: Likewise.
	* config/ia64/ia64.c: Likewise.
	* config/iq2000/iq2000.c: Likewise.
	* config/mep/mep.c: Likewise.
	* config/mips/mips.c: Likewise.
	* config/pa/som.h: Likewise.
	* config/rs6000/rs6000.c: Likewise.
	* config/s390/s390.c: Likewise.
	* config/sh/sh.c: Likewise.
	* config/sh/symbian-cxx.c: Likewise.
	* config/sparc/sparc.c: Likewise.
	* config/spu/spu.c: Likewise.
	* config/stormy16/stormy16.c: Likewise.
	* config/vxworks.c: Likewise.
	* config/xtensa/xtensa.c: Likewise.
	* coverage.c: Likewise.
	* dbxout.c: Likewise.
	* dwarf2out.c: Likewise.
	* emit-rtl.c: Likewise.
	* expr.c: Likewise.
	* function.c: Likewise.
	* gimple-low.c: Likewise.
	* gimple-pretty-print.c: Likewise.
	* gimplify.c: Likewise.
	* integrate.c: Likewise.
	* ipa-inline.c: Likewise.
	* ipa-prop.c: Likewise.
	* ipa-split.c: Likewise.
	* ipa-struct-reorg.c: Likewise.
	* ipa-type-escape.c: Likewise.
	* langhooks.c: Likewise.
	* lto-cgraph.c: Likewise.
	* omp-low.c: Likewise.
	* stor-layout.c: Likewise.
	* tree-cfg.c: Likewise.
	* tree-complex.c: Likewise.
	* tree-dfa.c: Likewise.
	* tree-dump.c: Likewise.
	* tree-inline.c: Likewise.
	* tree-mudflap.c: Likewise.
	* tree-nested.c: Likewise.
	* tree-object-size.c: Likewise.
	* tree-pretty-print.c: Likewise.
	* tree-sra.c: Likewise.
	* tree-ssa-live.c: Likewise.
	* tree-ssa-loop-niter.c: Likewise.
	* tree-ssa-math-opts.c: Likewise.
	* tree-ssa-reassoc.c: Likewise.
	* tree-ssa-sccvn.c: Likewise.
	* tree-ssa-structalias.c: Likewise.
	* tree-tailcall.c: Likewise.
	* tree-vrp.c: Likewise.
	* tree.c: Likewise.
	* var-tracking.c: Likewise.
	* varasm.c: Likewise.

gcc/ada/
	* gcc-interface/decl.c: Carefully replace TREE_CHAIN with DECL_CHAIN.
	* gcc-interface/trans.c: Likewise.
	* gcc-interface/utils.c: Likewise.
	* gcc-interface/utils2.c: Likewise.

gcc/c-family/
	* c-common.c: Carefully replace TREE_CHAIN with DECL_CHAIN.
	* c-format.c: Likewise.

gcc/cp/
	* cp-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN.
	* call.c: Likewise.
	* class.c: Likewise.
	* cp-gimplify.c: Likewise.
	* decl.c: Likewise.
	* decl2.c: Likewise.
	* init.c: Likewise.
	* mangle.c: Likewise.
	* name-lookup.c: Likewise.
	* optimize.c: Likewise.
	* parser.c: Likewise.
	* pt.c: Likewise.
	* rtti.c: Likewise.
	* search.c: Likewise.
	* semantics.c: Likewise.
	* typeck.c: Likewise.
	* typeck2.c: Likewise.

gcc/fortran/
	* f95-lang.c: Carefully replace TREE_CHAIN with DECL_CHAIN.
	* trans-common.c: Likewise.
	* trans-decl.c: Likewise.
	* trans-types.c: Likewise.
	* trans.c: Likewise.

gcc/java/
	* java-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN.
	* boehm.c: Likewise.
	* class.c: Likewise.
	* decl.c: Likewise.
	* expr.c: Likewise.
	* jcf-parse.c: Likewise.
	* typeck.c: Likewise.
	* verify-glue.c: Likewise.

gcc/objc/
	* objc-act.c: Carefully replace TREE_CHAIN with DECL_CHAIN.

gcc/testsuite/
	* g++.dg/plugin/attribute_plugin.c: Carefully replace TREE_CHAIN
	with DECL_CHAIN.

From-SVN: r162223
2010-07-15 14:31:28 +00:00
Nathan Froyd
0e228dd907 gigi.h (gnat_build_constructor): Take a VEC instead of a TREE_LIST.
* gcc-interface/gigi.h (gnat_build_constructor): Take a VEC instead
	of a TREE_LIST.  Update comment.
	* gcc-interface/trans.c (gigi): Build a VEC instead of a TREE_LIST.
	Adjust call to gnat_build_constructor.
	(Attribute_to_gnu): Likewise.
	(gnat_to_gnu): Likewise.
	(pos_to_constructor): Likewise.
	(extract_values): Likewise.
	* gcc-interface/utils.c (build_template): Likewise.
	(convert_vms_descriptor64): Likewise.
	(convert_vms_descriptor32): Likewise.
	(convert_to_fat_pointer): Likewise.
	(convert): Likewise.
	(unchecked_convert): Likewise.
	* gcc-interface/decl.c (gnat_to_gnu_entity): Likewise.
	* gcc-interface/utils2.c (build_allocator): Likewise.
	(fill_vms_descriptor): Likewise.
	(gnat_build_constructor): Take a VEC instead of a TREE_LIST.
	(compare_elmt_bitpos): Adjust for parameters being constructor_elts
	instead of TREE_LISTs.

From-SVN: r161529
2010-06-29 12:21:37 +00:00
Arnaud Charlet
5b9c3fc489 [multiple changes]
2010-06-23  Robert Dewar  <dewar@adacore.com>

	* sem_ch6.adb: Minor reformatting.

2010-06-23  Doug Rupp  <rupp@adacore.com>

	* bindusg.adb (Display): Write -Hnn line.
	* bindgen.adb (Gen_Adainit_Ada): Write Heap_Size to binder file as 
	necessary.
	* init.c (__gl_heap_size): Rename from __gl_no_malloc_64 and change
	valid values to 32 and 64.
	(GNAT$NO_MALLOC_64): Recognize TRUE, 1, FALSE, and 0 in addition to
	ENABLE, DISABLE as valid settings.
	* switch-b.adb (Scan_Binder_Switches): Process -Hnn switch.
	* opt.ads (Heap_Size): New global variable.
	* gcc-interface/utils2.c (maybe_wrap_malloc): Remove mostly redundant 
	TARGET_MALLOC64 check. Fix comment.

From-SVN: r161243
2010-06-23 07:48:28 +02:00
Steven Bosscher
9b4690892c utils.c: Do not include function.h, pointer-set.h, and gimple.h.
* gcc-interface/utils.c: Do not include function.h, pointer-set.h,
	and gimple.h.  Explain why rtl.h has to be included.
	(handle_vector_size_attribute): Call reconstruct_complex_type directly.
	* gcc-interface/targtyps.c: Do not include tm_p.h
	* gcc-interface/utils2.c: Do not include flags.h.
	* gcc-interface/trans.c: Do not include expr.h.  Include rtl.h instead,
	and explain why it has to be included.
	* gcc-interface/misc.c: Do not include expr.h, libfuncs.h, cgraph.h,
	and optabs.h.
	Include function.h and explain why.  Explain why except.h is included.
	(enumerate_modes): Remove unused function. 
	* gcc-interface/gigi.h (enumerate_modes): Remove prototype.
	* gcc-interface/Make-lang.in: Update dependencies.

From-SVN: r159844
2010-05-25 21:07:40 +00:00
Eric Botcazou
928dfa4bd0 gigi.h (build_unc_object_type): Add DEBUG_INFO_P param.
* gcc-interface/gigi.h (build_unc_object_type): Add DEBUG_INFO_P param.
	(build_unc_object_type_from_ptr): Likewise.
	* gcc-interface/utils.c (build_unc_object_type): Add DEBUG_INFO_P param
	and pass it to create_type_decl.  Declare the type.  Simplify.
	(build_unc_object_type_from_ptr): Add DEBUG_INFO_P parameter and pass
	it to build_unc_object_type.
	* gcc-interface/decl.c (gnat_to_gnu_entity): Adjust to above change.
	* gcc-interface/trans.c (Attribute_to_gnu): Likewise.
	(gnat_to_gnu): Likewise.
	* gcc-interface/utils2.c (build_allocator): Likewise.

From-SVN: r159180
2010-05-08 11:02:08 +00:00
Eric Botcazou
f5631ae690 utils2.c (build_unary_op): Do not issue warning.
* gcc-interface/utils2.c (build_unary_op) <ATTR_ADDR_EXPR>: Do not
	issue warning.

From-SVN: r158469
2010-04-17 14:53:08 +00:00
Eric Botcazou
728936bb92 uintp.h (UI_Lt): Declare.
* uintp.h (UI_Lt): Declare.
	* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Array_Type>: Do the size
	computation in sizetype.
	<E_Array_Subtype>: Use unified handling for all index types.  Do not
	generate MAX_EXPR-based expressions, only COND_EXPR-based ones.  Add
	bypass for PATs.
	(annotate_value): Change test for negative values.
	(validate_size): Apply test for negative values on GNAT nodes.
	(set_rm_size): Likewise.
	* gcc-interface/misc.c (gnat_init): Set unsigned types for sizetypes.
	* gcc-interface/utils.c (rest_of_record_type_compilation): Change test
	for negative values.
	(max_size) <MINUS_EXPR>: Do not reassociate a COND_EXPR on the LHS.
	(builtin_type_for_size): Adjust definition of signed_size_type_node.
	* gcc-interface/utils2.c (compare_arrays): Optimize comparison of
	lengths against zero.

From-SVN: r158466
2010-04-17 14:16:36 +00:00
Eric Botcazou
6936c61a5c back-end.adb (Call_Back_End): Pass Standard_Character to gigi.
* back-end.adb (Call_Back_End): Pass Standard_Character to gigi.
	* gcc-interface/gigi.h (gigi): Add standard_character parameter.
	(CHAR_TYPE_SIZE, SHORT_TYPE_SIZE, INT_TYPE_SIZE, LONG_TYPE_SIZE, 
	LONG_LONG_TYPE_SIZE, FLOAT_TYPE_SIZE, DOUBLE_TYPE_SIZE,
	LONG_DOUBLE_TYPE_SIZE, SIZE_TYPE): Delete.
	* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Array_Subtype>: Call
	rm_size.
	* gcc-interface/misc.c (gnat_init): Set signedness of char as per
	flag_signed_char.  Tag sizetype with "size_type" moniker.
	* gcc-interface/trans.c (gigi): Add standard_character parameter.
	Remove useless built-in types.  Equate unsigned_char_type_node to
	Standard.Character.  Use it instead of char_type_node throughout.
	(Attribute_to_gnu): Likewise.
	(gnat_to_gnu): Likewise.
	* gcc-interface/utils2.c (build_call_raise): Likewise.

From-SVN: r158462
2010-04-17 08:24:16 +00:00
Eric Botcazou
1081f5a7c7 gigi.h (enum standard_datatypes): Add new values ADT_sbitsize_one_node and ADT_sbitsize_unit_node.
* gcc-interface/gigi.h (enum standard_datatypes): Add new values
	ADT_sbitsize_one_node and ADT_sbitsize_unit_node.
	(sbitsize_one_node): New macro.
	(sbitsize_unit_node): Likewise.
	* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Array_Subtype>: Fix
	latent bug in the computation of subrange_p.  Fold wider_p predicate.
	(cannot_be_superflat_p): Use an explicitly signed 64-bit type to do
	the final comparison.
	(make_aligning_type): Build real negation and use sizetype throughout
	the offset computation.
	(maybe_pad_type): Do not issue the warning when the new size expression
	is too complex.
	(annotate_value) <INTEGER_CST>: Simplify code handling negative values.
	* gcc-interface/misc.c (gnat_init): Initialize sbitsize_one_node and
	sbitsize_unit_node.
	* gcc-interface/trans.c (Attribute_to_gnu) <Attr_Pool_Address>: Fold
	double negation.
	(gnat_to_gnu) <N_Free_Statement>: Likewise.
	* gcc-interface/utils.c (convert): Use sbitsize_unit_node.
	* gcc-interface/utils2.c (compare_arrays): Compute real lengths and use
	constants in sizetype.  Remove dead code and tweak comments.  Generate
	equality instead of inequality comparisons for zero length tests.

From-SVN: r158461
2010-04-17 08:14:08 +00:00
Eric Botcazou
1139f2e89d decl.c (gnat_to_gnu_entity): Use boolean_type_node in lieu of integer_type_node for boolean operations.
* gcc-interface/decl.c (gnat_to_gnu_entity): Use boolean_type_node in
	lieu of integer_type_node for boolean operations.
	(choices_to_gnu): Likewise.
	* gcc-interface/trans.c (Attribute_to_gnu): Likewise.
	(Loop_Statement_to_gnu): Likewise.
	(establish_gnat_vms_condition_handler): Likewise.
	(Exception_Handler_to_gnu_sjlj): Likewise.
	(gnat_to_gnu): Likewise.
	(build_unary_op_trapv): Likewise.
	(build_binary_op_trapv): Likewise.
	(emit_range_check): Likewise.
	(emit_index_check): Likewise.
	(convert_with_check): Likewise.
	* gcc-interface/utils.c (convert_vms_descriptor64): Likewise.
	(convert_vms_descriptor32): Likewise.
	(convert_vms_descriptor): Likewise.
	* gcc-interface/utils2.c (nonbinary_modular_operation): Likewise.
	(compare_arrays): Use boolean instead of integer constants.
	(build_binary_op) <TRUTH_ANDIF_EXPR, TRUTH_ORIF_EXPR, TRUTH_AND_EXPR,
	TRUTH_OR_EXPR, TRUTH_XOR_EXPR>: New case.  Check that the result type
	is a boolean type.
	<GE_EXPR, LE_EXPR, GT_EXPR, LT_EXPR>: Remove obsolete assertion.
	<EQ_EXPR, NE_EXPR>: Check that the result type is a boolean type.
	<PREINC/PREDECREMENT_EXPR, POSTINC/POSTDECREMENT_EXPR>: Delete.
	<TRUTH_NOT_EXPR>: Check that the result type is a boolean type.
	(build_unary_op): Use boolean_type_node in lieu of integer_type_node
	for boolean operations.
	(fill_vms_descriptor): Likewise.  Fix formatting nits.

From-SVN: r158411
2010-04-16 12:07:02 +00:00
Eric Botcazou
58c8f7700a cuintp.c (UI_To_gnu): Fix long line.
* gcc-interface/cuintp.c (UI_To_gnu): Fix long line.
	* gcc-interface/gigi.h (MARK_VISITED): Skip objects of constant class.
	(process_attributes): Delete.
	(post_error_ne_num): Change parameter name.
	* gcc-interface/decl.c (gnat_to_gnu_entity): Do not force debug info
	with -g3.  Remove a couple of obsolete lines.  Minor tweaks.
	If type annotating mode, operate on trees to compute the adjustment to
	the sizes of tagged types.  Fix long line.
	(cannot_be_superflat_p): Tweak head comment.
	(annotate_value): Fold local constant.
	(set_rm_size): Fix long line.
	* gcc-interface/trans.c (Identifier_to_gnu): Rework comments.
	(Attribute_to_gnu): Fix long line.
	<Attr_Size>: Remove useless assertion.
	Reorder statements.  Use size_binop routine.
	(Loop_Statement_to_gnu): Use build5 in lieu of build_nt.
	Create local variables for the label and the test.  Tweak comments.
	(Subprogram_Body_to_gnu): Reset cfun to NULL.
	(Compilation_Unit_to_gnu): Use the Sloc of the Unit node.
	(process_inlined_subprograms): Integrate into...
	(Compilation_Unit_to_gnu): ...this.
	(gnat_to_gnu): Fix long line.
	(post_error_ne_num): Change parameter name.
	* gcc-interface/utils.c (process_attributes): Static-ify.
	<ATTR_MACHINE_ATTRIBUTE>: Set input_location before proceeding.
	(create_type_decl): Add comment.
	(create_var_decl_1): Process the attributes after adding the VAR_DECL
	to the current binding level.
	(create_subprog_decl): Likewise for the FUNCTION_DECL.
	(end_subprog_body): Do not reset cfun to NULL.
	(build_vms_descriptor32): Fix long line.
	(build_vms_descriptor): Likewise.
	(handle_nonnull_attribute): Likewise.
	(convert_vms_descriptor64): Likewise.
	* gcc-interface/utils2.c (fill_vms_descriptor): Fix long line.
	(gnat_protect_expr): Fix thinko.

From-SVN: r158390
2010-04-15 21:15:47 +00:00
Eric Botcazou
1fc24649bc trans.c (gigi): Set DECL_IGNORED_P on EH functions.
* gcc-interface/trans.c (gigi): Set DECL_IGNORED_P on EH functions.
	(gnat_to_gnu) <N_Op_Eq>: Restore the value of input_location
	before translating the top-level node.
	(lvalue_required_p) <N_Function_Call>: Return 1 if !constant.
	<N_Object_Declaration>: Likewise.
	<N_Assignment_Statement>: Likewise.
	<N_Unchecked_Type_Conversion>: Likewise.
	(call_to_gnu): Remove kludge.
	(gnat_to_gnu) <N_Return_Statement>: When not optimizing, force labels
	associated with user returns to be preserved.
	(gnat_to_gnu): Add special code to deal with boolean rvalues.
	* gcc-interface/utils2.c (compare_arrays): Set input_location on all
	comparisons.
	(build_unary_op) <ADDR_EXPR>: Call build_fold_addr_expr.
	<INDIRECT_REF>: Call build_fold_indirect_ref.

From-SVN: r158388
2010-04-15 20:21:08 +00:00
Eric Botcazou
0b3467c4a3 trans.c (call_to_gnu): Open a nesting level if this is a statement.
* gcc-interface/trans.c (call_to_gnu): Open a nesting level if this is
	a statement.  Otherwise, if at top-level, push the processing of the
	elaboration routine.  In the misaligned case, issue the error messages
	again on entry and create the temporary explicitly.  Do not issue them
	for CONSTRUCTORs.
	For a function call, emit the range check if necessary.
	In the copy-in copy-out case, create the temporary for the return
	value explicitly.
	Do not unnecessarily convert by-ref parameters to the formal's type.
	Remove obsolete guards in conditions.
	(gnat_to_gnu) <N_Assignment_Statement>: For a function call, pass the
	target to call_to_gnu in all cases.
	(gnat_gimplify_expr) <ADDR_EXPR>: Remove handling of SAVE_EXPR.
	(addressable_p) <CONSTRUCTOR>: Return false if not static.
	<COMPOUND_EXPR>: New case.
	* gcc-interface/utils2.c (build_unary_op) <ADDR_EXPR>: Fold a compound
	expression if it has unconstrained array type.
	(gnat_mark_addressable) <COMPOUND_EXPR>: New case.
	(gnat_stabilize_reference) <COMPOUND_EXPR>: Stabilize operands on an
	individual basis.

From-SVN: r158371
2010-04-15 12:40:15 +00:00
Eric Botcazou
cb3d597d15 gimple.c (walk_gimple_op): Do not request a pure rvalue on the RHS if the LHS is of a non-renamable type.
* gimple.c (walk_gimple_op) <GIMPLE_ASSIGN>: Do not request a pure
	rvalue on the RHS if the LHS is of a non-renamable type.
	* tree-ssa-ccp.c (maybe_fold_offset_to_component_ref): Fold result.
ada/
	* gcc-interface/ada-tree.h (TYPE_BY_REFERENCE_P): Delete.
	(DECL_CONST_ADDRESS_P): New macro.
	(SET_DECL_ORIGINAL_FIELD_TO_FIELD): Likewise.
	(SAME_FIELD_P): Likewise.
	* gcc-interface/decl.c (constructor_address_p): New static function.
	(gnat_to_gnu_entity) <object>: Set DECL_CONST_ADDRESS_P according to
	the return value of above function.
	(gnat_to_gnu_entity) <E_Record_Type>: Force BLKmode for all types
	passed by reference.
	<E_Record_Subtype>: Likewise.
	Set TREE_ADDRESSABLE on the type if it passed by reference.
	(make_packable_type): Use SET_DECL_ORIGINAL_FIELD_TO_FIELD.
	(create_field_decl_from): Likewise.
	(substitute_in_type): Likewise.
	(purpose_member_field): Use SAME_FIELD_P.
	* gcc-interface/misc.c (must_pass_by_ref): Test TREE_ADDRESSABLE.
	* gcc-interface/trans.c (lvalue_required_p): Add ADDRESS_OF_CONSTANT
	parameter and adjust recursive calls.
	<N_Explicit_Dereference>: New case.
	<N_Object_Declaration>: Return 1 if the object is of a class-wide type.
	Adjust calls to lvalue_required_p.  Do not return the initializer of a
	DECL_CONST_ADDRESS_P constant if an lvalue is required for it.
	(call_to_gnu): Delay issuing error message for a misaligned actual and
	avoid the associated back-end assertion.  Test TREE_ADDRESSABLE.
	(gnat_gimplify_expr) <ADDR_EXPR>: Handle non-static constructors.
	* gcc-interface/utils.c (make_dummy_type): Set TREE_ADDRESSABLE if the
	type is passed by reference.
	(convert) <CONSTRUCTOR>: Convert in-place in more cases.
	* gcc-interface/utils2.c (build_cond_expr): Drop TYPE_BY_REFERENCE_P.
	(build_simple_component_ref): Use SAME_FIELD_P.

From-SVN: r158254
2010-04-13 07:08:24 +00:00
Eric Botcazou
3cd64bab88 trans.c (lvalue_required_for_attribute_p): New static function.
* gcc-interface/trans.c (lvalue_required_for_attribute_p): New static
	function.
	(lvalue_required_p) <N_Attribute_Reference>: Call it.
	(gnat_to_gnu) <N_Selected_Component>: Prevent build_component_ref from
	folding the result only if lvalue_required_for_attribute_p is true.
	* gcc-interface/utils.c (maybe_unconstrained_array): Pass correctly
	typed constant to build_component_ref.
	(unchecked_convert): Likewise.
	* gcc-interface/utils2.c (maybe_wrap_malloc): Likewise.
	(build_allocator): Likewise.

From-SVN: r158202
2010-04-11 11:49:22 +00:00
Eric Botcazou
87fa3d342b utils2.c (build_cond_expr): Take the address and dereference if the result type is passed by reference.
* gcc-interface/utils2.c (build_cond_expr): Take the address and
	dereference if the result type is passed by reference.

From-SVN: r158201
2010-04-11 11:23:32 +00:00
Eric Botcazou
7d7a1fe859 gigi.h (maybe_variable): Delete.
* gcc-interface/gigi.h (maybe_variable): Delete.
	(protect_multiple_eval): Likewise.
	(maybe_stabilize_reference): Likewise.
	(gnat_save_expr): Declare.
	(gnat_protect_expr): Likewise.
	(gnat_stabilize_reference): Likewise.
	* gcc-interface/decl.c (gnat_to_gnu_entity) <object>: Use
	gnat_stabilize_reference.
	(maybe_variable): Delete.
	(elaborate_expression_1): Use gnat_save_expr.
	* gcc-interface/trans.c (Attribute_to_gnu): Use gnat_protect_expr.
	(call_to_gnu): Pass NULL to gnat_stabilize_reference.
	(gnat_to_gnu) <N_Object_Declaration>: Use gnat_save_expr.
	<N_Slice>: Use gnat_protect_exp.
	<N_Selected_Component>: Pass NULL to gnat_stabilize_reference.
	<N_In>: Use gnat_protect_expr.
	Pass NULL to gnat_stabilize_reference.
	(build_unary_op_trapv): Use gnat_protect_expr.
	(build_binary_op_trapv): Likewise.
	(emit_range_check): Likewise.
	(emit_index_check): Likewise.
	(convert_with_check): Likewise.
	(protect_multiple_eval): Move to utils2.c file.
	(maybe_stabilize_reference): Merge into...
	(gnat_stabilize_reference): ...this.  Move to utils2.c file.
	(gnat_stabilize_reference_1): Likewise.
	* gcc-interface/utils.c (convert_to_fat_pointer): Use gnat_protect_expr
	instead of protect_multiple_eval.
	* gcc-interface/utils2.c (compare_arrays): Likewise.
	(nonbinary_modular_operation): Likewise.
	(maybe_wrap_malloc): Likewise.
	(build_allocator): Likewise.
	(gnat_save_expr): New function.
	(gnat_protect_expr): Rename from protect_multiple_eval.  Early return
	in common cases.  Propagate TREE_READONLY onto dereferences.
	(gnat_stabilize_reference_1): Move from trans.c file.
	(gnat_stabilize_reference): Likewise.

From-SVN: r158159
2010-04-09 10:49:46 +00:00