aboutsummaryrefslogtreecommitdiff
path: root/gcc/opts.c
AgeCommit message (Collapse)AuthorFilesLines
2015-11-23libsanitizer merge from upstream r253555, compiler part.Max Ostapenko1-4/+1
gcc/ * opts.c (finish_options): Allow -fsanitize-recover=address for userspace sanitization. * asan.c (asan_expand_check_ifn): Redefine recover_p. * doc/invoke.texi (fsanitize-recover): Update documentation. gcc/testsuite/ * c-c++-common/asan/halt_on_error-1.c: New test. * c-c++-common/asan/halt_on_error-2.c: Likewise. From-SVN: r230741
2015-11-17Extend tree-call-cdce to calls whose result is usedRichard Sandiford1-1/+1
For -fmath-errno, builtins.c currently expands calls to sqrt to: y = sqrt_optab (x); if (y != y) [ sqrt (x); or errno = EDOM; ] The drawbacks of this are: - the call to sqrt is protected by the result of the optab rather than the input. It would be better to check __builtin_isless (x, 0), like tree-call-cdce.c does. - the branch isn't exposed at the gimple level and so gets little high-level optimisation. - we do this for log too, but for log a zero input produces -inf rather than a NaN, and sets errno to ERANGE rather than EDOM. This patch moves the code to tree-call-cdce.c instead, with the optab operation being represented as an internal function. This means that we can use the existing argument-based range checks rather than the result-based checks and that we get more gimple optimisation of the branch. Previously the pass was only enabled by default at -O2 or above, but the old builtins.c code was enabled at -O. The patch therefore enables the pass at -O as well. The previous patch to cfgexpand.c handled cases where functions don't (or are assumed not to) set errno, so this patch makes the builtins.c code dead. Tested on x86_64-linux-gnu, aarch64-linux-gnu, arm-linux-gnueabi and visium-elf (for the EDOM stuff). gcc/ * builtins.c (expand_errno_check, expand_builtin_mathfn) (expand_builtin_mathfn_2): Delete. (expand_builtin): Remove handling of functions with internal function equivalents. * internal-fn.def (SET_EDOM): New internal function. * internal-fn.h (set_edom_supported_p): Declare. * internal-fn.c (expand_SET_EDOM): New function. (set_edom_supported_p): Likewise. * tree-call-cdce.c: Include builtins.h and internal-fn.h. Rewrite comment at head of file. (is_call_dce_candidate): Rename to... (can_test_argument_range): ...this. Don't check gimple_call_lhs or gimple_call_builtin_p here. (edom_only_function): New function. (shrink_wrap_one_built_in_call_with_conds): New function, split out from... (shrink_wrap_one_built_in_call): ...here. (can_use_internal_fn, use_internal_fn): New functions. (shrink_wrap_conditional_dead_built_in_calls): Call use_internal_fn for calls that have an lhs. (pass_call_cdce::gate): Remove optimize_function_for_speed_p check. (pass_call_cdce::execute): Skip blocks that are optimized for size. Check gimple_call_builtin_p here. Use can_use_internal_fn for calls with an lhs. * opts.c (default_options_table): Enable -ftree-builtin-call-cdce at -O and above. From-SVN: r230488
2015-11-13[Patch,tree-optimization]: Add new path Splitting pass on tree ssaAjit Agarwal1-0/+1
representation * Makefile.in (OBJS): Add gimple-ssa-split-paths.o * common.opt (-fsplit-paths): New flag controlling path splitting. * doc/invoke.texi (fsplit-paths): Document. * opts.c (default_options_table): Add -fsplit-paths to -O2. * passes.def: Add split_paths pass. * timevar.def (TV_SPLIT_PATHS): New timevar. * tracer.c: Include "tracer.h" (ignore_bb_p): No longer static. (transform_duplicate): New function, broken out of tail_duplicate. (tail_duplicate): Use transform_duplicate. * tracer.h (ignore_bb_p): Declare (transform_duplicate): Likewise. * tree-pass.h (make_pass_split_paths): Declare. * gimple-ssa-split-paths.c: New file. * gcc.dg/tree-ssa/split-path-1.c: New test. Co-Authored-By: Jeff Law <law@redhat.com> From-SVN: r230364
2015-11-12Fix big memory leak in ix86_valid_target_attribute_pMartin Liska1-1/+15
* config/i386/i386.c (ix86_valid_target_attribute_p): Finalize options at the of the function. * gcc.c (driver_get_configure_time_options): Call newly introduced init_opts_obstack. * lto-wrapper.c (main): Likewise. * opts.c (init_opts_obstack): New function. (init_options_struct): Call newly introduced init_opts_obstack. * opts.h (init_options_struct): Declare. From-SVN: r230264
2015-10-21Improve --help output to generate references to option aliases.Martin Sebor1-3/+43
gcc/ PR driver/68043 * opts.c (undocumented_msg, use_diagnosed_msg): New globals. (print_filtered_help): Reference aliased option's name and encourage readers to use it in preference to the alias if the former is not documented. Mention when using an option is diagnosed. * gcc.c (display_help): End each sentence with a period. * ada/gcc-interface/lang.opt: End each sentence that describes an option with a period. * c-family/c.opt: Same. * common.opt: Same. * config/aarch64/aarch64.opt: Same. * config/alpha/alpha.opt: Same. * config/arc/arc.opt: Same. * config/arm/arm.opt: Same. * config/avr/avr.opt: Same. * config/bfin/bfin.opt: Same. * config/c6x/c6x.opt: Same. * config/cr16/cr16.opt: Same. * config/cris/cris.opt: Same. * config/cris/linux.opt: Same. * config/darwin.opt: Same. * config/epiphany/epiphany.opt: Same. * config/fr30/fr30.opt: Same. * config/frv/frv.opt: Same. * config/ft32/ft32.opt: Same. * config/g.opt: Same. * config/h8300/h8300.opt: Same. * config/i386/cygming.opt: Same. * config/i386/djgpp.opt: Same. * config/i386/i386.opt: Same. * config/i386/interix.opt: Same. * config/i386/mingw-w64.opt: Same. * config/i386/mingw.opt: Same. * config/ia64/ia64.opt: Same. * config/ia64/ilp32.opt: Same. * config/iq2000/iq2000.opt: Same. * config/linux.opt: Same. * config/lm32/lm32.opt: Same. * config/lynx.opt: Same. * config/m32c/m32c.opt: Same. * config/m32r/m32r.opt: Same. * config/m68k/ieee.opt: Same. * config/m68k/m68k.opt: Same. * config/mcore/mcore.opt: Same. * config/mep/mep.opt: Same. * config/microblaze/microblaze.opt: Same. * config/mips/mips.opt: Same. * config/mmix/mmix.opt: Same. * config/mn10300/mn10300.opt: Same. * config/moxie/moxie.opt: Same. * config/msp430/msp430.opt: Same. * config/nios2/elf.opt: Same. * config/nios2/nios2.opt: Same. * config/nvptx/nvptx.opt: Same. * config/pa/pa-hpux.opt: Same. * config/pa/pa-hpux1010.opt: Same. * config/pa/pa-hpux1111.opt: Same. * config/pa/pa-hpux1131.opt: Same. * config/pa/pa.opt: Same. * config/pa/pa64-hpux.opt: Same. * config/pdp11/pdp11.opt: Same. * config/rl78/rl78.opt: Same. * config/rs6000/476.opt: Same. * config/rs6000/aix64.opt: Same. * config/rs6000/darwin.opt: Same. * config/rs6000/linux64.opt: Same. * config/rs6000/rs6000.opt: Same. * config/rs6000/sysv4.opt: Same. * config/s390/s390.opt: Same. * config/s390/tpf.opt: Same. * config/sh/sh.opt: Same. * config/sol2.opt: Same. * config/sparc/long-double-switch.opt: Same. * config/sparc/sparc.opt: Same. * config/spu/spu.opt: Same. * config/stormy16/stormy16.opt: Same. * config/tilegx/tilegx.opt: Same. * config/tilepro/tilepro.opt: Same. * config/v850/v850.opt: Same. * config/vax/vax.opt: Same. * config/visium/visium.opt: Same. * config/vms/vms.opt: Same. * config/vxworks.opt: Same. * config/xtensa/xtensa.opt: Same. * fortran/lang.opt: Same. testsuite/ PR driver/68043 * gcc.misc-tests/help.exp: Adjust. * lib/options.exp (check_for_options): Add detail to output. From-SVN: r229155
2015-10-21unconditionally compile most of the delay slot codeTrevor Saunders1-1/+1
gcc/ChangeLog: 2015-10-21 Trevor Saunders <tbsaunde+gcc@tbsaunde.org> * cfgrtl.c (pass_free_cfg::execute): Adjust. * final.c (dbr_sequence_length): Always define. (shorten_branches): Adjust. * genattr-common.c (main): Always define DELAY_SLOTS. * genattr.c (main): Unconditionally declare functions and define macros related to delay slots. * genattrtab.c (write_eligible_delay): Adjust. (main): Always write out delay slot functions. * opts.c (default_options_table): Adjust. * reorg.c (redirect_with_delay_slots_safe_p): Likewise. (redirect_with_delay_list_safe_p): Likewise. (fill_simple_delay_slots): Likewise. (fill_slots_from_thread): Likewise. (make_return_insns): Likewise. (dbr_schedule): Likewise. (rest_of_handle_delay_slots): Likewise. (pass_delay_slots::gate): Likewise. * toplev.c (process_options): Likewise. From-SVN: r229145
2015-10-13Support DEFPARAMENUM in params.defTom de Vries1-6/+13
2015-10-13 Tom de Vries <tom@codesourcery.com> * Makefile.in (PARAMS_H, PLUGIN_HEADERS): Add params-enum.h. * params-enum.h: New file. * opts.c (handle_param): Handle case that param arg is a string. * params-list.h: Handle DEFPARAMENUM5 in params.def. * params.c (find_param): New function, factored out of ... (set_param_value): ... here. (param_string_value_p): New function. * params.h (struct param_info): Add value_names field. (find_param, param_string_value_p): Declare. From-SVN: r228755
2015-10-01bb-reorder: Add -freorder-blocks-algorithm= and wire it upSegher Boessenkool1-1/+3
This adds an -freorder-blocks-algorithm=[simple|stc] flag, with "simple" as default. For -O2 and up (except -Os) it is switched to "stc" instead. Targets that never want STC can override this. This changes -freorder-blocks to be on at -O1 and up (was -O2 and up). In effect, the changes are for -O1 (which now gets "simple" instead of nothing), -Os (which now gets "simple" instead of "stc", since STC results in much bigger code), and for targets that wish to never use STC (not in this patch though). 2015-09-23 Segher Boessenkool <segher@kernel.crashing.org> * bb-reorder.c (reorder_basic_blocks): Use the algorithm selected with flag_reorder_blocks_algorithm. * common.opt (freorder-blocks-algorithm=): New flag. (reorder_blocks_algorithm): New enum. * flag-types.h (reorder_blocks_algorithm): New enum. * opts.c (default_options_table): Use -freorder-blocks at -O1 and up, and -freorder-blocks-algorithm=stc at -O2 and up (not at -Os). From-SVN: r228318
2015-09-25This patch unsets -freorder-blocks-and-partition when -fprofile-use is not ↵Teresa Johnson1-0/+10
specified. This patch unsets -freorder-blocks-and-partition when -fprofile-use is not specified. Function splitting was not actually being performed in that case, as probably_never_executed_bb_p does not distinguish any basic blocks as being cold vs hot when there is no profile data. Leaving it enabled, however, causes the assembly code generator to create (empty) cold sections and labels, leading to unnecessary size overhead. 2015-09-25 Teresa Johnson <tejohnson@google.com> * opts.c (finish_options): Unset -freorder-blocks-and-partition if not using profile. From-SVN: r228136
2015-09-24fdiagnostics-color=never does not disable color for some diagnosticsManuel López-Ibáñez1-3/+4
Actually, I was trying to reject non-warning options as argument to -Werror=. However, the new test fails because -fdiagnostics-color=never is always placed by the driver after the warning options when calling the compiler proper. This patch prunes all -fdiagnostics-color from the command-line but the last one, which is moved to the first position. gcc/ChangeLog: 2015-09-24 Manuel López-Ibáñez <manu@gcc.gnu.org> PR driver/67640 * opts-common.c (prune_options): Discard all -fdiagnostics-color but the last one, which is moved to the front to be processed first. * opts.c (enable_warning_as_error): Reject options that do not control warnings. gcc/testsuite/ChangeLog: 2015-09-24 Manuel López-Ibáñez <manu@gcc.gnu.org> PR driver/67640 * gcc.dg/Werror-13.c: New test. From-SVN: r228094
2015-08-19common.opt (fstack-protector): Initialize to -1.Magnus Granberg1-0/+5
* common.opt (fstack-protector): Initialize to -1. (fstack-protector-all): Likewise. (fstack-protector-strong): Likewise. (fstack-protector-explicit): Likewise. * configure.ac: Add --enable-default-ssp. * defaults.h (DEFAULT_FLAG_SSP): New. Default SSP to strong. * opts.c (finish_options): Update opts->x_flag_stack_protect if it is -1. * doc/install.texi: Document --enable-default-ssp. * config.in: Regenerated. * configure: Likewise. * lib/target-supports.exp (check_effective_target_fstack_protector_enabled): New test. * gcc.target/i386/ssp-default.c: New test. From-SVN: r227017
2015-08-14[PR64164] Drop copyrename, use coalescible partition as base when optimizing.Alexandre Oliva1-1/+1
for gcc/ChangeLog PR rtl-optimization/64164 PR bootstrap/66978 PR middle-end/66983 PR rtl-optimization/67000 PR middle-end/67034 PR middle-end/67035 * Makefile.in (OBJS): Drop tree-ssa-copyrename.o. * tree-ssa-copyrename.c: Removed. * opts.c (default_options_table): Drop -ftree-copyrename. Add -ftree-coalesce-vars. * passes.def: Drop all occurrences of pass_rename_ssa_copies. * common.opt (ftree-copyrename): Ignore. (ftree-coalesce-inlined-vars): Likewise. * doc/invoke.texi: Remove the ignored options above. * gimple-expr.h (gimple_can_coalesce_p): Move declaration * tree-ssa-coalesce.h: ... here. * tree-ssa-uncprop.c: Include tree-ssa-coalesce.h and other headers required by it. * gimple-expr.c (gimple_can_coalesce_p): Allow coalescing across variables when flag_tree_coalesce_vars. Check register use and promoted modes to allow coalescing. Do not coalesce maybe-byref parms with SSA_NAMEs of other variables, or anonymous SSA_NAMEs. Moved to tree-ssa-coalesce.c. * tree-ssa-live.c (struct tree_int_map_hasher): Move along with its member functions to tree-ssa-coalesce.c. (var_map_base_init): Likewise. Renamed to compute_samebase_partition_bases. (partition_view_normal): Drop want_bases parameter. (partition_view_bitmap): Likewise. * tree-ssa-live.h: Adjust declarations. * tree-ssa-coalesce.c: Include explow.h and cfgexpand.h. (build_ssa_conflict_graph): Process PARM_ and RESULT_DECLs's default defs at the entry point. (dump_part_var_map): New. (compute_optimized_partition_bases): New, called by... (coalesce_ssa_name): ... when flag_tree_coalesce_vars, instead of compute_samebase_partition_bases. Adjust. * alias.c (nonoverlapping_memrefs_p): Disregard gimple-regs. * cfgexpand.c (leader_merge, parm_maybe_byref_p): New. (ssa_default_def_partition): New. (get_rtl_for_parm_ssa_default_def): New. (align_local_variable, add_stack_var): Support anonymous SSA names. (defer_stack_allocation): Likewise. Declare earlier. (set_rtl): Merge exprs and attrs, even for MEMs and non-SSA vars. Update DECL_RTL for PARM_DECLs and RESULT_DECLs too. Do no record deferred-allocation marker in SA.partition_to_pseudo. (expand_stack_vars): Adjust check for the marker in it. (expand_one_stack_var_at): Handle anonymous SSA_NAMEs. Drop redundant MEM attr setting. (expand_one_stack_var_1): Handle anonymous SSA_NAMEs. Renamed from... (expand_one_stack_var): ... this. New wrapper to check and skip already expanded SSA partitions. (record_alignment_for_reg_var): New, factored out of... (expand_one_var): ... this. (expand_one_ssa_partition): New. (adjust_one_expanded_partition_var): New. (expand_one_register_var): Check and skip already expanded SSA partitions. (expand_used_vars): Don't create DECLs for anonymous SSA names. Expand all SSA partitions, then adjust all SSA names. (pass::execute): Replace the loops that set SA.partition_to_pseudo from partition leaders and cleared DECL_RTL for multi-location variables, and that which used to rename vars and set attrs, with one that clears DECL_RTL and checks that PARMs and RESULTs default_defs match DECL_RTL. * cfgexpand.h (get_rtl_for_parm_ssa_default_def): Declare. * emit-rtl.c: Include stor-layout.h. (set_reg_attrs_for_parm): Handle NULL decl. (set_reg_attrs_for_decl_rtl): Take mode from expression if it's not a DECL. * stmt.c (emit_case_decision_tree): Pass it the SSA_NAME rather than its possibly-NULL DECL. * explow.c (promote_ssa_mode): New. * explow.h (promote_ssa_mode): Declare. * expr.c (expand_expr_real_1): Handle anonymous SSA_NAMEs. (read_complex_part): Export. * expr.h (read_complex_part): Declare. * cfgexpand.h (parm_maybe_byref_p): Declare. * function.c: Include cfgexpand.h. (use_register_for_decl): Handle SSA_NAMEs, anonymous or not. (use_register_for_parm_decl): Wrapper for the above to special-case the result_ptr. (rtl_for_parm): Ditto for get_rtl_for_parm_ssa_default_def. (split_complex_args): Take assign_parm_data_all argument. Pass it to rtl_for_parm. Set up rtl and context for split args. Reset complex parm before fetching its default decl rtl. (assign_parms_unsplit_complex): Use the default-def complex parm rtl if it matches the components. (assign_parms_augmented_arg_list): Adjust. (maybe_reset_rtl_for_parm): Reset DECL_RTL of parms with multiple locations. Recognize split complex args. (assign_parm_adjust_stack_rtl): Add all and parm arguments, for rtl_for_parm. For SSA-assigned parms, zero stack_parm. (assign_parm_setup_block): Prefer SSA-assigned location, and fill in its address if the memory location of a maybe-byref parm was not assigned by cfgexpand. (assign_parm_setup_reg): Likewise. Adjust its mode as needed. Use entry_parm for equiv if stack_parm is NULL. Make sure passed_pointer parms don't need conversion. Copy address or value as needed. (assign_parm_setup_stack): Prefer SSA-assigned location. (assign_parms): Maybe reset DECL_RTL of params. Adjust stack rtl before testing for pointer bounds. Special-case result_ptr. (expand_function_start): Maybe reset DECL_RTL of result. Prefer SSA-assigned location for result and static chain. Factor out DECL_RESULT and SET_DECL_RTL. Convert static chain to Pmode if needed, from H.J. Lu <hongjiu.lu@intel.com>. * tree-outof-ssa.c (insert_value_copy_on_edge): Handle anonymous SSA names. Use promote_ssa_mode. (get_temp_reg): Likewise. (remove_ssa_form): Adjust. * stor-layout.c (layout_decl): Don't set mem attributes of non-MEMs. * var-tracking.c (dataflow_set_clear_at_call): Take call_insn and get its reg_usage for reg invalidation. (compute_bb_dataflow): Pass it insn. (emit_notes_in_bb): Likewise. for gcc/testsuite/ChangeLog * gcc.dg/guality/pr54200.c: Add -fno-tree-coalesce-vars. * gcc.dg/ssp-1.c: Make counter a register. * gcc.dg/ssp-2.c: Likewise. * gcc.dg/torture/parm-coalesce.c: New. From-SVN: r226901
2015-08-14Add DWARF2_LINENO_DEBUGGING_INFO, and use it for nvptxThomas Schwinge1-1/+1
gcc/ * config/nvptx/nvptx.c (nvptx_option_override): Don't override debug options. * config/nvptx/nvptx.h (DWARF2_LINENO_DEBUGGING_INFO): Define. (DWARF2_DEBUGGING_INFO): Don't define. * debug.h (dwarf2_lineno_debug_hooks): Declare. * toplev.c (process_options): Add a case for it. * dwarf2out.c (dwarf2_lineno_debug_hooks): New variable. (dwarf2out_init): Skip most initializations if DWARF2_LINENO_DEBUGGING_INFO, but set cur_line_info_table in that case. * defaults.h (PREFERRED_DEBUGGING_TYPE): Also use DWARF2_DEBUG if DWARF2_LINENO_DEBUGGING_INFO. * opts.c (set_debug_level): Likewise. Co-Authored-By: Bernd Schmidt <bernds@codesourcery.com> From-SVN: r226890
2015-07-24Revert:David Edelsohn1-1/+1
2015-07-23 Alexandre Oliva <aoliva@redhat.com> From-SVN: r226202
2015-07-23[PR64164] Drop copyrename, use coalescible partition as base when optimizing.Alexandre Oliva1-1/+1
for gcc/ChangeLog PR rtl-optimization/64164 * Makefile.in (OBJS): Drop tree-ssa-copyrename.o. * tree-ssa-copyrename.c: Removed. * opts.c (default_options_table): Drop -ftree-copyrename. Add -ftree-coalesce-vars. * passes.def: Drop all occurrences of pass_rename_ssa_copies. * common.opt (ftree-copyrename): Ignore. (ftree-coalesce-inlined-vars): Likewise. * doc/invoke.texi: Remove the ignored options above. * gimple-expr.h (gimple_can_coalesce_p): Move declaration * tree-ssa-coalesce.h: ... here. * tree-ssa-uncprop.c: Include tree-ssa-coalesce.h and other headers required by it. * gimple-expr.c (gimple_can_coalesce_p): Allow coalescing across variables when flag_tree_coalesce_vars. Check register use and promoted modes to allow coalescing. Moved to tree-ssa-coalesce.c. * tree-ssa-live.c (struct tree_int_map_hasher): Move along with its member functions to tree-ssa-coalesce.c. (var_map_base_init): Likewise. Renamed to compute_samebase_partition_bases. (partition_view_normal): Drop want_bases parameter. (partition_view_bitmap): Likewise. * tree-ssa-live.h: Adjust declarations. * tree-ssa-coalesce.c: Include explow.h. (build_ssa_conflict_graph): Process PARM_ and RESULT_DECLs's default defs at the entry point. (dump_part_var_map): New. (compute_optimized_partition_bases): New, called by... (coalesce_ssa_name): ... when flag_tree_coalesce_vars, instead of compute_samebase_partition_bases. Adjust. * alias.c (nonoverlapping_memrefs_p): Disregard gimple-regs. * cfgexpand.c (leader_merge): New. (get_rtl_for_parm_ssa_default_def): New. (set_rtl): Merge exprs and attrs, even for MEMs and non-SSA vars. Update DECL_RTL for PARM_DECLs and RESULT_DECLs too. (expand_one_stack_var_at): Handle anonymous SSA_NAMEs. Drop redundant MEM attr setting. (expand_one_stack_var_1): Handle anonymous SSA_NAMEs. Renamed from... (expand_one_stack_var): ... this. New wrapper to check and skip already expanded SSA partitions. (record_alignment_for_reg_var): New, factored out of... (expand_one_var): ... this. (expand_one_ssa_partition): New. (adjust_one_expanded_partition_var): New. (expand_one_register_var): Check and skip already expanded SSA partitions. (expand_used_vars): Don't create DECLs for anonymous SSA names. Expand all SSA partitions, then adjust all SSA names. (pass::execute): Replace the loops that set SA.partition_to_pseudo from partition leaders and cleared DECL_RTL for multi-location variables, and that which used to rename vars and set attrs, with one that clears DECL_RTL and checks that PARMs and RESULTs default_defs match DECL_RTL. * cfgexpand.h (get_rtl_for_parm_ssa_default_def): Declare. * emit-rtl.c (set_reg_attrs_for_parm): Handle NULL decl. * explow.c (promote_ssa_mode): New. * explow.h (promote_ssa_mode): Declare. * expr.c (expand_expr_real_1): Handle anonymous SSA_NAMEs. * function.c: Include cfgexpand.h. (use_register_for_decl): Handle SSA_NAMEs, anonymous or not. (use_register_for_parm_decl): Wrapper for the above to special-case the result_ptr. (rtl_for_parm): Ditto for get_rtl_for_parm_ssa_default_def. (split_complex_args): Take assign_parm_data_all argument. Pass it to rtl_for_parm. Set up rtl and context for split args. (assign_parms_augmented_arg_list): Adjust. (maybe_reset_rtl_for_parm): Reset DECL_RTL of parms with multiple locations. Recognize split complex args. (assign_parm_adjust_stack_rtl): Add all and parm arguments, for rtl_for_parm. For SSA-assigned parms, zero stack_parm. (assign_parm_setup_block): Prefer SSA-assigned location. (assign_parm_setup_reg): Likewise. Use entry_parm for equiv if stack_parm is NULL. (assign_parm_setup_stack): Prefer SSA-assigned location. (assign_parms): Maybe reset DECL_RTL of params. Adjust stack rtl before testing for pointer bounds. Special-case result_ptr. (expand_function_start): Maybe reset DECL_RTL of result. Prefer SSA-assigned location for result and static chain. Factor out DECL_RESULT and SET_DECL_RTL. * tree-outof-ssa.c (insert_value_copy_on_edge): Handle anonymous SSA names. Use promote_ssa_mode. (get_temp_reg): Likewise. (remove_ssa_form): Adjust. * stor-layout.c (layout_decl): Don't set mem attributes of non-MEMs. * var-tracking.c (dataflow_set_clear_at_call): Take call_insn and get its reg_usage for reg invalidation. (compute_bb_dataflow): Pass it insn. (emit_notes_in_bb): Likewise. for gcc/testsuite/ChangeLog * gcc.dg/guality/pr54200.c: Add -fno-tree-coalesce-vars. * gcc.dg/ssp-1.c: Make counter a register. * gcc.dg/ssp-2.c: Likewise. * gcc.dg/torture/parm-coalesce.c: New. From-SVN: r226113
2015-07-15opth-gen.awk: Check for UNKNOWN_LOCATION rather than GCC_TM_H, don't include ↵Andrew MacLeod1-4/+1
input.h. 2015-07-15 Andrew MacLeod <amacleod@redhat.com> * opth-gen.awk: Check for UNKNOWN_LOCATION rather than GCC_TM_H, don't include input.h. * opts.c: Remove multiline #include comment. 2015-07-15 Andrew MacLeod <amacleod@redhat.com> * java/expr.c: Remove multiline #include comment. 2015-07-15 Andrew MacLeod <amacleod@redhat.com> * fortran/trans-types.c: Remove multiline #include comment. 2015-07-15 Andrew MacLeod <amacleod@redhat.com> * c-family/c-opts.c: Remove multiline #include comment. From-SVN: r225846
2015-06-10Revert "[PR64164] Drop copyrename, use coalescible partition as base when ↵Alexandre Oliva1-1/+1
optimizing." This reverts commit c66acc7cedd89bfd22124caec44b8427c9082dac. Conflicts: gcc/ChangeLog gcc/testsuite/ChangeLog From-SVN: r224310
2015-06-09[PR64164] Drop copyrename, use coalescible partition as base when optimizing.Alexandre Oliva1-1/+1
for gcc/ChangeLog PR rtl-optimization/64164 * Makefile.in (OBJS): Drop tree-ssa-copyrename.o. * tree-ssa-copyrename.c: Removed. * opts.c (default_options_table): Drop -ftree-copyrename. Add -ftree-coalesce-vars. * passes.def: Drop all occurrences of pass_rename_ssa_copies. * common.opt (ftree-copyrename): Ignore. (ftree-coalesce-inlined-vars): Likewise. * doc/invoke.texi: Remove the ignored options above. * gimple-expr.h (gimple_can_coalesce_p): Move declaration * tree-ssa-coalesce.h: ... here. * tree-ssa-uncprop.c: Include tree-ssa-coalesce.h and other headers required by it. * gimple-expr.c (gimple_can_coalesce_p): Allow coalescing across variables when flag_tree_coalesce_vars. Check register use and promoted modes to allow coalescing. Moved to tree-ssa-coalesce.c. * tree-ssa-live.c (struct tree_int_map_hasher): Move along with its member functions to tree-ssa-coalesce.c. (var_map_base_init): Likewise. Renamed to compute_samebase_partition_bases. (partition_view_normal): Drop want_bases parameter. (partition_view_bitmap): Likewise. * tree-ssa-live.h: Adjust declarations. * tree-ssa-coalesce.c: Include explow.h. (build_ssa_conflict_graph): Process PARM_ and RESULT_DECLs's default defs at the entry point. (dump_part_var_map): New. (compute_optimized_partition_bases): New, called by... (coalesce_ssa_name): ... when flag_tree_coalesce_vars, instead of compute_samebase_partition_bases. Adjust. * alias.c (nonoverlapping_memrefs_p): Disregard gimple-regs. * cfgexpand.c (leader_merge): New. (get_rtl_for_parm_ssa_default_def): New. (set_rtl): Merge exprs and attrs, even for MEMs and non-SSA vars. Update DECL_RTL for PARM_DECLs and RESULT_DECLs too. (expand_one_stack_var_at): Handle anonymous SSA_NAMEs. Drop redundant MEM attr setting. (expand_one_stack_var_1): Handle anonymous SSA_NAMEs. Renamed from... (expand_one_stack_var): ... this. New wrapper to check and skip already expanded SSA partitions. (record_alignment_for_reg_var): New, factored out of... (expand_one_var): ... this. (expand_one_ssa_partition): New. (adjust_one_expanded_partition_var): New. (expand_one_register_var): Check and skip already expanded SSA partitions. (expand_used_vars): Don't create DECLs for anonymous SSA names. Expand all SSA partitions, then adjust all SSA names. (pass::execute): Replace the loops that set SA.partition_to_pseudo from partition leaders and cleared DECL_RTL for multi-location variables, and that which used to rename vars and set attrs, with one that clears DECL_RTL and checks that PARMs and RESULTs default_defs match DECL_RTL. * cfgexpand.h (get_rtl_for_parm_ssa_default_def): Declare. * emit-rtl.c (set_reg_attrs_for_parm): Handle NULL decl. * explow.c (promote_ssa_mode): New. * explow.h (promote_ssa_mode): Declare. * expr.c (expand_expr_real_1): Handle anonymous SSA_NAMEs. * function.c: Include cfgexpand.h. (use_register_for_decl): Handle SSA_NAMEs, anonymous or not. (use_register_for_parm_decl): Wrapper for the above to special-case the result_ptr. (rtl_for_parm): Ditto for get_rtl_for_parm_ssa_default_def. (maybe_reset_rtl_for_parm): Reset DECL_RTL of parms with multiple locations. (assign_parm_adjust_stack_rtl): Add all and parm arguments, for rtl_for_parm. For SSA-assigned parms, zero stack_parm. (assign_parm_setup_block): Prefer SSA-assigned location. (assign_parm_setup_reg): Likewise. Use entry_parm for equiv if stack_parm is NULL. (assign_parm_setup_stack): Prefer SSA-assigned location. (assign_parms): Maybe reset DECL_RTL of params. Adjust stack rtl before testing for pointer bounds. Special-case result_ptr. (expand_function_start): Maybe reset DECL_RTL of result. Prefer SSA-assigned location for result and static chain. Factor out DECL_RESULT and SET_DECL_RTL. * tree-outof-ssa.c (insert_value_copy_on_edge): Handle anonymous SSA names. Use promote_ssa_mode. (get_temp_reg): Likewise. (remove_ssa_form): Adjust. * var-tracking.c (dataflow_set_clear_at_call): Take call_insn and get its reg_usage for reg invalidation. (compute_bb_dataflow): Pass it insn. (emit_notes_in_bb): Likewise. * tree-ssa-loop-niter.c (loop_exits_before_overflow): Don't fail assert on conversion between unsigned types. for gcc/testsuite/ChangeLog * gcc.dg/guality/pr54200.c: Add -fno-tree-coalesce-vars. * gcc.dg/ssp-1.c: Make counter a register. * gcc.dg/ssp-2.c: Likewise. * gcc.dg/torture/parm-coalesce.c: New. From-SVN: r224262
2015-05-27Add --enable-default-pie option to GCC configureH.J. Lu1-0/+9
Add --enable-default-pie option to configure GCC to generate PIE by default. gcc/ * Makefile.in (COMPILER): Add @NO_PIE_CFLAGS@. (BUILD_CFLAGS): Likewise. (BUILD_CXXFLAGS): Likewise. (LINKER): Add @NO_PIE_FLAG@. (BUILD_LDFLAGS): Likewise. (libgcc.mvars): Set NO_PIE_CFLAGS to -fno-PIE for --enable-default-pie. * common.opt (fPIE): Initialize to -1. (fpie): Likewise. (no-pie): New option. (pie): Replace "Negative(shared)" with "Negative(no-pie)". * configure.ac: Add --enable-default-pie. (NO_PIE_CFLAGS): New. Check if -fno-PIE works. AC_SUBST. (NO_PIE_FLAG): New. Check if -no-pie works. AC_SUBST. * defaults.h (DEFAULT_FLAG_PIE): New. Default PIE to -fPIE. * gcc.c (NO_PIE_SPEC): New. (PIE_SPEC): Likewise. (NO_FPIE1_SPEC): Likewise. (FPIE1_SPEC): Likewise. (NO_FPIE2_SPEC): Likewise. (FPIE2_SPEC): Likewise. (NO_FPIE2_SPEC): Likewise. (FPIE_SPEC): Likewise. (NO_FPIE_SPEC): Likewise. (NO_FPIC1_SPEC): Likewise. (FPIC1_SPEC): Likewise. (NO_FPIC2_SPEC): Likewise. (FPIC2_SPEC): Likewise. (NO_FPIC2_SPEC): Likewise. (FPIC_SPEC): Likewise. (NO_FPIC_SPEC): Likewise. (NO_FPIE1_AND_FPIC1_SPEC): Likewise. (FPIE1_OR_FPIC1_SPEC): Likewise. (NO_FPIE2_AND_FPIC2_SPEC): Likewise. (FPIE2_OR_FPIC2_SPEC): Likewise. (NO_FPIE_AND_FPIC_SPEC): Likewise. (FPIE_OR_FPIC_SPEC): Likewise. (LD_PIE_SPEC): Likewise. (LINK_PIE_SPEC): Handle -no-pie. Use PIE_SPEC and LD_PIE_SPEC. * opts.c (finish_options): Update opts->x_flag_pie if it is -1. * config/darwin.h (PIE_SPEC): Renamed to ... (DARWIN_PIE_SPEC): This. (LINK_SPEC): Replace PIE_SPEC with DARWIN_PIE_SPEC. * config/darwin9.h (PIE_SPEC): Renamed to ... (DARWIN_PIE_SPEC): This. * config/gnu-user.h (GNU_USER_TARGET_STARTFILE_SPEC): Use PIE_SPEC and NO_PIE_SPEC if HAVE_LD_PIE is defined. * config/openbsd.h (ASM_SPEC): Use FPIE1_OR_FPIC1_SPEC and FPIE2_OR_FPIC2_SPEC. * config/m68k/netbsd-elf.h (ASM_SPEC): Likewise. * config/m68k/openbsd.h (ASM_SPEC): Likewise. * gcc/config/sol2.h (ASM_PIC_SPEC): Likewise. * config/arm/freebsd.h (SUBTARGET_EXTRA_ASM_SPEC): Likewise. * config/arm/netbsd-elf.h (SUBTARGET_EXTRA_ASM_SPEC): Likewise. * config/arm/semi.h (SUBTARGET_EXTRA_ASM_SPEC): Likewise. * config/cris/linux.h (CRIS_ASM_SUBTARGET_SPEC): Likewise. * config/m32r/m32r.h (ASM_SPEC): Likewise. * config/m68k/uclinux.h (DRIVER_SELF_SPECS): Likewise. * config/rs6000/linux64.h (ASM_SPEC32): Likewise. * config/rs6000/sysv4.h (ASM_SPEC): Likewise. * config/sparc/freebsd.h (ASM_SPEC): Likewise. * config/sparc/linux.h (ASM_SPEC): Likewise. * config/sparc/linux64.h (ASM_SPEC): Likewise. * config/sparc/netbsd-elf.h (ASM_SPEC): Likewise. * config/sparc/openbsd64.h (ASM_SPEC): Likewise. * config/sparc/sp-elf.h (ASM_SPEC): Likewise. * config/sparc/sp64-elf.h (ASM_SPEC): Likewise. * config/sparc/sparc.h (ASM_SPEC): Likewise. * config/sparc/sysv4.h (ASM_SPEC): Likewise. * config/sparc/vxworks.h (ASM_SPEC): Likewise. * config/c6x/elf-common.h (ASM_SPEC): Use NO_FPIC2_SPEC, FPIC2_SPEC, FPIC1_SPEC and FPIC2_SPEC. * config/c6x/uclinux-elf.h (LINK_SPEC): Use FPIE_SPEC. * config/frv/frv.h (DRIVER_SELF_SPECS): Use FPIC_SPEC, NO_FPIC_SPEC and NO_FPIE1_AND_FPIC1_SPEC. (ASM_SPEC): Use FPIE1_OR_FPIC1_SPEC and FPIE2_OR_FPIC2_SPEC. * config/m68k/m68k.h (ASM_PCREL_SPEC): Use FPIC_SPEC and NO_FPIC_SPEC. * config/mips/gnu-user.h (NO_SHARED_SPECS): Use NO_FPIE_AND_FPIC_SPEC. * config/mips/vxworks.h (SUBTARGET_ASM_SPEC): Use FPIC_SPEC. * config/rs6000/freebsd64.h (ASM_SPEC32): Likewise. * config/rs6000/vxworks.h (ASM_SPEC): Likewise. * config/vax/linux.h (ASM_SPEC): Likewise. * doc/install.texi: Document --enable-default-pie. * doc/invoke.texi: Document -no-pie. * config.in: Regenerated. * configure: Likewise. gcc/ada/ * gcc-interface/Makefile.in (TOOLS_LIBS): Add @NO_PIE_FLAG@. libgcc/ * Makefile.in (CRTSTUFF_CFLAGS): Add $(NO_PIE_CFLAGS). From-SVN: r223796
2015-05-18dbgcnt: enhance behavior.Martin Liska1-0/+4
* dbgcnt.def: Sort counters. * opts.c (common_handle_option): Do not compile if -fdbg-cnt-list is enabled. From-SVN: r223287
2015-05-07c-ubsan.c (ubsan_instrument_bounds): Don't skip instrumenting flexible ↵Marek Polacek1-0/+2
member array-like members if... * c-ubsan.c (ubsan_instrument_bounds): Don't skip instrumenting flexible member array-like members if SANITIZE_BOUNDS_STRICT. * doc/invoke.texi: Document -fsanitize=bounds-strict. * flag-types.h (enum sanitize_code): Add SANITIZE_BOUNDS_STRICT, or it into SANITIZE_NONDEFAULT. * opts.c (common_handle_option): Handle -fsanitize=bounds-strict. * c-c++-common/ubsan/bounds-10.c: New test. From-SVN: r222871
2015-04-30Fix spurious semicolonsDavid Malcolm1-1/+1
gcc/ChangeLog: * builtins.c (fold_builtin_1): Remove spurious second semicolon. * cgraph.h (symtab_node::get_availability): Likewise. * opts.c (common_handle_option): Remove spurious second semicolon. * tree-ssa-loop-ivopts.c (extract_cond_operands): Likewise. * tree-ssa-loop-niter.c (derive_constant_upper_bound_ops): Likewise. gcc/cp/ChangeLog: * cp-tree.h (ARGUMENT_PACK_SELECT_ARG): Remove spurious trailing semicolon. gcc/fortran/ChangeLog: * options.c (gfc_init_options): Remove spurious second semicolon. * trans-stmt.c (gfc_trans_allocate): Likewise. From-SVN: r222658
2015-02-17Add -fipa-cp-alignmentH.J. Lu1-0/+4
This patch adds -fipa-cp-alignment to provide a way to enable/disable alignment discovery and propagation in IPA-CP. gcc/ * common.opt (fipa-cp-alignment): New. * ipa-cp.c (ipcp_store_alignment_results): Check flag_ipa_cp_alignment. * opts.c (default_options_table): Enable -fipa-cp-alignment for -O2. (enable_fdo_optimizations): Set x_flag_ipa_cp_alignment. * doc/invoke.texi: Document -fipa-cp-alignment. gcc/testsuite/ * gcc.dg/ipa/propalign-3.c: New test. From-SVN: r220773
2015-02-12tree-sra.c (dump_dereferences_table): Avoid -Wformat-security warning.David Howells1-2/+2
* tree-sra.c (dump_dereferences_table): Avoid -Wformat-security warning. * tree-ssa-uninit.c (dump_predicates): Likewise. * opts.c (print_filtered_help): Likewise. From-SVN: r220662
2015-01-30Always pass explicit location to fatal_error.Joseph Myers1-2/+3
The patch <https://gcc.gnu.org/ml/gcc-patches/2014-11/msg00698.html> adding an overload for fatal_error that passes an explicit location broke gcc.pot regeneration because xgettext cannot handle function overloads with the diagnostic string argument in different positions. As the desired direction is for all diagnostics to have explicit locations, this patch addresses the regression by removing the version of fatal_error that does not pass a location, passing explicit input_location everywhere (in the hope that those will incrementally be changed to other locations, much as with the addition of a location argument to pedwarn some time ago - a lot of cases aren't meaningfully associated with a source file so UNKNOWN_LOCATION may be better). Note that this patch does not attempt to fix any existing issues with these diagnostics (such as wrongly starting with capital letters or ending with '.' or '\n'); it just adds the input_location argument. Bootstrapped with no regressions for x86_64-unknown-linux-gnu (Go excluded). gcc: * diagnostic.c (fatal_error (const char *, ...)): Remove function. * diagnostic-core.h (fatal_error (const char *, ...)): Remove prototype. * toplev.h (init_asm_output): Update comment on use of UNKNOWN_LOCATION with fatal_error. * cgraph.c, collect-utils.c, collect2.c, config/arc/arc.c, config/arc/arc.md, config/avr/avr.c, config/c6x/c6x.h, config/darwin.c, config/host-darwin.c, config/i386/host-cygwin.c, config/i386/intelmic-mkoffload.c, config/nios2/nios2.c, config/nvptx/mkoffload.c, config/nvptx/nvptx.h, config/rs6000/host-darwin.c, config/rs6000/rs6000.c, config/s390/s390.c, gcc.c, gcov-io.h, gcov-tool.c, ggc-common.c, ggc-page.c, graph.c, ipa-inline-analysis.c, ipa-reference.c, lto-cgraph.c, lto-section-in.c, lto-streamer-in.c, lto-streamer.c, lto-wrapper.c, objc/objc-act.c, opts.c, passes.c, plugin.c, tlink.c, toplev.c, tree-streamer-in.c, varpool.c: All callers of fatal_error changed to pass input_location as first argument. gcc/c-family: * c-opts.c, c-pch.c, cppspec.c: All callers of fatal_error changed to pass input_location as first argument. gcc/cp: * class.c, except.c, parser.c, pt.c: All callers of fatal_error changed to pass input_location as first argument. gcc/fortran: * f95-lang.c, gfortranspec.c, trans-const.c, trans-expr.c: All callers of fatal_error changed to pass input_location as first argument. gcc/java: * class.c, expr.c, jcf-parse.c, jvspec.c: All callers of fatal_error changed to pass input_location as first argument. gcc/lto: * lto-object.c, lto-symtab.c, lto.c: All callers of fatal_error changed to pass input_location as first argument. libcc1: * plugin.cc: All callers of fatal_error changed to pass input_location as first argument. From-SVN: r220293
2015-01-15flag-types.h (enum sanitize_code): Add SANITIZE_VPTR, include SANITIZE_VPTR ↵Jakub Jelinek1-0/+1
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-06opts.c (common_handle_option): Add support for -fno-sanitize=all and ↵Jakub Jelinek1-1/+10
-f{,no-}sanitize-recover=all. * opts.c (common_handle_option): Add support for -fno-sanitize=all and -f{,no-}sanitize-recover=all. * doc/invoke.texi: Document -fno-sanitize=all, -f{,no-}sanitize-recover=all. Document that -fsanitize=float-cast-overflow is not enabled by -fsanitize=undefined. Fix up documentation of -f{,no-}sanitize-recover. * c-c++-common/asan/sanitize-all-1.c: New test. * c-c++-common/ubsan/sanitize-all-1.c: New test. * c-c++-common/ubsan/sanitize-all-2.c: New test. * c-c++-common/ubsan/sanitize-all-3.c: New test. * c-c++-common/ubsan/sanitize-all-4.c: New test. From-SVN: r219241
2015-01-05Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r219188
2014-12-11diagnostic.c (get_terminal_width): Renamed fromTobias Burnus1-12/+2
2014-12-11 Tobias Burnus <burnus@net-b.de> Manuel López-Ibáñez <manu@gcc.gnu.org> gcc/ * diagnostic.c (get_terminal_width): Renamed from * getenv_columns, removed static, and additionally use ioctl to get width. (diagnostic_set_caret_max_width): Update call. * diagnostic.h (get_terminal_width): Add prototype. * opts.c (print_specific_help): Use it for x_help_columns. * doc/invoke.texi (fdiagnostics-show-caret): Document how the width is set. gcc/fortran/ * error.c (gfc_get_terminal_width): Renamed from get_terminal_width and use same-named common function. (gfc_error_init_1): Update call. Co-Authored-By: Manuel López-Ibáñez <manu@gcc.gnu.org> From-SVN: r218619
2014-12-04diagnostic.c (diagnostic_color_init): New.Manuel López-Ibáñez1-3/+1
gcc/ChangeLog: 2014-12-04 Manuel López-Ibáñez <manu@gcc.gnu.org> * diagnostic.c (diagnostic_color_init): New. * diagnostic.h: Declare. * gcc.c (driver::global_initializations): Use it. (driver_handle_option): Handle -fdiagnostics-color_. * toplev.c: Do not include diagnostic-color.h. (process_options): Do not initialize color diagnostics here. * common.opt (fdiagnostics-color=): Add Driver. * opts-global.c (init_options_once): Initialize color here. * opts.c (common_handle_option): Use diagnostics_color_init. * diagnostic-color.h: Fix comment. From-SVN: r218406
2014-12-03Rename fuse-caller-saveTom de Vries1-1/+1
2014-12-03 Tom de Vries <tom@codesourcery.com> PR rtl-optimization/63957 * doc/invoke.texi: Replace -fuse-caller-save with -fipa-ra. * final.c (rest_of_handle_final): Replace flag_use_caller_save with flag_ipa_ra. (get_call_reg_set_usage): Same. * lra-assigns.c (lra_assign): Same. * lra-constraints.c (need_for_call_save_p): Same. * lra-lives.c (process_bb_lives): Same. * lra.c (lra): Same. * calls.c (expand_call): Same. (emit_library_call_value_1): Same. * config/arm/arm.c (arm_option_override): Same. * opts.c (default_options_table): Replace OPT_fuse_caller_save with OPT_fipa_ra. * target.def (call_fusage_contains_non_callee_clobbers): Replace fuse-caller-save with fipa-ra. * doc/tm.texi (TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS): Same. * common.opt: Same. * gcc.dg/ira-shrinkwrap-prep-1.c: Replace -fno-use-caller-save with -fno-ipa-ra. * gcc.dg/ira-shrinkwrap-prep-2.c: Same. * gcc.target/aarch64/aapcs64/aapcs64.exp: Same. * gcc.dg/fuse-caller-save.c: Replace -fuse-caller-save with -fipa-ra. * gcc.target/aarch64/fuse-caller-save.c: Same. * gcc.target/arm/fuse-caller-save.c: Same. * gcc.target/i386/fuse-caller-save-rec.c: Same. * gcc.target/i386/fuse-caller-save-xmm-run.c: Same. * gcc.target/i386/fuse-caller-save-xmm.c: Same. * gcc.target/i386/fuse-caller-save.c: Same. * gcc.target/mips/fuse-caller-save-micromips.c: Same. * gcc.target/mips/fuse-caller-save-mips16.c: Same. * gcc.target/mips/fuse-caller-save.c: Same. * gcc.target/mips/mips.exp: Replace use-caller-save with ipa-ra in -ffoo/-fno-foo options. From-SVN: r218305
2014-11-26PR debug/38757 continued. Handle C11, C++11 and C++14.Mark Wielaard1-1/+1
Add experimental (minimal) DWARFv5 support. This change depends on the new DWARFv5 constants mentioned in the following draft: http://dwarfstd.org/doc/dwarf5.20141029.pdf gcc/ChangeLog * doc/invoke.texi (-gdwarf-@{version}): Mention experimental DWARFv5. * opts.c (common_handle_option): Accept -gdwarf-5. * dwarf2out.c (is_cxx): Add DW_LANG_C_plus_plus_11 and DW_LANG_C_plus_plus_14. (lower_bound_default): Likewise. Plus DW_LANG_C11. (gen_compile_unit_die): Output DW_LANG_C_plus_plus_11, DW_LANG_C_plus_plus_14 or DW_LANG_C11. (output_compilation_unit_header): Output at most a DWARFv4 header. (output_skeleton_debug_sections): Likewise. (output_line_info): Likewise. (output_aranges): Document header version number. gcc/testsuite/ChangeLog * gcc.dg/debug/dwarf2/lang-c11.c: New test. * gcc.dg/debug/dwarf2/lang-c11-d4-strict.c: Likewise. * g++.dg/debug/dwarf2/lang-cpp11.C: Likewise. * g++.dg/debug/dwarf2/lang-cpp14.C: Likewise. * g++.dg/debug/dwarf2/lang-cpp98.C: Likewise. include/ChangeLog * dwarf2.h: Add DW_LANG_C_plus_plus_11, DW_LANG_C11 and DW_LANG_C_plus_plus_14. From-SVN: r218077
2014-11-19PR jit/63854: Fix memory leak within gcc_optionsDavid Malcolm1-0/+8
gcc/ChangeLog: PR jit/63854 * opts.c (finalize_options_struct): New. * opts.h (finalize_options_struct): New. * toplev.c (toplev::finalize): Call finalize_options_struct on global_options and global_options_set. From-SVN: r217791
2014-11-18opts.c (finish_options): Disable aggressive opts for sanitizer.Marat Zakirov1-6/+13
gcc 2014-11-18 Marat Zakirov <m.zakirov@samsung.com> * opts.c (finish_options): Disable aggressive opts for sanitizer. (common_handle_option): Move code to finish_options. gcc/testsuite 2014-11-18 Marat Zakirov <m.zakirov@samsung.com> * c-c++-common/asan/aggressive-opts.c: New test. From-SVN: r217690
2014-11-13[PATCH 6/7] OpenMP 4.0 offloading infrastructure: option handling.Bernd Schmidt1-0/+11
gcc/ * common.opt (foffload, foffload-abi): New options. * config/i386/i386.c (ix86_offload_options): New static function. (TARGET_OFFLOAD_OPTIONS): Define. * coretypes.h (enum offload_abi): New enum. * doc/tm.texi: Regenerate. * doc/tm.texi.in (TARGET_OFFLOAD_OPTIONS): Document. * gcc.c (offload_targets): New static variable. (handle_foffload_option): New static function. (driver_handle_option): Handle OPT_foffload_. (driver::maybe_putenv_OFFLOAD_TARGETS): Set OFFLOAD_TARGET_NAMES according to offload_targets. * hooks.c (hook_charptr_void_null): New hook. * hooks.h (hook_charptr_void_null): Declare. * lto-opts.c: Include lto-section-names.h. (lto_write_options): Append options from target offload_options hook and store them to offload_lto section. Do not store target-specific, driver and diagnostic options in offload_lto section. * lto-wrapper.c (merge_and_complain): Handle OPT_foffload_ and OPT_foffload_abi_. (append_compiler_options, append_linker_options) (append_offload_options): New static functions. (compile_offload_image): Add new arguments with options. Call append_compiler_options and append_offload_options. (compile_images_for_offload_targets): Add new arguments with options. (find_and_merge_options): New static function. (run_gcc): Outline options handling into the new functions: find_and_merge_options, append_compiler_options, append_linker_options. * opts.c (common_handle_option): Don't handle OPT_foffload_. Forbid OPT_foffload_abi_ for non-offload compiler. * target.def (offload_options): New target hook. Co-Authored-By: Andrey Turetskiy <andrey.turetskiy@intel.com> Co-Authored-By: Ilya Verbin <ilya.verbin@intel.com> From-SVN: r217493
2014-11-13common.opt (flra-remat): New.Vladimir Makarov1-0/+1
2014-11-12 Vladimir Makarov <vmakarov@redhat.com> * common.opt (flra-remat): New. * opts.c (default_options_table): Add entry for flra_remat. * timevar_def (TV_LRA_REMAT): New. * doc/invoke.texi (-flra-remat): Add description of the new option. * doc/passes.texi (-flra-remat): Remove lra-equivs.c and lra-saves.c. Add lra-remat.c. * Makefile.in (OBJS): Add lra-remat.o. * lra-remat.c: New file. * lra.c: Add info about the rematerialization pass in the top comment. (collect_non_operand_hard_regs, add_regs_to_insn_regno_info): Process unallocatable regs too. (lra_constraint_new_insn_uid_start): Remove. (lra): Add code for calling rematerialization sub-pass. * lra-int.h (lra_constraint_new_insn_uid_start): Remove. (lra_constrain_insn, lra_remat): New prototypes. (lra_eliminate_regs_1): Add parameter. * lra-lives.c (make_hard_regno_born, make_hard_regno_dead): Process unallocatable hard regs too. (process_bb_lives): Ditto. * lra-spills.c (remove_pseudos): Add argument to lra_eliminate_regs_1 call. * lra-eliminations.c (lra_eliminate_regs_1): Add parameter. Use it for sp offset calculation. (lra_eliminate_regs): Add argument for lra_eliminate_regs_1 call. (eliminate_regs_in_insn): Add parameter. Use it for sp offset calculation. (process_insn_for_elimination): Add argument for eliminate_regs_in_insn call. * lra-constraints.c (get_equiv_with_elimination): Add argument for lra_eliminate_regs_1 call. (process_addr_reg): Add parameter. Use it. (process_address_1): Ditto. Add argument for process_addr_reg call. (process_address): Ditto. (curr_insn_transform): Add parameter. Use it. Add argument for process_address calls. (lra_constrain_insn): New function. (lra_constraints): Add argument for curr_insn_transform call. From-SVN: r217458
2014-11-13opts-global.c (postpone_unknown_option_warning): Fix spelling.Manuel López-Ibáñez1-4/+4
2014-11-13 Manuel López-Ibáñez <manu@gcc.gnu.org> * opts-global.c (postpone_unknown_option_warning): Fix spelling. (print_ignored_options): Fix quoting. * opts.c (common_handle_option): Likewise. (set_debug_level): Likewise. * toplev.c (process_options): Likewise. From-SVN: r217457
2014-10-28Enable -fsanitize-recover for KASan.Yury Gribov1-1/+3
2014-10-28 Yury Gribov <y.gribov@samsung.com> gcc/ * asan.c (report_error_func): Add noabort path. (check_func): Ditto. Formatting. (asan_expand_check_ifn): Handle noabort path. * common.opt (flag_sanitize_recover): Add SANITIZE_KERNEL_ADDRESS to default value. * doc/invoke.texi (-fsanitize-recover=): Mention KASan. * opts.c (finish_options): Reword comment. * sanitizer.def: Add noabort ASan builtins. gcc/testsuite/ * c-c++-common/asan/kasan-recover-1.c: New test. * c-c++-common/asan/kasan-recover-2.c: New test. * c-c++-common/asan/instrument-with-calls-1.c: Get rid of -save-temps. * c-c++-common/asan/instrument-with-calls-2.c: Likewise. * c-c++-common/asan/instrument-with-calls-3.c: Likewise. * c-c++-common/asan/kasan-recover-1.c: Likewise. * c-c++-common/asan/kasan-recover-2.c: Likewise. * c-c++-common/asan/no-asan-globals.c: Likewise. * c-c++-common/asan/no-instrument-reads.c: Likewise. * c-c++-common/asan/no-instrument-writes.c: Likewise. * c-c++-common/asan/no-use-after-return.c: Likewise. From-SVN: r216778
2014-10-28Allow to override Asan shadow offset.Yury Gribov1-0/+4
2014-10-28 Yury Gribov <y.gribov@samsung.com> gcc/ * asan.c (set_asan_shadow_offset): New function. (asan_shadow_offset): Likewise. (asan_emit_stack_protection): Call asan_shadow_offset. (build_shadow_mem_access): Likewise. * asan.h (set_asan_shadow_offset): Declare. * common.opt (fasan-shadow-offset): New option. (frandom-seed): Fixed parameter name. * doc/invoke.texi (fasan-shadow-offset): Describe new option. (frandom-seed): Fixed parameter name. * opts-global.c (handle_common_deferred_options): Handle -fasan-shadow-offset. * opts.c (common_handle_option): Likewise. gcc/testsuite/ * c-c++-common/asan/shadow-offset-1.c: New test. From-SVN: r216773
2014-10-22New syntax for -fsanitize-recover.Jakub Jelinek1-15/+42
2014-10-22 Jakub Jelinek <jakub@redhat.com> Yury Gribov <y.gribov@samsung.com> gcc/ * common.opt (flag_sanitize_recover): New variable. (fsanitize-recover): Remove Var/Init, deprecate. (fsanitize-recover=): New option. * doc/invoke.texi (fsanitize-recover): Update docs. * opts.c (finish_options): Use opts->x_flag_sanitize instead of flag_sanitize. Prohibit -fsanitize-recover for anything besides UBSan. Formatting. (common_handle_option): Handle OPT_fsanitize_recover_ and OPT_fsanitize_recover. Use opts->x_flag_sanitize instead of flag_sanitize. * asan.c (pass_sanopt::execute): Fix up formatting. * ubsan.c (ubsan_expand_bounds_ifn, ubsan_expand_null_ifn, ubsan_expand_objsize_ifn, ubsan_build_overflow_builtin, instrument_bool_enum_load, ubsan_instrument_float_cast, instrument_nonnull_arg, instrument_nonnull_return): Check bits in flag_sanitize_recover bitmask instead of flag_sanitize_recover as bool flag. gcc/c-family/ * c-ubsan.c (ubsan_instrument_division, ubsan_instrument_shift, ubsan_instrument_vla): Check bits in flag_sanitize_recover bitmask instead of flag_sanitize_recover as bool flag. gcc/testsuite/ * c-c++-common/ubsan/align-1.c: Update cmdline options. * c-c++-common/ubsan/align-3.c: Likewise. * c-c++-common/ubsan/bounds-1.c: Likewise. * c-c++-common/ubsan/div-by-zero-7.c: Likewise. * c-c++-common/ubsan/float-cast-overflow-10.c: Likewise. * c-c++-common/ubsan/float-cast-overflow-7.c: Likewise. * c-c++-common/ubsan/float-cast-overflow-8.c: Likewise. * c-c++-common/ubsan/float-cast-overflow-9.c: Likewise. * c-c++-common/ubsan/nonnull-2.c: Likewise. * c-c++-common/ubsan/nonnull-3.c: Likewise. * c-c++-common/ubsan/object-size-3.c: Likewise. * c-c++-common/ubsan/overflow-1.c: Likewise. * c-c++-common/ubsan/overflow-add-1.c: Likewise. * c-c++-common/ubsan/overflow-add-3.c: Likewise. * c-c++-common/ubsan/overflow-mul-1.c: Likewise. * c-c++-common/ubsan/overflow-mul-3.c: Likewise. * c-c++-common/ubsan/overflow-negate-2.c: Likewise. * c-c++-common/ubsan/overflow-sub-1.c: Likewise. * c-c++-common/ubsan/pr59503.c: Likewise. * c-c++-common/ubsan/pr60613-1.c: Likewise. * c-c++-common/ubsan/save-expr-1.c: Likewise. * c-c++-common/ubsan/shift-3.c: Likewise. * c-c++-common/ubsan/shift-6.c: Likewise. * c-c++-common/ubsan/undefined-1.c: Likewise. * c-c++-common/ubsan/vla-2.c: Likewise. * c-c++-common/ubsan/vla-3.c: Likewise. * c-c++-common/ubsan/vla-4.c: Likewise. * g++.dg/ubsan/cxx11-shift-1.C: Likewise. * g++.dg/ubsan/return-2.C: Likewise. * c-c++-common/ubsan/recovery-1.c: New test. * c-c++-common/ubsan/recovery-2.c: New test. * c-c++-common/ubsan/recovery-3.c: New test. * c-c++-common/ubsan/recovery-common.inc: New file. Co-Authored-By: Yury Gribov <y.gribov@samsung.com> From-SVN: r216552
2014-10-21Add AutoFDO.Dehao Chen1-38/+62
gcc/ChangeLog: 2014-10-21 Dehao Chen <dehao@google.com> * auto-profile.c: New file. * auto-profile.h: New file. * basic-block.h (maybe_hot_count_p): New export func. (add_working_set): New export func. * gcov-io.h (GCOV_TAG_AFDO_FILE_NAMES): New tag. (GCOV_TAG_AFDO_FUNCTION): Likewise. (GCOV_TAG_AFDO_WORKING_SET): Likewise. * opts.c (enable_fdo_optimizations): New func. (common_handle_option): Handle -fauto-profile flag. * ipa-inline.c (want_early_inline_function_p): Iterative-einline. (class pass_early_inline): Export early_inliner. (early_inliner): Likewise. (pass_early_inline::execute): Likewise. * ipa-inline.h (early_inliner): Likewise. * predict.c (maybe_hot_count_p): New export func. (counts_to_freqs): AutoFDO logic. (rebuild_frequencies): Likewise. * tree-profile.c (pass_ipa_tree_profile::gate): Likewise. * profile.c (add_working_set): New func. * Makefile.in (auto-profile.o): New object file. * passes.def (pass_ipa_auto_profile): New pass. * tree-ssa-live.c (remove_unused_scope_block_p): AutoFDO logic. * tree-pass.h (make_pass_ipa_auto_profile): New pass. * toplev.c (compile_file): AutoFDO logic. * doc/invoke.texi (-fauto-profile): New doc. * coverage.c (coverage_init): AutoFDO logic. * common.opt (-fauto-profile): New flag. * timevar.def (TV_IPA_AUTOFDO): New tag. * value-prof.c (gimple_alloc_histogram_value): New export func. (check_ic_target): Likewise. * value-prof.h (gimple_alloc_histogram_value): Likewise. (check_ic_target): Likewise. From-SVN: r216523
2014-10-17Temporary fix for PR63566.Martin Liska1-2/+2
* ipa-icf.c (sem_function::merge): Local flags are set to false to enforce equal calling convention to be used. * opts.c (common_handle_option): Indentation fix. From-SVN: r216386
2014-10-16IPA ICF pass, part 3/5Martin Liska1-0/+6
* Makefile.in: New object files included. * cgraph.c (cgraph_node::dump): New cgraph_node flag icf_merged is printed. (verify_edge_corresponds_to_fndecl): More sensitive verification of nodes that are merged by IPA ICF. * cgraph.h (cgraph_node::num_references): New function. * cgraphunit.c (cgraph_node::expand_thunk): White space fixed. * common.opt: New options ipa-icf, ipa-icf-functions and ipa-icf-variables introduced. * doc/invoke.texi: Documentation of new options introduced. * ipa-icf-gimple.c: New file. * ipa-icf-gimple.h: New file. * ipa-icf.c: New file. * ipa-icf.h: New file. * lto-cgraph.c (lto_output_node): Streaming of icf_merged flag added. (input_overwrite_node): Likewise. * lto-section-in.c: New icf section added. * lto-streamer.h (enum lto_section_type): Likewise. * opts.c (common_handle_option): New option added. * passes.def: New pass included. * timevar.def: Time variable for IPA ICF added. * tree-pass.h: New IPA ICF pass entry point added. Co-Authored-By: Jan Hubicka <hubicka@ucw.cz> From-SVN: r216305
2014-10-10asan.c (pass_sanopt::execute): Handle IFN_UBSAN_OBJECT_SIZE.Marek Polacek1-0/+2
* 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-09-30Make -Q --help print param defaults and min/max valuesAndi Kleen1-1/+10
Make -Q --help print the --param default, min, max values, similar to how it does print the defaults for other flags. This is useful to let a option auto tuner automatically query all needed information abourt gcc params (previously it needed to access the .def file in the source) gcc/: 2014-09-29 Andi Kleen <ak@linux.intel.com> * opts.c (print_filtered_help): Print --param min/max/default with -Q. From-SVN: r215704
2014-09-10flag-types.h (enum sanitize_code): Add SANITIZE_NONNULL_ATTRIBUTE and ↵Jakub Jelinek1-1/+7
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-03opts.c (default_options_optimization): Adjust max-combine-insns to 2 for -Og.Richard Biener1-0/+6
2014-09-03 Richard Biener <rguenther@suse.de> * opts.c (default_options_optimization): Adjust max-combine-insns to 2 for -Og. From-SVN: r214879
2014-08-01opts.c (common_handle_option): Handle -fsanitize=alignment.Jakub Jelinek1-0/+1
* 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-07-31cpp.texi (__SANITIZE_ADDRESS__): Updated description.Yury Gribov1-1/+37
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-15opts.c (default_options_table): Disable bit-ccp at -Og.Richard Biener1-1/+1
2014-07-15 Richard Biener <rguenther@suse.de> * opts.c (default_options_table): Disable bit-ccp at -Og. From-SVN: r212559