Commit Graph

1157 Commits

Author SHA1 Message Date
Jakub Jelinek a240da2d3a re PR c++/80534 (7.1 RC - internal compiler error: in finish_member_declaration, at cp/semantics.c:2963)
PR c++/80534
	* tree.c (type_cache_hasher::equal): Only compare
	TYPE_TYPELESS_STORAGE flag on non-aggregate element types.
	(build_array_type_1): Only hash TYPE_TYPELESS_STORAGE flag on
	non-aggregate element types.
	* tree.h (TYPE_TYPELESS_STORAGE): Fix comment typo, add more details
	about the flag on ARRAY_TYPEs in the comment, formatting fix.
c-family/
	* c-common.c (complete_array_type): Only hash TYPE_TYPELESS_STORAGE
	flag on non-aggregate element types.
testsuite/
	* g++.dg/other/pr80534-1.C: New test.
	* g++.dg/other/pr80534-2.C: New test.

From-SVN: r247337
2017-04-27 15:47:54 +02:00
Jakub Jelinek 8a59d4660c re PR middle-end/80423 (GC related -fcompare-debug failure)
PR middle-end/80423
	* tree.h (build_array_type): Add typeless_storage default argument.
	* tree.c (type_cache_hasher::equal): Also compare
	TYPE_TYPELESS_STORAGE flag for ARRAY_TYPEs.
	(build_array_type): Add typeless_storage argument, set
	TYPE_TYPELESS_STORAGE to it, if shared also hash it, and pass to
	recursive call.
	(build_nonshared_array_type): Adjust build_array_type_1 caller.
	(build_array_type): Likewise.  Add typeless_storage argument.
c-family/
	* c-common.c (complete_array_type): Preserve TYPE_TYPELESS_STORAGE.
cp/
	* tree.c (build_cplus_array_type): Call build_array_type
	with the intended TYPE_TYPELESS_STORAGE flag value, instead
	of calling build_array_type and modifying later TYPE_TYPELESS_STORAGE
	on the shared type.
testsuite/
	* g++.dg/other/pr80423.C: New test.

From-SVN: r247014
2017-04-20 11:18:02 +02:00
Jakub Jelinek 8487c9a550 re PR middle-end/79788 (ICE in expand_expr_real_2, at expr.c:9557)
PR middle-end/79788
	PR middle-end/80375
	* c-common.c (c_common_type_for_mode): Don't handle
	widest_*_literal_type_node here.
	c_common_signed_or_unsigned_type): Likewise.
	(c_common_nodes_and_builtins): Set widest_*_literal_type_node
	to *intTI_type_node or *intDI_type_node depending on whether
	TImode is supported by the target or not.

	* gcc.dg/pr79788-1.c: New test.
	* gcc.dg/pr79788-2.c: New test.

From-SVN: r246965
2017-04-18 15:15:46 +02:00
Martin Liska 3ee0fb02bb Evaluate a SAVE_EXPR before an UBSAN check (PR sanitizer/80350).
2017-04-10  Martin Liska  <mliska@suse.cz>

	PR sanitizer/80350
	* c-ubsan.c (ubsan_instrument_shift): Evaluate RHS before
	doing an UBSAN check.
2017-04-10  Martin Liska  <mliska@suse.cz>

	PR sanitizer/80350
	* c-c++-common/ubsan/pr80350.c: New test.

From-SVN: r246799
2017-04-10 07:29:29 +00:00
Jonathan Wakely 5764ee3c84 Fix numerous typos in comments
gcc:

	* alias.c (base_alias_check): Fix typo in comment.
	* cgraph.h (class ipa_polymorphic_call_context): Likewise.
	* cgraphunit.c (symbol_table::compile): Likewise.
	* collect2.c (maybe_run_lto_and_relink): Likewise.
	* config/arm/arm.c (arm_thumb1_mi_thunk): Likewise.
	* config/avr/avr-arch.h (avr_arch_info_t): Likewise.
	* config/avr/avr.c (avr_map_op_t): Likewise.
	* config/cr16/cr16.h (DATA_ALIGNMENT): Likewise.
	* config/epiphany/epiphany.c (TARGET_ARG_PARTIAL_BYTES): Likewise.
	* config/epiphany/epiphany.md (movcc): Likewise.
	* config/i386/i386.c (legitimize_pe_coff_extern_decl): Likewise.
	* config/m68k/m68k.c (struct _sched_ib, m68k_sched_variable_issue):
	Likewise.
	* config/mips/mips.c (mips_save_restore_reg): Likewise.
	* config/rx/rx.c (rx_is_restricted_memory_address): Likewise.
	* config/s390/s390.c (Z10_EARLYLOAD_DISTANCE): Likewise.
	* config/sh/sh.c (sh_rtx_costs): Likewise.
	* fold-const.c (fold_truth_andor): Likewise.
	* genautomata.c (collapse_flag): Likewise.
	* gengtype.h (struct type::u::s): Likewise.
	* gensupport.c (has_subst_attribute, add_mnemonic_string): Likewise.
	* input.c (FORMAT_AMOUNT): Likewise.
	* ipa-cp.c (class ipcp_lattice, agg_replacements_to_vector)
	(known_aggs_to_agg_replacement_list): Likewise.
	* ipa-inline-analysis.c: Likewise.
	* ipa-inline.h (estimate_edge_time, estimate_edge_hints): Likewise.
	* ipa-polymorphic-call.c
	(ipa_polymorphic_call_context::restrict_to_inner_class): Likewise.
	* loop-unroll.c (analyze_insn_to_expand_var): Likewise.
	* lra.c (lra_optional_reload_pseudos, lra_subreg_reload_pseudos):
	Likewise.
	* modulo-sched.c (apply_reg_moves): Likewise.
	* omp-expand.c (build_omp_regions_1): Likewise.
	* trans-mem.c (struct tm_wrapper_hasher): Likewise.
	* tree-ssa-loop-ivopts.c (may_eliminate_iv): Likewise.
	* tree-ssa-loop-niter.c (maybe_lower_iteration_bound): Likewise.
	* tree-vect-data-refs.c (vect_enhance_data_refs_alignment): Likewise.
	* value-prof.c: Likewise.
	* var-tracking.c (val_reset): Likewise.

gcc/ada:

	* doc/gnat_ugn/gnat_and_program_execution.rst: Fix typo.
	* g-socket.adb (To_Host_Entry): Fix typo in comment.
	* gnat_ugn.texi: Fix typo.
	* raise.c (_gnat_builtin_longjmp): Fix capitalization in comment.
	* s-stposu.adb (Allocate_Any_Controlled): Fix typo in comment.
	* sem_ch3.adb (Build_Derived_Record_Type): Likewise.
	* sem_util.adb (Mark_Coextensions): Likewise.
	* sem_util.ads (Available_Full_View_Of_Component): Likewise.

gcc/c:

	* c-array-notation.c: Fix typo in comment.

gcc/c-family:

	* c-warn.c (do_warn_double_promotion): Fix typo in comment.

gcc/cp:

        * class.c (update_vtable_entry_for_fn): Fix typo in comment.
	* decl2.c (one_static_initialization_or_destruction): Likewise.
	* name-lookup.c (store_bindings): Likewise.
	* parser.c (make_call_declarator): Likewise.
	* pt.c (check_explicit_specialization): Likewise.

gcc/testsuite:

	* g++.old-deja/g++.benjamin/scope02.C: Fix typo in comment.
	* gcc.dg/20031012-1.c: Likewise.
	* gcc.dg/ipa/ipcp-1.c: Likewise.
	* gcc.dg/torture/matrix-3.c: Likewise.
	* gcc.target/powerpc/ppc-spe.c: Likewise.
	* gcc.target/rx/zero-width-bitfield.c: Likewise.

libcpp:

	* include/line-map.h (LINEMAPS_MACRO_MAPS): Fix typo in comment.
	* lex.c (search_line_fast): Likewise.
	* pch.h (cpp_valid_state): Likewise.

libdecnumber:

	* decCommon.c (decFloatFromPackedChecked): Fix typo in comment.
	* decNumber.c (decNumberPower, decMultiplyOp): Likewise.

libgcc:

	* config/c6x/pr-support.c (__gnu_unwind_execute): Fix typo in comment.

libitm:

	* libitm_i.h (sutrct gtm_thread): Fix typo in comment.

From-SVN: r246664
2017-04-03 23:30:56 +01:00
Jakub Jelinek 6f3af35628 re PR sanitizer/79572 (reference binding to null pointer not reported with -fsanitize=undefined)
PR c++/79572
	* c-ubsan.h (ubsan_maybe_instrument_reference): Change argument to
	tree *.
	* c-ubsan.c (ubsan_maybe_instrument_reference): Likewise.  Handle
	not just NOP_EXPR to REFERENCE_TYPE, but also INTEGER_CST with
	REFERENCE_TYPE.

	* cp-gimplify.c (cp_genericize_r): Sanitize INTEGER_CSTs with
	REFERENCE_TYPE.  Adjust ubsan_maybe_instrument_reference caller
	for NOP_EXPR to REFERENCE_TYPE.

	* g++.dg/ubsan/null-8.C: New test.

From-SVN: r246621
2017-03-31 20:39:25 +02:00
David Malcolm f6a7a9d51c Fix description of Wendif-labels (PR documentation/78732)
gcc/c-family/ChangeLog:
	PR documentation/78732
	* c.opt (Wendif-labels): Fix description to refer to
	#else rather than #elif.

From-SVN: r246616
2017-03-31 14:24:27 +00:00
Jakub Jelinek af88f55707 re PR libstdc++/80251 (Is the is_aggregate meta function missing?)
PR libstdc++/80251
c-family/
	* c-common.h (enum rid): Add RID_IS_AGGREGATE.
	* c-common.c (c_common_reswords): Add __is_aggregate trait.
cp/
	* cp-tree.h (enum cp_trait_kind): Add CPTK_IS_AGGREGATE.
	* cxx-pretty-print.c (pp_cxx_trait_expression): Handle
	CPTK_IS_AGGREGATE.
	* semantics.c (trait_expr_value): Handle CPTK_IS_AGGREGATE.
	Remove extraneous parens.
	(finish_trait_expr): Handle CPTK_IS_AGGREGATE.
	* parser.c (cp_parser_primary_expression): Handle RID_IS_AGGREGATE.
	(cp_parser_trait_expr): Likewise.
testsuite/
	* g++.dg/ext/is_aggregate.C: New test.

From-SVN: r246609
2017-03-31 08:40:39 +02:00
Jakub Jelinek a9e4a1a56f re PR target/80162 (ICE on invalid code (address of register variable))
PR middle-end/80162
c-family/
	* c-common.c (c_common_mark_addressable_vec): Don't set
	TREE_ADDRESSABLE on DECL_HARD_REGISTER.
c/
	* c-tree.h (c_mark_addressable): Add array_ref_p argument.
	* c-typeck.c (c_mark_addressable): Likewise.  Look through
	VIEW_CONVERT_EXPR unless array_ref_p and VCE is from VECTOR_TYPE
	to ARRAY_TYPE.
	(build_array_ref): Pass true as array_ref_p to c_mark_addressable.
cp/
	* cp-tree.h (cxx_mark_addressable): Add array_ref_p argument.
	* typeck.c (cxx_mark_addressable): Likewise.  Look through
	VIEW_CONVERT_EXPR unless array_ref_p and VCE is from VECTOR_TYPE
	to ARRAY_TYPE.
	(cp_build_array_ref): Pass true as array_ref_p to cxx_mark_addressable.
testsuite/
	* c-c++-common/pr80162-1.c: New test.
	* c-c++-common/pr80162-2.c: New test.
	* c-c++-common/pr80162-3.c: New test.

From-SVN: r246512
2017-03-27 23:07:21 +02:00
Martin Sebor 3f01b620a7 PR c++/79548 - missing -Wunused-variable on a typedef'd variable in a function template
gcc/c-family/ChangeLog:

	PR c++/79548
	* c-common.c (set_underlying_type): Mark type used only when
	original del is declared unused.

gcc/testsuite/ChangeLog:

	PR c++/79548
	* g++.dg/warn/Wunused-var-26.C: New test.

From-SVN: r246335
2017-03-21 16:33:39 -06:00
David Malcolm 2f6f187a86 Simplify uses of "%<%s%>" to "%qs" (PR translation/79848)
gcc/c-family/ChangeLog:
	PR translation/79848
	* c-format.c (check_format_string): Simplify uses of "%<%s%>" to
	"%qs".

gcc/c/ChangeLog:
	PR translation/79848
	* c-decl.c (declspecs_add_type): Simplify uses of "%<%s%>" to
	"%qs".
	* c-parser.c (c_parser_oacc_shape_clause): Likewise.

gcc/cp/ChangeLog:
	PR translation/79848
	* decl.c (grokfndecl): Simplify uses of "%<%s%>" to "%qs".

gcc/ChangeLog:
	PR translation/79848
	* ipa-devirt.c (warn_types_mismatch): Simplify uses of "%<%s%>" to
	"%qs".
	* ipa-pure-const.c (suggest_attribute): Likewise.  Convert _
	to G_ to avoid double translation.

From-SVN: r246068
2017-03-11 01:57:11 +00:00
Martin Sebor 1d0cf89ab4 Fix up a couple of old ChangeLog entries.
From-SVN: r246065
2017-03-10 17:37:40 -07:00
David Malcolm a02fa80571 c-indentation.c: workaround xgettext limitation (PR c/79921)
gcc/c-family/ChangeLog:
	PR c/79921
	* c-indentation.c (warn_for_misleading_indentation): Remove parens
	from inform's message, so that xgettext can locate it.

From-SVN: r246045
2017-03-10 19:09:02 +00:00
Marek Polacek 822a132cfb re PR c++/79962 (ICE nonnull_check_p on a function template with a type-dependent attribute nonnull)
PR c++/79962
	PR c++/79984
	* c-attribs.c (handle_nonnull_attribute): Save the result of default
	conversion to the attribute list.

	* c-c++-common/nonnull-3.c: New test.
	* g++.dg/warn/Wnonnull3.C: New test.

From-SVN: r246016
2017-03-09 22:45:39 +00:00
Martin Liska bba81f1c84 Increment value instead of a pointer in ADA macro processing.
2017-03-09  Martin Liska  <mliska@suse.cz>

	* c-ada-spec.c (macro_length): Increment value instead of a pointer.

From-SVN: r245992
2017-03-09 09:20:59 +00:00
Jason Merrill 108154ff26 c.opt (Wnoexcept-type): New.
* c.opt (Wnoexcept-type): New.

gcc/cp/
	* mangle.c (mangle_decl): Check -Wnoexcept-type instead of
	-Wc++1z-compat.

From-SVN: r245894
2017-03-04 14:21:38 -05:00
Richard Biener eb0e7c34d7 re PR middle-end/79756 (ICE in execute_todo, at passes.c:2011)
2017-03-02  Richard Biener  <rguenther@suse.de>

	PR c/79756
	* c-common.c (c_common_mark_addressable_vec): Look through
	C_MAYBE_CONST_EXPR.

	* gcc.dg/vector-1.c: New testcase.

From-SVN: r245838
2017-03-02 11:44:16 +00:00
Martin Liska 9453ba0a0e Introduce =<number> for couple of options.
2017-02-28  Martin Liska  <mliska@suse.cz>

	* c.opt: Replace space with tabular for options of <number>
	type.
2017-02-28  Martin Liska  <mliska@suse.cz>

	* common.opt: Replace space with tabular for options of <number>
	type.
	* config/i386/i386.opt: Show <number> value for
	-mlarge-data-threshold.
	* opts.c (print_filtered_help): Do not display number in hexadecimal
	format.

From-SVN: r245789
2017-02-28 22:02:58 +00:00
Martin Liska 6a825afe90 Add tabulars for options with enum values.
2017-02-28  Martin Liska  <mliska@suse.cz>

	* common.opt: Fix --help=option -Q for options which are of
	an enum type.
2017-02-28  Martin Liska  <mliska@suse.cz>

	* c.opt: Fix --help=option -Q for options which are of
	an enum type.

From-SVN: r245788
2017-02-28 22:02:15 +00:00
Jakub Jelinek 4227c9adf0 re PR c++/79588 (ICE in warn_for_restrict with -Wrestrict)
PR c++/79588
c-family/
	* c-common.c (check_function_restrict): New function.
	(check_function_arguments): Add FNDECL argument.  Call
	check_function_restrict if -Wrestrict.
	* c-warn.c (warn_for_restrict): Remove ARGS argument, add ARGARRAY
	and NARGS.  Use auto_vec for ARG_POSITIONS, simplify.
	* c-common.h (check_function_arguments): Add FNDECL argument.
	(warn_for_restrict): Remove ARGS argument, add ARGARRAY and NARGS.
c/
	* c-parser.c (c_parser_postfix_expression_after_primary): Don't
	handle -Wrestrict here.
	* c-typeck.c (build_function_call_vec): Adjust
	check_function_arguments caller.
cp/
	* call.c (build_over_call): Call check_function_arguments even for
	-Wrestrict, adjust check_function_arguments caller.
	* parser.c (cp_parser_postfix_expression): Don't handle -Wrestrict
	here.
	* typeck.c (cp_build_function_call_vec): Adjust
	check_function_arguments caller.
testsuite/
	* g++.dg/warn/Wrestrict-1.C: New test.
	* g++.dg/warn/Wrestrict-2.C: New test.

From-SVN: r245719
2017-02-24 21:41:54 +01:00
Eric Botcazou 59909673d1 c-ada-spec.c (dump_ada_function_declaration): Add comment about the treatment of parameters with pointer-to-tagged type and...
c-family/
	* c-ada-spec.c (dump_ada_function_declaration): Add comment about the
	treatment of parameters with pointer-to-tagged type and tidy up.
	(print_ada_methods): Remove the special treatment of C++ static member
	functions.
ada/
	* gcc-interface/decl.c: Include demangle.h.
	(is_cplusplus_method): Return again true for a primitive operation
	only if it is dispatching.  For a subprogram with an interface name,
	call the demangler to get the number of C++ parameters and compare it
	with the number of Ada parameters.

From-SVN: r245700
2017-02-24 10:21:39 +00:00
Martin Liska 54dcd52676 instead of -Wnormalized=<options>
2017-02-22  Martin Liska  <mliska@suse.cz>

	* doc/invoke.texi: Replace inequality signs with square brackets
	for -Wnornalized.
2017-02-22  Martin Liska  <mliska@suse.cz>

	* c.opt: Replace inequality signs with square brackets
	for -Wnornalized.

From-SVN: r245659
2017-02-22 21:15:46 +00:00
Jakub Jelinek 00bc9de3fe re PR c++/79641 (ICE with const variable and attribute)
PR c++/79641
	* c-attribs.c (handle_mode_attribute): Use build_qualified_type to
	preserve quals.

	* c-c++-common/pr79641.c: New test.

From-SVN: r245632
2017-02-21 17:55:00 +01:00
Joseph Myers 97fcf7446c Restore DECIMAL_DIG macro to C99/C11 value.
By extending the set of floating types, TS 18661-3 thereby affected
the definition of DECIMAL_DIG, which is defined in terms of the
"widest supported floating type".  This is not conditional on whether
__STDC_WANT_IEC_60559_TYPES_EXT__ is defined when <float.h> is
included.

I raised this possible incompatibility with C11 (an implementation
should be able to conform simultaneously with C11, and with C11 + TS
18661) in DR#501.  This is not yet resolved, but the latest proposal
<http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2108.pdf> would
obsolete DECIMAL_DIG with the intention of limiting it to the C11
types (so making it equivalent to LDBL_DECIMAL_DIG).  (This proposal
is intended to go along with a corresponding change to TS 18661-3 to
avoid the new types and non-arithmetic interchange encodings affecting
the value of DECIMAL_DIG.)

To avoid releasing GCC 7 with a wider-than-C11 value of DECIMAL_DIG
and possibly reverting back to a C11 value in a future release, this
patch reverts back to the C11 value now.  If the proposed resolution
to DR#501 changes again so that DECIMAL_DIG *should* have a
wider-than-C11 value, we can move back to a wider-than-C11 value in
GCC 8.

Bootstrapped with no regressions on x86_64-pc-linux-gnu.

gcc/c-family:
	* c-cppbuiltin.c (builtin_define_float_constants): Define
	__DECIMAL_DIG__ to the value for long double.

gcc/testsuite:
	* gcc.dg/c11-float-2.c: New test.
	* gcc.dg/torture/float128-floath.c,
	gcc.dg/torture/float128x-floath.c,
	gcc.dg/torture/float16-floath.c, gcc.dg/torture/float32-floath.c,
	gcc.dg/torture/float32x-floath.c, gcc.dg/torture/float64-floath.c,
	gcc.dg/torture/float64x-floath.c: Do not test comparison of
	*_DECIMAL_DIG macros with DECIMAL_DIG.

From-SVN: r245555
2017-02-17 23:04:14 +00:00
Marek Polacek c7545f1cb3 re PR c/79515 (ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in do_warn_double_promotion, at c-family/c-warn.c:1867)
PR c/79515
	* c-warn.c (do_warn_double_promotion): Don't warn if an invalid
	conversion has occured.

	* gcc.dg/dfp/pr79515.c: New.

From-SVN: r245485
2017-02-15 16:14:19 +00:00
David Malcolm c2e8432763 Add "__RTL" to cc1
gcc/c-family/ChangeLog:
	* c-common.c (c_common_reswords): Add "__RTL".
	* c-common.h (enum rid): Add RID_RTL.

gcc/c/ChangeLog:
	* c-parser.c: Include "read-rtl-function.h" and
	"run-rtl-passes.h".
	(c_parser_declaration_or_fndef): Rename "gimple-pass-list" in
	grammar to gimple-or-rtl-pass-list.  Add rtl-function-definition
	production.  Update for renaming of field "gimple_pass" to
	"gimple_or_rtl_pass".  If __RTL was seen, call
	c_parser_parse_rtl_body.  Convert a timevar_push/pop pair
	to an auto_timevar, to cope with early exit.
	(c_parser_declspecs): Update RID_GIMPLE handling for renaming of
	field "gimple_pass" to "gimple_or_rtl_pass", and for renaming of
	c_parser_gimple_pass_list to c_parser_gimple_or_rtl_pass_list.
	Handle RID_RTL.
	(c_parser_parse_rtl_body): New function.
	* c-tree.h (enum c_declspec_word): Add cdw_rtl.
	(struct c_declspecs): Rename field "gimple_pass" to
	"gimple_or_rtl_pass".  Add field "rtl_p".
	* gimple-parser.c (c_parser_gimple_pass_list): Rename to...
	(c_parser_gimple_or_rtl_pass_list): ...this, updating accordingly.
	* gimple-parser.h (c_parser_gimple_pass_list): Rename to...
	(c_parser_gimple_or_rtl_pass_list): ...this.

gcc/ChangeLog:
	* cfg.c (original_copy_tables_initialized_p): New function.
	* cfg.h (original_copy_tables_initialized_p): New decl.
	* cfgrtl.c (relink_block_chain): Guard the call to
	free_original_copy_tables with a call to
	original_copy_tables_initialized_p.
	* cgraph.h (symtab_node::native_rtl_p): New decl.
	* cgraphunit.c (symtab_node::native_rtl_p): New function.
	(symtab_node::needed_p): Don't assert for early assembly output
	for __RTL functions.
	(cgraph_node::finalize_function): Set "force_output" for __RTL
	functions.
	(cgraph_node::analyze): Bail out early for __RTL functions.
	(analyze_functions): Update assertion to support __RTL functions.
	(cgraph_node::expand): Bail out early for __RTL functions.
	* final.c (rest_of_clean_state): Don't call delete_tree_ssa for
	__RTL functions.
	* function.h (struct function): Update comment for field
	"pass_startwith".
	* gimple-expr.c: Include "tree-pass.h".
	(gimple_has_body_p): Return false for __RTL functions.
	* Makefile.in (OBJS): Add run-rtl-passes.o.
	* pass_manager.h (gcc::pass_manager::get_rest_of_compilation): New
	accessor.
	(gcc::pass_manager::get_clean_slate): New accessor.
	* passes.c: Include "insn-addr.h".
	(should_skip_pass_p): Add logging.  Update logic for running
	"expand" to be compatible with both __GIMPLE and __RTL.  Guard
	property-provider override so it is only done for gimple passes.
	Don't skip dfinit.
	(skip_pass): New function.
	(execute_one_pass): Call skip_pass when skipping passes.
	* read-md.c (md_reader::read_char): Support filtering
	the input to a subset of line numbers.
	(md_reader::md_reader): Initialize fields
	m_first_line and m_last_line.
	(md_reader::read_file_fragment): New function.
	* read-md.h (md_reader::read_file_fragment): New decl.
	(md_reader::m_first_line): New field.
	(md_reader::m_last_line): New field.
	* read-rtl-function.c (function_reader::create_function): Only
	create cfun if it doesn't already exist.  Set PROP_rtl on cfun's
	curr_properties.  Set DECL_INITIAL to a dummy block.
	(read_rtl_function_body_from_file_range): New function.
	* read-rtl-function.h (read_rtl_function_body_from_file_range):
	New decl.
	* run-rtl-passes.c: New file.
	* run-rtl-passes.h: New file.

gcc/testsuite/ChangeLog:
	* gcc.dg/rtl/aarch64/asr_div1.c: New test case.
	* gcc.dg/rtl/aarch64/pr71779.c: New test case.
	* gcc.dg/rtl/rtl.exp: New file.
	* gcc.dg/rtl/test.c: New file.
	* gcc.dg/rtl/truncated-rtl-file.c: New test case.
	* gcc.dg/rtl/unknown-rtx-code.c: New test case.
	* gcc.dg/rtl/x86_64/dfinit.c: New test case.
	* gcc.dg/rtl/x86_64/different-structs.c: New test case.
	* gcc.dg/rtl/x86_64/final.c: New test case.
	* gcc.dg/rtl/x86_64/into-cfglayout.c: New test case.
	* gcc.dg/rtl/x86_64/ira.c: New test case.
	* gcc.dg/rtl/x86_64/pro_and_epilogue.c: New test case.
	* gcc.dg/rtl/x86_64/test-multiple-fns.c: New test case.
	* gcc.dg/rtl/x86_64/test-return-const.c.after-expand.c: New test case.
	* gcc.dg/rtl/x86_64/test-return-const.c.before-fwprop.c: New test case.
	* gcc.dg/rtl/x86_64/test-rtl.c: New test case.
	* gcc.dg/rtl/x86_64/test_1.h: New file.
	* gcc.dg/rtl/x86_64/times-two.c.after-expand.c: New test case.
	* gcc.dg/rtl/x86_64/times-two.c.before-df.c: New test case.
	* gcc.dg/rtl/x86_64/times-two.h: New file.
	* gcc.dg/rtl/x86_64/vregs.c: New test case.

From-SVN: r244878
2017-01-24 17:07:36 +00:00
Marek Polacek 2ebd93e1d7 re PR c/64279 (Warning missing for "(cond) ? A : A" / if(cond) expr1; else expr1; // same expression in if and else branch)
PR c/64279
	* c-common.h (do_warn_duplicated_branches_r): Declare.
	* c-gimplify.c (c_genericize): Walk the function tree calling
	do_warn_duplicated_branches_r.
	* c-warn.c (expr_from_macro_expansion_r): New.
	(do_warn_duplicated_branches): New.
	(do_warn_duplicated_branches_r): New.
	* c.opt (Wduplicated-branches): New option.

	* c-typeck.c (build_conditional_expr): Warn about duplicated branches.

	* call.c (build_conditional_expr_1): Warn about duplicated branches.
	* semantics.c (finish_expr_stmt): Build statement using the proper
	location.

	* doc/invoke.texi: Document -Wduplicated-branches.
	* fold-const.c (operand_equal_p): Handle MODIFY_EXPR, INIT_EXPR,
	COMPOUND_EXPR, PREDECREMENT_EXPR, PREINCREMENT_EXPR,
	POSTDECREMENT_EXPR, POSTINCREMENT_EXPR, CLEANUP_POINT_EXPR, EXPR_STMT,
	STATEMENT_LIST, and RETURN_EXPR.  For non-pure non-const functions
	return 0 only when not OEP_LEXICOGRAPHIC.
	(fold_build_cleanup_point_expr): Use the expression
	location when building CLEANUP_POINT_EXPR.
	* tree-core.h (enum operand_equal_flag): Add OEP_LEXICOGRAPHIC.
	* tree.c (add_expr): Handle error_mark_node.

	* c-c++-common/Wduplicated-branches-1.c: New test.
	* c-c++-common/Wduplicated-branches-10.c: New test.
	* c-c++-common/Wduplicated-branches-11.c: New test.
	* c-c++-common/Wduplicated-branches-12.c: New test.
	* c-c++-common/Wduplicated-branches-2.c: New test.
	* c-c++-common/Wduplicated-branches-3.c: New test.
	* c-c++-common/Wduplicated-branches-4.c: New test.
	* c-c++-common/Wduplicated-branches-5.c: New test.
	* c-c++-common/Wduplicated-branches-6.c: New test.
	* c-c++-common/Wduplicated-branches-7.c: New test.
	* c-c++-common/Wduplicated-branches-8.c: New test.
	* c-c++-common/Wduplicated-branches-9.c: New test.
	* c-c++-common/Wimplicit-fallthrough-7.c: Coalesce dg-warning.
	* g++.dg/cpp0x/lambda/lambda-switch.C: Move dg-warning.
	* g++.dg/ext/builtin-object-size3.C: Likewise.
	* g++.dg/gomp/loop-1.C: Likewise.
	* g++.dg/warn/Wduplicated-branches1.C: New test.
	* g++.dg/warn/Wduplicated-branches2.C: New test.

From-SVN: r244705
2017-01-20 12:02:50 +00:00
David Malcolm 0d80ab91d0 Fix wording of -Wmisleading-indentation (PR c++/71497)
gcc/c-family/ChangeLog:
	PR c++/71497
	* c-indentation.c (warn_for_misleading_indentation): Use the past
	subjunctive in the note.

gcc/testsuite/ChangeLog:
	PR c++/71497
	* c-c++-common/Wmisleading-indentation-3.c: Update wording of
	expected messages.
	* c-c++-common/Wmisleading-indentation.c: Likewise.

From-SVN: r244536
2017-01-17 16:33:44 +00:00
Aldy Hernandez 7f991c3616 re PR c/79116 (ICE on cilkplus array notation with a _Cilk_for)
PR c/79116
	* array-notation-common.c (cilkplus_extract_an_triplets): Convert
	start type to integer_type.

From-SVN: r244533
2017-01-17 15:27:18 +00:00
Jakub Jelinek 1c70261c9a re PR driver/49726 (-g0 file.S -g does not produce debug info)
PR driver/49726
	* gcc.c (debug_level_greater_than_spec_func): New function.
	(static_spec_functions): Add debug-level-gt spec function.
	(ASM_DEBUG_SPEC, cpp_options): Use %:debug-level-gt(0) instead of
	!g0.
	* config/darwin.h (DSYMUTIL_SPEC, ASM_DEBUG_SPEC): Likewise.
	* config/darwin9.h (DSYMUTIL_SPEC, ASM_DEBUG_SPEC): Likewise.
	* common.opt (g, gcoff, gdwarf, gdwarf-, ggdb, gno-pubnames,
	gpubnames, ggnu-pubnames, gno-record-gcc-switches,
	grecord-gcc-switches, gno-strict-dwarf, gstrict-dwarf, gstabs,
	gstabs+, gtoggle, gvms, gxcoff, gxcoff+): Add Driver flag.
c-family/
	* c.opt (gen-decls): Add Driver flag.
ada/
	* gcc-interface/lang.opt (gant, gnatO, gnat): Add Driver flag.

From-SVN: r244505
2017-01-16 22:33:07 +01:00
Paolo Carlini 1ddca3f365 revert: re PR c++/71737 (ICE following 2x pack expansion in non-pack with template alias)
/c-family
2017-01-16  Paolo Carlini  <paolo.carlini@oracle.com>

	Revert:
     	2017-01-16  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/71737
	* c-common.c (set_underlying_type): Always set DECL_ORIGINAL_TYPE.

/testsuite
2017-01-16  Paolo Carlini  <paolo.carlini@oracle.com>

	Revert:
        2017-01-16  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/71737
	* g++.dg/cpp0x/pr71737.C: New.

From-SVN: r244496
2017-01-16 15:43:06 +00:00
Paolo Carlini 7d2f3f1d29 re PR c++/71737 (ICE following 2x pack expansion in non-pack with template alias)
/c-family
2017-01-16  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/71737
	* c-common.c (set_underlying_type): Always set DECL_ORIGINAL_TYPE.

/testsuite
2017-01-16  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/71737
	* g++.dg/cpp0x/pr71737.C: New.

From-SVN: r244486
2017-01-16 09:09:30 +00:00
Martin Sebor bce6f76013 (-Wformat-overflow): ...to this.
gcc/c-family/ChangeLog:

	(-Wformat-overflow): ...to this.

gcc/ChangeLog:

	to -Wformat-overflow.
	* gimple-ssa-sprintf.c (pass_sprintf_length::gate): Adjust.
	(min_bytes_remaining): Same.
	(get_string_length): Same.
	(format_string): Same.
	(format_directive): Same.
	(add_bytes): Same.
	(pass_sprintf_length::handle_gimple_call): Same.

gcc/testsuite/ChangeLog:

	* gcc.dg/pr78138.c: Adjust.
	* gcc.dg/pr78768.c: Adjust.
	* gcc.dg/tree-ssa/builtin-sprintf-4.c: Adjust.
	* gcc.dg/tree-ssa/builtin-sprintf-warn-1.c: Adjust.
	* gcc.dg/tree-ssa/builtin-sprintf-warn-2.c: Adjust.
	* gcc.dg/tree-ssa/builtin-sprintf-warn-3.c: Adjust.
	* gcc.dg/tree-ssa/builtin-sprintf-warn-4.c: Adjust.
	* gcc.dg/tree-ssa/builtin-sprintf-warn-6.c: Adjust.
	* gcc.dg/tree-ssa/builtin-sprintf-warn-7.c: Adjust.
	* gcc.dg/tree-ssa/builtin-sprintf-warn-8.c: Adjust.
	* gcc.dg/tree-ssa/builtin-sprintf-warn-9.c: Adjust.
	* gcc.dg/tree-ssa/pr78605.c: Adjust.
	* gcc.dg/tree-ssa/pr78622.c: Adjust.

From-SVN: r244385
2017-01-12 14:54:41 -07:00
Martin Sebor bf5fbf465d PR c/78768 - -Walloca-larger-than and -Wformat-length warnings disabled by -flto
gcc/ChangeLog:
	* c.opt (-Walloca-larger-than, -Wformat-length, -Wformat-truncation):
	Also enable for LTO.

gcc/testsuite/ChangeLog:
	PR c/78768
	* gcc.dg/pr78768.c: New test.

From-SVN: r244326
2017-01-11 10:28:52 -07:00
Jason Merrill e363df3fd3 * c-cppbuiltin.c (c_cpp_builtins): Define __cpp_variadic_using.
From-SVN: r244283
2017-01-10 14:04:28 -05:00
Jakub Jelinek bd2c62704b re PR translation/79019 (translatable string typo in cif-code.def:141)
PR translation/79019
	PR translation/79020
	* params.def (PARAM_INLINE_MIN_SPEEDUP,
	PARAM_IPA_CP_SINGLE_CALL_PENALTY,
	PARAM_USE_AFTER_SCOPE_DIRECT_EMISSION_THRESHOLD): Fix typos
	in descriptions.
	* config/avr/avr.opt (maccumulate-args): Likewise.
	* config/msp430/msp430.opt (mwarn-mcu): Likewise.
	* common.opt (freport-bug): Likewise.
	* cif-code.def (CIF_FINAL_ERROR): Likewise.
	* doc/invoke.texi (ipa-cp-single-call-penalty): Likewise.
	* config/s390/s390.c (s390_invalid_binary_op): Fix spelling in
	translatable string.
	* config/i386/i386.c (function_value_32): Likewise.
	* config/nios2/nios2.c (nios2_valid_target_attribute_rec): Likewise.
	* config/msp430/msp430.c (msp430_option_override, msp430_attr):
	Likewise.
	* config/msp430/driver-msp430.c (msp430_select_hwmult_lib): Likewise.
	* common/config/msp430/msp430-common.c (msp430_handle_option):
	Likewise.
	* symtab.c (symtab_node::verify_base): Likewise.
	* opts.c (set_debug_level): Likewise.
	* tree.c (verify_type_variant): Likewise.  Fix typo in comment.
	* config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin): Add
	missing whitespace to translatable strings.
	* config/avr/avr.md (bswapsi2): Fix typo in comment.
	* config/sh/superh.h: Likewise.
	* config/i386/xopintrin.h: Likewise.
	* config/i386/znver1.md: Likewise.
	* config/rs6000/rs6000.c (struct rs6000_opt_mask): Likewise.
	* ipa-inline-analysis.c (compute_inline_parameters): Likewise.
	* double-int.h (struct double_int): Likewise.
	* double-int.c (div_and_round_double): Likewise.
	* wide-int.cc: Likewise.
	* tree-ssa.c (non_rewritable_mem_ref_base): Likewise.
	* tree-ssa-sccvn.c (vn_reference_lookup_3): Likewise.
	* cfgcleanup.c (crossjumps_occured): Renamed to ...
	(crossjumps_occurred): ... this.
	(try_crossjump_bb, try_head_merge_bb, try_optimize_cfg, cleanup_cfg):
	Adjust all uses.
cp/
	* semantics.c (finish_omp_clauses): Add missing whitespace to
	translatable strings.
	* cp-cilkplus.c (cpp_validate_cilk_plus_loop_aux): Fix comment typo.
lto/
	* lto-symtab.c (lto_symtab_merge_symbols): Fix comment typo.
fortran/
	* decl.c (attr_decl1): Fix spelling in translatable string.
	* intrinsic.texi: Fix spelling - invokation -> invocation.
	* lang.opt (faggressive-function-elimination, gfc_convert): Fix
	typos in descriptions.
	* openmp.c (resolve_omp_clauses): Add missing whitespace to
	translatable strings.
c-family/
	* c.opt (Wnormalized=): Fix typo in description.
testsuite/
	* c-c++-common/goacc/host_data-2.c (f): Adjust expected spelling of
	diagnostics.
	* gfortran.dg/initialization_17.f90: Likewise.

From-SVN: r244245
2017-01-09 22:48:33 +01:00
Martin Sebor efcc8d387f PR tree-optimization/78913 - Probably misleading error reported by -Wformat-length
PR tree-optimization/78913 - Probably misleading error reported by -Wformat-length
PR middle-end/77708 - -Wformat-length %s warns for snprintf

gcc/ChangeLog:

	PR middle-end/77708
	* doc/invoke.texi (Warning Options): Document -Wformat-truncation.
	* gimple-ssa-sprintf.c (call_info::reval_used, call_info::warnopt):
	New member functions.
	(format_directive): Used them.
	(add_bytes): Same.
	(pass_sprintf_length::handle_gimple_call): Same.
	* graphite-sese-to-poly.c (tree_int_to_gmp): Increase buffer size
	to avoid truncation for any argument.
	(extract_affine_mul): Same.
	* tree.c (get_file_function_name): Same.

gcc/c-family/ChangeLog:

	PR middle-end/77708
	* c.opt (-Wformat-truncation): New option.

gcc/fortran/ChangeLog:

	PR tree-optimization/78913
	PR middle-end/77708
	* trans-common.c (build_equiv_decl): Increase buffer size to avoid
	truncation for any argument.
	* trans-types.c (gfc_build_logical_type): Same.

gcc/testsuite/ChangeLog:

	PR middle-end/77708
	* gcc.dg/tree-ssa/builtin-snprintf-warn-1.c: New test.
	* gcc.dg/tree-ssa/builtin-snprintf-warn-2.c: New test.
	* gcc.dg/tree-ssa/builtin-sprintf-warn-6.c: XFAIL test cases failing
	due to bug 78969.
	* gcc.dg/format/pr78569.c: Adjust.

From-SVN: r244210
2017-01-08 16:42:09 -07:00
Alexandre Oliva 435f3f7adf [bootstrap-O1] change value type to avoid sprintf buffer size warning
In stage2 of bootstrap-O1, the code that warns if sprintf might
overflow its output buffer cannot tell that an unsigned value narrowed
to 16 bits will fit in 4 bytes with %4x.

Converting the value to 'unsigned short' makes it obvious that it
fits, at least on machines with 16-bit shorts.

for  gcc/c-family/ChangeLog

	* c-pretty-print.c (pp_c_tree_decl_identifier): Convert 16-bit
	value to unsigned short to fit in 4 hex digits without
	warnings.

From-SVN: r244121
2017-01-06 03:34:25 +00:00
Eric Botcazou 4e89adf970 invoke.texi (C Dialect Options): Document it.
* doc/invoke.texi (C Dialect Options): Document it.
c-family/
        * c.opt (fsso-struct): Add 'native' value.

From-SVN: r244115
2017-01-05 21:20:16 +00:00
Martin Liska cd445b543c Error for '-' as filename of a precompiled header (PR pch/78970)
2017-01-05  Martin Liska  <mliska@suse.cz>

	PR pch/78970
	* c-opts.c (c_common_post_options): Reject '-' filename for a precompiled
	header.
2017-01-05  Martin Liska  <mliska@suse.cz>

	PR pch/78970
	* gcc.c (lookup_compiler): Reject '-' filename for a precompiled
	header.

From-SVN: r244103
2017-01-05 14:17:07 +00:00
Marek Polacek a9342885b1 re PR c++/64767 (Could GCC warn when a pointer is compared against '\0'?)
PR c++/64767
	* c.opt (Wpointer-compare): New option.

	* c-parser.c (c_parser_postfix_expression): Mark zero character
	constants by setting original_type in c_expr.
	* c-typeck.c (parser_build_binary_op): Warn when a pointer is compared
	with a zero character constant.
	(char_type_p): New function.

	* typeck.c (cp_build_binary_op): Warn when a pointer is compared with
	a zero character literal.

	* doc/invoke.texi: Document -Wpointer-compare.

	* c-c++-common/Wpointer-compare-1.c: New test.

From-SVN: r244076
2017-01-04 21:47:04 +00:00
Jakub Jelinek fc73e60cde re PR driver/78957 (ICE: SIGSEGV with -fno-sso-struct=web)
PR driver/78957
	* c.opt (fsso-struct=): Add RejectNegative.

	* gcc.dg/pr78957.c: New test.

From-SVN: r244072
2017-01-04 21:25:13 +01:00
Jakub Jelinek cbe34bb5ed Update copyright years.
From-SVN: r243994
2017-01-01 13:07:43 +01:00
Martin Liska d4a6c0ea4b Add RejectNegative for a c option.
PR c/78933
	* g++.dg/pr78933.C: New test.
	PR c/78933
	* c.opt (strong-eval-order): Add RejectNegative keyword.

From-SVN: r243960
2016-12-29 10:35:33 +00:00
Alexander Ivchenko 8ba4f50639 c.opt (flag_chkp_flexible_struct_trailing_arrays): Add new option.
2016-12-27  Alexander Ivchenko  <alexander.ivchenko@intel.com>

* c-family/c.opt (flag_chkp_flexible_struct_trailing_arrays):
  Add new option.
  (fchkp-narrow-to-innermost-array): Fix typo.
* doc/cpp.texi (flag_chkp_flexible_struct_trailing_arrays): Ditto.
* tree-chkp.c (chkp_may_narrow_to_field ): Forbid
  narrowing when flag_chkp_flexible_struct_trailing_arrays is used
  and the field is the last array field in the structure.


2016-12-27  Alexander Ivchenko  <alexander.ivchenko@intel.com>

* gcc.target/i386/mpx/vla-trailing-1-lbv.c: New test.
* gcc.target/i386/mpx/vla-trailing-1-nov.c: Ditto.
* gcc.target/i386/mpx/vla-trailing-1-ubv.c: Ditto.

From-SVN: r243936
2016-12-27 13:31:43 +00:00
Jason Merrill 67a5ad7cbd Feature-test macro for P0522R0, matching of template template arguments.
* c-cppbuiltin.c (c_cpp_builtins): Define
	__cpp_template_template_args.

From-SVN: r243896
2016-12-22 15:29:02 -05:00
Jakub Jelinek 0dba79602a re PR bootstrap/78817 (stage2 bootstrap failure in vec.h:1613:5: error: argument 1 null where non-null expected after r243661)
PR bootstrap/78817
	* tree-pass.h (make_pass_post_ipa_warn): Declare.
	* builtins.c (validate_arglist): Adjust get_nonnull_args call.
	Check for NULL pointer argument to nonnull arg here.
	(validate_arg): Revert 2016-12-14 changes.
	* calls.h (get_nonnull_args): Remove declaration.
	* tree-ssa-ccp.c: Include diagnostic-core.h.
	(pass_data_post_ipa_warn): New variable.
	(pass_post_ipa_warn): New class.
	(pass_post_ipa_warn::execute): New method.
	(make_pass_post_ipa_warn): New function.
	* tree.h (get_nonnull_args): Declare.
	* tree.c (get_nonnull_args): New function.
	* calls.c (maybe_warn_null_arg): Removed.
	(maybe_warn_null_arg): Removed.
	(initialize_argument_information): Revert 2016-12-14 changes.
	* passes.def: Add pass_post_ipa_warn after first ccp after IPA.
c-family/
	* c-common.c (struct nonnull_arg_ctx): New type.
	(check_function_nonnull): Return bool instead of void.  Use
	nonnull_arg_ctx as context rather than just location_t.
	(check_nonnull_arg): Adjust for the new context type, set
	warned_p to true if a warning has been diagnosed.
	(check_function_arguments): Return bool instead of void.
	* c-common.h (check_function_arguments): Adjust prototype.
c/
	* c-typeck.c (build_function_call_vec): If check_function_arguments
	returns true, set TREE_NO_WARNING on CALL_EXPR.
cp/
	* typeck.c (cp_build_function_call_vec): If check_function_arguments
	returns true, set TREE_NO_WARNING on CALL_EXPR.
	* call.c (build_over_call): Likewise.

From-SVN: r243874
2016-12-21 23:15:59 +01:00
Jason Merrill 31bfc9b9dd Implement P0522R0, matching of template template arguments.
gcc/c-family/
	* c.opt (-fnew-ttp-matching): New flag.
	* c-opts.c (c_common_post_options): Default on if -std=c++1z.
gcc/cp/
	* pt.c (coerce_template_template_parms): Allow a template argument
	that's less specialized than the parameter.
	(unify_bound_ttp_args): Adjust parm's args to apply to arg's
	template.
	(coerce_template_args_for_ttp): Split out from
	lookup_template_class_1.
	(coerce_ttp_args_for_tta, store_defaulted_ttp)
	(lookup_defaulted_ttp, add_defaults_to_ttp): New.
	(process_partial_specialization): Set DECL_CONTEXT of
	template template-parameters.
	(coerce_template_parms): Only inform when complain.
	(expand_template_argument_pack): Handle error_mark_node.
	(convert_template_argument, template_args_equal, unify): Handle
	any_targ_node.
	* cp-tree.h (enum cp_tree_index): Add CPTI_ANY_TARG.
	(any_targ_node): New.
	* decl.c (cxx_init_decl_processing): Set it.
	* name-lookup.c (consider_binding_level): Ignore names with embedded
	spaces.

From-SVN: r243871
2016-12-21 14:39:04 -05:00
Martin Jambor 629b3d75c8 Split omp-low into multiple files
2016-12-14  Martin Jambor  <mjambor@suse.cz>

	* omp-general.h: New file.
	* omp-general.c: New file.
	* omp-expand.h: Likewise.
	* omp-expand.c: Likewise.
	* omp-offload.h: Likewise.
	* omp-offload.c: Likewise.
	* omp-grid.c: Likewise.
	* omp-grid.c: Likewise.
	* omp-low.h: Include omp-general.h and omp-grid.h.  Removed includes
	of params.h, symbol-summary.h, lto-section-names.h, cilk.h, tree-eh.h,
	ipa-prop.h, tree-cfgcleanup.h, cfgloop.h, except.h, expr.h, stmt.h,
	varasm.h, calls.h, explow.h, dojump.h, flags.h, tree-into-ssa.h,
	tree-cfg.h, cfganal.h, alias.h, emit-rtl.h, optabs.h, expmed.h,
	alloc-pool.h, cfghooks.h, rtl.h and memmodel.h.
	(omp_find_combined_for): Declare.
	(find_omp_clause): Renamed to omp_find_clause and moved to
	omp-general.h.
	(free_omp_regions): Renamed to omp_free_regions and moved to
	omp-expand.h.
	(replace_oacc_fn_attrib): Renamed to oacc_replace_fn_attrib and moved
	to omp-general.h.
	(set_oacc_fn_attrib): Renamed to oacc_set_fn_attrib and moved to
	omp-general.h.
	(build_oacc_routine_dims): Renamed to oacc_build_routine_dims and
	moved to omp-general.h.
	(get_oacc_fn_attrib): Renamed to oacc_get_fn_attrib and moved to
	omp-general.h.
	(oacc_fn_attrib_kernels_p): Moved to omp-general.h.
	(get_oacc_fn_dim_size): Renamed to oacc_get_fn_dim_size and moved to
	omp-general.c.
	(omp_expand_local): Moved to omp-expand.h.
	(make_gimple_omp_edges): Renamed to omp_make_gimple_edges and moved to
	omp-expand.h.
	(omp_finish_file): Moved to omp-offload.h.
	(default_goacc_validate_dims): Renamed to
	oacc_default_goacc_validate_dims and moved to omp-offload.h.
	(offload_funcs, offload_vars): Moved to omp-offload.h.
	* omp-low.c: Include omp-general.h, omp-offload.h and omp-grid.h.
	(omp_region): Moved to omp-expand.c.
	(omp_for_data_loop): Moved to omp-general.h.
	(omp_for_data): Likewise.
	(oacc_loop): Moved to omp-offload.c.
	(oacc_loop_flags): Moved to omp-general.h.
	(offload_funcs, offload_vars): Moved to omp-offload.c.
	(root_omp_region): Moved to omp-expand.c.
	(omp_any_child_fn_dumped): Likewise.
	(find_omp_clause): Renamed to omp_find_clause and moved to
	omp-general.c.
	(is_combined_parallel): Moved to omp-expand.c.
	(is_reference): Renamed to omp_is_reference and and moved to
	omp-general.c.
	(adjust_for_condition): Renamed to omp_adjust_for_condition and moved
	to omp-general.c.
	(get_omp_for_step_from_incr): Renamed to omp_get_for_step_from_incr
	and moved to omp-general.c.
	(extract_omp_for_data): Renamed to omp_extract_for_data and moved to
	omp-general.c.
	(workshare_safe_to_combine_p): Moved to omp-expand.c.
	(omp_adjust_chunk_size): Likewise.
	(get_ws_args_for): Likewise.
	(get_base_type): Removed.
	(dump_omp_region): Moved to omp-expand.c.
	(debug_omp_region): Likewise.
	(debug_all_omp_regions): Likewise.
	(new_omp_region): Likewise.
	(free_omp_region_1): Likewise.
	(free_omp_regions): Renamed to omp_free_regions and moved to
	omp-expand.c.
	(find_combined_for): Renamed to omp_find_combined_for, made global.
	(build_omp_barrier): Renamed to omp_build_barrier and moved to
	omp-general.c.
	(omp_max_vf): Moved to omp-general.c.
	(omp_max_simt_vf): Likewise.
	(gimple_build_cond_empty): Moved to omp-expand.c.
	(parallel_needs_hsa_kernel_p): Likewise.
	(expand_omp_build_assign): Moved declaration to omp-expand.c.
	(expand_parallel_call): Moved to omp-expand.c.
	(expand_cilk_for_call): Likewise.
	(expand_task_call): Likewise.
	(vec2chain): Likewise.
	(remove_exit_barrier): Likewise.
	(remove_exit_barriers): Likewise.
	(optimize_omp_library_calls): Likewise.
	(expand_omp_regimplify_p): Likewise.
	(expand_omp_build_assign): Likewise.
	(expand_omp_taskreg): Likewise.
	(oacc_collapse): Likewise.
	(expand_oacc_collapse_init): Likewise.
	(expand_oacc_collapse_vars): Likewise.
	(expand_omp_for_init_counts): Likewise.
	(expand_omp_for_init_vars): Likewise.
	(extract_omp_for_update_vars): Likewise.
	(expand_omp_ordered_source): Likewise.
	(expand_omp_ordered_sink): Likewise.
	(expand_omp_ordered_source_sink): Likewise.
	(expand_omp_for_ordered_loops): Likewise.
	(expand_omp_for_generic): Likewise.
	(expand_omp_for_static_nochunk): Likewise.
	(find_phi_with_arg_on_edge): Likewise.
	(expand_omp_for_static_chunk): Likewise.
	(expand_cilk_for): Likewise.
	(expand_omp_simd): Likewise.
	(expand_omp_taskloop_for_outer): Likewise.
	(expand_omp_taskloop_for_inner): Likewise.
	(expand_oacc_for): Likewise.
	(expand_omp_for): Likewise.
	(expand_omp_sections): Likewise.
	(expand_omp_single): Likewise.
	(expand_omp_synch): Likewise.
	(expand_omp_atomic_load): Likewise.
	(expand_omp_atomic_store): Likewise.
	(expand_omp_atomic_fetch_op): Likewise.
	(expand_omp_atomic_pipeline): Likewise.
	(expand_omp_atomic_mutex): Likewise.
	(expand_omp_atomic): Likewise.
	(oacc_launch_pack): and moved to omp-general.c, made public.
	(OACC_FN_ATTRIB): Likewise.
	(replace_oacc_fn_attrib): Renamed to oacc_replace_fn_attrib and moved
	to omp-general.c.
	(set_oacc_fn_attrib): Renamed to oacc_set_fn_attrib and moved to
	omp-general.c.
	(build_oacc_routine_dims): Renamed to oacc_build_routine_dims and
	moved to omp-general.c.
	(get_oacc_fn_attrib): Renamed to oacc_get_fn_attrib and moved to
	omp-general.c.
	(oacc_fn_attrib_kernels_p): Moved to omp-general.c.
	(oacc_fn_attrib_level): Moved to omp-offload.c.
	(get_oacc_fn_dim_size): Renamed to oacc_get_fn_dim_size and moved to
	omp-general.c.
	(get_oacc_ifn_dim_arg): Renamed to oacc_get_ifn_dim_arg and moved to
	omp-general.c.
	(mark_loops_in_oacc_kernels_region): Moved to omp-expand.c.
	(grid_launch_attributes_trees): Likewise.
	(grid_attr_trees): Likewise.
	(grid_create_kernel_launch_attr_types): Likewise.
	(grid_insert_store_range_dim): Likewise.
	(grid_get_kernel_launch_attributes): Likewise.
	(get_target_argument_identifier_1): Likewise.
	(get_target_argument_identifier): Likewise.
	(get_target_argument_value): Likewise.
	(push_target_argument_according_to_value): Likewise.
	(get_target_arguments): Likewise.
	(expand_omp_target): Likewise.
	(grid_expand_omp_for_loop): Moved to omp-grid.c.
	(grid_arg_decl_map): Likewise.
	(grid_remap_kernel_arg_accesses): Likewise.
	(grid_expand_target_grid_body): Likewise.
	(expand_omp): Renamed to omp_expand and moved to omp-expand.c.
	(build_omp_regions_1): Moved to omp-expand.c.
	(build_omp_regions_root): Likewise.
	(omp_expand_local): Likewise.
	(build_omp_regions): Likewise.
	(execute_expand_omp): Likewise.
	(pass_data_expand_omp): Likewise.
	(pass_expand_omp): Likewise.
	(make_pass_expand_omp): Likewise.
	(pass_data_expand_omp_ssa): Likewise.
	(pass_expand_omp_ssa): Likewise.
	(make_pass_expand_omp_ssa): Likewise.
	(grid_lastprivate_predicate): Renamed to
	omp_grid_lastprivate_predicate and moved to omp-grid.c, made public.
	(grid_prop): Moved to omp-grid.c.
	(GRID_MISSED_MSG_PREFIX): Likewise.
	(grid_safe_assignment_p): Likewise.
	(grid_seq_only_contains_local_assignments): Likewise.
	(grid_find_single_omp_among_assignments_1): Likewise.
	(grid_find_single_omp_among_assignments): Likewise.
	(grid_find_ungridifiable_statement): Likewise.
	(grid_parallel_clauses_gridifiable): Likewise.
	(grid_inner_loop_gridifiable_p): Likewise.
	(grid_dist_follows_simple_pattern): Likewise.
	(grid_gfor_follows_tiling_pattern): Likewise.
	(grid_call_permissible_in_distribute_p): Likewise.
	(grid_handle_call_in_distribute): Likewise.
	(grid_dist_follows_tiling_pattern): Likewise.
	(grid_target_follows_gridifiable_pattern): Likewise.
	(grid_remap_prebody_decls): Likewise.
	(grid_var_segment): Likewise.
	(grid_mark_variable_segment): Likewise.
	(grid_copy_leading_local_assignments): Likewise.
	(grid_process_grid_body): Likewise.
	(grid_eliminate_combined_simd_part): Likewise.
	(grid_mark_tiling_loops): Likewise.
	(grid_mark_tiling_parallels_and_loops): Likewise.
	(grid_process_kernel_body_copy): Likewise.
	(grid_attempt_target_gridification): Likewise.
	(grid_gridify_all_targets_stmt): Likewise.
	(grid_gridify_all_targets): Renamed to omp_grid_gridify_all_targets
	and moved to omp-grid.c, made public.
	(make_gimple_omp_edges): Renamed to omp_make_gimple_edges and moved to
	omp-expand.c.
	(add_decls_addresses_to_decl_constructor): Moved to omp-offload.c.
	(omp_finish_file): Likewise.
	(oacc_thread_numbers): Likewise.
	(oacc_xform_loop): Likewise.
	(oacc_default_dims, oacc_min_dims): Likewise.
	(oacc_parse_default_dims): Likewise.
	(oacc_validate_dims): Likewise.
	(new_oacc_loop_raw): Likewise.
	(new_oacc_loop_outer): Likewise.
	(new_oacc_loop): Likewise.
	(new_oacc_loop_routine): Likewise.
	(finish_oacc_loop): Likewise.
	(free_oacc_loop): Likewise.
	(dump_oacc_loop_part): Likewise.
	(dump_oacc_loop): Likewise.
	(debug_oacc_loop): Likewise.
	(oacc_loop_discover_walk): Likewise.
	(oacc_loop_sibling_nreverse): Likewise.
	(oacc_loop_discovery): Likewise.
	(oacc_loop_xform_head_tail): Likewise.
	(oacc_loop_xform_loop): Likewise.
	(oacc_loop_process): Likewise.
	(oacc_loop_fixed_partitions): Likewise.
	(oacc_loop_auto_partitions): Likewise.
	(oacc_loop_partition): Likewise.
	(default_goacc_fork_join): Likewise.
	(default_goacc_reduction): Likewise.
	(execute_oacc_device_lower): Likewise.
	(default_goacc_validate_dims): Likewise.
	(default_goacc_dim_limit): Likewise.
	(pass_data_oacc_device_lower): Likewise.
	(pass_oacc_device_lower): Likewise.
	(make_pass_oacc_device_lower): Likewise.
	(execute_omp_device_lower): Likewise.
	(pass_data_omp_device_lower): Likewise.
	(pass_omp_device_lower): Likewise.
	(make_pass_omp_device_lower): Likewise.
	(pass_data_omp_target_link): Likewise.
	(pass_omp_target_link): Likewise.
	(find_link_var_op): Likewise.
	(pass_omp_target_link::execute): Likewise.
	(make_pass_omp_target_link): Likewise.

	* Makefile.in (OBJS): Added omp-offload.o, omp-expand.o, omp-general.o
	and omp-grid.o.
	(GTFILES): Added omp-offload.h, omp-offload.c and omp-expand.c, removed
	omp-low.h.
	* gimple-fold.c: Include omp-general.h instead of omp-low.h.
	(fold_internal_goacc_dim): Adjusted calls to
	get_oacc_ifn_dim_arg and get_oacc_fn_dim_size to use their new names.
	* gimplify.c: Include omp-low.h.
	(omp_notice_variable): Adjust the call to get_oacc_fn_attrib to use
	its new name.
	(gimplify_omp_task): Adjusted calls to find_omp_clause to use its new
	name.
	(gimplify_omp_for): Likewise.
	* lto-cgraph.c: Include omp-offload.h instead of omp-low.h.
	* toplev.c: Include omp-offload.h instead of omp-low.h.
	* tree-cfg.c: Include omp-general.h instead of omp-low.h.  Also
	include omp-expand.h.
	(make_edges_bb): Adjusted the call to make_gimple_omp_edges to use its
	new name.
	(make_edges): Adjust the call to free_omp_regions to use its new name.
	* tree-parloops.c: Include omp-general.h.
	(create_parallel_loop): Adjusted the call to set_oacc_fn_attrib to use
	its new name.
	(parallelize_loops): Adjusted the call to get_oacc_fn_attrib to use
	its new name.
	* tree-ssa-loop.c: Include omp-general.h instead of omp-low.h.
	(gate_oacc_kernels): Adjusted the call to get_oacc_fn_attrib to use
	its new name.
	* tree-vrp.c: Include omp-general.h instead of omp-low.h.
	(extract_range_basic): Adjusted calls to get_oacc_ifn_dim_arg and
	get_oacc_fn_dim_size to use their new names.
	* varpool.c: Include omp-offload.h instead of omp-low.h.
	* gengtype.c (open_base_files): Replace omp-low.h with omp-offload.h in
	ifiles.
	* config/nvptx/nvptx.c: Include omp-general.c.
	(nvptx_expand_call): Adjusted the call to get_oacc_fn_attrib to use
	its new name.
	(nvptx_reorg): Likewise.
	(nvptx_record_offload_symbol): Likewise.

gcc/c-family:
	* c-omp.c: Include omp-general.h instead of omp-low.h.
	(c_finish_oacc_wait): Adjusted call to find_omp_clause to use its new
	name.

gcc/c/
	* c-parser.c: Include omp-general.h and omp-offload.h instead of
	omp-low.h.
	(c_finish_oacc_routine): Adjusted call to
	get_oacc_fn_attrib, build_oacc_routine_dims and replace_oacc_fn_attrib
	to use their new names.
	(c_parser_oacc_enter_exit_data): Adjusted call to find_omp_clause to
	use its new name.
	(c_parser_oacc_update): Likewise.
	(c_parser_omp_simd): Likewise.
	(c_parser_omp_target_update): Likewise.
	* c-typeck.c: Include omp-general.h instead of omp-low.h.
	(c_finish_omp_cancel): Adjusted call to find_omp_clause to use its new
	name.
	(c_finish_omp_cancellation_point): Likewise.
	* gimple-parser.c: Do not include omp-low.h

gcc/cp/
	* parser.c: Include omp-general.h and omp-offload.h instead of
	omp-low.h.
	(cp_parser_omp_simd): Adjusted calls to find_omp_clause to use its new
	name.
	(cp_parser_omp_target_update): Likewise.
	(cp_parser_oacc_declare): Likewise.
	(cp_parser_oacc_enter_exit_data): Likewise.
	(cp_parser_oacc_update): Likewise.
	(cp_finalize_oacc_routine): Adjusted call to get_oacc_fn_attrib,
	build_oacc_routine_dims and replace_oacc_fn_attrib to use their new
	names.
	* semantics.c: Include omp-general insteda of omp-low.h.
	(finish_omp_for): Adjusted calls to find_omp_clause to use its new
	name.
	(finish_omp_cancel): Likewise.
	(finish_omp_cancellation_point): Likewise.

fortran/
	* trans-openmp.c: Include omp-general.h.

From-SVN: r243673
2016-12-14 23:30:41 +01:00
Martin Sebor 474da67ef9 PR c/78673 - sprintf missing attribute nonnull on destination argument
PR c/78673 - sprintf missing attribute nonnull on destination argument
PR c/17308 - nonnull attribute not as useful as it could be

gcc/ChangeLog:

	PR c/17308
	* builtin-attrs.def (ATTR_NONNULL_1_1, ATTR_NONNULL_1_2): Defined.
	(ATTR_NONNULL_1_3, ATTR_NONNULL_1_4, ATTR_NONNULL_1_5): Same.
	(ATTR_NOTHROW_NONNULL_1_1, ATTR_NOTHROW_NONNULL_1_2): Same.
	(ATTR_NOTHROW_NONNULL_1_3, ATTR_NOTHROW_NONNULL_1_4): Same.
	(ATTR_NOTHROW_NONNULL_1_5): Same.
	(ATTR_NONNULL_1_FORMAT_PRINTF_1_2): Same.
	(ATTR_NONNULL_1_FORMAT_PRINTF_2_0): Same.
	(ATTR_NONNULL_1_FORMAT_PRINTF_2_3): Same.
	(ATTR_NONNULL_1_FORMAT_PRINTF_3_0): Same.
	(ATTR_NONNULL_1_FORMAT_PRINTF_3_4): Same.
	(ATTR_NONNULL_1_FORMAT_PRINTF_4_0): Same.
	(ATTR_NONNULL_1_FORMAT_PRINTF_4_5): Same.
	* builtins.c (validate_arg): Add argument.  Treat null pointers
	passed to nonnull arguments as invalid.
	(validate_arglist): Same.
	* builtins.def (fprintf, fprintf_unlocked): Add nonnull attribute.
	(printf, printf_unlocked, sprintf. vfprintf, vsprintf): Same.
	(__sprintf_chk, __vsprintf_chk, __fprintf_chk, __vfprintf_chk): Same.
	* calls.c (get_nonnull_ags, maybe_warn_null_arg): New functions.
	(initialize_argument_information): Diagnose null pointers passed to
	arguments declared nonnull.
	* calls.h (get_nonnull_args): Declared.

gcc/c-family/ChangeLog:

	PR c/17308
	* c-common.c (check_nonnull_arg): Disable when optimization
	is enabled.

gcc/testsuite/ChangeLog:

	PR c/17308
	* gcc.dg/builtins-nonnull.c: New test.
	* gcc.dg/nonnull-4.c: New test.

From-SVN: r243661
2016-12-14 10:23:16 -07:00