Dodji Seketeli [Tue, 15 Jan 2013 09:12:30 +0000 (09:12 +0000)]
PR c++/55663 - constexpr function templ instantiation
Consider the example of the problem report
1 template <typename>
2 constexpr bool the_truth () { return true; }
3
4 template <bool>
5 struct Takes_bool { };
6
7 template<bool B>
8 using Alias = Takes_bool<B>;
9
10 template<typename T>
11 struct test { using type = Alias<the_truth<T>()>; };
12
13 int main () {
14 test<int> a;
15
16 return 0;
17 }
that yields the error:
test.cc: In substitution of ‘template<bool B> using Alias = Takes_bool<B> [with bool B = the_truth<int>()]’:
test.cc:11:51: required from ‘struct test<int>’
test.cc:14:13: required from here
test.cc:11:51: error: integral expression ‘the_truth<int>()’ is not constant
struct test { using type = Alias<the_truth<T>()>; };
I think the issue happens in the course of instantiating test<int> at
line 14, when we look into instantiating Alias<the_truth<T>()> (at
line 11) (using instantiate_alias_template) with T = int.
There, when we check the argument 'the_truth<int>()' to see if it
actually is a constant expression, in check_instantiated_arg, we fail
to recognize it constexpr-ness b/c we just look at its TREE_CONSTANT.
At that point, the_truth<int> should have been folded, and it's not,
because instantiate_alias_template forgets to call
coerce_template_parms on its arguments.
Fixed thus, bootstapped and tested on x86_64-unknown-linux-gnu against
trunk.
gcc/cp/
PR c++/55663
* pt.c (coerce_innermost_template_parms): New static function.
(instantiate_alias_template): Use it here.
gcc/testsuite/
PR c++/55663
* g++.dg/cpp0x/alias-decl-31.C: New test.
Thomas Koenig [Mon, 14 Jan 2013 21:50:28 +0000 (21:50 +0000)]
re PR fortran/55806 (Missed optimization with ANY or ALL)
2013-01-14 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/55806
* frontend-passes.c (optimize_reduction): New function,
including prototype.
(callback_reduction): Likewise.
(gfc_run_passes): Also run optimize_reduction.
(copy_walk_reduction_arg): New function.
(dummy_code_callback): New function.
2013-01-14 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/55806
* gfortran.dg/array_constructor_40.f90: New test.
Georg-Johann Lay [Mon, 14 Jan 2013 18:28:24 +0000 (18:28 +0000)]
re PR target/55974 ([avr] Wrong suffix for built-in defines __INT24_MAX__ and __UINT24_MAX__ with -mint8)
PR target/55974
* config/avr/avr-c.c (avr_cpu_cpp_builtins): Define __FLASH
etc. to 1 and not to __flash.
Use LL suffix for __INT24_MAX__ with -mint8.
Use ULL suffix for __UINT24_MAX__ with -mint8.
Richard Biener [Mon, 14 Jan 2013 14:59:20 +0000 (14:59 +0000)]
tree-cfg.c (verify_expr_location, [...]): New functions.
2013-01-14 Richard Biener <rguenther@suse.de>
* tree-cfg.c (verify_expr_location, verify_expr_location_1,
verify_location, collect_subblocks): New functions.
(verify_gimple_in_cfg): Verify that locations only reference
BLOCKs in the functions BLOCK tree.
Georg-Johann Lay [Mon, 14 Jan 2013 10:19:00 +0000 (10:19 +0000)]
fixed-bit.c (SATFRACT): Only declare / set min_low, min_high if TO_MODE_UNSIGNED == 0.
* fixed-bit.c (SATFRACT) <FROM_TYPE=1, TO_TYPE=4>: Only
declare / set min_low, min_high if TO_MODE_UNSIGNED == 0.
(SATFRACT) <FROM_TYPE=TO_TYPE=4>: Only declare / set min_low,
min_high if FROM_MODE_UNSIGNED == 0 and TO_MODE_UNSIGNED == 0.
Paul Thomas [Sun, 13 Jan 2013 08:57:46 +0000 (08:57 +0000)]
re PR fortran/54286 (Accepts invalid proc-pointer assignments involving proc-ptr function result)
2013-01-13 Paul Thomas <pault@gcc.gnu.org>
PR fortran/54286
* expr.c (gfc_check_pointer_assign): Ensure that both lvalue
and rvalue interfaces are presented to gfc_compare_interfaces.
Simplify references to interface names by using the symbols
themselves. Call gfc_compare_interfaces with s1 and s2 inter-
changed to overcome the asymmetry of this function. Do not
repeat the check for the presence of s1 and s2.
2013-01-13 Paul Thomas <pault@gcc.gnu.org>
PR fortran/54286
* gfortran.dg/proc_ptr_result_8.f90 : New test.
Janus Weil [Sat, 12 Jan 2013 18:52:11 +0000 (19:52 +0100)]
re PR fortran/55072 (Missing internal_pack leads to wrong code with derived type)
2013-01-12 Janus Weil <janus@gcc.gnu.org>
PR fortran/55072
* trans-array.c (gfc_conv_array_parameter): No packing was done for
full arrays of derived type.
2013-01-12 Janus Weil <janus@gcc.gnu.org>
PR fortran/55072
* gfortran.dg/assumed_type_2.f90: Fix test case.
* gfortran.dg/internal_pack_13.f90: New test.
* gfortran.dg/internal_pack_14.f90: New test.
Paul Thomas [Sat, 12 Jan 2013 12:52:41 +0000 (12:52 +0000)]
re PR fortran/55868 (gfortran generates for CLASS(*) __m_MOD___vtab__$tar on NO_DOLLAR_IN_LABEL systems)
2013-01-08 Paul Thomas <pault@gcc.gnu.org>
PR fortran/55868
* class.c (get_unique_type_string): Change $tar to STAR and
replace sprintf by strcpy where there is no formatting.
* decl.c (gfc_match_decl_type_spec): Change $tar to STAR.
2013-01-08 Paul Thomas <pault@gcc.gnu.org>
PR fortran/55868
* gfortran.dg/unlimited_polymorphic_8.f90: Update
scan-tree-dump-times for foo.0.x._vptr to deal with change from
$tar to STAR.
Andreas Krebbel [Fri, 11 Jan 2013 16:43:49 +0000 (16:43 +0000)]
re PR rtl-optimization/55719 (ICE: Segmentation fault)
2013-01-11 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
PR target/55719
* config/s390/s390.c (s390_preferred_reload_class): Do not return
NO_REGS for larl operands.
(s390_reload_larl_operand): Use s390_load_address instead of
emit_move_insn.
2013-01-11 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
PR target/55719
* gcc.target/s390/pr55719.c: New testcase.
Richard Biener [Fri, 11 Jan 2013 13:59:28 +0000 (13:59 +0000)]
tree-cfg.c (verify_node_sharing_1): Split out from ...
2013-01-11 Richard Biener <rguenther@suse.de>
* tree-cfg.c (verify_node_sharing_1): Split out from ...
(verify_node_sharing): ... here.
(verify_gimple_in_cfg): Use verify_node_sharing_1 for walk_tree.
Richard Biener [Thu, 10 Jan 2013 13:42:27 +0000 (13:42 +0000)]
re PR bootstrap/55792 (Bad memory access with profiledbootstrap and LTO)
2013-01-10 Richard Biener <rguenther@suse.de>
PR bootstrap/55792
* tree-into-ssa.c (rewrite_add_phi_arguments): Do not set
locations for virtual PHI arguments.
(rewrite_update_phi_arguments): Likewise.
Andreas Krebbel [Thu, 10 Jan 2013 08:15:07 +0000 (08:15 +0000)]
re PR target/55718 (ICE in gen_reg_rtx, at emit-rtl.c:866)
2013-01-10 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
PR target/55718
* config/s390/s390.c (s390_symref_operand_p)
(s390_loadrelative_operand_p): Merge the two functions.
(s390_check_qrst_address, print_operand_address): Add parameters
to s390_loadrelative_operand_p invokation.
(s390_check_symref_alignment): Use s390_loadrelative_operand_p.
(s390_reload_larl_operand, s390_secondary_reload): Use
s390_loadrelative_operand_p instead of s390_symref_operand_p.
(legitimize_pic_address): Handle @GOTENT and @PLT + addend.
PR rtl-optimization/pr55829
* lra-constraints.c (match_reload): Add code for absent output.
(curr_insn_transform): Add code for reloads of matched inputs
without output.
Jan Hubicka [Wed, 9 Jan 2013 15:10:43 +0000 (16:10 +0100)]
re PR tree-optimization/55875 (IVopts caused miscompilation)
PR tree-optimiation/55875
* gcc.c-torture/execute/pr55875.c: New testcase.
* g++.dg/torture/pr55875.C: New testcase.
* tree-ssa-loop-niter.c (number_of_iterations_cond): Add
EVERY_ITERATION parameter.
(number_of_iterations_exit): Check if exit is executed every
iteration.
(idx_infer_loop_bounds): Similarly here.
(n_of_executions_at_most): Simplify
to only test for cases where statement is dominated by the
particular bound; handle correctly the "postdominance"
test.
(scev_probably_wraps_p): Use max loop iterations info
as a global bound first.
Nguyen Duy Dat [Wed, 9 Jan 2013 15:07:08 +0000 (15:07 +0000)]
v850.md (cbranchsf4): New pattern.
* config/v850/v850.md (cbranchsf4): New pattern.
(cstoresf4): New pattern.
(cbranchdf4): New pattern.
(cstoredf4): New pattern.
(movsicc): Disallow floating point comparisons.
(cmpsf_le_insn): Fix order of operators.
(cmpsf_lt_insn): Likewise.
(cmpsf_eq_insn): Likewise.
(cmpdf_le_insn): Likewise.
(cmpdf_lt_insn): Likewise.
(cmpdf_eq_insn): Likewise.
(cmpsf_ge_insn): Use LE comparison.
(cmpdf_ge_insn): Likewise.
(cmpsf_gt_insn): Use LT comparison.
(cmpdf_gt_insn): Likewise.
(cmpsf_ne_insn): Delete pattern.
(cmpdf_ne_insn): Delete pattern.
* config/v850/v850.c (v850_gen_float_compare): Use
gen_cmpdf_eq_insn for NE comparison.
(v850_float_z_comparison_operator)
(v850_float_nz_comparison_operator): Move from here ...
* config/v850/predicates.md: ... to here. Move GT and GE
comparisons into v850_float_z_comparison_operator.
* config/v850/v850-protos.h (v850_float_z_comparison_operator):
Delete prototype.
(v850_float_nz_comparison_operator): Likewise.
Jakub Jelinek [Wed, 9 Jan 2013 14:51:09 +0000 (15:51 +0100)]
re PR c/48418 (Bit shift operator >>=)
PR c/48418
* c-common.c (c_fully_fold_internal): Warn for LSHIFT_EXPR and
RSHIFT_EXPR, if orig_op1 isn't INTEGER_CST, op1 is INTEGER_CST
and is either negative or bigger or equal to type precision
of the first operand.
* typeck.c (cp_build_binary_op): For LSHIFT_EXPR and RSHIFT_EXPR,
call maybe_constant_value for the negative or too big shift
count warnings.
* config/pa/pa.h (VAL_U6_BITS_P): Define.
(INT_U6_BITS): Likewise.
* config/pa/predicates.md (uint6_operand): New predicate.
(shift5_operand, shift6_operand): Likewise.
* config/pa/pa.md (lshrsi3, rotrsi3): Use shift5_operand instead of
arith32_operand.
(lshrdi3): Use shift6_operand.
(shrpsi4, shrpdi4): New insn patterns.
(extzv): Delete expander.
(extzvsi, extzvdi): New expanders. Use uint5_operand and uint6_operand
predicates in unamed zero extract patterns. Tighten common constraint.
(extv): Delete expander.
(extvsi, extvdi): New expanders. Use uint5_operand and uint6_operand
predicates in unamed sign extract patterns. Tighten common constraint.
(insv): Delete expander.
(insvsi, insvdi): New expanders. Use uint5_operand and uint6_operand
predicates in unamed insert patterns. Tighten common constraint.
Change uint32_operand predicate to uint6_operand predicate in unamed
DImode pattern to insert constant values of type 1...1xxxx.