diff options
author | hjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-08-04 21:55:46 +0000 |
---|---|---|
committer | hjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-08-04 21:55:46 +0000 |
commit | 85f81bcdd58191dabf861562c4faaa432d6343f5 (patch) | |
tree | 92a6ab8bc17e105741baf6f77db62b000a3b10e0 | |
parent | 7e2585d8371b2edc3bee7fc0c7c8e76537bb451d (diff) |
Merged with trunk at revision 138652.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/ix86/avx@138653 138bc75d-0d04-0410-961f-82ee72b054a4
30 files changed, 352 insertions, 69 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2c30ecf5690..02ca43300fa 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,34 @@ +2008-08-04 Richard Guenther <rguenther@suse.de> + + * tree-ssa-loop-ivopts.c (add_iv_value_candidates): Also add + the candidate with the stripped base if that base is different + from the original base even for offset zero. + +2008-08-04 Richard Guenther <rguenther@suse.de> + + PR middle-end/36691 + * tree-ssa-loop-niter.c (number_of_iterations_lt_to_ne): Correctly + check for no_overflow. + +2008-08-04 Richard Guenther <rguenther@suse.de> + + * tree-vect-transform.c (vectorizable_call): Fix tuplification. + +2008-08-04 Paul Brook <paul@codesourcery.com> + + * cofig/arm/arm.c (thumb_core_reg_alloc_order): New. + (arm_order_regs_for_local_alloc): New function. + * config/arm/arm-protos.h (arm_order_regs_for_local_alloc): Add + prototype. + * config/arm/arm.h (ORDER_REGS_FOR_LOCAL_ALLOC): Define. + +2008-08-04 H.J. Lu <hongjiu.lu@intel.com> + + PR target/37012 + * config/i386/i386.c (ix86_expand_prologue): Use UNITS_PER_WORD + instead of STACK_BOUNDARY / BITS_PER_UNIT to align stack. + (ix86_expand_epilogue): Likewise. + 2008-08-04 H.J. Lu <hongjiu.lu@intel.com> * config/i386/i386.c (ix86_compute_frame_layout): Fix a typo diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index e49c0cd7510..93c23926fe2 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,45 @@ +2008-08-04 Robert Dewar <dewar@adacore.com> + + * exp_ch4.adb (Expand_N_In): Suppress range warnings in instances + +2008-08-04 Ed Schonberg <schonberg@adacore.com> + + * sem_ch3.adb: + (Replace_Anonymous_Access_To_Protected_Subprogram): Handle properly an + anonymous access to protected subprogram that is the return type of the + specification of a subprogram body. + + * sem_ch6.adb: + (Analyze_Subprogram_Body): if the return type is an anonymous access to + subprogram, freeze it now to prevent access anomalies in the back-end. + + * exp_ch9.adb: Minor code cleanup. + Make sure that new declarations are inserted into the tree before + analysis (from code reading). + +2008-08-04 Robert Dewar <dewar@adacore.com> + + * exp_ch5.adb: + (Expand_Simple_Function_Return): Check No_Secondary_Stack restriction + at point of return. + +2008-08-04 Thomas Quinot <quinot@adacore.com> + + * sem_type.adb, sem_ch4.adb, sprint.adb, exp_ch3.adb: Minor reformatting + +2008-08-04 Vasiliy Fofanov <fofanov@adacore.com> + + * g-soccon-mingw.ads: Fix value for MSG_WAITALL + +2008-08-04 Javier Miranda <miranda@adacore.com> + + * sem_prag.adb (Process_Convention): Add missing support for + N_Private_Extension_Declaration nodes. + +2008-08-04 Robert Dewar <dewar@adacore.com> + + * exp_ch4.adb: Minor reformatting + 2008-08-04 Pascal Obry <obry@adacore.com> * adaint.h: Add missing prototype. diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index 92a5f8c3b60..e50ea0487b2 100644 --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -1543,7 +1543,7 @@ package body Exp_Ch3 is end if; end if; - -- Ada 2005 (AI-287) In case of default initialized components, + -- Ada 2005 (AI-287): In case of default initialized components, -- we need to generate the corresponding selected component node -- to access the discriminant value. In other cases this is not -- required because we are inside the init proc and we use the diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index b1243d7a280..d0b60f313f7 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -2636,7 +2636,7 @@ package body Exp_Ch4 is New_Reference_To (Ind_Typ, Loc), New_Reference_To (Defining_Identifier (I_Decl), Loc))); - -- For other index types, computation is safe. + -- For other index types, computation is safe else H_Init := Ind_Val (Make_Op_Add (Loc, H_Init, L_Pos)); @@ -2667,7 +2667,7 @@ package body Exp_Ch4 is Declare_Decls := New_List (P_Decl, H_Decl, R_Decl); - -- Add constraint check for the modular index case. + -- Add constraint check for the modular index case if Is_Modular_Integer_Type (Ind_Typ) and then Esize (Ind_Typ) < Esize (Standard_Integer) @@ -3873,6 +3873,12 @@ package body Exp_Ch4 is and then Compile_Time_Known_Value (Hi) and then Expr_Value (Type_High_Bound (Ltyp)) = Expr_Value (Hi) and then Expr_Value (Type_Low_Bound (Ltyp)) = Expr_Value (Lo) + + -- Kill warnings in instances, since they may be cases where we + -- have a test in the generic that makes sense with some types + -- and not with other types. + + and then not In_Instance then Substitute_Valid_Check; return; @@ -3886,7 +3892,7 @@ package body Exp_Ch4 is -- legality checks, because we are constant-folding beyond RM 4.9. if Lcheck = LT or else Ucheck = GT then - if Warn1 then + if Warn1 and then not In_Instance then Error_Msg_N ("?range test optimized away", N); Error_Msg_N ("\?value is known to be out of range", N); end if; @@ -3902,7 +3908,7 @@ package body Exp_Ch4 is -- since we know we are in range. elsif Lcheck in Compare_GE and then Ucheck in Compare_LE then - if Warn1 then + if Warn1 and then not In_Instance then Error_Msg_N ("?range test optimized away", N); Error_Msg_N ("\?value is known to be in range", N); end if; @@ -3919,7 +3925,7 @@ package body Exp_Ch4 is -- a comparison against the upper bound. elsif Lcheck in Compare_GE then - if Warn2 then + if Warn2 and then not In_Instance then Error_Msg_N ("?lower bound test optimized away", Lo); Error_Msg_N ("\?value is known to be in range", Lo); end if; @@ -3937,7 +3943,7 @@ package body Exp_Ch4 is -- a comparison against the lower bound. elsif Ucheck in Compare_LE then - if Warn2 then + if Warn2 and then not In_Instance then Error_Msg_N ("?upper bound test optimized away", Hi); Error_Msg_N ("\?value is known to be in range", Hi); end if; diff --git a/gcc/ada/exp_ch5.adb b/gcc/ada/exp_ch5.adb index 729c126f4d6..2215912b22c 100644 --- a/gcc/ada/exp_ch5.adb +++ b/gcc/ada/exp_ch5.adb @@ -3906,6 +3906,7 @@ package body Exp_Ch5 is -- secondary stack. else + Check_Restriction (No_Secondary_Stack, N); Set_Storage_Pool (N, RTE (RE_SS_Pool)); -- If we are generating code for the VM do not use diff --git a/gcc/ada/exp_ch9.adb b/gcc/ada/exp_ch9.adb index 2a91413d570..53de7a0e9d5 100644 --- a/gcc/ada/exp_ch9.adb +++ b/gcc/ada/exp_ch9.adb @@ -4733,9 +4733,9 @@ package body Exp_Ch9 is Def1 : Node_Id; begin - -- Create access to protected subprogram with full signature + -- Create access to subprogram with full signature - if Nkind (Type_Definition (N)) = N_Access_Function_Definition then + if Etype (D_T) /= Standard_Void_Type then Def1 := Make_Access_Function_Definition (Loc, Parameter_Specifications => P_List, @@ -4753,8 +4753,8 @@ package body Exp_Ch9 is Defining_Identifier => D_T2, Type_Definition => Def1); - Analyze (Decl1); Insert_After (N, Decl1); + Analyze (Decl1); -- Create Equivalent_Type, a record with two components for an access to -- object and an access to subprogram. @@ -4786,8 +4786,8 @@ package body Exp_Ch9 is Make_Component_List (Loc, Component_Items => Comps))); - Analyze (Decl2); Insert_After (Decl1, Decl2); + Analyze (Decl2); Set_Equivalent_Type (T, E_T); end Expand_Access_Protected_Subprogram_Type; @@ -7062,6 +7062,7 @@ package body Exp_Ch9 is procedure Expand_N_Protected_Body (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Pid : constant Entity_Id := Corresponding_Spec (N); + Current_Node : Node_Id; Disp_Op_Body : Node_Id; New_Op_Body : Node_Id; @@ -7070,6 +7071,9 @@ package body Exp_Ch9 is Op_Decl : Node_Id; Op_Id : Entity_Id; + Chain : Entity_Id := Empty; + -- Finalization chain that may be attached to new body + function Build_Dispatching_Subprogram_Body (N : Node_Id; Pid : Node_Id; @@ -7203,13 +7207,13 @@ package body Exp_Ch9 is -- entity is not further elaborated, and so the chain -- properly belongs to the newly created subprogram body. - if Present - (Finalization_Chain_Entity (Defining_Entity (Op_Body))) - then + Chain := + Finalization_Chain_Entity (Defining_Entity (Op_Body)); + + if Present (Chain) then Set_Finalization_Chain_Entity (Protected_Body_Subprogram - (Corresponding_Spec (Op_Body)), - Finalization_Chain_Entity (Defining_Entity (Op_Body))); + (Corresponding_Spec (Op_Body)), Chain); Set_Analyzed (Handled_Statement_Sequence (New_Op_Body), False); end if; diff --git a/gcc/ada/g-soccon-mingw.ads b/gcc/ada/g-soccon-mingw.ads index 3bb83e4bebe..732ef67e2e5 100644 --- a/gcc/ada/g-soccon-mingw.ads +++ b/gcc/ada/g-soccon-mingw.ads @@ -139,7 +139,7 @@ package GNAT.Sockets.Constants is MSG_OOB : constant := 1; -- Process out-of-band data MSG_PEEK : constant := 2; -- Peek at incoming data MSG_EOR : constant := -1; -- Send end of record - MSG_WAITALL : constant := -1; -- Wait for full reception + MSG_WAITALL : constant := 8; -- Wait for full reception MSG_NOSIGNAL : constant := -1; -- No SIGPIPE on send MSG_Forced_Flags : constant := 0; -- Flags set on all send(2) calls diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 307b6a158b6..44cd6c65e03 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -1056,7 +1056,6 @@ package body Sem_Ch3 is N_Object_Renaming_Declaration, N_Formal_Object_Declaration, N_Formal_Type_Declaration, - N_Formal_Object_Declaration, N_Task_Type_Declaration, N_Protected_Type_Declaration)) loop @@ -4476,9 +4475,17 @@ package body Sem_Ch3 is Mark_Rewrite_Insertion (Decl); - -- Insert the new declaration in the nearest enclosing scope + -- Insert the new declaration in the nearest enclosing scope. If the + -- node is a body and N is its return type, the declaration belongs in + -- the enclosing scope. P := Parent (N); + if Nkind (P) = N_Subprogram_Body + and then Nkind (N) = N_Function_Specification + then + P := Parent (P); + end if; + while Present (P) and then not Has_Declarations (P) loop P := Parent (P); end loop; @@ -4521,13 +4528,13 @@ package body Sem_Ch3 is Mark_Rewrite_Insertion (Comp); - -- Temporarily remove the current scope from the stack to add the new - -- declarations to the enclosing scope - if Nkind_In (N, N_Object_Declaration, N_Access_Function_Definition) then Analyze (Decl); else + -- Temporarily remove the current scope (record or subprogram) from + -- the stack to add the new declarations to the enclosing scope. + Scope_Stack.Decrement_Last; Analyze (Decl); Set_Is_Itype (Anon); diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb index cd3bb500099..19afc8d8fa7 100644 --- a/gcc/ada/sem_ch4.adb +++ b/gcc/ada/sem_ch4.adb @@ -498,7 +498,7 @@ package body Sem_Ch4 is Set_Directly_Designated_Type (Acc_Type, Type_Id); Check_Fully_Declared (Type_Id, N); - -- Ada 2005 (AI-231) If the designated type is itself an access + -- Ada 2005 (AI-231): If the designated type is itself an access -- type that excludes null, it's default initializastion will -- be a null object, and we can insert an unconditional raise -- before the allocator. diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index ea1a21ed178..1e84b266745 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -663,9 +663,9 @@ package body Sem_Ch6 is -- Analyze_Object_Declaration; we treat it as a normal -- object declaration. + Set_Is_Return_Object (Defining_Identifier (Obj_Decl)); Analyze (Obj_Decl); - Set_Is_Return_Object (Defining_Identifier (Obj_Decl)); Check_Return_Subtype_Indication (Obj_Decl); if Present (HSS) then @@ -1804,12 +1804,19 @@ package body Sem_Ch6 is -- the body that depends on the subprogram having been frozen, -- such as uses of extra formals), so we force it to be frozen -- here. Same holds if the body and spec are compilation units. + -- Finally, if the return type is an anonymous access to protected + -- subprogram, it must be frozen before the body because its + -- expansion has generated an equivalent type that is used when + -- elaborating the body. if No (Spec_Id) then Freeze_Before (N, Body_Id); elsif Nkind (Parent (N)) = N_Compilation_Unit then Freeze_Before (N, Spec_Id); + + elsif Is_Access_Subprogram_Type (Etype (Body_Id)) then + Freeze_Before (N, Etype (Body_Id)); end if; else diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 3ad8ff5d21b..c1c661b08c0 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -1281,10 +1281,10 @@ package body Sem_Prag is -- sequence, so the only way we get here is by being in the -- declarative part of the body. - elsif Nkind (P) = N_Subprogram_Body - or else Nkind (P) = N_Package_Body - or else Nkind (P) = N_Task_Body - or else Nkind (P) = N_Entry_Body + elsif Nkind_In (P, N_Subprogram_Body, + N_Package_Body, + N_Task_Body, + N_Entry_Body) then return; end if; @@ -2497,7 +2497,8 @@ package body Sem_Prag is end if; E := Alias (E); - elsif Nkind (Parent (E)) = N_Full_Type_Declaration + elsif Nkind_In (Parent (E), N_Full_Type_Declaration, + N_Private_Extension_Declaration) and then Scope (E) = Scope (Alias (E)) then E := Alias (E); @@ -2626,7 +2627,7 @@ package body Sem_Prag is and then Comp_Unit = Get_Source_Unit (E1) and then not Is_Formal_Subprogram (E1) and then Nkind (Original_Node (Parent (E1))) /= - N_Full_Type_Declaration + N_Full_Type_Declaration then if Present (Alias (E1)) and then Scope (E1) /= Scope (Alias (E1)) @@ -2966,9 +2967,8 @@ package body Sem_Prag is -- Pragma cannot apply to subprogram body if Is_Subprogram (Def_Id) - and then - Nkind (Parent - (Declaration_Node (Def_Id))) = N_Subprogram_Body + and then Nkind (Parent (Declaration_Node (Def_Id))) = + N_Subprogram_Body then Error_Pragma ("pragma% requires separate spec" @@ -3505,10 +3505,8 @@ package body Sem_Prag is if Present (Decl) and then Nkind (Decl) = N_Subprogram_Declaration and then Present (Corresponding_Body (Decl)) - and then - Nkind - (Unit_Declaration_Node - (Corresponding_Body (Decl))) = + and then Nkind (Unit_Declaration_Node + (Corresponding_Body (Decl))) = N_Subprogram_Renaming_Declaration then Error_Msg_Sloc := Sloc (Def_Id); diff --git a/gcc/ada/sem_type.adb b/gcc/ada/sem_type.adb index bdd1c388220..3ca2e535478 100644 --- a/gcc/ada/sem_type.adb +++ b/gcc/ada/sem_type.adb @@ -2101,7 +2101,7 @@ package body Sem_Type is return Covers (Typ, Etype (N)) - -- Ada 2005 (AI-345) The context may be a synchronized interface. + -- Ada 2005 (AI-345): The context may be a synchronized interface. -- If the type is already frozen use the corresponding_record -- to check whether it is a proper descendant. diff --git a/gcc/ada/sprint.adb b/gcc/ada/sprint.adb index 4306ce41450..ad20565574f 100644 --- a/gcc/ada/sprint.adb +++ b/gcc/ada/sprint.adb @@ -2334,10 +2334,9 @@ package body Sprint is Write_Str_With_Col_Check ("out "); end if; - -- Ada 2005 (AI-231) parameter specification may carry - -- null exclusion. Do not print it now if this is an - -- access parameter, it is emitted when the access - -- definition is displayed. + -- Ada 2005 (AI-231): Parameter specification may carry null + -- exclusion. Do not print it now if this is an access formal, + -- it is emitted when the access definition is displayed. if Null_Exclusion_Present (Node) and then Nkind (Parameter_Type (Node)) diff --git a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h index a2963494c48..bdf9a04416b 100644 --- a/gcc/config/arm/arm-protos.h +++ b/gcc/config/arm/arm-protos.h @@ -208,4 +208,6 @@ extern void arm_lang_object_attributes_init(void); extern const char *arm_mangle_type (const_tree); +extern void arm_order_regs_for_local_alloc (void); + #endif /* ! GCC_ARM_PROTOS_H */ diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index a89229ec12a..8b89904ffa1 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -19046,4 +19046,28 @@ arm_mangle_type (const_tree type) return NULL; } +/* Order of allocation of core registers for Thumb: this allocation is + written over the corresponding initial entries of the array + initialized with REG_ALLOC_ORDER. We allocate all low registers + first. Saving and restoring a low register is usually cheaper than + using a call-clobbered high register. */ + +static const int thumb_core_reg_alloc_order[] = +{ + 3, 2, 1, 0, 4, 5, 6, 7, + 14, 12, 8, 9, 10, 11, 13, 15 +}; + +/* Adjust register allocation order when compiling for Thumb. */ + +void +arm_order_regs_for_local_alloc (void) +{ + const int arm_reg_alloc_order[] = REG_ALLOC_ORDER; + memcpy(reg_alloc_order, arm_reg_alloc_order, sizeof (reg_alloc_order)); + if (TARGET_THUMB) + memcpy (reg_alloc_order, thumb_core_reg_alloc_order, + sizeof (thumb_core_reg_alloc_order)); +} + #include "gt-arm.h" diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index 9f662f31297..2ab44c24483 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -1080,6 +1080,9 @@ extern int arm_structure_size_boundary; 127 \ } +/* Use different register alloc ordering for Thumb. */ +#define ORDER_REGS_FOR_LOCAL_ALLOC arm_order_regs_for_local_alloc () + /* Interrupt functions can only use registers that have already been saved by the prologue, even if they would normally be call-clobbered. */ diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index b7a88afb952..d00065ca63d 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -7855,14 +7855,13 @@ ix86_expand_prologue (void) rtx x, y; int align_bytes = crtl->stack_alignment_needed / BITS_PER_UNIT; int param_ptr_offset = (call_used_regs[REGNO (crtl->drap_reg)] - ? 0 : STACK_BOUNDARY / BITS_PER_UNIT); + ? 0 : UNITS_PER_WORD); gcc_assert (stack_realign_drap); /* Grab the argument pointer. */ x = plus_constant (stack_pointer_rtx, - (STACK_BOUNDARY / BITS_PER_UNIT - + param_ptr_offset)); + (UNITS_PER_WORD + param_ptr_offset)); y = crtl->drap_reg; /* Only need to push parameter pointer reg if it is caller @@ -7889,8 +7888,7 @@ ix86_expand_prologue (void) expand_builtin_return_addr etc. */ x = crtl->drap_reg; x = gen_frame_mem (Pmode, - plus_constant (x, - -(STACK_BOUNDARY / BITS_PER_UNIT))); + plus_constant (x, -UNITS_PER_WORD)); insn = emit_insn (gen_push (x)); RTX_FRAME_RELATED_P (insn) = 1; } @@ -8054,7 +8052,7 @@ ix86_expand_prologue (void) /* vDRAP is setup but after reload it turns out stack realign isn't necessary, here we will emit prologue to setup DRAP without stack realign adjustment */ - int drap_bp_offset = STACK_BOUNDARY / BITS_PER_UNIT * 2; + int drap_bp_offset = UNITS_PER_WORD * 2; rtx x = plus_constant (hard_frame_pointer_rtx, drap_bp_offset); insn = emit_insn (gen_rtx_SET (VOIDmode, crtl->drap_reg, x)); } @@ -8253,11 +8251,11 @@ ix86_expand_epilogue (int style) if (crtl->drap_reg && crtl->stack_realign_needed) { int param_ptr_offset = (call_used_regs[REGNO (crtl->drap_reg)] - ? 0 : STACK_BOUNDARY / BITS_PER_UNIT); + ? 0 : UNITS_PER_WORD); gcc_assert (stack_realign_drap); emit_insn ((*ix86_gen_add3) (stack_pointer_rtx, crtl->drap_reg, - GEN_INT (-(STACK_BOUNDARY / BITS_PER_UNIT + GEN_INT (-(UNITS_PER_WORD + param_ptr_offset)))); if (!call_used_regs[REGNO (crtl->drap_reg)]) emit_insn ((*ix86_gen_pop1) (crtl->drap_reg)); diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c865326d0bc..8ff23cdb5dd 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,19 @@ +2008-08-04 Jason Merrill <jason@redhat.com> + + PR c++/36963 + * typeck2.c (check_narrowing): Allow narrowing conversion + from an explicit floating-point constant. + + PR c++/37006 + * pt.c (tsubst_decl): Leave DECL_INITIAL set on deleted + instantiations. + +2008-08-04 Simon Baldwin <simonb@google.com> + + PR c++/36999 + * parser.c (cp_parser_elaborated_type_specifier): Warn only when + the declaration's id is followed by a semicolon. + 2008-07-31 Jakub Jelinek <jakub@redhat.com> PR c++/36405 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 15b66b03b95..76adb633ed7 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -11516,7 +11516,7 @@ cp_parser_elaborated_type_specifier (cp_parser* parser, caught elsewhere in parsing. Those that are pointless arrive here. */ - if (cp_parser_declares_only_class_p (parser) + if (cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON) && !is_friend && !processing_explicit_instantiation) warning (0, "declaration %qD does not declare anything", decl); diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 04fd29bb009..6e4f0ba447b 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -8143,7 +8143,9 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain) /* Clear out the mangled name and RTL for the instantiation. */ SET_DECL_ASSEMBLER_NAME (r, NULL_TREE); SET_DECL_RTL (r, NULL_RTX); - DECL_INITIAL (r) = NULL_TREE; + /* Leave DECL_INITIAL set on deleted instantiations. */ + if (!DECL_DELETED_FN (r)) + DECL_INITIAL (r) = NULL_TREE; DECL_CONTEXT (r) = ctx; if (member && DECL_CONV_FN_P (r)) diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index ee686fecf33..787f43963d6 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -640,9 +640,13 @@ check_narrowing (tree type, tree init) tree ftype = TREE_TYPE (init); bool ok = true; REAL_VALUE_TYPE d; + bool was_decl = false; if (DECL_P (init)) - init = decl_constant_value (init); + { + was_decl = true; + init = decl_constant_value (init); + } if (TREE_CODE (type) == INTEGER_TYPE && TREE_CODE (ftype) == REAL_TYPE) @@ -664,7 +668,12 @@ check_narrowing (tree type, tree init) if (TREE_CODE (init) == REAL_CST) { d = TREE_REAL_CST (init); - if (exact_real_truncate (TYPE_MODE (type), &d)) + if (exact_real_truncate (TYPE_MODE (type), &d) + /* FIXME: As a temporary workaround for PR 36963, don't + complain about narrowing from a floating + literal. Hopefully this will be resolved at the + September 2008 C++ meeting. */ + || !was_decl) ok = true; } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8c0f18eb123..0041134e91b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,17 @@ +2008-08-04 Richard Guenther <rguenther@suse.de> + + PR middle-end/36691 + * gcc.c-torture/execute/pr36691.c: New testcase. + +2008-08-04 Victor Kaplansky <victork@il.ibm.com> + + * gcc.dg/vect/vect-complex-5.c: New test. + +2008-08-04 Simon Baldwin <simonb@google.com> + + PR c++/36999 + * g++.dg/warn/pr36999.C: New. + 2008-08-04 Arnaud Charlet <charlet@adacore.com> * gnat.dg/bip_aggregate_bug.adb: New test. diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted3.C b/gcc/testsuite/g++.dg/cpp0x/defaulted3.C new file mode 100644 index 00000000000..efde415936d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/defaulted3.C @@ -0,0 +1,16 @@ +// PR c++/37006 +// { dg-options "-std=c++0x" } + +template<class T> +struct A { + template<class U> + bool operator==(const A<U>&) = delete; // { dg-error "deleted function" } + operator bool () { return true; } +}; + +int main() +{ + A<int> a1; + A<void> a2; + if(a1 == a2) {} // { dg-error "used here" } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist5.C b/gcc/testsuite/g++.dg/cpp0x/initlist5.C index 0d02fd42d7f..fbdc673948f 100644 --- a/gcc/testsuite/g++.dg/cpp0x/initlist5.C +++ b/gcc/testsuite/g++.dg/cpp0x/initlist5.C @@ -19,3 +19,7 @@ C c2 = { 1.1, 2 }; // { dg-error "narrowing" } int j { 1 }; // initialize to 1 int k {}; // initialize to 0 + +// PR c++/39693 +double d = 1.1; +float fa[] = { d, 1.1 }; // { dg-error "narrowing conversion of 'd'" } diff --git a/gcc/testsuite/g++.dg/warn/pr36999.C b/gcc/testsuite/g++.dg/warn/pr36999.C new file mode 100644 index 00000000000..ce2286efcf4 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/pr36999.C @@ -0,0 +1,40 @@ +/* PR36999: Erroneous "does not declare anything" warnings. */ +/* { dg-do compile } */ + +class C1 { + public: class C2 { }; +}; + +void cf1 (class C1::C2, void*); // { dg-bogus "does not declare anything" } +void cf2 (void*, class C1::C2); +void cf3 (C1::C2, void*); + +namespace N { + +enum E1 { foo }; +enum E2 { bar }; + +template <class X> +class TC1 { }; + +template <class T, class U> +class TC2 : public TC1<T> { }; + +} + +void +tcf1 (N::TC2<enum N::E1, void*> *arg1, // { dg-bogus "does not declare anything" } + N::TC2<void*, enum N::E1> *arg2, + N::TC2<N::E1, void*> *arg3) +{ +} + +void * +tcf2 (void *x) +{ + return (void *) + (N::TC2<enum N::E1, void*> *) // { dg-bogus "does not declare anything" } + (N::TC2<void*, enum N::E1> *) + (N::TC2<N::E1, void*> *) + x; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr36691.c b/gcc/testsuite/gcc.c-torture/execute/pr36691.c new file mode 100644 index 00000000000..81fe6fd55d9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr36691.c @@ -0,0 +1,17 @@ +unsigned char g_5; + +void func_1 (void) +{ + for (g_5 = 9; g_5 >= 4; g_5 -= 5) + ; +} + +extern void abort (void); +int main (void) +{ + func_1 (); + if (g_5 != 0) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.dg/vect/vect-complex-5.c b/gcc/testsuite/gcc.dg/vect/vect-complex-5.c new file mode 100644 index 00000000000..91eb1f54b3c --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-complex-5.c @@ -0,0 +1,45 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdio.h> +#include <stdarg.h> +#include "tree-vect.h" + +#define N 16 + +struct foostr { + _Complex short f1; + _Complex short f2; +}; + +_Complex short a1[64] __attribute__ ((__aligned__(16))); +_Complex short a2[64] __attribute__ ((__aligned__(16))); +_Complex short b1[64] __attribute__ ((__aligned__(16))); +_Complex short b2[64] __attribute__ ((__aligned__(16))); +struct foostr c[64] __attribute__ ((__aligned__(16))); + +__attribute__ ((noinline)) void +foo (void) +{ + int i; + + for (i = 0; i < N; i++) + { + c[i].f1 = a1[i] + b1[i]; + c[i].f2 = a2[i] + b2[i]; + } + +} + +int +main (void) +{ + int i; + check_vect (); + + foo (); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c index c314da49f94..1a1e58b1a81 100644 --- a/gcc/tree-ssa-loop-ivopts.c +++ b/gcc/tree-ssa-loop-ivopts.c @@ -2275,9 +2275,11 @@ add_iv_value_candidates (struct ivopts_data *data, add_candidate (data, build_int_cst (basetype, 0), iv->step, true, use); - /* Third, try removing the constant offset. */ + /* Third, try removing the constant offset. Make sure to even + add a candidate for &a[0] vs. (T *)&a. */ base = strip_offset (iv->base, &offset); - if (offset) + if (offset + || base != iv->base) add_candidate (data, base, iv->step, false, use); } diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c index 83baae7828a..1d0605e68b5 100644 --- a/gcc/tree-ssa-loop-niter.c +++ b/gcc/tree-ssa-loop-niter.c @@ -697,7 +697,7 @@ number_of_iterations_lt_to_ne (tree type, affine_iv *iv0, affine_iv *iv1, /* The final value of the iv is iv1->base + MOD, assuming that this computation does not overflow, and that iv0->base <= iv1->base + MOD. */ - if (!iv1->no_overflow && !integer_zerop (mod)) + if (!iv0->no_overflow && !integer_zerop (mod)) { bound = fold_build2 (MINUS_EXPR, type, TYPE_MAX_VALUE (type1), tmod); @@ -719,7 +719,7 @@ number_of_iterations_lt_to_ne (tree type, affine_iv *iv0, affine_iv *iv1, /* The final value of the iv is iv0->base - MOD, assuming that this computation does not overflow, and that iv0->base - MOD <= iv1->base. */ - if (!iv0->no_overflow && !integer_zerop (mod)) + if (!iv1->no_overflow && !integer_zerop (mod)) { bound = fold_build2 (PLUS_EXPR, type1, TYPE_MIN_VALUE (type1), tmod); diff --git a/gcc/tree-vect-transform.c b/gcc/tree-vect-transform.c index 362d37cf861..e466594f0cf 100644 --- a/gcc/tree-vect-transform.c +++ b/gcc/tree-vect-transform.c @@ -3127,16 +3127,16 @@ vectorizable_call (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt) rhs_type = NULL_TREE; nargs = gimple_call_num_args (stmt); + /* Bail out if the function has more than two arguments, we + do not have interesting builtin functions to vectorize with + more than two arguments. No arguments is also not good. */ + if (nargs == 0 || nargs > 2) + return false; + for (i = 0; i < nargs; i++) { op = gimple_call_arg (stmt, i); - /* Bail out if the function has more than two arguments, we - do not have interesting builtin functions to vectorize with - more than two arguments. */ - if (i >= 2) - return false; - /* We can only handle calls with arguments of the same type. */ if (rhs_type && rhs_type != TREE_TYPE (op)) @@ -3147,7 +3147,7 @@ vectorizable_call (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt) } rhs_type = TREE_TYPE (op); - if (!vect_is_simple_use (op, loop_vinfo, &def_stmt, &def, &dt[nargs])) + if (!vect_is_simple_use (op, loop_vinfo, &def_stmt, &def, &dt[i])) { if (vect_print_dump_info (REPORT_DETAILS)) fprintf (vect_dump, "use not simple."); @@ -3155,10 +3155,6 @@ vectorizable_call (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt) } } - /* No arguments is also not good. */ - if (nargs == 0) - return false; - vectype_in = get_vectype_for_scalar_type (rhs_type); if (!vectype_in) return false; |