Re: [patch] support for multiarch systems
Hi! On Sun, 21 Aug 2011 02:14:10 +0200, Matthias Klose d...@ubuntu.com wrote: Non-text part: multipart/mixed On 08/20/2011 09:51 PM, Matthias Klose wrote: Multiarch [1] is the term being used to refer to the capability of a system to install and run applications of multiple different binary targets on the same system. The idea and name of multiarch dates back to 2004/2005 [2] (to be confused with multiarch in glibc). attached is an updated patch which includes feedback from Jakub and Joseph. I can confirm that this restores out-of-the box GCC bootstrap on Debian GNU/Linux testing 386 and Debian GNU/Hurd unstable i386. Thanks! A hint for the kids trying this patch at home: don't forget to regenerate gcc/configure... (Saves you some hours...) ;-) Matthias, please put the following patch on top, though. (For preserving the order of using i386/t-linux (which should be renamed i386/t-gnu-user, but that's for another day) and i386/t-{gnu,kfreebsd}. * gcc/config.gcc i[34567]86-*-kfreebsd*-gnu, x86_64-*-kfreebsd*-gnu i[34567]86-*-gnu*: Take care to put their configuration files after the i386/t-linux one. diff --git a/gcc/config.gcc b/gcc/config.gcc index 784ddd7..7d0214f 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -1317,14 +1317,12 @@ i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | i ;; i[34567]86-*-kfreebsd*-gnu) tm_file=${tm_file} i386/gnu-user.h kfreebsd-gnu.h i386/kfreebsd-gnu.h - tmake_file=${tmake_file} i386/t-kfreebsd ;; i[34567]86-*-kopensolaris*-gnu) tm_file=${tm_file} i386/gnu-user.h kopensolaris-gnu.h i386/kopensolaris-gnu.h ;; i[34567]86-*-gnu*) tm_file=$tm_file i386/gnu-user.h gnu.h i386/gnu.h - tmake_file=${tmake_file} i386/t-gnu ;; esac tmake_file=${tmake_file} i386/t-crtstuff @@ -3587,11 +3585,15 @@ case ${target} in i[34567]86-*-darwin* | x86_64-*-darwin*) ;; - i[34567]86-*-linux* | x86_64-*-linux* | \ - i[34567]86-*-kfreebsd*-gnu | x86_64-*-kfreebsd*-gnu | \ - i[34567]86-*-gnu*) + i[34567]86-*-linux* | x86_64-*-linux*) tmake_file=${tmake_file} i386/t-linux ;; + i[34567]86-*-kfreebsd*-gnu | x86_64-*-kfreebsd*-gnu) + tmake_file=${tmake_file} i386/t-linux i386/t-kfreebsd + ;; + i[34567]86-*-gnu*) + tmake_file=${tmake_file} i386/t-linux i386/t-gnu + ;; i[34567]86-*-solaris2* | x86_64-*-solaris2.1[0-9]*) ;; i[34567]86-*-cygwin* | i[34567]86-*-mingw* | x86_64-*-mingw*) Grüße, Thomas pgp84Dl6hIS8C.pgp Description: PGP signature
[Ada] Remove duplicate in Makefile.in
Tested on x86_64-pc-linux-gnu, committed on trunk. 2011-09-06 Arnaud Charlet char...@adacore.com * gcc-interface/Makefile.in (X86_TARGET_PAIRS): Remove duplicate declaration. Index: gcc-interface/Makefile.in === --- gcc-interface/Makefile.in (revision 178565) +++ gcc-interface/Makefile.in (working copy) @@ -434,14 +434,6 @@ X86_TARGET_PAIRS = \ g-bytswa.adbg-bytswa-x86.adb \ s-atocou.adbs-atocou-x86.adb -# Special version of units for x86 and x86-64 platforms. - -X86_TARGET_PAIRS = \ - a-numaux.adsa-numaux-x86.ads \ - a-numaux.adba-numaux-x86.adb \ - g-bytswa.adbg-bytswa-x86.adb \ - s-atocou.adbs-atocou-x86.adb - X86_64_TARGET_PAIRS = \ a-numaux.adsa-numaux-x86.ads \ a-numaux.adba-numaux-x86.adb \
[Patch, Ada, Darwin] Remove explicit -lm from shared library builds.
-lm is a symlink to libSystem.dylib on all recent Darwin and therefore not required (as libSystem is automatically provided by gcc). Using -lm (especially when in conjunction with -flat_namespace) can cause unexpected differences in behavior between Darwin 9 - Darwin10 (where the unwinder was moved to libSystem) - since it causes libSystem to be placed ahead of other libs. - I guess it could be a config subsitution if anyone thinks it worth it for (really) ancient Darwin support - but I've just removed it. (no Ada regressions from this on *-darwin9 and x86-64-darwin10.) OK for trunk? Iain ada: * gcc-interface/Makefile.in (gnatlib-shared-darwin): Remove reference to -lm. diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in index 4be366e..8974a99 100644 --- a/gcc/ada/gcc-interface/Makefile.in +++ b/gcc/ada/gcc-interface/Makefile.in @@ -2664,7 +2666,7 @@ gnatlib-shared-darwin: $(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \ $(SO_OPTS) \ -Wl,-install_name,@rpath/libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \ - $(MISCLIB) -lm + $(MISCLIB) cd $(RTSDIR); `echo $(GCC_FOR_TARGET) \ | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -dynamiclib $(PICFLAG_FOR_TARGET) \ -o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
Re: [Patch, fortran] [0/4] gfc_ss structs initialization small refactoring
http://gcc.gnu.org/ml/fortran/2011-08/threads.html#00264 Mikael Morin wrote: the 4 follow-up patches try to refactor some common code initializing gfc_ss structs. Regression-tested (the 4 patches together only) on x86_64-freebsd8.2. OK for trunk? The patch set is OK. I think it is a nice clean up and might prevent future bugs due to incomplete initialization. Sorry for the slow review. Tobias
Re: [PATCH][Ada] Fix shift_unc_components_for_thin_pointers for sizetype changes
On Mon, 5 Sep 2011, Eric Botcazou wrote: This avoids setting the TREE_OVERFLOW bit on DECL_FIELD_OFFSET for the shifted bounds field. If DECL_FIELD_OFFSET of array-field is always a constant we could as well use DECL_FIELD_OFFSET (bounds_field) = size_int (-int_byte_position (array_field)); also I notice that DECL_OFFSET_ALIGN is now bogus for bounds_field. Yes, the offsets in the template record are fixed. DECL_FIELD_OFFSET no longer has the desired zero bits. Shouldn't we instead set DECL_FIELD_OFFSET to -DECL_OFFSET_ALIGN and adjust DECL_FIELD_BIT_OFFSET accordingly? Well, with the above questions and suggestions I'd rather leave it to you deciding whether you like the below hack or want to rework the function a bit. I guess that we have 3 solutions: - keep the negative offset hack and patch up, - make DECL_FIELD_OFFSET use ssizetype instead of sizetype, - remove the negative offset hack and devise a replacement mechanism. We previously discussed 2 internally and agreed that it would be kind of an earthquake (feel free to differ though :-) So it's probably about time to bite the bullet and tackle 3 seriously... Heh, well - more power to you (I agree about 2 ...). The other main related issue I run into is signed array domains (see PR50294, similar issues arise with current sign-extending sizetypes and unsigned array domains). Any hints on that? I can certainly patch up this one as well to some extent in layout_type ... Thanks, Richard.
Re: [Patch, Ada, Darwin] Restore PowerPC Darwin Ada bootstrap (after a looong time, it seems).
1. rs6000.c (WORLD_SAVE_P) decides on the use of the out-of-line prologue saves on the basis of cfun-calls_setjmp flag_exceptions. of course, flag_exceptions is NOT set by Ada for SjLj - which is what's used for the compiler build. It isn't set because GNAT implements a different SJLJ scheme, entirely based on __builtin_setjmp/__builtin_longjmp. It is incompatible with the regular EH scheme so flag_exceptions cannot be set. - it doesn't seem reasonable to force -fexceptions - until we can build ada with ZCE. Or change the SJLJ scheme. - so, given that SjLj exceptions are in use w/out the flag - it seems that the check should be adjusted. 2. (TRUNK-only) ** Eric, you removed the setting of cfun-calls_setjmp from gcc/ builtins.c (in June). This (re)breaks trunk c.f. 4.6 - given the fix to (1). Was there some reason to remove this? Yes, the comment just above was obsolete after the SPARC change. Moreover, __builtin_setjmp is not like setjmp, it is lowered into internal constructs that represent all of its effects so using the cfun-calls_setjmp big hammer looks overkill to me. ... would there be some more appropriate test for rs6000.c to use? Possibly, what's the exact reason why the special routines cannot be used? 3. There is no multi-lib target set for powerpc64-darwin, thus bootstrap fails with a Bad Alignment error in building the target libs. Since this is a long-standing regression (last bootstrap for powerpc- darwin was likely in the 4.2 era). OK for 4.6 (1, 3) and trunk (1,2 3) ? Be careful about system-darwin-ppc64.ads: I don't think you can backport an instance from the trunk to the 4.6 branch, as there is at least one entry missing at the end. Thanks for working on this! -- Eric Botcazou
[Ada] Ada 2012 accessibility checking
This set of changes implements support for AI05-0234's rules about how the accessibility level of a function result object may be determined by the point of call. The implementation involves passing in an additional accessibility-level parameter to some functions, similar in some ways to the Extra_Accessibility parameters that are already used in implementing access parameters. Initially this new parameter is only used to perform accessibility checks associated with function results which have access discriminants. Tested on x86_64-pc-linux-gnu, committed on trunk 2011-09-06 Steve Baird ba...@adacore.com * einfo.ads (Extra_Accessibility_Of_Result): New function; in the (Ada2012) cases described in AI05-0234 where the accessibility level of a function result is determined by the point of call, an implicit parameter representing that accessibility level is passed in. Extra_Accessibilty_Of_Result yields this additional formal parameter. Extra_Accessibility_Of_Result is analogous to the existing Extra_Accessibility function used in the implementation of access parameters. (Set_Extra_Accessibility_Of_Result): New procedure; sets Extra_Accessibility_Of_Result attribute. * einfo.adb (Extra_Accessibility_Of_Result): New function. (Set_Extra_Accessibility_Of_Result): New procedure. (Write_Field19_Name): Display Extra_Accessibilty_Of_Result attribute. * sem_util.adb (Dynamic_Accessibility_Level): Set Etype of an accessibility level literal to Natural; introduce a nested function, Make_Level_Literal, to do this. * exp_ch6.ads (Needs_Result_Accessibility_Level): New function; determines whether a given function (or access-to-function type) needs to have an implicitly-declared accessibility-level parameter added to its profile. (Add_Extra_Actual_To_Call): Export an existing procedure which was previously declared in the body of Exp_Ch6. * exp_ch6.adb (Add_Extra_Actual_To_Call): Export declaration by moving it to exp_ch6.ads. (Has_Unconstrained_Access_Discriminants): New Function; a predicate on subtype entities which returns True if the given subtype is unconstrained and has one or more access discriminants. (Expand_Call): When expanding a call to a function which takes an Extra_Accessibility_Of_Result parameter, pass in the appropriate actual parameter value. In the case of a function call which is used to initialize an allocator, this may not be possible because the Etype of the allocator may not have been set yet. In this case, we defer passing in the parameter and handle it later in Expand_Allocator_Expression. (Expand_Simple_Function_Return): When returning from a function which returns an unconstrained subtype having at least one access discriminant, generate the accessibility check needed to ensure that the function result will not outlive any objects designated by its discriminants. (Needs_Result_Accessibility_Level): New function; see exp_ch6.ads description. * exp_ch4.adb (Expand_Allocator_Expression): When a function call is used to initialize an allocator, we may need to pass in the accessibility level determined by the point of call (AI05-0234) to the function. Expand_Call, where such actual parameters are usually generated, is too early in this case because the Etype of the allocator (which is used in determining the level to be passed in) may not have been set yet when Expand_Call executes. Instead, we generate code to pass in the appropriate actual parameter in Expand_Allocator_Expression. * sem_ch6.adb (Create_Extra_Formals): Create the new Extra_Accessibility_Of_Result formal if Needs_Result_Accessibility_Level returns True. This includes the introduction of a nested procedure, Check_Against_Result_Level. Index: einfo.adb === --- einfo.adb (revision 178565) +++ einfo.adb (working copy) @@ -161,6 +161,7 @@ --Body_Entity Node19 --Corresponding_Discriminant Node19 + --Extra_Accessibility_Of_Result Node19 --Parent_Subtype Node19 --Related_Array_ObjectNode19 --Size_Check_Code Node19 @@ -1043,6 +1044,12 @@ return Node13 (Id); end Extra_Accessibility; + function Extra_Accessibility_Of_Result (Id : E) return E is + begin + pragma Assert (Ekind_In (Id, E_Function, E_Operator, E_Subprogram_Type)); + return Node19 (Id); + end Extra_Accessibility_Of_Result; + function Extra_Constrained (Id : E) return E is begin pragma Assert (Is_Formal (Id) or else Ekind
Re: [Patch, Ada, Darwin] Restore PowerPC Darwin Ada bootstrap (after a looong time, it seems).
Hello Eric, On 6 Sep 2011, at 08:41, Eric Botcazou wrote: - it doesn't seem reasonable to force -fexceptions - until we can build ada with ZCE. Or change the SJLJ scheme. Hm. I'm probably being a bit dumb here - but not clear about which scheme/where in the code-base you have in mind. (I get the point about the SjLj scheme used by Ada being different). ... would there be some more appropriate test for rs6000.c to use? Possibly, what's the exact reason why the special routines cannot be used? That's a good question, and one that I haven't got to the bottom of - but the exclusion was there in the original code-base [still in the vendor's tree too]. (also, the rs6000 pro/epilogue code is not the easiest to navigate). 3. There is no multi-lib target set for powerpc64-darwin, thus bootstrap fails with a Bad Alignment error in building the target libs. Since this is a long-standing regression (last bootstrap for powerpc- darwin was likely in the 4.2 era). OK for 4.6 (1, 3) and trunk (1,2 3) ? Be careful about system-darwin-ppc64.ads: I don't think you can backport an instance from the trunk to the 4.6 branch, as there is at least one entry missing at the end. Yes, I have a different version for 4.6 with the recently deleted entries still intact (and, of course, it has been tested). cheers Iain
[Ada] Protected extension as full type for limited private rejected
The compiler complains when a limited private type has a full type that is a protected type extending an interface, thinking that the partial view is not limited. The compiler was incorrectly checking that the partial view satisfies Is_Limited_Composite rather than simply testing for limitedness. The following test must compile quietly with -gnat05: package Priv_Prot_Extension_Bug is type Protected_Interface is protected interface; type Priv is limited private; private protected type Priv is new Protected_Interface with end Priv; end Priv_Prot_Extension_Bug; package body Priv_Prot_Extension_Bug is protected body Priv is end Priv; end Priv_Prot_Extension_Bug; Tested on x86_64-pc-linux-gnu, committed on trunk 2011-09-06 Gary Dismukes dismu...@adacore.com * sem_ch9.adb (Check_Interfaces): Test Is_Limited_Type rather than Is_Limited_Record when checking that the partial view of a synchronized full view must be limited. Index: sem_ch9.adb === --- sem_ch9.adb (revision 178565) +++ sem_ch9.adb (working copy) @@ -2381,7 +2381,7 @@ -- declaration must be limited. if Present (Interface_List (N)) - and then not Is_Limited_Record (Priv_T) + and then not Is_Limited_Type (Priv_T) then Error_Msg_Sloc := Sloc (Priv_T); Error_Msg_N ((Ada 2005) limited type declaration expected for
Re: [PATCH, testsuite, ARM] change XFAIL to pass for ARM on a case testing tree-ssa-dom
On Tue, Sep 6, 2011 at 3:29 AM, Jiangning Liu jiangning@arm.com wrote: PING... Ok. -Original Message- From: gcc-patches-ow...@gcc.gnu.org [mailto:gcc-patches- ow...@gcc.gnu.org] On Behalf Of Jiangning Liu Sent: Friday, August 26, 2011 5:56 PM To: gcc-patches@gcc.gnu.org Subject: [PATCH, testsuite, ARM] change XFAIL to pass for ARM on a case testing tree-ssa-dom Test case gcc.dg/tree-ssa/20040204-1.c can pass for -O1 after Richard Guenther rguent...@suse.de fixed something in tree-ssa-dom. The link_error should be optimized away for ARM targets as well. The patch is: diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20040204-1.c b/gcc/testsuite/gcc.dg/tree-ssa/20040204-1.c index 45e44a1..470b585 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/20040204-1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/20040204-1.c @@ -33,5 +33,5 @@ void test55 (int x, int y) that the should be emitted (based on BRANCH_COST). Fix this by teaching dom to look through and register all components as true. */ -/* { dg-final { scan-tree-dump-times link_error 0 optimized { xfail { ! alpha*-*-* powerpc*-*-* cris-*-* crisv32-*-* hppa*-*-* i?86-*-* mmix- *-* mips*-*-* m68k*-*-* moxie-*-* sparc*-*-* spu-*-* x86_64-*-* } } } } */ +/* { dg-final { scan-tree-dump-times link_error 0 optimized { xfail { ! alpha*-*-* arm*-*-* powerpc*-*-* cris-*-* crisv32-*-* hppa*-*-* i?86- *-* mmix-*-* mips*-*-* m68k*-*-* moxie-*-* sparc*-*-* spu-*-* x86_64-*- * } } } } */ /* { dg-final { cleanup-tree-dump optimized } } */ gcc/testsuite/ChangeLog: 2011-08-26 Jiangning Liu jiangning@arm.com PR tree-optimization/46021 * gcc.dg/tree-ssa/20040204-1.c: Don't XFAIL on arm*-*-*. Thanks, -Jiangning
[Ada] Expansion of case expressions
A case expression is rewritten as an Expression_With_Actions, whose main component is a case statement that mirrors the structure of the case expression. The actions created for the expression in a given case alterantive must be attached to the statement list of the ccrresponding case statement alternative They cannot be propagated ahead of the case statement, because the validity of the expression that generated the action may hold only for that alternative. No short example available. Tested on x86_64-pc-linux-gnu, committed on trunk 2011-09-06 Ed Schonberg schonb...@adacore.com * exp_ch4.adb (Expand_N_Case_Expression): Actions created for the expression in a given case alternative must be attached to the statement list of the ccrresponding case statement alternative They cannot be propagated ahead of the case statement, because the validity of the expression that generated the action may hold only for that alternative. Index: exp_ch4.adb === --- exp_ch4.adb (revision 178569) +++ exp_ch4.adb (working copy) @@ -4149,15 +4149,14 @@ Alt := First (Alternatives (N)); while Present (Alt) loop declare -Aexp : Node_Id := Expression (Alt); -Aloc : constant Source_Ptr := Sloc (Aexp); +Aexp : Node_Id := Expression (Alt); +Aloc : constant Source_Ptr := Sloc (Aexp); +Stats : List_Id; begin --- Propagate declarations inserted in the node by Insert_Actions --- (for example, temporaries generated to remove side effects). +-- As described above, take Unrestricted_Access for case of non- +-- scalar types, to avoid big copies, and special cases. -Append_List_To (Actions, Sinfo.Actions (Alt)); - if not Is_Scalar_Type (Typ) then Aexp := Make_Attribute_Reference (Aloc, @@ -4165,14 +4164,25 @@ Attribute_Name = Name_Unrestricted_Access); end if; +Stats := New_List ( + Make_Assignment_Statement (Aloc, +Name = New_Occurrence_Of (Tnn, Loc), +Expression = Aexp)); + +-- Propagate declarations inserted in the node by Insert_Actions +-- (for example, temporaries generated to remove side effects). +-- These actions must remain attached to the alternative, given +-- that they are generated by the corresponding expression. + +if Present (Sinfo.Actions (Alt)) then + Prepend_List (Sinfo.Actions (Alt), Stats); +end if; + Append_To (Alternatives (Cstmt), Make_Case_Statement_Alternative (Sloc (Alt), Discrete_Choices = Discrete_Choices (Alt), - Statements = New_List ( - Make_Assignment_Statement (Aloc, - Name = New_Occurrence_Of (Tnn, Loc), - Expression = Aexp; + Statements = Stats)); end; Next (Alt);
Re: [Patch, Ada, Darwin] Restore PowerPC Darwin Ada bootstrap (after a looong time, it seems).
That's a good question, and one that I haven't got to the bottom of - but the exclusion was there in the original code-base [still in the vendor's tree too]. (also, the rs6000 pro/epilogue code is not the easiest to navigate). Assuming that this is because the non-local goto handler needs to find a register saved at a canonical place, you can try !cfun-has_nonlocal_label. This will subsume the original check !(cfun-calls_setjmp flag_exceptions) as both the regular SJLJ scheme and the GNAT SJLJ scheme use it. Yes, I have a different version for 4.6 with the recently deleted entries still intact (and, of course, it has been tested). OK. -- Eric Botcazou
[Ada] Ada 2012 accessibility checking
In addition to fixing some bugs, the major effect of this set of changes is to temporarily disable support for AI05-0234's rules about how the accessibility level of a function result object may be determined by the point of call. Tested on x86_64-pc-linux-gnu, committed on trunk 2011-09-06 Steve Baird ba...@adacore.com * exp_ch4.adb (Expand_Allocator_Expression): Look through derived subprograms in checking for presence of an Extra_Accessibility_Of_Result formal parameter. * exp_ch6.adb (Expand_Call): Look through derived subprograms in checking for presence of an Extra_Accessibility_Of_Result formal parameter. (Expand_Call.Add_Actual_Parameter): Fix a bug in the case where the Parameter_Associatiations attribute is already set, but set to an empty list. (Needs_Result_Accessibility_Level): Unconditionally return False. This is a temporary change, disabling the Extra_Accessibility_Of_Result mechanism. (Expand_Simple_Function_Return): Check for Extra_Accessibility_Of_Result parameter's presence instead of testing Ada_Version when generating a runtime accessibility check which makes use of the parameter. Index: exp_ch4.adb === --- exp_ch4.adb (revision 178570) +++ exp_ch4.adb (working copy) @@ -783,6 +783,8 @@ Subp := Entity (Name (Exp)); end if; +Subp := Ultimate_Alias (Subp); + if Present (Extra_Accessibility_Of_Result (Subp)) then Add_Extra_Actual_To_Call (Subprogram_Call = Exp, Index: exp_ch6.adb === --- exp_ch6.adb (revision 178569) +++ exp_ch6.adb (working copy) @@ -1847,8 +1847,10 @@ if No (Prev) then if No (Parameter_Associations (Call_Node)) then Set_Parameter_Associations (Call_Node, New_List); - Append (Insert_Param, Parameter_Associations (Call_Node)); end if; + + Append (Insert_Param, Parameter_Associations (Call_Node)); + else Insert_After (Prev, Insert_Param); end if; @@ -2754,7 +2756,8 @@ -- passed in to it, then pass it in. if Ekind_In (Subp, E_Function, E_Operator, E_Subprogram_Type) - and then Present (Extra_Accessibility_Of_Result (Subp)) +and then + Present (Extra_Accessibility_Of_Result (Ultimate_Alias (Subp))) then declare Ancestor : Node_Id := Parent (Call_Node); @@ -2763,15 +2766,19 @@ begin -- Unimplemented: if Subp returns an anonymous access type, then + --a) if the call is the operand of an explict conversion, then -- the target type of the conversion (a named access type) -- determines the accessibility level pass in; + --b) if the call defines an access discriminant of an object -- (e.g., the discriminant of an object being created by an -- allocator, or the discriminant of a function result), -- then the accessibility level to pass in is that of the -- discriminated object being initialized). +-- ??? + while Nkind (Ancestor) = N_Qualified_Expression loop Ancestor := Parent (Ancestor); @@ -2851,7 +2858,9 @@ Scope_Depth (Current_Scope) + 1); end if; - Add_Extra_Actual (Level, Extra_Accessibility_Of_Result (Subp)); + Add_Extra_Actual + (Level, + Extra_Accessibility_Of_Result (Ultimate_Alias (Subp))); end if; end; end if; @@ -6742,7 +6751,7 @@ -- ensure that the function result does not outlive an -- object designated by one of it discriminants. - if Ada_Version = Ada_2012 + if Present (Extra_Accessibility_Of_Result (Scope_Id)) and then Has_Unconstrained_Access_Discriminants (R_Type) then declare @@ -8320,6 +8329,9 @@ return False; end Has_Unconstrained_Access_Discriminant_Component; + Feature_Disabled : constant Boolean := True; + -- Temporary + -- Start of processing for Needs_Result_Accessibility_Level begin @@ -8328,6 +8340,9 @@ if not Present (Func_Typ) then return False; + elsif Feature_Disabled then + return False; + -- False if not a function, also handle enum-lit renames case elsif Func_Typ = Standard_Void_Type
Re: rtl_verify_flow_info fix
On 09/05/2011 02:46 PM, Jakub Jelinek wrote: On Mon, Sep 05, 2011 at 02:31:32PM +0200, Tom de Vries wrote: --- gcc/recog.c (revision 178145) +++ gcc/recog.c (working copy) @@ -118,6 +118,46 @@ init_recog (void) } +/* Return true if labels in asm operands BODY are LABEL_REFs. */ + +static bool +asm_labels_ok (rtx body) +{ + rtx first, asmop = NULL; + int i; asmop = extract_asm_operands (body); if (asmop == NULL) return true; ? I'd say you don't need to call asm_noperands after it. Yes, that's better. Jakub bootstrapped and regtested on x86_64, build and regtested on arm. OK for trunk? Thanks, - Tom 2011-09-06 Tom de Vries t...@codesourcery.com * recog.c (asm_labels_ok): New function. (check_asm_operands): Use asm_labels_ok. Index: gcc/recog.c === --- gcc/recog.c (revision 178145) +++ gcc/recog.c (working copy) @@ -118,6 +118,25 @@ init_recog (void) } +/* Return true if labels in asm operands BODY are LABEL_REFs. */ + +static bool +asm_labels_ok (rtx body) +{ + rtx asmop; + int i; + + asmop = extract_asm_operands (body); + if (asmop == NULL_RTX) +return true; + + for (i = 0; i ASM_OPERANDS_LABEL_LENGTH (asmop); i++) +if (GET_CODE (ASM_OPERANDS_LABEL (asmop, i)) != LABEL_REF) + return false; + + return true; +} + /* Check that X is an insn-body for an `asm' with operands and that the operands mentioned in it are legitimate. */ @@ -129,6 +148,9 @@ check_asm_operands (rtx x) const char **constraints; int i; + if (!asm_labels_ok (x)) +return 0; + /* Post-reload, be more strict with things. */ if (reload_completed) {
[PATCH] check_cfg assert fix
Hi, During testing the approved-for-commit middle-end patch for bug 43864 on ARM, I ran into a gcc.dg/torture/pr46068.c ICE. The following assert in haifa-sched.c:check_cfg triggered: ... else if (any_condjump_p (head)) gcc_assert (/* Usual case. */ (EDGE_COUNT (bb-succs) 1 !BARRIER_P (NEXT_INSN (head))) /* Or jump to the next instruction. */ || (EDGE_COUNT (bb-succs) == 1 (BB_HEAD (EDGE_I (bb-succs, 0)-dest) == JUMP_LABEL (head; ... It triggered on this rtl, a conditional return followed by a barrier: ... (jump_insn 44 43 93 7 (set (pc) (if_then_else (ne (reg:CC 24 cc) (const_int 0 [0])) (return) (pc))) gcc/testsuite/gcc.dg/builtin-unreachable-4.c:13 249 {*cond_return} (expr_list:REG_DEAD (reg:CC 24 cc) (expr_list:REG_BR_PROB (const_int 9996 [0x270c]) (nil))) - return) (barrier 93 44 92) ... Although this insn sequence is non-optimal (the conditional return can be optimized to an unconditional one, given that it's followed by a barrier), it's not incorrect. The patch fixes this ICE by removing the check for the 'EDGE_COUNT (bb-succs) == 1' case. Bootstrapped and reg-tested on x86_64 and build and reg-tested on arm. OK for trunk? Thanks, - Tom 2011-09-05 Tom de Vries t...@codesourcery.com * haifa-sched.c (check_cfg): Remove restriction on conditional jump if the containing block has only 1 outgoing edge. Index: gcc/haifa-sched.c === --- gcc/haifa-sched.c (revision 178145) +++ gcc/haifa-sched.c (working copy) @@ -6065,13 +6065,12 @@ check_cfg (rtx head, rtx tail) gcc_assert (EDGE_COUNT (bb-succs) == 1 BARRIER_P (NEXT_INSN (head))); else if (any_condjump_p (head)) - gcc_assert (/* Usual case. */ -(EDGE_COUNT (bb-succs) 1 - !BARRIER_P (NEXT_INSN (head))) -/* Or jump to the next instruction. */ -|| (EDGE_COUNT (bb-succs) == 1 - (BB_HEAD (EDGE_I (bb-succs, 0)-dest) -== JUMP_LABEL (head; + gcc_assert (/* Weird case, like jump to the next insn + or use of __builtin_unreachable (). */ +EDGE_COUNT (bb-succs) == 1 +/* Normal case, one path falls through. */ +|| !BARRIER_P (NEXT_INSN (head))); + } if (BB_END (bb) == head) {
Re: rtl_verify_flow_info fix
On Tue, Sep 06, 2011 at 11:05:16AM +0200, Tom de Vries wrote: bootstrapped and regtested on x86_64, build and regtested on arm. OK for trunk? Yes. 2011-09-06 Tom de Vries t...@codesourcery.com * recog.c (asm_labels_ok): New function. (check_asm_operands): Use asm_labels_ok. Jakub
[Ada] Inlining calls that return unconstrained arrays
This patch fixes a crash in the compiler when inlining a function call that returns an unconstrained array in the context of an assignment created for an extended return statement. The patch also optimizes the case where the target of the assignment is a selected component, and avoid the use of an intermediate temporary in the expansion. The following must compile quietly: with Types; use Types; package body My_Simulink_Model is procedure Compute (Input : Input_Type; Output : out Output_Type) is begin Output.O := Sum (Input.M1, Input.M2); end Compute; procedure Compute_Ext_Return (Input : Input_Type; Output : out Output_Type) is begin Output.O := Sum_Ext_Return (Input.M1, Input.M2); end Compute_Ext_Return; procedure Compute_Inline (Input : Input_Type; Output : out Output_Type) is begin for I in Output.O'Range (1) loop for J in Output.O'Range (2) loop Output.O (I, J) := Input.M1 (I, J) + Input.M2 (I, J); end loop; end loop; end Compute_Inline; end My_Simulink_Model; --- with Types; package My_Simulink_Model is subtype Range_1 is Integer range 1 .. 2; subtype Range_2 is Integer range 1 .. 3; subtype My_Matrix is Types.Integer_Matrix_2D (Range_1, Range_2); type Input_Type is record M1 : My_Matrix; M2 : My_Matrix; end record; type Output_Type is record O : My_Matrix; end record; procedure Compute (Input : Input_Type; Output : out Output_Type); procedure Compute_Ext_Return (Input : Input_Type; Output : out Output_Type); procedure Compute_Inline (Input : Input_Type; Output : out Output_Type); end My_Simulink_Model; --- package Types is type Integer_Matrix_2D is array (Integer range , Integer range ) of Integer; function Sum (Left, Right : Integer_Matrix_2D) return Integer_Matrix_2D; pragma Precondition (Left'Length (1) = Right'Length (1) and Left'Length (2) = Right'Length (2)); pragma Inline_Always (Sum); function Sum_Ext_Return (Left, Right : Integer_Matrix_2D) return Integer_Matrix_2D; pragma Precondition (Left'Length (1) = Right'Length (1) and Left'Length (2) = Right'Length (2)); pragma Inline_Always (Sum_Ext_Return); end Types; --- package body Types is function Sum (Left, Right : Integer_Matrix_2D) return Integer_Matrix_2D is Res : Integer_Matrix_2D (Left'Range (1), Left'Range (2)); begin for I in Res'Range (1) loop for J in Res'Range (2) loop Res (I, J) := Left (I, J) + Right (I, J); end loop; end loop; return Res; end Sum; function Sum_Ext_Return (Left, Right : Integer_Matrix_2D) return Integer_Matrix_2D is begin return Res : Integer_Matrix_2D (Left'Range (1), Left'Range (2)) do for I in Res'Range (1) loop for J in Res'Range (2) loop Res (I, J) := Left (I, J) + Right (I, J); end loop; end loop; end return; end Sum_Ext_Return; end Types; Tested on x86_64-pc-linux-gnu, committed on trunk 2011-09-06 Ed Schonberg schonb...@adacore.com * exp_ch6.adb (Expand_Inlined_Call): Handle properly the case where the return type is an unconstrained array and the context is an assignment. Optimize the case when the target of the assignment is a selected component. Index: exp_ch6.adb === --- exp_ch6.adb (revision 178572) +++ exp_ch6.adb (working copy) @@ -4031,12 +4031,20 @@ Insert_After (Parent (Entity (N)), Blk); + -- If the context is an assignment, and the left-hand side is + -- free of side-effects, the replacement is also safe. + -- Can this be generalized further??? + elsif Nkind (Parent (N)) = N_Assignment_Statement and then (Is_Entity_Name (Name (Parent (N))) or else (Nkind (Name (Parent (N))) = N_Explicit_Dereference -and then Is_Entity_Name (Prefix (Name (Parent (N)) + and then Is_Entity_Name (Prefix (Name (Parent (N) + + or else + (Nkind (Name (Parent (N))) = N_Selected_Component + and then Is_Entity_Name (Prefix (Name (Parent (N)) then -- Replace assignment with the block @@ -4201,14 +4209,19 @@ Set_Declarations (Blk, New_List); end if; - -- For the unconstrained case, capture the name of the local - -- variable that holds the result. This must be the first declaration + -- For the unconstrained case, capture the name of the local variable + --
[Ada] Use oscons circuitry to define pthread types on GNU/Linux
Simplify s-linux*.ads files by using s-oscons-tmplt.c to generate proper definition of pthread_mutex_t. Tested on x86_64-pc-linux-gnu, committed on trunk 2011-09-06 Pascal Obry o...@adacore.com * s-linux.ads, s-linux-alpha.ads, s-linux-hppa.ads, s-linux-mipsel.ads, s-linux-sparc.ads: Remove hard coded and now wrong definitions. * s-oscons-tmplt.c: Add support for generating pthread related types size on GNU/Linux as done for Darwin. * s-osinte-linux.ads: Use s-oscons to define the pthread types. Index: s-osinte-linux.ads === --- s-osinte-linux.ads (revision 178565) +++ s-osinte-linux.ads (working copy) @@ -41,6 +41,7 @@ with Ada.Unchecked_Conversion; with Interfaces.C; with System.Linux; +with System.OS_Constants; package System.OS_Interface is pragma Preelaborate; @@ -557,35 +558,31 @@ end record; pragma Convention (C, timespec); - type pthread_attr_t is record - detachstate : int; - schedpolicy : int; - schedparam: struct_sched_param; - inheritsched : int; - scope : int; - guardsize : size_t; - stackaddr_set : int; - stackaddr : System.Address; - stacksize : size_t; - end record; + type unsigned_long_long_t is mod 2 ** 64; + -- Local type only used to get it's 'Alignment below + + type pthread_attr_t is + array (1 .. OS_Constants.PTHREAD_ATTR_SIZE) of unsigned_char; pragma Convention (C, pthread_attr_t); + for pthread_attr_t'Alignment use Interfaces.C.unsigned_long'Alignment; - type pthread_condattr_t is record - dummy : int; - end record; + type pthread_condattr_t is + array (1 .. OS_Constants.PTHREAD_CONDATTR_SIZE) of unsigned_char; pragma Convention (C, pthread_condattr_t); + for pthread_condattr_t'Alignment use Interfaces.C.int'Alignment; - type pthread_mutexattr_t is record - mutexkind : int; - end record; + type pthread_mutexattr_t is + array (1 .. OS_Constants.PTHREAD_MUTEXATTR_SIZE) of unsigned_char; pragma Convention (C, pthread_mutexattr_t); + for pthread_mutexattr_t'Alignment use Interfaces.C.int'Alignment; - type pthread_mutex_t is new System.Linux.pthread_mutex_t; + type pthread_mutex_t is + array (1 .. OS_Constants.PTHREAD_MUTEX_SIZE) of unsigned_char; + pragma Convention (C, pthread_mutex_t); + for pthread_mutex_t'Alignment use Interfaces.C.unsigned_long'Alignment; - type unsigned_long_long_t is mod 2 ** 64; - -- Local type only used to get it's 'Alignment below - - type pthread_cond_t is array (0 .. 47) of unsigned_char; + type pthread_cond_t is + array (1 .. OS_Constants.PTHREAD_COND_SIZE) of unsigned_char; pragma Convention (C, pthread_cond_t); for pthread_cond_t'Alignment use unsigned_long_long_t'Alignment; Index: s-linux.ads === --- s-linux.ads (revision 178565) +++ s-linux.ads (working copy) @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2008-2009, Free Software Foundation, Inc. -- +-- Copyright (C) 2008-2011, Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -101,19 +101,4 @@ SA_SIGINFO : constant := 16#04#; SA_ONSTACK : constant := 16#0800#; - type struct_pthread_fast_lock is record - status : Long_Integer; - spinlock : Integer; - end record; - pragma Convention (C, struct_pthread_fast_lock); - - type pthread_mutex_t is record - m_reserved : Integer; - m_count: Integer; - m_owner: System.Address; - m_kind : Integer; - m_lock : struct_pthread_fast_lock; - end record; - pragma Convention (C, pthread_mutex_t); - end System.Linux; Index: s-linux-alpha.ads === --- s-linux-alpha.ads (revision 178565) +++ s-linux-alpha.ads (working copy) @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2009, Free Software Foundation, Inc. -- +-- Copyright (C) 2009-2011, Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it
[Ada] Add support to load references of imported entities
This patch adds the support needed to load references of entities imported from other languages. This functionality is required by tools processing ALI files (for example GPS). Tested on x86_64-pc-linux-gnu, committed on trunk 2011-09-06 Javier Miranda mira...@adacore.com * ali.adb (Scan_ALI): Add missing support to load references of entities imported from other languages. * ali.ads (Xref_Record): Adding new fields to store the language and name of an imported entity. * lib-xref.adb (Output_Import_Export_Info): Fix typo in comment. Index: ali.adb === --- ali.adb (revision 178565) +++ ali.adb (working copy) @@ -504,6 +504,10 @@ or else Nextc = '' or else Nextc = '' or else Nextc = '='; + -- Terminate on comma + + exit when Nextc = ','; + -- Terminate if left bracket not part of wide char sequence -- Note that we only recognize brackets notation so far ??? @@ -2389,12 +2393,21 @@ -- Imported entities reference as in: --494bc,__gnat_copy_attribs25 --- ??? Simply skipped for now if Nextc = '' then - while Getc /= '' loop - null; - end loop; + Skipc; + XR.Imported_Lang := Get_Name; + + pragma Assert (Nextc = ','); + Skipc; + + XR.Imported_Name := Get_Name; + + pragma Assert (Nextc = ''); + Skipc; +else + XR.Imported_Lang := No_Name; + XR.Imported_Name := No_Name; end if; XR.Col := Get_Nat; Index: ali.ads === --- ali.ads (revision 178565) +++ ali.ads (working copy) @@ -975,6 +975,10 @@ -- ref1 is a reference to an entity that was instantied at ref2. -- ref2 itself is also the result of an instantiation, that took -- place at ref3 + + Imported_Lang : Name_Id := No_Name; + Imported_Name : Name_Id := No_Name; + -- Language and name of imported entity reference end record; package Xref is new Table.Table ( Index: lib-xref.adb === --- lib-xref.adb(revision 178565) +++ lib-xref.adb(working copy) @@ -1163,7 +1163,7 @@ procedure Output_Import_Export_Info (Ent : Entity_Id); -- Output language and external name information for an interfaced - -- entity, using the format language, external_name, + -- entity, using the format language, external_name -- Get_Type_Reference --
[Ada] Implementation of Ada 2012 type invariants
The final version of the Ada 2012 RM specifies that a type invariant can be given in the private part of a package, on the completion of a private type declaration. The following must compile quietly: package Inv is type List is private; private type Length_T is new Integer; type Array_T is array (Length_T range ) of Integer; type Array_Ptr_T is access Array_T; type List is record Length : Length_T; Item : Array_Ptr_T; end record with Type_Invariant = List.Item'First = 1 and List.Item'Last = List.Length; end Inv; Tested on x86_64-pc-linux-gnu, committed on trunk 2011-09-06 Ed Schonberg schonb...@adacore.com * sem_prag.adb (Analyze_Pragma, case Type_Invariant): A type invariant is allowed on a full type declaration if it is the completion of a private declarations. * sem_ch13.adb (Analyze_Aspect_Specifications): An invariant aspect is allowed on a full type declaration in the private part of a package. Index: sem_prag.adb === --- sem_prag.adb(revision 178565) +++ sem_prag.adb(working copy) @@ -10088,10 +10088,21 @@ if Typ = Any_Type then return; -elsif not Ekind_In (Typ, E_Private_Type, +-- An invariant must apply to a private type, or appear in the +-- private part of a package spec and apply to a completion. + +elsif Ekind_In (Typ, E_Private_Type, E_Record_Type_With_Private, E_Limited_Private_Type) then + null; + +elsif In_Private_Part (Current_Scope) + and then Has_Private_Declaration (Typ) +then + null; + +else Error_Pragma_Arg (pragma% only allowed for private type, Arg1); end if; Index: sem_ch13.adb === --- sem_ch13.adb(revision 178565) +++ sem_ch13.adb(working copy) @@ -1289,11 +1289,22 @@ when Aspect_Invariant | Aspect_Type_Invariant = - -- Check placement legality + -- Check placement legality: An invariant must apply to a + -- private type, or appear in the private part of a spec. + -- Analysis of the pragma will verify that in the private + -- part it applies to a completion. - if not Nkind_In (N, N_Private_Type_Declaration, + if Nkind_In (N, N_Private_Type_Declaration, N_Private_Extension_Declaration) then + null; + + elsif Nkind (N) = N_Full_Type_Declaration +and then In_Private_Part (Current_Scope) + then + null; + + else Error_Msg_N (invariant aspect must apply to a private type, N); end if;
[rs6000] Fix PR target/50091
Hi, this is a regression present on the mainline/4.6/4.5 branches. I overlooked the -mregnames business when I changed the probe_stack pattern and, while this silently works on most platforms, this breaks on Darwin because of the awkward assembler. Tested on PowerPC/Darwin by Iain and on PowerPC/Linux by me. OK for mainline and the 4.6/4.5 branches? 2011-09-06 Eric Botcazou ebotca...@adacore.com Iain Sandoe develo...@sandoe-acoustics.co.uk PR target/50091 * config/rs6000/rs6000.md (probe_stack): Use explicit operand. * config/rs6000/rs6000.c (output_probe_stack_range): Likewise. -- Eric Botcazou Index: config/rs6000/rs6000.c === --- config/rs6000/rs6000.c (revision 178488) +++ config/rs6000/rs6000.c (working copy) @@ -19303,7 +19303,8 @@ output_probe_stack_range (rtx reg1, rtx output_asm_insn ({cal %0,%1(%0)|addi %0,%0,%1}, xops); /* Probe at TEST_ADDR and branch. */ - output_asm_insn ({st|stw} 0,0(%0), xops); + xops[1] = gen_rtx_REG (Pmode, 0); + output_asm_insn ({st|stw} %1,0(%0), xops); fprintf (asm_out_file, \tb ); assemble_name_raw (asm_out_file, loop_lab); fputc ('\n', asm_out_file); Index: config/rs6000/rs6000.md === --- config/rs6000/rs6000.md (revision 178488) +++ config/rs6000/rs6000.md (working copy) @@ -13049,7 +13049,11 @@ (define_insn probe_stack [(set (match_operand 0 memory_operand =m) (unspec [(const_int 0)] UNSPEC_PROBE_STACK))] - {st%U0%X0|stw%U0%X0} 0,%0 + * +{ + operands[1] = gen_rtx_REG (Pmode, 0); + return \{st%U0%X0|stw%U0%X0} %1,%0\; +} [(set_attr type store) (set_attr length 4)])
[v3] libstdc++/50257
Hi, tested x86_64-linux, committed to mainline. See audit trail for details... Thanks, Paolo. / 2011-09-06 Paolo Carlini paolo.carl...@oracle.com PR libstdc++/50257 * include/bits/hashtable_policy.h (_Prime_rehash_policy:: _M_next_bkt): Optimize for small argument. Index: include/bits/hashtable_policy.h === --- include/bits/hashtable_policy.h (revision 178574) +++ include/bits/hashtable_policy.h (working copy) @@ -427,8 +427,15 @@ _Prime_rehash_policy:: _M_next_bkt(std::size_t __n) const { -const unsigned long __p = *std::lower_bound(__prime_list, __prime_list - + _S_n_primes, __n); +// Optimize lookups involving the first elements of __prime_list. +// (useful to speed-up, eg, constructors) +static const unsigned char __fastbkt[12] + = { 2, 2, 2, 3, 5, 5, 7, 7, 11, 11, 11, 11 }; + +const unsigned long __p + = __n = 11 ? __fastbkt[__n] + : *std::lower_bound(__prime_list + 5, + __prime_list + _S_n_primes, __n); _M_next_resize = static_caststd::size_t(__builtin_floor(__p * _M_max_load_factor)); return __p;
[PATCH] SCCVN TLC
Some cleanups before I touch this code. Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk. Richard. 2011-09-06 Richard Guenther rguent...@suse.de * tree-ssa-sccvn.c (visit_use): CSE stmt pieces and simplify matching. Index: gcc/tree-ssa-sccvn.c === --- gcc/tree-ssa-sccvn.c(revision 178570) +++ gcc/tree-ssa-sccvn.c(working copy) @@ -3043,16 +3043,17 @@ visit_use (tree use) changed = defs_to_varying (stmt); else if (is_gimple_assign (stmt)) { + enum tree_code code = gimple_assign_rhs_code (stmt); tree lhs = gimple_assign_lhs (stmt); + tree rhs1 = gimple_assign_rhs1 (stmt); tree simplified; /* Shortcut for copies. Simplifying copies is pointless, since we copy the expression and value they represent. */ - if (gimple_assign_copy_p (stmt) - TREE_CODE (gimple_assign_rhs1 (stmt)) == SSA_NAME + if (code == SSA_NAME TREE_CODE (lhs) == SSA_NAME) { - changed = visit_copy (lhs, gimple_assign_rhs1 (stmt)); + changed = visit_copy (lhs, rhs1); goto done; } simplified = try_to_simplify (stmt); @@ -3119,24 +3120,22 @@ visit_use (tree use) /* We can substitute SSA_NAMEs that are live over abnormal edges with their constant value. */ !(gimple_assign_copy_p (stmt) -is_gimple_min_invariant (gimple_assign_rhs1 (stmt))) +is_gimple_min_invariant (rhs1)) !(simplified is_gimple_min_invariant (simplified)) SSA_NAME_OCCURS_IN_ABNORMAL_PHI (lhs)) /* Stores or copies from SSA_NAMEs that are live over abnormal edges are a problem. */ - || (gimple_assign_single_p (stmt) - TREE_CODE (gimple_assign_rhs1 (stmt)) == SSA_NAME - SSA_NAME_OCCURS_IN_ABNORMAL_PHI (gimple_assign_rhs1 (stmt + || (code == SSA_NAME + SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rhs1))) changed = defs_to_varying (stmt); - else if (REFERENCE_CLASS_P (lhs) || DECL_P (lhs)) - { - changed = visit_reference_op_store (lhs, gimple_assign_rhs1 (stmt), stmt); - } + else if (REFERENCE_CLASS_P (lhs) + || DECL_P (lhs)) + changed = visit_reference_op_store (lhs, rhs1, stmt); else if (TREE_CODE (lhs) == SSA_NAME) { if ((gimple_assign_copy_p (stmt) - is_gimple_min_invariant (gimple_assign_rhs1 (stmt))) + is_gimple_min_invariant (rhs1)) || (simplified is_gimple_min_invariant (simplified))) { @@ -3144,11 +3143,11 @@ visit_use (tree use) if (simplified) changed = set_ssa_val_to (lhs, simplified); else - changed = set_ssa_val_to (lhs, gimple_assign_rhs1 (stmt)); + changed = set_ssa_val_to (lhs, rhs1); } else { - switch (get_gimple_rhs_class (gimple_assign_rhs_code (stmt))) + switch (get_gimple_rhs_class (code)) { case GIMPLE_UNARY_RHS: case GIMPLE_BINARY_RHS: @@ -3156,25 +3155,24 @@ visit_use (tree use) changed = visit_nary_op (lhs, stmt); break; case GIMPLE_SINGLE_RHS: - switch (TREE_CODE_CLASS (gimple_assign_rhs_code (stmt))) + switch (TREE_CODE_CLASS (code)) { case tcc_reference: /* VOP-less references can go through unary case. */ - if ((gimple_assign_rhs_code (stmt) == REALPART_EXPR - || gimple_assign_rhs_code (stmt) == IMAGPART_EXPR - || gimple_assign_rhs_code (stmt) == VIEW_CONVERT_EXPR) - TREE_CODE (TREE_OPERAND (gimple_assign_rhs1 (stmt), 0)) == SSA_NAME) + if ((code == REALPART_EXPR + || code == IMAGPART_EXPR + || code == VIEW_CONVERT_EXPR) + TREE_CODE (TREE_OPERAND (rhs1, 0)) == SSA_NAME) { changed = visit_nary_op (lhs, stmt); break; } /* Fallthrough. */ case tcc_declaration: - changed = visit_reference_op_load - (lhs, gimple_assign_rhs1 (stmt), stmt); +
[Ada] Optimize out index check for dynamic arrays in indirect case
This small change brings the indirect case on par with the direct case when it comes to eliminating an index check for dynamic arrays. No index check will be generated for the following procedure in default mode: type Darray is array (1 .. Q.N) of Long_Float; procedure Add (X, Y : access Darray; R : access Darray) is begin for I in Darray'Range loop R(I) := X(I) + Y(I); end loop; end; Tested on x86_64-pc-linux-gnu, committed on trunk 2011-09-06 Eric Botcazou ebotca...@adacore.com * checks.adb (Apply_Scalar_Range_Check): Deal with access type prefix. Index: checks.adb === --- checks.adb (revision 178565) +++ checks.adb (working copy) @@ -1877,6 +1877,9 @@ if Is_Subscr_Ref then Arr := Prefix (Parnt); Arr_Typ := Get_Actual_Subtype_If_Available (Arr); + if Is_Access_Type (Arr_Typ) then +Arr_Typ := Directly_Designated_Type (Arr_Typ); + end if; end if; if not Do_Range_Check (Expr) then
[Ada] Automatic deallocation of task upon termination
This change implements a new feature in the tasking runtime library: if Unchecked_Deallocation is called on a non-terminated task (which was previously a no-op), the task is now marked to be freed automatically when it terminates. The following test case demonstrates the feature: $ gnatmake -q -z free_nonterm_task When executing free_nonterm_task under valgrind, no memory leak corresponding to the creation of task T (in System.Tasking.Stages.Create_Task) shall be reported. package Free_Nonterm_Task is pragma Elaborate_Body; end Free_Nonterm_Task; with Ada.Unchecked_Deallocation; with Ada.Text_IO; use Ada.Text_IO; package body Free_Nonterm_Task is type T; type A is access T; task type T is entry Term (Self : in out A); end T; procedure Free is new Ada.Unchecked_Deallocation (T, A); task body T is begin Put_Line (T: enter); accept Term (Self : in out A) do Free (Self); end Term; Put_Line (T: exit); end T; My_Task : A; begin Put_Line (Create task); My_Task := new T; Put_Line (Call Term); My_Task.Term (My_Task); end Free_Nonterm_Task; Tested on x86_64-pc-linux-gnu, committed on trunk 2011-09-06 Thomas Quinot qui...@adacore.com * s-tassta.adb, s-taskin.ads (Free_Task): If the task is not terminated, mark it for deallocation upon termination. (Terminate_Task): Call Free_Task again if the task is marked for automatic deallocation upon termination. Index: s-tassta.adb === --- s-tassta.adb(revision 178565) +++ s-tassta.adb(working copy) @@ -969,12 +969,11 @@ Free_Entry_Names (T); System.Task_Primitives.Operations.Finalize_TCB (T); - -- If the task is not terminated, then we simply ignore the call. This - -- happens when a user program attempts an unchecked deallocation on - -- a non-terminated task. + else + -- If the task is not terminated, then mark the task as to be freed + -- upon termination. - else - null; + T.Free_On_Termination := True; end if; end Free_Task; @@ -1429,6 +1428,7 @@ procedure Terminate_Task (Self_ID : Task_Id) is Environment_Task : constant Task_Id := STPO.Environment_Task; Master_of_Task : Integer; + Deallocate : Boolean; begin Debug.Task_Termination_Hook; @@ -1474,6 +1474,7 @@ Stack_Guard (Self_ID, False); Utilities.Make_Passive (Self_ID, Task_Completed = True); + Deallocate := Self_ID.Free_On_Termination; if Single_Lock then Unlock_RTS; @@ -1485,8 +1486,13 @@ Initialization.Final_Task_Unlock (Self_ID); -- WARNING: past this point, this thread must assume that the ATCB has - -- been deallocated. It should not be accessed again. + -- been deallocated, and can't access it anymore (which is why we have + -- saved the Free_On_Termination flag in a temporary variable). + if Deallocate then + Free_Task (Self_ID); + end if; + if Master_of_Task 0 then STPO.Exit_Task; end if; Index: s-taskin.ads === --- s-taskin.ads(revision 178565) +++ s-taskin.ads(working copy) @@ -1150,6 +1150,12 @@ -- -- Protection: Self.L. Once a task has set Self.Stage to Completing, it -- has exclusive access to this field. + + Free_On_Termination : Boolean := False; + -- Deallocate the ATCB when the task terminates. This flag is normally + -- False, and is set True when Unchecked_Deallocation is called on a + -- non-terminated task so that the associated storage is automatically + -- reclaimed when the task terminates. end record;
[Ada] Erroneous memory access when destroying a task's own ATCB
This change fixes a defect in the tasking runtime library whereby a task freeing its own Ada Task Control Block would reference it after it had been deallocated, because the deallocation is made with abortion deferred, and Abort_Undefer needs access to the ATCB. In particular this happens when a foreign thread unregisters using GNAT.Threads.Unregister_Thread. Tested on x86_64-pc-linux-gnu, committed on trunk 2011-09-06 Thomas Quinot qui...@adacore.com * s-taprop-vxworks.adb, s-taprop-tru64.adb, s-taprop-vms.adb, s-tpoaal.adb, s-taprop-mingw.adb, s-taprop-linux.adb, s-taprop-solaris.adb, s-taprop-irix.adb, s-taprop.ads, s-taprop-hpux-dce.adb, s-taprop-dummy.adb, s-taprop-posix.adb (ATCB_Allocation): New subpackage of System.Tasking.Primitive_Operations, shared across all targets with full tasking runtime. (ATCB_Allocation.New_ATCB): Moved there (from target specific s-taprop bodies). (ATCB_Allocation.Free_ATCB): New subprogram. Deallocate an ATCB, taking care of establishing a local temporary ATCB if the one being deallocated is Self, to avoid a reference to the freed ATCB in Abort_Undefer. Index: s-taprop-vxworks.adb === --- s-taprop-vxworks.adb(revision 178565) +++ s-taprop-vxworks.adb(working copy) @@ -39,7 +39,6 @@ -- operations. It causes infinite loops and other problems. with Ada.Unchecked_Conversion; -with Ada.Unchecked_Deallocation; with Interfaces.C; @@ -140,6 +139,13 @@ package body Specific is separate; -- The body of this package is target specific + -- + -- ATCB allocation/deallocation -- + -- + + package body ATCB_Allocation is separate; + -- The body of this package is shared across several targets + - -- Support for foreign threads -- - @@ -828,15 +834,6 @@ end if; end Enter_Task; - -- - -- New_ATCB -- - -- - - function New_ATCB (Entry_Num : Task_Entry_Index) return Task_Id is - begin - return new Ada_Task_Control_Block (Entry_Num); - end New_ATCB; - --- -- Is_Valid_Task -- --- @@ -986,13 +983,8 @@ -- procedure Finalize_TCB (T : Task_Id) is - Result : int; - Tmp : Task_Id := T; - Is_Self : constant Boolean := (T = Self); + Result : int; - procedure Free is new -Ada.Unchecked_Deallocation (Ada_Task_Control_Block, Task_Id); - begin if not Single_Lock then Result := semDelete (T.Common.LL.L.Mutex); @@ -1008,11 +1000,7 @@ Known_Tasks (T.Known_Tasks_Index) := null; end if; - Free (Tmp); - - if Is_Self then - Specific.Delete; - end if; + ATCB_Allocation.Free_ATCB (T); end Finalize_TCB; --- Index: s-taprop-tru64.adb === --- s-taprop-tru64.adb (revision 178565) +++ s-taprop-tru64.adb (working copy) @@ -38,8 +38,6 @@ -- Turn off polling, we do not want ATC polling to take place during tasking -- operations. It causes infinite loops and other problems. -with Ada.Unchecked_Deallocation; - with Interfaces; with Interfaces.C; @@ -127,6 +125,13 @@ package body Specific is separate; -- The body of this package is target specific + -- + -- ATCB allocation/deallocation -- + -- + + package body ATCB_Allocation is separate; + -- The body of this package is shared across several targets + - -- Support for foreign threads -- - @@ -695,15 +700,6 @@ Specific.Set (Self_ID); end Enter_Task; - -- - -- New_ATCB -- - -- - - function New_ATCB (Entry_Num : Task_Entry_Index) return Task_Id is - begin - return new Ada_Task_Control_Block (Entry_Num); - end New_ATCB; - --- -- Is_Valid_Task -- --- @@ -930,13 +926,8 @@ -- procedure Finalize_TCB (T : Task_Id) is - Result : Interfaces.C.int; - Tmp : Task_Id := T; - Is_Self : constant Boolean := T = Self; + Result : Interfaces.C.int; - procedure Free is new -Ada.Unchecked_Deallocation (Ada_Task_Control_Block, Task_Id); - begin if not Single_Lock then Result := pthread_mutex_destroy (T.Common.LL.L'Access); @@ -950,11 +941,7 @@ Known_Tasks (T.Known_Tasks_Index) := null; end if; - Free (Tmp); - - if Is_Self then - Specific.Set (null); - end if; + ATCB_Allocation.Free_ATCB (T); end Finalize_TCB;
Re: Rename across basic block boundaries
Bernd Schmidt ber...@codesourcery.com writes: On 09/01/11 16:16, Richard Sandiford wrote: Bernd Schmidt ber...@codesourcery.com writes: On 08/26/11 14:57, Richard Sandiford wrote: Wouldn't a reverse post-order (inverted_post_order_compute) allow even more pre-opening (as well as being less code)? I can't really tell from the comments what that function is supposed to produce. Sorry, I thought it was supposed to produce a reverse postorder, but... I've made a change to use it to order the bbs, but that made rr visit basic blocks without seeing any of their predecessors first, ...I guess not. :-) pre_and_rev_post_order_compute should though. Could you try that instead? That seems to work for me. Looks good to me. Maybe here: + /* The order in which we visit blocks ensures that whenever + possible, we only process a block after at least one of its + predecessors, which provides a seeding effect to make the logic + in set_incoming_from_chain and init_rename_info useful. */ + + for (i = 0; i n_bbs; i++) +{ + basic_block bb1 = BASIC_BLOCK (inverse_postorder[i]); + struct bb_rename_info *this_info = rename_info + i; [...] + if (bb1-aux == NULL) + continue; it would be better to use: this_info = (struct bb_rename_info *) bb1-aux; if (this_info == NULL) continue; so that we don't care which order the rename_info array is. You could then keep the original form of the first loop: /* Gather some information about the blocks in this function. */ rename_info = XCNEWVEC (struct bb_rename_info, n_basic_blocks); ri_index = 0; FOR_EACH_BB (bb) { struct bb_rename_info *ri = rename_info + ri_index; ri-bb = bb; ri-n_preds = EDGE_COUNT (bb-preds); bb-aux = ri; ri_index++; } OK with me whichever. Richard
[Ada] Implement attribute Descriptor_Size
This patch provides support for attribute Descriptor_Size. Currently the attribute is applicable only to unconstrained arrays types and returns the size of the dope vector plus any additional padding due to alignment issues in bits. Tested on x86_64-pc-linux-gnu, committed on trunk 2011-09-06 Hristian Kirtchev kirtc...@adacore.com * gcc-interface/trans.c (Attribute_to_gnu): New case for attribute Descriptor_Size. * exp_attr.adb (Expand_N_Attribute_Reference): Add processing for attribute Descriptor_Size. * exp_ch7.adb (Double_Size_Of): Removed. (Make_Finalize_Address_Stmts): Remove the code which generates an expression to calculate the dope vector of an unconstrained array. Instead use attribute Descriptor_Size and leave the calculation to the back end. (Nearest_Multiple_Rounded_Up): Removed. (Size_Of): Removed. * sem_attr.adb (Analyze_Attribute): Add processing for attribute Descriptor_Size. Currently the attribute is applicable only to unconstrained arrays. (Eval_Attribute): Add processing for attribute Descriptor_Size. * snames.ads-tmpl: Add a predefined name and an Attribute_Id for Descriptor_Size. Index: exp_ch7.adb === --- exp_ch7.adb (revision 178572) +++ exp_ch7.adb (working copy) @@ -7023,99 +7023,6 @@ Desg_Typ : Entity_Id; Obj_Expr : Node_Id; - function Double_Size_Of (Typ : Entity_Id) return Node_Id; - -- Subsidiary routine, produces an expression which calculates double - -- the size of Typ as the nearest multiple of its alignment rounded up. - - function Nearest_Multiple_Rounded_Up -(Size_Expr : Node_Id; - Typ : Entity_Id) return Node_Id; - -- Subsidiary routine, generate the following expression: - --((Size_Expr + Typ'Alignment - 1) / Typ'Alignment) * Typ'Alignment - - function Size_Of (Typ : Entity_Id) return Node_Id; - -- Subsidiary routine, produces an expression which calculates the size - -- of Typ as the nearest multiple of its alignment rounded up. - - - -- Double_Size_Of -- - - - function Double_Size_Of (Typ : Entity_Id) return Node_Id is - begin - return - Make_Op_Multiply (Loc, - Left_Opnd = Make_Integer_Literal (Loc, 2), - Right_Opnd = Size_Of (Typ)); - end Double_Size_Of; - - - - -- Nearest_Multiple_Rounded_Up -- - - - - function Nearest_Multiple_Rounded_Up -(Size_Expr : Node_Id; - Typ : Entity_Id) return Node_Id - is - function Alignment_Of (Typ : Entity_Id) return Node_Id; - -- Subsidiary routine, generate the following attribute reference: - --Typ'Alignment - - -- - -- Alignment_Of -- - -- - - function Alignment_Of (Typ : Entity_Id) return Node_Id is - begin -return - Make_Attribute_Reference (Loc, -Prefix = New_Reference_To (Typ, Loc), -Attribute_Name = Name_Alignment); - end Alignment_Of; - - -- Start of processing for Nearest_Multiple_Rounded_Up - - begin - -- Generate: - --((Size_Expr + Typ'Alignment - 1) / Typ'Alignment) * - -- Typ'Alignment - - return - Make_Op_Multiply (Loc, - Left_Opnd = - Make_Op_Divide (Loc, - Left_Opnd = - Make_Op_Add (Loc, - Left_Opnd = Size_Expr, - Right_Opnd = - Make_Op_Subtract (Loc, - Left_Opnd = Alignment_Of (Typ), - Right_Opnd = Make_Integer_Literal (Loc, 1))), - Right_Opnd = Alignment_Of (Typ)), - Right_Opnd = Alignment_Of (Typ)); - end Nearest_Multiple_Rounded_Up; - - - - -- Size_Of -- - - - - function Size_Of (Typ : Entity_Id) return Node_Id is - begin - return - Nearest_Multiple_Rounded_Up - (Size_Expr = -Make_Op_Divide (Loc, - Left_Opnd = -Make_Attribute_Reference (Loc, - Prefix = New_Reference_To (Typ, Loc), - Attribute_Name = Name_Size), - Right_Opnd = -Make_Integer_Literal (Loc, System_Storage_Unit)), - Typ = Typ); - end Size_Of; - - -- Start of processing for Make_Finalize_Address_Stmts - begin if Is_Array_Type (Typ) then if Is_Constrained (First_Subtype (Typ)) then @@ -7190,11
[Ada] Speed up build of gnatools
Now that gnatmake supports -j0, it's possible to speed up the build of gnattools during GNAT build by using gnatmake -j0 instead of gnatmake. This is useful since gnattools is the only target which isn't parallelized in the Makefile before this change. Tested on x86_64-linux-gnu, committed on trunk. 2011-09-06 Arnaud Charlet char...@adacore.com * gcc-interface/Makefile.in (common-tools, gnatmake-re, gnatlink-re): Speed up by using -j0. -- Index: gcc-interface/Makefile.in === --- gcc-interface/Makefile.in (revision 178566) +++ gcc-interface/Makefile.in (working copy) @@ -2336,7 +2336,7 @@ endif common-tools: - $(GNATMAKE) -c -b $(ADA_INCLUDES) \ + $(GNATMAKE) -j0 -c -b $(ADA_INCLUDES) \ --GNATBIND=$(GNATBIND) --GCC=$(CC) $(ALL_ADAFLAGS) \ gnatchop gnatcmd gnatkr gnatls gnatprep gnatxref gnatfind gnatname \ gnatclean -bargs $(ADA_INCLUDES) $(GNATBIND_FLAGS) @@ -2375,16 +2375,18 @@ $(GNATLINK) -v vxaddr2line -o $@ --GCC=$(GCC_LINK) targext.o $(CLIB) gnatmake-re: link.o targext.o - $(GNATMAKE) $(ADA_INCLUDES) -u sdefault --GCC=$(CC) $(MOST_ADA_FLAGS) - $(GNATMAKE) -c $(ADA_INCLUDES) gnatmake --GCC=$(CC) $(ALL_ADAFLAGS) + $(GNATMAKE) -j0 $(ADA_INCLUDES) -u sdefault --GCC=$(CC) $(MOST_ADA_FLAGS) + $(GNATMAKE) -j0 -c $(ADA_INCLUDES) gnatmake --GCC=$(CC) $(ALL_ADAFLAGS) $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatmake $(GNATLINK) -v gnatmake -o ../../gnatmake$(exeext) \ --GCC=$(GCC_LINK) $(TOOLS_LIBS) # Note the use of the mv command in order to allow gnatlink to be linked with # with the former version of gnatlink itself which cannot override itself. -gnatlink-re: link.o targext.o - $(GNATMAKE) -c $(ADA_INCLUDES) gnatlink --GCC=$(CC) $(ALL_ADAFLAGS) +# gnatlink-re cannot be run at the same time as gnatmake-re, hence the +# dependency +gnatlink-re: link.o targext.o gnatmake-re + $(GNATMAKE) -j0 -c $(ADA_INCLUDES) gnatlink --GCC=$(CC) $(ALL_ADAFLAGS) $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatlink $(GNATLINK) -v gnatlink -o ../../gnatlinknew$(exeext) \ --GCC=$(GCC_LINK) $(TOOLS_LIBS)
[Ada] Improved warnings on useless formals in subprograms
This patch allows a better detection of unused formals in subprogram bodies. Previously the use of a formal as the selector in a parameter association was treated as a proper reference, thus missing otherwise unused entities. The following command : gcc -c -gnatwa k.adb must yield: k.adb:2:22: warning: formal parameter X is not referenced --- procedure K is procedure Suspect (X : Integer) is begin for I in 1 .. 10 loop null; end loop; end; begin Suspect (X = 15); Suspect (X = 15); Suspect (X = 15); end; Tested on x86_64-pc-linux-gnu, committed on trunk 2011-09-06 Ed Schonberg schonb...@adacore.com * lib-xref.adb (OK_To_Set_Referenced): A reference to a formal in a parameter association must not set the Referenced flag on the formal. * prj-nmsc.adb (Check_File_Naming_Schemes): Remove useless formal Index: prj-nmsc.adb === --- prj-nmsc.adb(revision 178585) +++ prj-nmsc.adb(working copy) @@ -376,8 +376,7 @@ -- otherwise only those currently set in the Source_Names hash table. procedure Check_File_Naming_Schemes - (In_Tree : Project_Tree_Ref; - Project : Project_Processing_Data; + (Project : Project_Processing_Data; File_Name : File_Name_Type; Alternate_Languages : out Language_List; Language : out Language_Ptr; @@ -6619,8 +6618,7 @@ --- procedure Check_File_Naming_Schemes - (In_Tree : Project_Tree_Ref; - Project : Project_Processing_Data; + (Project : Project_Processing_Data; File_Name : File_Name_Type; Alternate_Languages : out Language_List; Language : out Language_Ptr; @@ -6923,8 +6921,7 @@ if Check_Name then Check_File_Naming_Schemes - (In_Tree = Data.Tree, -Project = Project, + (Project = Project, File_Name = File_Name, Alternate_Languages = Alternate_Languages, Language = Language, Index: lib-xref.adb === --- lib-xref.adb(revision 178578) +++ lib-xref.adb(working copy) @@ -512,6 +512,16 @@ return False; end if; end if; + +-- A reference to a formal in a named parameter association does +-- not make the formal referenced. Formals that are unused in the +-- subprogram body are properly flagged as such, even if calls +-- elsewhere use named notation. + +elsif Nkind (P) = N_Parameter_Association + and then N = Selector_Name (P) +then + return False; end if; end if;
Re: [Ada] Speed up build of gnatools
Hi Arnaud, Now that gnatmake supports -j0, it's possible to speed up the build of gnattools during GNAT build by using gnatmake -j0 instead of gnatmake. This is useful since gnattools is the only target which isn't parallelized in the Makefile before this change. this means using as many processes as there are CPUs, right? It seems pretty dubious to me to use more processes than the user maybe asked for. For example I have to restrict the number of CPUs used when building GCC to less than I have since otherwise my machine overheats and turns itself off. Is there some way to get at the -j level the user passed to the top-level make and use that? Ciao, Duncan. Tested on x86_64-linux-gnu, committed on trunk. 2011-09-06 Arnaud Charletchar...@adacore.com * gcc-interface/Makefile.in (common-tools, gnatmake-re, gnatlink-re): Speed up by using -j0. -- Index: gcc-interface/Makefile.in === --- gcc-interface/Makefile.in (revision 178566) +++ gcc-interface/Makefile.in (working copy) @@ -2336,7 +2336,7 @@ endif common-tools: - $(GNATMAKE) -c -b $(ADA_INCLUDES) \ + $(GNATMAKE) -j0 -c -b $(ADA_INCLUDES) \ --GNATBIND=$(GNATBIND) --GCC=$(CC) $(ALL_ADAFLAGS) \ gnatchop gnatcmd gnatkr gnatls gnatprep gnatxref gnatfind gnatname \ gnatclean -bargs $(ADA_INCLUDES) $(GNATBIND_FLAGS) @@ -2375,16 +2375,18 @@ $(GNATLINK) -v vxaddr2line -o $@ --GCC=$(GCC_LINK) targext.o $(CLIB) gnatmake-re: link.o targext.o - $(GNATMAKE) $(ADA_INCLUDES) -u sdefault --GCC=$(CC) $(MOST_ADA_FLAGS) - $(GNATMAKE) -c $(ADA_INCLUDES) gnatmake --GCC=$(CC) $(ALL_ADAFLAGS) + $(GNATMAKE) -j0 $(ADA_INCLUDES) -u sdefault --GCC=$(CC) $(MOST_ADA_FLAGS) + $(GNATMAKE) -j0 -c $(ADA_INCLUDES) gnatmake --GCC=$(CC) $(ALL_ADAFLAGS) $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatmake $(GNATLINK) -v gnatmake -o ../../gnatmake$(exeext) \ --GCC=$(GCC_LINK) $(TOOLS_LIBS) # Note the use of the mv command in order to allow gnatlink to be linked with # with the former version of gnatlink itself which cannot override itself. -gnatlink-re: link.o targext.o - $(GNATMAKE) -c $(ADA_INCLUDES) gnatlink --GCC=$(CC) $(ALL_ADAFLAGS) +# gnatlink-re cannot be run at the same time as gnatmake-re, hence the +# dependency +gnatlink-re: link.o targext.o gnatmake-re + $(GNATMAKE) -j0 -c $(ADA_INCLUDES) gnatlink --GCC=$(CC) $(ALL_ADAFLAGS) $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatlink $(GNATLINK) -v gnatlink -o ../../gnatlinknew$(exeext) \ --GCC=$(GCC_LINK) $(TOOLS_LIBS)
Re: [ARM] PR target/49030: ICE in get_arm_condition_code
Chung-Lin Tang clt...@codesourcery.com writes: Hi Richard, this looks very similar to this patch, originally for LP:689887: http://gcc.gnu.org/ml/gcc-patches/2011-01/msg00794.html Apart from your additional handling in the dominance modes cases. Indeed. Sorry about that. It must look odd that I've posted such a similar patch to a bug that I'd also assigned to myself. The reason is that this problem was reported more recently as two other Launchpad bugs, and I only found the old one when submitting the patch (I linked the new bugs to the bugzilla PR, and Launchpad told me about the old one also being linked to that PR). I didn't even notice there was a patch attached. My patch has now survived a Thumb-2 bootstrap, and it sounds like Ramana has also successfully bootstrapped your original patch. Richard
Re: [patch, ARM] Change default vector size to 128 bits - take 3
On 17 August 2011 15:49, Richard Earnshaw rearn...@arm.com wrote: On 16/08/11 10:28, Ira Rosen wrote: Hi, This patch changes the default vector size for auto-vectorization on ARM NEON to 128 bits. This new version is a result of a discussion with Richard and Ramana. wwwdocs changes will follow shortly. Bootstrapped and tested on arm-linux-gnueabi. The testsuite changes were also checked on powerpc64-suse-linux and x86_64-suse-linux. There is one new failure: gcc.c-torture/execute/mode-dependent-address.c fails with -O3 -funroll-loops with this patch or with -mvectorize-with-neon-quad. Ramana has a patch to fix this http://gcc.gnu.org/ml/gcc/2011-08/msg00284.html. I will wait with committing my patch until this issue is resolved. OK for mainline? Thanks, Ira ChangeLog: * config/arm/arm.c (arm_preferred_simd_mode): Check TARGET_NEON_VECTORIZE_DOUBLE instead of TARGET_NEON_VECTORIZE_QUAD. (arm_expand_sync): Likewise. * config/arm/arm.opt (mvectorize-with-neon-quad): Make inverse mask of mvectorize-with-neon-double. Add RejectNegative. (mvectorize-with-neon-double): New. testsuite/ChangeLog: * lib/target-supports.exp (check_effective_target_vect_multiple_sizes): New procedure. (add_options_for_quad_vectors): Replace with ... (add_options_for_double_vectors): ... this. * gfortran.dg/vect/pr19049.f90: Expect more printings on targets that support multiple vector sizes since the vectorizer attempts to vectorize with both vector sizes. * gcc.dg/vect/no-vfa-vect-79.c, gcc.dg/vect/no-vfa-vect-102a.c, gcc.dg/vect/vect-outer-1a.c, gcc.dg/vect/vect-outer-1b.c, gcc.dg/vect/vect-outer-2b.c, gcc.dg/vect/vect-outer-3a.c, gcc.dg/vect/no-vfa-vect-37.c, gcc.dg/vect/vect-outer-3b.c, gcc.dg/vect/no-vfa-vect-101.c, gcc.dg/vect/no-vfa-vect-102.c, gcc.dg/vect/vect-reduc-dot-s8b.c, gcc.dg/vect/vect-outer-1.c, gcc.dg/vect/vect-104.c: Likewise. * gcc.dg/vect/vect-42.c: Run with 64 bit vectors if applicable. * gcc.dg/vect/vect-multitypes-6.c, gcc.dg/vect/vect-52.c, gcc.dg/vect/vect-54.c, gcc.dg/vect/vect-46.c, gcc.dg/vect/vect-48.c, gcc.dg/vect/vect-96.c, gcc.dg/vect/vect-multitypes-3.c, gcc.dg/vect/vect-40.c: Likewise. * gcc.dg/vect/vect-outer-5.c: Remove quad-vectors option as redundant. * gcc.dg/vect/vect-109.c, gcc.dg/vect/vect-peel-1.c, gcc.dg/vect/vect-peel-2.c, gcc.dg/vect/slp-25.c, gcc.dg/vect/vect-multitypes-1.c, gcc.dg/vect/slp-3.c, gcc.dg/vect/no-vfa-pr29145.c, gcc.dg/vect/vect-multitypes-4.c: Likewise. * gcc.dg/vect/vect-peel-4.c: Make ia global. Ok with the following change: static unsigned int arm_autovectorize_vector_sizes (void) { - return TARGET_NEON_VECTORIZE_QUAD ? 16 | 8 : 0; + return TARGET_NEON_VECTORIZE_DOUBLE ? 0 : 16 | 8; } Please put parentheses round the expression to make the precedence explicit. I added parentheses and committed the patch. Thanks, Ira R.
Re: [Ada] Speed up build of gnatools
this means using as many processes as there are CPUs, right? It seems pretty Right, but only for gnattools, which is a relatively short time, and which always occurs at the end of the build (so with nothing else running at the same time). dubious to me to use more processes than the user maybe asked for. For example I have to restrict the number of CPUs used when building GCC to less than I have since otherwise my machine overheats and turns itself off. Is there some way to get at the -j level the user passed to the top-level make and use that? No, I'm not aware of a way to get this information. I'd suggest playing/experimenting with this change for a while. If people (e.g. you) report troubles with this change, reverting it is very easy in any case. I'll be happy to do that. Arno
[c-family] Fix PR middle-end/50266
Hi, this is a regression present on the mainline and 4.6 branch caused by the constructor uniquization patch. The tree_output_constant_def routine rejects offsetof-like computations that can be written in the C family of languages. While the C compiler folds most of them early, it doesn't if an intermediate folding step is required. The proposed fix is to make c_fully_fold also do the offsetof folding. Tested on x86_64-suse-linux, OK for mainline and 4.6 branch? 2011-09-06 Eric Botcazou ebotca...@adacore.com PR middle-end/50266 * c-common.c (c_fully_fold_internal) ADDR_EXPR: Fold offsetof-like computations. 2011-09-06 Eric Botcazou ebotca...@adacore.com * gcc.dg/init-offsetof-1.c: New test. -- Eric Botcazou Index: c-common.c === --- c-common.c (revision 178488) +++ c-common.c (working copy) @@ -1264,7 +1264,18 @@ c_fully_fold_internal (tree expr, bool i STRIP_TYPE_NOPS (op0); if (code != ADDR_EXPR code != REALPART_EXPR code != IMAGPART_EXPR) op0 = decl_constant_value_for_optimization (op0); - if (op0 != orig_op0 || in_init) + if (op0 != orig_op0 + code == ADDR_EXPR + (op1 = get_base_address (op0)) != NULL_TREE + TREE_CODE (op1) == INDIRECT_REF + TREE_CONSTANT (TREE_OPERAND (op1, 0))) + { + tree offset = fold_offsetof (op0, op1); + op1 + = fold_convert_loc (loc, TREE_TYPE (expr), TREE_OPERAND (op1, 0)); + ret = fold_build_pointer_plus_loc (loc, op1, offset); + } + else if (op0 != orig_op0 || in_init) ret = in_init ? fold_build1_initializer_loc (loc, code, TREE_TYPE (expr), op0) : fold_build1_loc (loc, code, TREE_TYPE (expr), op0); /* PR middle-end/50266 */ /* Testcase by b...@arklinux.org */ /* { dg-do compile } */ /* { dg-options -Os } */ struct a { unsigned int a; unsigned int b; }; struct a *const p = (struct a *)0x4A004100; void foo(void) { unsigned int i = 0; unsigned int *const x[] = { p-a, p-b, 0 }; (*(volatile unsigned int *)((x[i])) = (unsigned int)((unsigned int)((*(volatile unsigned int *)(x[i]); }
[Ada] Initialization calls with access discriminants
If a record component is constrained with a current instance, that is to say an access to the enclosing type, an initialization call for the component must use a reference to the target object. Previously this was done when generating the code for the initialization procedure for the encloing record, but such a call can also be generated for an aggregate. The following must compile quietly in Ada2005 mode: --- package Small_Class is type Instance is limited private; type Instance_P is access all Instance; function Create (Index : Integer) return Instance_P; procedure Start (This : Instance_P); private task type T (This : not null access Instance) is entry Start; end T; type Instance is limited record The_T : T (This = Instance'Access); Index : Integer := 0; end record; end Small_Class; --- with Ada.Text_IO; use Ada.Text_IO; package body Small_Class is task body T is begin accept Start; Put_Line (T ( Integer'Image (This.Index) ) started.); end T; function Create (Index : Integer) return Instance_P is -- Result : Instance_P := new Instance; begin -- Result.Index := Index; -- return Result; return new Instance'(Index = Index, others = ); end Create; procedure Start (This : Instance_P) is begin This.The_T.Start; end Start; end Small_Class; Tested on x86_64-pc-linux-gnu, committed on trunk 2011-09-06 Ed Schonberg schonb...@adacore.com * exp_ch3.adb (Build_Initialization_Call): If the target is a selected component discriminated by a current instance, replace the constraint with a reference to the target object, regardless of whether the context is an init_proc. Index: exp_ch3.adb === --- exp_ch3.adb (revision 178565) +++ exp_ch3.adb (working copy) @@ -1563,8 +1563,22 @@ Discriminant_Constraint (Full_Type)); end; -if In_Init_Proc then +-- If the target has access discriminants, and is constrained by +-- an access to the enclosing construct, i.e. a current instance, +-- replace the reference to the type by a reference to the object. +if Nkind (Arg) = N_Attribute_Reference + and then Is_Access_Type (Etype (Arg)) + and then Is_Entity_Name (Prefix (Arg)) + and then Is_Type (Entity (Prefix (Arg))) +then + Arg := + Make_Attribute_Reference (Loc, + Prefix = New_Copy (Prefix (Id_Ref)), + Attribute_Name = Name_Unrestricted_Access); + +elsif In_Init_Proc then + -- Replace any possible references to the discriminant in the -- call to the record initialization procedure with references -- to the appropriate formal parameter. @@ -1574,19 +1588,6 @@ then Arg := New_Reference_To (Discriminal (Entity (Arg)), Loc); - -- Case of access discriminants. We replace the reference - -- to the type by a reference to the actual object - - elsif Nkind (Arg) = N_Attribute_Reference - and then Is_Access_Type (Etype (Arg)) - and then Is_Entity_Name (Prefix (Arg)) - and then Is_Type (Entity (Prefix (Arg))) - then - Arg := -Make_Attribute_Reference (Loc, - Prefix = New_Copy (Prefix (Id_Ref)), - Attribute_Name = Name_Unrestricted_Access); - -- Otherwise make a copy of the default expression. Note that -- we use the current Sloc for this, because we do not want the -- call to appear to be at the declaration point. Within the
[Ada] Freezing rules and expression functions
Ada2012 Expression functions behave like default expressions in regards to freezing rules: their declaration does not freeze, only a use of them (in a call) freezes. The following must compile quietly in Ada2012 mode: --- with Interfaces; use Interfaces; package Images is type RGBQUAD is record rgbBlue : Unsigned_8; rgbGreen: Unsigned_8; rgbRed : Unsigned_8; rgbReserved : Unsigned_8; end record; type Color_Type is new Unsigned_32; type Image_Types is (Grey, RGB, RGBa); subtype Colornr_Range is Integer range 0 .. 255; type Color_Data_Header is array (Colornr_Range) of RGBQUAD; type Color_Data_Header_Ptr is access all Color_Data_Header; subtype Image_Byte is Unsigned_8; type Image_Data is array (Positive range , Positive range ) of Unsigned_8; for Image_Data'Alignment use 4; type Image_Data_Ptr is access all Image_Data; type Line_Type is record X_From, Y_From, X_Upto, Y_Upto : Integer; Color : Color_Type; end record; type Line_Array is array (Positive range ) of Line_Type; subtype Linenr_Range is Integer range 1 .. 256; type Visual_Itec_Common_Header is record SequenceNr : Integer; Xaxis_Mirror : Boolean; Yaxis_Mirror : Boolean; Lines : Line_Array (Linenr_Range); end record; type Visual_Itec_Common_Header_Ptr is access constant Visual_Itec_Common_Header; type Image_Read_Properties is (Image_Width, Image_Height, Image_VerticalPitch, Image_BitsPerPixel, Image_XPelsPerMeter, Image_YPelsPerMeter); type Image_Write_Properties is (Image_XPelsPerMeter, Image_YPelsPerMeter); type Image_Header is private; type Image_Type (Height, Width, VerticalPitch : Positive) is limited record Header : Image_Header; Data : Image_Data (1 .. Height, 1 .. VerticalPitch); end record; type Image_Object is access all Image_Type; pragma No_Strict_Aliasing (Image_Object); Null_Image : constant Image_Object; type Image_Objects is array (Integer range ) of Image_Object; procedure Set_Default_PixelsPerMeter (X, Y : Integer); private type Image_Header is record ImageNr : Integer; Common : aliased Visual_Itec_Common_Header; Color_Data : aliased Color_Data_Header; end record; Null_Image : constant Image_Object := null; function Get_Color (Image : Image_Object; Colornr : Colornr_Range) return RGBQUAD is (Image.Header.Color_Data (Colornr)); end Images; --- package body Images is XPelsPerMeter : Integer := 5000; YPelsPerMeter : Integer := 5000; procedure Set_Default_PixelsPerMeter (X, Y : Integer) is begin XPelsPerMeter := X; YPelsPerMeter := Y; end Set_Default_PixelsPerMeter; end Images; Tested on x86_64-pc-linux-gnu, committed on trunk 2011-09-06 Ed Schonberg schonb...@adacore.com * sem_res.adb (Resolve): An expression that is the body of an expression function does not freeze. Index: sem_res.adb === --- sem_res.adb (revision 178565) +++ sem_res.adb (working copy) @@ -2810,8 +2810,17 @@ -- default expression mode (the Freeze_Expression routine tests this -- flag and only freezes static types if it is set). - Freeze_Expression (N); + -- AI05-177 (Ada2012): Expression functions do not freeze. Only + -- their use (in an expanded call) freezes. + if Ekind (Current_Scope) /= E_Function + or else + Nkind (Original_Node (Unit_Declaration_Node (Current_Scope))) /= +N_Expression_Function + then +Freeze_Expression (N); + end if; + -- Now we can do the expansion Expand (N);
[Ada] Remove hack for Win95 which is not needed anymore
No change in behavior, this patch just removes code that is not used since a long time. Tested on x86_64-pc-linux-gnu, committed on trunk 2011-09-06 Pascal Obry o...@adacore.com * sysdep.c (winflush_nt): Removed as not needed anymore. (winflush_95): Likewise. (winflush_init): Likewise. (winflush_function): Likewise. (getc_immediate_common): Remove call to winflush_function. Index: sysdep.c === --- sysdep.c(revision 178565) +++ sysdep.c(working copy) @@ -211,84 +211,10 @@ return NULL; } -/* This function is needed to fix a bug under Win95/98. Under these platforms - doing : -ch1 = getch(); - ch2 = fgetc (stdin); +#ifndef RTX - will put the same character into ch1 and ch2. It seem that the character - read by getch() is not correctly removed from the buffer. Even a - fflush(stdin) does not fix the bug. This bug does not appear under Window - NT. So we have two version of this routine below one for 95/98 and one for - NT/2000 version of Windows. There is also a special routine (winflushinit) - that will be called only the first time to check which version of Windows - we are running running on to set the right routine to use. - - This problem occurs when using Text_IO.Get_Line after Text_IO.Get_Immediate - for example. - - Calling FlushConsoleInputBuffer just after getch() fix the bug under - 95/98. */ - -#ifdef RTX - -static void winflush_nt (void); - -/* winflush_function will do nothing since we only have problems with Windows - 95/98 which are not supported by RTX. */ - -static void (*winflush_function) (void) = winflush_nt; - -static void -winflush_nt (void) -{ - /* Does nothing as there is no problem under NT. */ -} - -#else /* !RTX */ - -static void winflush_init (void); - -static void winflush_95 (void); - -static void winflush_nt (void); - int __gnat_is_windows_xp (void); -/* winflusfunction is set first to the winflushinit function which will check - the OS version 95/98 or NT/2000 */ - -static void (*winflush_function) (void) = winflush_init; - -/* This function does the runtime check of the OS version and then sets - winflush_function to the appropriate function and then call it. */ - -static void -winflush_init (void) -{ - DWORD dwVersion = GetVersion(); - - if (dwVersion 0x8000)/* Windows NT/2000 */ -winflush_function = winflush_nt; - else /* Windows 95/98 */ -winflush_function = winflush_95; - - (*winflush_function)(); /* Perform the 'flush' */ - -} - -static void -winflush_95 (void) -{ - FlushConsoleInputBuffer (GetStdHandle (STD_INPUT_HANDLE)); -} - -static void -winflush_nt (void) -{ - /* Does nothing as there is no problem under NT. */ -} - int __gnat_is_windows_xp (void) { @@ -311,7 +237,7 @@ return is_win_xp; } -#endif /* !RTX */ +#endif /* Get the bounds of the stack. The stack pointer is supposed to be initialized to BASE when a thread is created and the stack can be extended @@ -542,7 +468,6 @@ if (waiting) { *ch = getch (); - (*winflush_function) (); if (*ch == eot_ch) *end_of_file = 1; @@ -559,7 +484,6 @@ { *avail = 1; *ch = getch (); - (*winflush_function) (); if (*ch == eot_ch) *end_of_file = 1;
Re: [c-family] Fix PR middle-end/50266
On Tue, 6 Sep 2011, Eric Botcazou wrote: Hi, this is a regression present on the mainline and 4.6 branch caused by the constructor uniquization patch. The tree_output_constant_def routine rejects offsetof-like computations that can be written in the C family of languages. While the C compiler folds most of them early, it doesn't if an intermediate folding step is required. The proposed fix is to make c_fully_fold also do the offsetof folding. Tested on x86_64-suse-linux, OK for mainline and 4.6 branch? OK with a comment explaining the need to fold in this case and with the testcase moved to gcc.c-torture/compile rather than having dg-options specifying particular options from the set that would be passed in gcc.c-torture/compile. But in general we want to *reduce* the amount of folding done in the front ends and move more of it to gimplification time or later, except where required for the front end to meet standard requirements for diagnostics relating to constant expressions or avoid unnecessary warnings in various cases relating to conversions etc. (and there may be better ways to avoid those warnings without early optimization). -- Joseph S. Myers jos...@codesourcery.com
Re: [PATCH, Atom] Improve AGU stalls avoidance optimization
Hello, Thanks for review! 2011/9/3 Uros Bizjak ubiz...@gmail.com: Did you also test on x32 ? H.J.'s x32 page [1] currently says that Atom LEA optimization is disabled on x32 for some reason. No. I did not try to cover x32. It will be a separate work. +bool +ix86_avoid_lea_for_addr (rtx insn, rtx operands[]) +{ + unsigned int regno0 = true_regnum (operands[0]) ; + unsigned int regno1 = -1; + unsigned int regno2 = -1; Use INVALID_REGNUM here. Fixed. Also used INVALID_REGNUM in other places where -1 was used as invalid register number. +extern void +ix86_split_lea_for_addr (rtx operands[], enum machine_mode mode) +{ Missing comment. Fixed +;; Split non destructive adds if we cannot use lea. +(define_split + [(set (match_operand:SWI48 0 register_operand ) + (plus:SWI48 (match_operand:SWI48 1 register_operand ) + (match_operand:SWI48 2 nonmemory_operand ))) + (clobber (reg:CC FLAGS_REG))] + reload_completed ix86_avoid_lea_for_add (insn, operands) + [(set (match_dup 0) (match_dup 1)) + (parallel [(set (match_dup 0) (plus:MODE (match_dup 0) (match_dup 2))) + (clobber (reg:CC FLAGS_REG))]) + ] +) Put all closing braces on one line: Fixed. +;; Split lea into one or more ALU instructions if profitable. +(define_split + [(set (match_operand:SI 0 register_operand ) + (subreg:SI (match_operand:DI 1 lea_address_operand ) 0))] + reload_completed ix86_avoid_lea_for_addr (insn, operands) + [(const_int 0)] +{ + ix86_split_lea_for_addr (operands, SImode); + DONE; +}) This is valid only for TARGET_64BIT. Fixed. Please note that x32 adds quite some different LEA patterns (see i386.md, line 5466+). I suggest you merge your splitters with these define_insn patterns into define_insn_and_split, adding reload_completed ix86_avoid_lea_for_addr (insn, operands) as a split condition. Thanks for the note. I'll look at new patterns when we enable lea optimization for x32. Uros. Is fixed version OK? Thanks, Ilya --- gcc/ 2011-09-06 Enkovich Ilya ilya.enkov...@intel.com * config/i386/i386-protos.h (ix86_lea_outperforms): New. (ix86_avoid_lea_for_add): Likewise. (ix86_avoid_lea_for_addr): Likewise. (ix86_split_lea_for_addr): Likewise. * config/i386/i386.c (LEA_MAX_STALL): New. (increase_distance): Likewise. (insn_defines_reg): Likewise. (insn_uses_reg_mem): Likewise. (distance_non_agu_define_in_bb): Likewise. (distance_agu_use_in_bb): Likewise. (ix86_lea_outperforms): Likewise. (ix86_ok_to_clobber_flags): Likewise. (ix86_avoid_lea_for_add): Likewise. (ix86_avoid_lea_for_addr): Likewise. (ix86_split_lea_for_addr): Likewise. (distance_non_agu_define): Search in pred BBs added. (distance_agu_use): Search in succ BBs added. (IX86_LEA_PRIORITY): Value changed from 2 to 0. (LEA_SEARCH_THRESHOLD): Now depends on LEA_MAX_STALL. (ix86_lea_for_add_ok): Use ix86_lea_outperforms to make decision. * config/i386/i386.md: Splits added to transform lea into a sequence of instructions. lea.diff Description: Binary data
[PATCH, 4.6] Revert fix for PR 49886
Hi, I'm going to apply this after a quick c-only bootstrap and test on the 4.6 branch to revert my previous fix for PR 49886 because it causes PR 50295 (and probably also PR 50287 though I do not know whether that is against trunk or 4.6 too). I'm not reverting this on trunk because I know there is at least one another patch depending on it (the IPA-CP fro unchangeable signatures). I'm going to look into ways to fix it there right now (and Honza promised the same) and after it is done we'll backport the correct fix here too. The execution part of the testcase for PR 49886 is XFAILed by this patch but that means it XPASSes with LTO. This is the best I could do in reasonable time though, it has taken me quite a lot of time already. Thanks, Martin 2011-09-06 Martin Jambor mjam...@suse.cz Revert 2011-09-02 Martin Jambor mjam...@suse.cz PR middle-end/49886 * ipa-split.c (split_function): Do not skip any arguments if can_change_signature is set or there are function type attributes. testsuite/ * gcc.c-torture/execute/pr49886.c: Move to... * gcc.dg/torture/pr49886.c: ...here. Xfail run test for -O2 and above. Index: gcc/testsuite/gcc.c-torture/execute/pr49886.c === --- gcc/testsuite/gcc.c-torture/execute/pr49886.c (revision 178572) +++ gcc/testsuite/gcc.c-torture/execute/pr49886.c (working copy) @@ -1,100 +0,0 @@ -struct PMC { -unsigned flags; -}; - -typedef struct Pcc_cell -{ -struct PMC *p; -long bla; -long type; -} Pcc_cell; - -int gi; -int cond; - -extern void abort (); -extern void never_ever(int interp, struct PMC *pmc) - __attribute__((noinline,noclone)); - -void never_ever (int interp, struct PMC *pmc) -{ - abort (); -} - -static void mark_cell(int * interp, Pcc_cell *c) - __attribute__((__nonnull__(1))); - -static void -mark_cell(int * interp, Pcc_cell *c) -{ - if (!cond) -return; - - if (c c-type == 4 c-p - !(c-p-flags (118))) -never_ever(gi + 1, c-p); - if (c c-type == 4 c-p - !(c-p-flags (117))) -never_ever(gi + 2, c-p); - if (c c-type == 4 c-p - !(c-p-flags (116))) -never_ever(gi + 3, c-p); - if (c c-type == 4 c-p - !(c-p-flags (115))) -never_ever(gi + 4, c-p); - if (c c-type == 4 c-p - !(c-p-flags (114))) -never_ever(gi + 5, c-p); - if (c c-type == 4 c-p - !(c-p-flags (113))) -never_ever(gi + 6, c-p); - if (c c-type == 4 c-p - !(c-p-flags (112))) -never_ever(gi + 7, c-p); - if (c c-type == 4 c-p - !(c-p-flags (111))) -never_ever(gi + 8, c-p); - if (c c-type == 4 c-p - !(c-p-flags (110))) -never_ever(gi + 9, c-p); -} - -static void -foo(int * interp, Pcc_cell *c) -{ - mark_cell(interp, c); -} - -static struct Pcc_cell * -__attribute__((noinline,noclone)) -getnull(void) -{ - return (struct Pcc_cell *) 0; -} - - -int main() -{ - int i; - - cond = 1; - for (i = 0; i 100; i++) -foo (gi, getnull ()); - return 0; -} - - -void -bar_1 (int * interp, Pcc_cell *c) -{ - c-bla += 1; - mark_cell(interp, c); -} - -void -bar_2 (int * interp, Pcc_cell *c) -{ - c-bla += 2; - mark_cell(interp, c); -} - Index: gcc/testsuite/gcc.dg/torture/pr49886.c === --- gcc/testsuite/gcc.dg/torture/pr49886.c (revision 178572) +++ gcc/testsuite/gcc.dg/torture/pr49886.c (working copy) @@ -1,3 +1,6 @@ +/* { dg-do run } */ +/* { dg-xfail-run-if { *-*-* } { -O2 -O3 -Os } } */ + struct PMC { unsigned flags; }; Index: gcc/ipa-split.c === --- gcc/ipa-split.c (revision 178572) +++ gcc/ipa-split.c (working copy) @@ -943,10 +943,10 @@ static void split_function (struct split_point *split_point) { VEC (tree, heap) *args_to_pass = NULL; - bitmap args_to_skip; + bitmap args_to_skip = BITMAP_ALLOC (NULL); tree parm; int num = 0; - struct cgraph_node *node, *cur_node = cgraph_node (current_function_decl); + struct cgraph_node *node; basic_block return_bb = find_return_bb (); basic_block call_bb; gimple_stmt_iterator gsi; @@ -966,34 +966,17 @@ split_function (struct split_point *spli dump_split_point (dump_file, split_point); } - if (cur_node-local.can_change_signature - !TYPE_ATTRIBUTES (TREE_TYPE (cur_node-decl))) -args_to_skip = BITMAP_ALLOC (NULL); - else -args_to_skip = NULL; - /* Collect the parameters of new function and args_to_skip bitmap. */ for (parm = DECL_ARGUMENTS (current_function_decl); parm; parm = DECL_CHAIN (parm), num++) -if (args_to_skip -(!is_gimple_reg (parm) - || !gimple_default_def (cfun, parm) - || !bitmap_bit_p (split_point-ssa_names_to_pass, - SSA_NAME_VERSION (gimple_default_def (cfun, -
Re: [PATCH Atom][PR middle-end/44382] Tree reassociation improvement
Hello, 2011/9/2 Uros Bizjak ubiz...@gmail.com: I assume that you need to split tune attribute to int and FP part to handle reassociation for other targets, since Atom handles both in the same way. Please also describe function return value in the comment (and perhaps in documentation, too). OK with this addition. Thanks, Uros. Here is patch with added comment for hook implementation. Is it OK? Thanks, Ilya --- gcc/ 2011-09-06 Enkovich Ilya ilya.enkov...@intel.com PR middle-end/44382 * target.def (reassociation_width): New hook. * doc/tm.texi.in (reassociation_width): Likewise. * doc/tm.texi (reassociation_width): Likewise. * doc/invoke.texi (tree-reassoc-width): New param documented. * hooks.h (hook_int_uint_mode_1): New default hook. * hooks.c (hook_int_uint_mode_1): Likewise. * config/i386/i386.h (ix86_tune_indices): Add X86_TUNE_REASSOC_INT_TO_PARALLEL and X86_TUNE_REASSOC_FP_TO_PARALLEL. (TARGET_REASSOC_INT_TO_PARALLEL): New. (TARGET_REASSOC_FP_TO_PARALLEL): Likewise. * config/i386/i386.c (initial_ix86_tune_features): Add X86_TUNE_REASSOC_INT_TO_PARALLEL and X86_TUNE_REASSOC_FP_TO_PARALLEL. (ix86_reassociation_width) implementation of new hook for i386 target. * params.def (PARAM_TREE_REASSOC_WIDTH): New param added. * tree-ssa-reassoc.c (get_required_cycles): New function. (get_reassociation_width): Likewise. (swap_ops_for_binary_stmt): Likewise. (rewrite_expr_tree_parallel): Likewise. (rewrite_expr_tree): Refactored. Part of code moved into swap_ops_for_binary_stmt. (reassociate_bb): Now checks reassociation width to be used and call rewrite_expr_tree_parallel instead of rewrite_expr_tree if needed. gcc/testsuite/ 2011-09-06 Enkovich Ilya ilya.enkov...@intel.com * gcc.dg/tree-ssa/pr38533.c (dg-options): Added option --param tree-reassoc-width=1. * gcc.dg/tree-ssa/reassoc-24.c: New test. * gcc.dg/tree-ssa/reassoc-25.c: Likewise. PR44382.diff Description: Binary data
RFA: MN10300: Add jump label to Lcc insn
Hi Jeff, Hi Alex, The MN10300 target is currently failing to build in the mainline FSF sources because of this error when creating libgcc: gcc/libgcc2.c: In function '__popcountsi2': gcc/libgcc2.c:834:1: internal compiler error: in create_trace_edges, at dwarf2cfi.c:2325 This turns out to be because the code in create_trace_edges does not handle jumps inside parallel insns, like this: (jump_insn 72 52 31 3 (parallel [ (set (pc) (if_then_else (ne (reg:CC 51 EPSW) (const_int 0 [0])) (label_ref 29) (pc))) (unspec [ (const_int 1 [0x1]) ] 9) ]) gcc/libgcc2.c:830 -1 (insn_list:REG_LABEL_OPERAND 29 (nil))) I am not sure if create_trace_edges should handle this, but I felt that the easiest thing to do was to fix the MN10300 backend so that when it was creating this insn, it would also set the label on the parallel container. That is what the patch below does and with this applied I can build the toolchain again. OK to apply, or is there a better way to fix the problem ? Cheers Nick gcc/ChangeLog 2011-09-06 Nick Clifton ni...@redhat.com * config/mn10300/mn10300.c (mn10300_insert_setlb_lcc): Set the jump label on the parallel part of the insn. Index: gcc/config/mn10300/mn10300.c === --- gcc/config/mn10300/mn10300.c(revision 178566) +++ gcc/config/mn10300/mn10300.c(working copy) @@ -3150,6 +3150,7 @@ lcc = emit_jump_insn_before (lcc, branch); mark_jump_label (XVECEXP (PATTERN (lcc), 0, 0), lcc, 0); + JUMP_LABEL (lcc) = label; DUMP (Replacing branch insn..., branch); DUMP (... with Lcc insn:, lcc); delete_insn (branch);
[Ada] Freezing and Ada2012 expression functions
The body that is a rewriting of an expression function does not freeze previous entities. The following must compile quietly in Ada2012 mode: --- package Ada12 is type T is tagged null record;function Template (Self : T) return String is (foo.thtml); type T2 is new T with null record; overriding function Template (Self : T2) return String is (bar.thtml); end Ada12; Tested on x86_64-pc-linux-gnu, committed on trunk 2011-09-06 Ed Schonberg schonb...@adacore.com * sem_ch6.adb (Analyze_Subprogram_Body_Helper): The body that is a rewriting of an expression function does not freeze previous entities. Index: sem_ch6.adb === --- sem_ch6.adb (revision 178567) +++ sem_ch6.adb (working copy) @@ -2346,7 +2346,12 @@ -- expansion has generated an equivalent type that is used when -- elaborating the body. -if No (Spec_Id) then +-- An exception in the case of Ada2012, AI05-177: The bodies +-- created for expression functions do not freeze. + +if No (Spec_Id) + and then Nkind (Original_Node (N)) /= N_Expression_Function +then Freeze_Before (N, Body_Id); elsif Nkind (Parent (N)) = N_Compilation_Unit then
[Ada] Implement new Ada 2012 restriction No_Implementation_Units
This patch implements the new restriction No_Implementation_Units, as defined in AI 242. This restriction is also part of the new Ada 2012 profile No_Implementation_Extensions. Here is a test of the new restriction (compiled with -gnatld7 -gnatj60) 1. pragma Ada_2005; 2. pragma Restrictions (No_Implementation_Units); 3. with Ada.Command_Line.Remove; -- ERROR | violation of restriction No_Implementation_Units at line 2 4. with Ada.Iterator_Interfaces; -- ERROR | violation of restriction No_Implementation_Units at line 2 5. with Ada.Wide_Wide_Text_IO.C_Streams; -- ERROR | violation of restriction No_Implementation_Units at line 2 6. with Ada.Directories; -- OK 7. with Ada.Text_IO; -- OK 8. with Ada; -- OK 9. with Interfaces; -- OK 10. with System; -- OK 11. with GNAT;-- ERROR | violation of restriction No_Implementation_Units at line 2 12. package NoImpUnits is 13. end NoImpUnits; and here is the same test using the profile 1. pragma Ada_2005; 2. pragma Profile (No_Implementation_Extensions); 3. with Ada.Command_Line.Remove; -- ERROR | violation of restriction No_Implementation_Units, from profile No_Implementation_Extensions at line 2 4. with Ada.Iterator_Interfaces; -- ERROR | violation of restriction No_Implementation_Units, from profile No_Implementation_Extensions at line 2 5. with Ada.Wide_Wide_Text_IO.C_Streams; -- ERROR | violation of restriction No_Implementation_Units, from profile No_Implementation_Extensions at line 2 6. with Ada.Directories; -- OK 7. with Ada.Text_IO; -- OK 8. with Ada; -- OK 9. with Interfaces; -- OK 10. with System; -- OK 11. with GNAT;-- ERROR | violation of restriction No_Implementation_Units, from profile No_Implementation_Extensions at line 2 12. package NoImpUnits2 is 13. end NoImpUnits2; Tested on x86_64-pc-linux-gnu, committed on trunk 2011-09-06 Robert Dewar de...@adacore.com * impunit.ads, impunit.adb (Is_RM_Defined_Unit): New function. * s-rident.ads: New restriction No_Implementation_Units (this restriction is also part of the profile No_Implementation_Extensions) * sem_ch10.adb (Analyze_With_Clause): Add check for No_Implementation_Units restriction. Index: impunit.adb === --- impunit.adb (revision 178593) +++ impunit.adb (working copy) @@ -29,6 +29,7 @@ with Fname.UF; use Fname.UF; with Lib; use Lib; with Namet;use Namet; +with Opt; use Opt; with Uname;use Uname; -- Note: this package body is used by GPS and GNATBench to supply a list of @@ -37,8 +38,22 @@ package body Impunit is subtype File_Name_8 is String (1 .. 8); - type File_List is array (Nat range ) of File_Name_8; + type File_Name_Record is record + Fname : File_Name_8; + -- 8 character name of unit + + RMdef : Boolean; + -- True if unit is RM defined. False for any unit that is implementation + -- defined (and thus not with'able in No_Implementation_Units mode). + end record; + + type File_List is array (Nat range ) of File_Name_Record; + + T : constant Boolean := True; + F : constant Boolean := False; + -- Short hand for RM_Defined values in lists below + -- -- Ada 95 Units -- -- @@ -58,130 +73,133 @@ -- Ada Hierarchy Units from Ada-95 Reference Manual -- -- - a-astaco,-- Ada.Asynchronous_Task_Control - a-calend,-- Ada.Calendar - a-chahan,-- Ada.Characters.Handling - a-charac,-- Ada.Characters - a-chlat1,-- Ada.Characters.Latin_1 - a-comlin,-- Ada.Command_Line - a-decima,-- Ada.Decimal - a-direio,-- Ada.Direct_IO - a-dynpri,-- Ada.Dynamic_Priorities - a-except,-- Ada.Exceptions - a-finali,-- Ada.Finalization - a-flteio,-- Ada.Float_Text_IO - a-fwteio,-- Ada.Float_Wide_Text_IO - a-inteio,-- Ada.Integer_Text_IO - a-interr,-- Ada.Interrupts - a-intnam,-- Ada.Interrupts.Names - a-ioexce,-- Ada.IO_Exceptions - a-iwteio,--
Re: [Ada] Speed up build of gnatools
On 9/6/2011 7:14 AM, Duncan Sands wrote: this means using as many processes as there are CPUs, right? It seems pretty dubious to me to use more processes than the user maybe asked for. We often find that the optimum number of processes is a little bit more than the number of physical processes (not surprising when there is mixed I/O computation going on. For example I have to restrict the number of CPUs used when building GCC to less than I have since otherwise my machine overheats and turns itself off. That seems a (pretty disastrous) engineering error in the design of your machine. In a properly designed machine, extra fans should come on to counteract the extra heating (that's certainly what happens on my Toshiba R700 with is the new core i7-2620M with four cores. Is there some way to get at the -j level the user passed to the top-level make and use that? I am pretty sure you can specify any -j value you like, but will let Arno clarify that.
[Ada] Fixes to No_Implementation_Units restriction
This patch fixes some errors in the previous initial checkin of this new feature. 1. package noimpunit4 is end; 1. pragma Restrictions (No_Implementation_Units); 2. with noimpunit4; 3. with GNAT.IO; | violation of restriction no_implementation_units at line 1 4. package noimpunit3 is end; Prior to this fix, the line with'ing noimpunit4 was flagged (along with all user defined units), and the with of the gnat unit was not flagged and it should be (even if perhaps this is not 100% legally conforming). Tested on x86_64-pc-linux-gnu, committed on trunk 2011-09-06 Robert Dewar de...@adacore.com * sem_ch10.adb, impunit.ads, impunit.adb (Not_Impl_Defined_Unit): New name for Is_RM_Defined_Unit. Also several fixes to this unit. Index: impunit.adb === --- impunit.adb (revision 178594) +++ impunit.adb (working copy) @@ -826,11 +826,11 @@ return False; end Is_Known_Unit; - - -- Is_RM_Defined_Unit -- - + --- + -- Not_Impl_Defined_Unit -- + --- - function Is_RM_Defined_Unit (U : Unit_Number_Type) return Boolean is + function Not_Impl_Defined_Unit (U : Unit_Number_Type) return Boolean is Fname : constant File_Name_Type := Unit_File_Name (U); begin @@ -848,21 +848,22 @@ return True; end if; - -- If length of file name is greater than 12, not RM-defined. The value - -- 12 here is an 8 char name with extension .ads. + -- If length of file name is greater than 12, then it's a user unit + -- and not a GNAT implementation defined unit. if Name_Len 12 then - return False; + return True; end if; - -- Not RM-defined if length of name greater than 12 (12 is 8 characters - -- plus 4 for .ads appended at the end). + -- Implementation defined if unit in the gnat hierarchy - if Length_Of_Name (Fname) 12 then + if (Name_Len = 8 and then Name_Buffer (1 .. 8) = gnat.ads) +or else (Name_Len 2 and then Name_Buffer (1 .. 2) = g-) + then return False; end if; - -- Not RM defined if file name does not start with a- s- i- + -- Not implementation defined if file name does not start with a- s- i- if Name_Len 3 or else Name_Buffer (2) /= '-' @@ -872,14 +873,14 @@ and then Name_Buffer (1) /= 's') then - return False; + return True; end if; - -- Not RM defined if file name does not end in .ads. This can happen + -- Not impl-defined if file name does not end in .ads. This can happen -- when non-standard file names are being used. if Name_Buffer (Name_Len - 3 .. Name_Len) /= .ads then - return False; + return True; end if; -- Otherwise normalize file name to 8 characters @@ -891,7 +892,8 @@ end loop; -- Check our lists of names, if we find a match, return corresponding - -- indication of whether the file is RM defined. + -- indication of whether the file is RM defined, respecting the RM + -- version in which it is defined. for J in Non_Imp_File_Names_95'Range loop if Name_Buffer (1 .. 8) = Non_Imp_File_Names_95 (J).Fname then @@ -913,9 +915,11 @@ end if; end loop; - -- If no match in any of the lists, not RM defined + -- If unit is in System, Ada or Interfaces hierarchies and did not match + -- any entry in the list, means it is an internal implementation defined + -- unit which the restriction should definition forbid. - return False; - end Is_RM_Defined_Unit; + return True; + end Not_Impl_Defined_Unit; end Impunit; Index: impunit.ads === --- impunit.ads (revision 178594) +++ impunit.ads (working copy) @@ -72,10 +72,14 @@ -- the known library units, and if so, returns True. If the name does not -- match any known library unit, False is returned. - function Is_RM_Defined_Unit (U : Unit_Number_Type) return Boolean; - -- This function returns True if U represents a unit that is defined in - -- the RM, as defined by the No_Implementation_Units restriction rules. - -- It is used to implement this restriction, so if False is returned, it - -- means that with'ing the unit violates the restriction. + function Not_Impl_Defined_Unit (U : Unit_Number_Type) return Boolean; + -- This function returns True if U represents a unit that is permitted by + -- the restriction No_Implementation_Units (i.e. a unit in the Ada, System, + -- and Interfaces hierarchies that is defined in the RM, or a user defined + -- unit. It returns False if U represents a unit
[PATCH] Fix PR48149
This makes SCCVN combine COMPLEX_EXPR arguments with its operands, allowing to optimize piecewise pass-thru of a complex value. The meat of the patch is the tuplification fix ! TREE_CODE (gimple_assign_rhs1 (def_stmt)) == SSA_NAME) --- ! TREE_CODE (TREE_OPERAND (gimple_assign_rhs1 (def_stmt), ! 0)) == SSA_NAME) and special-casing of COMPLEX_EXPR in simplify_binary_expression. The rest is some TLC in the functions. Bootstrap and regtest ongoing for x86_64-unknown-linux-gnu. Richard. 2011-09-06 Richard Guenther rguent...@suse.de PR tree-optimization/48149 * tree-ssa-sccvn.c (vn_get_expr_for): Simplify. Fix tuplification bug. (vn_valueize): Move earlier. (valueize_expr): Use vn_valueize. (simplify_binary_expression): Simplify, also combine COMPLEX_EXPR operands. (simplify_unary_expression): Simplify. * gcc.dg/tree-ssa/ssa-fre-32.c: New testcase. Index: trunk/gcc/tree-ssa-sccvn.c === *** trunk.orig/gcc/tree-ssa-sccvn.c 2011-09-06 14:58:32.0 +0200 --- trunk/gcc/tree-ssa-sccvn.c 2011-09-06 14:58:53.0 +0200 *** vn_get_expr_for (tree name) *** 217,222 --- 217,223 vn_ssa_aux_t vn = VN_INFO (name); gimple def_stmt; tree expr = NULL_TREE; + enum tree_code code; if (vn-valnum == VN_TOP) return name; *** vn_get_expr_for (tree name) *** 241,277 /* Otherwise use the defining statement to build the expression. */ def_stmt = SSA_NAME_DEF_STMT (vn-valnum); ! /* If the value number is a default-definition or a PHI result ! use it directly. */ ! if (gimple_nop_p (def_stmt) ! || gimple_code (def_stmt) == GIMPLE_PHI) ! return vn-valnum; ! if (!is_gimple_assign (def_stmt)) return vn-valnum; /* FIXME tuples. This is incomplete and likely will miss some simplifications. */ ! switch (TREE_CODE_CLASS (gimple_assign_rhs_code (def_stmt))) { case tcc_reference: ! if ((gimple_assign_rhs_code (def_stmt) == VIEW_CONVERT_EXPR ! || gimple_assign_rhs_code (def_stmt) == REALPART_EXPR ! || gimple_assign_rhs_code (def_stmt) == IMAGPART_EXPR) ! TREE_CODE (gimple_assign_rhs1 (def_stmt)) == SSA_NAME) ! expr = fold_build1 (gimple_assign_rhs_code (def_stmt), gimple_expr_type (def_stmt), TREE_OPERAND (gimple_assign_rhs1 (def_stmt), 0)); break; case tcc_unary: ! expr = fold_build1 (gimple_assign_rhs_code (def_stmt), gimple_expr_type (def_stmt), gimple_assign_rhs1 (def_stmt)); break; case tcc_binary: ! expr = fold_build2 (gimple_assign_rhs_code (def_stmt), gimple_expr_type (def_stmt), gimple_assign_rhs1 (def_stmt), gimple_assign_rhs2 (def_stmt)); --- 242,275 /* Otherwise use the defining statement to build the expression. */ def_stmt = SSA_NAME_DEF_STMT (vn-valnum); ! /* If the value number is not an assignment use it directly. */ if (!is_gimple_assign (def_stmt)) return vn-valnum; /* FIXME tuples. This is incomplete and likely will miss some simplifications. */ ! code = gimple_assign_rhs_code (def_stmt); ! switch (TREE_CODE_CLASS (code)) { case tcc_reference: ! if ((code == REALPART_EXPR ! || code == IMAGPART_EXPR ! || code == VIEW_CONVERT_EXPR) ! TREE_CODE (TREE_OPERAND (gimple_assign_rhs1 (def_stmt), ! 0)) == SSA_NAME) ! expr = fold_build1 (code, gimple_expr_type (def_stmt), TREE_OPERAND (gimple_assign_rhs1 (def_stmt), 0)); break; case tcc_unary: ! expr = fold_build1 (code, gimple_expr_type (def_stmt), gimple_assign_rhs1 (def_stmt)); break; case tcc_binary: ! expr = fold_build2 (code, gimple_expr_type (def_stmt), gimple_assign_rhs1 (def_stmt), gimple_assign_rhs2 (def_stmt)); *** stmt_has_constants (gimple stmt) *** 2822,2827 --- 2820,2838 return false; } + /* Valueize NAME if it is an SSA name, otherwise just return it. */ + + static inline tree + vn_valueize (tree name) + { + if (TREE_CODE (name) == SSA_NAME) + { + tree tem = SSA_VAL (name); + return tem == VN_TOP ? name : tem; + } + return name; + } + /* Replace SSA_NAMES in expr with their value numbers, and return the result. This is performed in place. */ *** valueize_expr (tree expr) *** 2831,2851 { switch (TREE_CODE_CLASS
Re: [PATCH][ARM] -m{cpu,tune,arch}=native
This update adds many more magic numbers for various ARM CPUs, and also ensures that the implementer is ARM (as opposed to Marvell, etc.). The list is far from comprehensive, but it should cover many (but by no means all) of the cores in current use and it would not be hard to add support for other implementers and CPU names in future. It has been suggested that this patch should use auxv rather than /proc/cpuinfo. Does anybody here have any insight/preferences? Is the patch OK? Andrew 2011-08-27 Andrew Stubbs a...@codesourcery.com gcc/ * config.host (arm*-*-linux*): Add driver-arm.o and x-arm. * config/arm/arm.opt: Add 'native' processor_type and arm_arch enum values. * config/arm/arm.h (host_detect_local_cpu): New prototype. (EXTRA_SPEC_FUNCTIONS): New define. (MCPU_MTUNE_NATIVE_SPECS): New define. (DRIVER_SELF_SPECS): New define. * config/arm/driver-arm.c: New file. * config/arm/x-arm: New file. * doc/invoke.texi (ARM Options): Document -mcpu=native, -mtune=native and -march=native. --- a/gcc/config.host +++ b/gcc/config.host @@ -100,6 +100,14 @@ case ${host} in esac case ${host} in + arm*-*-linux*) +case ${target} in + arm*-*-*) + host_extra_gcc_objs=driver-arm.o + host_xmake_file=${host_xmake_file} arm/x-arm + ;; +esac +;; alpha*-*-linux* | alpha*-dec-osf*) case ${target} in alpha*-*-linux* | alpha*-dec-osf*) --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -2223,4 +2223,21 @@ extern int making_const_table; instruction. */ #define MAX_LDM_STM_OPS 4 +/* -mcpu=native handling only makes sense with compiler running on + an ARM chip. */ +#if defined(__arm__) +extern const char *host_detect_local_cpu (int argc, const char **argv); +# define EXTRA_SPEC_FUNCTIONS \ + { local_cpu_detect, host_detect_local_cpu }, + +# define MCPU_MTUNE_NATIVE_SPECS \ +%{march=native:%march=native %:local_cpu_detect(arch)} \ +%{mcpu=native:%mcpu=native %:local_cpu_detect(cpu)} \ +%{mtune=native:%mtune=native %:local_cpu_detect(tune)} +#else +# define MCPU_MTUNE_NATIVE_SPECS +#endif + +#define DRIVER_SELF_SPECS MCPU_MTUNE_NATIVE_SPECS + #endif /* ! GCC_ARM_H */ --- a/gcc/config/arm/arm.opt +++ b/gcc/config/arm/arm.opt @@ -80,6 +80,11 @@ march= Target RejectNegative Joined Enum(arm_arch) Var(arm_arch_option) Specify the name of the target architecture +; Other arm_arch values are loaded from arm-tables.opt +; but that is a generated file and this is an odd-one-out. +EnumValue +Enum(arm_arch) String(native) Value(-1) DriverOnly + marm Target Report RejectNegative InverseMask(THUMB) Generate code in 32 bit ARM state. @@ -233,6 +238,11 @@ mtune= Target RejectNegative Joined Enum(processor_type) Var(arm_tune_option) Init(arm_none) Tune code for the given processor +; Other processor_type values are loaded from arm-tables.opt +; but that is a generated file and this is an odd-one-out. +EnumValue +Enum(processor_type) String(native) Value(-1) DriverOnly + mwords-little-endian Target Report RejectNegative Mask(LITTLE_WORDS) Assume big endian bytes, little endian words. This option is deprecated. --- /dev/null +++ b/gcc/config/arm/driver-arm.c @@ -0,0 +1,108 @@ +/* Subroutines for the gcc driver. + Copyright (C) 2011 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +http://www.gnu.org/licenses/. */ + +#include config.h +#include system.h +#include coretypes.h +#include tm.h + +static struct { + const char *part_no; + const char *arch_name; + const char *cpu_name; +} cpu_table[] = { +{0x926, armv5te, arm926ej-s}, +{0xa26, armv5te, arm1026ej-s}, +{0xb02, armv6k, mpcore}, +{0xb36, armv6j, arm1136j-s}, +{0xb56, armv6t2, arm1156t2-s}, +{0xb76, armv6zk, arm1176jz-s}, +{0xc05, armv7-a, cortex-a5}, +{0xc08, armv7-a, cortex-a8}, +{0xc09, armv7-a, cortex-a9}, +{0xc0f, armv7-a, cortex-a15}, +{0xc14, armv7-r, cortex-r4}, +{0xc15, armv7-r, cortex-r5}, +{0xc20, armv6-m, cortex-m0}, +{0xc21, armv6-m, cortex-m1}, +{0xc23, armv7-m, cortex-m3}, +{0xc24, armv7e-m, cortex-m4}, +{NULL, NULL, NULL} +}; + +/* This will be called by the spec parser in gcc.c when it sees + a %:local_cpu_detect(args) construct. Currently it will be called + with either arch, cpu or tune as argument depending on if + -march=native, -mcpu=native or -mtune=native is to be substituted. + + It returns a
[PATCH ARM] Fix PR50099
Hi, PR target/50099 is a case where we are using the wrong predicate for the sign_extend from QI to DImode values. ldrsb has a lower range than the other ldrb instructions in ARM state and hence one has to be careful about generating the right addresses when splitting it. Attached is a patch to fix this. I will commit this if there are no regressions. A backport to 4.6 branch will be done after suitable regression testing. cheers Ramana 2011-09-06 Ramana Radhakrishnan ramana.radhakrish...@linaro.org PR target/50099 * config/arm/iterators.md (qhs_zextenddi_cstr): New. (qhs_zextenddi_op): New. * config/arm/arm.md (zero_extendmodedi2): Use them. * config/arm/predicates.md (arm_extendqisi_mem_op): Distinguish between ARM and Thumb2 states. PR target/50099 * gcc.target/arm/pr50099.c: New test. commit 9c268f1a74578ae082ea52dfcc655804b8319190 Author: Ramana Radhakrishnan ramana.radhakrish...@linaro.org Date: Tue Sep 6 15:14:14 2011 +0100 Fix PR target/50099 diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md index 40341bd..388254f 100644 --- a/gcc/config/arm/arm.md +++ b/gcc/config/arm/arm.md @@ -4163,8 +4163,8 @@ (define_insn zero_extendmodedi2 [(set (match_operand:DI 0 s_register_operand =r) -(zero_extend:DI (match_operand:QHSI 1 qhs_extenddi_op - qhs_extenddi_cstr)))] +(zero_extend:DI (match_operand:QHSI 1 qhs_zextenddi_op + qhs_zextenddi_cstr)))] TARGET_32BIT qhs_zextenddi_cond # [(set_attr length 8) diff --git a/gcc/config/arm/iterators.md b/gcc/config/arm/iterators.md index 219918c..da1f7af 100644 --- a/gcc/config/arm/iterators.md +++ b/gcc/config/arm/iterators.md @@ -390,10 +390,14 @@ (define_mode_attr qhs_zextenddi_cond [(SI ) (HI arm_arch6) (QI )]) (define_mode_attr qhs_sextenddi_cond [(SI ) (HI arm_arch6) (QI arm_arch6)]) -(define_mode_attr qhs_extenddi_op [(SI s_register_operand) +(define_mode_attr qhs_zextenddi_op [(SI s_register_operand) (HI nonimmediate_operand) (QI nonimmediate_operand)]) -(define_mode_attr qhs_extenddi_cstr [(SI r) (HI rm) (QI rm)]) +(define_mode_attr qhs_extenddi_op [(SI s_register_operand) + (HI nonimmediate_operand) + (QI arm_reg_or_extendqisi_mem_op)]) +(define_mode_attr qhs_extenddi_cstr [(SI r) (HI rm) (QI rUq)]) +(define_mode_attr qhs_zextenddi_cstr [(SI r) (HI rm) (QI rm)]) ;; Mode attributes used for fixed-point support. (define_mode_attr qaddsub_suf [(V4UQQ 8) (V2UHQ 16) (UQQ 8) (UHQ 16) diff --git a/gcc/config/arm/predicates.md b/gcc/config/arm/predicates.md index cfe8d33..50c1b43 100644 --- a/gcc/config/arm/predicates.md +++ b/gcc/config/arm/predicates.md @@ -296,8 +296,11 @@ (define_special_predicate arm_extendqisi_mem_op (and (match_operand 0 memory_operand) - (match_test arm_legitimate_address_outer_p (mode, XEXP (op, 0), - SIGN_EXTEND, 0 + (match_test TARGET_ARM ? arm_legitimate_address_outer_p (mode, + XEXP (op, 0), +SIGN_EXTEND, +0) + : memory_address_p (QImode, XEXP (op, 0) (define_special_predicate arm_reg_or_extendqisi_mem_op (ior (match_operand 0 arm_extendqisi_mem_op) diff --git a/gcc/testsuite/gcc.target/arm/pr50099.c b/gcc/testsuite/gcc.target/arm/pr50099.c new file mode 100644 index 000..e767423 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pr50099.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ + +typedef signed char int8_t ; +typedef signed short int16_t; +typedef signed long int32_t; +typedef signed long long int64_t; + +int64_t foo (int8_t * arg) +{ + int64_t temp_1; + + temp_1 = arg[256]; // index must be 255 to ice! + return temp_1; +}
Re: [Patch][Cilkplus branch] Adding include directory path to testsuite script
On Mon, Sep 5, 2011 at 9:52 PM, Iyer, Balaji V balaji.v.i...@intel.com wrote: Hello Everyone, This patch is for the Cilk Plus branch. It will add the include directory path it the testsuite script (cilk_plus.exp) in both gcc.dg/cilk-plus and g++.dg/cilk-plus directories. Thanking You, ChangeLog entries are missing. -- H.J.
RE: [Patch][Cilkplus branch] Adding include directory path to testsuite script
Attached, please find a patch with the modifications you have suggested (adding the info in Changelog.cilk). Sorry for the mistake. Thanks, Balaji V. Iyer. -Original Message- From: H.J. Lu [mailto:hjl.to...@gmail.com] Sent: Tuesday, September 06, 2011 10:22 AM To: Iyer, Balaji V Cc: gcc-patches@gcc.gnu.org Subject: Re: [Patch][Cilkplus branch] Adding include directory path to testsuite script On Mon, Sep 5, 2011 at 9:52 PM, Iyer, Balaji V balaji.v.i...@intel.com wrote: Hello Everyone, This patch is for the Cilk Plus branch. It will add the include directory path it the testsuite script (cilk_plus.exp) in both gcc.dg/cilk-plus and g++.dg/cilk-plus directories. Thanking You, ChangeLog entries are missing. -- H.J. diff --git a/gcc/testsuite/ChangeLog.cilk b/gcc/testsuite/ChangeLog.cilk index a311052..cc2a973 100644 --- a/gcc/testsuite/ChangeLog.cilk +++ b/gcc/testsuite/ChangeLog.cilk @@ -1,3 +1,12 @@ +2011-09-05 Balaji V. Iyer. balaji.v.i...@intel.com + + * gcc.dg/cilk-plus/cilk_plus.exp: Added -I + $(src_dir)../../libcilkrts/include so that the compiler can find cilk.h + and cilk_api.h file correctly. Also removed -fsyntax-only + * g++.dg/cilk-plus/cilk_plus.exp: Added -I + $(src_dir)../../libcilkrts/include so that the compiler can find cilk.h + and cilk_api.h file correctly. Also removed -fsyntax-only + 2011-08-15 Balaji V. Iyer. balaji.v.i...@intel.com diff --git a/gcc/testsuite/g++.dg/cilk-plus/cilk_plus.exp b/gcc/testsuite/g++.dg/cilk-plus/cilk_plus.exp index 9f91b0c..8a9fdd4 100644 --- a/gcc/testsuite/g++.dg/cilk-plus/cilk_plus.exp +++ b/gcc/testsuite/g++.dg/cilk-plus/cilk_plus.exp @@ -18,6 +18,6 @@ load_lib g++-dg.exp dg-init -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cpp]] -fsyntax-only -w -lcilkrts -ldl +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cpp]] -w -lcilkrts -ldl -I $srcdir/../../libcilkrts/include dg-finish diff --git a/gcc/testsuite/gcc.dg/cilk-plus/cilk_plus.exp b/gcc/testsuite/gcc.dg/cilk-plus/cilk_plus.exp index b228b65..dcf096e 100644 --- a/gcc/testsuite/gcc.dg/cilk-plus/cilk_plus.exp +++ b/gcc/testsuite/gcc.dg/cilk-plus/cilk_plus.exp @@ -18,6 +18,6 @@ load_lib gcc-dg.exp dg-init -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] -fsyntax-only -lcilkrts -ldl -std=c99 +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] -ldl -lcilkrts -I $srcdir/../../libcilkrts/include -std=c99 dg-finish
Re: [PATCH] Better comparison of BINFOs in IPA-CP
Hi, On Mon, Sep 05, 2011 at 09:24:36AM +0200, Jan Hubicka wrote: Hi, the patch below improves the comparisons of BINFOs in IPA-CP. The problem is that we can read different BINFOs for the same type (or a base type component) from the LTO summaries because BINFOs coming from different compilation units are not unified. Because we now have the BINFO_VTABLE available, we can compare those instead since the VMT variables are unified. Hmm, I was quite sure this is happening. Can't you get an extra credit for unifying the binfos at stream in? Unifying them (especially BASE_BINFOs) in a way that we end up with an appropriate BINFO attached to the prevailing type is not trivial and I really would like to avoid writing that. On the other hand, we basically use BINFOs as a mapping from the encapsulating type and offset into virtual table expressions and so what we can do is stream the encapsulating type and offset in jump functions and at the WPA stage use the two to get the BINFO (now unique because of type unification) and work with that. So I decided to implement the above and not to commit this patch (I'd only consider it if I did not manage to have the proper solution ready by the end of stage1). Thanks, Martin Honza Bootstrapped and tested on x86_64-linux, also tested by LTO-building Firefox and 483.xalancbmk on the same platform (I lost the actual numbers but the new test returned true hundreds of times in both these cases). OK for trunk? Thanks, Martin 2011-09-02 Martin Jambor mjam...@suse.cz * ipa-cp.c (values_equal_for_ipcp_p): When comparing BINFOs, compare their BINFO_VTABLE, Index: src/gcc/ipa-cp.c === --- src.orig/gcc/ipa-cp.c +++ src/gcc/ipa-cp.c @@ -800,6 +800,33 @@ values_equal_for_ipcp_p (tree x, tree y) if (x == y) return true; + if (TREE_CODE (x) == TREE_BINFO TREE_CODE (y) == TREE_BINFO) +{ + unsigned HOST_WIDE_INT ox, oy; + tree vx = BINFO_VTABLE (x); + tree vy = BINFO_VTABLE (y); + + if (!vx || !vy + || TREE_CODE (vx) != POINTER_PLUS_EXPR + || TREE_CODE (vy) != POINTER_PLUS_EXPR) + return false; + + ox = tree_low_cst (TREE_OPERAND (vx, 1), 1); + oy = tree_low_cst (TREE_OPERAND (vx, 1), 1); + + if (ox != oy) + return false; + + vx = TREE_OPERAND (vx, 0); + vy = TREE_OPERAND (vy, 0); + if (TREE_CODE (vx) != ADDR_EXPR + || TREE_CODE (vy) != ADDR_EXPR) + return false; + + if (TREE_OPERAND (vx, 0) == TREE_OPERAND (vy, 0)) + return true; +} + if (TREE_CODE (x) == TREE_BINFO || TREE_CODE (y) == TREE_BINFO) return false;
Re: [Patch][Cilkplus branch] Adding include directory path to testsuite script
On Tue, Sep 6, 2011 at 7:30 AM, Iyer, Balaji V balaji.v.i...@intel.com wrote: Attached, please find a patch with the modifications you have suggested (adding the info in Changelog.cilk). Please remove the extra blank line in ChangLog. ChangeLog should simply say what you did, not why. H.J. Sorry for the mistake. Thanks, Balaji V. Iyer. -Original Message- From: H.J. Lu [mailto:hjl.to...@gmail.com] Sent: Tuesday, September 06, 2011 10:22 AM To: Iyer, Balaji V Cc: gcc-patches@gcc.gnu.org Subject: Re: [Patch][Cilkplus branch] Adding include directory path to testsuite script On Mon, Sep 5, 2011 at 9:52 PM, Iyer, Balaji V balaji.v.i...@intel.com wrote: Hello Everyone, This patch is for the Cilk Plus branch. It will add the include directory path it the testsuite script (cilk_plus.exp) in both gcc.dg/cilk-plus and g++.dg/cilk-plus directories. Thanking You, ChangeLog entries are missing. -- H.J. -- H.J.
RE: [Patch][Cilkplus branch] Adding include directory path to testsuite script
I fixed all the changed you have requested. Here is an updated patch. Thanks, Balaji V. Iyer. -Original Message- From: H.J. Lu [mailto:hjl.to...@gmail.com] Sent: Tuesday, September 06, 2011 10:41 AM To: Iyer, Balaji V Cc: gcc-patches@gcc.gnu.org Subject: Re: [Patch][Cilkplus branch] Adding include directory path to testsuite script On Tue, Sep 6, 2011 at 7:30 AM, Iyer, Balaji V balaji.v.i...@intel.com wrote: Attached, please find a patch with the modifications you have suggested (adding the info in Changelog.cilk). Please remove the extra blank line in ChangLog. ChangeLog should simply say what you did, not why. H.J. Sorry for the mistake. Thanks, Balaji V. Iyer. -Original Message- From: H.J. Lu [mailto:hjl.to...@gmail.com] Sent: Tuesday, September 06, 2011 10:22 AM To: Iyer, Balaji V Cc: gcc-patches@gcc.gnu.org Subject: Re: [Patch][Cilkplus branch] Adding include directory path to testsuite script On Mon, Sep 5, 2011 at 9:52 PM, Iyer, Balaji V balaji.v.i...@intel.com wrote: Hello Everyone, This patch is for the Cilk Plus branch. It will add the include directory path it the testsuite script (cilk_plus.exp) in both gcc.dg/cilk-plus and g++.dg/cilk-plus directories. Thanking You, ChangeLog entries are missing. -- H.J. -- H.J. diff --git a/gcc/testsuite/ChangeLog.cilk b/gcc/testsuite/ChangeLog.cilk index a311052..b018232 100644 --- a/gcc/testsuite/ChangeLog.cilk +++ b/gcc/testsuite/ChangeLog.cilk @@ -1,3 +1,9 @@ +2011-09-05 Balaji V. Iyer. balaji.v.i...@intel.com + + * gcc.dg/cilk-plus/cilk_plus.exp: Added -I + $(src_dir)../../libcilkrts/include. Also removed -fsyntax-only + * g++.dg/cilk-plus/cilk_plus.exp: Added -I + $(src_dir)../../libcilkrts/include. Also removed -fsyntax-only 2011-08-15 Balaji V. Iyer. balaji.v.i...@intel.com diff --git a/gcc/testsuite/g++.dg/cilk-plus/cilk_plus.exp b/gcc/testsuite/g++.dg/cilk-plus/cilk_plus.exp index 9f91b0c..8a9fdd4 100644 --- a/gcc/testsuite/g++.dg/cilk-plus/cilk_plus.exp +++ b/gcc/testsuite/g++.dg/cilk-plus/cilk_plus.exp @@ -18,6 +18,6 @@ load_lib g++-dg.exp dg-init -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cpp]] -fsyntax-only -w -lcilkrts -ldl +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cpp]] -w -lcilkrts -ldl -I $srcdir/../../libcilkrts/include dg-finish diff --git a/gcc/testsuite/gcc.dg/cilk-plus/cilk_plus.exp b/gcc/testsuite/gcc.dg/cilk-plus/cilk_plus.exp index b228b65..dcf096e 100644 --- a/gcc/testsuite/gcc.dg/cilk-plus/cilk_plus.exp +++ b/gcc/testsuite/gcc.dg/cilk-plus/cilk_plus.exp @@ -18,6 +18,6 @@ load_lib gcc-dg.exp dg-init -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] -fsyntax-only -lcilkrts -ldl -std=c99 +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] -ldl -lcilkrts -I $srcdir/../../libcilkrts/include -std=c99 dg-finish
Re: Vector Comparison patch
Here is a new version of the patch which considers the changes from 2011-09-02 Richard Guenther ChangeLog 20011-09-06 Artjoms Sinkarovs artyom.shinkar...@gmail.com gcc/ * fold-const.c (constant_boolean_node): Adjust the meaning of boolean for vector types: true = {-1,..}, false = {0,..}. (fold_unary_loc): Avoid conversion of vector comparison to boolean type. * expr.c (expand_expr_real_2): Expand vector comparison by building an appropriate VEC_COND_EXPR. * c-typeck.c (build_binary_op): Typecheck vector comparisons. (c_objc_common_truthvalue_conversion): Adjust. * tree-vect-generic.c (do_compare): Helper function. (expand_vector_comparison): Check if hardware supports vector comparison of the given type or expand vector piecewise. (expand_vector_operation): Treat comparison as binary operation of vector type. (expand_vector_operations_1): Adjust. * tree-cfg.c (verify_gimple_comparison): Adjust. gcc/config/i386 * i386.c (ix86_expand_sse_movcc): Consider a case when vcond operators are {-1,..} and {0,..}. gcc/doc * extend.texi: Adjust. gcc/testsuite * gcc.c-torture/execute/vector-compare-1.c: New test. * gcc.c-torture/execute/vector-compare-2.c: New test. * gcc.dg/vector-compare-1.c: New test. * gcc.dg/vector-compare-2.c: New test. bootstrapped and tested on x86_64-unknown-linux-gnu. Thanks, Artem. Index: gcc/doc/extend.texi === --- gcc/doc/extend.texi (revision 178579) +++ gcc/doc/extend.texi (working copy) @@ -6561,6 +6561,29 @@ invoke undefined behavior at runtime. W accesses for vector subscription can be enabled with @option{-Warray-bounds}. +In GNU C vector comparison is supported within standard comparison +operators: @code{==, !=, , =, , =}. Comparison operands can be +vector expressions of integer-type or real-type. Comparison between +integer-type vectors and real-type vectors are not supported. The +result of the comparison is a vector of the same width and number of +elements as the comparison operands with a signed integral element +type. + +Vectors are compared element-wise producing 0 when comparison is false +and -1 (constant of the appropriate type where all bits are set) +otherwise. Consider the following example. + +@smallexample +typedef int v4si __attribute__ ((vector_size (16))); + +v4si a = @{1,2,3,4@}; +v4si b = @{3,2,1,4@}; +v4si c; + +c = a b; /* The result would be @{0, 0,-1, 0@} */ +c = a == b; /* The result would be @{0,-1, 0,-1@} */ +@end smallexample + You can declare variables and use them in function calls and returns, as well as in assignments and some casts. You can specify a vector type as a return type for a function. Vector types can also be used as function Index: gcc/fold-const.c === --- gcc/fold-const.c(revision 178579) +++ gcc/fold-const.c(working copy) @@ -5934,7 +5934,15 @@ extract_muldiv_1 (tree t, tree c, enum t tree constant_boolean_node (bool value, tree type) { - if (type == integer_type_node) + if (TREE_CODE (type) == VECTOR_TYPE) +{ + tree tval; + + gcc_assert (TREE_CODE (TREE_TYPE (type)) == INTEGER_TYPE); + tval = build_int_cst (TREE_TYPE (type), value ? -1 : 0); + return build_vector_from_val (type, tval); +} + else if (type == integer_type_node) return value ? integer_one_node : integer_zero_node; else if (type == boolean_type_node) return value ? boolean_true_node : boolean_false_node; @@ -7670,6 +7678,16 @@ fold_unary_loc (location_t loc, enum tre return build2_loc (loc, TREE_CODE (op0), type, TREE_OPERAND (op0, 0), TREE_OPERAND (op0, 1)); + else if (TREE_CODE (type) == VECTOR_TYPE) + { + tree el_type = TREE_TYPE (type); + tree op_el_type = TREE_TYPE (TREE_TYPE (op0)); + + if (el_type == op_el_type) + return op0; + else + build1_loc (loc, VIEW_CONVERT_EXPR, type, op0); + } else if (!INTEGRAL_TYPE_P (type)) return build3_loc (loc, COND_EXPR, type, op0, constant_boolean_node (true, type), Index: gcc/testsuite/gcc.c-torture/execute/vector-compare-1.c === --- gcc/testsuite/gcc.c-torture/execute/vector-compare-1.c (revision 0) +++ gcc/testsuite/gcc.c-torture/execute/vector-compare-1.c (revision 0) @@ -0,0 +1,123 @@ +#define vector(elcount, type) \ +__attribute__((vector_size((elcount)*sizeof(type type + +#define check_compare(count, res, i0, i1, op, fmt) \ +do { \ +int __i; \ +for (__i = 0; __i count; __i ++) { \ + if ((res)[__i] !=
Re: Vector Comparison patch
On Tue, Sep 6, 2011 at 4:50 PM, Artem Shinkarov artyom.shinkar...@gmail.com wrote: Here is a new version of the patch which considers the changes from 2011-09-02 Richard Guenther ChangeLog 20011-09-06 Artjoms Sinkarovs artyom.shinkar...@gmail.com gcc/ * fold-const.c (constant_boolean_node): Adjust the meaning of boolean for vector types: true = {-1,..}, false = {0,..}. (fold_unary_loc): Avoid conversion of vector comparison to boolean type. Both changes have already been done. * expr.c (expand_expr_real_2): Expand vector comparison by building an appropriate VEC_COND_EXPR. I prefer Index: gcc/expr.c === *** gcc/expr.c.orig 2011-08-29 11:48:23.0 +0200 --- gcc/expr.c 2011-08-29 12:58:59.0 +0200 *** do_store_flag (sepops ops, rtx target, e *** 10309,10314 --- 10309,10325 STRIP_NOPS (arg0); STRIP_NOPS (arg1); + /* For vector typed comparisons emit code to generate the desired + all-ones or all-zeros mask. Conveniently use the VEC_COND_EXPR + expander for this. */ + if (TREE_CODE (ops-type) == VECTOR_TYPE) + { + tree ifexp = build2 (ops-code, ops-type, arg0, arg1); + tree if_true = constant_boolean_node (true, ops-type); + tree if_false = constant_boolean_node (false, ops-type); + return expand_vec_cond_expr (ops-type, ifexp, if_true, if_false, target); + } + /* Get the rtx comparison code to use. We know that EXP is a comparison as I said multiple times. * c-typeck.c (build_binary_op): Typecheck vector comparisons. (c_objc_common_truthvalue_conversion): Adjust. * tree-vect-generic.c (do_compare): Helper function. (expand_vector_comparison): Check if hardware supports vector comparison of the given type or expand vector piecewise. (expand_vector_operation): Treat comparison as binary operation of vector type. (expand_vector_operations_1): Adjust. * tree-cfg.c (verify_gimple_comparison): Adjust. The tree-cfg.c change has already been done. Richard. gcc/config/i386 * i386.c (ix86_expand_sse_movcc): Consider a case when vcond operators are {-1,..} and {0,..}. gcc/doc * extend.texi: Adjust. gcc/testsuite * gcc.c-torture/execute/vector-compare-1.c: New test. * gcc.c-torture/execute/vector-compare-2.c: New test. * gcc.dg/vector-compare-1.c: New test. * gcc.dg/vector-compare-2.c: New test. bootstrapped and tested on x86_64-unknown-linux-gnu. Thanks, Artem.
Re: [Patch][Cilkplus branch] Adding include directory path to testsuite script
You should just say * g++.dg/cilk-plus/cilk_plus.exp: Likewise since the change is the same as above. H.J. On Tue, Sep 6, 2011 at 7:45 AM, Iyer, Balaji V balaji.v.i...@intel.com wrote: I fixed all the changed you have requested. Here is an updated patch. Thanks, Balaji V. Iyer. -Original Message- From: H.J. Lu [mailto:hjl.to...@gmail.com] Sent: Tuesday, September 06, 2011 10:41 AM To: Iyer, Balaji V Cc: gcc-patches@gcc.gnu.org Subject: Re: [Patch][Cilkplus branch] Adding include directory path to testsuite script On Tue, Sep 6, 2011 at 7:30 AM, Iyer, Balaji V balaji.v.i...@intel.com wrote: Attached, please find a patch with the modifications you have suggested (adding the info in Changelog.cilk). Please remove the extra blank line in ChangLog. ChangeLog should simply say what you did, not why. H.J. Sorry for the mistake. Thanks, Balaji V. Iyer. -Original Message- From: H.J. Lu [mailto:hjl.to...@gmail.com] Sent: Tuesday, September 06, 2011 10:22 AM To: Iyer, Balaji V Cc: gcc-patches@gcc.gnu.org Subject: Re: [Patch][Cilkplus branch] Adding include directory path to testsuite script On Mon, Sep 5, 2011 at 9:52 PM, Iyer, Balaji V balaji.v.i...@intel.com wrote: Hello Everyone, This patch is for the Cilk Plus branch. It will add the include directory path it the testsuite script (cilk_plus.exp) in both gcc.dg/cilk-plus and g++.dg/cilk-plus directories. Thanking You, ChangeLog entries are missing. -- H.J. -- H.J. -- H.J.
RE: [Patch][Cilkplus branch] Adding include directory path to testsuite script
Sure! Here is the fixed patch. Thanks, Balaji V. Iyer. -Original Message- From: H.J. Lu [mailto:hjl.to...@gmail.com] Sent: Tuesday, September 06, 2011 10:57 AM To: Iyer, Balaji V Cc: gcc-patches@gcc.gnu.org Subject: Re: [Patch][Cilkplus branch] Adding include directory path to testsuite script You should just say * g++.dg/cilk-plus/cilk_plus.exp: Likewise since the change is the same as above. H.J. On Tue, Sep 6, 2011 at 7:45 AM, Iyer, Balaji V balaji.v.i...@intel.com wrote: I fixed all the changed you have requested. Here is an updated patch. Thanks, Balaji V. Iyer. -Original Message- From: H.J. Lu [mailto:hjl.to...@gmail.com] Sent: Tuesday, September 06, 2011 10:41 AM To: Iyer, Balaji V Cc: gcc-patches@gcc.gnu.org Subject: Re: [Patch][Cilkplus branch] Adding include directory path to testsuite script On Tue, Sep 6, 2011 at 7:30 AM, Iyer, Balaji V balaji.v.i...@intel.com wrote: Attached, please find a patch with the modifications you have suggested (adding the info in Changelog.cilk). Please remove the extra blank line in ChangLog. ChangeLog should simply say what you did, not why. H.J. Sorry for the mistake. Thanks, Balaji V. Iyer. -Original Message- From: H.J. Lu [mailto:hjl.to...@gmail.com] Sent: Tuesday, September 06, 2011 10:22 AM To: Iyer, Balaji V Cc: gcc-patches@gcc.gnu.org Subject: Re: [Patch][Cilkplus branch] Adding include directory path to testsuite script On Mon, Sep 5, 2011 at 9:52 PM, Iyer, Balaji V balaji.v.i...@intel.com wrote: Hello Everyone, This patch is for the Cilk Plus branch. It will add the include directory path it the testsuite script (cilk_plus.exp) in both gcc.dg/cilk-plus and g++.dg/cilk-plus directories. Thanking You, ChangeLog entries are missing. -- H.J. -- H.J. -- H.J. diff --git a/gcc/testsuite/ChangeLog.cilk b/gcc/testsuite/ChangeLog.cilk index a311052..a602b88 100644 --- a/gcc/testsuite/ChangeLog.cilk +++ b/gcc/testsuite/ChangeLog.cilk @@ -1,3 +1,8 @@ +2011-09-05 Balaji V. Iyer. balaji.v.i...@intel.com + + * gcc.dg/cilk-plus/cilk_plus.exp: Added -I + $(src_dir)../../libcilkrts/include. Also removed -fsyntax-only + * g++.dg/cilk-plus/cilk_plus.exp: Likewise 2011-08-15 Balaji V. Iyer. balaji.v.i...@intel.com diff --git a/gcc/testsuite/g++.dg/cilk-plus/cilk_plus.exp b/gcc/testsuite/g++.dg/cilk-plus/cilk_plus.exp index 9f91b0c..8a9fdd4 100644 --- a/gcc/testsuite/g++.dg/cilk-plus/cilk_plus.exp +++ b/gcc/testsuite/g++.dg/cilk-plus/cilk_plus.exp @@ -18,6 +18,6 @@ load_lib g++-dg.exp dg-init -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cpp]] -fsyntax-only -w -lcilkrts -ldl +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cpp]] -w -lcilkrts -ldl -I $srcdir/../../libcilkrts/include dg-finish diff --git a/gcc/testsuite/gcc.dg/cilk-plus/cilk_plus.exp b/gcc/testsuite/gcc.dg/cilk-plus/cilk_plus.exp index b228b65..dcf096e 100644 --- a/gcc/testsuite/gcc.dg/cilk-plus/cilk_plus.exp +++ b/gcc/testsuite/gcc.dg/cilk-plus/cilk_plus.exp @@ -18,6 +18,6 @@ load_lib gcc-dg.exp dg-init -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] -fsyntax-only -lcilkrts -ldl -std=c99 +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] -ldl -lcilkrts -I $srcdir/../../libcilkrts/include -std=c99 dg-finish
Re: [PATCH] check_cfg assert fix
On Tue, Sep 6, 2011 at 11:14 AM, Tom de Vries vr...@codesourcery.com wrote: Hi, During testing the approved-for-commit middle-end patch for bug 43864 on ARM, I ran into a gcc.dg/torture/pr46068.c ICE. The following assert in haifa-sched.c:check_cfg triggered: ... else if (any_condjump_p (head)) gcc_assert (/* Usual case. */ (EDGE_COUNT (bb-succs) 1 !BARRIER_P (NEXT_INSN (head))) /* Or jump to the next instruction. */ || (EDGE_COUNT (bb-succs) == 1 (BB_HEAD (EDGE_I (bb-succs, 0)-dest) == JUMP_LABEL (head; ... It triggered on this rtl, a conditional return followed by a barrier: ... (jump_insn 44 43 93 7 (set (pc) (if_then_else (ne (reg:CC 24 cc) (const_int 0 [0])) (return) (pc))) gcc/testsuite/gcc.dg/builtin-unreachable-4.c:13 249 {*cond_return} (expr_list:REG_DEAD (reg:CC 24 cc) (expr_list:REG_BR_PROB (const_int 9996 [0x270c]) (nil))) - return) (barrier 93 44 92) ... Although this insn sequence is non-optimal (the conditional return can be optimized to an unconditional one, given that it's followed by a barrier), it's not incorrect. The patch fixes this ICE by removing the check for the 'EDGE_COUNT (bb-succs) == 1' case. Bootstrapped and reg-tested on x86_64 and build and reg-tested on arm. OK for trunk? No. If the conditional return is not taken, you should not fall into a barrier. It looks like the CFG somehow got corrupted, and if that's indeed the case then your patch just papers over the problem. That follows after the barrier? Ciao! Steven
Re: [Ada] Speed up build of gnatools
On 09/06/2011 01:56 PM, Arnaud Charlet wrote: this means using as many processes as there are CPUs, right? It seems pretty Right, but only for gnattools, which is a relatively short time, and which always occurs at the end of the build (so with nothing else running at the same time). dubious to me to use more processes than the user maybe asked for. For example I have to restrict the number of CPUs used when building GCC to less than I have since otherwise my machine overheats and turns itself off. Is there some way to get at the -j level the user passed to the top-level make and use that? No, I'm not aware of a way to get this information. The solution would be to support running gnatmake as a client of make's job server. In short: 1) gnatmake should look for the MAKEFLAGS environment variable, and look for the --jobserver-fds= option found inside it. The option receives a comma-separated list of two file descriptors. The first is an input pipe, the second is an output pipe. 2) before invoking any child process, gnatmake should ensure the child doesn't see the two pipes (unless the child were also an instance of make/gnatmake). 3) *after* invoking any child process, gnatmake should perform a blocking 1-byte read from the input pipe. 4) after reaping any child process, gnatmake should perform a blocking 1-byte write to the output pipe. 5) you should add a + in front of rules that use gnatmake. Paolo
Re: RFA: MN10300: Add jump label to Lcc insn
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 09/06/11 07:01, Nick Clifton wrote: Hi Jeff, Hi Alex, The MN10300 target is currently failing to build in the mainline FSF sources because of this error when creating libgcc: gcc/libgcc2.c: In function '__popcountsi2': gcc/libgcc2.c:834:1: internal compiler error: in create_trace_edges, at dwarf2cfi.c:2325 This turns out to be because the code in create_trace_edges does not handle jumps inside parallel insns, like this: (jump_insn 72 52 31 3 (parallel [ (set (pc) (if_then_else (ne (reg:CC 51 EPSW) (const_int 0 [0])) (label_ref 29) (pc))) (unspec [ (const_int 1 [0x1]) ] 9) ]) gcc/libgcc2.c:830 -1 (insn_list:REG_LABEL_OPERAND 29 (nil))) I am not sure if create_trace_edges should handle this, but I felt that the easiest thing to do was to fix the MN10300 backend so that when it was creating this insn, it would also set the label on the parallel container. That is what the patch below does and with this applied I can build the toolchain again. OK to apply, or is there a better way to fix the problem ? Cheers Nick gcc/ChangeLog 2011-09-06 Nick Clifton ni...@redhat.com * config/mn10300/mn10300.c (mn10300_insert_setlb_lcc): Set the jump label on the parallel part of the insn. Normally the JUMP_LABEL is set by the generic parts of the compiler; however, jumps created via the md_reorg hook need explicitly have their JUMP_LABEL set by the backend. OK. jeff -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJOZjs5AAoJEBRtltQi2kC7jJkH/0XQmZiche6+zgwdkq9rxLAs BBILnHF4cHsj8lb12lL3r7CY32JrXVE+jl1o2xz5uR1gWUd4Hnf3EVQ0z7feNfda CQLUJUHTbCVTIOLZqLtMuwB4IVQFiRKFSdNxTE/ZYUG3gvHuN6vVEjbJW/+rzPei MMhc0jq2uFUvazdnHJQ9rW6mQuk51Y66CWOTft21mrOnm2SzeKZ+tKM0TiTOYOOT xSkT3Ni6wMPQe9sey1Bub+r4S0LWo2ER2aV2/Owg6j5k/ChDFYYcKCci+pLBSKGe J4QdG4LdJjzLIvFf4YB4OQo9NGFVvlD5+lRXYW+QgYNmsM+nrqmFpC4C2eW04fk= =jpY2 -END PGP SIGNATURE-
Re: Vector shuffling
On Sat, Sep 3, 2011 at 5:52 PM, Artem Shinkarov artyom.shinkar...@gmail.com wrote: On Fri, Sep 2, 2011 at 8:52 PM, Joseph S. Myers jos...@codesourcery.com wrote: On Fri, 2 Sep 2011, Artem Shinkarov wrote: Joseph, I don't understand this comment. I have 2 or 3 arguments in the VEC_SHUFFLE_EXPR and any of them can be C_MAYBE_CONST_EXPR, Yes. so I need to wrap mask (the last argument) to avoid the following failure: No. You need to fold it (c_fully_fold) to eliminate any C_MAYBE_CONST_EXPR it contains, but you shouldn't need to wrap the result of folding in a SAVE_EXPR. Ok, Now I get it, thanks. In the attachment there is a new version of the patch that removes save-exprs. You are missing a ChangeLog entry + +res = __builtin_shuffle (a, mask1); /* res is @{1,2,2,4@} */ +res = __builtin_shuffle2 (a, b, mask2); /* res is @{1,5,3,6@} */ should be __builtin_shuffle (a, b, mask2); +bool +expand_vec_shuffle_expr_p (enum machine_mode mode, tree v0, + tree v1, tree mask) +{ + int v0_mode_s = GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (TREE_TYPE (v0; + int mask_mode_s = GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (TREE_TYPE (mask; + + if (TREE_CODE (mask) == VECTOR_CST + targetm.vectorize.builtin_vec_perm_ok (TREE_TYPE (v0), mask)) +return true; + + if (v0 != v1 || v0_mode_s != mask_mode_s) +return false; the mask size check constrains the size of the vector elements but not their count. It looks like you should instead verify the vector modes are equal? At least that would match the fact that you have an expander that distinguishes one operand mode only. At some point we definitely want to merge the builtin_vec_perm_* target hooks with the optab. + fn = copy_node (fn); You shouldn't need to copy fn + call = fold_build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (fn)), fn); + call = build_call_nary (type /* ? */, call, 3, v0, v1, mask); + + t = expand_normal (call); + target = gen_reg_rtx (mode); + emit_insn (gen_rtx_SET (VOIDmode, target, t)); why can't you simply use return expand_expr_real_1 (call, target, VOIDmode, EXPAND_NORMAL, NULL); here? + case VEC_SHUFFLE_EXPR: + { + enum gimplify_status r0, r1, r2; + + if (TREE_OPERAND (*expr_p, 0) == TREE_OPERAND (*expr_p, 1)) + { + r0 = r1 = gimplify_expr (TREE_OPERAND (*expr_p, 0), pre_p, +post_p, is_gimple_val, fb_rvalue); + TREE_OPERAND (*expr_p, 1) = TREE_OPERAND (*expr_p, 0); + } + else + { +r0 = gimplify_expr (TREE_OPERAND (*expr_p, 0), pre_p, +post_p, is_gimple_val, fb_rvalue); +r1 = gimplify_expr (TREE_OPERAND (*expr_p, 1), pre_p, +post_p, is_gimple_val, fb_rvalue); + } please avoid the above tree sharing (I realize it's probably for constants, but we don't share those). Thus, unconditionally gimplify both operands. The equality check in expanding should probably use operand_equal_p (..., ..., 0) instead of a pointer comparison. Thus, the above should simply use the expr_3: code, like FMA_EXPR. +/* Vector shuffle expression. A = VEC_SHUFFLE_EXPRv0, v1, maks + means + + freach i in length (mask): foreach + number of elements in V0 and V1. The size of the inner type + of the MASK and of the V0 and V1 must be the same. Index: gcc/tree-cfg.c === --- gcc/tree-cfg.c (revision 178354) +++ gcc/tree-cfg.c (working copy) @@ -3713,6 +3713,7 @@ verify_gimple_assign_ternary (gimple stm case DOT_PROD_EXPR: case REALIGN_LOAD_EXPR: +case VEC_SHUFFLE_EXPR: /* FIXME. */ return false; can you do some basic verification here? At least what you document in tree.def should be verified here. Index: gcc/tree-vect-generic.c === --- gcc/tree-vect-generic.c (revision 178354) +++ gcc/tree-vect-generic.c (working copy) @@ -30,6 +30,7 @@ along with GCC; see the file COPYING3. #include tree-pass.h #include flags.h #include ggc.h +#include diagnostic.h I don't see where you need this, nor a Makefile.in change. +/* Build a reference to the element of the vector VECT. Function two spaces after a '.' + if (TREE_CODE (vect) == VECTOR_CST) +{ +unsigned i; +tree vals = TREE_VECTOR_CST_ELTS (vect); +for (i = 0; vals; vals = TREE_CHAIN (vals), ++i) + if (i == index) operand_equal_p + else if (TREE_CODE (vect) == SSA_NAME) +{ + tree el; + gimple vectdef = SSA_NAME_DEF_STMT (vect); + if (gimple_assign_single_p (vectdef) + (el = vector_element (gsi, gimple_assign_rhs1 (vectdef), +
Re: [PATCH, Atom] Improve AGU stalls avoidance optimization
On Tue, Sep 6, 2011 at 2:26 PM, Ilya Enkovich enkovich@gmail.com wrote: Is fixed version OK? Thanks, Ilya --- gcc/ 2011-09-06 Enkovich Ilya ilya.enkov...@intel.com * config/i386/i386-protos.h (ix86_lea_outperforms): New. (ix86_avoid_lea_for_add): Likewise. (ix86_avoid_lea_for_addr): Likewise. (ix86_split_lea_for_addr): Likewise. * config/i386/i386.c (LEA_MAX_STALL): New. (increase_distance): Likewise. (insn_defines_reg): Likewise. (insn_uses_reg_mem): Likewise. (distance_non_agu_define_in_bb): Likewise. (distance_agu_use_in_bb): Likewise. (ix86_lea_outperforms): Likewise. (ix86_ok_to_clobber_flags): Likewise. (ix86_avoid_lea_for_add): Likewise. (ix86_avoid_lea_for_addr): Likewise. (ix86_split_lea_for_addr): Likewise. (distance_non_agu_define): Search in pred BBs added. (distance_agu_use): Search in succ BBs added. (IX86_LEA_PRIORITY): Value changed from 2 to 0. (LEA_SEARCH_THRESHOLD): Now depends on LEA_MAX_STALL. (ix86_lea_for_add_ok): Use ix86_lea_outperforms to make decision. * config/i386/i386.md: Splits added to transform lea into a sequence of instructions. Please merge your new splitters with corresponding LEA patterns. OK with this change. Thanks, Uros.
Re: [PATCH Atom][PR middle-end/44382] Tree reassociation improvement
On Tue, Sep 6, 2011 at 2:39 PM, Ilya Enkovich enkovich@gmail.com wrote: I assume that you need to split tune attribute to int and FP part to handle reassociation for other targets, since Atom handles both in the same way. Please also describe function return value in the comment (and perhaps in documentation, too). OK with this addition. Thanks, Uros. Here is patch with added comment for hook implementation. Is it OK? Thanks, Ilya --- gcc/ 2011-09-06 Enkovich Ilya ilya.enkov...@intel.com PR middle-end/44382 * target.def (reassociation_width): New hook. * doc/tm.texi.in (reassociation_width): Likewise. * doc/tm.texi (reassociation_width): Likewise. * doc/invoke.texi (tree-reassoc-width): New param documented. * hooks.h (hook_int_uint_mode_1): New default hook. * hooks.c (hook_int_uint_mode_1): Likewise. * config/i386/i386.h (ix86_tune_indices): Add X86_TUNE_REASSOC_INT_TO_PARALLEL and X86_TUNE_REASSOC_FP_TO_PARALLEL. (TARGET_REASSOC_INT_TO_PARALLEL): New. (TARGET_REASSOC_FP_TO_PARALLEL): Likewise. * config/i386/i386.c (initial_ix86_tune_features): Add X86_TUNE_REASSOC_INT_TO_PARALLEL and X86_TUNE_REASSOC_FP_TO_PARALLEL. (ix86_reassociation_width) implementation of new hook for i386 target. * params.def (PARAM_TREE_REASSOC_WIDTH): New param added. * tree-ssa-reassoc.c (get_required_cycles): New function. (get_reassociation_width): Likewise. (swap_ops_for_binary_stmt): Likewise. (rewrite_expr_tree_parallel): Likewise. (rewrite_expr_tree): Refactored. Part of code moved into swap_ops_for_binary_stmt. (reassociate_bb): Now checks reassociation width to be used and call rewrite_expr_tree_parallel instead of rewrite_expr_tree if needed. gcc/testsuite/ 2011-09-06 Enkovich Ilya ilya.enkov...@intel.com * gcc.dg/tree-ssa/pr38533.c (dg-options): Added option --param tree-reassoc-width=1. * gcc.dg/tree-ssa/reassoc-24.c: New test. * gcc.dg/tree-ssa/reassoc-25.c: Likewise. OK. Thanks, Uros.
[PATCH] Fix PR47025
This fixes PR47025, __builtin_va_end is preventing dead store elimination and __builtin_va_start is an escape point for the valist. Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk. Richard. 2011-09-06 Richard Guenther rguent...@suse.de PR tree-optimization/47025 * tree-ssa-alias.c (ref_maybe_used_by_call_p_1): BUILT_IN_VA_END uses nothing. (call_may_clobber_ref_p_1): BUILT_IN_VA_END is a barrier like BUILT_IN_FREE. (stmt_kills_ref_p_1): BUILT_IN_VA_END kills what its argument definitely points to. * tree-ssa-structalias.c (find_func_aliases_for_builtin_call): BUILT_IN_VA_START doesn't let its va_list argument escape. * tree-ssa-dce.c (propagate_necessity): BUILT_IN_VA_END does not make any previous stores necessary. Index: gcc/tree-ssa-alias.c === *** gcc/tree-ssa-alias.c.orig 2011-09-06 16:24:16.0 +0200 --- gcc/tree-ssa-alias.c2011-09-06 16:28:48.0 +0200 *** ref_maybe_used_by_call_p_1 (gimple call, *** 1254,1259 --- 1254,1260 case BUILT_IN_SINCOSF: case BUILT_IN_SINCOSL: case BUILT_IN_ASSUME_ALIGNED: + case BUILT_IN_VA_END: return false; /* __sync_* builtins and some OpenMP builtins act as threading barriers. */ *** call_may_clobber_ref_p_1 (gimple call, a *** 1518,1523 --- 1519,1525 the call has to serve as a barrier for moving loads and stores across it. */ case BUILT_IN_FREE: + case BUILT_IN_VA_END: { tree ptr = gimple_call_arg (call, 0); return ptr_deref_may_alias_ref_p_1 (ptr, ref); *** stmt_kills_ref_p_1 (gimple stmt, ao_ref *** 1763,1772 / BITS_PER_UNIT))) return true; } } default:; } - } return false; } --- 1765,1787 / BITS_PER_UNIT))) return true; } + break; + } + + case BUILT_IN_VA_END: + { + tree ptr = gimple_call_arg (stmt, 0); + if (TREE_CODE (ptr) == ADDR_EXPR) + { + tree base = ao_ref_base (ref); + if (TREE_OPERAND (ptr, 0) == base) + return true; + } + break; } + default:; } } return false; } Index: gcc/tree-ssa-structalias.c === *** gcc/tree-ssa-structalias.c.orig 2011-09-06 16:23:29.0 +0200 --- gcc/tree-ssa-structalias.c 2011-09-06 16:24:18.0 +0200 *** find_func_aliases_for_builtin_call (gimp *** 4187,4213 mode as well. */ case BUILT_IN_VA_START: { if (in_ipa_mode) { - tree valist = gimple_call_arg (t, 0); - struct constraint_expr rhs, *lhsp; - unsigned i; - /* The va_list gets access to pointers in variadic -arguments. */ fi = lookup_vi_for_tree (cfun-decl); - gcc_assert (fi != NULL); - get_constraint_for (valist, lhsc); - do_deref (lhsc); rhs = get_function_part_constraint (fi, ~0); rhs.type = ADDRESSOF; - FOR_EACH_VEC_ELT (ce_s, lhsc, i, lhsp) - process_constraint (new_constraint (*lhsp, rhs)); - VEC_free (ce_s, heap, lhsc); - /* va_list is clobbered. */ - make_constraint_to (get_call_clobber_vi (t)-id, valist); - return true; } ! break; } /* va_end doesn't have any effect that matters. */ case BUILT_IN_VA_END: --- 4187,4218 mode as well. */ case BUILT_IN_VA_START: { + tree valist = gimple_call_arg (t, 0); + struct constraint_expr rhs, *lhsp; + unsigned i; + get_constraint_for (valist, lhsc); + do_deref (lhsc); + /* The va_list gets access to pointers in variadic +arguments. Which we know in the case of IPA analysis +and otherwise are just all nonlocal variables. */ if (in_ipa_mode) { fi = lookup_vi_for_tree (cfun-decl); rhs = get_function_part_constraint (fi, ~0); rhs.type = ADDRESSOF; } ! else ! { ! rhs.var = nonlocal_id; ! rhs.type = ADDRESSOF; ! rhs.offset = 0; ! } ! FOR_EACH_VEC_ELT (ce_s, lhsc, i, lhsp) ! process_constraint (new_constraint (*lhsp, rhs)); ! VEC_free (ce_s, heap, lhsc); ! /* va_list is clobbered. */ !
Re: [PATCH Atom][PR middle-end/44382] Tree reassociation improvement
2011/9/6 Uros Bizjak ubiz...@gmail.com: OK. Thanks, Uros. Could please someone check it in for me? Thanks, Ilya
Re: [Patch, Ada, Darwin] Restore PowerPC Darwin Ada bootstrap (after a looong time, it seems).
On Sep 6, 2011, at 1:12 AM, Eric Botcazou wrote: That's a good question, and one that I haven't got to the bottom of - but the exclusion was there in the original code-base [still in the vendor's tree too]. (also, the rs6000 pro/epilogue code is not the easiest to navigate). Assuming that this is because the non-local goto handler needs to find a register saved at a canonical place, you can try !cfun-has_nonlocal_label. This will subsume the original check !(cfun-calls_setjmp flag_exceptions) as both the regular SJLJ scheme and the GNAT SJLJ scheme use it. I can't confirm the assumption, but, if it holds, sounds nicer to me, thanks.
[patch][google/integration] Add lightweight checks to vector::begin et. al. (issue4973065)
Greetings, This patch adds a lightweight self-consistency check to many vector operations. Google issue 5246356. Ok for google/integration branch? Thanks, -- 2011-09-06 Paul Pluzhnikov ppluzhni...@google.com * include/bits/stl_vector.h (__is_valid): New function. (begin, end, size, capacity, swap, clear): Call it. * include/bits/vector.tcc (operator=): Likewise. Index: include/bits/stl_vector.h === --- include/bits/stl_vector.h (revision 178493) +++ include/bits/stl_vector.h (working copy) @@ -234,6 +234,16 @@ using _Base::_M_impl; using _Base::_M_get_Tp_allocator; + bool __is_valid() const + { +return (this-_M_impl._M_end_of_storage == 0 +this-_M_impl._M_start == 0 +this-_M_impl._M_finish == 0) + || (this-_M_impl._M_start = this-_M_impl._M_finish + this-_M_impl._M_finish = this-_M_impl._M_end_of_storage + this-_M_impl._M_start this-_M_impl._M_end_of_storage); + } + public: // [23.2.4.1] construct/copy/destroy // (assign() and get_allocator() are also listed in this section) @@ -531,7 +541,13 @@ */ iterator begin() _GLIBCXX_NOEXCEPT - { return iterator(this-_M_impl._M_start); } + { +#if __google_stl_debug_dangling_vector +if (!this-__is_valid()) + __throw_logic_error(begin() on corrupt (dangling?) vector); +#endif + return iterator(this-_M_impl._M_start); + } /** * Returns a read-only (constant) iterator that points to the @@ -540,7 +556,13 @@ */ const_iterator begin() const _GLIBCXX_NOEXCEPT - { return const_iterator(this-_M_impl._M_start); } + { +#if __google_stl_debug_dangling_vector +if (!this-__is_valid()) + __throw_logic_error(begin() on corrupt (dangling?) vector); +#endif + return const_iterator(this-_M_impl._M_start); + } /** * Returns a read/write iterator that points one past the last @@ -549,7 +571,13 @@ */ iterator end() _GLIBCXX_NOEXCEPT - { return iterator(this-_M_impl._M_finish); } + { +#if __google_stl_debug_dangling_vector +if (!this-__is_valid()) + __throw_logic_error(end() on corrupt (dangling?) vector); +#endif + return iterator(this-_M_impl._M_finish); + } /** * Returns a read-only (constant) iterator that points one past @@ -558,7 +586,13 @@ */ const_iterator end() const _GLIBCXX_NOEXCEPT - { return const_iterator(this-_M_impl._M_finish); } + { +#if __google_stl_debug_dangling_vector +if (!this-__is_valid()) + __throw_logic_error(end() on corrupt (dangling?) vector); +#endif + return const_iterator(this-_M_impl._M_finish); + } /** * Returns a read/write reverse iterator that points to the @@ -638,7 +672,13 @@ /** Returns the number of elements in the %vector. */ size_type size() const _GLIBCXX_NOEXCEPT - { return size_type(this-_M_impl._M_finish - this-_M_impl._M_start); } + { +#if __google_stl_debug_dangling_vector +if (!this-__is_valid()) + __throw_logic_error(size() on corrupt (dangling?) vector); +#endif + return size_type(this-_M_impl._M_finish - this-_M_impl._M_start); + } /** Returns the size() of the largest possible %vector. */ size_type @@ -718,7 +758,12 @@ */ size_type capacity() const _GLIBCXX_NOEXCEPT - { return size_type(this-_M_impl._M_end_of_storage + { +#if __google_stl_debug_dangling_vector +if (!this-__is_valid()) + __throw_logic_error(capacity() on corrupt (dangling?) vector); +#endif + return size_type(this-_M_impl._M_end_of_storage - this-_M_impl._M_start); } /** @@ -1112,6 +1157,10 @@ noexcept(_Alloc_traits::_S_nothrow_swap()) #endif { +#if __google_stl_debug_dangling_vector +if (!this-__is_valid() || !__x.__is_valid()) + __throw_logic_error(swap() on corrupt (dangling?) vector); +#endif this-_M_impl._M_swap_data(__x._M_impl); _Alloc_traits::_S_on_swap(_M_get_Tp_allocator(), __x._M_get_Tp_allocator()); @@ -1125,7 +1174,13 @@ */ void clear() _GLIBCXX_NOEXCEPT - { _M_erase_at_end(this-_M_impl._M_start); } + { +#if __google_stl_debug_dangling_vector +if (!this-__is_valid()) + __throw_logic_error(clear() on corrupt (dangling?) vector); +#endif + _M_erase_at_end(this-_M_impl._M_start); + } protected: /** Index: include/bits/vector.tcc === --- include/bits/vector.tcc (revision 178493) +++ include/bits/vector.tcc
Re: [Patch][Cilkplus branch] Adding include directory path to testsuite script
On Tue, Sep 6, 2011 at 8:01 AM, Iyer, Balaji V balaji.v.i...@intel.com wrote: Sure! Here is the fixed patch. It won't apply. Please make sure that it is against cilkplus branch. H.J. Thanks, Balaji V. Iyer. -Original Message- From: H.J. Lu [mailto:hjl.to...@gmail.com] Sent: Tuesday, September 06, 2011 10:57 AM To: Iyer, Balaji V Cc: gcc-patches@gcc.gnu.org Subject: Re: [Patch][Cilkplus branch] Adding include directory path to testsuite script You should just say * g++.dg/cilk-plus/cilk_plus.exp: Likewise since the change is the same as above. H.J. On Tue, Sep 6, 2011 at 7:45 AM, Iyer, Balaji V balaji.v.i...@intel.com wrote: I fixed all the changed you have requested. Here is an updated patch. Thanks, Balaji V. Iyer. -Original Message- From: H.J. Lu [mailto:hjl.to...@gmail.com] Sent: Tuesday, September 06, 2011 10:41 AM To: Iyer, Balaji V Cc: gcc-patches@gcc.gnu.org Subject: Re: [Patch][Cilkplus branch] Adding include directory path to testsuite script On Tue, Sep 6, 2011 at 7:30 AM, Iyer, Balaji V balaji.v.i...@intel.com wrote: Attached, please find a patch with the modifications you have suggested (adding the info in Changelog.cilk). Please remove the extra blank line in ChangLog. ChangeLog should simply say what you did, not why. H.J. Sorry for the mistake. Thanks, Balaji V. Iyer. -Original Message- From: H.J. Lu [mailto:hjl.to...@gmail.com] Sent: Tuesday, September 06, 2011 10:22 AM To: Iyer, Balaji V Cc: gcc-patches@gcc.gnu.org Subject: Re: [Patch][Cilkplus branch] Adding include directory path to testsuite script On Mon, Sep 5, 2011 at 9:52 PM, Iyer, Balaji V balaji.v.i...@intel.com wrote: Hello Everyone, This patch is for the Cilk Plus branch. It will add the include directory path it the testsuite script (cilk_plus.exp) in both gcc.dg/cilk-plus and g++.dg/cilk-plus directories. Thanking You, ChangeLog entries are missing.
Re: [patch][google/integration] Add lightweight checks to vector::begin et. al. (issue4973065)
On Tue, Sep 6, 2011 at 9:28 AM, Paul Pluzhnikov ppluzhni...@google.com wrote: This patch adds a lightweight self-consistency check to many vector operations. Google issue 5246356. Sorry, forgot to mention: tested by doing bootstrap and make check on Linux/x86_64. -- Paul Pluzhnikov
Re: [PATCH Atom][PR middle-end/44382] Tree reassociation improvement
On Tue, Sep 6, 2011 at 9:07 AM, Ilya Enkovich enkovich@gmail.com wrote: 2011/9/6 Uros Bizjak ubiz...@gmail.com: OK. Thanks, Uros. Could please someone check it in for me? I checked it in for you. -- H.J.
Re: [patch][google/integration] Add lightweight checks to vector::begin et. al. (issue4973065)
On Tue, Sep 6, 2011 at 12:28, Paul Pluzhnikov ppluzhni...@google.com wrote: Greetings, This patch adds a lightweight self-consistency check to many vector operations. Google issue 5246356. Ok for google/integration branch? Thanks, -- 2011-09-06 Paul Pluzhnikov ppluzhni...@google.com * include/bits/stl_vector.h (__is_valid): New function. (begin, end, size, capacity, swap, clear): Call it. * include/bits/vector.tcc (operator=): Likewise. OK. Any reason not to send this (or a variant) to mainline? Diego.
Re: [Patch][Cilkplus branch] Adding include directory path to testsuite script
diff --git a/gcc/testsuite/ChangeLog.cilk b/gcc/testsuite/ChangeLog.cilk index c9eac87..a602b88 100644 --- a/gcc/testsuite/ChangeLog.cilk +++ b/gcc/testsuite/ChangeLog.cilk @@ -1,3 +1,9 @@ +2011-09-05 Balaji V. Iyer. balaji.v.i...@intel.com ^^ Your name should be followed by 2 spaces, not a period. + + * gcc.dg/cilk-plus/cilk_plus.exp: Added -I + $(src_dir)../../libcilkrts/include. Also removed -fsyntax-only + * g++.dg/cilk-plus/cilk_plus.exp: Likewise + On Tue, Sep 6, 2011 at 10:22 AM, Iyer, Balaji V balaji.v.i...@intel.com wrote: Ok..try it now.. I did git diff origin/cilkplus. Thanks, Balaji V. Iyer. -Original Message- From: H.J. Lu [mailto:hjl.to...@gmail.com] Sent: Tuesday, September 06, 2011 12:37 PM To: Iyer, Balaji V Subject: Re: [Patch][Cilkplus branch] Adding include directory path to testsuite script Please use git diff origin/cilkplus to generate patch. On Tue, Sep 6, 2011 at 9:36 AM, H.J. Lu hjl.to...@gmail.com wrote: On Tue, Sep 6, 2011 at 8:01 AM, Iyer, Balaji V balaji.v.i...@intel.com wrote: Sure! Here is the fixed patch. It won't apply. Please make sure that it is against cilkplus branch. H.J. Thanks, Balaji V. Iyer. -Original Message- From: H.J. Lu [mailto:hjl.to...@gmail.com] Sent: Tuesday, September 06, 2011 10:57 AM To: Iyer, Balaji V Cc: gcc-patches@gcc.gnu.org Subject: Re: [Patch][Cilkplus branch] Adding include directory path to testsuite script You should just say * g++.dg/cilk-plus/cilk_plus.exp: Likewise since the change is the same as above. H.J. On Tue, Sep 6, 2011 at 7:45 AM, Iyer, Balaji V balaji.v.i...@intel.com wrote: I fixed all the changed you have requested. Here is an updated patch. Thanks, Balaji V. Iyer. -Original Message- From: H.J. Lu [mailto:hjl.to...@gmail.com] Sent: Tuesday, September 06, 2011 10:41 AM To: Iyer, Balaji V Cc: gcc-patches@gcc.gnu.org Subject: Re: [Patch][Cilkplus branch] Adding include directory path to testsuite script On Tue, Sep 6, 2011 at 7:30 AM, Iyer, Balaji V balaji.v.i...@intel.com wrote: Attached, please find a patch with the modifications you have suggested (adding the info in Changelog.cilk). Please remove the extra blank line in ChangLog. ChangeLog should simply say what you did, not why. H.J. Sorry for the mistake. Thanks, Balaji V. Iyer. -Original Message- From: H.J. Lu [mailto:hjl.to...@gmail.com] Sent: Tuesday, September 06, 2011 10:22 AM To: Iyer, Balaji V Cc: gcc-patches@gcc.gnu.org Subject: Re: [Patch][Cilkplus branch] Adding include directory path to testsuite script On Mon, Sep 5, 2011 at 9:52 PM, Iyer, Balaji V balaji.v.i...@intel.com wrote: Hello Everyone, This patch is for the Cilk Plus branch. It will add the include directory path it the testsuite script (cilk_plus.exp) in both gcc.dg/cilk-plus and g++.dg/cilk-plus directories. Thanking You, ChangeLog entries are missing. -- H.J. -- H.J.
[PATCH] Make SRA produce integer replacements for enumeration types
Hi, the patch below makes SRA produce intere type replacements when it currently produces enumeration type ones because this then may cause VRP to assume wrong bounds (PR 49911). I do not know how to create a testcase for the PR this should solve because I could not reproduce it on yesterday's trunk checkout. The patch is against trunk, where it successfully passes bootstrap and testing on x86_64-linux, but applies well also to 4.6 and 4.5 branches and there has been a request to commit them there as well so I'd like to do so (after testing it on them which I have not done yet). OK? Thanks, Martin 2011-09-05 Martin Jambor mjam...@suse.cz PR tree-optimization/49911 * tree-sra.c (analyze_access_subtree): Change type of to-be-replaced enumerations to the corresponding plain integer type. Index: src/gcc/tree-sra.c === --- src.orig/gcc/tree-sra.c +++ src/gcc/tree-sra.c @@ -2075,13 +2075,25 @@ analyze_access_subtree (struct access *r || ((root-grp_scalar_read || root-grp_assignment_read) (root-grp_scalar_write || root-grp_assignment_write { + bool new_integer_type; + if (TREE_CODE (root-type) == ENUMERAL_TYPE) + { + tree rt = root-type; + root-type = build_nonstandard_integer_type (TYPE_PRECISION (rt), + TYPE_UNSIGNED (rt)); + new_integer_type = true; + } + else + new_integer_type = false; + if (dump_file (dump_flags TDF_DETAILS)) { fprintf (dump_file, Marking ); print_generic_expr (dump_file, root-base, 0); - fprintf (dump_file, offset: %u, size: %u: , + fprintf (dump_file, offset: %u, size: %u , (unsigned) root-offset, (unsigned) root-size); - fprintf (dump_file, to be replaced.\n); + fprintf (dump_file, to be replaced%s.\n, + new_integer_type ? with an integer: ); } root-grp_to_be_replaced = 1;
Re: [patch][google/integration] Add lightweight checks to vector::begin et. al. (issue4973065)
On Tue, Sep 6, 2011 at 12:54, Paul Pluzhnikov ppluzhni...@google.com wrote: On Tue, Sep 6, 2011 at 9:44 AM, Diego Novillo dnovi...@google.com wrote: OK. Any reason not to send this (or a variant) to mainline? AFAIU, mainline is not interested -- there is already a debug mode (enabled by _GLIBCXX_DEBUG), which catches many of the same bugs (and more), and introduction of parallel debug modes is undesirable. Unfortunately, _GLIBCXX_DEBUG makes no performance guarantees (making some normally constant-time operations O(N), etc.) and so we can't just turn it on in Google. Right. That's why I thought of a variant. Maybe we want to have levels of checking, or a _GLBICXX_DEBUG_FAST. But this is something to discuss with libstdc++ (CC'd). Diego. Thanks, -- Paul Pluzhnikov
Re: [PATCH, Atom] Improve AGU stalls avoidance optimization
2011/9/6 Uros Bizjak ubiz...@gmail.com: Please merge your new splitters with corresponding LEA patterns. OK with this change. Thanks, Uros. Fixed. Could please someone check it in if it's OK now? Thanks, Ilya --- gcc/ 2011-09-06 Enkovich Ilya ilya.enkov...@intel.com * config/i386/i386-protos.h (ix86_lea_outperforms): New. (ix86_avoid_lea_for_add): Likewise. (ix86_avoid_lea_for_addr): Likewise. (ix86_split_lea_for_addr): Likewise. * config/i386/i386.c (LEA_MAX_STALL): New. (increase_distance): Likewise. (insn_defines_reg): Likewise. (insn_uses_reg_mem): Likewise. (distance_non_agu_define_in_bb): Likewise. (distance_agu_use_in_bb): Likewise. (ix86_lea_outperforms): Likewise. (ix86_ok_to_clobber_flags): Likewise. (ix86_avoid_lea_for_add): Likewise. (ix86_avoid_lea_for_addr): Likewise. (ix86_split_lea_for_addr): Likewise. (distance_non_agu_define): Search in pred BBs added. (distance_agu_use): Search in succ BBs added. (IX86_LEA_PRIORITY): Value changed from 2 to 0. (LEA_SEARCH_THRESHOLD): Now depends on LEA_MAX_STALL. (ix86_lea_for_add_ok): Use ix86_lea_outperforms to make decision. * config/i386/i386.md: Split added to transform non destructive add into move and add. (lea_1): transformed into insn_and_split to avoid AGU stalls. (leamode_2): Likewise. lea.diff Description: Binary data
[PATCH, PR 50301] Missing checks of number of actual arguments in IPA-CP
Hi, somehow I lost two hunks in the patch allowing IPA-CP to process functions with variable number of arguments and one of these omissions caused PR 50301 (416.gamess LTO miscompilation). The two hunks check the number of actual arguments in two places of IPA-CP which are not executed so often and where we currently can get an out-of-bounds VECtor failure. Bootstrapped and tested on x86_64-linux, I have verified gmaess LTO-builds with it. OK for trunk? Thanks, Martin 2011-09-06 Martin Jambor mjam...@suse.cz PR middle-end/50301 * ipa-cp.c (find_more_values_for_callers_subset): Check jump function index bounds. (perhaps_add_new_callers): Likewise. Index: src/gcc/ipa-cp.c === --- src.orig/gcc/ipa-cp.c +++ src/gcc/ipa-cp.c @@ -2052,8 +2052,12 @@ find_more_values_for_callers_subset (str struct ipa_jump_func *jump_func; tree t; + if (i = ipa_get_cs_argument_count (IPA_EDGE_REF (cs))) +{ + newval = NULL_TREE; + break; +} jump_func = ipa_get_ith_jump_func (IPA_EDGE_REF (cs), i); - t = ipa_value_from_jfunc (IPA_NODE_REF (cs-caller), jump_func); if (!t || (newval @@ -2123,6 +2127,11 @@ perhaps_add_new_callers (struct cgraph_n if (!val) continue; + if (i = ipa_get_cs_argument_count (args)) + { + insufficient = true; + break; + } jump_func = ipa_get_ith_jump_func (args, i); t = ipa_value_from_jfunc (caller_info, jump_func); if (!t || !values_equal_for_ipcp_p (val, t))
Re: [PATCH] check_cfg assert fix
On 7/09/2011, at 3:13 AM, Steven Bosscher wrote: On Tue, Sep 6, 2011 at 11:14 AM, Tom de Vries vr...@codesourcery.com wrote: Hi, During testing the approved-for-commit middle-end patch for bug 43864 on ARM, I ran into a gcc.dg/torture/pr46068.c ICE. The following assert in haifa-sched.c:check_cfg triggered: ... else if (any_condjump_p (head)) gcc_assert (/* Usual case. */ (EDGE_COUNT (bb-succs) 1 !BARRIER_P (NEXT_INSN (head))) /* Or jump to the next instruction. */ || (EDGE_COUNT (bb-succs) == 1 (BB_HEAD (EDGE_I (bb-succs, 0)-dest) == JUMP_LABEL (head; ... Bootstrapped and reg-tested on x86_64 and build and reg-tested on arm. OK for trunk? No. If the conditional return is not taken, you should not fall into a barrier. It looks like the CFG somehow got corrupted, and if that's indeed the case then your patch just papers over the problem. That follows after the barrier? Initially, I thought so too, that is why I wrote the above assert in the first place. However, __builtin_unreachable() adds a whole new spin on where a BARRIER can occur; after all, this built-in expands directly to BARRIER. Before Tom's optimization the fall-through path of conditional jump was followed by an unconditional jump to a label directly followed by a barrier. Tom's patch removed the middle-man in the face of unconditional jump so that the barrier now follows a conditional jump. This is very odd, but, given the initial test case, is a valid case. For reference, the test case in question: /* { dg-do compile } */ void foo () { asm goto (l1); __builtin_unreachable (); l1:; } void bar () { foo (); foo (); } -- Maxim Kuvyrkov CodeSourcery / Mentor Graphics smime.p7s Description: S/MIME cryptographic signature
Re: [patch][google/integration] Add lightweight checks to vector::begin et. al. (issue4973065)
On Tue, Sep 6, 2011 at 10:46 AM, Diego Novillo dnovi...@google.com wrote: On Tue, Sep 6, 2011 at 12:54, Paul Pluzhnikov ppluzhni...@google.com wrote: On Tue, Sep 6, 2011 at 9:44 AM, Diego Novillo dnovi...@google.com wrote: OK. Any reason not to send this (or a variant) to mainline? AFAIU, mainline is not interested -- there is already a debug mode (enabled by _GLIBCXX_DEBUG), which catches many of the same bugs (and more), and introduction of parallel debug modes is undesirable. Unfortunately, _GLIBCXX_DEBUG makes no performance guarantees (making some normally constant-time operations O(N), etc.) and so we can't just turn it on in Google. Right. That's why I thought of a variant. Maybe we want to have levels of checking, or a _GLBICXX_DEBUG_FAST. Which would introduce a parallel debug mode ... which has been rejected in the past. But this is something to discuss with libstdc++ (CC'd). Sure. If the parallel debug mode is more tenable now, I am all for it. To give some context, in a large code base ( 1e6 lines of C++ code), the checks added in this patch found 20 bugs. Most (though not all) of these bugs could also have been found with Valgrind and (probably) with _GLIBCXX_DEBUG, but the runtime cost of running such heavy-weight checks over the entire code base is prohibitive. Thanks, -- Paul Pluzhnikov
Re: [Patch][Cilkplus branch] Adding include directory path to testsuite script
I checked it into cilkplus branch. Thanks. On Tue, Sep 6, 2011 at 10:38 AM, Iyer, Balaji V balaji.v.i...@intel.com wrote: OK..fixed. Please try it now. Thanks, Balaji V. Iyer. From: H.J. Lu [hjl.to...@gmail.com] Sent: Tuesday, September 06, 2011 1:35 PM To: Iyer, Balaji V Cc: gcc-patches@gcc.gnu.org Subject: Re: [Patch][Cilkplus branch] Adding include directory path to testsuite script diff --git a/gcc/testsuite/ChangeLog.cilk b/gcc/testsuite/ChangeLog.cilk index c9eac87..a602b88 100644 --- a/gcc/testsuite/ChangeLog.cilk +++ b/gcc/testsuite/ChangeLog.cilk @@ -1,3 +1,9 @@ +2011-09-05 Balaji V. Iyer. balaji.v.i...@intel.com ^^ Your name should be followed by 2 spaces, not a period. + + * gcc.dg/cilk-plus/cilk_plus.exp: Added -I + $(src_dir)../../libcilkrts/include. Also removed -fsyntax-only + * g++.dg/cilk-plus/cilk_plus.exp: Likewise + On Tue, Sep 6, 2011 at 10:22 AM, Iyer, Balaji V balaji.v.i...@intel.com wrote: Ok..try it now.. I did git diff origin/cilkplus. Thanks, Balaji V. Iyer. -Original Message- From: H.J. Lu [mailto:hjl.to...@gmail.com] Sent: Tuesday, September 06, 2011 12:37 PM To: Iyer, Balaji V Subject: Re: [Patch][Cilkplus branch] Adding include directory path to testsuite script Please use git diff origin/cilkplus to generate patch. On Tue, Sep 6, 2011 at 9:36 AM, H.J. Lu hjl.to...@gmail.com wrote: On Tue, Sep 6, 2011 at 8:01 AM, Iyer, Balaji V balaji.v.i...@intel.com wrote: Sure! Here is the fixed patch. It won't apply. Please make sure that it is against cilkplus branch. H.J. Thanks, Balaji V. Iyer. -Original Message- From: H.J. Lu [mailto:hjl.to...@gmail.com] Sent: Tuesday, September 06, 2011 10:57 AM To: Iyer, Balaji V Cc: gcc-patches@gcc.gnu.org Subject: Re: [Patch][Cilkplus branch] Adding include directory path to testsuite script You should just say * g++.dg/cilk-plus/cilk_plus.exp: Likewise since the change is the same as above. H.J. On Tue, Sep 6, 2011 at 7:45 AM, Iyer, Balaji V balaji.v.i...@intel.com wrote: I fixed all the changed you have requested. Here is an updated patch. Thanks, Balaji V. Iyer. -Original Message- From: H.J. Lu [mailto:hjl.to...@gmail.com] Sent: Tuesday, September 06, 2011 10:41 AM To: Iyer, Balaji V Cc: gcc-patches@gcc.gnu.org Subject: Re: [Patch][Cilkplus branch] Adding include directory path to testsuite script On Tue, Sep 6, 2011 at 7:30 AM, Iyer, Balaji V balaji.v.i...@intel.com wrote: Attached, please find a patch with the modifications you have suggested (adding the info in Changelog.cilk). Please remove the extra blank line in ChangLog. ChangeLog should simply say what you did, not why. H.J. Sorry for the mistake. Thanks, Balaji V. Iyer. -Original Message- From: H.J. Lu [mailto:hjl.to...@gmail.com] Sent: Tuesday, September 06, 2011 10:22 AM To: Iyer, Balaji V Cc: gcc-patches@gcc.gnu.org Subject: Re: [Patch][Cilkplus branch] Adding include directory path to testsuite script On Mon, Sep 5, 2011 at 9:52 PM, Iyer, Balaji V balaji.v.i...@intel.com wrote: Hello Everyone, This patch is for the Cilk Plus branch. It will add the include directory path it the testsuite script (cilk_plus.exp) in both gcc.dg/cilk-plus and g++.dg/cilk-plus directories. Thanking You, ChangeLog entries are missing. -- H.J. -- H.J. -- H.J.
Re: C++ PATCHes for core 1358, 1360, c++/50248 (constexpr, templates, default constructor)
A followup: non-literal argument types shouldn't change the constexpr flag either, and we shouldn't crash when a constructor initializes bases as well as members (50296). I'm not sure how my testing missed that bug... Tested x86_64-pc-linux-gnu, applying to trunk. commit 26e458d541a3b04512ab88cfab866703e868e728 Author: Jason Merrill ja...@redhat.com Date: Thu Jul 14 23:56:59 2011 -0400 zadditional_options diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 0fded4e..e12791d 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -5019,7 +5019,7 @@ check_p_subdirs=$(wordlist 1,$(words $(check_$*_parallelize)),$(check_p_numbers) # For parallelized check-% targets, this decides whether parallelization # is desirable (if -jN is used and RUNTESTFLAGS doesn't contain anything -# but optional --target_board or --tool_opts arguments). If it is desirable, +# but optional --target_board or --zadditional_options arguments). If desirable, # recursive make is run with check-parallel-$lang{,1,2,3,4,5} etc. goals, # which can be executed in parallel, as they are run in separate directories. # check-parallel-$lang{1,2,3,4,5} etc. goals invoke runtest with the longest @@ -5036,7 +5036,7 @@ check_p_subdirs=$(wordlist 1,$(words $(check_$*_parallelize)),$(check_p_numbers) # to lang_checks_parallelized variable and define check_$lang_parallelize # variable (see above check_gcc_parallelize description). $(lang_checks_parallelized): check-% : site.exp - @if [ -z $(filter-out --target_board=%,$(filter-out --tool_opts%,$(RUNTESTFLAGS))) ] \ + @if [ -z $(filter-out --target_board=%,$(filter-out --zadditional_options%,$(RUNTESTFLAGS))) ] \ [ $(filter -j, $(MFLAGS)) = -j ]; then \ $(MAKE) TESTSUITEDIR=$(TESTSUITEDIR) RUNTESTFLAGS=$(RUNTESTFLAGS) \ check-parallel-$* \ diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in index b9251a4..8353376 100644 --- a/gcc/cp/Make-lang.in +++ b/gcc/cp/Make-lang.in @@ -151,7 +151,7 @@ c++.srcman: doc/g++.1 check-c++ : check-g++ # Run the testsute in C++0x mode. check-c++0x: - $(MAKE) RUNTESTFLAGS=$(RUNTESTFLAGS) --tool_opts=-std=gnu++0x \ + $(MAKE) RUNTESTFLAGS=$(RUNTESTFLAGS) --zadditional_options,-std=gnu++0x \ TESTSUITEDIR=$(TESTSUITEDIR).c++0x check-g++ check-c++-subtargets : check-g++-subtargets # List of targets that can use the generic check- rule and its // variant. diff --git a/gcc/testsuite/lib/g++.exp b/gcc/testsuite/lib/g++.exp index 81c4398..562f6f0 100644 --- a/gcc/testsuite/lib/g++.exp +++ b/gcc/testsuite/lib/g++.exp @@ -307,3 +307,33 @@ proc g++_target_compile { source dest type options } { return $result } + +# +# ${tool}_option_help +# +# The initial 'z' is there because runtest.exp treats --a* as --all. +# This shouldn't be necessary at all; it should be entirely redundant with +# --tool_opts, except that --tool_opts currently breaks multilib. Patch at +# http://lists.gnu.org/archive/html/dejagnu/2002-10/msg7.html + +proc ${tool}_option_help { } { +send_user --zadditional_options,OPTIONS\t\tUse OPTIONS to compile the testcase files. OPTIONS should be comma-separated.\n +} + +# +# ${tool}_option_proc +# + +proc ${tool}_option_proc { option } { +if [regexp ^--zadditional_options, $option] { + global gpp_compile_options + regsub ^--zadditional_options, $option option + foreach x [split $option ,] { + lappend gpp_compile_options additional_flags=$x + } + verbose -log gpp_compile_options set to $gpp_compile_options + return 1 +} else { + return 0 +} +}
Re: [PATCH] For mem_loc_descriptor prefer avoid_constant_pool_reference (PR debug/50191)
OK. Jason
Re: [PATCH] PR c++/33255 - Support -Wunused-local-typedefs warning
On 08/08/2011 03:52 PM, Dodji Seketeli wrote: + cfun-language = NULL; Might as well ggc_free it first. + /* We want T to be either a type or a TYPE_DECL. */ Comment is out of date. Does __attribute ((used)) on the typedef prevent the warning? Jason
Re: [patch][google/integration] Add lightweight checks to vector::begin et. al. (issue4973065)
On 6 September 2011 19:01, Paul Pluzhnikov wrote: But this is something to discuss with libstdc++ (CC'd). Sure. If the parallel debug mode is more tenable now, I am all for it. I don't think anything has changed. I'm not excited by the idea of another debug mode, especially not this patch, which would never get into mainline. It is always valid to call vector::begin(), it's 'noexcept' so the patch will cause immediate calls to std::terminate, so why throw instead of just aborting? Why is __valid not named consistently with the v3 naming style? What's a dangling vector anyway? One that has been moved from? To give some context, in a large code base ( 1e6 lines of C++ code), the checks added in this patch found 20 bugs. Most (though not all) of these bugs could also have been found with Valgrind and (probably) with _GLIBCXX_DEBUG, but the runtime cost of running such heavy-weight checks over the entire code base is prohibitive. You can do: #ifdef MY_DEBUG_FLAG #include debug/vector namespace v = __gnu_debug; #else #include vector namespace v = std; # Then use v::vector in specific places to only enable the checks in some places.
Re: [patch][google/integration] Add lightweight checks to vector::begin et. al. (issue4973065)
On 6 September 2011 20:23, Jonathan Wakely wrote: What's a dangling vector anyway? One that has been moved from? Apparently not, since a moved-from vector would pass __valid() (as indeed it should) So I'm quite curious what bugs this catches. The existing debug mode catches some fairly subtle cases of user error such as comparing iterators from different containers, or dereferencing past-the-end iterators. This patch seems to catch user errors related to ... what? Heap corruption? Using a vector after its destructor runs? Those are pretty serious, un-subtle errors and not specific to vector, so why add code to vector (code which isn't 100% reliable if it only catches corruption after the memory is reused and new data written to it) to detect more general problems that can happen to any type? The fact the patch did catch real bugs doesn't mean it's a good idea, as you say, those bugs probably could have been caught in other ways.
[Patch, Darwin, Committed] remove duplicate LIBSPEC from darwin10.h
I applied the following under the 'obvious' rule. config/darwin10.h no longer modifies LIB_SPEC and thus the one in it was just a duplicate of the one in darwin.h. tidied. cheers, Iain gcc: * config/darwin10.h Remove duplicate LIB_SPEC. Index: gcc/config/darwin10.h === --- gcc/config/darwin10.h (revision 178608) +++ gcc/config/darwin10.h (working copy) @@ -18,9 +18,6 @@ You should have received a copy of the GNU General along with GCC; see the file COPYING3. If not see http://www.gnu.org/licenses/. */ -#undef LIB_SPEC -#define LIB_SPEC %{!static: -lSystem } - /* Fix PR41260 by passing -no_compact_unwind on darwin10 and later until unwinder in libSystem is fixed to digest new epilog unwinding notes.
Re: [patch][google/integration] Add lightweight checks to vector::begin et. al. (issue4973065)
On Tue, Sep 6, 2011 at 12:44 PM, Jonathan Wakely jwakely@gmail.com wrote: On 6 September 2011 20:23, Jonathan Wakely wrote: What's a dangling vector anyway? One that has been moved from? Apparently not, since a moved-from vector would pass __valid() (as indeed it should) So I'm quite curious what bugs this catches. The garden variety use after free: vector *v = new vector; ... delete v; ... for (it = v-begin(); it != v-end(); ++it) // Oops! The existing debug mode catches some fairly subtle cases of user error such as comparing iterators from different containers, or dereferencing past-the-end iterators. This patch seems to catch user errors related to ... what? Heap corruption? Using a vector after its destructor runs? Those are pretty serious, un-subtle errors and not specific to vector, so why add code to vector (code which isn't 100% reliable if it only catches corruption after the memory is reused and new data written to it) It is 100% percent reliable for us, due to use of a debugging allocator which scribbles on all free()d memory. But yes, that's one more reason why this patch is not really good for upstream. to detect more general problems that can happen to any type? We can't (easily) catch the general problem. This patch allows us to easily catch this particular instance of it. The fact the patch did catch real bugs doesn't mean it's a good idea, as you say, those bugs probably could have been caught in other ways. Sure -- we have other ways to catch the these bugs. They are not very practical at the moment due to their runtime overhead. As for your other suggestion: enabling _GLIBCXX_DEBUG just for vector, that didn't occur to me and is something I'd like to explore. Thanks, -- Paul Pluzhnikov
Re: [patch][google/integration] Add lightweight checks to vector::begin et. al. (issue4973065)
On 6 Sep 2011, at 21:19, Paul Pluzhnikov wrote: On Tue, Sep 6, 2011 at 12:44 PM, Jonathan Wakely jwakely@gmail.com wrote: On 6 September 2011 20:23, Jonathan Wakely wrote: What's a dangling vector anyway? One that has been moved from? Apparently not, since a moved-from vector would pass __valid() (as indeed it should) So I'm quite curious what bugs this catches. The garden variety use after free: vector *v = new vector; ... delete v; ... for (it = v-begin(); it != v-end(); ++it) // Oops! The existing debug mode catches some fairly subtle cases of user error such as comparing iterators from different containers, or dereferencing past-the-end iterators. This patch seems to catch user errors related to ... what? Heap corruption? Using a vector after its destructor runs? Those are pretty serious, un-subtle errors and not specific to vector, so why add code to vector (code which isn't 100% reliable if it only catches corruption after the memory is reused and new data written to it) It is 100% percent reliable for us, due to use of a debugging allocator which scribbles on all free()d memory. But yes, that's one more reason why this patch is not really good for upstream. to detect more general problems that can happen to any type? We can't (easily) catch the general problem. This patch allows us to easily catch this particular instance of it. The fact the patch did catch real bugs doesn't mean it's a good idea, as you say, those bugs probably could have been caught in other ways. Sure -- we have other ways to catch the these bugs. They are not very practical at the moment due to their runtime overhead. As for your other suggestion: enabling _GLIBCXX_DEBUG just for vector, that didn't occur to me and is something I'd like to explore. It might be interesting to profile your app under _GLIBCXX_DEBUG, and see where the high costs are. I previously found that stable_sort had a stupidly high cost, and it turned out with some tweaking we could get just as much protection with a lower cost. Chris
Re: [patch][google/integration] Add lightweight checks to vector::begin et. al. (issue4973065)
On Tue, Sep 6, 2011 at 1:33 PM, Jonathan Wakely jwakely@gmail.com wrote: for (it = v-begin(); it != v-end(); ++it) // Oops! Eurgh, the occurrence of delete in anything except a destructor is a code smell that should have led someone to find those bugs anyway! Obviously the code above is a trivial example, but it's unforgivable to write that I can assure you that the actual code that exhibited these bugs was much subtler than that, and the bugs were not immediately obvious. Sometimes they were not immediately obvious even after running Valgrind on the buggy code and getting allocation/deletion/access stack traces with source corrdinates. We can't (easily) catch the general problem. This patch allows us to easily catch this particular instance of it. Sure, but so does adding assert(this); at the top of every member Sorry, no. Adding assert(this); does not catch any new bugs (at least not on Linux) -- the code would have immediately crashed on zero-page dereference anyway. Thanks, -- Paul Pluzhnikov
[PATCH, i386]: Fix XPASS: gcc.target/i386/builtin-apply-mmx.c execution test + some cleanups
Hello! x32 follows x86_64 ABI, so no MMX regs are saved/restored in __builtin_apply_args/__builtin_return, even with -mmmx. The patch also includes some cleanups in this area. 2011-09-06 Uros Bizjak ubiz...@gmail.com * config/i386/i386.c (ix86_function_value_regno_p): Use AX_REG. (function_value_32): Do not check TARGET_MMX, TARGET_SSE or TARGET_AVX. testsuite/ChangeLog: 2011-09-06 Uros Bizjak ubiz...@gmail.com * gcc.target/i386/builtin-apply-mmx.c: Require ia32 effective target. Tested on x86_64-pc-linux-gnu {,-m32}, committed to mainline SVN. Uros. Index: config/i386/i386.c === --- config/i386/i386.c (revision 178608) +++ config/i386/i386.c (working copy) @@ -7015,7 +7015,7 @@ ix86_function_value_regno_p (const unsigned int re { switch (regno) { -case 0: +case AX_REG: return true; case FIRST_FLOAT_REG: @@ -7053,18 +7053,18 @@ function_value_32 (enum machine_mode orig_mode, en we normally prevent this case when mmx is not available. However some ABIs may require the result to be returned like DImode. */ if (VECTOR_MODE_P (mode) GET_MODE_SIZE (mode) == 8) -regno = TARGET_MMX ? FIRST_MMX_REG : 0; +regno = FIRST_MMX_REG; /* 16-byte vector modes in %xmm0. See ix86_return_in_memory for where we prevent this case when sse is not available. However some ABIs may require the result to be returned like integer TImode. */ else if (mode == TImode || (VECTOR_MODE_P (mode) GET_MODE_SIZE (mode) == 16)) -regno = TARGET_SSE ? FIRST_SSE_REG : 0; +regno = FIRST_SSE_REG; /* 32-byte vector modes in %ymm0. */ else if (VECTOR_MODE_P (mode) GET_MODE_SIZE (mode) == 32) -regno = TARGET_AVX ? FIRST_SSE_REG : 0; +regno = FIRST_SSE_REG; /* Floating point return values in %st(0) (unless -mno-fp-ret-in-387). */ else if (X87_FLOAT_MODE_P (mode) TARGET_FLOAT_RETURNS_IN_80387) @@ -7098,6 +7098,8 @@ function_value_64 (enum machine_mode orig_mode, en /* Handle libcalls, which don't provide a type node. */ if (valtype == NULL) { + unsigned int regno; + switch (mode) { case SFmode: @@ -7108,15 +7110,19 @@ function_value_64 (enum machine_mode orig_mode, en case SDmode: case DDmode: case TDmode: - return gen_rtx_REG (mode, FIRST_SSE_REG); + regno = FIRST_SSE_REG; + break; case XFmode: case XCmode: - return gen_rtx_REG (mode, FIRST_FLOAT_REG); + regno = FIRST_FLOAT_REG; + break; case TCmode: return NULL; default: - return gen_rtx_REG (mode, AX_REG); + regno = AX_REG; } + + return gen_rtx_REG (mode, regno); } else if (POINTER_TYPE_P (valtype)) { Index: testsuite/gcc.target/i386/builtin-apply-mmx.c === --- testsuite/gcc.target/i386/builtin-apply-mmx.c (revision 178608) +++ testsuite/gcc.target/i386/builtin-apply-mmx.c (working copy) @@ -11,7 +11,7 @@ /* { dg-do run { xfail { ! *-*-darwin* } } } */ /* { dg-options -O2 -mmmx } */ -/* { dg-require-effective-target ilp32 } */ +/* { dg-require-effective-target ia32 } */ #include mmx-check.h
Re: [PATCH] check_cfg assert fix
On Tue, Sep 6, 2011 at 8:00 PM, Maxim Kuvyrkov ma...@codesourcery.com wrote: On 7/09/2011, at 3:13 AM, Steven Bosscher wrote: On Tue, Sep 6, 2011 at 11:14 AM, Tom de Vries vr...@codesourcery.com wrote: Hi, During testing the approved-for-commit middle-end patch for bug 43864 on ARM, I ran into a gcc.dg/torture/pr46068.c ICE. The following assert in haifa-sched.c:check_cfg triggered: ... else if (any_condjump_p (head)) gcc_assert (/* Usual case. */ (EDGE_COUNT (bb-succs) 1 !BARRIER_P (NEXT_INSN (head))) /* Or jump to the next instruction. */ || (EDGE_COUNT (bb-succs) == 1 (BB_HEAD (EDGE_I (bb-succs, 0)-dest) == JUMP_LABEL (head; ... Bootstrapped and reg-tested on x86_64 and build and reg-tested on arm. OK for trunk? No. If the conditional return is not taken, you should not fall into a barrier. It looks like the CFG somehow got corrupted, and if that's indeed the case then your patch just papers over the problem. That follows after the barrier? Initially, I thought so too, that is why I wrote the above assert in the first place. However, __builtin_unreachable() adds a whole new spin on where a BARRIER can occur; after all, this built-in expands directly to BARRIER. Before Tom's optimization the fall-through path of conditional jump was followed by an unconditional jump to a label directly followed by a barrier. Tom's patch removed the middle-man in the face of unconditional jump so that the barrier now follows a conditional jump. This is very odd, but, given the initial test case, is a valid case. Well, shouldn't the assert be changed then to handle !onlyjump_p and returnjump_p cases separately? Tom's patch removes a valid check for all but these corner cases. Perhaps something like this: Index: haifa-sched.c === --- haifa-sched.c (revision 178601) +++ haifa-sched.c (working copy) @@ -6071,7 +6071,10 @@ check_cfg (rtx head, rtx tail) /* Or jump to the next instruction. */ || (EDGE_COUNT (bb-succs) == 1 (BB_HEAD (EDGE_I (bb-succs, 0)-dest) -== JUMP_LABEL (head; +== JUMP_LABEL (head))) + /* Or the jump is not just a jump. */ + || (!onlyjump_p (head) + || returnjump_p (head))); } if (BB_END (bb) == head) { Ciao! Steven
Re: C++ PATCHes for core 1358, 1360, c++/50248 (constexpr, templates, default constructor)
On 09/06/2011 04:21 PM, Dodji Seketeli wrote: Jason Merrillja...@redhat.com a écrit: A followup: non-literal argument types shouldn't change the constexpr flag either, and we shouldn't crash when a constructor initializes bases as well as members (50296). I'm not sure how my testing missed that bug... Tested x86_64-pc-linux-gnu, applying to trunk. commit 26e458d541a3b04512ab88cfab866703e868e728 Author: Jason Merrillja...@redhat.com Date: Thu Jul 14 23:56:59 2011 -0400 zadditional_options I fail to see what the patch below has to do with the cover letter you wrote above. Am I missing something? Hmm, Thunderbird has wanted to attach that patch for a while and finally managed to sneak it past me. Here's the proper patch. commit b7cc1c044d3a529340dc17599d58bef1dac8333a Author: Jason Merrill ja...@redhat.com Date: Mon Sep 5 12:24:44 2011 -0400 PR c++/50296 * semantics.c (register_constexpr_fundef): Call is_valid_constexpr_fn. (cx_check_missing_mem_inits): Handle bases and empty trivial members. (validate_constexpr_fundecl): Remove. * decl.c (start_preparsed_function): Don't call it. * cp-tree.h: Don't declare it. diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index cf6c056..ae4cd07 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -5367,7 +5367,6 @@ extern void finish_handler_parms (tree, tree); extern void finish_handler (tree); extern void finish_cleanup (tree, tree); extern bool literal_type_p (tree); -extern tree validate_constexpr_fundecl (tree); extern tree register_constexpr_fundef (tree, tree); extern bool check_constexpr_ctor_body (tree, tree); extern tree ensure_literal_type_for_constexpr_object (tree); diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 39a0b0e..eed4535 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -12659,10 +12659,6 @@ start_preparsed_function (tree decl1, tree attrs, int flags) maybe_apply_pragma_weak (decl1); } - /* constexpr functions must have literal argument types and - literal return type. */ - validate_constexpr_fundecl (decl1); - /* Reset this in case the call to pushdecl changed it. */ current_function_decl = decl1; diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index bdc4cf2..f782df9 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -5485,7 +5485,6 @@ is_valid_constexpr_fn (tree fun, bool complain) } } - /* Check this again here for cxx_eval_call_expression. */ if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fun) !CLASSTYPE_LITERAL_P (DECL_CONTEXT (fun))) { @@ -5502,29 +5501,6 @@ is_valid_constexpr_fn (tree fun, bool complain) return ret; } -/* Return non-null if FUN certainly designates a valid constexpr function - declaration. Otherwise return NULL. Issue appropriate diagnostics - if necessary. Note that we only check the declaration, not the body - of the function. */ - -tree -validate_constexpr_fundecl (tree fun) -{ - if (processing_template_decl || !DECL_DECLARED_CONSTEXPR_P (fun)) -return NULL; - else if (DECL_CLONED_FUNCTION_P (fun)) -/* We already checked the original function. */ -return fun; - - if (!is_valid_constexpr_fn (fun, !DECL_TEMPLATE_INFO (fun))) -{ - DECL_DECLARED_CONSTEXPR_P (fun) = false; - return NULL; -} - - return fun; -} - /* Subroutine of build_constexpr_constructor_member_initializers. The expression tree T represents a data member initialization in a (constexpr) constructor definition. Build a pairing of @@ -5799,17 +5775,27 @@ cx_check_missing_mem_inits (tree fun, tree body, bool complain) else { index = CONSTRUCTOR_ELT (body, i)-index; - /* Skip base vtable inits. */ - if (TREE_CODE (index) == COMPONENT_REF) + /* Skip base and vtable inits. */ + if (TREE_CODE (index) != FIELD_DECL) continue; } for (; field != index; field = DECL_CHAIN (field)) { + tree ftype; if (TREE_CODE (field) != FIELD_DECL || (DECL_C_BIT_FIELD (field) !DECL_NAME (field))) continue; if (!complain) return true; + ftype = strip_array_types (TREE_TYPE (field)); + if (type_has_constexpr_default_constructor (ftype)) + { + /* It's OK to skip a member with a trivial constexpr ctor. + A constexpr ctor that isn't trivial should have been + added in by now. */ + gcc_checking_assert (!TYPE_HAS_COMPLEX_DFLT (ftype)); + continue; + } error (uninitialized member %qD in %constexpr% constructor, field); bad = true; @@ -5834,6 +5820,9 @@ register_constexpr_fundef (tree fun, tree body) constexpr_fundef entry; constexpr_fundef **slot; + if (!is_valid_constexpr_fn (fun, !DECL_TEMPLATE_INFO (fun))) +return NULL; + body = massage_constexpr_body (fun, body); if (body == NULL_TREE || body == error_mark_node) { diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-diag1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-diag1.C index 44e6bc7..cbd4983 100644
Re: [patch][google/integration] Add lightweight checks to vector::begin et. al. (issue4973065)
On 6 September 2011 21:52, Paul Pluzhnikov wrote: On Tue, Sep 6, 2011 at 1:33 PM, Jonathan Wakely jwakely@gmail.com wrote: for (it = v-begin(); it != v-end(); ++it) // Oops! Eurgh, the occurrence of delete in anything except a destructor is a code smell that should have led someone to find those bugs anyway! Obviously the code above is a trivial example, but it's unforgivable to write that I can assure you that the actual code that exhibited these bugs was much subtler than that, and the bugs were not immediately obvious. Sometimes they were not immediately obvious even after running Valgrind on the buggy code and getting allocation/deletion/access stack traces with source corrdinates. We can't (easily) catch the general problem. This patch allows us to easily catch this particular instance of it. Sure, but so does adding assert(this); at the top of every member Sorry, no. Adding assert(this); does not catch any new bugs (at least not on Linux) -- the code would have immediately crashed on zero-page dereference anyway. I don't mean for vector::begin and the other functions in that patch, I mean in general for member functions of any type. There are plenty of functions that wouldn't crash when called through a null pointer. But even std:vector has member functions like that, such as max_size. Anyway, I think we've concluded the patch is not suitable for general use, as it has limited value without a debugging allocator that makes pages dirty after free.
Re: [PATCH, PR 50301] Missing checks of number of actual arguments in IPA-CP
Hi, somehow I lost two hunks in the patch allowing IPA-CP to process functions with variable number of arguments and one of these omissions caused PR 50301 (416.gamess LTO miscompilation). The two hunks check the number of actual arguments in two places of IPA-CP which are not executed so often and where we currently can get an out-of-bounds VECtor failure. Bootstrapped and tested on x86_64-linux, I have verified gmaess LTO-builds with it. OK for trunk? OK, thanks Honza Thanks, Martin 2011-09-06 Martin Jambor mjam...@suse.cz PR middle-end/50301 * ipa-cp.c (find_more_values_for_callers_subset): Check jump function index bounds. (perhaps_add_new_callers): Likewise. Index: src/gcc/ipa-cp.c === --- src.orig/gcc/ipa-cp.c +++ src/gcc/ipa-cp.c @@ -2052,8 +2052,12 @@ find_more_values_for_callers_subset (str struct ipa_jump_func *jump_func; tree t; + if (i = ipa_get_cs_argument_count (IPA_EDGE_REF (cs))) +{ + newval = NULL_TREE; + break; +} jump_func = ipa_get_ith_jump_func (IPA_EDGE_REF (cs), i); - t = ipa_value_from_jfunc (IPA_NODE_REF (cs-caller), jump_func); if (!t || (newval @@ -2123,6 +2127,11 @@ perhaps_add_new_callers (struct cgraph_n if (!val) continue; + if (i = ipa_get_cs_argument_count (args)) + { + insufficient = true; + break; + } jump_func = ipa_get_ith_jump_func (args, i); t = ipa_value_from_jfunc (caller_info, jump_func); if (!t || !values_equal_for_ipcp_p (val, t))
Re: [patch][google/integration] Add lightweight checks to vector::begin et. al. (issue4973065)
On Tue, Sep 6, 2011 at 2:51 PM, Jonathan Wakely jwakely@gmail.com wrote: I don't mean for vector::begin and the other functions in that patch, I mean in general for member functions of any type. There are plenty of functions that wouldn't crash when called through a null pointer. But even std:vector has member functions like that, such as max_size. Right. (We might tweak the compiler to automagically insert that assert in non-omitimized builds ;-) Anyway, I think we've concluded the patch is not suitable for general use, as it has limited value without a debugging allocator that makes pages dirty after free. Agreed. I'll rename __is_valid to _M_is_valid to match the rest of the file, and submit to google/integration only. Thanks for your comments, -- Paul Pluzhnikov
[PATCH, committed] Fix C++ altivec test case
I committed the following patch as obvious to make the dg-error test match the current compiler's error message (the current compiler now lists the type which broke the regexp). 2011-09-06 Michael Meissner meiss...@linux.vnet.ibm.com * g++.dg/ext/altivec-17.C: Fix dg-error to match current compiler. Index: gcc/testsuite/g++.dg/ext/altivec-17.C === --- gcc/testsuite/g++.dg/ext/altivec-17.C (revision 178613) +++ gcc/testsuite/g++.dg/ext/altivec-17.C (working copy) @@ -12,5 +12,5 @@ typedef vector__ bool__ int bool_simd_ty void Foo (bool_simd_type const a) { - simd_type const v = a; // { dg-error 'const simd_type' from expression of type 'const bool_simd_type' } + simd_type const v = a; // { dg-error invalid initialization of reference of type } } -- Michael Meissner, IBM 5 Technology Place Drive, M/S 2757, Westford, MA 01886-3141, USA meiss...@linux.vnet.ibm.com fax +1 (978) 399-6899
[PATCH, committed] Fix up documentation about tm_p.h
I checked in the following patch to update the documentation for tm_p.h. I noticed the FIXME comment in the texi source when I was working on my previous patch for combining the standard and machine dependent builtin indexes. While that patch did not go in, I figured I could improve the documentation for tm_p.h. 2011-09-06 Michael Meissner meiss...@linux.vnet.ibm.com * doc/configfiles.texi (Configuration Files): Update documentation about tm_p.h and remove FIXME comment. Index: gcc/doc/configfiles.texi === --- gcc/doc/configfiles.texi(revision 178609) +++ gcc/doc/configfiles.texi(working copy) @@ -59,6 +59,14 @@ these include the autoconfigured headers machine. @item @file{tm_p.h}, which includes the header @file{@var{machine}-protos.h} -that contains prototypes for functions in the target @file{.c} file. -FIXME: why is such a separate header necessary? +that contains prototypes for functions in the target +@file{@var{machine}.c} file. The header @file{@var{machine}-protos.h} +can include prototypes of functions that use rtl and tree data +structures inside appropriate @code{#ifdef RTX_CODE} and @code{#ifdef +TREE_CODE} conditional code segements. The +@file{@var{machine}-protos.h} is included after the @file{rtl.h} +and/or @file{tree.h} would have been included. The @file{tm_p.h} also +includes the header @file{tm-preds.h} which is generated by +@file{genpreds} program during the build to define the declarations +and inline functions for the predicate functions. @end itemize -- Michael Meissner, IBM 5 Technology Place Drive, M/S 2757, Westford, MA 01886-3141, USA meiss...@linux.vnet.ibm.com fax +1 (978) 399-6899
[v3] constexpr tuple
Here's the tuple additions for constexpr now that it's ok to return this. I'm not quite sure what to do with the get, tie, tuple_cat functions given the current signatures. Is tuple_cat now considered conforming? If so, certain signatures can be constexpr. tested x86/linux benjamin2011-09-06 Benjamin Kosnik b...@redhat.com * include/std/tuple (_Tuple_impl::_M_head, _M_tail): Mark constexpr. (tuple(tuple)): Same. (tuple(const tuple_UElements... __in)): Same. (tuple(tuple_UElements... __in)): Same. (tuple_cat(const tuple_TElements..., const tuple_UElements...)): Same. (get): Same. * include/std/array: Consolidate array::data usage. * testsuite/23_containers/array/requirements/constexpr_functions.cc: Remove extra include. * testsuite/20_util/tuple/creation_functions/constexpr.cc: New. * testsuite/20_util/tuple/cons/constexpr-2.cc: Add tests. * testsuite/20_util/tuple/cons/constexpr-3.cc: Same. * testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Adjust line numbers. Index: include/std/tuple === --- include/std/tuple (revision 178557) +++ include/std/tuple (working copy) @@ -143,7 +143,7 @@ _Head _M_head() noexcept { return *this; } - const _Head + constexpr const _Head _M_head() const noexcept { return *this; } }; @@ -189,7 +189,7 @@ _Head _M_head() noexcept { return _M_head_impl; } - const _Head + constexpr const _Head _M_head() const noexcept { return _M_head_impl; } _Head _M_head_impl; @@ -248,13 +248,13 @@ _Head _M_head() noexcept { return _Base::_M_head(); } - const _Head + constexpr const _Head _M_head() const noexcept { return _Base::_M_head(); } _Inherited _M_tail() noexcept { return *this; } - const _Inherited + constexpr const _Inherited _M_tail() const noexcept { return *this; } constexpr _Tuple_impl() @@ -280,7 +280,7 @@ _Base(std::forward_Head(__in._M_head())) { } templatetypename... _UElements -_Tuple_impl(const _Tuple_impl_Idx, _UElements... __in) +constexpr _Tuple_impl(const _Tuple_impl_Idx, _UElements... __in) : _Inherited(__in._M_tail()), _Base(__in._M_head()) { } templatetypename _UHead, typename... _UTails @@ -409,7 +409,7 @@ constexpr tuple(const tuple) = default; - tuple(tuple) = default; + constexpr tuple(tuple) = default; templatetypename... _UElements, typename = typename enable_if__and_integral_constantbool, sizeof...(_UElements) @@ -417,7 +417,7 @@ __all_convertible__conv_typesconst _UElements..., __conv_types_Elements... ::value::type -tuple(const tuple_UElements... __in) +constexpr tuple(const tuple_UElements... __in) : _Inherited(static_castconst _Tuple_impl0, _UElements...(__in)) { } @@ -427,7 +427,7 @@ __all_convertible__conv_types_UElements..., __conv_types_Elements... ::value::type -tuple(tuple_UElements... __in) +constexpr tuple(tuple_UElements... __in) : _Inherited(static_cast_Tuple_impl0, _UElements...(__in)) { } // Allocator-extended constructors. @@ -548,18 +548,18 @@ constexpr tuple(const tuple) = default; - tuple(tuple) = default; + constexpr tuple(tuple) = default; templatetypename _U1, typename _U2, typename = typename enable_if__and_is_convertibleconst _U1, _T1, is_convertibleconst _U2, _T2::value::type -tuple(const tuple_U1, _U2 __in) +constexpr tuple(const tuple_U1, _U2 __in) : _Inherited(static_castconst _Tuple_impl0, _U1, _U2(__in)) { } templatetypename _U1, typename _U2, typename = typename enable_if__and_is_convertible_U1, _T1, is_convertible_U2, _T2::value::type -tuple(tuple_U1, _U2 __in) +constexpr tuple(tuple_U1, _U2 __in) : _Inherited(static_cast_Tuple_impl0, _U1, _U2(__in)) { } templatetypename _U1, typename _U2, typename = typename @@ -571,7 +571,7 @@ templatetypename _U1, typename _U2, typename = typename enable_if__and_is_convertible_U1, _T1, is_convertible_U2, _T2::value::type - tuple(pair_U1, _U2 __in) + constexpr tuple(pair_U1, _U2 __in) : _Inherited(std::forward_U1(__in.first), std::forward_U2(__in.second)) { } @@ -752,7 +752,7 @@ { return __t._M_head(); } templatestd::size_t __i, typename _Head, typename... _Tail -inline typename __add_c_ref_Head::type +inline constexpr typename __add_c_ref_Head::type __get_helper(const _Tuple_impl__i, _Head, _Tail... __t) noexcept { return __t._M_head(); } @@ -767,7 +767,7 @@ { return __get_helper__i(__t); } templatestd::size_t __i, typename... _Elements -inline typename __add_c_ref +inline constexpr typename
[google][main]Fix broken test cases in google/main branch (issue4961065)
This patches fixes bugs that caused the multi-version tests to fail. * mversn-dispatch.c (specialize_call): Rebuild cgraph edges after specialization. (clone_and_dispatch_function): Rebuild cgraph edges to compute inline parameters. (do_convert_builtin_dispatch): Ditto. (convert_builtin_dispatch): Remove call to mark_syms_for_renaming for phi nodes. * passes.c (init_optimization_passes): Remove pass to rebuild cgraph edges after converting __builtin_dispatch. Index: mversn-dispatch.c === --- mversn-dispatch.c (revision 178618) +++ mversn-dispatch.c (working copy) @@ -1166,6 +1166,10 @@ specialize_call (tree clone_decl, int side) gsi = gsi_for_stmt (specialized_call_stmt); } } + + /* Rebuild cgraph edges for the clone. */ + rebuild_cgraph_edges (); + current_function_decl = old_current_function_decl; pop_cfun (); } @@ -1282,6 +1286,8 @@ clone_and_dispatch_function (struct cgraph_node *o global. */ update_ssa (TODO_update_ssa); + /* cgraph edges need to be updated before computing inline parameters. */ + rebuild_cgraph_edges (); compute_inline_parameters (cgraph_get_create_node (orig_fndecl), false); DECL_DECLARED_INLINE_P (orig_fndecl) = 1; DECL_UNINLINABLE (orig_fndecl) = 0; @@ -1623,7 +1629,6 @@ convert_builtin_dispatch (gimple stmt) phinode = create_phi_node (tmp_var, bb4); add_phi_arg (phinode, ssa_if_name, e24, UNKNOWN_LOCATION); add_phi_arg (phinode, ssa_else_name, e34, UNKNOWN_LOCATION); - mark_symbols_for_renaming (phinode); gcc_assert (lhs_result); assign_stmt = gimple_build_assign (lhs_result, gimple_phi_result (phinode)); @@ -1732,6 +1737,8 @@ do_convert_builtin_dispatch (void) ++ix) convert_builtin_dispatch (builtin_stmt); + /* cgraph edges need to be updated before computing inline parameters. */ + rebuild_cgraph_edges (); compute_inline_parameters (cgraph_get_create_node (current_function_decl), false); Index: passes.c === --- passes.c(revision 178618) +++ passes.c(working copy) @@ -1254,10 +1254,6 @@ init_optimization_passes (void) { struct opt_pass **p = pass_ipa_multiversion_dispatch.pass.sub; NEXT_PASS (pass_tree_convert_builtin_dispatch); - /* Rebuilding cgraph edges is necessary as the above passes change - the call graph. Otherwise, future optimizations use the old -call graph and make wrong decisions sometimes.*/ - NEXT_PASS (pass_rebuild_cgraph_edges); } NEXT_PASS (pass_ipa_lower_emutls); *p = NULL; -- This patch is available for review at http://codereview.appspot.com/4961065