Commit Graph

39 Commits

Author SHA1 Message Date
Jakub Jelinek 35228ac722 flag-types.h (enum sanitize_code): Add SANITIZE_VPTR, include SANITIZE_VPTR in SANITIZE_UNDEFINED.
* flag-types.h (enum sanitize_code): Add SANITIZE_VPTR,
	include SANITIZE_VPTR in SANITIZE_UNDEFINED.
	* opts.c (common_handle_option): Add -fsanitize=vptr.
	* sanitizer.def (BUILT_IN_UBSAN_HANDLE_DYNAMIC_TYPE_CACHE_MISS,
	BUILT_IN_UBSAN_HANDLE_DYNAMIC_TYPE_CACHE_MISS_ABORT): New.
	* ubsan.h (enum ubsan_null_ckind): Add UBSAN_DOWNCAST_POINTER,
	UBSAN_DOWNCAST_REFERENCE, UBSAN_UPCAST and UBSAN_CAST_TO_VBASE.
	(ubsan_expand_vptr_ifn): New prototype.
	* internal-fn.c (expand_ANNOTATE, expand_GOMP_SIMD_LANE,
	expand_GOMP_SIMD_VF, expand_GOMP_SIMD_LAST_LANE, expand_UBSAN_NULL,
	expand_UBSAN_BOUNDS, expand_UBSAN_OBJECT_SIZE, expand_ASAN_CHECK,
	expand_LOOP_VECTORIZED): Make argument nameless, remove
	ATTRIBUTE_UNUSED.
	(expand_UBSAN_VPTR): New function.
	* internal-fn.def (UBSAN_NULL, ASAN_CHECK): Use R instead of W
	in fn spec.
	(UBSAN_VPTR): New internal function.
	* sanopt.c (tree_map_traits): Renamed to ...
	(sanopt_tree_map_traits): ... this.
	(sanopt_tree_triplet, sanopt_tree_triplet_map_traits): New classes.
	(sanopt_ctx): Adjust asan_check_map type for tree_map_traits
	to sanopt_tree_map_traits renaming.  Add vptr_check_map field.
	(maybe_optimize_ubsan_vptr_ifn): New function.
	(sanopt_optimize_walker): Handle IFN_UBSAN_VPTR.
	(pass_sanopt::execute): Likewise.  Call sanopt_optimize even for
	-fsanitize=vptr.
	* tree-ssa-alias.c (call_may_clobber_ref_p_1): Handle certain
	internal calls like pure functions for aliasing, even when they
	have other side-effects that prevent making them ECF_PURE.
	* ubsan.c (ubsan_vptr_type_cache_decl): New variable.
	(ubsan_expand_vptr_ifn): New function.
cp/
	* cp-gimplify.c (cp_genericize_r): Call
	cp_ubsan_maybe_instrument_member_call for member calls.
	(cp_ubsan_check_member_access_r): New function.
	(cp_genericize_tree): Call cp_ubsan_instrument_member_accesses.
	* cp-tree.h (cp_ubsan_maybe_instrument_member_call,
	cp_ubsan_instrument_member_accesses,
	cp_ubsan_maybe_instrument_downcast,
	cp_ubsan_maybe_instrument_cast_to_vbase): New prototypes.
	* cp-ubsan.c: New file.
	* Make-lang.in (CXX_AND_OBJCXX_OBJS): Add cp/cp-ubsan.o.
	* constexpr.c (cxx_eval_call_expression): Return void_node
	for IFN_UBSAN_VPTR.
	(potential_constant_expression_1): Return true for
	UBSAN_NULL, UBSAN_BOUNDS and UBSAN_VPTR internal calls.
	* typeck.c (build_class_member_access_expr): Provide locus
	for COMPONENT_REFs.
	(build_static_cast_1): Instrument downcasts.
	* class.c (build_base_path): For -fsanitize=vptr and !fixed_type_p
	add ubsan instrumentation for virtual_access.
	* call.c: Include internal-fn.h.
	(set_flags_from_callee): Handle internal calls.
gcc/testsuite/
	* g++.dg/ubsan/vptr-1.C: New test.
	* g++.dg/ubsan/vptr-2.C: New test.
	* g++.dg/ubsan/vptr-3.C: New test.
	* g++.dg/ubsan/vptr-4.C: New test.
	* g++.dg/ubsan/vptr-5.C: New test.
	* g++.dg/ubsan/vptr-6.C: New test.
	* g++.dg/ubsan/vptr-7.C: New test.
	* g++.dg/ubsan/vptr-8.C: New test.
	* g++.dg/ubsan/vptr-9.C: New test.

From-SVN: r219695
2015-01-15 23:58:42 +01:00
Jakub Jelinek 5624e564d2 Update copyright years.
From-SVN: r219188
2015-01-05 13:33:28 +01:00
Tobias Burnus f19626cf30 re PR fortran/54687 (Use gcc option machinery for gfortran)
2014-12-17  Tobias Burnus  <burnus@net-b.de>

        PR fortran/54687
gcc/
        * flag-types.h (gfc_init_local_real, gfc_fcoarray,
        gfc_convert): New enums; moved from fortran/.

gcc/fortran/
        * gfortran.h (gfc_option_t): Remove flags which now
        have a Var().
        (init_local_real, gfc_fcoarray): Moved to ../flag-types.h.
        * libgfortran.h (unit_convert): Add comment.
        * lang.opt (flag-convert, flag-init_real, flag-coarray):
        Add Var() and Enum().
        * options.c (gfc_handle_coarray_option): Remove.
        (gfc_init_options, gfc_post_options, gfc_handle_option):
        Update for *.opt changes.
        * array.c: Update for flag-variable name changes.
        * check.c: Ditto.
        * match.c: Ditto.
        * resolve.c: Ditto.
        * simplify.c: Ditto.
        * trans-array.c: Ditto.
        * trans-decl.c: Ditto.
        * trans-expr.c: Ditto.
        * trans-intrinsic.c: Ditto.
        * trans-stmt.c: Ditto.
        * trans-types.c: Ditto.
        * trans.c: Ditto.

From-SVN: r218808
2014-12-17 07:29:30 +01:00
Roman Gareev b12749230b Makefile.in: Remove the compilation of graphite-clast-to-gimple.o.
[gcc/]

	* Makefile.in: Remove the compilation of graphite-clast-to-gimple.o.
	* common.opt: Remove using of fgraphite-code-generator flag.
	* flag-types.h: Likewise.
	* graphite.c: Remove using of CLooG.
	* graphite-blocking.c: Likewise.
	* graphite-dependences.c: Likewise.
	* graphite-poly.c: Likewise.
	* graphite-poly.h: Likewise.
	* graphite-scop-detection.c: Likewise.
	* graphite-sese-to-poly.c: Likewise.
	* graphite-clast-to-gimple.c: Removed.
	* graphite-clast-to-gimple.h: Likewise.
	* graphite-htab.h: Likewise.

[gcc/testsuite]

	* gcc.dg/graphite/isl-ast-gen-blocks-1.c: Remove using of
	fgraphite-code-generator flag.
	* gcc.dg/graphite/isl-ast-gen-blocks-2.c: Likewise.
	* gcc.dg/graphite/isl-ast-gen-blocks-3.c: Likewise.
	* gcc.dg/graphite/isl-ast-gen-blocks-4.c: Likewise.
	* gcc.dg/graphite/isl-ast-gen-user-1.c: Likewise.
	* gcc.dg/graphite/isl-codegen-loop-dumping.c: Likewise.
	* gcc.dg/graphite/pr35356-2.c: Likewise.
	* gcc.dg/graphite/isl-ast-gen-single-loop-1.c: Likewise.
	* gcc.dg/graphite/isl-ast-gen-single-loop-2.c: Likewise.
	* gcc.dg/graphite/isl-ast-gen-single-loop-3.c: Likewise.
	* gcc.dg/graphite/isl-ast-gen-if-1.c: Likewise.
	* gcc.dg/graphite/isl-ast-gen-if-2.c: Likewise.

From-SVN: r217315
2014-11-10 20:32:31 +00:00
DJ Delorie 8c0f01186f flag-types.h (sanitize_code): Don't assume targets have 32-bit integers.
* flag-types.h (sanitize_code): Don't assume targets have 32-bit
integers.

From-SVN: r216349
2014-10-16 16:58:16 -04:00
Marek Polacek 0e82f08971 asan.c (pass_sanopt::execute): Handle IFN_UBSAN_OBJECT_SIZE.
* asan.c (pass_sanopt::execute): Handle IFN_UBSAN_OBJECT_SIZE.
	* doc/invoke.texi: Document -fsanitize=object-size.
	* flag-types.h (enum sanitize_code): Add SANITIZE_OBJECT_SIZE and
	or it into SANITIZE_UNDEFINED.
	* gimple-fold.c (gimple_fold_call): Optimize IFN_UBSAN_OBJECT_SIZE.
	* internal-fn.c (expand_UBSAN_OBJECT_SIZE): New function.
	* internal-fn.def (UBSAN_OBJECT_SIZE): Define.
	* opts.c (common_handle_option): Handle -fsanitize=object-size.
	* ubsan.c: Include tree-object-size.h.
	(ubsan_type_descriptor): Call tree_to_uhwi instead of tree_to_shwi. 
	(ubsan_expand_bounds_ifn): Use false instead of 0.
	(ubsan_expand_objsize_ifn): New function.
	(instrument_object_size): New function.
	(pass_ubsan::execute): Add object size instrumentation.
	* ubsan.h (ubsan_expand_objsize_ifn): Declare.
testsuite/
	* c-c++-common/ubsan/object-size-1.c: New test.
	* c-c++-common/ubsan/object-size-2.c: New test.
	* c-c++-common/ubsan/object-size-3.c: New test.
	* c-c++-common/ubsan/object-size-4.c: New test.
	* c-c++-common/ubsan/object-size-5.c: New test.
	* c-c++-common/ubsan/object-size-6.c: New test.
	* c-c++-common/ubsan/object-size-7.c: New test.
	* c-c++-common/ubsan/object-size-8.c: New test.
	* c-c++-common/ubsan/object-size-9.c: New test.
	* g++.dg/ubsan/object-size-1.C: New test.
	* gcc.dg/ubsan/object-size-9.c: New test.

From-SVN: r216099
2014-10-10 17:19:25 +00:00
Jakub Jelinek 126edc3fe2 flag-types.h (enum sanitize_code): Add SANITIZE_NONNULL_ATTRIBUTE and SANITIZE_RETURNS_NONNULL_ATTRIBUTE...
gcc/
	* flag-types.h (enum sanitize_code): Add SANITIZE_NONNULL_ATTRIBUTE
	and SANITIZE_RETURNS_NONNULL_ATTRIBUTE, or them into SANITIZE_UNDEFINED.
	* opts.c (common_handle_option): Handle SANITIZE_NONNULL_ATTRIBUTE and
	SANITIZE_RETURNS_NONNULL_ATTRIBUTE and disable
	flag_delete_null_pointer_checks for them.
	* sanitizer.def (BUILT_IN_UBSAN_HANDLE_NONNULL_ARG,
	BUILT_IN_UBSAN_HANDLE_NONNULL_ARG_ABORT,
	BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN,
	BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_ABORT): New.
	* ubsan.c (instrument_bool_enum_load): Set *gsi back to
	stmt's iterator.
	(instrument_nonnull_arg, instrument_nonnull_return): New functions.
	(pass_ubsan::gate): Return true even for SANITIZE_NONNULL_ATTRIBUTE
	or SANITIZE_RETURNS_NONNULL_ATTRIBUTE.
	(pass_ubsan::execute): Call instrument_nonnull_{arg,return}.
	* doc/invoke.texi (-fsanitize=nonnull-attribute,
	-fsanitize=returns-nonnull-attribute): Document.
gcc/testsuite/
	* c-c++-common/ubsan/attrib-3.c: New test.
	* c-c++-common/ubsan/nonnull-1.c: New test.
	* c-c++-common/ubsan/nonnull-2.c: New test.
	* c-c++-common/ubsan/nonnull-3.c: New test.
	* c-c++-common/ubsan/nonnull-4.c: New test.
	* c-c++-common/ubsan/nonnull-5.c: New test.
libsanitizer/
	* ubsan/ubsan_handlers.cc, ubsan/ubsan_handlers.h: Cherry pick
	upstream r215485, r217389, r217391 and r217400.

From-SVN: r215118
2014-09-10 11:23:16 +02:00
Jakub Jelinek 944fa280bc opts.c (common_handle_option): Handle -fsanitize=alignment.
* opts.c (common_handle_option): Handle -fsanitize=alignment.
	* ubsan.h (enum ubsan_null_ckind): Add UBSAN_CTOR_CALL.
	(ubsan_expand_bounds_ifn, ubsan_expand_null_ifn): Change return
	type to bool.
	* stor-layout.h (min_align_of_type): New prototype.
	* asan.c (pass_sanopt::execute): Don't perform gsi_next if
	ubsan_expand* told us not to do it.  Remove the extra gsi_end_p
	check.
	* ubsan.c: Include builtins.h.
	(ubsan_expand_bounds_ifn): Change return type to bool,
	always return true.
	(ubsan_expand_null_ifn): Change return type to bool, change
	argument to gimple_stmt_iterator *.  Handle both null and alignment
	sanitization, take type from ckind argument's type rather than
	first argument.
	(instrument_member_call): Removed.
	(instrument_mem_ref): Remove t argument, add mem and base arguments.
	Handle both null and alignment sanitization, don't say whole
	struct access is member access.  Build 3 argument IFN_UBSAN_NULL
	call instead of 2 argument.
	(instrument_null): Adjust instrument_mem_ref caller.  Don't
	instrument calls here.
	(pass_ubsan::gate, pass_ubsan::execute): Handle SANITIZE_ALIGNMENT
	like SANITIZE_NULL.
	* stor-layout.c (min_align_of_type): New function.
	* flag-types.h (enum sanitize_code): Add SANITIZE_ALIGNMENT.
	Or it into SANITIZE_UNDEFINED.
	* doc/invoke.texi (-fsanitize=alignment): Document.
cp/
	* cp-gimplify.c (cp_genericize_r): For -fsanitize=null and/or
	-fsanitize=alignment call ubsan_maybe_instrument_reference
	for casts to REFERENCE_TYPE and ubsan_maybe_instrument_member_call
	for calls to member functions.
c-family/
	* c-common.h (min_align_of_type): Removed prototype.
	* c-common.c (min_align_of_type): Removed.
	* c-ubsan.h (ubsan_maybe_instrument_reference,
	ubsan_maybe_instrument_member_call): New prototypes.
	* c-ubsan.c: Include stor-layout.h and builtins.h.
	(ubsan_maybe_instrument_reference_or_call,
	ubsan_maybe_instrument_reference, ubsan_maybe_instrument_call): New
	functions.
testsuite/
	* c-c++-common/ubsan/align-1.c: New test.
	* c-c++-common/ubsan/align-2.c: New test.
	* c-c++-common/ubsan/align-3.c: New test.
	* c-c++-common/ubsan/align-4.c: New test.
	* c-c++-common/ubsan/align-5.c: New test.
	* c-c++-common/ubsan/attrib-4.c: New test.
	* g++.dg/ubsan/align-1.C: New test.
	* g++.dg/ubsan/align-2.C: New test.
	* g++.dg/ubsan/align-3.C: New test.
	* g++.dg/ubsan/attrib-1.C: New test.
	* g++.dg/ubsan/null-1.C: New test.
	* g++.dg/ubsan/null-2.C: New test.

From-SVN: r213406
2014-08-01 09:52:43 +02:00
Yury Gribov fec4842dee cpp.texi (__SANITIZE_ADDRESS__): Updated description.
2014-07-31  Yury Gribov  <y.gribov@samsung.com>

	* doc/cpp.texi (__SANITIZE_ADDRESS__): Updated description.
	* doc/invoke.texi (-fsanitize=kernel-address): Describe new option.
	* flag-types.h (SANITIZE_USER_ADDRESS, SANITIZE_KERNEL_ADDRESS):
	New enums.
	* gcc.c (sanitize_spec_function): Support new option.
	(SANITIZER_SPEC): Remove now redundant check.
	* opts.c (common_handle_option): Support new option.
	(finish_options): Check for incompatibilities.
	* toplev.c (process_options): Split userspace-specific checks.

From-SVN: r213367
2014-07-31 13:35:18 +00:00
Roman Gareev f6cc31036a Makefile.in: Add the compilation of graphite-isl-ast-to-gimple.o.
gcc/
	* Makefile.in:
	Add the compilation of graphite-isl-ast-to-gimple.o.
	* common.opt:
	Add new switch fgraphite-code-generator=[isl|cloog].
	* flag-types.h:
	Add new enum fgraphite_generator.
	* graphite-isl-ast-to-gimple.c: New.
	* graphite-isl-ast-to-gimple.h: New.
	* graphite.c (graphite_transform_loops):
	Add choice of Graphite code generator,
	which depends on flag_graphite_code_gen.

	gcc/testsuite/gcc.dg/graphite/isl-codegen-loop-dumping.c:
	New testcase that checks that the dump is generated.

From-SVN: r212124
2014-06-29 14:20:35 +00:00
Marek Polacek 0e37a2f33d asan.c (pass_sanopt::execute): Handle IFN_UBSAN_BOUNDS.
* asan.c (pass_sanopt::execute): Handle IFN_UBSAN_BOUNDS.
	* flag-types.h (enum sanitize_code): Add SANITIZE_BOUNDS and or it
	into SANITIZE_UNDEFINED.
	* doc/invoke.texi: Describe -fsanitize=bounds.
	* gimplify.c (gimplify_call_expr): Add gimplification of internal
	functions created in the FEs.
	* internal-fn.c: Move "internal-fn.h" after "tree.h".
	(expand_UBSAN_BOUNDS): New function.
	* internal-fn.def (UBSAN_BOUNDS): New internal function.
	* internal-fn.h: Don't define internal functions here.
	* opts.c (common_handle_option): Add -fsanitize=bounds.
	* sanitizer.def (BUILT_IN_UBSAN_HANDLE_OUT_OF_BOUNDS,
	BUILT_IN_UBSAN_HANDLE_OUT_OF_BOUNDS_ABORT): Add.
	* tree-core.h: Define internal functions here.
	(struct tree_base): Add ifn field.
	* tree-pretty-print.c: Include "internal-fn.h".
	(dump_generic_node): Handle functions without CALL_EXPR_FN.
	* tree.c (get_callee_fndecl): Likewise.
	(build_call_expr_internal_loc): New function.
	* tree.def (CALL_EXPR): Update description.
	* tree.h (CALL_EXPR_IFN): Define.
	(build_call_expr_internal_loc): Declare.
	* ubsan.c (get_ubsan_type_info_for_type): Return 0 for non-arithmetic
	types.
	(ubsan_type_descriptor): Change bool parameter to enum
	ubsan_print_style.  Adjust the code.  Add handling of
	UBSAN_PRINT_ARRAY.
	(ubsan_expand_bounds_ifn): New function.
	(ubsan_expand_null_ifn): Adjust ubsan_type_descriptor call.
	(ubsan_build_overflow_builtin): Likewise.
	(instrument_bool_enum_load): Likewise.
	(ubsan_instrument_float_cast): Likewise.
	* ubsan.h (enum ubsan_print_style): New enum.
	(ubsan_expand_bounds_ifn): Declare.
	(ubsan_type_descriptor): Adjust declaration.  Use a default parameter.
c-family/
	* c-gimplify.c: Include "c-ubsan.h" and "pointer-set.h".
	(ubsan_walk_array_refs_r): New function.
	(c_genericize): Instrument array bounds.
	* c-ubsan.c: Include "internal-fn.h".
	(ubsan_instrument_division): Mark instrumented arrays as having
	side effects.  Adjust ubsan_type_descriptor call.
	(ubsan_instrument_shift): Likewise.
	(ubsan_instrument_vla): Adjust ubsan_type_descriptor call.
	(ubsan_instrument_bounds): New function.
	(ubsan_array_ref_instrumented_p): New function.
	(ubsan_maybe_instrument_array_ref): New function.
	* c-ubsan.h (ubsan_instrument_bounds): Declare.
	(ubsan_array_ref_instrumented_p): Declare.
	(ubsan_maybe_instrument_array_ref): Declare.
testsuite/
	* c-c++-common/ubsan/bounds-1.c: New test.
	* c-c++-common/ubsan/bounds-2.c: New test.
	* c-c++-common/ubsan/bounds-3.c: New test.
	* c-c++-common/ubsan/bounds-4.c: New test.
	* c-c++-common/ubsan/bounds-5.c: New test.
	* c-c++-common/ubsan/bounds-6.c: New test.

From-SVN: r211859
2014-06-20 21:20:51 +00:00
Marek Polacek 85a16bf8b5 builtins.def: Change SANITIZE_FLOAT_DIVIDE to SANITIZE_NONDEFAULT.
* builtins.def: Change SANITIZE_FLOAT_DIVIDE to SANITIZE_NONDEFAULT.
	* gcc.c (sanitize_spec_function): Likewise.
	* convert.c (convert_to_integer): Include "ubsan.h".  Add
	floating-point to integer instrumentation.
	* doc/invoke.texi: Document -fsanitize=float-cast-overflow.
	* flag-types.h (enum sanitize_code): Add SANITIZE_FLOAT_CAST and
	SANITIZE_NONDEFAULT.
	* opts.c (common_handle_option): Handle -fsanitize=float-cast-overflow.
	* sanitizer.def (BUILT_IN_UBSAN_HANDLE_FLOAT_CAST_OVERFLOW,
	BUILT_IN_UBSAN_HANDLE_FLOAT_CAST_OVERFLOW_ABORT): Add.
	* ubsan.c: Include "realmpfr.h" and "dfp.h".
	(get_ubsan_type_info_for_type): Handle REAL_TYPEs.
	(ubsan_type_descriptor): Set tkind to 0xffff for types other than
	float/double/long double.
	(ubsan_instrument_float_cast): New function.
	* ubsan.h (ubsan_instrument_float_cast): Declare.
testsuite/
	* c-c++-common/ubsan/float-cast-overflow-1.c: New test.
	* c-c++-common/ubsan/float-cast-overflow-10.c: New test.
	* c-c++-common/ubsan/float-cast-overflow-2.c: New test.
	* c-c++-common/ubsan/float-cast-overflow-3.c: New test.
	* c-c++-common/ubsan/float-cast-overflow-4.c: New test.
	* c-c++-common/ubsan/float-cast-overflow-5.c: New test.
	* c-c++-common/ubsan/float-cast-overflow-6.c: New test.
	* c-c++-common/ubsan/float-cast-overflow-7.c: New test.
	* c-c++-common/ubsan/float-cast-overflow-7.h: New file.
	* c-c++-common/ubsan/float-cast-overflow-8.c: New test.
	* c-c++-common/ubsan/float-cast-overflow-9.c: New test.
	* c-c++-common/ubsan/float-cast.h: New file.
	* g++.dg/ubsan/float-cast-overflow-bf.C: New test.
	* gcc.dg/ubsan/float-cast-overflow-bf.c: New test.
libsanitizer/
	* ubsan/ubsan_value.cc (getFloatValue): Handle 96-bit
	floating-point types.

Co-Authored-By: Jakub Jelinek <jakub@redhat.com>

From-SVN: r210862
2014-05-23 14:44:42 +00:00
Marek Polacek f8ed5150c3 gcc.c (sanitize_spec_function): Handle SANITIZE_FLOAT_DIVIDE.
* gcc.c (sanitize_spec_function): Handle SANITIZE_FLOAT_DIVIDE.
	* builtins.def: Initialize builtins even for SANITIZE_FLOAT_DIVIDE.
	* flag-types.h (enum sanitize_code): Add SANITIZE_FLOAT_DIVIDE.
	* opts.c (common_handle_option): Add -fsanitize=float-divide-by-zero.
c-family/
	* c-ubsan.c (ubsan_instrument_division): Handle REAL_TYPEs.  Perform
	INT_MIN / -1 sanitization only for integer types.
c/
	* c-typeck.c (build_binary_op): Call ubsan_instrument_division
	also when SANITIZE_FLOAT_DIVIDE is on.
cp/
	* typeck.c (cp_build_binary_op): Call ubsan_instrument_division
	even when SANITIZE_FLOAT_DIVIDE is on.  Set doing_div_or_mod even
	for non-integer types.
testsuite/
	* c-c++-common/ubsan/div-by-zero-5.c: Fix formatting.
	* c-c++-common/ubsan/float-div-by-zero-1.c: New test.

From-SVN: r209927
2014-04-30 07:34:43 +00:00
Dimitris Papavasiliou dcaaa5a04a flag-types.h (enum ivar_visibility): Add.
2014-04-24  Dimitris Papavasiliou  <dpapavas@gmail.com>

	    * flag-types.h (enum ivar_visibility): Add.

c-family:
	    * c.opt (Wshadow-ivar, flocal-ivars, fivar-visibility): Add.

objc:
	* objc-act.c (objc_ivar_visibility, objc_default_ivar_visibility): Add.
	(objc_init): Initialize objc_default_ivar_visibility.
	(objc_start_class_interface): Use objc_default_ivar_visibility.
	(objc_start_class_implementation): Likewise.
	(objc_lookup_ivar): Implement -fno-local-ivars.

From-SVN: r209753
2014-04-24 15:58:44 +00:00
Richard Biener 783dab6bd5 common.opt (lto_partition_model): New enum.
2014-04-15  Richard Biener  <rguenther@suse.de>

	* common.opt (lto_partition_model): New enum.
	(flto-partition=): Merge separate options with a single with argument,
	add -flto-partition=one support.
	* flag-types.h (enum lto_partition_model): Declare.
	* opts.c (finish_options): Remove duplicate -flto-partition=
	option check.
	* lto-wrapper.c (run_gcc): Adjust.

	lto/
	* lto.c: Include params.h.
	(do_whole_program_analysis): Switch on flag_lto_partition value,
	add support for LTO_PARTITION_ONE.
	* lto-partition.h (lto_balanced_map): Adjust.
	* lto-partition.c (lto_balanced_map): Get number of desired
	partitions as argument to support -flto-partition=one.

From-SVN: r209416
2014-04-15 12:56:16 +00:00
Richard Sandiford 23a5b65a92 Update copyright years in gcc/
From-SVN: r206289
2014-01-02 22:23:26 +00:00
Jakub Jelinek ac0ff9f273 ubsan.c: Include tree-ssanames.h, asan.h and gimplify-me.h.
* ubsan.c: Include tree-ssanames.h, asan.h and gimplify-me.h.
	(ubsan_type_descriptor): Handle BOOLEAN_TYPE and ENUMERAL_TYPE
	like INTEGER_TYPE.
	(instrument_bool_enum_load): New function.
	(ubsan_pass): Call it.
	(gate_ubsan): Also enable for SANITIZE_BOOL or SANITIZE_ENUM.
	* asan.c (create_cond_insert_point): No longer static.
	* asan.h (create_cond_insert_point): Declare.
	* sanitizer.def (BUILT_IN_UBSAN_HANDLE_LOAD_INVALID_VALUE): New
	built-in.
	* opts.c (common_handle_option): Handle -fsanitize=bool and
	-fsanitize=enum.
	* builtins.c (fold_builtin_memory_op): When sanitizing bool
	and enum loads, don't use enum or bool types for memcpy folding.
	* flag-types.h (SANITIZE_BOOL, SANITIZE_ENUM): New.
	(SANITIZE_UNDEFINED): Or these in.

	* c-c++-common/ubsan/load-bool-enum.c: New test.

From-SVN: r206143
2013-12-20 10:05:04 +01:00
Marek Polacek 31e071aeb8 Implement -fsanitize=signed-integer-overflow.
From-SVN: r205684
2013-12-04 22:47:11 +00:00
Jakub Jelinek 9065ada9b5 re PR sanitizer/59061 (Port leaksanitizer)
PR sanitizer/59061
	* common.opt (static-liblsan): Add.
	* config/gnu-user.h (STATIC_LIBLSAN_LIBS, STATIC_LIBUBSAN_LIBS):
	Define.
	* flag-types.h (enum sanitize_code): Add SANITIZE_LEAK.  Renumber
	SANITIZE_SHIFT, SANITIZE_DIVIDE, SANITIZE_UNREACHABLE, SANITIZE_VLA,
	SANITIZE_RETURN.
	* opts.c (common_handle_option): Handle -fsanitize=leak.
	* gcc.c (ADD_STATIC_LIBLSAN_LIBS, LIBLSAN_SPEC): Define.
	(LIBUBSAN_SPEC): Don't test LIBUBSAN_EARLY_SPEC.
	(LIBUBSAN_EARLY_SPEC): Remove.
	(SANITIZER_EARLY_SPEC): Don't do anything for libubsan.
	(SANITIZER_SPEC): Add -fsanitize=leak handling.
	(sanitize_spec_function): Handle %sanitize(leak).
	* doc/invoke.texi (-static-liblsan, -fsanitize=leak): Document.

	* c-c++-common/asan/no-redundant-instrumentation-7.c: Fix
	cleanup-tree-dump directive.

	* configure.tgt: Set LSAN_SUPPORTED=yes for x86_64-linux.
	* configure.ac (LSAN_SUPPORTED): New AM_CONDITIONAL.
	* configure: Regenerated.
	* lsan/Makefile.am (toolexeclib_LTLIBRARIES, lsan_files,
	liblsan_la_SOURCES, liblsan_la_LIBADD, liblsan_la_LDFLAGS): Add.
	* lsan/Makefile.in: Regenerated.

From-SVN: r205290
2013-11-22 22:13:08 +01:00
Jakub Jelinek 0a508bb66b ubsan.c (ubsan_source_location): Don't crash on unknown locations.
* ubsan.c (ubsan_source_location): Don't crash on
	unknown locations.
	(ubsan_pass): Ignore clobber stmts.

	* sanitizer.def (BUILT_IN_UBSAN_HANDLE_MISSING_RETURN): New built-in.
	* opts.c (common_handle_option): Add -fsanitize=return.
	* flag-types.h (enum sanitize_code): Add SANITIZE_RETURN and
	or it into SANITIZE_UNDEFINED.
c-family/
	* c-ubsan.h (ubsan_instrument_return): New prototype.
	* c-ubsan.c (ubsan_instrument_return): New function.
cp/
	* cp-gimplify.c: Include target.h and c-family/c-ubsan.h.
	(cp_ubsan_maybe_instrument_return): New function.
	(cp_genericize): Call it if -fsanitize=return.
testsuite/
	* g++.dg/ubsan/return-1.C: New test.
	* g++.dg/ubsan/return-2.C: New test.

From-SVN: r205283
2013-11-22 21:07:31 +01:00
Marek Polacek b9a55b135e bootstrap-ubsan.mk (POSTSTAGE1_LDFLAGS): Add -ldl.
config/
	* bootstrap-ubsan.mk (POSTSTAGE1_LDFLAGS): Add -ldl.
gcc/c-family/
	* c-ubsan.c (ubsan_instrument_division): Adjust ubsan_create_data
	call.
	(ubsan_instrument_shift): Likewise.
	(ubsan_instrument_vla): Likewise.
gcc/
	* opts.c (common_handle_option): Add -fsanitize=null option.
	Turn off -fdelete-null-pointer-checks option when doing the
	NULL pointer checking.
	* sanitizer.def (BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH): Add.
	* tree-pass.h (make_pass_ubsan): Declare.
	(make_pass_sanopt): Declare.
	* timevar.def (TV_TREE_UBSAN): New timevar.
	* passes.def: Add pass_sanopt and pass_ubsan.
	* ubsan.h (ubsan_null_ckind): New enum.
	(ubsan_mismatch_data): New struct.
	(ubsan_expand_null_ifn): Declare.
	(ubsan_create_data): Adjust declaration.
	(ubsan_type_descriptor): Likewise.
	* asan.c: Include "ubsan.h".
	(pass_data_sanopt): New pass.
	(execute_sanopt): New function.
	(gate_sanopt): Likewise.
	(make_pass_sanopt): Likewise.
	(class pass_sanopt): New class.
	* ubsan.c: Include tree-pass.h, gimple-ssa.h, gimple-walk.h,
	gimple-iterator.h and cfgloop.h. 
	(PROB_VERY_UNLIKELY): Define.
	(tree_type_map_hash): New function.
	(ubsan_type_descriptor): Add new parameter.
	Improve type name generation.
	(ubsan_create_data): Add new parameter.  Add pointer data into
	ubsan structure.
	(ubsan_expand_null_ifn): New function.
	(instrument_member_call): Likewise.
	(instrument_mem_ref): Likewise.
	(instrument_null): Likewise.
	(ubsan_pass): Likewise.
	(gate_ubsan): Likewise.
	(make_pass_ubsan): Likewise.
	(ubsan_instrument_unreachable): Adjust ubsan_create_data call.
	(class pass_ubsan): New class.
	(pass_data_ubsan): New pass.
	* flag-types.h (enum sanitize_code): Add SANITIZE_NULL.
	* internal-fn.c (expand_UBSAN_NULL): New function.
	* cgraphunit.c (varpool_finalize_decl): Call varpool_assemble_decl
	even when !flag_toplevel_reorder.
	* internal-fn.def (UBSAN_NULL): New.
gcc/testsuite/
	* c-c++-common/ubsan/null-1.c: New test.
	* c-c++-common/ubsan/null-2.c: New test.
	* c-c++-common/ubsan/null-3.c: New test.
	* c-c++-common/ubsan/null-4.c: New test.
	* c-c++-common/ubsan/null-5.c: New test.
	* c-c++-common/ubsan/null-6.c: New test.
	* c-c++-common/ubsan/null-7.c: New test.
	* c-c++-common/ubsan/null-8.c: New test.
	* c-c++-common/ubsan/null-9.c: New test.
	* c-c++-common/ubsan/null-10.c: New test.
	* c-c++-common/ubsan/null-11.c: New test.
	* gcc.dg/ubsan/c99-shift-2.c: Adjust dg-output.
	* c-c++-common/ubsan/shift-1.c: Likewise.
	* c-c++-common/ubsan/div-by-zero-3.c: Likewise.

From-SVN: r205021
2013-11-19 11:45:15 +00:00
Marek Polacek b906f4ca81 Implement -fsanitize=vla-bound.
* opts.c (common_handle_option): Handle vla-bound.
	* sanitizer.def (BUILT_IN_UBSAN_HANDLE_VLA_BOUND_NOT_POSITIVE):
	Define.
	* flag-types.h (enum sanitize_code): Add SANITIZE_VLA.
	* asan.c (initialize_sanitizer_builtins): Build BT_FN_VOID_PTR_PTR.
c-family/
	* c-ubsan.c: Don't include hash-table.h.
	(ubsan_instrument_vla): New function.
	* c-ubsan.h: Declare it.
cp/
	* decl.c (cp_finish_decl): Move C++1y bounds checking...
	(compute_array_index_type): ...here.  Add VLA instrumentation.
	Call stabilize_vla_size.
	(grokdeclarator): Don't call stabilize_vla_size here.
c/
	* c-decl.c (grokdeclarator): Add VLA instrumentation.
testsuite/
	* g++.dg/ubsan/cxx1y-vla.C: New test.
	* c-c++-common/ubsan/vla-3.c: New test.
	* c-c++-common/ubsan/vla-2.c: New test.
	* c-c++-common/ubsan/vla-4.c: New test.
	* c-c++-common/ubsan/vla-1.c: New test.

From-SVN: r204334
2013-11-03 17:59:31 +00:00
Xinliang David Li d6d1127249 vectorizer cost model enhancement
From-SVN: r202980
2013-09-27 16:48:15 +00:00
Marek Polacek de5a5fa139 Merge ubsan into trunk.
From-SVN: r202113
2013-08-30 16:12:58 +00:00
Caroline Tice 2077db1be5 Commit the vtable verification feature.
Commit the vtable verification feature.  This feature is designed to
detect, at run time, if/when the vtable pointer in a C++ object has
been corrupted, before allowing virtual calls through that pointer. 
If pointer corruption is detected, execution of the program is halted.

libstdc++-v3 ChangeLog:
2013-08-06  Caroline Tice  <cmtice@google.com>

        * fragment.am: Add XTEMPLATE_FLAGS.
        * configure.ac: Add definitions for --enable-vtable-verify.
        * acinclude.m4:  Add --enable-vtable-verify and
        --disable-vtable-verify; define --enable-vtable-verify; define
        VTV_CXXFLAGS, VTV_PCH_CXXFLAGS and VTV_CXXLINKFLAGS.
        * config/abi/pre/gnu.ver: Export symbols for vtable verification.
        * libsupc++/Makefile.am: Define vtv_sources and add it to
        libsupc___la_SOURCES and libsupc__convenience_la_SOURCES.
        * libsupc++/vtv_stubs.cc: New file.
        * include/Makefile.am: Add VTV_PCH_CXXFLAGS to PCHFLAGS.
        * src/Makefile.am: Add VTV_CXXFLAGS to AM_CXXFLAGS; add
        VTV_CXXLINKFLAGS to CXXLINK.
        * src/c++98/Makefile.am: Comment out XTEMPLATE_FLAGS; add VTV_CXXFLAGS
        to AM_CXXFLAGS; add VTV_CXXXLINKFLAGS to CXXLINK.
        * src/C++11/Makefile.am: Ditto.
        * doc/xml/manual/configure.xml: Add entry for --enable-vtable-verify.
        * scripts/testsuite_flags.in: Add cxxvtvflags to Usage; cause
        cxxvtvflags to use VTV_CXXFLAGS and VTV_CXXLINKFLAGS.
        * testsuite/lib/libstdc++.exp: Add cxxvtvflags; add code to locate
        libvtv if --enable-vtable-verify was used; set cxxvtvflags; add
        cxxvtvflags to cxx_final.
        * testsuite/18_support/bad_exception/23591_thread-1.c: Add
        -fvtable-verify=none to compiler flags.
        * testsuite/17_intro/freestanding.cc: Add -fvtable-verify=none
        to compiler flags.
        * configure: Regenerated.
        * Makefile.in: Regenerated.
        * python/Makefile.in: Regenerated.
        * include/Makefile.in: Regenerated.
        * libsupc++/Makefile.in: Regenerated.
        * config.h.in: Regenerated.
        * po/Makefile.in: Regenerated.
        * src/Makefile.in: Regenerated.
        * src/c++98/Makefile.in: Regenerated.
        * src/c++11/Makefile.in: Regenerated.
        * doc/Makefile.in: Regenerated.
        * testsuite/Makefile.in: Regenerated.

top level ChangeLog:
2013-08-06  Caroline Tice  <cmtice@google.com>

        * configure.ac: Add target-libvtv to target_libraries; disable libvtv
        on non-linux systems; add target-libvtv to noconfigdirs; add
        libsupc++/.libs to C++ library search paths.
        * configure: Regenerated.
        * Makefile.def: Add libvtv to target_modules; make libvtv depend on
        libstdc++ and libgcc.
        * Makefile.in: Regenerated.

include/ChangeLog:
2013-08-06  Caroline Tice  <cmtice@google.com>

        * vtv-change-permission.h: New file.

contrib/ChangeLog:
2013-08-06  Caroline Tice4  <cmtice@google.com>

        * gcc_update: Add libvtv files.

libgcc/ChangeLog:
2013-08-06  Caroline Tice  <cmtice@google.com>

        config.host (extra_parts): Add vtv_start.o, vtv_end.o
        vtv_start_preinit.o and vtv_end_preinit.o.
        configure.ac: Add code to check/set enable_vtable_verify.
        Makefile.in: Add rules to build vtv_*.o, if enable_vtable_verify is
        true.
        vtv_start_preinit.c: New file.
        vtv_end_preinit.c: New file.
        vtv_start.c: New file.
        vtv_end.c: New file.
        configure: Regenerated.

gcc/ChangeLog:
2013-08-06  Caroline Tice  <cmtice@google.com>

        * gcc.c (VTABLE_VERIFICATION_SPEC): New definition.
        (LINK_COMMAND_SPEC): Add VTABLE_VERIFICATION_SPEC.
        * tree-pass.h: Add pass_vtable_verify.
        * varasm.c (assemble_variable): Add code to properly set the comdat
        section and name for the .vtable_map_vars section.
        (assemble_vtyv_preinit_initializer): New function.
        (default_sectin_type_flags):  Make sure .vtable_map_vars section has
        LINK_ONCE flag.
        * output.h: Add function decl for assemble_vtv_preinit_initializer.
        * vtable-verify.c: New file.
        * vtable-verify.h: New file.
        * flag-types.h (enum vtv_priority): Defintions for flag_vtable_verify
        initialiation levels.
        * timevar.def (TV_VTABLE_VERIFICATION): New definition.
        * passes.def: Insert pass_vtable_verify.
        * aclocal.m4: Reorder includes.
        * doc/invoke.texi: Add documentation for the flags -fvtable-verify=,
	-fvtv-debug and -fvtv-counts.
        * config/gnu-user.h (GNU_USER_TARGET_STARTFILE_SPEC): Add vtv_start*.o,
as appropriate, if -fvtable-verify=... is used.
        (GNU_USER_TARGET_ENDFILE_SPEC): Add vtv_end*.o as appropriate, if
        -fvtable-verify=... is used.
        * Makefile.in (OBJS):  Add vtable-verify.o to list.
        (vtable-verify.o): Add new build rule.
        (GTFILES): Add vtable-verify.c to list.
        * common.opt (fvtable-verify=): New flag.
        (vtv_priority): Values for fvtable-verify= flag.
        (fvtv-counts): New flag.
(fvtv-debug): New flag.
        * tree.h (save_vtable_map_decl): New extern function decl.


gcc/cp/ChangeLog:
2013-08-06  Caroline Tice  <cmtice@google.com>

        * Make-lang.in (*CXX_AND_OBJCXX_OBJS):  Add vtable-class-hierarchy.o to
        list.
        (vtable-class-hierarchy.o): Add build rule.
        * cp-tree.h (vtv_start_verification_constructor_init_function): New
        extern function decl.
        (vtv_finish_verification_constructor_init_function): New extern
        function decl.
        (build_vtbl_address): New extern function decl.
        (get_mangled_vtable_map_var_name): New extern function decl.
        (vtv_compute_class_hierarchy_transitive_closure): New extern function
        decl.
        (vtv_generate_init_routine): New extern function decl.
        (vtv_save_class_info): New extern function decl.
        (vtv_recover_class_info): New extern function decl.
        (vtv_build_vtable_verify_fndecl): New extern function decl.
        * class.c (finish_struct_1): Add call to vtv_save_class_info if
        flag_vtable_verify is true.
        * config-lang.in: Add vtable-class-hierarchy.c to gtfiles list.
        * vtable-class-hierarchy.c: New file.
        * mangle.c (get_mangled_vtable_map_var_name):  New function.
        * decl2.c (start_objects): Update function comment.
        (cp_write_global_declarations): Call vtv_recover_class_info,
        vtv_compute_class_hierarchy_transitive_closure and
        vtv_build_vtable_verify_fndecl, before calling
        finalize_compilation_unit, and call vtv_generate_init_rount after, IFF
        flag_vtable_verify is true.
        (vtv_start_verification_constructor_init_function): New function.
        (vtv_finish_verification_constructor_init_function): New function.
        * init.c (build_vtbl_address): Remove static qualifier from function.

libvtv/ChangeLog:
2013-08-06  Caroline Tice  <cmtice@google.com>

        Initial check-in of new vtable verification feature.
        * configure.ac : New file.
        * acinclude.m4 : New file.
        * Makefile.am : New file.
        * aclocal.m4 : New file.
        * configure.tgt : New file.
        * configure: New file (generated).
        * Makefile.in: New file (generated).
        * vtv_set.h : New file.
        * vtv_utils.cc : New file.
        * vtv_utils.h : New file.
        * vtv_malloc.cc : New file.
        * vtv_rts.cc : New file.
        * vtv_malloc.h : New file.
        * vtv_rts.h : New file.
        * vtv_fail.cc : New file.
        * vtv_fail.h : New file.
        * vtv_map.h : New file.
        * scripts/run-testsuite.sh : New file.
        * scripts/sum-vtv-counts.c : New file.
        * testsuite/parts-test-main.h : New file.
        * testusite/dataentry.cc : New file.
        * testsuite/temp_deriv.cc : New file.
        * testsuite/register_pair.cc : New file.
        * testsuite/virtual_inheritance.cc : New file.
        * testsuite/field-test.cc : New file.
        * testsuite/nested_vcall_test.cc : New file.
        * testsuite/template-list-iostream.cc : New file.
        * testsuite/register_pair_inserts.cc : New file.
        * testsuite/register_pair_inserts_mt.cc : New file.
        * testsuite/event.list : New file.
        * testsuite/parts-test-extra-parts-views.cc : New file.
        * testsuite/parts-test-extra-parts-views.h : New file.
        * testsuite/environment-fail-32.s : New file.
        * testsuite/parts-test-extra-parts.h : New file.
        * testsuite/temp_deriv2.cc : New file.
        * testsuite/dlopen_mt.cc : New file.
        * testsuite/event.h : New file.
        * testsuite/template-list.cc : New file.
        * testsuite/replace-fail.cc : New file.
        * testsuite/Makefile.am : New file.
        * testsuite/Makefile.in: New file (generated).
        * testsuite/mempool_negative.c : New file.
        * testsuite/parts-test-main.cc : New file.
        * testsuite/event-private.cc : New file.
        * testsuite/thunk.cc : New file.
        * testsuite/event-defintiions.cc : New file.
        * testsuite/event-private.h : New file.
        * testsuite/parts-test.list : New file.
        * testusite/register_pair_mt.cc : New file.
        * testsuite/povray-derived.cc : New file.
        * testsuite/event-main.cc : New file.
        * testsuite/environment.cc : New file.
        * testsuite/template-list2.cc : New file.
        * testsuite/thunk_vtable_map_attack.cc : New file.
        * testsuite/parts-test-extra-parts.cc : New file.
        * testsuite/environment-fail-64.s : New file.
        * testsuite/dlopen.cc : New file.
        * testsuite/so.cc : New file.
        * testsuite/temp_deriv3.cc : New file.
        * testsuite/const_vtable.cc : New file.
        * testsuite/mempool_positive.c : New file.
        * testsuite/dup_name.cc : New file.

From-SVN: r201555
2013-08-06 20:38:59 -07:00
Richard Sandiford d1e082c2c2 Update copyright years in gcc/
From-SVN: r195098
2013-01-10 20:38:27 +00:00
Jakub Jelinek 90d04a445c Update Copyright years for files modified in 2011 and/or 2012.
From-SVN: r194903
2013-01-04 13:49:55 +01:00
Steven Bosscher a27a5de969 invoke.texi: Remove -dv documentation.
gcc/
	* doc/invoke.texi: Remove -dv documentation.  Fix up graph dump related
	documentation.  Document the '-graph' dump option.  Complete the '-slim'
	dump option documentation.

	* common.opt (Variable graph_dump_format): Remove.
	* flag-types.h (enum graph_dump_types): Remove.
	* flags.h (dump_for_graph): Remove.
	* opts.c (decode_d_option): Remove -dv handling.
	* sched-int.h (print_insn, print_pattern, print_value): Move prototypes
	from here ...
	* rtl.h: ...to here.  Add note that these functions ought to be in
	another file.
	* sched-vis.c (print_insn): Add detailed dump for insn notes.
	* print-rtl.c (dump_for_graph): Remove.
	(print_rtx): Remove dump_for_graph related code.
	* graph.c: Almost complete re-write to dump DOT (GraphViz) dumps
	instead of VCG dumps.
	* graph.h (print_rtl_graph_with_bb): Update prototype.
	* passes.c (finish_optimization_passes): Fix profile dump finishing.
	Unconditionally loop over graph dumps to finalize.
	(execute_function_dump): Split code to dump graphs to separate block.
	(execute_one_pass): Don't set TDF_GRAPH here, let the dump option
	decoders do their job.

	* ddg.c (vcg_print_ddg): Make it a DEBUG_FUNCTION.
	* toplev.c: Don't include graph.h.
	* tree-optimize.c: Don't include graph.h.

testsuite/
	* testsuite/gcc.dg/20050811-1.c: Change -dv option to -graph option
	to -fdump-rtl-all.
	* testsuite/gcc.dg/pr37858.c: Remove -dv option.

From-SVN: r193821
2012-11-26 16:47:58 +00:00
Sharad Singhai 78c60e3da2 invoke.texi: Add documentation for the new option.
2012-09-30  Sharad Singhai  <singhai@google.com>

	* doc/invoke.texi: Add documentation for the new option.
	* tree-dump.c: Move general dump file related functionality into
	dumpfile.c. Remove unneeded headers.
	* tree-dump.h: Move function declarations into dumpfile.h.
	* dumpfile.h: Include "line-map.h". Add defines for MSG flags.
	(struct dump_file_info): Move here from tree-dump.c.  Rename flags
	to pflags, state to pstate, stream to pstream, filename to
	pfilename. All callers updated. Add alt_flags, alt_state,
	alt_filenmae, alt_stream.
	* tree-vectorizer.c: Include "dumpfile.h". Remove vect_dump.
	(vect_set_dump_settings): Remove.
	(vect_print_dump_info): Ditto.
	* tree-vectorizer.h: Remove declaration of vect_dump and
	vect_print_dump_info.
	* tree-vect-loop.c: Include "dumpfile.h". Use new dump style.
	* tree-vect-data-refs.c: Ditto.
	* tree-vect-stmts.c: Ditto.
	* tree-vect-slp.c: Ditto.
	* tree-vect-patterns.c: Ditto.
	* tree-vect-loop-manip.c: Ditto.
	* testsuite/gcc.target/i386/vect-double-1.c: Fix test.
	* opts.c (vect_set_verbosity_level): Remove.
	(common_handle_option): Handle -fopt-info flag. Deprecate
	-ftree-vectorizer-verbose.
	* tree-parloops.c (gather_scalar_reductions): Remove reference to
	vect_dump.
	* flag-types.h: Remove vect_verbosity_levels.
	* common.opt: Add -fopt-info. Deprecate -ftree-vectorizer-verbose.
	* opts-global.c (dump_remap_tree_vectorizer_verbose): New
	function.
	(handle_common_deferred_options): Handle -fopt-info and
	-ftree-vectorizer-verbose.
	* Makefile.in: Add dumpfile.o.
	(tree-dump.o): Update dependencies.
	(tree-vect-loop.o): Ditto.
	(tree-vect-loop-manip.o): Ditto.
	(tree-vect-slp.o): Ditto.
	(tree-vect-stmts.o): Ditto.
	(tree-vectorizer.o): Ditto.
	(opts.o): Ditto.
	* passes.c (finish_optimization_passes): Instead of using
	dump_begin/dump_end, use dump_start/dump_finish. Do not use dump_file.
	(pass_init_dump_file): Ditto.
	* c-decl.c (c_write_global_declarations): Use a different method
	to determine if the dump has ben initialized.
	* decl2.c (cp_write_global_declarations): Use a different method
	to determine if the dump has ben initialized.

From-SVN: r191883
2012-10-01 05:43:06 +00:00
Xinliang David Li 87e2a8fd39 Implement -freuse-stack= option
From-SVN: r189413
2012-07-10 20:26:38 +00:00
Richard Sandiford c881de027c invoke.texi (sched-pressure-algorithm): Document new --param.
gcc/
	* doc/invoke.texi (sched-pressure-algorithm): Document new --param.
	* common.opt (fsched-pressure-algorithm=): Remove.
	* flag-types.h (sched_pressure_algorithm): Move to...
	* sched-int.h (sched_pressure_algorithm): ...here.
	* params.def (sched-pressure-algorithm): New param.
	* haifa-sched.c (sched_init): Use it to initialize sched_pressure.
	* common/config/s390/s390-common.c (s390_option_optimization_table):
	Remove OPT_fsched_pressure_algorithm_ entry.
	* config/s390/s390.c (s390_option_override): Set a default value for
	PARAM_SCHED_PRESSURE_ALGORITHM.

From-SVN: r188258
2012-06-06 09:12:58 +00:00
Richard Sandiford 60867e8c63 common.opt (fsched-pressure-algorithm=): New option.
gcc/
	* common.opt (fsched-pressure-algorithm=): New option.
	* flag-types.h (sched_pressure_algorithm): New enum.
	* sched-int.h (sched_pressure_p): Replace with...
	(sched_pressure): ...this new variable.
	* haifa-sched.c (sched_pressure_p): Replace with...
	(sched_pressure): ...this new variable.
	(sched_regno_pressure_class, rank_for_schedule, ready_sort)
	(update_reg_and_insn_max_reg_pressure, schedule_insn)
	(debug_ready_list, prune_ready_list, schedule_block, sched_init)
	(sched_finish, fix_tick_ready, haifa_init_insn): Update accordingly.
	* sched-deps.c (init_insn_reg_pressure_info): Likewise.
	(sched_analyze_insn): Likewise.
	* sched-rgn.c (schedule_region): Likewise.
	* config/m68k/m68k.c (m68k_sched_variable_issue): Likewise.

From-SVN: r186881
2012-04-26 15:49:13 +00:00
Vladimir Makarov ffe8727f47 re PR rtl-optimization/48455 (Huge code size regression for all ARM configurations)
2011-11-23  Vladimir Makarov  <vmakarov@redhat.com>

	PR rtl-optimization/48455
	* doc/invoke.texi (-fira-region): Document default values.

	* flags-types.h (enum ira_region): Add new value
	IRA_REGION_AUTODETECT.

	* common.opt (fira-region): Set up initial value to
	IRA_REGION_AUTODETECT.

	* toplev.c (process_options): Set up flag_ira_region depending on
	-O options.

	* ira.c (ira.c): Remove optimize guard for ira_build.

From-SVN: r181675
2011-11-23 18:51:17 +00:00
Joseph Myers 7cd2305059 common.opt (user_vect_verbosity_level): New Variable entry.
* common.opt (user_vect_verbosity_level): New Variable entry.
	(ftree-vectorizer-verbose=): Mark as UInteger.
	* flag-types.h (enum vect_verbosity_levels): Move from enum
	verbosity_levels in tree-vectorizer.h.
	* opts.c: Don't include tree.h.
	(vect_set_verbosity_level): Move from tree-vectorizer.c.  Use
	gcc_options parameter; take integer option argument.
	(common_handle_option): Update call to vect_set_verbosity_level.
	* tree-vectorizer.c (user_vect_verbosity_level): Remove.
	(vect_set_verbosity_level): Move to opts.c.
	(vect_verbosity_level, vect_print_dump_info): Update for change of
	enum name.
	* tree-vectorizer.h (enum verbosity_levels): Move to flag-types.h.
	(vect_print_dump_info): Update for change of enum name.
	* tree.h (vect_set_verbosity_level): Remove.
	* Makefile.in (opts.o): Update dependencies.

From-SVN: r167113
2010-11-24 13:28:38 +00:00
Joseph Myers c98cd5bff6 flag-types.h (struct visibility_flags): Don't declare here.
* flag-types.h (struct visibility_flags): Don't declare here.
	* flags.h (strip_off_ending, fast_math_flags_set_p,
	fast_math_flags_struct_set_p): Declare here.
	(visibility_options): Don't declare here.
	* opts-common.c (option_enabled, get_option_state): Move from
	opts.c.
	* opts-global.c: Include diagnostic.h instead of
	diagnostic-core.h.  Include tree.h, langhooks.h, lto-streamer.h
	and toplev.h.
	(const_char_p, ignored_options, in_fnames, num_in_fnames,
	write_langs, complain_wrong_lang, postpone_unknown_option_warning,
	print_ignored_options, unknown_option_callback,
	post_handling_callback, lang_handle_option, add_input_filename,
	read_cmdline_options, initial_lang_mask, init_options_once,
	decode_cmdline_options_to_array_default_mask,
	set_default_handlers, decode_options): Move from opts.c.
	(print_ignored_options): Use warning_at instead of saving and
	restoring input_location.
	* opts.c: Include <signal.h> and <sys/resource.h>.  Include rtl.h
	instead of expr.h.  Don't include langhooks.h, except.h or
	lto-streamer.h.  Add more comments on includes.
	(strip_off_ending, setup_core_dumping, decode_d_option): Move from
	toplev.c.
	(visibility_options): Move to c-family/c-common.c.
	(const_char_p, ignored_options, in_fnames, num_in_fnames,
	write_langs, complain_wrong_lang, postpone_unknown_option_warning,
	print_ignored_options, unknown_option_callback,
	post_handling_callback, lang_handle_option, add_input_filename,
	read_cmdline_options, initial_lang_mask, init_options_once,
	decode_cmdline_options_to_array_default_mask,
	set_default_handlers, decode_options): Move to opts-global.c.
	(target_handle_option, default_options_optimization,
	finish_options, common_handle_option): Remove static.
	(option_enabled, get_option_state): Move to opts-common.c.
	* opts.h (common_handle_option, target_handle_option,
	finish_options, default_options_optimization): Declare.
	* toplev.c: Don't include <signal.h> or <sys/resource.h>.
	(setup_core_dumping, strip_off_ending, decode_d_option): Move to
	opts.c.
	* toplev.h (strip_off_ending, decode_d_option,
	fast_math_flags_set_p, fast_math_flags_struct_set_p): Don't
	declare here.
	* Makefile.in (opts.o, opts-global.o): Update dependencies.

c-family:
	* c-common.c (visibility_options): Move from ../opts.c.
	* c-common.h (struct visibility_flags, visibility_options):
	Declare here.
	* c-opts.c (finish_options): Rename to c_finish_options.
	(c_common_init): Update call to finish_options.

From-SVN: r167105
2010-11-24 00:51:48 +00:00
Joseph Myers 0576d21f39 common.opt (exit_after_options, [...]): New Variable entries.
* common.opt (exit_after_options, write_symbols, debug_info_level,
	use_gnu_debug_info_extensions): New Variable entries.
	(fprofile-dir=): Use Var.
	* flag-types.h (enum debug_info_level): Rename to enum
	debug_info_levels.
	* flags.h (write_symbols, debug_info_level,
	use_gnu_debug_info_extensions): Remove declarations.
	* opts.c (exit_after_options, write_symbols, debug_info_level):
	Remove.
	(set_struct_debug_option): Make static variables const.
	(use_gnu_debug_info_extensions): Remove.
	(set_debug_level, print_filtered_help, print_specific_help,
	fast_math_flags_set_p): Take gcc_options parameters and use them
	in place of global variables.
	(print_filtered_help): Make new_help non-static.
	(print_specific_help): Update call to print_filtered_help.
	(common_handle_option): Update calls to print_specific_help.  Use
	gcc_options structure for more settings.  Make --help table
	const.  Don't handle OPT_fprofile_dir_ here.  Update calls to
	set_debug_level.
	* toplev.c (profile_data_prefix): Remove.
	* toplev.h (profile_data_prefix, exit_after_options): Remove
	declarations.
	(fast_math_flags_set_p): Update prototype.
	* cppbuiltin.c (define_builtin_macros_for_compilation_flags):
	Update call to fast_math_flags_set_p.

objc:
	* objc-act.c (write_symbols): Don't declare here.

From-SVN: r167064
2010-11-22 23:59:18 +00:00
Joseph Myers 69ccdddbb8 common.opt (debug_struct_ordinary, [...]): New Variable entries.
* common.opt (debug_struct_ordinary, debug_struct_generic): New
	Variable entries.
	* dwarf2out.c (matches_main_base, dump_struct_debug, DUMP_GSTRUCT,
	should_emit_struct_debug): Move from opts.c.
	* flag-types.h (enum debug_struct_file): Move from opts.c.
	* flags.h (should_emit_struct_debug): Remove.
	(base_of_path): Declare.
	(set_struct_debug_option): Add gcc_options parameter.
	* optc-gen.awk, opth-gen.awk: Handle array variables.
	* opts.c (enum debug_struct_file, debug_struct_ordinary,
	debug_struct_generic): Remove.
	(set_struct_debug_option): Add gcc_options parameter.
	(base_of_path): Remove static.
	(main_input_basename, main_input_baselength, matches_main_base,
	dump_struct_debug, DUMP_GSTRUCT, should_emit_struct_debug):
	Remove.
	* toplev.c (main_input_basename, main_input_baselength): Define
	here.
	* toplev.h (main_input_basename, main_input_baselength): Declare
	here.

c-family:
	* c-opts.c (c_common_handle_option): Update calls to
	set_struct_debug_option.

From-SVN: r166944
2010-11-19 13:30:38 +00:00
Richard Guenther 1694907238 tree.def (FMA_EXPR): New tree code.
2010-11-04  Richard Guenther  <rguenther@suse.de>
	Richard Henderson  <rth@redhat.com>

	* tree.def (FMA_EXPR): New tree code.
	* expr.c (expand_expr_real_2): Add FMA_EXPR expansion code.
	* gimple.c (gimple_rhs_class_table): FMA_EXPR is a GIMPLE_TERNARY_RHS.
	* tree-cfg.c (verify_gimple_assign_ternary): Verify FMA_EXPR types.
	* tree-inline.c (estimate_operator_cost): Handle FMA_EXPR.
	* gimple-pretty-print.c (dump_ternary_rhs): Likewise.
	* tree-ssa-math-opts.c (convert_mult_to_fma): New function.
	(execute_optimize_widening_mul): Call it.  Reorganize to allow
	dead stmt removal.  Move TODO flags ...
	(pass_optimize_widening_mul): ... here.
	* flag-types.h (enum fp_contract_mode): New enum.
	* common.opt (flag_fp_contract_mode): New variable.
	(-ffp-contract): New option.
	* opts.c (common_handle_option): Handle it.
	* doc/invoke.texi (-ffp-contract): Document.
	* tree.h (fold_fma): Declare.
	* builtins.c (fold_fma): New function.
	(fold_builtin_fma): Likewise.
	(fold_builtin_3): Call it for fma.
	* fold-const.c (fold_ternary_loc): Fold FMA_EXPR.
	* optabs.c (optab_for_tree_code): Handle FMA_EXPR.
	* config/i386/sse.md (fms<mode>4, fnma<mode>, fnms<mode>4):
	New expanders.
	* doc/md.texi (fms<mode>4, fnma<mode>, fnms<mode>4): Document new
	named patterns.
	* genopinit.c (optabs): Initialize fms_optab, fnma_optab and fnms_optab.
	* optabs.h (enum optab_index): Add OTI_fms, OTI_fnma and OTI_fnms.
	(fms_optab, fnma_optab, fnms_optab): New defines.
	* gimplify.c (gimplify_expr): Handle binary truth expressions
	explicitly.  Handle FMA_EXPR.
	* tree-vect-stmts.c (vectorizable_operation): Handle ternary
	operations.

	* gcc.target/i386/fma4-vector-2.c: New testcase.

Co-Authored-By: Richard Henderson <rth@redhat.com>

From-SVN: r166304
2010-11-04 10:56:22 +00:00
Joseph Myers f938f60cb6 flag-types.h: New.
* flag-types.h: New.
	* Makefile.in (TH_H): Include $(OPTIONS_H) instead of $(FLAGS_H).
	(FLAGS_H): Include flag-types.h.  Include $(OPTIONS_H) instead of
	options.h.
	(OPTIONS_H): Define.
	(c-family/c-opts.o, lto-opts.o, opts.o): Use $(OPTIONS_H) instead
	of options.h.
	* configure.ac (tm_include_list): Include options.h not flags.h.
	* configure: Regenerate.
	* flags.h: Include flag-types.h.  Include options.h at top of file
	again.
	(enum debug_info_type, enum debug_info_level, enum
	debug_info_usage, enum symbol_visibility, struct visibility_flags,
	enum ira_algorithm, enum ira_region, enum excess_precision, enum
	graph_dump_types, enum stack_check_type, enum
	warn_strict_overflow_code): Move to flag-types.h
	* opth-gen.awk: Include flag-types.h in options.h.

ada:
	* gcc-interface/Make-lang.in (ada/misc.o): Use $(OPTIONS_H)
	instead of options.h.

java:
	* Make-lang.in (java/lang.o): Use $(OPTIONS_H) instead of
	options.h.

From-SVN: r165362
2010-10-12 12:25:16 +01:00