aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family
AgeCommit message (Collapse)AuthorFilesLines
2016-04-18tree.h (TYPE_ALIGN, DECL_ALIGN): Return shifted amount.Michael Matz2-2/+7
* tree.h (TYPE_ALIGN, DECL_ALIGN): Return shifted amount. (SET_TYPE_ALIGN, SET_DECL_ALIGN): New. * tree-core.h (tree_type_common.align): Use bit-field. (tree_type_common.spare): New. (tree_decl_common.off_align): Make smaller. (tree_decl_common.align): Use bit-field. * expr.c (expand_expr_addr_expr_1): Use SET_TYPE_ALIGN. * omp-low.c (install_var_field): Use SET_DECL_ALIGN. (scan_sharing_clauses): Ditto. (finish_taskreg_scan): Use SET_DECL_ALIGN and SET_TYPE_ALIGN. (omp_finish_file): Ditto. * stor-layout.c (do_type_align): Use SET_DECL_ALIGN. (layout_decl): Ditto. (relayout_decl): Ditto. (finalize_record_size): Use SET_TYPE_ALIGN. (finalize_type_size): Ditto. (finish_builtin_struct): Ditto. (layout_type): Ditto. (initialize_sizetypes): Ditto. * targhooks.c (std_gimplify_va_arg_expr): Use SET_TYPE_ALIGN. * tree-nested.c (insert_field_into_struct): Use SET_TYPE_ALIGN. (lookup_field_for_decl): Use SET_DECL_ALIGN. (get_chain_field): Ditto. (get_trampoline_type): Ditto. (get_nl_goto_field): Ditto. * tree-streamer-in.c (unpack_ts_decl_common_value_fields): Use SET_DECL_ALIGN. (unpack_ts_type_common_value_fields): Use SET_TYPE_ALIGN. * gimple-expr.c (copy_var_decl): Use SET_DECL_ALIGN. * tree.c (make_node_stat): Use SET_DECL_ALIGN and SET_TYPE_ALIGN. (build_qualified_type): Use SET_TYPE_ALIGN. (build_aligned_type, build_range_type_1): Ditto. (build_atomic_base): Ditto. (build_common_tree_nodes): Ditto. * cfgexpand.c (align_local_variable): Use SET_DECL_ALIGN. (expand_one_stack_var_at): Ditto. * coverage.c (build_var): Use SET_DECL_ALIGN. * except.c (init_eh): Ditto. * function.c (assign_parm_setup_block): Ditto. * symtab.c (increase_alignment_1): Ditto. * tree-ssa-ccp.c (fold_builtin_alloca_with_align): Ditto. * tree-vect-stmts.c (ensure_base_align): Ditto. * varasm.c (align_variable): Ditto. (assemble_variable): Ditto. (build_constant_desc): Ditto. (output_constant_def_contents): Ditto. * config/arm/arm.c (arm_relayout_function): Use SET_DECL_ALIGN. * config/avr/avr.c (avr_adjust_type_node): Use SET_TYPE_ALIGN. * config/mips/mips.c (mips_std_gimplify_va_arg_expr): Ditto. * config/msp430/msp430.c (msp430_gimplify_va_arg_expr): Ditto. * config/spu/spu.c (spu_build_builtin_va_list): Use SET_DECL_ALIGN. ada/ * gcc-interface/decl.c (gnat_to_gnu_entity): Use SET_TYPE_ALIGN. (gnat_to_gnu_field): Ditto. (components_to_record): Ditto. (create_variant_part_from): Ditto. (copy_and_substitute_in_size): Ditto. (substitute_in_type): Ditto. * gcc-interface/utils.c (make_aligning_type): Use SET_TYPE_ALIGN. (make_packable_type): Ditto. (maybe_pad_type): Ditto. (finish_fat_pointer_type): Ditto. (finish_record_type): Ditto and use SET_DECL_ALIGN. (rest_of_record_type_compilation): Use SET_TYPE_ALIGN. (create_field_decl): Use SET_DECL_ALIGN. c-family/ * c-common.c (handle_aligned_attribute): Use SET_TYPE_ALIGN and SET_DECL_ALIGN. c/ * c-decl.c (merge_decls): Use SET_DECL_ALIGN and SET_TYPE_ALIGN. (grokdeclarator, parser_xref_tag, finish_enum): Use SET_TYPE_ALIGN. cp/ * class.c (build_vtable): Use SET_DECL_ALIGN and SET_TYPE_ALIGN. (layout_class_type): Ditto. (build_base_field): Use SET_DECL_ALIGN. (fixup_attribute_variants): Use SET_TYPE_ALIGN. * decl.c (duplicate_decls): Use SET_DECL_ALIGN. (record_unknown_type): Use SET_TYPE_ALIGN. (cxx_init_decl_processing): Ditto. (copy_type_enum): Ditto. (grokfndecl): Use SET_DECL_ALIGN. (copy_type_enum): Use SET_TYPE_ALIGN. * pt.c (instantiate_class_template_1): Use SET_TYPE_ALIGN. (tsubst): Ditto. * tree.c (cp_build_qualified_type_real): Use SET_TYPE_ALIGN. * lambda.c (maybe_add_lambda_conv_op): Use SET_DECL_ALIGN. * method.c (implicitly_declare_fn): Use SET_DECL_ALIGN. * rtti.c (emit_tinfo_decl): Ditto. fortran/ * trans-io.c (gfc_build_io_library_fndecls): Use SET_TYPE_ALIGN. * trans-common.c (build_common_decl): Use SET_DECL_ALIGN. * trans-types.c (gfc_add_field_to_struct): Use SET_DECL_ALIGN. go/ * go-gcc.cc (Gcc_backend::implicit_variable): Use SET_DECL_ALIGN. java/ * class.c (add_method_1): Use SET_DECL_ALIGN. (make_class_data): Ditto. (emit_register_classes_in_jcr_section): Ditto. * typeck.c (build_java_array_type): Ditto. objc/ * objc-act.c (objc_build_struct): Use SET_DECL_ALIGN. libcc1/ * plugin.cc (plugin_finish_record_or_union): Use SET_TYPE_ALIGN. From-SVN: r235172
2016-04-17c-ada-spec.c (get_underlying_decl): Return the typedef, if any.Eric Botcazou2-52/+45
* c-ada-spec.c (get_underlying_decl): Return the typedef, if any. (dump_generic_ada_node) <POINTER_TYPE>: Clean up handling of access to incomplete types. (dump_nested_type): Remove redundant tests and tidy up. (print_ada_declaration): Also set TREE_VISITED on the declaration of a type which is the typedef of an original type. From-SVN: r235084
2016-04-15re PR c/70651 (ICE on invalid code on x86_64-linux-gnu in build_va_arg, at ↵Marek Polacek2-2/+18
c-family/c-common.c:5728) PR c/70651 * c-common.c (build_va_arg): Change two asserts into errors and return error_mark_node. * c-c++-common/pr70651.c: New test. From-SVN: r235027
2016-04-13re PR c++/70639 (internal compiler error: in guard_tinfo_to_string, at ↵Marek Polacek2-4/+11
c-family/c-indentation.c:560) PR c++/70639 * c-indentation.c (should_warn_for_misleading_indentation): Bail out for switch statements, too. * c-c++-common/Wmisleading-indentation-4.c: New test. From-SVN: r234952
2016-03-28* c-cppbuiltin.c (c_cpp_builtins): Update __cpp_range_based_for.Jason Merrill2-1/+5
From-SVN: r234508
2016-03-23re PR c++/69884 (warning: ignoring attributes on template argument)Marek Polacek2-0/+9
PR c++/69884 * c.opt (Wignored-attributes): New option. * pt.c (canonicalize_type_argument): Use OPT_Wignored_attributes. * doc/invoke.texi: Document -Wignored-attributes. * g++.dg/warn/Wignored-attributes-1.C: New test. * g++.dg/warn/Wignored-attributes-2.C: New test. From-SVN: r234433
2016-03-22PR c/69993: improvements to wording of -Wmisleading-indentationDavid Malcolm2-4/+13
gcc/c-family/ChangeLog: PR c/69993 * c-indentation.c (warn_for_misleading_indentation): Rewrite the diagnostic text, reversing the order of the warning and note so that they appear in source order. gcc/testsuite/ChangeLog: PR c/69993 * c-c++-common/Wmisleading-indentation-3.c: New test, based on Wmisleading-indentation.c. * c-c++-common/Wmisleading-indentation.c: Update thoughout to reflect change to diagnostic text and order of messages. * gcc.dg/plugin/location-overflow-test-2.c: Likewise. From-SVN: r234403
2016-03-17re PR c/69407 (-Wunused-value on __atomic_fetch_OP and __atomic_OP_fetch)Marek Polacek2-0/+10
PR c/69407 * c-common.c (resolve_overloaded_builtin): Set TREE_USED for the fetch operations. * gcc.dg/atomic-op-6.c: New test. From-SVN: r234304
2016-03-15expr.c (cpp_classify_number): Hex floats are new in C++1z.Jason Merrill2-0/+6
* libcpp/expr.c (cpp_classify_number): Hex floats are new in C++1z. * libcpp/init.c (lang_defaults): Likewise. * gcc/c-family/c-cppbuiltin.c (c_cpp_builtins): Set __cpp_hex_float. From-SVN: r234213
2016-03-14* c-cppbuiltin.c (c_cpp_builtins): Bump __cpp_range_based_for.Jason Merrill2-1/+5
From-SVN: r234207
2016-03-09re PR c/70143 (false strict-aliasing warning)Richard Biener2-1/+9
2016-03-09 Richard Biener <rguenther@suse.de> c-family/ PR c/70143 * c-common.c (strict_aliasing_warning): Add back alias_sets_conflict_p check. * gcc.dg/Wstrict-aliasing-bogus-upcast.c: New testcase. * gcc.dg/Wstrict-aliasing-struct-with-char-member.c: Likewise. * gcc.dg/Wstrict-aliasing-struct-member.c: Remove again. From-SVN: r234084
2016-03-08Remove Concepts from -std=c++1z.Jason Merrill2-2/+4
gcc/c-family/ * c-opts.c (set_std_cxx1z): Don't enable concepts. gcc/testsuite/ * lib/g++-dg.exp (g++-dg-runtest): Handle "concepts" in std list. * lib/target-supports.exp (check_effective_target_concepts): New. gcc/cp/ * parser.c (cp_parser_diagnose_invalid_type_name): Give helpful diagnostic for use of "concept". (cp_parser_requires_clause_opt): And "requires". (cp_parser_type_parameter, cp_parser_late_return_type_opt) (cp_parser_explicit_template_declaration): Adjust. * Make-lang.in (check-c++-all): Add "concepts" to std list. From-SVN: r234069
2016-03-04PR c/68187: fix overzealous -Wmisleading-indentation (comment #1)David Malcolm2-61/+94
gcc/c-family/ChangeLog: PR c/68187 * c-indentation.c (get_visual_column): Move code to determine next tab stop to... (next_tab_stop): ...this new function. (line_contains_hash_if): Delete function. (detect_preprocessor_logic): Delete function. (get_first_nws_vis_column): New function. (detect_intervening_unindent): New function. (should_warn_for_misleading_indentation): Replace call to detect_preprocessor_logic with a call to detect_intervening_unindent. gcc/testsuite/ChangeLog: PR c/68187 * c-c++-common/Wmisleading-indentation.c (fn_42_a): New test function. (fn_42_b): Likewise. (fn_42_c): Likewise. From-SVN: r233972
2016-03-04PR c/68187: fix overzealous -Wmisleading-indentation (comment #0)David Malcolm2-6/+21
gcc/c-family/ChangeLog: PR c/68187 * c-indentation.c (should_warn_for_misleading_indentation): When suppressing warnings about cases where the guard and body are on the same column, only use the first non-whitespace column in place of the guard token column when dealing with "else" clauses. When rejecting aligned BODY and NEXT, loosen the requirement from equality with the first non-whitespace of guard to simply that they not be indented relative to it. gcc/testsuite/ChangeLog: PR c/68187 * c-c++-common/Wmisleading-indentation.c (fn_40_a): New test function. (fn_40_b): Likewise. (fn_41_a): Likewise. (fn_41_b): Likewise. From-SVN: r233971
2016-03-04re PR middle-end/70054 (GCC 6 gives a strict-aliasing warning on use of ↵Richard Biener2-1/+7
std::aligned_storage) 2016-03-04 Richard Biener <rguenther@suse.de> PR c++/70054 * c-common.c (strict_aliasing_warning): Use alias_set_subset_of instead of alias_sets_conflict_p. * g++.dg/warn/Wstrict-aliasing-bogus-union-2.C: New testcase. * gcc.dg/Wstrict-aliasing-struct-member.c: New testcase. From-SVN: r233961
2016-03-01re PR c++/69795 (g++ ICE on invalid code on x86_64-linux-gnu in ↵Marek Polacek2-1/+7
"reject_gcc_builtin") PR c++/69795 * c-common.c (reject_gcc_builtin): Check for FUNCTION_DECL rather than any DECL. * g++.dg/parse/invalid1.C: New test. From-SVN: r233855
2016-02-23PR middle-end/69780 - [4.9/5/6 Regression] ICE on __builtin_alloca_with_alignMartin Sebor2-0/+33
PR middle-end/69780 - [4.9/5/6 Regression] ICE on __builtin_alloca_with_align with small alignment PR c/69759 - __builtin_alloca and __builtin_alloca_with_align undocumented gcc/c-family/ChangeLog: * c-common.c (check_builtin_function_arguments): Validate and reject invalid arguments to __builtin_alloca_with_align. gcc/ChangeLog: * doc/extend.texi (Other Builtins): Document __builtin_alloca and __builtin_alloca_with_align. gcc/testsuite/ChangeLog: * g++.dg/ext/builtin_alloca.C: New test. * gcc.dg/builtins-68.c: New test. From-SVN: r233640
2016-02-22PR28901 Add two levels for -Wunused-const-variable.Mark Wielaard2-1/+11
There is some controversy about enabling -Wunused-const-variable for all unused static const variables because some feel there are too many errors exposed in header files. Create two levels for -Wunused-const-variable. One level to only check for unused static const variables in the main compilation file. Which is enabled by -Wunused-variable. And a second level that also checks for unused static const variables in included files. Which must be explicitly enabled. gcc/ChangeLog PR c/28901 * cgraphunit.c (check_global_declaration): Check level of warn_unused_const_variable and main_input_filename. * doc/invoke.texi (Warning Options): Add -Wunused-const-variable=. (-Wunused-variable): For C implies -Wunused-const-variable=1. (-Wunused-const-variable): Explain levels 1 and 2. gcc/c-family/ChangeLog PR c/28901 * c.opt (Wunused-const-variable): Turn into Alias for... (Wunused-const-variable=): New option. gcc/testsuite/ChangeLog PR c/28901 * gcc.dg/unused-variable-3.c: New test. From-SVN: r233616
2016-02-19re PR c++/69865 (-trigraphs option broken)Bernd Edlinger2-4/+14
gcc/c-family/ChangeLog: 2016-02-19 Bernd Edlinger <bernd.edlinger@hotmail.de> PR c++/69865 * c-opts.c (c_common_post_options): Move call to set_std_cxx14 from here... (c_common_init_options): ...to here. (set_std_cxx98): Initialize flag_isoc94 and flag_isoc99. gcc/testsuite/ChangeLog: 2016-02-19 Bernd Edlinger <bernd.edlinger@hotmail.de> PR c++/69865 * c-c++-common/Wshift-negative-value-6.c: Add -std=c++11 before -std=c++03. From-SVN: r233574
2016-02-19re PR c++/69826 (problem with cilkplus pragma and preprocessor variable)Jakub Jelinek2-1/+15
PR c++/69826 * c-pragma.c (c_pp_lookup_pragma): Handle PRAGMA_CILK_GRAINSIZE. (init_pragma): Register PRAGMA_CILK_GRAINSIZE even for flag_preprocess_only. * c-c++-common/cilk-plus/CK/pr69826-1.c: New test. * c-c++-common/cilk-plus/CK/pr69826-2.c: New test. From-SVN: r233571
2016-02-16re PR c/69835 (-Wnonnull diagnoses parameter comparisons with NULL even when ↵Jakub Jelinek2-0/+9
those could have changed) PR c/69835 * common.opt (Wnonnull-compare): New warning. * doc/invoke.texi (-Wnonnull): Remove text about comparison of arguments against NULL. (-Wnonnull-compare): Document. * Makefile.in (OBJS): Add gimple-ssa-nonnull-compare.o. * tree-pass.h (make_pass_warn_nonnull_compare): Declare. * passes.def (pass_warn_nonnull_compare): Add. * gimple-ssa-nonnull-compare.c: New file. c-family/ * c.opt (Wnonnull-compare): Enable for -Wall. c/ * c-typeck.c (build_binary_op): Revert 2015-09-09 change. cp/ * typeck.c (cp_build_binary_op): Revert 2015-09-09 change. testsuite/ * c-c++-common/nonnull-1.c: Use -Wnonnull-compare instead of -Wnonnull in dg-options. * c-c++-common/nonnull-2.c: New test. From-SVN: r233472
2016-02-15re PR c++/69797 (ICE on invalid code on x86_64-linux-gnu in operator[], at ↵Jakub Jelinek2-1/+7
vec.h:714) PR c++/69797 * c-common.c (sync_resolve_size): Diagnose too few arguments even when params is non-NULL empty vector. * c-c++-common/pr69797.c: New test. From-SVN: r233434
2016-02-08Remove -fshort-doubleBernd Schmidt3-5/+6
PR target/60410 * tree.c (build_common_tree_nodes): Remove short_double argument. All callers changed. * tree.h (build_common_tree_nodes): Adjust declaration. * doc/invoke.texi (-fshort-double): Remove documentation. * config/mips/t-img-elf (MULTILIB_OPTIONS, MULTILIB_DIRNAMES, MULTILIB_EXCEPTIONS): Remove -fshort-double variant. * lto-wrapper.c (merge_and_complain, append_compiler_options, append_linker_options): Don't handle OPT_fshort_double. c-family/ PR target/60410 * c.opt (fshort-double): Remove. testsuite/ PR target/60410 * gcc.dg/lto/pr55113_0.c: Remove test. From-SVN: r233218
2016-02-05PR c++/69662 - -Wplacement-new on allocated one element array membersMartin Sebor2-1/+11
gcc/testsuite/ChangeLog: PR c++/69662 * g++.dg/warn/Wplacement-new-size-1.C: New test. * g++.dg/warn/Wplacement-new-size-2.C: New test. gcc/cp/ChangeLog: PR c++/69662 * init.c (find_field_init): New function. (warn_placement_new_too_small): Call it. Handle one-element arrays at ends of structures special. gcc/c-family/ChangeLog: PR c++/69662 * c.opt (Warning options): Update -Wplacement-new to take an optional argument. gcc/ChangeLog: PR c++/69662 * doc/invoke.texi: Update -Wplacement-new to take an optional argument. From-SVN: r233190
2016-02-01re PR preprocessor/69543 (_Pragma does not apply within macro)Jakub Jelinek2-1/+11
PR preprocessor/69543 PR c/69558 * c-pragma.c (handle_pragma_diagnostic): Pass input_location instead of loc to control_warning_option. * gcc.dg/pr69543.c: New test. * gcc.dg/pr69558.c: New test. From-SVN: r233058
2016-02-01nvptx.c (PTX_GANG_DEFAULT): New.Nathan Sidwell2-0/+8
gcc/ * config/nvptx/nvptx.c (PTX_GANG_DEFAULT): New. (nvptx_goacc_validate_dims): Extend to handle global defaults. * target.def (OACC_VALIDATE_DIMS): Extend documentation. * doc/tm.texti: Rebuilt. * doc/invoke.texi (fopenacc-dim): Document. * lto-wrapper.c (merge_and_complain): Add OPT_fopenacc_dim_ case. (append_compiler_options): Likewise. * omp-low.c (oacc_default_dims, oacc_min_dims): New. (oacc_parse_default_dims): New. (oacc_validate_dims): Add USED arg. Select non-unity default when possible. (oacc_loop_fixed_partitions): Return mask of used partitions. (oacc_loop_auto_partitions): Emit dump info. (oacc_loop_partition): Return mask of used partitions. (execute_oacc_device_lower): Parse default dimension arg. Adjust loop partitioning and validation calls. gcc/c-family/ * c.opt (fopenacc-dim=): New option. gcc/fortran/ * lang.opt (fopenacc-dim=): New option. libgomp/ * testsuite/libgomp.oacc-c-c++-common/loop-dim-default.c: New. * testsuite/libgomp.oacc-fortran/routine-7.f90: Serialize loop. From-SVN: r233041
2016-01-27re PR c++/69267 ([cilkplus] ICE when calling a function with an empty class ↵Ryan Burn4-8/+15
as an argument) 2016-01-15 Ryan Burn <contact@rnburn.com> PR cilkplus/69267 * cilk.c (cilk_gimplify_call_params_in_spawned_fn): Change to use gimplify_arg. Removed superfluous post_p argument. * c-family.h (cilk_gimplify_call_params_in_spawned_fn): Removed superfluous post_p argument. * c-gimplify.c (c_gimplify_expr): Likewise. gcc/cp/ChangeLog: 2016-01-15 Ryan Burn <contact@rnburn.com> PR cilkplus/69267 * cp-gimplify.c (cilk_cp_gimplify_call_params_in_spawned_fn): Removed superfluous post_p argument in call to cilk_gimplify_call_params_in_spawned_fn. gcc/testsuite/ChangeLog: 2016-01-15 Ryan Burn <contact@rnburn.com> PR cilkplus/69267 * g++.dg/cilk-plus/CK/pr69267.cc: New test. From-SVN: r232887
2016-01-26PR other/69006: fix extra newlines after diagnosticsDavid Malcolm2-1/+7
gcc/c-family/ChangeLog: PR other/69006 * c-opts.c (c_diagnostic_finalizer): Replace invocation of pp_newline_and_flush with pp_flush. gcc/cp/ChangeLog: PR other/69006 * error.c (print_instantiation_partial_context_line): Add missing newlines from output for the t == NULL case. (print_instantiation_partial_context): Remove call to pp_newline. gcc/ChangeLog: PR other/69006 * diagnostic-show-locus.c (layout::print_source_line): Replace call to pp_newline with call to layout::print_newline. (layout::print_annotation_line): Likewise. (layout::move_to_column): Likewise. (layout::print_any_fixits): After printing any fixits, print a trailing newline, if necessary. (layout::print_newline): New method, resetting any colorization before a newline. (diagnostic_show_locus): Move the pp_newline to before the early bailout. Remove dummy block enclosing the layout instance. * diagnostic.c (default_diagnostic_finalizer): Replace invocation of pp_newline_and_flush with pp_flush. (diagnostic_append_note): Delete use of pp_newline. (diagnostic_append_note_at_rich_loc): Delete. * diagnostic.h (diagnostic_append_note_at_rich_loc): Delete. * pretty-print.h (output_buffer_append_r): Reset buff->line_length when newline characters are added to the buffer. gcc/fortran/ChangeLog: PR other/69006 * error.c (gfc_diagnostic_starter): Delete use of pp_newline. gcc/testsuite/ChangeLog: PR other/69006 * g++.dg/ext/timevar1.C: Add dg-allow-blank-lines-in-output directive. * gcc.dg/plugin/diagnostic-test-show-locus-color.c: Update expected multiline output to reflect the colorization being disabled before newlines. * gcc.dg/plugin/diagnostic_plugin_test_show_locus.c (custom_diagnostic_finalizer): Replace call to pp_newline_and_flush with call to pp_flush. * gcc.dg/unroll-2.c: Add dg-allow-blank-lines-in-output directive. * gfortran.dg/implicit_class_1.f90: Likewise. * lib/gcc-dg.exp (allow_blank_lines): New global. (dg-allow-blank-lines-in-output): New procedure. (gcc-dg-prune): Complain about blank lines in the output, unless dg-allow-blank-lines-in-output was called. * lib/multiline.exp (_build_multiline_regex): Only support arbitrary followup text for non-blank-lines, not for blank lines. From-SVN: r232837
2016-01-21PR c/69405 - [6 Regression] ICE in c_tree_printer on an invalidMartin Sebor2-2/+11
PR c/69405 - [6 Regression] ICE in c_tree_printer on an invalid __atomic_fetch_add gcc/testsuite/ChangeLog: 2016-01-20 Martin Sebor <msebor@redhat.com> PR c/69405 * gcc.dg/sync-fetch.c: New test. gcc/c-family/ChangeLog: 2016-01-20 Martin Sebor <msebor@redhat.com> PR c/69405 * c-common.c (sync_resolve_size): Avoid printing diagnostic about an incompatible argument when the argument isn't a valid tree node. From-SVN: r232713
2016-01-18re PR c++/68767 (spurious warning: null argument where non-null required)Jason Merrill2-9/+19
PR c++/68767 gcc/c-family/ * c-common.c (check_function_arguments_recurse): Fold the whole COND_EXPR, not just the condition. gcc/cp/ * cp-gimplify.c (cp_fold) [COND_EXPR]: Simplify. Do fold COND_EXPR. (contains_label_1, contains_label_p): Remove. From-SVN: r232522
2016-01-18Ignore reduction clause on kernels directiveTom de Vries2-7/+7
2016-01-18 Tom de Vries <tom@codesourcery.com> * c-omp.c (c_oacc_split_loop_clauses): Don't copy OMP_CLAUSE_REDUCTION, classify as loop clause. From-SVN: r232521
2016-01-15re PR bootstrap/68271 (Boostrap fails on x86_64-apple-darwin14 at r230084)Jakub Jelinek2-3/+10
PR bootstrap/68271 * parser.h (cp_token): Remove pragma_kind field. Add comment with number of unused bits. * parser.c (eof_token): Remove pragma_kind field initializer. (cp_lexer_get_preprocessor_token): Don't set pragma_kind field, don't clear CPP_PRAGMA u.value. (cp_parser_pragma_kind): New function. (cp_parser_omp_sections_scope, cp_parser_oacc_kernels_parallel, cp_parser_omp_construct, cp_parser_initial_pragma, cp_parser_pragma): Use cp_parser_pragma_kind instead of accessing pragma_kind field. * c-pragma.c (c_register_pragma_1): Adjust comment to note that C++ FE no longer has limit on number of pragmas. From-SVN: r232451
2016-01-14Fix minor whitespace problems in last commitJeff Law1-1/+1
From-SVN: r232394
2016-01-14[cilkplus] Fix cilk_spawn gimplification bug (PR cilkplus/69048)Ryan Burn2-0/+11
PR c++/69048 * cilk.c (create_cilk_wrapper_body): Call fold_build_cleanup_point_expr to add missing cleanup point. PR c++/69048 * g++.dg/cilk-plus/CK/pr69048.cc: New test. From-SVN: r232393
2016-01-14PR preprocessor/69177 and PR c++/68819: libcpp fallbacks and ↵David Malcolm2-5/+35
-Wmisleading-indentation gcc/c-family/ChangeLog: PR c++/68819 * c-indentation.c (get_visual_column): Add location_t param. Handle the column number being zero by effectively disabling the warning, with an "inform". (should_warn_for_misleading_indentation): Add location_t argument for all uses of get_visual_column. gcc/testsuite/ChangeLog: PR c++/68819 PR preprocessor/69177 * gcc.dg/plugin/location-overflow-test-1.c: New test case. * gcc.dg/plugin/location-overflow-test-2.c: New test case. * gcc.dg/plugin/location_overflow_plugin.c: New test plugin. * gcc.dg/plugin/plugin.exp (plugin_test_list): Add the above. libcpp/ChangeLog: PR preprocessor/69177 * line-map.c (LINE_MAP_MAX_LOCATION_WITH_PACKED_RANGES): New constant. (LINE_MAP_MAX_LOCATION_WITH_COLS): Add note about unit tests to comment. (can_be_stored_compactly_p): Reduce threshold from LINE_MAP_MAX_LOCATION_WITH_COLS to LINE_MAP_MAX_LOCATION_WITH_PACKED_RANGES. (get_combined_adhoc_loc): Likewise. (get_range_from_loc): Likewise. (linemap_line_start): Ensure that a new ordinary map is created when transitioning from range-packing being enabled to disabled, at the LINE_MAP_MAX_LOCATION_WITH_PACKED_RANGES threshold. Set range_bits to 0 for new ordinary maps when beyond this limit. Prevent the "increase the column bits of a freshly created map" optimization if the range bits has reduced. From-SVN: r232379
2016-01-13Improve warning locations (PR66208)Bernd Schmidt2-14/+15
PR c/66208 * c-common.c (check_function_nonnull): Remove unnecessary declaration. Add new arg loc and pass it down as context. (check_nonnull_arg): Don't mark ctx arg as unused. Use it as a pointer to the location to use for the warning. (check_function_arguments): New arg loc. All callers changed. Pass it to check_function_nonnull. * c-common.h (check_function_arguments): Adjust declaration. testsuite/ PR c/66208 * c-c++-common/pr66208.c: New file. From-SVN: r232345
2016-01-10Fix -Wmisleading indentation false-positive for do-while statementPatrick Palka2-1/+12
gcc/c-family/ChangeLog: PR c++/69029 * c-indentation.c (should_warn_for_misleading_indentation): Don't warn about do-while statements. gcc/testsuite/ChangeLog: PR c++/69029 * c-c++-common/Wisleading-indentation.c: Augment test. From-SVN: r232202
2016-01-07PR c/68966 - atomic_fetch_* on atomic_bool not diagnosedMartin Sebor2-5/+39
gcc/ChangeLog: * doc/extend.texi (__atomic Builtins, __sync Builtins): Document constraint on the type of arguments. gcc/c-family/ChangeLog: * c-common.c (sync_resolve_size): Reject first argument when it's a pointer to _Bool. gcc/testsuite/ChangeLog: * gcc.dg/atomic-fetch-bool.c: New test. * gcc.dg/sync-fetch-bool.c: New test. From-SVN: r232147
2016-01-05Fix PR c/69122 (-Wmisleading-indentation false positive with empty macros)David Malcolm2-2/+32
gcc/c-family/ChangeLog: PR c/69122 * c-indentation.c (get_visual_column): Remove default argument. (should_warn_for_misleading_indentation): For the multiline case, update call to get_visual_column for next_stmt_exploc so that it captures the location of the first non-whitespace character in the relevant line. Don't issue warnings if there is non-whitespace before the next statement. gcc/testsuite/ChangeLog: PR c/69122 * c-c++-common/Wmisleading-indentation.c (pr69122): New function. From-SVN: r232076
2016-01-04Update copyright years.Jakub Jelinek35-35/+39
From-SVN: r232055
2015-12-21C and C++ FE: fix source ranges for binary opsDavid Malcolm3-6/+24
gcc/c-family/ChangeLog: * c-common.c (binary_op_error): Convert first param from location_t to rich_location * and use it when emitting an error. * c-common.h (binary_op_error): Convert first param from location_t to rich_location *. gcc/c/ChangeLog: * c-typeck.c: Include "gcc-rich-location.h". (build_binary_op): In the two places that call binary_op_error, create a gcc_rich_location and populate it with the location of the binary op and its two operands. gcc/cp/ChangeLog: * typeck.c (cp_build_binary_op): Update for change in signature of build_binary_op. Use error_at to replace an implicit use of input_location with param "location" in "invalid operands" error. (cp_build_binary_op): Replace an error with an error_at, using "location", rather than implicitly using input_location. gcc/testsuite/ChangeLog: * g++.dg/diagnostic/bad-binary-ops.C: New test case. * gcc.dg/bad-binary-ops.c: New test case. gcc.dg/plugin/diagnostic_plugin_show_trees.c (get_range_for_expr): Remove material copied from gcc-rich-location.c (gcc_rich_location::add_expr): Likewise. From-SVN: r231884
2015-12-16Better error recovery for merge-conflict markersDavid Malcolm3-0/+35
gcc/c-family/ChangeLog: * c-common.h (conflict_marker_get_final_tok_kind): New prototype. * c-lex.c (conflict_marker_get_final_tok_kind): New function. gcc/c/ChangeLog: * c-parser.c (struct c_parser): Expand array "tokens_buf" from 2 to 4. (c_parser_peek_nth_token): New function. (c_parser_peek_conflict_marker): New function. (c_parser_error): Detect conflict markers and report them as such. gcc/cp/ChangeLog: * parser.c (cp_lexer_peek_conflict_marker): New function. (cp_parser_error): Detect conflict markers and report them as such. gcc/testsuite/ChangeLog: * c-c++-common/conflict-markers-1.c: New testcase. * c-c++-common/conflict-markers-2.c: Likewise. * c-c++-common/conflict-markers-3.c: Likewise. * c-c++-common/conflict-markers-4.c: Likewise. * c-c++-common/conflict-markers-5.c: Likewise. * c-c++-common/conflict-markers-6.c: Likewise. * c-c++-common/conflict-markers-7.c: Likewise. * c-c++-common/conflict-markers-8.c: Likewise. * c-c++-common/conflict-markers-9.c: Likewise. * c-c++-common/conflict-markers-10.c: Likewise. * c-c++-common/conflict-markers-11.c: Likewise. * g++.dg/conflict-markers-1.C: Likewise. From-SVN: r231712
2015-12-15c-common.c (c_common_attribute_table): Handle "omp declare target link" ↵Ilya Verbin2-0/+7
attribute. gcc/c-family/ * c-common.c (c_common_attribute_table): Handle "omp declare target link" attribute. gcc/ * cgraphunit.c (output_in_order): Do not assemble "omp declare target link" variables in ACCEL_COMPILER. * gimplify.c (gimplify_adjust_omp_clauses): Do not remove mapping of "omp declare target link" variables. * omp-low.c (scan_sharing_clauses): Do not remove mapping of "omp declare target link" variables. (add_decls_addresses_to_decl_constructor): For "omp declare target link" variables output address of the artificial pointer instead of address of the variable. Set most significant bit of the size to mark them. (pass_data_omp_target_link): New pass_data. (pass_omp_target_link): New class. (find_link_var_op): New static function. (make_pass_omp_target_link): New function. * passes.def: Add pass_omp_target_link. * tree-pass.h (make_pass_omp_target_link): Declare. * varpool.c (symbol_table::output_variables): Do not assemble "omp declare target link" variables in ACCEL_COMPILER. gcc/lto/ * lto.c: Include stringpool.h and fold-const.h. (offload_handle_link_vars): New static function. (lto_main): Call offload_handle_link_vars. libgomp/ * libgomp.h (REFCOUNT_LINK): Define. (struct splay_tree_key_s): Add link_key. * target.c (gomp_map_vars): Treat REFCOUNT_LINK objects as not mapped. Replace target address of the pointer with target address of newly mapped object in the splay tree. Set link pointer on target to the device address of the mapped object. (gomp_unmap_vars): Restore target address of the pointer in the splay tree for REFCOUNT_LINK objects after unmapping. (gomp_load_image_to_device): Set refcount to REFCOUNT_LINK for "omp declare target link" objects. (gomp_unload_image_from_device): Replace j with i. Force unmap of all "omp declare target link" objects, which were mapped for the image. (gomp_exit_data): Restore target address of the pointer in the splay tree for REFCOUNT_LINK objects after unmapping. * testsuite/libgomp.c/target-link-1.c: New file. From-SVN: r231655
2015-12-14re PR c/68833 (-Werror=format issues an error now)Jakub Jelinek2-2/+7
PR c/68833 * common.opt (Wmissing-noreturn): Add Warning option. * opts-common.c (control_warning_option): If opt is alias_target with alias_arg, set arg to it. * c.opt (Wmissing-format-attribute, Wnormalized): Add Warning option. * c-c++-common/pr68833-1.c: New test. * c-c++-common/pr68833-2.c: New test. From-SVN: r231624
2015-12-12re PR fortran/68815 (Error/warning diagnostic: '%s' should be converted to ↵Tobias Burnus2-3/+9
%qs-like or %<%s%>-like string strings) 2014-12-12 Tobias Burnus <burnus@net-b.de> gcc/c-family/ PR fortran/68815 * c-format.c (gcc_gfc_char_table): Add 'q' flag to remaining specifiers (%d, %i,%u and %c). gcc/fortran/ PR fortran/68815 * check.c (gfc_check_reshape): Replace %<%d%> by %qd. * matchexp.c (gfc_match_defined_op_name): Use %qc. * symbol.c (gfc_add_new_implicit_range, gfc_merge_new_implicit): Ditto. From-SVN: r231584
2015-12-12re PR sanitizer/68418 (ubsan complains about left shifts even with -fwrapv)Paolo Bonzini1-6/+9
gcc: PR sanitizer/68418 * c-family/c-ubsan.c (ubsan_instrument_shift): Disable sanitization of left shifts for wrapping signed types as well. gcc/testsuite: PR sanitizer/68418 * gcc.dg/ubsan/c99-wrapv-shift-1.c, gcc.dg/ubsan/c99-wrapv-shift-2.c: New testcases. From-SVN: r231582
2015-12-10Add -Wmisleading-indentation to -WallDavid Malcolm2-1/+5
gcc/c-family/ChangeLog: * c.opt (Wmisleading-indentation): Add to -Wall for C and C++. gcc/ChangeLog: * doc/invoke.texi (-Wall): Add -Wmisleading-indentation to the list. (-Wmisleading-indentation): Update documentation to reflect being enabled by -Wall in C/C++. From-SVN: r231539
2015-12-09c-omp.c (c_finish_oacc_wait): Remove add_stmt() call.Chung-Lin Tang1-1/+0
2015-12-09 Chung-Lin Tang <cltang@codesourcery.com> * c-family/c-omp.c (c_finish_oacc_wait): Remove add_stmt() call. * c/c-parser.c (c_parser_oacc_wait): Add add_stmt() call. * cp/parser.c (cp_parser_oacc_wait): Add finish_expr_stmt() call. From-SVN: r231441
2015-12-08re PR c/48088 (-Werror=frame-larger-than=100 does not work as expected)Jakub Jelinek3-3/+15
PR c/48088 PR c/68657 * common.opt (Wframe-larger-than=): Add Warning. * opts.h (control_warning_option): Add ARG argument. * opts-common.c (cmdline_handle_error): New function. (read_cmdline_option): Use it. (control_warning_option): Likewise. Add ARG argument. If non-NULL, decode it if needed and pass through to handle_generated_option. Handle CLVC_ENUM like CLVC_BOOLEAN. * opts.c (common_handle_option): Adjust control_warning_option caller. (enable_warning_as_error): Likewise. c-family/ * c.opt (Wfloat-conversion, Wsign-conversion): Add Warning. * c-pragma.c (handle_pragma_diagnostic): Adjust control_warning_option caller. ada/ * gcc-interface/trans.c (Pragma_to_gnu): Adjust control_warning_option caller. testsuite/ * c-c++-common/pr68657-1.c: New test. * c-c++-common/pr68657-2.c: New test. * c-c++-common/pr68657-3.c: New test. * gcc.dg/cpp/warn-normalized-3.c: Use -Werror=normalized=nfc instead of -Werror=normalized= in dg-options. From-SVN: r231406
2015-12-07Fix missing range information for "%q+D" format codeDavid Malcolm2-3/+6
gcc/c-family/ChangeLog: * c-common.c (c_cpp_error): Update for change to rich_location::set_range. gcc/fortran/ChangeLog: * error.c (gfc_format_decoder): Update for change of text_info::set_range to text_info::set_location. gcc/ChangeLog: * pretty-print.c (text_info::set_range): Rename to... (text_info::set_location): ...this, converting 2nd param from source_range to a location_t. * pretty-print.h (text_info::set_location): Convert from inline function to external definition. (text_info::set_range): Delete. gcc/testsuite/ChangeLog: * gcc.dg/diagnostic-ranges-1.c: New test file. * gcc.dg/plugin/diagnostic-test-show-locus-bw.c (test_percent_q_plus_d): New test function. * gcc.dg/plugin/diagnostic_plugin_test_show_locus.c (test_show_locus): Rewrite test code using rich_location::set_range. Add code to unit-test the "%q+D" format code. libcpp/ChangeLog: * include/line-map.h (rich_location::set_range): Add line_maps * param; convert param from source_range to source_location. Drop "overwrite_loc_p" param. * line-map.c (rich_location::set_range): Likewise, acting as if "overwrite_loc_p" were true, and getting range from the location. From-SVN: r231367