From 7a21b590fb5d96a2a925f2a26ea1f20c89ae070f Mon Sep 17 00:00:00 2001 From: edlinger Date: Mon, 12 Sep 2016 20:18:16 +0000 Subject: gcc/c-family: 2016-09-12 Bernd Edlinger PR c++/77496 * c-common.c (warn_for_omitted_condop): Also warn for boolean data. gcc/c: 2016-09-12 Bernd Edlinger PR c++/77496 * c-parser.c (c_parser_conditional_expression): Pass the rightmost COMPOUND_EXPR to warn_for_omitted_condop. gcc/cp: 2016-09-12 Bernd Edlinger PR c++/77496 * call.c (build_conditional_expr_1): Call warn_for_omitted_condop. * class.c (instantiate_type): Look through the SAVE_EXPR. gcc/testsuite: 2016-09-12 Bernd Edlinger PR c++/77496 * c-c++-common/warn-ommitted-condop.c: Add more test cases. * g++.dg/ext/pr77496.C: New test. * g++.dg/warn/pr77496.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@240098 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/class.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'gcc/cp/class.c') diff --git a/gcc/cp/class.c b/gcc/cp/class.c index a4f3c6b6aba..f7147e629bd 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -8262,7 +8262,12 @@ instantiate_type (tree lhstype, tree rhs, tsubst_flags_t complain) return error_mark_node; } - /* There only a few kinds of expressions that may have a type + /* If we instantiate a template, and it is a A ?: C expression + with omitted B, look through the SAVE_EXPR. */ + if (TREE_CODE (rhs) == SAVE_EXPR) + rhs = TREE_OPERAND (rhs, 0); + + /* There are only a few kinds of expressions that may have a type dependent on overload resolution. */ gcc_assert (TREE_CODE (rhs) == ADDR_EXPR || TREE_CODE (rhs) == COMPONENT_REF -- cgit v1.2.1 From ac29ece21d1243ab39f49fd72ef7c171cf1feaee Mon Sep 17 00:00:00 2001 From: jason Date: Fri, 16 Sep 2016 19:20:44 +0000 Subject: Add inline functions for various bitwise operations. * hwint.h (least_bit_hwi, pow2_or_zerop, pow2p_hwi, ctz_or_zero): New. * hwint.c (exact_log2): Use pow2p_hwi. (ctz_hwi, ffs_hwi): Use least_bit_hwi. * alias.c (memrefs_conflict_p): Use pow2_or_zerop. * builtins.c (get_object_alignment_2, get_object_alignment) (get_pointer_alignment, fold_builtin_atomic_always_lock_free): Use least_bit_hwi. * calls.c (compute_argument_addresses, store_one_arg): Use least_bit_hwi. * cfgexpand.c (expand_one_stack_var_at): Use least_bit_hwi. * combine.c (force_to_mode): Use least_bit_hwi. * emit-rtl.c (set_mem_attributes_minus_bitpos, adjust_address_1): Use least_bit_hwi. * expmed.c (synth_mult, expand_divmod): Use ctz_or_zero, ctz_hwi. (init_expmed_one_conv): Use pow2p_hwi. * fold-const.c (round_up_loc, round_down_loc): Use pow2_or_zerop. (fold_binary_loc): Use pow2p_hwi. * function.c (assign_parm_find_stack_rtl): Use least_bit_hwi. * gimple-fold.c (gimple_fold_builtin_memory_op): Use pow2p_hwi. * gimple-ssa-strength-reduction.c (replace_ref): Use least_bit_hwi. * hsa-gen.c (gen_hsa_addr_with_align, hsa_bitmemref_alignment): Use least_bit_hwi. * ipa-cp.c (ipcp_alignment_lattice::meet_with_1): Use least_bit_hwi. * ipa-prop.c (ipa_modify_call_arguments): Use least_bit_hwi. * omp-low.c (oacc_loop_fixed_partitions) (oacc_loop_auto_partitions): Use least_bit_hwi. * rtlanal.c (nonzero_bits1): Use ctz_or_zero. * stor-layout.c (place_field): Use least_bit_hwi. * tree-pretty-print.c (dump_generic_node): Use pow2p_hwi. * tree-sra.c (build_ref_for_offset): Use least_bit_hwi. * tree-ssa-ccp.c (ccp_finalize): Use least_bit_hwi. * tree-ssa-math-opts.c (bswap_replace): Use least_bit_hwi. * tree-ssa-strlen.c (handle_builtin_memcmp): Use pow2p_hwi. * tree-vect-data-refs.c (vect_analyze_group_access_1) (vect_grouped_store_supported, vect_grouped_load_supported) (vect_permute_load_chain, vect_shift_permute_load_chain) (vect_transform_grouped_load): Use pow2p_hwi. * tree-vect-generic.c (expand_vector_divmod): Use ctz_or_zero. * tree-vect-patterns.c (vect_recog_divmod_pattern): Use ctz_or_zero. * tree-vect-stmts.c (vectorizable_mask_load_store): Use least_bit_hwi. * tsan.c (instrument_expr): Use least_bit_hwi. * var-tracking.c (negative_power_of_two_p): Use pow2_or_zerop. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@240194 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/class.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc/cp/class.c') diff --git a/gcc/cp/class.c b/gcc/cp/class.c index f7147e629bd..150f46f6e19 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -1843,7 +1843,7 @@ check_bases (tree t, doesn't define its own, then the current class inherits one. */ if (seen_tm_mask && !find_tm_attribute (TYPE_ATTRIBUTES (t))) { - tree tm_attr = tm_mask_to_attr (seen_tm_mask & -seen_tm_mask); + tree tm_attr = tm_mask_to_attr (least_bit_hwi (seen_tm_mask)); TYPE_ATTRIBUTES (t) = tree_cons (tm_attr, NULL, TYPE_ATTRIBUTES (t)); } } @@ -5074,7 +5074,7 @@ set_one_vmethod_tm_attributes (tree type, tree fndecl) restrictive one. */ else if (tm_attr == NULL) { - apply_tm_attr (fndecl, tm_mask_to_attr (found & -found)); + apply_tm_attr (fndecl, tm_mask_to_attr (least_bit_hwi (found))); } /* Otherwise validate that we're not weaker than a function that is being overridden. */ -- cgit v1.2.1 From 24b3d864a8d14aff75561b1bee142e10ddcc725c Mon Sep 17 00:00:00 2001 From: jakub Date: Fri, 16 Sep 2016 20:21:29 +0000 Subject: PR c++/77375 * class.c (check_bases): Set CLASSTYPE_HAS_MUTABLE if any TYPE_HAS_MUTABLE_P for any bases. * g++.dg/cpp0x/mutable1.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@240195 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/class.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gcc/cp/class.c') diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 150f46f6e19..7362c732646 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -1796,6 +1796,8 @@ check_bases (tree t, SET_CLASSTYPE_REF_FIELDS_NEED_INIT (t, CLASSTYPE_REF_FIELDS_NEED_INIT (t) | CLASSTYPE_REF_FIELDS_NEED_INIT (basetype)); + if (TYPE_HAS_MUTABLE_P (basetype)) + CLASSTYPE_HAS_MUTABLE (t) = 1; /* A standard-layout class is a class that: ... -- cgit v1.2.1