diff options
Diffstat (limited to 'gcc/c-family')
33 files changed, 272 insertions, 180 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 43c4dad0945..defc0030a64 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,96 @@ +2014-01-02 Richard Sandiford <rdsandiford@googlemail.com> + + Update copyright years + +2014-01-02 Richard Sandiford <rdsandiford@googlemail.com> + + * array-notation-common.c, c-cilkplus.c: Use the standard form for + the copyright notice. + +2013-12-28 Eric Botcazou <ebotcazou@adacore.com> + + * c-ada-spec.c (print_constructor): New function. + (print_destructor): Retrieve the origin of the destructor. + (print_ada_declaration): Revamp handling of constructors/destructors. + +2013-12-23 Stuart Hastings <stuart@apple.com> + Bill Maddox <maddox@google.com> + Jason Merrill <jason@redhat.com> + + * c.opt: Add -fdeclone-ctor-dtor. + * c-opts.c (c_common_post_options): Default to on iff -Os. + +2013-12-18 Balaji V. Iyer <balaji.v.iyer@intel.com> + + * c-common.c (c_common_attribute_table): Added "cilk simd function" + attribute. + * c-pragma.h (enum pragma_cilk_clause): Remove. + (enum pragma_omp_clause): Added the following fields: + PRAGMA_CILK_CLAUSE_NOMASK, PRAGMA_CILK_CLAUSE_MASK, + PRAGMA_CILK_CLAUSE_VECTORLENGTH, PRAGMA_CILK_CLAUSE_NONE, + PRAGMA_CILK_CLAUSE_LINEAR, PRAGMA_CILK_CLAUSE_PRIVATE, + PRAGMA_CILK_CLAUSE_FIRSTPRIVATE, PRAGMA_CILK_CLAUSE_LASTPRIVATE, + PRAGMA_CILK_CLAUSE_UNIFORM. + + +2013-12-11 Balaji V. Iyer <balaji.v.iyer@intel.com> + + * cilk.c (cilk_outline): Made this function non-static. + (gimplify_cilk_spawn): Removed pre_p and post_p arguments. + (create_cilk_wrapper): Added a new parameter: a function pointer. + (c_install_body_w_frame_cleanup): Remove + (extract_free_variables): Added VEC_INIT_EXPR and CONSTRUCTOR case. + * c-common.h (cilk_outline): New prototype. + (gimplify_cilk_spawn): Removed two parameters. + (cilk_install_body_with_frame_cleanup): New prototype. + * c-gimplify.c (c_gimplify_expr): Added MODIFY_EXPR, CALL_EXPR and + CILK_SPAWN_STMT case. + +2013-12-11 Bernd Schmidt <bernds@codesourcery.com> + + * c-common.c (c_fully_fold_internal): Handle ADDR_SPACE_CONVERT_EXPR. + + * c-common.h (enum c_tree_index): Remove CTI_INT_ARRAY_TYPE. + (int_array_type_node): Remove. + * c-common.c (c_common_nodes_and_builtins): Don't build it. + +2013-12-05 Marek Polacek <polacek@redhat.com> + + PR c/52023 + * c-common.c (c_sizeof_or_alignof_type): Move a declaration into + [ADJUST_FIELD_ALIGN]. + +2013-12-04 Joseph Myers <joseph@codesourcery.com> + + PR c/52023 + * c-common.c (c_sizeof_or_alignof_type): Add parameter min_alignof + and check field alignment if set. + * c-common.h (c_sizeof_or_alignof_type): Update prototype. + (c_sizeof, c_alignof): Update calls to c_sizeof_or_alignof_type. + +2013-12-04 Jakub Jelinek <jakub@redhat.com> + Marek Polacek <polacek@redhat.com> + + * c-gimplify.c (c_gimplify_expr): If doing the integer-overflow + sanitization, call unsigned_type_for only when !TYPE_OVERFLOW_WRAPS. + +2013-11-29 H.J. Lu <hongjiu.lu@intel.com> + + PR c/59309 + * cilk.c (gimplify_cilk_spawn): Properly handle function without + arguments. + +2013-11-29 Jakub Jelinek <jakub@redhat.com> + + PR c/59280 + * c-common.c (get_priority): If TREE_VALUE (args) is IDENTIFIER_NODE, + goto invalid. If it is error_mark_node, don't issue further + diagnostics. + +2013-11-28 Sergey Ostanevich <sergos.gnu@gmail.com> + + * c.opt (Wopenmp-simd): New. + 2013-11-22 Jakub Jelinek <jakub@redhat.com> * c-ubsan.h (ubsan_instrument_return): New prototype. @@ -3284,7 +3377,7 @@ * c-common.c: Include gt-c-family-c-common.h. * c-pragma.c: Include gt-c-family-c-pragma.h. -Copyright (C) 2010-2013 Free Software Foundation, Inc. +Copyright (C) 2010-2014 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright diff --git a/gcc/c-family/array-notation-common.c b/gcc/c-family/array-notation-common.c index c54f444f757..c0100398a8b 100644 --- a/gcc/c-family/array-notation-common.c +++ b/gcc/c-family/array-notation-common.c @@ -1,7 +1,7 @@ /* This file is part of the Intel(R) Cilk(TM) Plus support This file contains the builtin functions for Array notations. - Copyright (C) 2013 Free Software Foundation, Inc. + Copyright (C) 2013-2014 Free Software Foundation, Inc. Contributed by Balaji V. Iyer <balaji.v.iyer@intel.com>, Intel Corporation diff --git a/gcc/c-family/c-ada-spec.c b/gcc/c-family/c-ada-spec.c index 1724c748af5..df4a1f232b9 100644 --- a/gcc/c-family/c-ada-spec.c +++ b/gcc/c-family/c-ada-spec.c @@ -1,6 +1,6 @@ /* Print GENERIC declaration (functions, variables, types) trees coming from the C and C++ front-ends as well as macros in Ada syntax. - Copyright (C) 2010-2013 Free Software Foundation, Inc. + Copyright (C) 2010-2014 Free Software Foundation, Inc. Adapted from tree-pretty-print.c by Arnaud Charlet <charlet@adacore.com> This file is part of GCC. @@ -2521,20 +2521,34 @@ dump_nested_types (pretty_printer *buffer, tree t, tree parent, bool forward, TREE_VISITED (t) = 1; } +/* Dump in BUFFER constructor spec corresponding to T. */ + +static void +print_constructor (pretty_printer *buffer, tree t) +{ + tree decl_name = DECL_NAME (DECL_ORIGIN (t)); + + pp_string (buffer, "New_"); + pp_ada_tree_identifier (buffer, decl_name, t, false); +} + /* Dump in BUFFER destructor spec corresponding to T. */ static void print_destructor (pretty_printer *buffer, tree t) { - const char *s = IDENTIFIER_POINTER (DECL_NAME (t)); + tree decl_name = DECL_NAME (DECL_ORIGIN (t)); + const char *s = IDENTIFIER_POINTER (decl_name); if (*s == '_') - for (s += 2; *s != ' '; s++) - pp_character (buffer, *s); + { + for (s += 2; *s != ' '; s++) + pp_character (buffer, *s); + } else { pp_string (buffer, "Delete_"); - pp_ada_tree_identifier (buffer, DECL_NAME (t), t, false); + pp_ada_tree_identifier (buffer, decl_name, t, false); } } @@ -2785,7 +2799,7 @@ print_ada_declaration (pretty_printer *buffer, tree t, tree type, int spc) } else if (TREE_CODE (t) == FUNCTION_DECL) { - bool is_function = true, is_abstract_class = false; + bool is_function, is_abstract_class = false; bool is_method = TREE_CODE (TREE_TYPE (t)) == METHOD_TYPE; tree decl_name = DECL_NAME (t); int prev_in_function = in_function; @@ -2805,24 +2819,21 @@ print_ada_declaration (pretty_printer *buffer, tree t, tree type, int spc) is_copy_constructor = cpp_check (t, IS_COPY_CONSTRUCTOR); } - /* Skip __comp_dtor destructor which is redundant with the '~class()' - destructor. */ - if (is_destructor - && !strncmp (IDENTIFIER_POINTER (decl_name), "__comp", 6)) - return 0; - /* Skip copy constructors: some are internal only, and those that are not cannot be called easily from Ada anyway. */ if (is_copy_constructor) return 0; - /* If this function has an entry in the dispatch table, we cannot - omit it. */ - if (!DECL_VINDEX (t) && *IDENTIFIER_POINTER (decl_name) == '_') + if (is_constructor || is_destructor) { - if (IDENTIFIER_POINTER (decl_name)[1] == '_') + /* Only consider constructors/destructors for complete objects. */ + if (strncmp (IDENTIFIER_POINTER (decl_name), "__comp", 6) != 0) return 0; + } + /* If this function has an entry in the vtable, we cannot omit it. */ + else if (!DECL_VINDEX (t) && *IDENTIFIER_POINTER (decl_name) == '_') + { INDENT (spc); pp_string (buffer, "-- skipped func "); pp_string (buffer, IDENTIFIER_POINTER (decl_name)); @@ -2832,19 +2843,22 @@ print_ada_declaration (pretty_printer *buffer, tree t, tree type, int spc) if (need_indent) INDENT (spc); - if (is_constructor) - pp_string (buffer, "function New_"); - else if (VOID_TYPE_P (TREE_TYPE (TREE_TYPE (t)))) + if (VOID_TYPE_P (TREE_TYPE (TREE_TYPE (t))) && !is_constructor) { - is_function = false; pp_string (buffer, "procedure "); + is_function = false; } else - pp_string (buffer, "function "); + { + pp_string (buffer, "function "); + is_function = true; + } in_function = is_function; - if (is_destructor) + if (is_constructor) + print_constructor (buffer, t); + else if (is_destructor) print_destructor (buffer, t); else dump_ada_decl_name (buffer, t, false); @@ -2856,16 +2870,9 @@ print_ada_declaration (pretty_printer *buffer, tree t, tree type, int spc) if (is_function) { pp_string (buffer, " return "); - - if (is_constructor) - { - dump_ada_decl_name (buffer, t, false); - } - else - { - dump_generic_ada_node - (buffer, TREE_TYPE (TREE_TYPE (t)), type, spc, false, true); - } + tree ret_type + = is_constructor ? DECL_CONTEXT (t) : TREE_TYPE (TREE_TYPE (t)); + dump_generic_ada_node (buffer, ret_type, type, spc, false, true); } if (is_constructor @@ -2877,7 +2884,7 @@ print_ada_declaration (pretty_printer *buffer, tree t, tree type, int spc) for (tmp = TYPE_METHODS (type); tmp; tmp = TREE_CHAIN (tmp)) if (cpp_check (tmp, IS_ABSTRACT)) { - is_abstract_class = 1; + is_abstract_class = true; break; } } @@ -2896,8 +2903,8 @@ print_ada_declaration (pretty_printer *buffer, tree t, tree type, int spc) if (is_constructor) { - pp_string (buffer, "pragma CPP_Constructor (New_"); - dump_ada_decl_name (buffer, t, false); + pp_string (buffer, "pragma CPP_Constructor ("); + print_constructor (buffer, t); pp_string (buffer, ", \""); pp_asm_name (buffer, t); pp_string (buffer, "\");"); diff --git a/gcc/c-family/c-ada-spec.h b/gcc/c-family/c-ada-spec.h index 64f0ecd4b22..3d1f1655dfb 100644 --- a/gcc/c-family/c-ada-spec.h +++ b/gcc/c-family/c-ada-spec.h @@ -1,5 +1,5 @@ /* Interface for -fdump-ada-spec capability. - Copyright (C) 2010-2013 Free Software Foundation, Inc. + Copyright (C) 2010-2014 Free Software Foundation, Inc. This file is part of GCC. diff --git a/gcc/c-family/c-cilkplus.c b/gcc/c-family/c-cilkplus.c index 6fa979d652d..1a16f6690b0 100644 --- a/gcc/c-family/c-cilkplus.c +++ b/gcc/c-family/c-cilkplus.c @@ -1,7 +1,7 @@ /* This file contains routines to construct and validate Cilk Plus constructs within the C and C++ front ends. - Copyright (C) 2013 Free Software Foundation, Inc. + Copyright (C) 2013-2014 Free Software Foundation, Inc. Contributed by Aldy Hernandez <aldyh@redhat.com>. This file is part of GCC. diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 60b069cdb69..40d12bca809 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -1,5 +1,5 @@ /* Subroutines shared by all languages that are variants of C. - Copyright (C) 1992-2013 Free Software Foundation, Inc. + Copyright (C) 1992-2014 Free Software Foundation, Inc. This file is part of GCC. @@ -121,11 +121,6 @@ cpp_reader *parse_in; /* Declared in c-pragma.h. */ tree char_array_type_node; - Type `int[SOMENUMBER]' or something like it. - Used when an array of int needed and the size is irrelevant. - - tree int_array_type_node; - Type `wchar_t[SOMENUMBER]' or something like it. Used when a wide string literal is created. @@ -382,8 +377,6 @@ static tree handle_omp_declare_simd_attribute (tree *, tree, tree, int, bool *); static tree handle_omp_declare_target_attribute (tree *, tree, tree, int, bool *); -static tree handle_bnd_variable_size_attribute (tree *, tree, tree, int, bool *); -static tree handle_bnd_legacy (tree *, tree, tree, int, bool *); static void check_function_nonnull (tree, int, tree *); static void check_nonnull_arg (void *, tree, unsigned HOST_WIDE_INT); @@ -769,12 +762,10 @@ const struct attribute_spec c_common_attribute_table[] = handle_returns_nonnull_attribute, false }, { "omp declare simd", 0, -1, true, false, false, handle_omp_declare_simd_attribute, false }, + { "cilk simd function", 0, -1, true, false, false, + handle_omp_declare_simd_attribute, false }, { "omp declare target", 0, 0, true, false, false, handle_omp_declare_target_attribute, false }, - { "bnd_variable_size", 0, 0, true, false, false, - handle_bnd_variable_size_attribute, false }, - { "bnd_legacy", 0, 0, true, false, false, - handle_bnd_legacy, false }, { NULL, 0, 0, false, false, false, NULL, false } }; @@ -1334,6 +1325,7 @@ c_fully_fold_internal (tree expr, bool in_init, bool *maybe_const_operands, case FIX_TRUNC_EXPR: case FLOAT_EXPR: CASE_CONVERT: + case ADDR_SPACE_CONVERT_EXPR: case VIEW_CONVERT_EXPR: case NON_LVALUE_EXPR: case NEGATE_EXPR: @@ -4927,14 +4919,17 @@ c_common_get_alias_set (tree t) } /* Compute the value of 'sizeof (TYPE)' or '__alignof__ (TYPE)', where - the second parameter indicates which OPERATOR is being applied. + the IS_SIZEOF parameter indicates which operator is being applied. The COMPLAIN flag controls whether we should diagnose possibly ill-formed constructs or not. LOC is the location of the SIZEOF or - TYPEOF operator. */ + TYPEOF operator. If MIN_ALIGNOF, the least alignment required for + a type in any context should be returned, rather than the normal + alignment for that type. */ tree c_sizeof_or_alignof_type (location_t loc, - tree type, bool is_sizeof, int complain) + tree type, bool is_sizeof, bool min_alignof, + int complain) { const char *op_name; tree value = NULL; @@ -5000,6 +4995,22 @@ c_sizeof_or_alignof_type (location_t loc, value = size_binop_loc (loc, CEIL_DIV_EXPR, TYPE_SIZE_UNIT (type), size_int (TYPE_PRECISION (char_type_node) / BITS_PER_UNIT)); + else if (min_alignof) + { + unsigned int align = TYPE_ALIGN (type); + align = MIN (align, BIGGEST_ALIGNMENT); +#ifdef BIGGEST_FIELD_ALIGNMENT + align = MIN (align, BIGGEST_FIELD_ALIGNMENT); +#endif + unsigned int field_align = align; +#ifdef ADJUST_FIELD_ALIGN + tree field = build_decl (UNKNOWN_LOCATION, FIELD_DECL, NULL_TREE, + type); + field_align = ADJUST_FIELD_ALIGN (field, field_align); +#endif + align = MIN (align, field_align); + value = size_int (align / BITS_PER_UNIT); + } else value = size_int (TYPE_ALIGN_UNIT (type)); } @@ -5506,10 +5517,6 @@ c_common_nodes_and_builtins (void) char_array_type_node = build_array_type (char_type_node, array_domain_type); - /* Likewise for arrays of ints. */ - int_array_type_node - = build_array_type (integer_type_node, array_domain_type); - string_type_node = build_pointer_type (char_type_node); const_string_type_node = build_pointer_type (build_qualified_type @@ -7014,6 +7021,10 @@ get_priority (tree args, bool is_destructor) } arg = TREE_VALUE (args); + if (TREE_CODE (arg) == IDENTIFIER_NODE) + goto invalid; + if (arg == error_mark_node) + return DEFAULT_INIT_PRIORITY; arg = default_conversion (arg); if (!tree_fits_shwi_p (arg) || !INTEGRAL_TYPE_P (TREE_TYPE (arg))) @@ -8045,38 +8056,6 @@ handle_fnspec_attribute (tree *node ATTRIBUTE_UNUSED, tree ARG_UNUSED (name), return NULL_TREE; } -/* Handle a "bnd_variable_size" attribute; arguments as in - struct attribute_spec.handler. */ - -static tree -handle_bnd_variable_size_attribute (tree *node, tree name, tree ARG_UNUSED (args), - int ARG_UNUSED (flags), bool *no_add_attrs) -{ - if (TREE_CODE (*node) != FIELD_DECL) - { - warning (OPT_Wattributes, "%qE attribute ignored", name); - *no_add_attrs = true; - } - - return NULL_TREE; -} - -/* Handle a "bnd_legacy" attribute; arguments as in - struct attribute_spec.handler. */ - -static tree -handle_bnd_legacy (tree *node, tree name, tree ARG_UNUSED (args), - int ARG_UNUSED (flags), bool *no_add_attrs) -{ - if (TREE_CODE (*node) != FUNCTION_DECL) - { - warning (OPT_Wattributes, "%qE attribute ignored", name); - *no_add_attrs = true; - } - - return NULL_TREE; -} - /* Handle a "warn_unused" attribute; arguments as in struct attribute_spec.handler. */ diff --git a/gcc/c-family/c-common.def b/gcc/c-family/c-common.def index fac50e23777..a181475bc51 100644 --- a/gcc/c-family/c-common.def +++ b/gcc/c-family/c-common.def @@ -1,7 +1,7 @@ /* This file contains the definitions and documentation for the additional tree codes used in the GNU C compiler (see tree.def for the standard codes). - Copyright (C) 1987-2013 Free Software Foundation, Inc. + Copyright (C) 1987-2014 Free Software Foundation, Inc. Written by Benjamin Chelf <chelf@codesourcery.com> This file is part of GCC. diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h index 664e9287a1b..7e3ece6a691 100644 --- a/gcc/c-family/c-common.h +++ b/gcc/c-family/c-common.h @@ -1,5 +1,5 @@ /* Definitions for c-common.c. - Copyright (C) 1987-2013 Free Software Foundation, Inc. + Copyright (C) 1987-2014 Free Software Foundation, Inc. This file is part of GCC. @@ -281,7 +281,6 @@ enum c_tree_index CTI_CHAR16_ARRAY_TYPE, CTI_CHAR32_ARRAY_TYPE, CTI_WCHAR_ARRAY_TYPE, - CTI_INT_ARRAY_TYPE, CTI_STRING_TYPE, CTI_CONST_STRING_TYPE, @@ -421,7 +420,6 @@ extern const unsigned int num_c_common_reswords; #define char16_array_type_node c_global_trees[CTI_CHAR16_ARRAY_TYPE] #define char32_array_type_node c_global_trees[CTI_CHAR32_ARRAY_TYPE] #define wchar_array_type_node c_global_trees[CTI_WCHAR_ARRAY_TYPE] -#define int_array_type_node c_global_trees[CTI_INT_ARRAY_TYPE] #define string_type_node c_global_trees[CTI_STRING_TYPE] #define const_string_type_node c_global_trees[CTI_CONST_STRING_TYPE] @@ -759,7 +757,7 @@ extern tree c_wrap_maybe_const (tree, bool); extern tree c_save_expr (tree); extern tree c_common_truthvalue_conversion (location_t, tree); extern void c_apply_type_quals_to_decl (int, tree); -extern tree c_sizeof_or_alignof_type (location_t, tree, bool, int); +extern tree c_sizeof_or_alignof_type (location_t, tree, bool, bool, int); extern tree c_alignof_expr (location_t, tree); /* Print an error message for invalid operands to arith operation CODE. NOP_EXPR is used as a special case (see truthvalue_conversion). */ @@ -792,8 +790,8 @@ extern bool keyword_is_type_qualifier (enum rid); extern bool keyword_is_decl_specifier (enum rid); extern bool cxx_fundamental_alignment_p (unsigned); -#define c_sizeof(LOC, T) c_sizeof_or_alignof_type (LOC, T, true, 1) -#define c_alignof(LOC, T) c_sizeof_or_alignof_type (LOC, T, false, 1) +#define c_sizeof(LOC, T) c_sizeof_or_alignof_type (LOC, T, true, false, 1) +#define c_alignof(LOC, T) c_sizeof_or_alignof_type (LOC, T, false, false, 1) /* Subroutine of build_binary_op, used for certain operations. */ extern tree shorten_binary_op (tree result_type, tree op0, tree op1, bool bitwise); @@ -1378,8 +1376,8 @@ extern vec <tree, va_gc> *fix_sec_implicit_args /* In cilk.c. */ extern tree insert_cilk_frame (tree); extern void cilk_init_builtins (void); -extern int gimplify_cilk_spawn (tree *, gimple_seq *, gimple_seq *); -extern void c_cilk_install_body_w_frame_cleanup (tree, tree); +extern int gimplify_cilk_spawn (tree *); +extern void cilk_install_body_with_frame_cleanup (tree, tree, void *); extern bool cilk_detect_spawn_and_unwrap (tree *); extern bool cilk_set_spawn_marker (location_t, tree); extern tree build_cilk_sync (void); @@ -1387,5 +1385,5 @@ extern tree build_cilk_spawn (location_t, tree); extern tree make_cilk_frame (tree); extern tree create_cilk_function_exit (tree, bool, bool); extern tree cilk_install_body_pedigree_operations (tree); - +extern void cilk_outline (tree, tree *, void *); #endif /* ! GCC_C_COMMON_H */ diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c index eb96b8338b0..2f2e7bae824 100644 --- a/gcc/c-family/c-cppbuiltin.c +++ b/gcc/c-family/c-cppbuiltin.c @@ -1,5 +1,5 @@ /* Define builtin-in macros for the C family front ends. - Copyright (C) 2002-2013 Free Software Foundation, Inc. + Copyright (C) 2002-2014 Free Software Foundation, Inc. This file is part of GCC. diff --git a/gcc/c-family/c-dump.c b/gcc/c-family/c-dump.c index 3954331b1a2..b1b0c820143 100644 --- a/gcc/c-family/c-dump.c +++ b/gcc/c-family/c-dump.c @@ -1,5 +1,5 @@ /* Tree-dumping functionality for C-family languages. - Copyright (C) 2002-2013 Free Software Foundation, Inc. + Copyright (C) 2002-2014 Free Software Foundation, Inc. Written by Mark Mitchell <mark@codesourcery.com> This file is part of GCC. diff --git a/gcc/c-family/c-format.c b/gcc/c-family/c-format.c index 0552c84464f..cdc09c44b86 100644 --- a/gcc/c-family/c-format.c +++ b/gcc/c-family/c-format.c @@ -1,5 +1,5 @@ /* Check calls to formatted I/O functions (-Wformat). - Copyright (C) 1992-2013 Free Software Foundation, Inc. + Copyright (C) 1992-2014 Free Software Foundation, Inc. This file is part of GCC. diff --git a/gcc/c-family/c-format.h b/gcc/c-family/c-format.h index f1cf71e8c80..821a2cc7b7b 100644 --- a/gcc/c-family/c-format.h +++ b/gcc/c-family/c-format.h @@ -1,5 +1,5 @@ /* Check calls to formatted I/O functions (-Wformat). - Copyright (C) 1992-2013 Free Software Foundation, Inc. + Copyright (C) 1992-2014 Free Software Foundation, Inc. This file is part of GCC. diff --git a/gcc/c-family/c-gimplify.c b/gcc/c-family/c-gimplify.c index d047c65b4ee..737be4d7290 100644 --- a/gcc/c-family/c-gimplify.c +++ b/gcc/c-family/c-gimplify.c @@ -2,7 +2,7 @@ by the C-based front ends. The structure of gimplified, or language-independent, trees is dictated by the grammar described in this file. - Copyright (C) 2002-2013 Free Software Foundation, Inc. + Copyright (C) 2002-2014 Free Software Foundation, Inc. Lowering of expressions contributed by Sebastian Pop <s.pop@laposte.net> Re-written to support lowering of whole function trees, documentation and miscellaneous cleanups by Diego Novillo <dnovillo@redhat.com> @@ -44,7 +44,7 @@ along with GCC; see the file COPYING3. If not see #include "dumpfile.h" #include "c-pretty-print.h" #include "cgraph.h" - +#include "cilk.h" /* The gimplification pass converts the language-dependent trees (ld-trees) emitted by the parser into language-independent trees @@ -199,12 +199,34 @@ c_gimplify_expr (tree *expr_p, gimple_seq *pre_p ATTRIBUTE_UNUSED, tree type = TREE_TYPE (TREE_OPERAND (*expr_p, 0)); if (INTEGRAL_TYPE_P (type) && c_promoting_integer_type_p (type)) { - if (TYPE_OVERFLOW_UNDEFINED (type)) + if (TYPE_OVERFLOW_UNDEFINED (type) + || ((flag_sanitize & SANITIZE_SI_OVERFLOW) + && !TYPE_OVERFLOW_WRAPS (type))) type = unsigned_type_for (type); return gimplify_self_mod_expr (expr_p, pre_p, post_p, 1, type); } break; } + + case CILK_SPAWN_STMT: + gcc_assert + (fn_contains_cilk_spawn_p (cfun) + && cilk_detect_spawn_and_unwrap (expr_p)); + + /* If errors are seen, then just process it as a CALL_EXPR. */ + if (!seen_error ()) + return (enum gimplify_status) gimplify_cilk_spawn (expr_p); + + case MODIFY_EXPR: + case INIT_EXPR: + case CALL_EXPR: + if (fn_contains_cilk_spawn_p (cfun) + && cilk_detect_spawn_and_unwrap (expr_p) + /* If an error is found, the spawn wrapper is removed and the + original expression (MODIFY/INIT/CALL_EXPR) is processes as + it is supposed to be. */ + && !seen_error ()) + return (enum gimplify_status) gimplify_cilk_spawn (expr_p); default:; } diff --git a/gcc/c-family/c-lex.c b/gcc/c-family/c-lex.c index 2130296a390..e3e1da240d8 100644 --- a/gcc/c-family/c-lex.c +++ b/gcc/c-family/c-lex.c @@ -1,5 +1,5 @@ /* Mainly the interface between cpplib and the C front ends. - Copyright (C) 1987-2013 Free Software Foundation, Inc. + Copyright (C) 1987-2014 Free Software Foundation, Inc. This file is part of GCC. diff --git a/gcc/c-family/c-objc.h b/gcc/c-family/c-objc.h index bf4e3d536d6..f7fc9c4b489 100644 --- a/gcc/c-family/c-objc.h +++ b/gcc/c-family/c-objc.h @@ -1,5 +1,5 @@ /* Definitions of Objective-C front-end entry points used for C and C++. - Copyright (C) 1987-2013 Free Software Foundation, Inc. + Copyright (C) 1987-2014 Free Software Foundation, Inc. This file is part of GCC. diff --git a/gcc/c-family/c-omp.c b/gcc/c-family/c-omp.c index 3ccf8f91521..ac380ee7e1d 100644 --- a/gcc/c-family/c-omp.c +++ b/gcc/c-family/c-omp.c @@ -1,7 +1,7 @@ /* This file contains routines to construct GNU OpenMP constructs, called from parsing in the C and C++ front ends. - Copyright (C) 2005-2013 Free Software Foundation, Inc. + Copyright (C) 2005-2014 Free Software Foundation, Inc. Contributed by Richard Henderson <rth@redhat.com>, Diego Novillo <dnovillo@redhat.com>. diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c index f368cab289f..b7478f3a2d6 100644 --- a/gcc/c-family/c-opts.c +++ b/gcc/c-family/c-opts.c @@ -1,5 +1,5 @@ /* C/ObjC/C++ command line option handling. - Copyright (C) 2002-2013 Free Software Foundation, Inc. + Copyright (C) 2002-2014 Free Software Foundation, Inc. Contributed by Neil Booth. This file is part of GCC. @@ -899,6 +899,10 @@ c_common_post_options (const char **pfilename) if (warn_implicit_function_declaration == -1) warn_implicit_function_declaration = flag_isoc99; + /* Declone C++ 'structors if -Os. */ + if (flag_declone_ctor_dtor == -1) + flag_declone_ctor_dtor = optimize_size; + if (cxx_dialect >= cxx11) { /* If we're allowing C++0x constructs, don't warn about C++98 diff --git a/gcc/c-family/c-pch.c b/gcc/c-family/c-pch.c index 7b0eca7fde1..e51d5b9409e 100644 --- a/gcc/c-family/c-pch.c +++ b/gcc/c-family/c-pch.c @@ -1,5 +1,5 @@ /* Precompiled header implementation for the C languages. - Copyright (C) 2000-2013 Free Software Foundation, Inc. + Copyright (C) 2000-2014 Free Software Foundation, Inc. This file is part of GCC. diff --git a/gcc/c-family/c-ppoutput.c b/gcc/c-family/c-ppoutput.c index 03b88170520..f3b5fa4487d 100644 --- a/gcc/c-family/c-ppoutput.c +++ b/gcc/c-family/c-ppoutput.c @@ -1,5 +1,5 @@ /* Preprocess only, using cpplib. - Copyright (C) 1995-2013 Free Software Foundation, Inc. + Copyright (C) 1995-2014 Free Software Foundation, Inc. Written by Per Bothner, 1994-95. This program is free software; you can redistribute it and/or modify it diff --git a/gcc/c-family/c-pragma.c b/gcc/c-family/c-pragma.c index 64a5b667499..af280856999 100644 --- a/gcc/c-family/c-pragma.c +++ b/gcc/c-family/c-pragma.c @@ -1,5 +1,5 @@ /* Handle #pragma, system V.4 style. Supports #pragma weak and #pragma pack. - Copyright (C) 1992-2013 Free Software Foundation, Inc. + Copyright (C) 1992-2014 Free Software Foundation, Inc. This file is part of GCC. diff --git a/gcc/c-family/c-pragma.h b/gcc/c-family/c-pragma.h index 5379b9e4eb8..6f1bf74c2a9 100644 --- a/gcc/c-family/c-pragma.h +++ b/gcc/c-family/c-pragma.h @@ -1,5 +1,5 @@ /* Pragma related interfaces. - Copyright (C) 1995-2013 Free Software Foundation, Inc. + Copyright (C) 1995-2014 Free Software Foundation, Inc. This file is part of GCC. @@ -103,19 +103,20 @@ typedef enum pragma_omp_clause { PRAGMA_OMP_CLAUSE_THREAD_LIMIT, PRAGMA_OMP_CLAUSE_TO, PRAGMA_OMP_CLAUSE_UNIFORM, - PRAGMA_OMP_CLAUSE_UNTIED -} pragma_omp_clause; - -/* All Cilk Plus #pragma omp clauses. */ -typedef enum pragma_cilk_clause { - PRAGMA_CILK_CLAUSE_NONE = 0, + PRAGMA_OMP_CLAUSE_UNTIED, + + /* Clauses for Cilk Plus SIMD-enabled function. */ + PRAGMA_CILK_CLAUSE_NOMASK, + PRAGMA_CILK_CLAUSE_MASK, PRAGMA_CILK_CLAUSE_VECTORLENGTH, - PRAGMA_CILK_CLAUSE_LINEAR, - PRAGMA_CILK_CLAUSE_PRIVATE, - PRAGMA_CILK_CLAUSE_FIRSTPRIVATE, - PRAGMA_CILK_CLAUSE_LASTPRIVATE, - PRAGMA_CILK_CLAUSE_REDUCTION -} pragma_cilk_clause; + PRAGMA_CILK_CLAUSE_NONE = PRAGMA_OMP_CLAUSE_NONE, + PRAGMA_CILK_CLAUSE_LINEAR = PRAGMA_OMP_CLAUSE_LINEAR, + PRAGMA_CILK_CLAUSE_PRIVATE = PRAGMA_OMP_CLAUSE_PRIVATE, + PRAGMA_CILK_CLAUSE_FIRSTPRIVATE = PRAGMA_OMP_CLAUSE_FIRSTPRIVATE, + PRAGMA_CILK_CLAUSE_LASTPRIVATE = PRAGMA_OMP_CLAUSE_LASTPRIVATE, + PRAGMA_CILK_CLAUSE_REDUCTION = PRAGMA_OMP_CLAUSE_REDUCTION, + PRAGMA_CILK_CLAUSE_UNIFORM = PRAGMA_OMP_CLAUSE_UNIFORM +} pragma_omp_clause; extern struct cpp_reader* parse_in; diff --git a/gcc/c-family/c-pretty-print.c b/gcc/c-family/c-pretty-print.c index d1b588033dd..62a00306fba 100644 --- a/gcc/c-family/c-pretty-print.c +++ b/gcc/c-family/c-pretty-print.c @@ -1,5 +1,5 @@ /* Subroutines common to both C and C++ pretty-printers. - Copyright (C) 2002-2013 Free Software Foundation, Inc. + Copyright (C) 2002-2014 Free Software Foundation, Inc. Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net> This file is part of GCC. diff --git a/gcc/c-family/c-pretty-print.h b/gcc/c-family/c-pretty-print.h index aa046e51dad..7ad6dfb760c 100644 --- a/gcc/c-family/c-pretty-print.h +++ b/gcc/c-family/c-pretty-print.h @@ -1,5 +1,5 @@ /* Various declarations for the C and C++ pretty-printers. - Copyright (C) 2002-2013 Free Software Foundation, Inc. + Copyright (C) 2002-2014 Free Software Foundation, Inc. Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net> This file is part of GCC. diff --git a/gcc/c-family/c-semantics.c b/gcc/c-family/c-semantics.c index 44dc0bf7e7a..f25805a79b0 100644 --- a/gcc/c-family/c-semantics.c +++ b/gcc/c-family/c-semantics.c @@ -1,5 +1,5 @@ /* This file contains subroutine used by the C front-end to construct GENERIC. - Copyright (C) 2000-2013 Free Software Foundation, Inc. + Copyright (C) 2000-2014 Free Software Foundation, Inc. Written by Benjamin Chelf (chelf@codesourcery.com). This file is part of GCC. diff --git a/gcc/c-family/c-target-def.h b/gcc/c-family/c-target-def.h index e33396916d7..2b2eed2fd49 100644 --- a/gcc/c-family/c-target-def.h +++ b/gcc/c-family/c-target-def.h @@ -1,5 +1,5 @@ /* Default initializers for C-family target hooks. - Copyright (C) 2011-2013 Free Software Foundation, Inc. + Copyright (C) 2011-2014 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the diff --git a/gcc/c-family/c-target.def b/gcc/c-family/c-target.def index 925dbd14cc4..b55dda88095 100644 --- a/gcc/c-family/c-target.def +++ b/gcc/c-family/c-target.def @@ -1,5 +1,5 @@ /* Target hook definitions for C-family front ends. - Copyright (C) 2001-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2014 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the diff --git a/gcc/c-family/c-target.h b/gcc/c-family/c-target.h index 176f3fa0705..321e8ce4ac0 100644 --- a/gcc/c-family/c-target.h +++ b/gcc/c-family/c-target.h @@ -1,5 +1,5 @@ /* Data structure definitions for target-specific C-family behavior. - Copyright (C) 2001-2013 Free Software Foundation, Inc. + Copyright (C) 2001-2014 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the diff --git a/gcc/c-family/c-ubsan.c b/gcc/c-family/c-ubsan.c index a2769352be4..610c010bdde 100644 --- a/gcc/c-family/c-ubsan.c +++ b/gcc/c-family/c-ubsan.c @@ -1,5 +1,5 @@ /* UndefinedBehaviorSanitizer, undefined behavior detector. - Copyright (C) 2013 Free Software Foundation, Inc. + Copyright (C) 2013-2014 Free Software Foundation, Inc. Contributed by Marek Polacek <polacek@redhat.com> This file is part of GCC. diff --git a/gcc/c-family/c-ubsan.h b/gcc/c-family/c-ubsan.h index 9b91bad8cdc..e504b908fc6 100644 --- a/gcc/c-family/c-ubsan.h +++ b/gcc/c-family/c-ubsan.h @@ -1,5 +1,5 @@ /* UndefinedBehaviorSanitizer, undefined behavior detector. - Copyright (C) 2013 Free Software Foundation, Inc. + Copyright (C) 2013-2014 Free Software Foundation, Inc. Contributed by Marek Polacek <polacek@redhat.com> This file is part of GCC. diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt index ac678855414..38ae58efdb8 100644 --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -1,5 +1,5 @@ ; Options for the C, ObjC, C++ and ObjC++ front ends. -; Copyright (C) 2003-2013 Free Software Foundation, Inc. +; Copyright (C) 2003-2014 Free Software Foundation, Inc. ; ; This file is part of GCC. ; @@ -596,6 +596,10 @@ Wold-style-definition C ObjC Var(warn_old_style_definition) Warning Warn if an old-style parameter definition is used +Wopenmp-simd +C C++ Var(warn_openmp_simd) Warning LangEnabledBy(C C++,Wall) +Warn if a simd directive is overridden by the vectorizer cost model + Woverlength-strings C ObjC C++ ObjC++ Var(warn_overlength_strings) Warning LangEnabledBy(C ObjC C++ ObjC++,Wpedantic) Warn if a string is longer than the maximum portable length specified by the standard @@ -858,11 +862,6 @@ fcanonical-system-headers C ObjC C++ ObjC++ Where shorter, use canonicalized paths to systems headers. -fcheck-pointer-bounds -C ObjC C++ ObjC++ LTO Report Var(flag_check_pointer_bounds) -Add Pointer Bounds Checker instrumentation. fchkp-* flags are used to -control instrumentation. - fcilkplus C ObjC C++ ObjC++ LTO Report Var(flag_enable_cilkplus) Init(0) Enable Cilk Plus @@ -891,6 +890,10 @@ fdeduce-init-list C++ ObjC++ Var(flag_deduce_init_list) Init(0) -fdeduce-init-list enable deduction of std::initializer_list for a template type parameter from a brace-enclosed initializer-list +fdeclone-ctor-dtor +C++ ObjC++ Var(flag_declone_ctor_dtor) Init(-1) +Factor complex constructors and destructors to favor space over speed + fdefault-inline C++ ObjC++ Ignore Does nothing. Preserved for backward compatibility. diff --git a/gcc/c-family/cilk.c b/gcc/c-family/cilk.c index c85b5f2a7c9..f2179dfc128 100644 --- a/gcc/c-family/cilk.c +++ b/gcc/c-family/cilk.c @@ -1,6 +1,6 @@ /* This file is part of the Intel(R) Cilk(TM) Plus support This file contains the CilkPlus Intrinsics - Copyright (C) 2013 Free Software Foundation, Inc. + Copyright (C) 2013-2014 Free Software Foundation, Inc. Contributed by Balaji V. Iyer <balaji.v.iyer@intel.com>, Intel Corporation @@ -477,9 +477,10 @@ wrapper_local_cb (const void *k_v, void **vp, void *data) /* Alter a tree STMT from OUTER_FN to form the body of INNER_FN. */ -static void -cilk_outline (tree inner_fn, tree *stmt_p, struct wrapper_data *wd) +void +cilk_outline (tree inner_fn, tree *stmt_p, void *w) { + struct wrapper_data *wd = (struct wrapper_data *) w; const tree outer_fn = wd->context; const bool nested = (wd->type == CILK_BLOCK_FOR); copy_body_data id; @@ -512,8 +513,7 @@ cilk_outline (tree inner_fn, tree *stmt_p, struct wrapper_data *wd) /* We don't want the private variables any more. */ pointer_map_traverse (wd->decl_map, nested ? for_local_cb : wrapper_local_cb, &id); - - walk_tree (stmt_p, copy_tree_body_r, &id, NULL); + walk_tree (stmt_p, copy_tree_body_r, (void *) &id, NULL); /* See if this function can throw or calls something that should not be spawned. The exception part is only necessary if @@ -554,10 +554,8 @@ create_cilk_wrapper_body (tree stmt, struct wrapper_data *wd) for (p = wd->parms; p; p = TREE_CHAIN (p)) DECL_CONTEXT (p) = fndecl; - cilk_outline (fndecl, &stmt, wd); - stmt = fold_build_cleanup_point_expr (void_type_node, stmt); gcc_assert (!DECL_SAVED_TREE (fndecl)); - lang_hooks.cilkplus.install_body_with_frame_cleanup (fndecl, stmt); + cilk_install_body_with_frame_cleanup (fndecl, stmt, (void *) wd); gcc_assert (DECL_SAVED_TREE (fndecl)); pop_cfun_to (outer); @@ -733,8 +731,7 @@ create_cilk_wrapper (tree exp, tree *args_out) and GS_UNHANDLED, otherwise. */ int -gimplify_cilk_spawn (tree *spawn_p, gimple_seq *before ATTRIBUTE_UNUSED, - gimple_seq *after ATTRIBUTE_UNUSED) +gimplify_cilk_spawn (tree *spawn_p) { tree expr = *spawn_p; tree function, call1, call2, new_args; @@ -757,7 +754,10 @@ gimplify_cilk_spawn (tree *spawn_p, gimple_seq *before ATTRIBUTE_UNUSED, /* This should give the number of parameters. */ total_args = list_length (new_args); - arg_array = XNEWVEC (tree, total_args); + if (total_args) + arg_array = XNEWVEC (tree, total_args); + else + arg_array = NULL; ii_args = new_args; for (ii = 0; ii < total_args; ii++) @@ -771,7 +771,7 @@ gimplify_cilk_spawn (tree *spawn_p, gimple_seq *before ATTRIBUTE_UNUSED, call1 = cilk_call_setjmp (cfun->cilk_frame_decl); - if (*arg_array == NULL_TREE) + if (arg_array == NULL || *arg_array == NULL_TREE) call2 = build_call_expr (function, 0); else call2 = build_call_expr_loc_array (EXPR_LOCATION (*spawn_p), function, @@ -875,30 +875,6 @@ cilk_install_body_pedigree_operations (tree frame_ptr) return body_list; } -/* Inserts "cleanup" functions after the function-body of FNDECL. FNDECL is a - spawn-helper and BODY is the newly created body for FNDECL. */ - -void -c_cilk_install_body_w_frame_cleanup (tree fndecl, tree body) -{ - tree list = alloc_stmt_list (); - tree frame = make_cilk_frame (fndecl); - tree dtor = create_cilk_function_exit (frame, false, true); - add_local_decl (cfun, frame); - - DECL_SAVED_TREE (fndecl) = list; - tree frame_ptr = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (frame)), - frame); - tree body_list = cilk_install_body_pedigree_operations (frame_ptr); - gcc_assert (TREE_CODE (body_list) == STATEMENT_LIST); - - tree detach_expr = build_call_expr (cilk_detach_fndecl, 1, frame_ptr); - append_to_statement_list (detach_expr, &body_list); - append_to_statement_list (body, &body_list); - append_to_statement_list (build_stmt (EXPR_LOCATION (body), TRY_FINALLY_EXPR, - body_list, dtor), &list); -} - /* Add a new variable, VAR to a variable list in WD->DECL_MAP. HOW indicates whether the variable is previously defined, currently defined, or a variable that is being written to. */ @@ -1059,6 +1035,7 @@ extract_free_variables (tree t, struct wrapper_data *wd, extract_free_variables (TREE_OPERAND (t, 0), wd, ADD_READ); return; + case VEC_INIT_EXPR: case INIT_EXPR: extract_free_variables (TREE_OPERAND (t, 0), wd, ADD_BIND); extract_free_variables (TREE_OPERAND (t, 1), wd, ADD_READ); @@ -1219,6 +1196,15 @@ extract_free_variables (tree t, struct wrapper_data *wd, break; } + case CONSTRUCTOR: + { + unsigned HOST_WIDE_INT idx = 0; + constructor_elt *ce; + for (idx = 0; vec_safe_iterate (CONSTRUCTOR_ELTS (t), idx, &ce); idx++) + extract_free_variables (ce->value, wd, ADD_READ); + break; + } + default: if (is_expr) { @@ -1235,7 +1221,6 @@ extract_free_variables (tree t, struct wrapper_data *wd, } } - /* Add appropriate frames needed for a Cilk spawned function call, FNDECL. Returns the __cilkrts_stack_frame * variable. */ diff --git a/gcc/c-family/cppspec.c b/gcc/c-family/cppspec.c index 21d0b730b5b..442a3a3c012 100644 --- a/gcc/c-family/cppspec.c +++ b/gcc/c-family/cppspec.c @@ -1,5 +1,5 @@ /* Specific flags and argument handling of the C preprocessor. - Copyright (C) 1999-2013 Free Software Foundation, Inc. + Copyright (C) 1999-2014 Free Software Foundation, Inc. This file is part of GCC. diff --git a/gcc/c-family/stub-objc.c b/gcc/c-family/stub-objc.c index a2dbe491122..40866cc3972 100644 --- a/gcc/c-family/stub-objc.c +++ b/gcc/c-family/stub-objc.c @@ -1,7 +1,7 @@ /* Stub functions for Objective-C and Objective-C++ routines that are called from within the C and C++ front-ends, respectively. - Copyright (C) 1991-2013 Free Software Foundation, Inc. + Copyright (C) 1991-2014 Free Software Foundation, Inc. This file is part of GCC. |