Re: [Patch, Ada, Darwin] Restore PowerPC Darwin Ada bootstrap (after a looong time, it seems).
Hi Eric, On 6 Sep 2011, at 17:17, Mike Stump wrote: 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. Much nicer ... and works... Bootstrap with ada succeeds + no regressions esp. objc and obj-c++ which use SjLj for exceptions @m32. (java not tested). OK for trunk ( + 4.6 after a re-check and with a suitable variant of system-darwin-ppc64.ads )? Iain gcc: (+Eric) * config/rs6000/rs6000.c (compute_save_world_info): Test cfun->has_nonlocal_label to determine if the out-of-line save world call may be used. ada: * gcc-interface/Makefile.in (darwin): Provide powerpc64 system implementation. * system-darwin-ppc64.ads: New file. Index: gcc/config/rs6000/rs6000.c === --- gcc/config/rs6000/rs6000.c (revision 178608) +++ gcc/config/rs6000/rs6000.c (working copy) @@ -17945,7 +17945,7 @@ compute_save_world_info (rs6000_stack_t *info_ptr) info_ptr->world_save_p = (WORLD_SAVE_P (info_ptr) && DEFAULT_ABI == ABI_DARWIN - && ! (cfun->calls_setjmp && flag_exceptions) + && !cfun->has_nonlocal_label && info_ptr->first_fp_reg_save == FIRST_SAVED_FP_REGNO && info_ptr->first_gp_reg_save == FIRST_SAVED_GP_REGNO && info_ptr->first_altivec_reg_save == FIRST_SAVED_ALTIVEC_REGNO Index: gcc/ada/gcc-interface/Makefile.in === --- gcc/ada/gcc-interface/Makefile.in (revision 178608) +++ gcc/ada/gcc-interface/Makefile.in (working copy) @@ -2236,8 +2236,16 @@ ifeq ($(strip $(filter-out darwin%,$(osys))),) a-numaux.adshttp://www.gnu.org/licenses/>. -- +-- -- +-- GNAT was originally developed by the GNAT team at New York University. -- +-- Extensive contributions were provided by Ada Core Technologies Inc. -- +-- -- +-- + +package System is + pragma Pure; + -- Note that we take advantage of the implementation permission to make + -- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada + -- 2005, this is Pure in any case (AI-362). + + type Name is (SYSTEM_NAME_GNAT); + System_Name : constant Name := SYSTEM_NAME_GNAT; + + -- System-Dependent Named Numbers + + Min_Int : constant := Long_Long_Integer'First; + Max_Int : constant := Long_Long_Integer'Last; + + Max_Binary_Modulus: constant := 2 ** Long_Long_Integer'Size; + Max_Nonbinary_Modulus : constant := 2 ** Integer'Size - 1; + + Max_Base_Digits : constant := Long_Long_Float'Digits; + Max_Digits: constant := Long_Long_Float'Digits; + + Max_Mantissa : constant := 63; + Fine_Delta: constant := 2.0 ** (-Max_Mantissa); + + Tick : constant := 0.01; + + -- Storage-related Declarations + + type Address is private; + pragma Preelaborable_Initialization (Address); + Null_Address : constant Address; + + Storage_Unit : constant := 8; + Word_Size: constant := 64; + Memory_Size : constant := 2 ** 64; + + -- Address comparison + + function "<" (Left, Right : Address) return Boolean; + function "<=" (Left, Right : Address) return Boolean; + function ">" (Left, Right : Address) return Boolean; + function ">=" (Left, Right : Address) return Boolean; + function "=" (Left, Right : Address) return Boolean; + + pragma Import (Intrinsic, "<"); + pragma Import (Intrinsic, "<="); + pragma Import (Intrinsic, ">"); + pragma Import (Intrinsic, ">="); + pragma Import (Intrinsic, "="); + + -- Other System-Dependent Declarations + + type Bit_Order is (High_Order_First, Low_Order_First); + Default_Bit_Order : constant Bit_Order := High_Order_First; + pragma Warnings (Off, Default_Bit_Order); -- kill constant condition warning + + -- Priority-related Declarations (RM D.1) + + -- The values defined here are copied from the ppc version. + + Max_Interrupt_Priority : constant Positive := 63; + Max_Priority : constant Positive := Max_Interrupt_Priority - 1; + + subtype Any_Priority is
Re: [Patch, Ada, Darwin] Restore PowerPC Darwin Ada bootstrap (after a looong time, it seems).
> OK for trunk ( + 4.6 after a re-check and with a suitable variant of > system-darwin-ppc64.ads )? Yes, this looks fine as far as I'm concerned, thanks. -- Eric Botcazou
[Patch, testsuite] Skip case ipa-sra-2.c for strict_align target.
Hello, The SRA optimization requires the reference to struct/union member must be aligned to their natural boundary e.g. (int *) must be aligned to 4 byte boundary. This is done in function tree_non_mode_aligned_mem_p. For target like x86 that define "STRICT_ALIGNMENT" to 0, the function return false. Afterward, the SRA is conducted. For target like ARM or MIPS that define "STRICT_ALIGNMENT" to 1, the alignment status is checked by "align = get_object_alignment (exp)". The function get_object_alignment rely on SSA and tend to over-conservative. So for most cases, the SRA is stopped here. This patch intends to skip this case for target that set STRICT_ALIGNMENT to 1 otherwise the case will fail due to the SRA isn't performed actually. OK to commit to trunk? BR, Terry 2011-09-07 Terry Guo * gcc.dg/ipa/ipa-sra-2.c: Only run on targets that are non_strict_align. diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-sra-2.c b/gcc/testsuite/gcc.dg/ipa/ipa-sra-2.c index 3437a81..c6b4d63 100644 --- a/gcc/testsuite/gcc.dg/ipa/ipa-sra-2.c +++ b/gcc/testsuite/gcc.dg/ipa/ipa-sra-2.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fipa-sra -fdump-tree-eipa_sra-details" } */ +/* { dg-require-effective-target non_strict_align } */ struct bovid {
Re: [PATCH] Make SRA produce integer replacements for enumeration types
On Tue, 6 Sep 2011, Martin Jambor wrote: > 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? Ok. Can you add the testcase from the PR? Thanks, Richard. > Thanks, > > Martin > > > 2011-09-05 Martin Jambor > > 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; > > -- Richard Guenther SUSE / SUSE Labs SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746 GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer
[Patch, Ada, Darwin] Remove use of "flat_namespace" linker flag.
The "-flat_namespace" linker flag defeats one of Darwin's nicer features (two-level library namespaces). AFAIU, it was habitually applied to unix projects in the early versions of darwin to cater for assumptions about library ordering made in such projects. However, it is rarely needed these days (perhaps in the case of imported unix projects using plugins sometimes). It also upsets our careful use of an extension library to provide current GCC facilities to Darwin 8...11 (which relies on the two-level namespace to use both the system and GCC versions of libgcc_s) ... and, in particular, this can cause subtle and difficult to diagnose differences of behavior between darwin 9 and later systems. --- Perhaps I'm missing something (please enlighten me if so), but I can't presently see any reason why this needs to be applied to the Ada _build_ ... ... and IMHO it's likely to cause end user issues defaulting to it for shared library Ada make projects. (better that the User should explicitly issue the flag where it is required) So is the following OK for trunk? (no Ada regressions on *-darwin9, x86_64-darwin10). cheers Iain ada: * gcc-interface/Makefile.in (darwin): Do not issue the '-flat_namespace' linker flag during Ada build. * mlib-tgt-specific-darwin.adb: Remove 'flat_namespace' flag from the default shared library options. Index: gcc/ada/mlib-tgt-specific-darwin.adb === --- gcc/ada/mlib-tgt-specific-darwin.adb(revision 178615) +++ gcc/ada/mlib-tgt-specific-darwin.adb(working copy) @@ -57,15 +57,10 @@ package body MLib.Tgt.Specific is -- Local objects - Flat_Namespace : aliased String := "-Wl,-flat_namespace"; - -- Instruct the linker to build the shared library as a flat - -- namespace image. The default is a two-level namespace image. - Shared_Libgcc : aliased String := "-shared-libgcc"; Shared_Options : constant Argument_List := - (1 => Flat_Namespace'Access, - 2 => Shared_Libgcc'Access); + (1 => Shared_Libgcc'Access); - -- Archive_Indexer_Options -- Index: gcc/ada/gcc-interface/Makefile.in === --- gcc/ada/gcc-interface/Makefile.in (revision 178615) +++ gcc/ada/gcc-interface/Makefile.in (working copy) @@ -2164,7 +2164,7 @@ ifeq ($(strip $(filter-out %x86_64 linux%,$(arch) endif ifeq ($(strip $(filter-out darwin%,$(osys))),) - SO_OPTS = -Wl,-flat_namespace -shared-libgcc + SO_OPTS = -shared-libgcc ifeq ($(strip $(filter-out %86,$(arch))),) LIBGNAT_TARGET_PAIRS = \ a-intnam.ads
Re: [ARM] PR target/49030: ICE in get_arm_condition_code
> > My patch has now survived a Thumb-2 bootstrap, and it sounds like Ramana > has also successfully bootstrapped your original patch. I'd rather take the version that handles the cases for the dominance modes as well. RichardE, do you think you could have a look at this one ? cheers Ramana
Re: ARM: Emit conditions in push_multi
On 2 September 2011 12:42, Bernd Schmidt wrote: > On 09/02/11 12:35, Ramana Radhakrishnan wrote: >> On 1 September 2011 12:50, Bernd Schmidt wrote: >>> Shrink-wrapping tests on ARM had one additional failure, which I could >>> track down to a stmfd instruction being emitted where an stmhifd was >>> intended. The following patch fixes the testcase; full tests running >>> now. Ok? >> >> IIUC this should have been a result of conditionalizing the prologue >> saves by the CCFSM state machine in ARM state > > Correct. > >> given that the push >> instruction below doesn't have the conditional markers. > > Although I'm not sure how you arrived at this? Thumb insns can't be > conditional anyway? IT blocks in Thumb2 and the predicable attribute means we can generate some amount of conditional instruction in T2 state. I just looked at that patch as it was and didn't remember whether the pattern had a predicable attribute set on it ( in which case you would have seen the failure in Thumb2). Thus if the failure came in ARM state alone it had to be from the CCFSM state machine. It's probably worth-while just putting out the %? marker in that case anyway for the push instruction given that the only way this is likely to be seen is if someday we mark this as predicable :) > >> In which case >> the routines to emit the asm for the VFP registers( vfp_output_fstmfd? >> ) should also be checked for this issue. > > Hmm, ok. I found two more places which looked suspicious. New version, > untested so far. What's "sfmfd"? That doesn't occur in my manual. sfmfd an FPA instruction should be conditionalizable given it's in the co-processor space. cheers Ramana
[Patch, Ada, Darwin] update traceback choice for newer darwin systems.
This doesn't actually make any functional change to x86 darwin, but it does group all the darwin versions together. Current PPC darwin (like x86) should use the GCC unwinder. (no Ada regression on *-darwin9, x86-64-darwin10) OK for trunk/ 4.6 when the PPC changes are in? cheers Iain ada: * traceback.c (Darwin) USE_GCC_UNWINDER for Darwin versions >= 8. Index: gcc/ada/tracebak.c === --- gcc/ada/tracebak.c (revision 178627) +++ gcc/ada/tracebak.c (working copy) @@ -203,9 +203,23 @@ extern void (*Unlock_Task) (void); */ -/*--- PPC AIX/Darwin */ +/*--- Darwin 8 (OSX 10.4) or newer --*/ +#if defined (__APPLE__) \ +&& defined (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) \ +&& __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1040 + +#define USE_GCC_UNWINDER -#if ((defined (_POWER) && defined (_AIX)) || \ +#if defined (__i386__) || defined (__x86_64__) +#define PC_ADJUST -2 +#elif defined (__ppc__) || defined (__ppc64__) +#define PC_ADJUST -4 +#else +#error Unhandled darwin architecture. +#endif + +/* PPC AIX/Older Darwin -*/ +#elif ((defined (_POWER) && defined (_AIX)) || \ (defined (__ppc__) && defined (__APPLE__))) #define USE_GENERIC_UNWINDER
Re: rs6000 toc reference rtl
On Tue, Sep 06, 2011 at 01:11:26AM +0930, Alan Modra wrote: > Consequently, Mike's change to split rtl for > indirect calls sometimes sees the scheduler moving the r2 load in the > indirect call sequence before a toc reference. Actually, this isn't correct. Mike's change adding rs6000.c rs6000_call_indirect_aix just made it more likely. Even before this post-reload scheduling could move the r2 load around, since rs6000.md call_indirect_aix patterns were (and still are) split post-reload. Here's an example I was shown today of such damage (qemu compiled with gcc-4.6-redhat). .LVL57151: ld 0,0(31) # load opd+0, function addr addis 4,2,.LC4758@toc@ha ld 11,16(31) mr 7,3 std 2,40(1) # save r2 mr 5,25 addi 4,4,.LC4758@toc@l mtctr 0 # mr 6,26 ld 2,8(31) # load opd+8, new toc ptr in r2 mr 3,28 .LBB255670: .LBB255668: .loc 8 98 0 addis 27,2,.LC4761@toc@ha # oops, should be using old r2 .LVL57152: addi 27,27,.LC4761@toc@l .LBE255668: .LBE255670: .loc 3 9212 0 addis 25,2,.LC4762@toc@ha # oops again .loc 3 9198 0 bctrl # make the call ld 2,40(1) # restore r2 r27 and r25 set up here for later use now contain bogus values. The blame rests on my 2011-06-20 change. -- Alan Modra Australia Development Lab, IBM
Re: [Patch, Ada, Darwin] update traceback choice for newer darwin systems.
> This doesn't actually make any functional change to x86 darwin, but it does > group all the darwin versions together. > > Current PPC darwin (like x86) should use the GCC unwinder. > > (no Ada regression on *-darwin9, x86-64-darwin10) > > OK for trunk/ 4.6 when the PPC changes are in? > cheers > Iain > > ada: > > * traceback.c (Darwin) USE_GCC_UNWINDER for Darwin > versions >= 8. Patch looks OK to me, thanks. > Index: gcc/ada/tracebak.c > === > > --- gcc/ada/tracebak.c(revision 178627) > +++ gcc/ada/tracebak.c(working copy) > @@ -203,9 +203,23 @@ extern void (*Unlock_Task) (void); > >*/ > > -/*--- PPC AIX/Darwin > */ > +/*--- Darwin 8 (OSX 10.4) or newer > --*/ > +#if defined (__APPLE__) \ > +&& defined (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) \ > +&& __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1040 > + > +#define USE_GCC_UNWINDER > > -#if ((defined (_POWER) && defined (_AIX)) || \ > +#if defined (__i386__) || defined (__x86_64__) > +#define PC_ADJUST -2 > +#elif defined (__ppc__) || defined (__ppc64__) > +#define PC_ADJUST -4 > +#else > +#error Unhandled darwin architecture. > +#endif > + > +/* PPC AIX/Older Darwin > -*/ > +#elif ((defined (_POWER) && defined (_AIX)) || \ > (defined (__ppc__) && defined (__APPLE__))) > > #define USE_GENERIC_UNWINDER
Re: [patch][google/integration] Add lightweight checks to vector::begin et. al. (issue4973065)
On Tuesday 06 September 2011 23:09:17, Jonathan Wakely wrote: > On 6 September 2011 22:58, Paul Pluzhnikov wrote: > > On Tue, Sep 6, 2011 at 2:51 PM, Jonathan Wakely > > 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 ;-) > > Heh :-) > > Have you considered a compiler option to make 'delete v' zero out the > pointer, so that any following use of it gives an immediate segfault? > That would be conforming (the value of delete's operand is unspecified > after the operation), but would only help if the same pointer is used, > rather than another object with the same value. I don't know of any > compiler that does that, but have wondered if it would be useful for > debugging some cases. Zeroing out would hide bugs; there's lots of code that does delete ptr; ... ... ... if (ptr) { ptr->... } You'd not see the bug that way. Making 'delete v' clobber the pointer with 0xdeadbeef or ~0 instead would be better. -- Pedro Alves
Re: [Patch, testsuite] Skip case ipa-sra-2.c for strict_align target.
On Wed, Sep 7, 2011 at 9:47 AM, Terry Guo wrote: > Hello, > > The SRA optimization requires the reference to struct/union member must be > aligned to their natural boundary e.g. (int *) must be aligned to 4 byte > boundary. This is done in function tree_non_mode_aligned_mem_p. For target > like x86 that define "STRICT_ALIGNMENT" to 0, the function return false. > Afterward, the SRA is conducted. For target like ARM or MIPS that define > "STRICT_ALIGNMENT" to 1, the alignment status is checked by "align = > get_object_alignment (exp)". The function get_object_alignment rely on SSA > and tend to over-conservative. So for most cases, the SRA is stopped here. > > This patch intends to skip this case for target that set STRICT_ALIGNMENT to > 1 otherwise the case will fail due to the SRA isn't performed actually. OK > to commit to trunk? Hm, the testcase looks like it should actually pass even for strict-align targets. Martin? Richard. > BR, > Terry > > 2011-09-07 Terry Guo > > * gcc.dg/ipa/ipa-sra-2.c: Only run on > targets that are non_strict_align. > > > diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-sra-2.c > b/gcc/testsuite/gcc.dg/ipa/ipa-sra-2.c > index 3437a81..c6b4d63 100644 > --- a/gcc/testsuite/gcc.dg/ipa/ipa-sra-2.c > +++ b/gcc/testsuite/gcc.dg/ipa/ipa-sra-2.c > @@ -1,5 +1,6 @@ > /* { dg-do compile } */ > /* { dg-options "-O2 -fipa-sra -fdump-tree-eipa_sra-details" } */ > +/* { dg-require-effective-target non_strict_align } */ > > struct bovid > { > > >
[PATCH] sel-sched: forbid differing modes in substitution (PR 50205)
Hello, The patch repairs a problem when we attempt to substitute an insn like (... (cmp (mem (reg:DI ax)) (reg:SI ax))) (note different modes) through (set (reg:DI ax) (reg:DI dx)), which leaves the (reg:SI ax) part of the comparison intact, causing an ICE later on when we notice that the dependency on ax is still present. As this is quite rare, we can simply forbid substitution in such circumstances, much like substitution of multiple hard reg references is forbidden now. En passant, the patch simplifes the code a little, as we never try to substitute anything but registers. Bootstrapped and regtested on x86_64-linux with sel-sched enabled at -O2, OK? (I'll add the testcase from Bugzilla when committing) 2011-09-07 Alexander Monakov PR rtl-optimization/50205 * sel-sched.c (count_occurrences_1): Simplify on the assumption that p->x is a register. Forbid substitution when the same register is found in a different mode. (count_occurrences_equiv): Assert that 'what' is a register. diff --git a/gcc/sel-sched.c b/gcc/sel-sched.c index f11faca..2af01ae 100644 --- a/gcc/sel-sched.c +++ b/gcc/sel-sched.c @@ -813,18 +813,12 @@ count_occurrences_1 (rtx *cur_rtx, void *arg) { rtx_search_arg_p p = (rtx_search_arg_p) arg; - /* The last param FOR_GCSE is true, because otherwise it performs excessive -substitutions like - r8 = r33 - r16 = r33 -for the last insn it presumes r33 equivalent to r8, so it changes it to -r33. Actually, there's no change, but it spoils debugging. */ - if (exp_equiv_p (*cur_rtx, p->x, 0, true)) -{ - /* Bail out if we occupy more than one register. */ - if (REG_P (*cur_rtx) - && HARD_REGISTER_P (*cur_rtx) - && hard_regno_nregs[REGNO(*cur_rtx)][GET_MODE (*cur_rtx)] > 1) + if (REG_P (*cur_rtx) && REGNO (*cur_rtx) == REGNO (p->x)) +{ + /* Bail out if mode is different or more than one register is used. */ + if (GET_MODE (*cur_rtx) != GET_MODE (p->x) + || (HARD_REGISTER_P (*cur_rtx) + && hard_regno_nregs[REGNO(*cur_rtx)][GET_MODE (*cur_rtx)] > 1)) { p->n = 0; return 1; @@ -837,7 +831,6 @@ count_occurrences_1 (rtx *cur_rtx, void *arg) } if (GET_CODE (*cur_rtx) == SUBREG - && REG_P (p->x) && (!REG_P (SUBREG_REG (*cur_rtx)) || REGNO (SUBREG_REG (*cur_rtx)) == REGNO (p->x))) { @@ -859,6 +852,7 @@ count_occurrences_equiv (rtx what, rtx where) { struct rtx_search_arg arg; + gcc_assert (REG_P (what)); arg.x = what; arg.n = 0;
RE: [Patch, testsuite] Skip case ipa-sra-2.c for strict_align target.
Hello, > > Hm, the testcase looks like it should actually pass even for strict- > align > targets. Martin? > > Richard. > I debugged the GCC and observed the below situation. Here is the code snippet of this case: static int __attribute__((noinline)) ox (struct bovid *cow) { cow->red = cow->red + cow->green + cow->green; return 0; } int main() { struct bovid cow; . ox (&cow); } In GCC the function access_precludes_ipa_sra_p will call function tree_non_model_aligned_mem_p to check the align status of the access->expr. For the case, the access->expr is a gimple expr in function ox: cow_1(D)->red$3 = void. The mode for this expr is SFmode. Because STRICT_ALIGNMENT is defined to 1, so the function get_object_alignment is called and return the alignment for this expr is 8 bit. While the required alignment for SFmode is 32 bit. So this expr is regarded as unaligned. The SRA is stopped. Hope this investigation is helpful. BR, Terry
Re: Add unwind information to mips epilogues
Here's a new version, which adds support for mips16 and tries to avoid the window with the frame pointer restore. Testing mips16 is problematic, all the execute tests fail before and after - I interpret one of your earlier mails to say that this is expected. There are no new compilation failures with this patch, but incorrect earlier versions triggered a few, indicating that the testing is at least somewhat useful. I get the following output for restore insns: move$sp,$17 restore 8,$16,$17 $LCFI2 = . .cfi_remember_state .cfi_restore 16 .cfi_restore 17 .cfi_def_cfa 29, 0 which I think is correct. Question for Richard H.: What is this actually good for, other than presenting consistent information to dwarf2cfi? Do we actually expect code to unwind through the middle of an epilogue? Bernd * config/mips/mips.c (cfa_restores, cfa_sp_offset): New static variables. (mips16e_save_restore_reg): Add to cfa_restores. (mips_restore_reg): Add to cfa_restores, and add a REG_CFA_DEF_CFA note to insns restoring the frame pointer. (mips_expand_epilogue): Initialize the new variables. Annotate RTL to ensure dwarf2cfi sees the effects of the epilogue. Generate a simple_return only if the return address is in r31. Index: gcc/config/mips/mips.c === --- gcc/config/mips/mips.c (revision 178135) +++ gcc/config/mips/mips.c (working copy) @@ -501,6 +501,11 @@ int sdb_label_count; int mips_dbx_regno[FIRST_PSEUDO_REGISTER]; int mips_dwarf_regno[FIRST_PSEUDO_REGISTER]; +/* Used to collect REG_CFA notes during epilogue generation. */ +static rtx cfa_restores = NULL_RTX; +/* Used to produce REG_CFA_DEF_CFA notes during epilogue generation. */ +static HOST_WIDE_INT cfa_sp_offset; + /* The nesting depth of the PRINT_OPERAND '%(', '%<' and '%[' constructs. */ struct mips_asm_switch mips_noreorder = { "reorder", 0 }; struct mips_asm_switch mips_nomacro = { "macro", 0 }; @@ -8371,8 +8376,8 @@ mips16e_collect_argument_saves (void) } /* Return a move between register REGNO and memory location SP + OFFSET. - Make the move a load if RESTORE_P, otherwise make it a frame-related - store. */ + Make the move a load and update cfa_restores if RESTORE_P, otherwise + make it a frame-related store. */ static rtx mips16e_save_restore_reg (bool restore_p, HOST_WIDE_INT offset, @@ -8382,6 +8387,9 @@ mips16e_save_restore_reg (bool restore_p mem = gen_frame_mem (SImode, plus_constant (stack_pointer_rtx, offset)); reg = gen_rtx_REG (SImode, regno); + if (restore_p) +cfa_restores = alloc_reg_note (REG_CFA_RESTORE, reg, cfa_restores); + return (restore_p ? gen_rtx_SET (VOIDmode, reg, mem) : mips_frame_set (mem, reg)); @@ -10227,17 +10236,30 @@ mips_expand_prologue (void) emit_insn (gen_blockage ()); } -/* Emit instructions to restore register REG from slot MEM. */ +/* Emit instructions to restore register REG from slot MEM. Also update + the cfa_restores list. */ static void mips_restore_reg (rtx reg, rtx mem) { + rtx orig_reg = reg; + rtx last; + /* There's no MIPS16 instruction to load $31 directly. Load into $7 instead and adjust the return insn appropriately. */ if (TARGET_MIPS16 && REGNO (reg) == RETURN_ADDR_REGNUM) reg = gen_rtx_REG (GET_MODE (reg), GP_REG_FIRST + 7); mips_emit_save_slot_move (reg, mem, MIPS_EPILOGUE_TEMP (GET_MODE (reg))); + if (reg == orig_reg) +cfa_restores = alloc_reg_note (REG_CFA_RESTORE, reg, cfa_restores); + + if (!frame_pointer_needed || REGNO (reg) != HARD_FRAME_POINTER_REGNUM) +return; + last = get_last_insn (); + add_reg_note (last, REG_CFA_DEF_CFA, plus_constant (stack_pointer_rtx, + cfa_sp_offset)); + RTX_FRAME_RELATED_P (last) = 1; } /* Emit any instructions needed before a return. */ @@ -10268,6 +10290,8 @@ mips_expand_epilogue (bool sibcall_p) HOST_WIDE_INT step1, step2; rtx base, target, insn; + cfa_restores = NULL_RTX; + if (!sibcall_p && mips_can_use_return_insn ()) { emit_jump_insn (gen_return ()); @@ -10306,6 +10330,8 @@ mips_expand_epilogue (bool sibcall_p) step1 -= step2; } + cfa_sp_offset = step2; + /* Set TARGET to BASE + STEP1. */ target = base; if (step1 > 0) @@ -10324,12 +10350,26 @@ mips_expand_epilogue (bool sibcall_p) if (!TARGET_MIPS16) target = stack_pointer_rtx; - emit_insn (gen_add3_insn (target, base, adjust)); + insn = emit_insn (gen_add3_insn (target, base, adjust)); + if (!frame_pointer_needed && target == stack_pointer_rtx) + { + RTX_FRAME_RELATED_P (insn) = 1; + add_reg_note (insn, REG_CFA_DEF_CFA, + plus_constant (stack_pointer_rtx, step2)); + } } /* Copy TARGET into the stack pointer.
[C++ Patch] PR 50309
Hi, I have the below simple patch to avoid the ICE after error. Tested x86_64-linux. Is it Ok? In case, if it applies as-is, 4_6-branch too? Thanks, Paolo. /cp 2011-09-07 Paolo Carlini PR c++/50309 * decl.c (grokdeclarator): Check u.function.exception_specification for error_mark_node. /testsuite 2011-09-07 Paolo Carlini PR c++/50309 * g++.dg/cpp0x/noexcept14.C: New. Index: testsuite/g++.dg/cpp0x/noexcept14.C === --- testsuite/g++.dg/cpp0x/noexcept14.C (revision 0) +++ testsuite/g++.dg/cpp0x/noexcept14.C (revision 0) @@ -0,0 +1,4 @@ +// PR c++/50309 +// { dg-options -std=c++0x } + +void foo () noexcept () { } // { dg-error "expected" } Index: cp/decl.c === --- cp/decl.c (revision 178631) +++ cp/decl.c (working copy) @@ -9049,6 +9049,8 @@ grokdeclarator (const cp_declarator *declarator, virt_specifiers = declarator->u.function.virt_specifiers; /* Pick up the exception specifications. */ raises = declarator->u.function.exception_specification; + if (raises == error_mark_node) + return error_mark_node; /* Say it's a definition only for the CALL_EXPR closest to the identifier. */
Re: [ARM] PR target/49030: ICE in get_arm_condition_code
On 02/09/11 16:01, Richard Sandiford wrote: > CC_NCV rightly only allows GE(U) and LT(U). GT(U) and LE(U) have to > implemented by reversing the condition. This is handled correctly when > the condition is first expanded, but nothing stops later optimisers from > producing invalid forms. > > This patch makes arm_comparison_operator check that the condition > is acceptable. Tested on arm-linux-gnueabi. OK to install? > > Richard > > > gcc/ > * config/arm/arm-protos.h (maybe_get_arm_condition_code): Declare. > * config/arm/arm.c (maybe_get_arm_condition_code): New function, > reusing the old code from get_arm_condition_code. Return ARM_NV > for invalid comparison codes. > (get_arm_condition_code): Redefine in terms of > maybe_get_arm_condition_code. > * config/arm/predicates.md (arm_comparison_operator): Use > maybe_get_arm_condition_code. > > gcc/testsuite/ > * gcc.dg/torture/pr49030.c: New test. OK. R.
Re: Add unwind information to mips epilogues
On Wed, Sep 7, 2011 at 12:28 PM, Bernd Schmidt wrote: > Here's a new version, which adds support for mips16 and tries to avoid > the window with the frame pointer restore. > > Testing mips16 is problematic, all the execute tests fail before and > after - I interpret one of your earlier mails to say that this is > expected. There are no new compilation failures with this patch, but > incorrect earlier versions triggered a few, indicating that the testing > is at least somewhat useful. > > I get the following output for restore insns: > > move $sp,$17 > restore 8,$16,$17 > $LCFI2 = . > .cfi_remember_state > .cfi_restore 16 > .cfi_restore 17 > .cfi_def_cfa 29, 0 > > which I think is correct. > > Question for Richard H.: What is this actually good for, other than > presenting consistent information to dwarf2cfi? Do we actually expect > code to unwind through the middle of an epilogue? With async signals we can at least get interrupted in the middle of an epilogue. What you are allowed to do here (throw an exception? perform manual unwinding? use gdb which unwinds?) is another question. ISTR customer requests for this feature at least (which I think was doing profiling stuff). Richard. > > Bernd >
[PATCH] Fix PR50213
This fixes PR50213 by adding a heuristic to tree forwprop to not propagate simple IV counter increments (similar as how to DOM avoids to CSE them). Bootstrapped and tested on x86_64-unknown-linux-gnu, applied. Richard. 2011-09-07 Richard Guenther PR tree-optimization/50213 * tree-flow.h (simple_iv_increment_p): Declare. * tree-ssa-dom.c (simple_iv_increment_p): Export. Also handle POINTER_PLUS_EXPR. * tree-ssa-forwprop.c (ssa_forward_propagate_and_combine): Do not propagate simple IV counter increments. Index: gcc/tree-flow.h === *** gcc/tree-flow.h (revision 178628) --- gcc/tree-flow.h (working copy) *** extern void dump_dominator_optimization_ *** 597,602 --- 597,603 extern void debug_dominator_optimization_stats (void); int loop_depth_of_name (tree); tree degenerate_phi_result (gimple); + bool simple_iv_increment_p (gimple); /* In tree-ssa-copy.c */ extern void propagate_value (use_operand_p, tree); Index: gcc/tree-ssa-dom.c === *** gcc/tree-ssa-dom.c (revision 178628) --- gcc/tree-ssa-dom.c (working copy) *** record_equality (tree x, tree y) *** 1409,1417 i_1 = phi (..., i_2) i_2 = i_1 +/- ... */ ! static bool simple_iv_increment_p (gimple stmt) { tree lhs, preinc; gimple phi; size_t i; --- 1409,1418 i_1 = phi (..., i_2) i_2 = i_1 +/- ... */ ! bool simple_iv_increment_p (gimple stmt) { + enum tree_code code; tree lhs, preinc; gimple phi; size_t i; *** simple_iv_increment_p (gimple stmt) *** 1423,1434 if (TREE_CODE (lhs) != SSA_NAME) return false; ! if (gimple_assign_rhs_code (stmt) != PLUS_EXPR ! && gimple_assign_rhs_code (stmt) != MINUS_EXPR) return false; preinc = gimple_assign_rhs1 (stmt); - if (TREE_CODE (preinc) != SSA_NAME) return false; --- 1424,1436 if (TREE_CODE (lhs) != SSA_NAME) return false; ! code = gimple_assign_rhs_code (stmt); ! if (code != PLUS_EXPR ! && code != MINUS_EXPR ! && code != POINTER_PLUS_EXPR) return false; preinc = gimple_assign_rhs1 (stmt); if (TREE_CODE (preinc) != SSA_NAME) return false; Index: gcc/tree-ssa-forwprop.c === *** gcc/tree-ssa-forwprop.c (revision 178628) --- gcc/tree-ssa-forwprop.c (working copy) *** ssa_forward_propagate_and_combine (void) *** 2377,2397 else gsi_next (&gsi); } ! else if (code == POINTER_PLUS_EXPR && can_propagate_from (stmt)) { ! if (TREE_CODE (gimple_assign_rhs2 (stmt)) == INTEGER_CST /* ??? Better adjust the interface to that function instead of building new trees here. */ && forward_propagate_addr_expr ! (lhs, ! build1 (ADDR_EXPR, ! TREE_TYPE (rhs), ! fold_build2 (MEM_REF, ! TREE_TYPE (TREE_TYPE (rhs)), ! rhs, ! fold_convert ! (ptr_type_node, !gimple_assign_rhs2 (stmt)) { release_defs (stmt); todoflags |= TODO_remove_unused_locals; --- 2377,2399 else gsi_next (&gsi); } ! else if (code == POINTER_PLUS_EXPR) { ! tree off = gimple_assign_rhs2 (stmt); ! if (TREE_CODE (off) == INTEGER_CST ! && can_propagate_from (stmt) ! && !simple_iv_increment_p (stmt) /* ??? Better adjust the interface to that function instead of building new trees here. */ && forward_propagate_addr_expr ! (lhs, ! build1_loc (gimple_location (stmt), ! ADDR_EXPR, TREE_TYPE (rhs), ! fold_build2 (MEM_REF, !TREE_TYPE (TREE_TYPE (rhs)), !rhs, !fold_convert (ptr_type_node, ! off) { release_defs (stmt); todoflags |= TODO_remove_unused_locals;
[Patch, Darwin] Make the darwin port a little more friendly to X and Native X cases
I found myself building a lot of X's and native X's recently - linux - > darwin; i686-darwin -> ppc-darwin ; i686-darwin9 -> x86_64-darwin10. Amongst other issues (primarily wrong auto-host.h decisions) there is an issue that the target headers (and some GCC code) make use of __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ which does not get set (IMHO) sensibly for CROSS_DIRECTORY_STRUCTURE. In fact, as things stand, darwin-driver.c pretty much ignores any attempt to control the value for that case. --- So I did the following; when CROSS_DIRECTORY_STRUCTURE is set - we pick a default for the osx- version-min that is set by the target header. we also allow the user to override this with MACOSX_DEPLOYMENT_TARGET. Attached is a tidied version (which is currently bootstrapping as a check) of the one I have been using. WDYT? ok for trunk (after a re-check)? gcc: *config/darwin-driver.c (darwin_find_version_from_kernel): New routine cut from... ... (darwin_default_min_version): amended to provide defaults for the cross directory case. (darwin_driver_init): call darwin_default_min_version unconditionally. * config/darwin.h (DEF_MIN_OSX_VERSION): New. * config/darwin9.h: Likewise. * config/darwin10.h: Likewise. * config/rs6000/darwin7.h: Likewise. Index: gcc/config/rs6000/darwin7.h === --- gcc/config/rs6000/darwin7.h (revision 178631) +++ gcc/config/rs6000/darwin7.h (working copy) @@ -28,3 +28,6 @@ along with GCC; see the file COPYING3. If not see #define LIB_SPEC "%{!static:\ %:version-compare(!< 10.3 mmacosx-version-min= -lmx)\ -lSystem}" + +#undef DEF_MIN_OSX_VERSION +#define DEF_MIN_OSX_VERSION "10.3.9" Index: gcc/config/darwin.h === --- gcc/config/darwin.h (revision 178631) +++ gcc/config/darwin.h (working copy) @@ -945,4 +945,8 @@ extern void darwin_driver_init (unsigned int *,str #undef SUPPORTS_INIT_PRIORITY #define SUPPORTS_INIT_PRIORITY 0 +/* When building cross-compilers (and native crosses) we shall default to + providing an osx-version-min of this unless overridden by the User. */ +#define DEF_MIN_OSX_VERSION "10.4" + #endif /* CONFIG_DARWIN_H */ Index: gcc/config/darwin10.h === --- gcc/config/darwin10.h (revision 178631) +++ gcc/config/darwin10.h (working copy) @@ -27,3 +27,6 @@ along with GCC; see the file COPYING3. If not see "%:version-compare(>= 10.6 mmacosx-version-min= -no_compact_unwind) \ %{!static:%{!static-libgcc: \ %:version-compare(>= 10.6 mmacosx-version-min= -lSystem) } } %G %L" + +#undef DEF_MIN_OSX_VERSION +#define DEF_MIN_OSX_VERSION "10.6" Index: gcc/config/darwin-driver.c === --- gcc/config/darwin-driver.c (revision 178631) +++ gcc/config/darwin-driver.c (working copy) @@ -29,9 +29,74 @@ along with GCC; see the file COPYING3. If not see #include #include "xregex.h" +static bool +darwin_find_version_from_kernel (char *new_flag) +{ + char osversion[32]; + size_t osversion_len = sizeof (osversion) - 1; + static int osversion_name[2] = { CTL_KERN, KERN_OSRELEASE }; + int major_vers; + char minor_vers[6]; + char * version_p; + char * version_pend; + + /* Determine the version of the running OS. If we can't, warn user, + and do nothing. */ + if (sysctl (osversion_name, ARRAY_SIZE (osversion_name), osversion, + &osversion_len, NULL, 0) == -1) +{ + warning (0, "sysctl for kern.osversion failed: %m"); + return false; +} + + /* Try to parse the first two parts of the OS version number. Warn + user and return if it doesn't make sense. */ + if (! ISDIGIT (osversion[0])) +goto parse_failed; + major_vers = osversion[0] - '0'; + version_p = osversion + 1; + if (ISDIGIT (*version_p)) +major_vers = major_vers * 10 + (*version_p++ - '0'); + if (major_vers > 4 + 9) +goto parse_failed; + if (*version_p++ != '.') +goto parse_failed; + version_pend = strchr(version_p, '.'); + if (!version_pend) +goto parse_failed; + if (! ISDIGIT (*version_p)) +goto parse_failed; + strncpy(minor_vers, version_p, version_pend - version_p); + minor_vers[version_pend - version_p] = '\0'; + + /* The major kernel version number is 4 plus the second OS version + component. */ + if (major_vers - 4 <= 4) +/* On 10.4 and earlier, the old linker is used which does not + support three-component system versions. */ +sprintf (new_flag, "10.%d", major_vers - 4); + else +sprintf (new_flag, "10.%d.%s", major_vers - 4, +minor_vers); + + return true; + + parse_failed: + warning (0, "couldn%'t understand kern.osversion %q.*s", + (int) osversion_len, osversion); + return false; +} + +#endif + /* When running on a Darwin system and usin
Re: Add unwind information to mips epilogues
On Wed, 7 Sep 2011, Richard Guenther wrote: > With async signals we can at least get interrupted in the middle of an > epilogue. What you are allowed to do here (throw an exception? > perform manual unwinding? use gdb which unwinds?) is another > question. ISTR customer requests for this feature at least (which > I think was doing profiling stuff). Profiling this way is discussed in Nathan Froyd et al's paper in the 2006 Summit proceedings. -- Joseph S. Myers jos...@codesourcery.com
[PATCH] Propagate out predicate inversions in forwprop
This makes sure that we propagate comparisons that we cannot invert into inverted conditions by swapping edges or the conditional ops. For the testcase it transforms : D.2724_4 = xx_2(D) < xy_3(D); p_5 = (int) D.2724_4; D.2725_6 = p_5 == 0; np_7 = (int) D.2725_6; if (np_7 != 0) to : if (xx_2(D) < xy_3(D)) while without the patch we would be left with : D.2724_4 = xx_2(D) < xy_3(D); if (D.2724_4 == 0) Bootstrap and regtest ongoing on x86_64-unknown-linux-gnu. Richard. 2011-09-07 Richard Guenther * tree-ssa-forwprop.c (forward_propagate_into_gimple_cond): Canonicalize negated predicates by swapping edges. (forward_propagate_into_cond): Likewise. * gcc.dg/tree-ssa/forwprop-16.c: New testcase. Index: gcc/tree-ssa-forwprop.c === *** gcc/tree-ssa-forwprop.c (revision 178633) --- gcc/tree-ssa-forwprop.c (working copy) *** forward_propagate_into_gimple_cond (gimp *** 534,539 --- 534,556 return (cfg_changed || is_gimple_min_invariant (tmp)) ? 2 : 1; } + /* Canonicalize _Bool == 0 and _Bool != 1 to _Bool != 0 by swapping edges. */ + if ((TREE_CODE (TREE_TYPE (rhs1)) == BOOLEAN_TYPE +|| (INTEGRAL_TYPE_P (TREE_TYPE (rhs1)) + && TYPE_PRECISION (TREE_TYPE (rhs1)) == 1)) + && ((code == EQ_EXPR + && integer_zerop (rhs2)) + || (code == NE_EXPR + && integer_onep (rhs2 + { + basic_block bb = gimple_bb (stmt); + gimple_cond_set_code (stmt, NE_EXPR); + gimple_cond_set_rhs (stmt, build_zero_cst (TREE_TYPE (rhs1))); + EDGE_SUCC (bb, 0)->flags ^= (EDGE_TRUE_VALUE|EDGE_FALSE_VALUE); + EDGE_SUCC (bb, 1)->flags ^= (EDGE_TRUE_VALUE|EDGE_FALSE_VALUE); + return 1; + } + return 0; } *** forward_propagate_into_cond (gimple_stmt *** 548,553 --- 565,571 gimple stmt = gsi_stmt (*gsi_p); tree tmp = NULL_TREE; tree cond = gimple_assign_rhs1 (stmt); + bool swap = false; /* We can do tree combining on SSA_NAME and comparison expressions. */ if (COMPARISON_CLASS_P (cond)) *** forward_propagate_into_cond (gimple_stmt *** 557,573 TREE_OPERAND (cond, 1)); else if (TREE_CODE (cond) == SSA_NAME) { tree name = cond; gimple def_stmt = get_prop_source_stmt (name, true, NULL); if (!def_stmt || !can_propagate_from (def_stmt)) return 0; ! if (TREE_CODE_CLASS (gimple_assign_rhs_code (def_stmt)) == tcc_comparison) tmp = fold_build2_loc (gimple_location (def_stmt), ! gimple_assign_rhs_code (def_stmt), boolean_type_node, gimple_assign_rhs1 (def_stmt), gimple_assign_rhs2 (def_stmt)); } if (tmp) --- 575,601 TREE_OPERAND (cond, 1)); else if (TREE_CODE (cond) == SSA_NAME) { + enum tree_code code; tree name = cond; gimple def_stmt = get_prop_source_stmt (name, true, NULL); if (!def_stmt || !can_propagate_from (def_stmt)) return 0; ! code = gimple_assign_rhs_code (def_stmt); ! if (TREE_CODE_CLASS (code) == tcc_comparison) tmp = fold_build2_loc (gimple_location (def_stmt), ! code, boolean_type_node, gimple_assign_rhs1 (def_stmt), gimple_assign_rhs2 (def_stmt)); + else if ((code == BIT_NOT_EXPR + && TYPE_PRECISION (TREE_TYPE (cond)) == 1) + || (code == BIT_XOR_EXPR + && integer_onep (gimple_assign_rhs2 (def_stmt + { + tmp = gimple_assign_rhs1 (def_stmt); + swap = true; + } } if (tmp) *** forward_propagate_into_cond (gimple_stmt *** 586,592 else if (integer_zerop (tmp)) gimple_assign_set_rhs_from_tree (gsi_p, gimple_assign_rhs3 (stmt)); else ! gimple_assign_set_rhs1 (stmt, unshare_expr (tmp)); stmt = gsi_stmt (*gsi_p); update_stmt (stmt); --- 614,628 else if (integer_zerop (tmp)) gimple_assign_set_rhs_from_tree (gsi_p, gimple_assign_rhs3 (stmt)); else ! { ! gimple_assign_set_rhs1 (stmt, unshare_expr (tmp)); ! if (swap) ! { ! tree t = gimple_assign_rhs2 (stmt); ! gimple_assign_set_rhs2 (stmt, gimple_assign_rhs3 (stmt)); ! gimple_assign_set_rhs3 (stmt, t); ! } ! } stmt = gsi_stmt (*gsi_p); update_stmt (stmt); Index: gcc/testsuite/gcc.dg/tree-ssa/forwprop-16.c === *** gcc/testsuite/gcc.dg/tree-ss
Re: [Patch, testsuite] Skip case ipa-sra-2.c for strict_align target.
Hi, On Wed, Sep 07, 2011 at 11:35:53AM +0200, Richard Guenther wrote: > On Wed, Sep 7, 2011 at 9:47 AM, Terry Guo wrote: > > Hello, > > > > The SRA optimization requires the reference to struct/union member must be > > aligned to their natural boundary e.g. (int *) must be aligned to 4 byte > > boundary. This is done in function tree_non_mode_aligned_mem_p. For target > > like x86 that define "STRICT_ALIGNMENT" to 0, the function return false. > > Afterward, the SRA is conducted. For target like ARM or MIPS that define > > "STRICT_ALIGNMENT" to 1, the alignment status is checked by "align = > > get_object_alignment (exp)". The function get_object_alignment rely on SSA > > and tend to over-conservative. So for most cases, the SRA is stopped here. > > > > This patch intends to skip this case for target that set STRICT_ALIGNMENT to > > 1 otherwise the case will fail due to the SRA isn't performed actually. OK > > to commit to trunk? > > Hm, the testcase looks like it should actually pass even for strict-align > targets. Martin? > Well, tree_non_mode_aligned_mem_p clearly does not really work very well and needs a more-or-less reimplementation, there has been a discussion about this already in August (and you even had a suggestion): http://gcc.gnu.org/ml/gcc-patches/2011-08/msg00931.html This has been only slowly moving towards the top of my TODO list but I am aware of it and at the moment it is almost there, I should be looking at this issue pretty soon. The testcase certainly should pass also on strict alignment architectures and I'd prefer if it stayed enabled for them. Martin > Richard. > > > BR, > > Terry > > > > 2011-09-07 Terry Guo > > > > * gcc.dg/ipa/ipa-sra-2.c: Only run on > > targets that are non_strict_align. > > > > > > diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-sra-2.c > > b/gcc/testsuite/gcc.dg/ipa/ipa-sra-2.c > > index 3437a81..c6b4d63 100644 > > --- a/gcc/testsuite/gcc.dg/ipa/ipa-sra-2.c > > +++ b/gcc/testsuite/gcc.dg/ipa/ipa-sra-2.c > > @@ -1,5 +1,6 @@ > > /* { dg-do compile } */ > > /* { dg-options "-O2 -fipa-sra -fdump-tree-eipa_sra-details" } */ > > +/* { dg-require-effective-target non_strict_align } */ > > > > struct bovid > > { > > > > > >
Re: Add unwind information to mips epilogues
On Wed, Sep 07, 2011 at 12:28:30PM +0200, Bernd Schmidt wrote: > Question for Richard H.: What is this actually good for, other than > presenting consistent information to dwarf2cfi? Do we actually expect > code to unwind through the middle of an epilogue? With -fasynchronous-unwind-tables and e.g. async cancellation enabled pthread_signal may be handled anywhere. There have been several bug reports e.g. against glibc, which is why Richard implemented the epilogue unwinding on various targets. Additionally, if the debugger uses the unwind info, when you step through the epilogue, you want precise unwind info too. Jakub
RE: [Patch, testsuite] Skip case ipa-sra-2.c for strict_align target.
Hello, > > > > Hm, the testcase looks like it should actually pass even for strict- > align > > targets. Martin? > > > > Well, tree_non_mode_aligned_mem_p clearly does not really work very > well and needs a more-or-less reimplementation, there has been a > discussion about this already in August (and you even had a > suggestion): > > http://gcc.gnu.org/ml/gcc-patches/2011-08/msg00931.html > > This has been only slowly moving towards the top of my TODO list but I > am aware of it and at the moment it is almost there, I should be > looking at this issue pretty soon. > > The testcase certainly should pass also on strict alignment > architectures and I'd prefer if it stayed enabled for them. > > Martin > Sorry for missing that mail thread. After read it, I agree with you guys. Let us keep this case for strict alignment architecture. Hope the improvement can be done soon. I also have a strong interest on checking alignment. Thanks very much. Best regards, Terry
[PATCH] Fix PR50319, if-conversion behaving weirdly
This fixes if-conversion to properly track inversion in its (topmost) predicate. Spurious gimplification made this code never work (it doesn't work at least on the 4.6 branch either). Bootstrap and regtest ongoing on x86_64-unknown-linux-gnu. Richard. 2011-09-07 Richard Guenther PR tree-optimization/50319 * tree-if-conv.c (set_bb_predicate): Assert we only set canonical predicates. (add_to_predicate_list): Simplify. Allow TRUTH_NOT_EXPR around canonical predicates. (predicate_bbs): Do not re-gimplify already canonical predicates. Properly unshare them though. (find_phi_replacement_condition): Simplify. Index: gcc/tree-if-conv.c === --- gcc/tree-if-conv.c (revision 178633) +++ gcc/tree-if-conv.c (working copy) @@ -137,6 +137,9 @@ bb_predicate (basic_block bb) static inline void set_bb_predicate (basic_block bb, tree cond) { + gcc_assert ((TREE_CODE (cond) == TRUTH_NOT_EXPR + && is_gimple_condexpr (TREE_OPERAND (cond, 0))) + || is_gimple_condexpr (cond)); ((bb_predicate_p) bb->aux)->predicate = cond; } @@ -328,7 +331,7 @@ fold_or_predicates (location_t loc, tree static inline void add_to_predicate_list (basic_block bb, tree nc) { - tree bc; + tree bc, *tp; if (is_true_predicate (nc)) return; @@ -339,19 +342,25 @@ add_to_predicate_list (basic_block bb, t { bc = bb_predicate (bb); bc = fold_or_predicates (EXPR_LOCATION (bc), nc, bc); + if (is_true_predicate (bc)) + { + reset_bb_predicate (bb); + return; + } } - if (!is_gimple_condexpr (bc)) + /* Allow a TRUTH_NOT_EXPR around the main predicate. */ + if (TREE_CODE (bc) == TRUTH_NOT_EXPR) +tp = &TREE_OPERAND (bc, 0); + else +tp = &bc; + if (!is_gimple_condexpr (*tp)) { gimple_seq stmts; - bc = force_gimple_operand (bc, &stmts, true, NULL_TREE); + *tp = force_gimple_operand_1 (*tp, &stmts, is_gimple_condexpr, NULL_TREE); add_bb_predicate_gimplified_stmts (bb, stmts); } - - if (is_true_predicate (bc)) -reset_bb_predicate (bb); - else -set_bb_predicate (bb, bc); + set_bb_predicate (bb, bc); } /* Add the condition COND to the previous condition PREV_COND, and add @@ -944,14 +953,6 @@ predicate_bbs (loop_p loop) } cond = bb_predicate (bb); - if (cond - && bb != loop->header) - { - gimple_seq stmts; - - cond = force_gimple_operand (cond, &stmts, true, NULL_TREE); - add_bb_predicate_gimplified_stmts (bb, stmts); - } for (itr = gsi_start_bb (bb); !gsi_end_p (itr); gsi_next (&itr)) { @@ -980,14 +981,17 @@ predicate_bbs (loop_p loop) &true_edge, &false_edge); /* If C is true, then TRUE_EDGE is taken. */ - add_to_dst_predicate_list (loop, true_edge, cond, unshare_expr (c)); + add_to_dst_predicate_list (loop, true_edge, + unshare_expr (cond), + unshare_expr (c)); /* If C is false, then FALSE_EDGE is taken. */ c2 = invert_truthvalue_loc (loc, unshare_expr (c)); tem = canonicalize_cond_expr_cond (c2); if (tem) c2 = tem; - add_to_dst_predicate_list (loop, false_edge, cond, c2); + add_to_dst_predicate_list (loop, false_edge, + unshare_expr (cond), c2); cond = NULL_TREE; break; @@ -1237,7 +1241,7 @@ find_phi_replacement_condition (struct l *cond = bb_predicate (second_edge->src); if (TREE_CODE (*cond) == TRUTH_NOT_EXPR) - *cond = invert_truthvalue (*cond); + *cond = TREE_OPERAND (*cond, 0); else /* Select non loop header bb. */ first_edge = second_edge; @@ -1245,18 +1249,10 @@ find_phi_replacement_condition (struct l else *cond = bb_predicate (first_edge->src); - /* Gimplify the condition: the vectorizer prefers to have gimple - values as conditions. Various targets use different means to - communicate conditions in vector compare operations. Using a - gimple value allows the compiler to emit vector compare and - select RTL without exposing compare's result. */ - *cond = force_gimple_operand_gsi (gsi, unshare_expr (*cond), - false, NULL_TREE, - true, GSI_SAME_STMT); - if (!is_gimple_reg (*cond) && !is_gimple_condexpr (*cond)) -*cond = ifc_temp_var (TREE_TYPE (*cond), unshare_expr (*cond), gsi); - - gcc_assert (*cond); + /* Gimplify the condition to a valid cond-expr conditonal operand. */ + *cond = force_gimple_operand_gsi_1 (gsi, unshare_expr (*cond), +
Re: Vector Comparison patch
On Tue, Sep 6, 2011 at 3:56 PM, Richard Guenther wrote: > On Tue, Sep 6, 2011 at 4:50 PM, Artem Shinkarov > 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 >> >> 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. I missed the way you applied constant_boolean node, sorry for that. But fold_unary_loc seems confusing to me. We have the following code: else if (!INTEGRAL_TYPE_P (type)) return build3_loc (loc, COND_EXPR, type, op0, constant_boolean_node (true, type), constant_boolean_node (false, type)); But this is wrong for the vector types, because it should construct VEC_COND_EXPR, not COND_EXPR. That is why I had a special case for vectors. >> * 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. >> > All the rest is adjusted in the new version of the patch you can find in the attachment. ChangLog 20011-09-06 Artjoms Sinkarovs gcc/ * expr.c (do_store_flag): 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. 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. 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
Re: [google][main]Fix broken test cases in google/main branch (issue4961065)
On Tue, Sep 6, 2011 at 21:44, Sriraman Tallam wrote: > 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. OK, thanks for the fix. Diego.
Re: [PATCH] Make SRA produce integer replacements for enumeration types
Hi, On Wed, Sep 07, 2011 at 10:08:29AM +0200, Richard Guenther wrote: > On Tue, 6 Sep 2011, Martin Jambor wrote: > > 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? > > Ok. Can you add the testcase from the PR? > Well, as I said, it does not fail even wothout the patch but why not. This is the patch I wichh commit in a few moments. Thanks, Martin 2011-09-07 Martin Jambor PR tree-optimization/49911 * tree-sra.c (analyze_access_subtree): Change type of to-be-replaced enumerations to the corresponding plain integer type. * testsuite/g++.dg/tree-ssa/pr49911.C: New test. 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; Index: src/gcc/testsuite/g++.dg/tree-ssa/pr49911.C === --- /dev/null +++ src/gcc/testsuite/g++.dg/tree-ssa/pr49911.C @@ -0,0 +1,41 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-rtti -fno-exceptions -fno-strict-aliasing -fdump-tree-vrp2" } */ + + +extern void JS_Assert(); +typedef enum { +eax, ecx, edx, ebx, esp, ebp, +esi, edi } +RegisterID; +union StateRemat { + RegisterID reg_; + int offset_; +}; +static StateRemat FromRegister(RegisterID reg) { + StateRemat sr; + sr.reg_ = reg; + return sr; +} +static StateRemat FromAddress3(int address) { + StateRemat sr; +sr.offset_ = address; + //sr.offset_ = 0; + if (address < 46 &&address >= 0) { +JS_Assert(); + } + return sr; +} +struct FrameState { + StateRemat dataRematInfo2(bool y, int z) { +if (y) return FromRegister(RegisterID(1)); +return FromAddress3(z); + } +}; +FrameState frame; +StateRemat x; +void jsop_setelem(bool y, int z) { + x = frame.dataRematInfo2(y, z); +} + +/* { dg-final { scan-tree-dump-times "Folding predicate.*45" 0 "vrp2"} } */ +/* { dg-final { cleanup-tree-dump "vrp2" } } */
[PATCH][1/n] Fix parts of PR19831
This fixes the easy piece of PR19831 - removal of "dead" calls to allocation functions (thus, memleaks). It looks like this should be valid even for corner-cases like errno = 0; malloc (whatever); if (errno != 0) ...; as there is no standard defined value for whatever that is guaranteed to make malloc fail. Thus you'd have to test its return value in which case it wouldn't be dead (the above woulds simply always appear as if malloc worked). In practice the patch will do something about alloca at most, unless, of course, you have a memleak that you don't use ;) Followups will eventually lead us to remove a malloc/free pair as well (a free currently constitutes as a use of the allocated storage). Bootstrap and regtest running on x86_64-unknown-linux-gnu. Richard. 2011-09-07 Richard Guenther PR tree-optimization/19831 * tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Do not mark allocation functions as necessary. * gcc.dg/tree-ssa/ssa-dce-8.c: New testcase. Index: gcc/tree-ssa-dce.c === *** gcc/tree-ssa-dce.c (revision 178633) --- gcc/tree-ssa-dce.c (working copy) *** mark_stmt_if_obviously_necessary (gimple *** 299,315 return; case GIMPLE_CALL: ! /* Most, but not all function calls are required. Function calls that !produce no result and have no side effects (i.e. const pure !functions) are unnecessary. */ ! if (gimple_has_side_effects (stmt)) ! { ! mark_stmt_necessary (stmt, true); return; ! } ! if (!gimple_call_lhs (stmt)) ! return; ! break; case GIMPLE_DEBUG: /* Debug temps without a value are not useful. ??? If we could --- 299,327 return; case GIMPLE_CALL: ! { ! tree callee = gimple_call_fndecl (stmt); ! if (callee != NULL_TREE ! && DECL_BUILT_IN_CLASS (callee) == BUILT_IN_NORMAL) ! switch (DECL_FUNCTION_CODE (callee)) ! { ! case BUILT_IN_MALLOC: ! case BUILT_IN_CALLOC: ! case BUILT_IN_ALLOCA: ! return; ! } ! /* Most, but not all function calls are required. Function calls that ! produce no result and have no side effects (i.e. const pure ! functions) are unnecessary. */ ! if (gimple_has_side_effects (stmt)) ! { ! mark_stmt_necessary (stmt, true); ! return; ! } ! if (!gimple_call_lhs (stmt)) return; ! break; ! } case GIMPLE_DEBUG: /* Debug temps without a value are not useful. ??? If we could Index: gcc/testsuite/gcc.dg/tree-ssa/ssa-dce-8.c === *** gcc/testsuite/gcc.dg/tree-ssa/ssa-dce-8.c (revision 0) --- gcc/testsuite/gcc.dg/tree-ssa/ssa-dce-8.c (revision 0) *** *** 0 --- 1,12 + /* { dg-do compile } */ + /* { dg-options "-O -fdump-tree-optimized" } */ + + int main() + { + int *p = __builtin_malloc (4); + *p = 4; + return 0; + } + + /* { dg-final { scan-tree-dump-not "malloc" "optimized" } } */ + /* { dg-final { cleanup-tree-dump "optimized" } } */
Re: [PATCH][ARM] pr50193: ICE on a | (b << negative-constant)
On 5 September 2011 18:07, Andrew Stubbs wrote: > On 01/09/11 17:21, Andrew Stubbs wrote: >> >> I wasn't sure how to find the mode of shift operand in the predicate >> though, so I've assumed they're always the same size. How would one find >> the proper mode in a predicate? > > OK, no reply, so I'm just going to assume we're dealing with 32-bit > registers. > > Additionally, Richard Sandiford has pointed out that changing the predicate > such that it is more restrictive than the constraints is a problem because > reload apparently ignores the predicates under certain circumstances. > Setting aside that that seems broken and wrong (what's the point in a > predicate if you're just going to ignore it), this patch also creates a new > constraint "Pm" that limits the range to match the predicate. > > Speaking of which, I've limited the constants to the range 1..31 (inclusive) > because a) allowing zero seems like it would be counter-productive - it > would be better to keep a zero shift as a separate operation that can be > optimized away (probably not an issue, but there it is); and b) allowing > zero would produce non-canonical assembler (which is not a problem now, but > is still best avoided). > > I have a bootstrap test running now. Assuming that succeeds, is this ok? This is a summary of what we discussed on IRC for others to also comment. This doesn't capture the case of mult by power_of_two in arith_shiftsi . So this testcase below int * foo (int *x , int y) { return x + (y << 24); } will fail . There are 2 options as we discussed on IRC . 1. as you suggested a check in shift_operator for the shift amount. 2. add an alternative for the M constraint but enable it using insn_enabled only if the mult_operator is valid. This sort of cries to be rewritten with iterators and then we can retain the mult case as a specific pattern only with the M constraint but that is a significant rewrite. > +;; in Thumb-2 state: Pj, PJ, Pm, Ps, Pt, Pu, Pv, Pw, Px, Py Minor nit - Pm is valid for both ARM / Thumb2 state and not just Thumb2 unlike the other constraints in the list above. Hope this helps. Ramana > > Andrew > >
Re: Vector shuffling
On Sat, 3 Sep 2011, Artem Shinkarov wrote: > > 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. > +res = __builtin_shuffle2 (a, b, mask2); /* res is @{1,5,3,6@} */ Elsewhere it's __builtin_shuffle for the variants with both numbers of arguments. > Index: gcc/c-family/c-common.h > === > --- gcc/c-family/c-common.h (revision 178354) > +++ gcc/c-family/c-common.h (working copy) > @@ -898,6 +898,7 @@ extern tree build_function_call (locatio > > extern tree build_function_call_vec (location_t, tree, >VEC(tree,gc) *, VEC(tree,gc) *); > +extern tree c_build_vec_shuffle_expr (location_t, tree, tree, tree); Since this function is actually defined in c-typeck.c, not in c-family code, the declaration should go in c-tree.h not c-common.h. > +/* Return true if VEC_SHUFF_EXPR can be expanded using SIMD extensions VEC_SHUFFLE_EXPR > Index: gcc/c-typeck.c > === > +/* Build a VEC_SHUFFLE_EXPR if V0, V1 and MASK are not error_mark_nodes > + and have vector types, V0 has the same type as V1, and the number of > + elements of V0, V1, MASK is the same. */ > +tree > +c_build_vec_shuffle_expr (location_t loc, tree v0, tree v1, tree mask) > +{ > + tree vec_shuffle, tmp; > + bool wrap = true; > + bool maybe_const = false; > + bool two_arguments = v0 == v1; Relying on pointer comparison to determine the number of arguments seems error-prone; a convention of passing NULL_TREE for v1 in the two-argument case would be better. Consider the case where v0 and v1 both refer to the same volatile DECL (so at present would have the same tree), which is a three-argument case where the variable should be read from twice. The documentation seems to suggest that in the two-argument case the mask values must be within a single vector whereas the implementation treats the two-argument case as if the first argument is passed twice (so twice the range of mask values) but only evaluated once. If the twice-the-range is intended semantics, it should be documented; otherwise there should be a comment noting that it's an implementation accident and not guaranteed semantics for users. > + if (TREE_TYPE (v0) != TREE_TYPE (v1)) > +{ > + error_at (loc, "__builtin_shuffle argument vectors must be of " > + "the same type"); > + return error_mark_node; > +} What if one is const-qualified or a typedef, and the other isn't? That should still be allowed, and I don't see any testcases for it. You may need to use TYPE_MAIN_VARIANT. > @@ -6120,7 +6201,14 @@ digest_init (location_t init_loc, tree t > tree value; > bool constant_p = true; > > - /* Iterate through elements and check if all constructor > + /* If constructor has less elements than the vector type. */ > + if (CONSTRUCTOR_NELTS (inside_init) > + < TYPE_VECTOR_SUBPARTS (TREE_TYPE (inside_init))) > +warning_at (init_loc, 0, "vector length does not match " > + "initializer length, zero elements " > + "will be inserted"); > + This looks unrelated to the other changes and should be submitted separately with its own testcase and rationale if you wish to propose it as a patch. > case RID_CHOOSE_EXPR: > - expr = integer_zerop (c) ? e3 : e2; > + expr.value = integer_zerop (c) ? e3value : e2value; I think you should preserve the original_type value of the operand as well (meaning you need to use the p_orig_types operand to c_parser_expr_list). This is only relevant to __builtin_choose_expr, not the other pseudo-builtins. -- Joseph S. Myers jos...@codesourcery.com
Re: Vector Comparison patch
This looks like it has the same issue with maybe needing to use TYPE_MAIN_VARIANT in type comparisons as the shuffle patch. -- Joseph S. Myers jos...@codesourcery.com
Re: [patch][google/integration] Add lightweight checks to vector::begin et. al. (issue4973065)
On Wed, Sep 7, 2011 at 2:34 AM, Pedro Alves wrote: > Zeroing out would hide bugs; there's lots of code that does > > delete ptr; > ... > if (ptr) > { > ptr->... > } > > You'd not see the bug that way. Making 'delete v' clobber the pointer > with 0xdeadbeef or ~0 instead would be better. Right. In practice, I don't believe I've ever seen this bug in such a "pure" form though. What I often see is ptr = new Foo; DoSomethingInAnotherThread(ptr); ... delete ptr; // Oops. Didn't wait for another thread to finish } Or ptr = new Foo; DoSomethingThatDeletes(ptr); ptr->x++; // Oops. Use after free AFAICT, neither of these would be helped by delete stomping on the pointer. -- Paul Pluzhnikov
Re: [PATCH][ARM] pr50193: ICE on a | (b << negative-constant)
On 01/09/11 16:51, Jakub Jelinek wrote: > 1) shift by 0 is well defined (though not sure if arm backend >supports it) The canonical form of ( (x) (const_int 0)) is just (x) So while it's well defined, it's also useless.
[trans-mem] Fix compilation of libitm with recent gcc
Here the error when gcc compiles libitm: ../../../transactional-memory/libitm/aatree.h: In constructor ‘GTM::aa_node_base::aa_node_base(GTM::aa_node_base::level_type)’: ../../../transactional-memory/libitm/aatree.h:53:16: error: list-initializer for non-class type must not be parenthesized [-Werror] The fix just consists to remove the parenthesis. Patrick. Index: aatree.h === --- aatree.h(revision 178056) +++ aatree.h(working copy) @@ -48,8 +48,8 @@ public: aa_node_base(level_type l = 1) -: m_link({ const_cast(&s_nil), -const_cast(&s_nil) }), +: m_link { const_cast(&s_nil), +const_cast(&s_nil) }, m_level(l) { }
[PATCH, testsuite, committed] Add -fstrict-enums to pr49911.C
Hi, I forgot to add -fstrict-enums flag totestsuite/g++.dg/tree-ssa/pr49911.C. Committed as obvious. Thanks, Martin
Re: Add unwind information to mips epilogues
Testing with the shrink-wrapping patch added reveals a problem with the mips16 "save" insn: sometimes we store registers that shouldn't be considered saved registers; we have to clear RTX_FRAME_RELATED_P for these. Testing in progress with mips-elf, "ips16/arch=mips32r2/abi=32" and some other multilibs. Ok? Bernd * config/mips/mips.c (mips16e_build_save_restore): Clear RTX_FRAME_RELATED_P for argument stores stolen from the first block. Index: gcc/config/mips/mips.c === --- gcc/config/mips/mips.c (revision 178135) +++ gcc/config/mips/mips.c (working copy) @@ -8448,6 +8456,7 @@ mips16e_build_save_restore (bool restore offset = top_offset + i * UNITS_PER_WORD; set = mips16e_save_restore_reg (restore_p, offset, GP_ARG_FIRST + i); XVECEXP (pattern, 0, n++) = set; + RTX_FRAME_RELATED_P (set) = 0; } /* Then fill in the other register moves. */
Re: [PATCH][1/n] Fix parts of PR19831
On Wed, Sep 7, 2011 at 7:31 AM, Richard Guenther wrote: > In practice the patch will do something about alloca at most, > unless, of course, you have a memleak that you don't use ;) I think we have "alloca (0);" being required still and aligning the stack. Thanks, Andrew Pinski
Re: Rename across basic block boundaries
On 09/06/11 12:37, Richard Sandiford wrote: > Maybe here: [...] > 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: > OK with me whichever. Thanks! I've committed the following version after retesting. Bernd Index: gcc/regrename.c === --- gcc/regrename.c (revision 178596) +++ gcc/regrename.c (working copy) @@ -47,18 +47,24 @@ 1. Local def/use chains are built: within each basic block, chains are opened and closed; if a chain isn't closed at the end of the block, - it is dropped. + it is dropped. We pre-open chains if we have already examined a + predecessor block and found chains live at the end which match + live registers at the start of the new block. - 2. For each chain, the set of possible renaming registers is computed. + 2. We try to combine the local chains across basic block boundaries by +comparing chains that were open at the start or end of a block to + those in successor/predecessor blocks. + + 3. For each chain, the set of possible renaming registers is computed. This takes into account the renaming of previously processed chains. Optionally, a preferred class is computed for the renaming register. - 3. The best renaming register is computed for the chain in the above set, + 4. The best renaming register is computed for the chain in the above set, using a round-robin allocation. If a preferred class exists, then the round-robin allocation is done within the class first, if possible. The round-robin allocation of renaming registers itself is global. - 4. If a renaming register has been found, it is substituted in the chain. + 5. If a renaming register has been found, it is substituted in the chain. Targets can parameterize the pass by specifying a preferred class for the renaming register for a given (super)class of registers to be renamed. */ @@ -75,8 +81,9 @@ struct du_head struct du_head *next_chain; /* The first and last elements of this chain. */ struct du_chain *first, *last; - /* Describes the register being tracked. */ - unsigned regno, nregs; + /* Describe the register being tracked, register number and count. */ + unsigned regno; + int nregs; /* A unique id to be used as an index into the conflicts bitmaps. */ unsigned id; @@ -140,6 +147,7 @@ static struct obstack rename_obstack; static void do_replace (struct du_head *, int); static void scan_rtx (rtx, rtx *, enum reg_class, enum scan_actions, enum op_type); +static bool build_def_use (basic_block); typedef struct du_head *du_head_p; DEF_VEC_P (du_head_p); @@ -151,9 +159,8 @@ static unsigned current_id; /* A mapping of unique id numbers to chains. */ static VEC(du_head_p, heap) *id_to_chain; -/* List of currently open chains, and closed chains that can be renamed. */ +/* List of currently open chains. */ static struct du_head *open_chains; -static struct du_head *closed_chains; /* Bitmap of open chains. The bits set always match the list found in open_chains. */ @@ -166,14 +173,33 @@ static HARD_REG_SET live_in_chains; between this and live_in_chains is empty. */ static HARD_REG_SET live_hard_regs; -/* Dump all def/use chains in CHAINS to DUMP_FILE. */ +/* Return the chain corresponding to id number ID. Take into account that + chains may have been merged. */ +static du_head_p +chain_from_id (unsigned int id) +{ + du_head_p first_chain = VEC_index (du_head_p, id_to_chain, id); + du_head_p chain = first_chain; + while (chain->id != id) +{ + id = chain->id; + chain = VEC_index (du_head_p, id_to_chain, id); +} + first_chain->id = id; + return chain; +} + +/* Dump all def/use chains, starting at id FROM. */ static void -dump_def_use_chain (struct du_head *head) +dump_def_use_chain (int from) { - while (head) + du_head_p head; + int i; + FOR_EACH_VEC_ELT_FROM (du_head_p, id_to_chain, i, head, from) { struct du_chain *this_du = head->first; + fprintf (dump_file, "Register %s (%d):", reg_names[head->regno], head->nregs); while (this_du) @@ -215,7 +241,7 @@ mark_conflict (struct du_head *chains, u and record its occurrence in *LOC, which is being written to in INSN. This access requires a register of class CL. */ -static void +static du_head_p create_new_chain (unsigned this_regno, unsigned this_nregs, rtx *loc, rtx insn, enum reg_class cl) { @@ -224,7 +250,6 @@ create_new_chain (unsigned this_regno, u int nregs; head->next_chain = open_chains; - open_chains = head; head->regno = this_regno; head->nregs = this_nregs; head->ne
RFA: MN10300: Fix splitting AND insns
Hi Jeff, Hi Alex, I have finally tracked down a bug in the MN10300 backend which has been causing all kinds of weird behaviour in generated code. The problem was that the pattern to split an AND insn into two shift insns was using a left shift followed by a right shift to clear bits at the *bottom* of a word... It turns out that this was because of the mn10300_split_and_operand_count function which was returning a negative value for both clears at the top of the word and at the bottom. Once I had found this the fix was easy, and with the patch below applied I now have 28 fewer GCC testsuite failures, 7 fewer G++ testsuite failures and no regressions. OK to apply ? Cheers Nick gcc/ChangeLog 2011-09-07 Nick Clifton * config/mn10300/mn10300.c (mn10300_split_and_operand_count): Return a positive value to indicate that the bits at the bottom of the register should be cleared. Index: gcc/config/mn10300/mn10300.c === --- gcc/config/mn10300/mn10300.c(revision 178626) +++ gcc/config/mn10300/mn10300.c(working copy) @@ -2894,7 +2894,7 @@ would be replacing 1 6-byte insn with 2 3-byte insns. */ if (count > (optimize_insn_for_speed_p () ? 2 : 4)) return 0; - return -count; + return count; } else {
[testsuite,committed]: gcc.dg/tree-ssa/ivopts-lt.c add xfails for avr.
Committed this patch as requested by Tom de Vries: http://gcc.gnu.org/viewcvs?view=revision&revision=178646 Johann PR tree-optimization/50322 * gcc.dg/tree-ssa/ivopts-lt.c: Add xfails for avr. Index: gcc.dg/tree-ssa/ivopts-lt.c === --- gcc.dg/tree-ssa/ivopts-lt.c (revision 178645) +++ gcc.dg/tree-ssa/ivopts-lt.c (working copy) @@ -14,7 +14,8 @@ f1 (char *p, unsigned long int i, unsign while (i < n); } -/* { dg-final { scan-tree-dump-times "PHI" 1 "ivopts"} } */ +/* For the fails on avr see PR tree-optimization/50322. */ +/* { dg-final { scan-tree-dump-times "PHI" 1 "ivopts" { xfail { "avr-*-*" } } } } */ /* { dg-final { scan-tree-dump-times "PHI
Re: [C++ Patch] PR 50309
On 09/07/2011 06:37 AM, Paolo Carlini wrote: I have the below simple patch to avoid the ICE after error. Tested x86_64-linux. Is it Ok? In case, if it applies as-is, 4_6-branch too? I think this is a recoverable error; if the exception-specification is ill-formed, let's pretend there wasn't one rather than discard the whole declaration. Jason
[testsuite]: Fix gcc.c-torture/execute/pr48571-1.c (4 -> sizeof(int))
This patch fixes magic number 4 and uses sizeof(int) instead so that the test no more fails on int=16 platforms. Successfully tested on AVR. Johann * gcc.c-torture/execute/pr48571-1.c (bar): Use offsets sizeof(int) instead of 4. Index: gcc.c-torture/execute/pr48571-1.c === --- gcc.c-torture/execute/pr48571-1.c (revision 178527) +++ gcc.c-torture/execute/pr48571-1.c (working copy) @@ -1,3 +1,5 @@ +#define S (sizeof (int)) + unsigned int c[624]; void __attribute__((noinline)) bar (void) @@ -5,9 +7,9 @@ bar (void) unsigned int i; /* Obfuscated c[i] = c[i-1] * 2. */ for (i = 1; i < 624; ++i) -*(unsigned int *)((void *)c + (__SIZE_TYPE__)i * 4) +*(unsigned int *)((void *)c + (__SIZE_TYPE__)i * S) = 2 * *(unsigned int *)((void *)c + ((__SIZE_TYPE__)i + -((__SIZE_TYPE__)-4)/4) * 4); +((__SIZE_TYPE__)-S)/S) * S); } extern void abort (void); int
Re: [Patch, Ada, Darwin] Restore PowerPC Darwin Ada bootstrap (after a looong time, it seems).
On Sep 7, 2011, at 12:22 AM, Iain Sandoe wrote: > OK for trunk ( + 4.6 after a re-check and with a suitable variant of > system-darwin-ppc64.ads )? Ok.
Re: [C++ Patch] PR 50309
On 09/07/2011 06:41 PM, Jason Merrill wrote: On 09/07/2011 06:37 AM, Paolo Carlini wrote: I have the below simple patch to avoid the ICE after error. Tested x86_64-linux. Is it Ok? In case, if it applies as-is, 4_6-branch too? I think this is a recoverable error; if the exception-specification is ill-formed, let's pretend there wasn't one rather than discard the whole declaration. Agreed. I'm finishing testing the below. Ok if it passes? Paolo. /// Index: testsuite/g++.dg/cpp0x/noexcept14.C === --- testsuite/g++.dg/cpp0x/noexcept14.C (revision 0) +++ testsuite/g++.dg/cpp0x/noexcept14.C (revision 0) @@ -0,0 +1,4 @@ +// PR c++/50309 +// { dg-options -std=c++0x } + +void foo () noexcept () { } // { dg-error "expected" } Index: cp/decl.c === --- cp/decl.c (revision 178631) +++ cp/decl.c (working copy) @@ -9049,6 +9049,10 @@ grokdeclarator (const cp_declarator *declarator, virt_specifiers = declarator->u.function.virt_specifiers; /* Pick up the exception specifications. */ raises = declarator->u.function.exception_specification; + /* If the exception-specification is ill-formed, let's pretend + there wasn't one. */ + if (raises == error_mark_node) + raises = NULL_TREE; /* Say it's a definition only for the CALL_EXPR closest to the identifier. */
Re: [Patch, Darwin] Make the darwin port a little more friendly to X and Native X cases
On Sep 7, 2011, at 4:30 AM, Iain Sandoe wrote: > I found myself building a lot of X's and native X's recently - linux -> > darwin; i686-darwin -> ppc-darwin ; i686-darwin9 -> x86_64-darwin10. > ok for trunk (after a re-check)? Ok. I like cross building...
[testsuite,committed,AVR]: Don't xfail gcc.dg/section1.c for avr.
Since r176262 read-only data on avr is put into .rodata and thus xfail is no more appropriate. http://gcc.gnu.org/viewcvs?view=revision&revision=178649 Johann * gcc.dg/section1.c: Don't xfail for avr. Index: gcc.dg/section1.c === --- gcc.dg/section1.c (revision 178527) +++ gcc.dg/section1.c (working copy) @@ -1,5 +1,5 @@ /* PR optimization/6871 */ /* Constant variables belong in .rodata, not .bss. */ -/* { dg-final { scan-assembler-not "\.bss" { xfail avr-*-*} } } */ +/* { dg-final { scan-assembler-not "\.bss" } } */ const int i = 0;
Re: [testsuite]: Fix gcc.c-torture/execute/pr48571-1.c (4 -> sizeof(int))
Georg-Johann Lay schrieb: > This patch fixes magic number 4 and uses sizeof(int) instead so that the test > no more fails on int=16 platforms. Successfully tested on AVR. Ok to commit? > > Johann > > * gcc.c-torture/execute/pr48571-1.c (bar): Use offsets sizeof(int) > instead of 4. > > > Index: gcc.c-torture/execute/pr48571-1.c > === > --- gcc.c-torture/execute/pr48571-1.c (revision 178527) > +++ gcc.c-torture/execute/pr48571-1.c (working copy) > @@ -1,3 +1,5 @@ > +#define S (sizeof (int)) > + > unsigned int c[624]; > void __attribute__((noinline)) > bar (void) > @@ -5,9 +7,9 @@ bar (void) >unsigned int i; >/* Obfuscated c[i] = c[i-1] * 2. */ >for (i = 1; i < 624; ++i) > -*(unsigned int *)((void *)c + (__SIZE_TYPE__)i * 4) > +*(unsigned int *)((void *)c + (__SIZE_TYPE__)i * S) > = 2 * *(unsigned int *)((void *)c + ((__SIZE_TYPE__)i + > -((__SIZE_TYPE__)-4)/4) * 4); > +((__SIZE_TYPE__)-S)/S) * S); > } > extern void abort (void); > int >
Re: [Patch, Ada, Darwin] Remove use of "flat_namespace" linker flag.
On Sep 7, 2011, at 1:08 AM, Iain Sandoe wrote: > It also upsets our careful use of an extension library to provide current GCC > facilities to Darwin 8...11 (which relies on the two-level namespace to use > both the system and GCC versions of libgcc_s) ... and, in particular, this > can cause subtle and difficult to diagnose differences of behavior between > darwin 9 and later systems. > So is the following OK for trunk? I'm ok with it from a darwin perspective if you want to go that direction, though, this would be an Ada person call in the end.
C++ PATCH for c++/50298 (static constexpr reference in-class initialization)
cp_parser_constant_expression wants an rvalue constant, so we shouldn't use it for parsing initializers, since the thing being initialized might be a reference. In C++98 it's OK because only integral statics can be initialized in the class, but in C++11 any type can be with the constexpr tag. Tested x86_64-pc-linux-gnu, applying to trunk. commit 820655889d7ea9f825769286823241fd6d0fbae5 Author: Jason Merrill Date: Tue Sep 6 22:01:35 2011 -0400 PR c++/50298 * parser.c (cp_parser_member_declaration): Don't require a constant rvalue here in C++0x. diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 7d766d1..6346aa0 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -18187,6 +18187,17 @@ cp_parser_member_declaration (cp_parser* parser) initializer_token_start = cp_lexer_peek_token (parser->lexer); if (function_declarator_p (declarator)) initializer = cp_parser_pure_specifier (parser); + else if (cxx_dialect >= cxx0x) + { + bool nonconst; + /* Don't require a constant rvalue in C++11, since we + might want a reference constant. We'll enforce + constancy later. */ + cp_lexer_consume_token (parser->lexer); + /* Parse the initializer. */ + initializer = cp_parser_initializer_clause (parser, + &nonconst); + } else /* Parse the initializer. */ initializer = cp_parser_constant_initializer (parser); diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ref3.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ref3.C new file mode 100644 index 000..24cc9c8 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ref3.C @@ -0,0 +1,10 @@ +// PR c++/50298 +// { dg-options -std=c++0x } + +int global_variable; + +template struct X { + static constexpr T r = global_variable; +}; + +X x;
Minor C++ PATCHes to tsubsting
Two little things I noticed while working on another issue: 1) We were passing tf_none to tsubst_template_argument even when we want to explain a deduction failure. 2) We were calling tsubst_aggr_type and *then* checking whether it's a type. Tested x86_64-pc-linux-gnu, applying to trunk. commit 319f3236e80f88852d19017ea472881e2d19c3e8 Author: Jason Merrill Date: Tue Sep 6 22:17:18 2011 -0400 * pt.c (type_unification_real): Correct complain arg for tsubsting default template args. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index d883c16..d326c84 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -14804,6 +14804,10 @@ type_unification_real (tree tparms, if (!subr) { + tsubst_flags_t complain = (explain_p + ? tf_warning_or_error + : tf_none); + /* Check to see if we need another pass before we start clearing ARGUMENT_PACK_INCOMPLETE_P. */ for (i = 0; i < ntparms; i++) @@ -14854,11 +14858,8 @@ type_unification_real (tree tparms, { tree parm = TREE_VALUE (TREE_VEC_ELT (tparms, i)); tree arg = TREE_PURPOSE (TREE_VEC_ELT (tparms, i)); - arg = tsubst_template_arg (arg, targs, tf_none, NULL_TREE); - arg = convert_template_argument (parm, arg, targs, - (explain_p - ? tf_warning_or_error - : tf_none), + arg = tsubst_template_arg (arg, targs, complain, NULL_TREE); + arg = convert_template_argument (parm, arg, targs, complain, i, NULL_TREE); if (arg == error_mark_node) return 1; diff --git a/gcc/testsuite/g++.dg/cpp0x/sfinae11.C b/gcc/testsuite/g++.dg/cpp0x/sfinae11.C index e62c089..25902cb 100644 --- a/gcc/testsuite/g++.dg/cpp0x/sfinae11.C +++ b/gcc/testsuite/g++.dg/cpp0x/sfinae11.C @@ -52,5 +52,6 @@ int main() noexcept( f1(z) ); // { dg-message "required" } static_assert( noexcept( f2(z) ), "shall be ill-formed." ); // { dg-error "no match|could not convert" } + // { dg-error "no member" "" { target *-*-* } 54 } noexcept( f3(z) ); // { dg-message "required" } } diff --git a/libstdc++-v3/testsuite/20_util/bind/ref_neg.cc b/libstdc++-v3/testsuite/20_util/bind/ref_neg.cc index daa815c..f5a08c2 100644 --- a/libstdc++-v3/testsuite/20_util/bind/ref_neg.cc +++ b/libstdc++-v3/testsuite/20_util/bind/ref_neg.cc @@ -29,8 +29,8 @@ int inc(int& i) { return ++i; } void test01() { const int dummy = 0; - std::bind(&inc, _1)(0); // { dg-error "no match" } - std::bind(&inc, std::ref(dummy))(); // { dg-error "no match" } + std::bind(&inc, _1)(0); // { dg-error "no match|rvalue" } + std::bind(&inc, std::ref(dummy))(); // { dg-error "no match|const" } } struct Inc diff --git a/libstdc++-v3/testsuite/20_util/duration/cons/1_neg.cc b/libstdc++-v3/testsuite/20_util/duration/cons/1_neg.cc index eddd57c..97f4ef1 100644 --- a/libstdc++-v3/testsuite/20_util/duration/cons/1_neg.cc +++ b/libstdc++-v3/testsuite/20_util/duration/cons/1_neg.cc @@ -26,7 +26,7 @@ void test01() { - std::chrono::duration d1(1.0); // { dg-error "no matching" } + std::chrono::duration d1(1.0); // { dg-error "no matching|no type" } } void @@ -35,6 +35,6 @@ test02() using namespace std::chrono; duration d2(8); - duration d2_copy(d2); // { dg-error "no matching" } + duration d2_copy(d2); // { dg-error "no matching|no type" } } commit 7a78b2be5ddd397e87c0781262ea1f37a040494a Author: Jason Merrill Date: Tue Sep 6 22:02:14 2011 -0400 * pt.c (tsubst_aggr_type): Check TYPE_P before tsubsting. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 1f43ff1..d883c16 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -9590,14 +9590,13 @@ tsubst_aggr_type (tree t, /* First, determine the context for the type we are looking up. */ context = TYPE_CONTEXT (t); - if (context) + if (context && TYPE_P (context)) { context = tsubst_aggr_type (context, args, complain, in_decl, /*entering_scope=*/1); /* If context is a nested class inside a class template, it may still need to be instantiated (c++/33959). */ - if (TYPE_P (context)) - context = complete_type (context); + context = complete_type (context); } /* Then, figure out what arguments are appropriate for the
Re: [C++ Patch] PR 50309
OK. Jason
Re: [testsuite]: Fix gcc.c-torture/execute/pr48571-1.c (4 -> sizeof(int))
On Sep 7, 2011, at 9:57 AM, Georg-Johann Lay wrote: > Georg-Johann Lay schrieb: >> This patch fixes magic number 4 and uses sizeof(int) instead so that the test >> no more fails on int=16 platforms. Successfully tested on AVR. > > Ok to commit? Ok.
[PATCH, PR 50287] Do not create SSA names for unused non-register parameters in IPA-split
Hi, the patch below should fix PR 50287 (and its many duplicates) by simply never attempting to create new default-defs for unused non-register parameters and using their DECL when calling the split function. Note that all of this is relevant only in the case when there is some other reason why we cannot change the function's signature (typically because there are function attributes). Otherwise, parameters that are not used or referenced in any way are not passed on to the split function. This is correct because it does not really matter what actual value we pass to the split function for any non-register parameter because all statements that are going to end up in the split function are checked by mark_nonssa_use which makes sure it does not use, store or take address of any such PARM_DECL. The patch passes bootstrap and testing on x86_64-linux, it has successfully LTO-built Firefox and I'm LTO-building a few SPEC 2006 benchmarks with it right now. Of course it fixes the ICE when compiling the testcase (and I have verified that the 4.6 version also fixes the ICE when compiling the reduced testcase of PR 50295). OK for trunk (and then for the 4.6 branch)? Thanks, Martin 2011-09-06 Martin Jambor PR tree-optimization/50287 * ipa-split.c (split_function): Do not create SSA names for non-gimple-registers. * testsuite/gcc.dg/torture/pr50287.c: New test. Index: src/gcc/testsuite/gcc.dg/torture/pr50287.c === --- /dev/null +++ src/gcc/testsuite/gcc.dg/torture/pr50287.c @@ -0,0 +1,109 @@ +/* { dg-do compile } */ + +struct PMC { +unsigned flags; +}; + +struct PVC { + unsigned flags, other_stuff; +}; + + +typedef struct Pcc_cell +{ +struct PMC *p; +long bla; +long type; +} Pcc_cell; + +int gi; +int cond; + +struct PVC g_pvc; + +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, struct PVC pvc) + __attribute__((__nonnull__(1))); + +static void +mark_cell(int * interp, Pcc_cell *c, struct PVC pvc) +{ + if (!cond) +return; + + if (c && c->type == 4 && c->p + && !(c->p->flags & (1<<8))) +never_ever(gi + 1, c->p); + if (c && c->type == 4 && c->p + && !(c->p->flags & (1<<7))) +never_ever(gi + 2, c->p); + if (c && c->type == 4 && c->p + && !(c->p->flags & (1<<6))) +never_ever(gi + 3, c->p); + if (c && c->type == 4 && c->p + && !(c->p->flags & (1<<5))) +never_ever(gi + 4, c->p); + if (c && c->type == 4 && c->p + && !(c->p->flags & (1<<4))) +never_ever(gi + 5, c->p); + if (c && c->type == 4 && c->p + && !(c->p->flags & (1<<3))) +never_ever(gi + 6, c->p); + if (c && c->type == 4 && c->p + && !(c->p->flags & (1<<2))) +never_ever(gi + 7, c->p); + if (c && c->type == 4 && c->p + && !(c->p->flags & (1<<1))) +never_ever(gi + 8, c->p); + if (c && c->type == 4 && c->p + && !(c->p->flags & (1<<9))) +never_ever(gi + 9, c->p); +} + +static void +foo(int * interp, Pcc_cell *c) +{ + mark_cell(interp, c, g_pvc); +} + +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, g_pvc); +} + +void +bar_2 (int * interp, Pcc_cell *c, struct PVC pvc) +{ + c->bla += 2; + mark_cell(interp, c, pvc); +} + Index: src/gcc/ipa-split.c === --- src.orig/gcc/ipa-split.c +++ src/gcc/ipa-split.c @@ -985,15 +985,20 @@ split_function (struct split_point *spli bitmap_set_bit (args_to_skip, num); else { - arg = gimple_default_def (cfun, parm); - if (!arg) + /* This parm might not have been used up to now, but is going to be + used, hence register it. */ + add_referenced_var (parm); + if (is_gimple_reg (parm)) { - /* This parm wasn't used up to now, but is going to be used, - hence register it. */ - add_referenced_var (parm); - arg = make_ssa_name (parm, gimple_build_nop ()); - set_default_def (parm, arg); + arg = gimple_default_def (cfun, parm); + if (!arg) + { + arg = make_ssa_name (parm, gimple_build_nop ()); + set_default_def (parm, arg); + } } + else + arg = parm; if (TYPE_MAIN_VARIANT (DECL_ARG_TYPE (parm)) != TYPE_MAIN_VARIANT (TREE_TYPE (arg)))
PATCH: Add capability to contrib/compare_tests to handle directories
Hi, Should not change behavior for comparing two files (expect for usage output), and also should be POSIX compliant. Tested on x86_64 tests logs and test directories, would be interested in help testing on other platforms. Ok to commit? -- Quentin Neill >From 4d4fa9d094745ace0b6e51faadb2f3ea40cb7c7f Mon Sep 17 00:00:00 2001 From: Quentin Neill Date: Wed, 7 Sep 2011 12:04:35 -0500 Subject: [PATCH] Add capability to compare test log directories. --- contrib/ChangeLog |4 ++ contrib/compare_tests | 107 - 2 files changed, 101 insertions(+), 10 deletions(-) diff --git a/contrib/ChangeLog b/contrib/ChangeLog index 07adb58..e2007e7 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,7 @@ +2011-09-07 Quentin Neill + + * compare_tests: Add capability to compare test log directories. + 2011-08-25 Rainer Orth * gcc_update: Determine svn branch from hg convert_revision. diff --git a/contrib/compare_tests b/contrib/compare_tests index bed9742..b0e3321 100755 --- a/contrib/compare_tests +++ b/contrib/compare_tests @@ -2,13 +2,36 @@ # This script automatically test the given tool with the tool's test cases, # reporting anything of interest. -# exits with 0 if there is nothing of interest -# exits with 1 if there is something interesting -# exits with 2 if an error occurred - -# Give two .sum files to compare them +usage() +{ + if [ -n "$1" ] ; then + echo "$0: Error: $1" >&2 + echo >&2 + fi + cat >&2 < +# Subdir comparison added by Quentin Neill tool=gxx @@ -16,10 +39,72 @@ tmp1=/tmp/$tool-testing.$$a tmp2=/tmp/$tool-testing.$$b now_s=/tmp/$tool-testing.$$d before_s=/tmp/$tool-testing.$$e +lst1=/tmp/$tool-lst1.$$ +lst2=/tmp/$tool-lst2.$$ +lst3=/tmp/$tool-lst3.$$ +lst4=/tmp/$tool-lst4.$$ +lst5=/tmp/$tool-lst5.$$ +tmps="$tmp1 $tmp2 $now_s $before_s $lst1 $lst2 $lst3 $lst4 $lst5" + +[ "$1" = "-strict" ] && strict=$1 && shift +[ "$1" = "-?" ] && usage +[ "$2" = "" ] && usage "Must specify both PREVIOUS and CURRENT" + +trap "rm -f $tmps" 0 1 2 3 5 9 13 15 +exit_status=0 -if [ "$2" = "" ]; then - echo "Usage: $0 previous current" >&2 - exit 2 +if [ -d "$1" -a -d "$2" ] ; then + find "$1" \( ! -name config.log \) -name '*.log' >$lst1 + find "$2" \( ! -name config.log \) -name '*.log' >$lst2 + echo "# Comparing directories" + echo "## Dir1=$1: `cat $lst1 | wc -l` log files" + echo "## Dir2=$2: `cat $lst2 | wc -l` log files" + echo + # remove leading directory components to compare + sed -e "s|^$1/||" $lst1 | sort >$lst3 + sed -e "s|^$2/||" $lst2 | sort >$lst4 + comm -23 $lst3 $lst4 >$lst5 + if [ -s $lst5 ] ; then + echo "# Extra log files in Dir1=$1" + sed -e "s|^|< $1/|" $lst5 + echo + [ -n "$strict" ] && exit_status=`expr $exit_status + 1` + fi + comm -13 $lst3 $lst4 >$lst5 + if [ -s $lst5 ] ; then + echo "# Extra log files in Dir2=$2" + sed -e "s|^|> $2/|" $lst5 + echo + [ -n "$strict" ] && exit_status=`expr $exit_status + 1` + fi + comm -12 $lst3 $lst4 | sort -u >$lst5 + if [ ! -s $lst5 ] ; then + echo "# No common log files" + exit_status=`expr $exit_status + 1` + exit $exit_status + fi + cmnlogs=`cat $lst5 | wc -l` + echo "# Comparing $cmnlogs common log files" + for fname in `cat $lst5` + do + f1="$1/$fname" + f2="$2/$fname" + echo "## ${CONFIG_SHELL-/bin/sh} $0 $strict $f1 $f2" + ${CONFIG_SHELL-/bin/sh} $0 $strict $f1 $f2 + ret=$? + if [ $ret -ne 0 ]; then + exit_status=`expr $exit_status + 1` + echo "## Differences found: $fname" + fi + done + if [ $exit_status -ne 0 ]; then + echo "# $exit_status differences in $cmnlogs common log files found" + else + echo "# No differences found in $cmnlogs common log files" + fi + exit $exit_status +elif [ -d "$1" -o -d "$2" ] ; then + usage "Must specify either two directories or two files" fi sed 's/^XFAIL/FAIL/; s/^XPASS/PASS/' < "$1" | awk '/^Running target / {target = $3} { if (target != "unix") { sub(/: /, "&"target": " ); }; print $0; }' >$tmp1 @@ -28,8 +113,6 @@ sed 's/^XFAIL/FAIL/; s/^XPASS/PASS/' < "$2" | awk '/^Running target / {target = before=$tmp1 now=$tmp2 -exit_status=0 -trap "rm -f $tmp1 $tmp2 $now_s $before_s" 0 1 2 3 5 9 13 15 if sort -k 2 /dev/null 2>&1; then skip1='-k 2' @@ -60,6 +143,7 @@ if [ $? = 0 ]; then echo "Tests that now work, but didn't before:" echo cat $tmp2 + [ -n "$strict" ] && echo "Strict test fails" && exit_status=1 echo fi @@ -83,6 +167,7 @
Re: [Patch, Ada, Darwin] Remove use of "flat_namespace" linker flag.
> > It also upsets our careful use of an extension library to provide current > > GCC facilities to Darwin 8...11 (which relies on the two-level namespace > > to use both the system and GCC versions of libgcc_s) ... and, in > > particular, this can cause subtle and difficult to diagnose differences > > of behavior between darwin 9 and later systems. > > > So is the following OK for trunk? > > I'm ok with it from a darwin perspective if you want to go that direction, > though, this would be an Ada person call in the end. We're reviewing this patch and its consequences. For now the patch is NOT OK since the change was done for a reason initially. The question is whether the reason still holds today, so stay tuned. Arno
Re: [PATCH] PR c++/33255 - Support -Wunused-local-typedefs warning
Jason Merrill writes: > On 08/08/2011 03:52 PM, Dodji Seketeli wrote: >> + cfun->language = NULL; > > Might as well ggc_free it first. Done. > >> + /* We want T to be either a type or a TYPE_DECL. */ > > Comment is out of date. Removed. > > Does __attribute ((used)) on the typedef prevent the warning? No it doesn't. handle_used_attribute ignores the used attribute on anything that isn't a variable or a function. I have changed that in the patch below. Note that as handle_used_attribute function is called before the typedef is properly setup (by calling set_underlying_type), I couldn't use is_typedef_decl in it. Is that a problem? To ease the review, here is the changes I made against the previous patch. diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 230f1a7..42730d7 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -1,3 +1,4 @@ + /* Process declarations and variables for C compiler. Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 @@ -8328,7 +8329,8 @@ finish_function (void) if (!decl_function_context (fndecl)) undef_nested_function = false; - cfun->language = NULL; + if (cfun->language != NULL) +ggc_free (cfun->language); /* We're leaving the context of this function, so zap cfun. It's still in DECL_STRUCT_FUNCTION, and we'll restore it in diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 290240a..bb57569 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -6091,7 +6091,8 @@ handle_used_attribute (tree *pnode, tree name, tree ARG_UNUSED (args), tree node = *pnode; if (TREE_CODE (node) == FUNCTION_DECL - || (TREE_CODE (node) == VAR_DECL && TREE_STATIC (node))) + || (TREE_CODE (node) == VAR_DECL && TREE_STATIC (node)) + || (TREE_CODE (node) == TYPE_DECL)) { TREE_USED (node) = 1; DECL_PRESERVE_P (node) = 1; @@ -9629,7 +9630,6 @@ record_locally_defined_typedef (tree decl) void maybe_record_typedef_use (tree t) { - /* We want T to be either a type or a TYPE_DECL. */ if (!is_typedef_decl (t)) return; diff --git a/gcc/testsuite/c-c++-common/Wunused-local-typedefs.c b/gcc/testsuite/c-c++-common/Wunused-local-typedefs.c index 32fb723..683019d 100644 --- a/gcc/testsuite/c-c++-common/Wunused-local-typedefs.c +++ b/gcc/testsuite/c-c++-common/Wunused-local-typedefs.c @@ -36,3 +36,9 @@ test7 (void) typedef int foo; int vec[1] = {sizeof (foo)}; } + +void +test8 (void) +{ + typedef int foo __attribute__((used)); +} The consolidated patch against trunk is below. Bootstrapped and tested against trunk on x86_64-unknown-linux-gnu. gcc/ * c-decl.c (lookup_name): Use the new maybe_record_typedef_use. (pushdecl): Use the new record_locally_defined_typedef. (store_parm_decls): Allocate cfun->language. (finish_function): Use the new maybe_warn_unused_local_typedefs, and free cfun->language. (c_push_function_context): Allocate cfun->language here only if needed. (c_pop_function_context): Likewise, mark cfun->language for collection only when it should be done. * c-common.c (handle_used_attribute): Don't ignore TYPE_DECL nodes. * c-typeck.c (c_expr_sizeof_type, c_cast_expr): Use the new maybe_record_local_typedef_use. gcc/c-family * c-common.h (struct c_language_function::local_typedefs): New field. (record_locally_defined_typedef, maybe_record_typedef_use) (maybe_warn_unused_local_typedefs): Declare new functions. * c-common.c (record_locally_defined_typedef) (maybe_record_typedef_use) (maybe_warn_unused_local_typedefs): Define new functions. * c.opt: Declare new -Wunused-local-typedefs flag. gcc/cp * name-lookup.c (pushdecl_maybe_friend_1): Use the new record_locally_defined_typedef. * decl.c (finish_function): Use the new maybe_warn_unused_local_typedefs. (grokfield): Use the new record_locally_defined_typedef. * parser.c (lookup_name): Use the new maybe_record_typedef_use. gcc/doc/ * invoke.texi: Update documentation for -Wunused-local-typedefs. gcc/testsuite/ * g++.dg/warn/Wunused-local-typedefs.C: New test file. * c-c++-common/Wunused-local-typedefs.c: Likewise. libstdc++-v3/ * include/ext/bitmap_allocator.h (__detail::__mini_vector::__lower_bound): Remove unused typedef. * src/istream.cc (std::operator>>(basic_istream& __in, basic_string& __str)): Likewise. (std::getline): Likewise. * src/valarray.cc (__valarray_product): Likewise. --- gcc/c-decl.c | 39 +- gcc/c-family/c-common.c| 73 ++- gcc/c-family/c-common.h|7 + gcc/c-family/c.opt
Re: [PATCH] PR c++/33255 - Support -Wunused-local-typedefs warning
On 09/07/2011 02:01 PM, Dodji Seketeli wrote: + /* Process declarations and variables for C compiler. Blank line at the top of the file? Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 @@ -8328,7 +8329,8 @@ finish_function (void) if (!decl_function_context (fndecl)) undef_nested_function = false; - cfun->language = NULL; + if (cfun->language != NULL) +ggc_free (cfun->language); You'll still want to set it to NULL after freeing it. OK with those changes. Jason
Re: [C++0x] contiguous bitfields race implementation
On 09/02/2011 10:38 AM, Richard Guenther wrote: On Fri, Sep 2, 2011 at 4:10 PM, Jason Merrill wrote: I wonder what would break if C++ just set TYPE_SIZE to the as-base size? Good question. Probably argument passing, as the as-base size wouldn't get a proper mode assigned form layout_type then(?) for small structs? Classes for which the as-base size is different are passed by invisible reference, so that wouldn't be an issue. But layout_decl would get the wrong size for variables and fields of the type, so that won't work. Perhaps it's time to get serious about the change I talked about in http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22488#c42 ... Jason
[cxx-mem-model] g++.dg/dg.exp: exclude memmodel tests
I am doing a merge from trunk and noticed the g++.dg/dg.exp are all failing because we are trying to run the memmodel/ tests outside of the memmodel/ directory. The memmodel tests must be excluded from the dg.exp list, since they are handled specially. Fixed thusly. Applied to branch. * gcc.dg/dg.exp: Exclude memmodel tests. Index: g++.dg/dg.exp === --- g++.dg/dg.exp (revision 178607) +++ g++.dg/dg.exp (working copy) @@ -48,6 +48,7 @@ set tests [prune $tests $srcdir/$subdir/ set tests [prune $tests $srcdir/$subdir/torture/*] set tests [prune $tests $srcdir/$subdir/graphite/*] set tests [prune $tests $srcdir/$subdir/guality/*] +set tests [prune $tests $srcdir/$subdir/memmodel/*] # Main loop. dg-runtest $tests "" $DEFAULT_CXXFLAGS
[PATCH] Fix up mode attribute on integer vector andnot, and, or and xor (PR target/50310)
Hi! This patch fixes a breakage introduced by the AVX2 changes. On the attached testcase even with -O3 -mavx -mno-avx2 we generate code that uses AVX2 insns. The immediate problem has been a thinko in what GET_MODE_SIZE returns - it is byte size instead of bit size. But the following patch also makes sure that get_attr_mode for those insns doesn't unconditionally return OImode even for 16-byte vectors with -mavx2 (when it should return TImode - perhaps scheduling or some other attributes do care if it is accurate) and removes redundant cases in sseinsnmode mode_attr (the integer 32-byte vector modes are present already at the beginning of define_mode_attr). Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2011-09-07 Jakub Jelinek * config/i386/sse.md (sseinsnmode): Remove 32-byte integer vector duplicates. PR target/50310 * config/i386/sse.md (*andnot3, *3): Fix up "mode" attribute computation. * gcc.dg/pr50310-1.c: New test. --- gcc/config/i386/sse.md.jj 2011-09-02 16:29:38.0 +0200 +++ gcc/config/i386/sse.md 2011-09-07 09:40:52.0 +0200 @@ -229,7 +229,7 @@ (define_mode_attr sseinsnmode (V16QI "TI") (V8HI "TI") (V4SI "TI") (V2DI "TI") (V1TI "TI") (V8SF "V8SF") (V4DF "V4DF") (V4SF "V4SF") (V2DF "V2DF") - (TI "TI") (V32QI "OI") (V16HI "OI") (V8SI "OI") (V4DI "OI")]) + (TI "TI")]) ;; Mapping of vector float modes to an integer mode of the same size (define_mode_attr sseintvecmode @@ -6340,14 +6340,13 @@ (define_insn "*andnot3" (const_string "*"))) (set_attr "prefix" "orig,vex") (set (attr "mode") - (cond [(match_test "TARGET_AVX2") - (const_string "OI") - (match_test "GET_MODE_SIZE (mode) > 128") + (cond [(and (not (match_test "TARGET_AVX2")) +(match_test "GET_MODE_SIZE (mode) > 16")) (const_string "V8SF") - (match_test "TARGET_SSE2") - (const_string "TI") + (not (match_test "TARGET_SSE2")) + (const_string "V4SF") ] - (const_string "V4SF")))]) + (const_string "")))]) (define_expand "3" [(set (match_operand:VI 0 "register_operand" "") @@ -6416,14 +6415,13 @@ (define_insn "*3" (const_string "*"))) (set_attr "prefix" "orig,vex") (set (attr "mode") - (cond [(match_test "TARGET_AVX2") - (const_string "OI") - (match_test "GET_MODE_SIZE (mode) > 128") + (cond [(and (not (match_test "TARGET_AVX2")) +(match_test "GET_MODE_SIZE (mode) > 16")) (const_string "V8SF") - (match_test "TARGET_SSE2") - (const_string "TI") + (not (match_test "TARGET_SSE2")) + (const_string "V4SF") ] - (const_string "V4SF")))]) + (const_string "")))]) (define_insn "*andnottf3" [(set (match_operand:TF 0 "register_operand" "=x,x") --- gcc/testsuite/gcc.dg/pr50310-1.c.jj 2011-09-07 09:00:39.0 +0200 +++ gcc/testsuite/gcc.dg/pr50310-1.c2011-09-07 08:59:58.0 +0200 @@ -0,0 +1,18 @@ +/* PR target/50310 */ +/* { dg-do run } */ +/* { dg-options "-O3" } */ +/* { dg-options "-O3 -mavx -mno-avx2" { target avx_runtime } } */ + +double s1[4], s2[4]; +long long e[4]; + +int +main () +{ + int i; + asm volatile ("" : : : "memory"); + for (i = 0; i < 4; i++) +e[i] = __builtin_isunordered (s1[i], s2[i]) && s1[i] != s2[i] ? -1 : 0; + asm volatile ("" : : : "memory"); + return 0; +} Jakub
[PATCH][cilkplus branch] Add __cilk builtin keyword
Hello Everyone, This patch should add the built-in __cilk keyword and set it to 200 in the GCC cilkplus branch. Thanks, Balaji V. Iyer. __cilk_keyword_patch Description: __cilk_keyword_patch
[PATCH] Ensure vcond* expansion doesn't fail on x86 (PR target/50310)
Hi! The attached testcase ICEs, because the vectorizer assumes that if vcond* is available, it supports all comparisons, not just a subset of them. With -mavx vcmpd etc. already support all the needed comparisons (and several more - we wouldn't even need to swap the arguments), for SSE the only missing ones (LTGT and UNEQ) can be handled as ORDERED & NE resp. UNORDERED | EQ. Bootstrapped/regtested on x86_64-linux and i686-linux (on non-AVX host), plus regtested on x86_64-linux on AVX box. Ok for trunk and 4.6? 2011-09-07 Jakub Jelinek PR target/50310 * config/i386/i386.c (ix86_prepare_sse_fp_compare_args): For TARGET_AVX return code for LTGT and UNEQ. (ix86_expand_fp_vcond): Handle LTGT and UNEQ. * gcc.c-torture/execute/ieee/pr50310.c: New test. * gcc.dg/pr50310-2.c: New test. --- gcc/config/i386/i386.c.jj 2011-09-02 16:29:38.0 +0200 +++ gcc/config/i386/i386.c 2011-09-07 13:34:17.0 +0200 @@ -18308,6 +18308,10 @@ ix86_prepare_sse_fp_compare_args (rtx de { case LTGT: case UNEQ: + /* With AVX these are supported directly. */ + if (TARGET_AVX) + break; + /* We have no LTGT as an operator. We could implement it with NE & ORDERED, but this requires an extra temporary. It's not clear that it's worth it. */ @@ -18559,7 +18563,32 @@ ix86_expand_fp_vcond (rtx operands[]) code = ix86_prepare_sse_fp_compare_args (operands[0], code, &operands[4], &operands[5]); if (code == UNKNOWN) -return false; +{ + rtx temp; + switch (GET_CODE (operands[3])) + { + case LTGT: + temp = ix86_expand_sse_cmp (operands[0], ORDERED, operands[4], + operands[5], operands[0], operands[0]); + cmp = ix86_expand_sse_cmp (operands[0], NE, operands[4], +operands[5], operands[1], operands[2]); + code = AND; + break; + case UNEQ: + temp = ix86_expand_sse_cmp (operands[0], UNORDERED, operands[4], + operands[5], operands[0], operands[0]); + cmp = ix86_expand_sse_cmp (operands[0], EQ, operands[4], +operands[5], operands[1], operands[2]); + code = IOR; + break; + default: + gcc_unreachable (); + } + cmp = expand_simple_binop (GET_MODE (cmp), code, temp, cmp, cmp, 1, +OPTAB_DIRECT); + ix86_expand_sse_movcc (operands[0], cmp, operands[1], operands[2]); + return true; +} if (ix86_expand_sse_fp_minmax (operands[0], code, operands[4], operands[5], operands[1], operands[2])) --- gcc/testsuite/gcc.c-torture/execute/ieee/pr50310.c.jj 2011-09-07 14:16:12.0 +0200 +++ gcc/testsuite/gcc.c-torture/execute/ieee/pr50310.c 2011-09-07 14:40:57.0 +0200 @@ -0,0 +1,73 @@ +/* PR target/50310 */ + +extern void abort (void); +double s1[4], s2[4], s3[64]; + +void +foo (void) +{ + int i; + for (i = 0; i < 4; i++) +s3[0 * 4 + i] = __builtin_isgreater (s1[i], s2[i]) ? -1.0 : 0.0; + for (i = 0; i < 4; i++) +s3[1 * 4 + i] = (!__builtin_isgreater (s1[i], s2[i])) ? -1.0 : 0.0; + for (i = 0; i < 4; i++) +s3[2 * 4 + i] = __builtin_isgreaterequal (s1[i], s2[i]) ? -1.0 : 0.0; + for (i = 0; i < 4; i++) +s3[3 * 4 + i] = (!__builtin_isgreaterequal (s1[i], s2[i])) ? -1.0 : 0.0; + for (i = 0; i < 4; i++) +s3[4 * 4 + i] = __builtin_isless (s1[i], s2[i]) ? -1.0 : 0.0; + for (i = 0; i < 4; i++) +s3[5 * 4 + i] = (!__builtin_isless (s1[i], s2[i])) ? -1.0 : 0.0; + for (i = 0; i < 4; i++) +s3[6 * 4 + i] = __builtin_islessequal (s1[i], s2[i]) ? -1.0 : 0.0; + for (i = 0; i < 4; i++) +s3[7 * 4 + i] = (!__builtin_islessequal (s1[i], s2[i])) ? -1.0 : 0.0; + for (i = 0; i < 4; i++) +s3[8 * 4 + i] = __builtin_islessgreater (s1[i], s2[i]) ? -1.0 : 0.0; + for (i = 0; i < 4; i++) +s3[9 * 4 + i] = (!__builtin_islessgreater (s1[i], s2[i])) ? -1.0 : 0.0; + for (i = 0; i < 4; i++) +s3[10 * 4 + i] = __builtin_isunordered (s1[i], s2[i]) ? -1.0 : 0.0; + for (i = 0; i < 4; i++) +s3[11 * 4 + i] = (!__builtin_isunordered (s1[i], s2[i])) ? -1.0 : 0.0; + for (i = 0; i < 4; i++) +s3[12 * 4 + i] = s1[i] > s2[i] ? -1.0 : 0.0; + for (i = 0; i < 4; i++) +s3[13 * 4 + i] = s1[i] <= s2[i] ? -1.0 : 0.0; + for (i = 0; i < 4; i++) +s3[14 * 4 + i] = s1[i] < s2[i] ? -1.0 : 0.0; + for (i = 0; i < 4; i++) +s3[15 * 4 + i] = s1[i] >= s2[i] ? -1.0 : 0.0; +} + +int +main () +{ + int i; + s1[0] = 5.0; + s1[1] = 6.0; + s1[2] = 5.0; + s1[3] = __builtin_nan (""); + s2[0] = 6.0; + s2[1] = 5.0; + s2[2] = 5.0; + s2[3] = 5.0; + asm volatile ("" : : : "memory"); + foo (); + asm volatile ("" : : : "memory"); + for (i = 0; i < 16 * 4; i++) +if (i >= 12 * 4 && (i & 3) == 3) + { + if (s3[
Re: [PATCH 1/7] Linemap infrastructure for virtual locations
On 09/01/2011 06:36 AM, Dodji Seketeli wrote: +#ifdef ENABLE_CHECKING + +/* Assertion macro to be used in line-map code. */ +#define linemap_assert(EXPR) \ + do { \ +if (! (EXPR)) \ + abort ();\ + } while (0) + +/* Assert that MAP encodes locations of tokens that are not part of + the replacement-list of a macro expansion. */ +#define linemap_check_ordinary(LINE_MAP) __extension__ \ + ({linemap_assert (!linemap_macro_expansion_map_p (LINE_MAP)); \ +(LINE_MAP);}) If you're going to use a statement-expression, you need to check that you're being compiled with GCC; tree.h uses #if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007) - if (highest >0xF000) + if (highest > 0xF000) Unnecessary whitespace change. OK with those changes. Jason
Re: ARM: Emit conditions in push_multi
On 09/07/11 10:28, Ramana Radhakrishnan wrote: > On 2 September 2011 12:42, Bernd Schmidt wrote: >> On 09/02/11 12:35, Ramana Radhakrishnan wrote: >>> On 1 September 2011 12:50, Bernd Schmidt wrote: Shrink-wrapping tests on ARM had one additional failure, which I could track down to a stmfd instruction being emitted where an stmhifd was intended. The following patch fixes the testcase; full tests running now. Ok? >>> >>> IIUC this should have been a result of conditionalizing the prologue >>> saves by the CCFSM state machine in ARM state >> >> Correct. >> >>> given that the push >>> instruction below doesn't have the conditional markers. >> >> Although I'm not sure how you arrived at this? Thumb insns can't be >> conditional anyway? > > IT blocks in Thumb2 and the predicable attribute means we can generate > some amount of conditional instruction in T2 state. Oh, and the insns are output as conditional in addition to the it instruction - half a year of hardly doing anything with ARM and I'd forgotten about this :( New patch below. Tested on arm-eabi sim with a few multilibs. Bernd * config/arm/arm.md (push_multi): Emit predicates. (push_fp_multi): Likewise. * config/arm/arm.c (vfp_output_fstmd): Likewise. Index: gcc/config/arm/arm.c === --- gcc/config/arm/arm.c(revision 178596) +++ gcc/config/arm/arm.c(working copy) @@ -13084,7 +13084,7 @@ vfp_output_fstmd (rtx * operands) int base; int i; - strcpy (pattern, "fstmfdd\t%m0!, {%P1"); + strcpy (pattern, "fstmfdd%?\t%m0!, {%P1"); p = strlen (pattern); gcc_assert (GET_CODE (operands[1]) == REG); Index: gcc/config/arm/arm.md === --- gcc/config/arm/arm.md (revision 178596) +++ gcc/config/arm/arm.md (working copy) @@ -10581,14 +10581,16 @@ (define_insn "*push_multi" In Thumb mode always use push, and the assembler will pick something appropriate. */ if (num_saves == 1 && TARGET_ARM) - output_asm_insn (\"str\\t%1, [%m0, #-4]!\", operands); + output_asm_insn (\"str%?\\t%1, [%m0, #-4]!\", operands); else { int i; char pattern[100]; if (TARGET_ARM) - strcpy (pattern, \"stmfd\\t%m0!, {%1\"); + strcpy (pattern, \"stm%(fd%)\\t%m0!, {%1\"); + else if (TARGET_THUMB2) + strcpy (pattern, \"push%?\\t{%1\"); else strcpy (pattern, \"push\\t{%1\"); @@ -10631,7 +10633,7 @@ (define_insn "*push_fp_multi" { char pattern[100]; -sprintf (pattern, \"sfmfd\\t%%1, %d, [%%m0]!\", XVECLEN (operands[2], 0)); +sprintf (pattern, \"sfm%(fd%)\\t%%1, %d, [%%m0]!\", XVECLEN (operands[2], 0)); output_asm_insn (pattern, operands); return \"\"; }"
Re: [PATCH] Propagate out predicate inversions in forwprop
On Wed, Sep 7, 2011 at 4:46 AM, Richard Guenther wrote: > > This makes sure that we propagate comparisons that we cannot invert > into inverted conditions by swapping edges or the conditional ops. > For the testcase it transforms > > : > D.2724_4 = xx_2(D) < xy_3(D); > p_5 = (int) D.2724_4; > D.2725_6 = p_5 == 0; > np_7 = (int) D.2725_6; > if (np_7 != 0) > > to > > : > if (xx_2(D) < xy_3(D)) > > while without the patch we would be left with > > : > D.2724_4 = xx_2(D) < xy_3(D); > if (D.2724_4 == 0) This sounds like PR 15558. Thanks, Andrew Pinski
Re: [PATCH] Fix up mode attribute on integer vector andnot, and, or and xor (PR target/50310)
On Wed, Sep 7, 2011 at 8:12 PM, Jakub Jelinek wrote: > This patch fixes a breakage introduced by the AVX2 changes. > On the attached testcase even with -O3 -mavx -mno-avx2 we generate > code that uses AVX2 insns. The immediate problem has been > a thinko in what GET_MODE_SIZE returns - it is byte size instead of bit > size. But the following patch also makes sure that get_attr_mode > for those insns doesn't unconditionally return OImode even for 16-byte > vectors with -mavx2 (when it should return TImode - perhaps scheduling or > some other attributes do care if it is accurate) and removes redundant cases > in sseinsnmode mode_attr (the integer 32-byte vector modes are present > already at the beginning of define_mode_attr). > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? > > 2011-09-07 Jakub Jelinek > > * config/i386/sse.md (sseinsnmode): Remove 32-byte integer vector > duplicates. > > PR target/50310 > * config/i386/sse.md (*andnot3, *3): Fix up > "mode" attribute computation. > > * gcc.dg/pr50310-1.c: New test. The patch is OK for mainline SVN. Thanks, Uros.
[Patch, Fortran, OOP] PR 48095: Invalid assignment to procedure pointer component not rejected
Hi all, the attached patch fixes this accepts-valid OOP PR. It consists of two parts: 1) resolve_structure_cons is being extended to check the interface of proc-ptr components (comment #7). 2) A small fix to allow for correct parsing of structure constructors including proc-ptr components (comment #8). The patch was regtested on x86_64-unknown-linux-gnu. Ok for trunk? Cheers, Janus 2011-09-07 Janus Weil PR fortran/48095 * primary.c (gfc_match_structure_constructor): Handle parsing of procedure pointers components in structure constructors. * resolve.c (resolve_structure_cons): Check interface of procedure pointer components. 2011-09-07 Janus Weil PR fortran/48095 * gfortran.dg/proc_ptr_comp_33.f90: New. Index: gcc/fortran/resolve.c === --- gcc/fortran/resolve.c (revision 178634) +++ gcc/fortran/resolve.c (working copy) @@ -1119,6 +1119,40 @@ resolve_structure_cons (gfc_expr *expr, int init) comp->name); } + if (comp->attr.proc_pointer && comp->ts.interface) + { + /* Check procedure pointer interface. */ + gfc_symbol *s2 = NULL; + gfc_component *c2; + const char *name; + char err[200]; + + if (gfc_is_proc_ptr_comp (cons->expr, &c2)) + { + s2 = c2->ts.interface; + name = c2->name; + } + else if (cons->expr->expr_type == EXPR_FUNCTION) + { + s2 = cons->expr->symtree->n.sym->result; + name = cons->expr->symtree->n.sym->result->name; + } + else if (cons->expr->expr_type != EXPR_NULL) + { + s2 = cons->expr->symtree->n.sym; + name = cons->expr->symtree->n.sym->name; + } + + if (s2 && !gfc_compare_interfaces (comp->ts.interface, s2, name, 0, 1, + err, sizeof(err))) + { + gfc_error ("In derived type constructor at %L: Interface mismatch" + " in procedure pointer component '%s': %s", + &cons->expr->where, comp->name, err); + return FAILURE; + } + } + if (!comp->attr.pointer || comp->attr.proc_pointer || cons->expr->expr_type == EXPR_NULL) continue; Index: gcc/fortran/primary.c === --- gcc/fortran/primary.c (revision 178634) +++ gcc/fortran/primary.c (working copy) @@ -2418,7 +2418,10 @@ gfc_match_structure_constructor (gfc_symbol *sym, } /* Match the current initializer expression. */ + if (this_comp->attr.proc_pointer) + gfc_matching_procptr_assignment = 1; m = gfc_match_expr (&comp_tail->val); + gfc_matching_procptr_assignment = 0; if (m == MATCH_NO) goto syntax; if (m == MATCH_ERROR) ! { dg-do compile } ! ! PR 48095: [OOP] Invalid assignment to procedure pointer component not rejected ! ! Original test case by Arjen Markus ! Modified by Janus Weil module m implicit none type :: rectangle real :: width, height procedure(get_area_ai), pointer :: get_area => get_my_area ! { dg-error "Type/rank mismatch" } end type rectangle abstract interface real function get_area_ai( this ) import :: rectangle class(rectangle), intent(in) :: this end function get_area_ai end interface contains real function get_my_area( this ) type(rectangle), intent(in) :: this get_my_area = 3.0 * this%width * this%height end function get_my_area end !--- program p implicit none type :: rectangle real :: width, height procedure(get_area_ai), pointer :: get_area end type rectangle abstract interface real function get_area_ai (this) import :: rectangle class(rectangle), intent(in) :: this end function get_area_ai end interface type(rectangle) :: rect rect = rectangle (1.0, 2.0, get1) rect = rectangle (3.0, 4.0, get2) ! { dg-error "Type/rank mismatch" } contains real function get1 (this) class(rectangle), intent(in) :: this get1 = 1.0 * this%width * this%height end function get1 real function get2 (this) type(rectangle), intent(in) :: this get2 = 2.0 * this%width * this%height end function get2 end ! { dg-final { cleanup-modules "m" } }
Re: [PATCH] Ensure vcond* expansion doesn't fail on x86 (PR target/50310)
On Wed, Sep 7, 2011 at 8:17 PM, Jakub Jelinek wrote: > The attached testcase ICEs, because the vectorizer assumes that if vcond* > is available, it supports all comparisons, not just a subset of them. > With -mavx vcmpd etc. already support all the needed comparisons (and > several more - we wouldn't even need to swap the arguments), for SSE > the only missing ones (LTGT and UNEQ) can be handled as ORDERED & NE > resp. UNORDERED | EQ. > > Bootstrapped/regtested on x86_64-linux and i686-linux (on non-AVX host), > plus regtested on x86_64-linux on AVX box. Ok for trunk and 4.6? > > 2011-09-07 Jakub Jelinek > > PR target/50310 > * config/i386/i386.c (ix86_prepare_sse_fp_compare_args): For > TARGET_AVX return code for LTGT and UNEQ. > (ix86_expand_fp_vcond): Handle LTGT and UNEQ. > > * gcc.c-torture/execute/ieee/pr50310.c: New test. > * gcc.dg/pr50310-2.c: New test. Please put early exit for TARGET_SSE at the beginning of ix86_prepare_sse_fp_compare_args function. There is really no need to swap operands - and to help reload, since AVX instructions are three-operand instructions. OK for mainline with this change. Thanks, Uros.
Re: [PATCH] PR c++/33255 - Support -Wunused-local-typedefs warning
Jason Merrill writes: > On 09/07/2011 02:01 PM, Dodji Seketeli wrote: >> + >> /* Process declarations and variables for C compiler. > > Blank line at the top of the file? Oops, I noticed it and changed it in the aggregated patch I sent, but forgot to update the diff against the previous. Sorry for that. >> Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, >> 2000, >> 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 >> @@ -8328,7 +8329,8 @@ finish_function (void) >> if (!decl_function_context (fndecl)) >> undef_nested_function = false; >> >> - cfun->language = NULL; >> + if (cfun->language != NULL) >> +ggc_free (cfun->language); > > You'll still want to set it to NULL after freeing it. Fixed. > OK with those changes. Thanks. Here is the patch I will commit in a short while. gcc/ * c-decl.c (lookup_name): Use the new maybe_record_typedef_use. (pushdecl): Use the new record_locally_defined_typedef. (store_parm_decls): Allocate cfun->language. (finish_function): Use the new maybe_warn_unused_local_typedefs, and free cfun->language. (c_push_function_context): Allocate cfun->language here only if needed. (c_pop_function_context): Likewise, mark cfun->language for collection only when it should be done. * c-common.c (handle_used_attribute): Don't ignore TYPE_DECL nodes. * c-typeck.c (c_expr_sizeof_type, c_cast_expr): Use the new maybe_record_local_typedef_use. gcc/c-family * c-common.h (struct c_language_function::local_typedefs): New field. (record_locally_defined_typedef, maybe_record_typedef_use) (maybe_warn_unused_local_typedefs): Declare new functions. * c-common.c (record_locally_defined_typedef) (maybe_record_typedef_use) (maybe_warn_unused_local_typedefs): Define new functions. * c.opt: Declare new -Wunused-local-typedefs flag. gcc/cp * name-lookup.c (pushdecl_maybe_friend_1): Use the new record_locally_defined_typedef. * decl.c (finish_function): Use the new maybe_warn_unused_local_typedefs. (grokfield): Use the new record_locally_defined_typedef. * parser.c (lookup_name): Use the new maybe_record_typedef_use. gcc/doc/ * invoke.texi: Update documentation for -Wunused-local-typedefs. gcc/testsuite/ * g++.dg/warn/Wunused-local-typedefs.C: New test file. * c-c++-common/Wunused-local-typedefs.c: Likewise. libstdc++-v3/ * include/ext/bitmap_allocator.h (__detail::__mini_vector::__lower_bound): Remove unused typedef. * src/istream.cc (std::operator>>(basic_istream& __in, basic_string& __str)): Likewise. (std::getline): Likewise. * src/valarray.cc (__valarray_product): Likewise. --- gcc/c-decl.c | 42 +- gcc/c-family/c-common.c| 73 ++- gcc/c-family/c-common.h|7 + gcc/c-family/c.opt |4 + gcc/cp/decl.c |4 + gcc/cp/decl2.c |1 + gcc/cp/name-lookup.c |7 + gcc/cp/parser.c|2 + gcc/doc/invoke.texi|9 +- .../c-c++-common/Wunused-local-typedefs.c | 44 ++ gcc/testsuite/g++.dg/warn/Wunused-local-typedefs.C | 146 libstdc++-v3/include/ext/bitmap_allocator.h|2 - libstdc++-v3/src/istream.cc|3 - libstdc++-v3/src/valarray.cc |1 - 14 files changed, 330 insertions(+), 15 deletions(-) create mode 100644 gcc/testsuite/c-c++-common/Wunused-local-typedefs.c create mode 100644 gcc/testsuite/g++.dg/warn/Wunused-local-typedefs.C diff --git a/gcc/c-decl.c b/gcc/c-decl.c index d683d4e..5d4564a 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -2769,7 +2769,15 @@ pushdecl (tree x) skip_external_and_shadow_checks: if (TREE_CODE (x) == TYPE_DECL) -set_underlying_type (x); +{ + /* So this is a typedef, set its underlying type. */ + set_underlying_type (x); + + /* If X is a typedef defined in the current function, record it +for the purpose of implementing the -Wunused-local-typedefs +warning. */ + record_locally_defined_typedef (x); +} bind (name, x, scope, /*invisible=*/false, nested, locus); @@ -3435,7 +3443,10 @@ lookup_name (tree name) { struct c_binding *b = I_SYMBOL_BINDING (name); if (b && !b->invisible) -return b->decl; +{ + maybe_record_typedef_use (b->decl); + return b->decl; +} return 0; } @@ -8192,6 +8203,9 @@ store_parm_decls (void) /* Initialize the RTL code for the function. */ allocate_struct_f
Re: [PATCH] Ensure vcond* expansion doesn't fail on x86 (PR target/50310)
On Wed, Sep 07, 2011 at 09:54:03PM +0200, Uros Bizjak wrote: > > 2011-09-07 Jakub Jelinek > > > > PR target/50310 > > * config/i386/i386.c (ix86_prepare_sse_fp_compare_args): For > > TARGET_AVX return code for LTGT and UNEQ. > > (ix86_expand_fp_vcond): Handle LTGT and UNEQ. > > > > * gcc.c-torture/execute/ieee/pr50310.c: New test. > > * gcc.dg/pr50310-2.c: New test. > > Please put early exit for TARGET_SSE at the beginning of > ix86_prepare_sse_fp_compare_args function. There is really no need to You mean for TARGET_AVX, right? > swap operands - and to help reload, since AVX instructions are > three-operand instructions. > > OK for mainline with this change. Here is the updated patch, I'll bootstrap/regtest it now. 2011-09-07 Jakub Jelinek PR target/50310 * config/i386/i386.c (ix86_prepare_sse_fp_compare_args): Return code early if TARGET_AVX. (ix86_expand_fp_vcond): Handle LTGT and UNEQ. * gcc.c-torture/execute/ieee/pr50310.c: New test. * gcc.dg/pr50310-2.c: New test. --- gcc/config/i386/i386.c.jj 2011-09-02 16:29:38.0 +0200 +++ gcc/config/i386/i386.c 2011-09-07 21:57:52.0 +0200 @@ -18304,6 +18304,11 @@ ix86_prepare_sse_fp_compare_args (rtx de { rtx tmp; + /* AVX supports all the needed comparisons, no need to swap arguments + nor help reload. */ + if (TARGET_AVX) +return code; + switch (code) { case LTGT: @@ -18559,7 +18564,32 @@ ix86_expand_fp_vcond (rtx operands[]) code = ix86_prepare_sse_fp_compare_args (operands[0], code, &operands[4], &operands[5]); if (code == UNKNOWN) -return false; +{ + rtx temp; + switch (GET_CODE (operands[3])) + { + case LTGT: + temp = ix86_expand_sse_cmp (operands[0], ORDERED, operands[4], + operands[5], operands[0], operands[0]); + cmp = ix86_expand_sse_cmp (operands[0], NE, operands[4], +operands[5], operands[1], operands[2]); + code = AND; + break; + case UNEQ: + temp = ix86_expand_sse_cmp (operands[0], UNORDERED, operands[4], + operands[5], operands[0], operands[0]); + cmp = ix86_expand_sse_cmp (operands[0], EQ, operands[4], +operands[5], operands[1], operands[2]); + code = IOR; + break; + default: + gcc_unreachable (); + } + cmp = expand_simple_binop (GET_MODE (cmp), code, temp, cmp, cmp, 1, +OPTAB_DIRECT); + ix86_expand_sse_movcc (operands[0], cmp, operands[1], operands[2]); + return true; +} if (ix86_expand_sse_fp_minmax (operands[0], code, operands[4], operands[5], operands[1], operands[2])) --- gcc/testsuite/gcc.c-torture/execute/ieee/pr50310.c.jj 2011-09-07 14:16:12.0 +0200 +++ gcc/testsuite/gcc.c-torture/execute/ieee/pr50310.c 2011-09-07 14:40:57.0 +0200 @@ -0,0 +1,73 @@ +/* PR target/50310 */ + +extern void abort (void); +double s1[4], s2[4], s3[64]; + +void +foo (void) +{ + int i; + for (i = 0; i < 4; i++) +s3[0 * 4 + i] = __builtin_isgreater (s1[i], s2[i]) ? -1.0 : 0.0; + for (i = 0; i < 4; i++) +s3[1 * 4 + i] = (!__builtin_isgreater (s1[i], s2[i])) ? -1.0 : 0.0; + for (i = 0; i < 4; i++) +s3[2 * 4 + i] = __builtin_isgreaterequal (s1[i], s2[i]) ? -1.0 : 0.0; + for (i = 0; i < 4; i++) +s3[3 * 4 + i] = (!__builtin_isgreaterequal (s1[i], s2[i])) ? -1.0 : 0.0; + for (i = 0; i < 4; i++) +s3[4 * 4 + i] = __builtin_isless (s1[i], s2[i]) ? -1.0 : 0.0; + for (i = 0; i < 4; i++) +s3[5 * 4 + i] = (!__builtin_isless (s1[i], s2[i])) ? -1.0 : 0.0; + for (i = 0; i < 4; i++) +s3[6 * 4 + i] = __builtin_islessequal (s1[i], s2[i]) ? -1.0 : 0.0; + for (i = 0; i < 4; i++) +s3[7 * 4 + i] = (!__builtin_islessequal (s1[i], s2[i])) ? -1.0 : 0.0; + for (i = 0; i < 4; i++) +s3[8 * 4 + i] = __builtin_islessgreater (s1[i], s2[i]) ? -1.0 : 0.0; + for (i = 0; i < 4; i++) +s3[9 * 4 + i] = (!__builtin_islessgreater (s1[i], s2[i])) ? -1.0 : 0.0; + for (i = 0; i < 4; i++) +s3[10 * 4 + i] = __builtin_isunordered (s1[i], s2[i]) ? -1.0 : 0.0; + for (i = 0; i < 4; i++) +s3[11 * 4 + i] = (!__builtin_isunordered (s1[i], s2[i])) ? -1.0 : 0.0; + for (i = 0; i < 4; i++) +s3[12 * 4 + i] = s1[i] > s2[i] ? -1.0 : 0.0; + for (i = 0; i < 4; i++) +s3[13 * 4 + i] = s1[i] <= s2[i] ? -1.0 : 0.0; + for (i = 0; i < 4; i++) +s3[14 * 4 + i] = s1[i] < s2[i] ? -1.0 : 0.0; + for (i = 0; i < 4; i++) +s3[15 * 4 + i] = s1[i] >= s2[i] ? -1.0 : 0.0; +} + +int +main () +{ + int i; + s1[0] = 5.0; + s1[1] = 6.0; + s1[2] = 5.0; + s1[3] = __builtin_nan (""); + s2[0] = 6.0; + s2[1] = 5.0; + s2[2] = 5.0; + s2[3] = 5.0; + asm volatile ("" : : : "memory"); + foo (); + a
Re: [PATCH] Ensure vcond* expansion doesn't fail on x86 (PR target/50310)
On Wed, Sep 7, 2011 at 10:01 PM, Jakub Jelinek wrote: >> > 2011-09-07 Jakub Jelinek >> > >> > PR target/50310 >> > * config/i386/i386.c (ix86_prepare_sse_fp_compare_args): For >> > TARGET_AVX return code for LTGT and UNEQ. >> > (ix86_expand_fp_vcond): Handle LTGT and UNEQ. >> > >> > * gcc.c-torture/execute/ieee/pr50310.c: New test. >> > * gcc.dg/pr50310-2.c: New test. >> >> Please put early exit for TARGET_SSE at the beginning of >> ix86_prepare_sse_fp_compare_args function. There is really no need to > > You mean for TARGET_AVX, right? Oh, sure. >> swap operands - and to help reload, since AVX instructions are >> three-operand instructions. >> >> OK for mainline with this change. > > Here is the updated patch, I'll bootstrap/regtest it now. Thanks. Uros.
[4.6 PATCH] Fix DECL_COMDAT_GROUP of thunks (PR c++/50255)
Hi! On various targets we emit thunks into the same section as the corresponding method they are thunking to. Unfortunately, the thunk_fndecl had a DECL_COMDAT_GROUP set earlier to the thunk name, which results in assembly like: .section .text._ZN1TI1WI1XEE1hEP1A,"axG",@progbits,_ZThn8_N1TI1WI1XEE1hEP1A,comdat .weak _ZThn8_N1TI1WI1XEE1hEP1A .type _ZThn8_N1TI1WI1XEE1hEP1A, @function _ZThn8_N1TI1WI1XEE1hEP1A: .LFB4: .cfi_startproc subq$8, %rdi jmp .LTHUNK0 .cfi_endproc .LFE4: .size _ZThn8_N1TI1WI1XEE1hEP1A, .-_ZThn8_N1TI1WI1XEE1hEP1A .align 2 .weak _ZN1TI1WI1XEE1hEP1A .type _ZN1TI1WI1XEE1hEP1A, @function _ZN1TI1WI1XEE1hEP1A: .LFB3: .cfi_startproc subq$40, %rsp .cfi_def_cfa_offset 48 movl(%rsi), %edx decl%edx cmpl$4, %edx ja .L3 movq8(%rsi), %rax jmp *.L8(,%rdx,8) .section .rodata._ZN1TI1WI1XEE1hEP1A,"aG",@progbits,_ZN1TI1WI1XEE1hEP1A,comdat .align 8 .align 4 .L8: .quad .L4 Note the .text._ZN1TI1WI1XEE1hEP1A section uses incorrectly _ZThn8_N1TI1WI1XEE1hEP1A comdat group instead of _ZN1TI1WI1XEE1hEP1A, but e.g. the .rodata section for it already uses the right comdat group name, therefore e.g. if the same method is compiled with different optimization options with no need for .rodata in another CU and that CU's _ZThn8_N1TI1WI1XEE1hEP1A would be picked and this CU's _ZN1TI1WI1XEE1hEP1A, it will fail to link. This patch makes sure it uses the right thunk name. When mixing 4.6 compiled objects compiled before/after this patch, if just the .text section is used, I think the worst thing that can happen is that both comdat groups stay but as the symbols are weak, it will just result in larger code. If more than one section is used for the method+thunks and mixed comdat groups were used before, it was a problem already before. On the trunk this issue went away with Honza's cgraph thunk reorg, the make_decl_one_only for the thunk's comdat group is gone and it does cgraph_add_to_same_comdat_group. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for 4.6? Maybe for 4.5 also afterwards (4.4 wasn't emitting comdat groups). 2011-09-07 Jakub Jelinek PR c++/50255 * method.c (use_thunk): If emitting thunk into the same section as function, use the same DECL_COMDAT_GROUP as well. --- gcc/cp/method.c.jj 2011-05-19 11:48:00.0 +0200 +++ gcc/cp/method.c 2011-09-07 17:15:37.0 +0200 @@ -360,6 +360,8 @@ use_thunk (tree thunk_fndecl, bool emit_ /* Output the thunk into the same section as function. */ DECL_SECTION_NAME (thunk_fndecl) = DECL_SECTION_NAME (function); + if (DECL_COMDAT_GROUP (function)) + make_decl_one_only (thunk_fndecl, DECL_COMDAT_GROUP (function)); } } Jakub
Re: [Patch, Fortran, OOP] PR 48095: Invalid assignment to procedure pointer component not rejected
Janus Weil wrote: the attached patch fixes this accepts-valid OOP PR. It consists of two parts: 1) resolve_structure_cons is being extended to check the interface of proc-ptr components (comment #7). 2) A small fix to allow for correct parsing of structure constructors including proc-ptr components (comment #8). Thanks for the patch! + if (s2&& !gfc_compare_interfaces (comp->ts.interface, s2, name, 0, 1, +err, sizeof(err))) Space after sizeof. + gfc_error ("In derived type constructor at %L: Interface mismatch" +" in procedure pointer component '%s': %s", + &cons->expr->where, comp->name, err); Somehow, I find the words clumsy with too many colons. "derived type constructor" - I'd use a hyphen ("derived-type") and I want to note that the standard calls it "structure constructor"; I also would use "for ... component" and not "in ... component" and add a hyphen to "procedure pointer". How about a simpler: "Interface mismatch for procedure-pointer component '%s' at %L: %s"? I think it should be clear from the context that it is about a structure constructor. Or for the long version, how about: "Interface mismatch for procedure-pointer component '%s' in structure constructor at %L: %s"? OK with fixing the sizeof nit and after considering the text changes. Tobias
[pph] Merge micro tests. (issue4988047)
This patch adds new tests for overload resolution. In contrast to prior tests, we want these tests to have assembly differences because PPH binds overloads at header compilation time, not based on accident of include order. The test control files change as a consequence. Changed the compiler command line slightly to make copy/paste searches easier. Corrected the keyno test to actually not have a key method. (There were incomplete copy/paste/edit actions in the original change.) However, the incorrect tests were failing for other reasons, and that test has been preserved as a new test. Test x7rtti.cc was unresolved because the run test was failing to compile. Updated test x7rtti.cc to supress the dg-run, until the compile problems are fixed. Tests run on x64. Index: gcc/testsuite/ChangeLog.pph 2011-09-07 Lawrence Crowl * a0vardef.h: New. * c0vardef1.h: New. * x4structover1.cc: New. * c0vardef2.h: New. * x0structover1.h: New. * c4vardef.cc: New. * x4structover2.cc: New. * x0structover2.h: New. * x4resolve1.cc: Add more overloaded calls. * x4resolve2.cc: Add more overloaded calls. Index: gcc/testsuite/g++.dg/pph/x4resolve1.cc === --- gcc/testsuite/g++.dg/pph/x4resolve1.cc (revision 178657) +++ gcc/testsuite/g++.dg/pph/x4resolve1.cc (working copy) @@ -1,9 +1,12 @@ -// pph asm xwant 53261 +// pph asm xwant 03374 #include "x0resolve1.h" #include "x0resolve2.h" int caller() { -return overloader1() + overloader2(); +int t = intfunc(3l) + fltfunc(2.0); +t += intfunc(3) + fltfunc(2.0f); +t += overloader1() + overloader2(); +return t; } Index: gcc/testsuite/g++.dg/pph/a0vardef.h === --- gcc/testsuite/g++.dg/pph/a0vardef.h (revision 0) +++ gcc/testsuite/g++.dg/pph/a0vardef.h (revision 0) @@ -0,0 +1,4 @@ +#ifndef A0VARDEF_H +#define A0VARDEF_H +int variable = 1; +#endif Index: gcc/testsuite/g++.dg/pph/c0vardef1.h === --- gcc/testsuite/g++.dg/pph/c0vardef1.h(revision 0) +++ gcc/testsuite/g++.dg/pph/c0vardef1.h(revision 0) @@ -0,0 +1,4 @@ +#ifndef C0VARDEF1_H +#define C0VARDEF1_H +#include "a0vardef.h" +#endif Index: gcc/testsuite/g++.dg/pph/x4resolve2.cc === --- gcc/testsuite/g++.dg/pph/x4resolve2.cc (revision 178657) +++ gcc/testsuite/g++.dg/pph/x4resolve2.cc (working copy) @@ -1,9 +1,12 @@ -// pph asm xwant 12527 +// pph asm xwant 37643 #include "x0resolve2.h" #include "x0resolve1.h" int caller() { -return overloader1() + overloader2(); +int t = intfunc(3l) + fltfunc(2.0); +t += intfunc(3) + fltfunc(2.0f); +t += overloader1() + overloader2(); +return t; } Index: gcc/testsuite/g++.dg/pph/x4structover1.cc === --- gcc/testsuite/g++.dg/pph/x4structover1.cc (revision 0) +++ gcc/testsuite/g++.dg/pph/x4structover1.cc (revision 0) @@ -0,0 +1,9 @@ +// { dg-xfail-if "BOGUS" { "*-*-*" } { "-fpph-map=pph.map" } } + + +#include "x0structover1.h" +#include "x0structover2.h" + +int func2() { +return func( (S*)0 ); +} Index: gcc/testsuite/g++.dg/pph/c0vardef2.h === --- gcc/testsuite/g++.dg/pph/c0vardef2.h(revision 0) +++ gcc/testsuite/g++.dg/pph/c0vardef2.h(revision 0) @@ -0,0 +1,4 @@ +#ifndef C0VARDEF2_H +#define C0VARDEF2_H +#include "a0vardef.h" +#endif Index: gcc/testsuite/g++.dg/pph/x0structover1.h === --- gcc/testsuite/g++.dg/pph/x0structover1.h(revision 0) +++ gcc/testsuite/g++.dg/pph/x0structover1.h(revision 0) @@ -0,0 +1,5 @@ +#ifndef X0STRUCTOVER1_H +#define X0STRUCTOVER1_H +#include "a0rawstruct.h" +inline int func( S* p ) { if ( p ) return 1; else return 0; } +#endif Index: gcc/testsuite/g++.dg/pph/c4vardef.cc === --- gcc/testsuite/g++.dg/pph/c4vardef.cc(revision 0) +++ gcc/testsuite/g++.dg/pph/c4vardef.cc(revision 0) @@ -0,0 +1,4 @@ +// pph asm xdiff 00553 + +#include "c0vardef1.h" +#include "c0vardef2.h" Index: gcc/testsuite/g++.dg/pph/x4structover2.cc === --- gcc/testsuite/g++.dg/pph/x4structover2.cc (revision 0) +++ gcc/testsuite/g++.dg/pph/x4structover2.cc (revision 0) @@ -0,0 +1,6 @@ +#include "x0structover2.h" +#include "x0structover1.h" + +int func2() { +return func( (S*)0 ); +} Index: gcc/testsuite/g++.dg/pph/x0structover2.h === --- gcc/testsuite/g++.dg/pph/x0structover2.h(revision 0) +++ gcc/testsuite/g++.dg/pph/x0structover2.h
Re: [Patch, Fortran, OOP] PR 48095: Invalid assignment to procedure pointer component not rejected
Hi Tobias, >> + if (s2&& !gfc_compare_interfaces (comp->ts.interface, s2, name, >> 0, 1, >> + err, sizeof(err))) > > Space after sizeof. Fixed. >> + gfc_error ("In derived type constructor at %L: Interface >> mismatch" >> + " in procedure pointer component '%s': %s", >> + &cons->expr->where, comp->name, err); > > Somehow, I find the words clumsy with too many colons. "derived type > constructor" - I'd use a hyphen ("derived-type") and I want to note that the > standard calls it "structure constructor"; I also would use "for ... > component" and not "in ... component" and add a hyphen to "procedure > pointer". You are right about the hyphens, and I also agree that it makes more sense to stick to the standard language. Note: My wording was partly copied over from other error messages in resolve_structure_cons, all of which use "derived type constructor". I'm changing all of them in the attached update of the patch. > How about a simpler: "Interface mismatch for procedure-pointer component > '%s' at %L: %s"? I think it should be clear from the context that it is > about a structure constructor. Or for the long version, how about: > "Interface mismatch for procedure-pointer component '%s' in structure > constructor at %L: %s"? I prefer the second variant. I'll do another regtest with the updated patch (the changed error messages might need testsuite adaptions?) and then go ahead and commit it. Thanks for the review. Cheers, Janus Index: gcc/fortran/resolve.c === --- gcc/fortran/resolve.c (revision 178659) +++ gcc/fortran/resolve.c (working copy) @@ -1013,7 +1013,7 @@ resolve_structure_cons (gfc_expr *expr, int init) if (cons->expr->expr_type != EXPR_NULL && rank != cons->expr->rank && (comp->attr.allocatable || cons->expr->rank)) { - gfc_error ("The rank of the element in the derived type " + gfc_error ("The rank of the element in the structure " "constructor at %L does not match that of the " "component (%d/%d)", &cons->expr->where, cons->expr->rank, rank); @@ -1035,7 +1035,7 @@ resolve_structure_cons (gfc_expr *expr, int init) t = SUCCESS; } else if (comp->attr.pointer && cons->expr->ts.type != BT_UNKNOWN) - gfc_error ("The element in the derived type constructor at %L, " + gfc_error ("The element in the structure constructor at %L, " "for pointer component '%s', is %s but should be %s", &cons->expr->where, comp->name, gfc_basic_typename (cons->expr->ts.type), @@ -1113,12 +1113,46 @@ resolve_structure_cons (gfc_expr *expr, int init) || CLASS_DATA (comp)->attr.allocatable { t = FAILURE; - gfc_error ("The NULL in the derived type constructor at %L is " + gfc_error ("The NULL in the structure constructor at %L is " "being applied to component '%s', which is neither " "a POINTER nor ALLOCATABLE", &cons->expr->where, comp->name); } + if (comp->attr.proc_pointer && comp->ts.interface) + { + /* Check procedure pointer interface. */ + gfc_symbol *s2 = NULL; + gfc_component *c2; + const char *name; + char err[200]; + + if (gfc_is_proc_ptr_comp (cons->expr, &c2)) + { + s2 = c2->ts.interface; + name = c2->name; + } + else if (cons->expr->expr_type == EXPR_FUNCTION) + { + s2 = cons->expr->symtree->n.sym->result; + name = cons->expr->symtree->n.sym->result->name; + } + else if (cons->expr->expr_type != EXPR_NULL) + { + s2 = cons->expr->symtree->n.sym; + name = cons->expr->symtree->n.sym->name; + } + + if (s2 && !gfc_compare_interfaces (comp->ts.interface, s2, name, 0, 1, + err, sizeof (err))) + { + gfc_error ("Interface mismatch for procedure-pointer component " + "'%s' in structure constructor at %L: %s", + &cons->expr->where, comp->name, err); + return FAILURE; + } + } + if (!comp->attr.pointer || comp->attr.proc_pointer || cons->expr->expr_type == EXPR_NULL) continue; @@ -1128,7 +1162,7 @@ resolve_structure_cons (gfc_expr *expr, int init) if (!a.pointer && !a.target) { t = FAILURE; - gfc_error ("The element in the derived type constructor at %L, " + gfc_error ("The element in the structure constructor at %L, " "for pointer component '%s' should be a POINTER or " "a TARGET", &cons->expr->where, comp->name); } @@ -1156,7 +1190,7 @@ resolve_structure_cons (gfc_expr *expr, int init) || gfc_is_coindexed (cons->expr))) { t = FAILURE; - gfc_error ("Invalid expression in the derived type constructor for " + gfc_error ("Invalid expression in the structure constructor for " "pointer component '%s' at %L in PURE procedure", comp->name, &cons->expr->where); } Index: gcc/fortran/primary.c
Re: [PATCH][cilkplus branch] Add __cilk builtin keyword
On Wed, Sep 7, 2011 at 11:12 AM, Iyer, Balaji V wrote: > Hello Everyone, > This patch should add the built-in __cilk keyword and set it to 200 in the > GCC cilkplus branch. > > Thanks, > + + if (flag_enable_cilk) +cpp_define_formatted(pfile, "__cilk=%d", 200); + <<< Extra line +2011-09-07 Balaji V. Iyer + + * gcc.dg/cilk-plus/test__cilk.c: New<<<
RE: [PATCH][cilkplus branch] Add __cilk builtin keyword
Fixed the changes you mentioned. Here is an upated patch. Thanks, Balaji V. Iyer. From: H.J. Lu [hjl.to...@gmail.com] Sent: Wednesday, September 07, 2011 5:26 PM To: Iyer, Balaji V Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH][cilkplus branch] Add __cilk builtin keyword On Wed, Sep 7, 2011 at 11:12 AM, Iyer, Balaji V wrote: > Hello Everyone, >This patch should add the built-in __cilk keyword and set it to 200 in the > GCC cilkplus branch. > > Thanks, > + + if (flag_enable_cilk) +cpp_define_formatted(pfile, "__cilk=%d", 200); + <<< Extra line +2011-09-07 Balaji V. Iyer + + * gcc.dg/cilk-plus/test__cilk.c: New<<< __cilk_keyword_patch Description: __cilk_keyword_patch
Re: [PING] [PATCH] PR c++/47346 - access control for nested type is ignored in template
On 08/31/2011 09:56 AM, Dodji Seketeli wrote: + /* So if we are parsing a friend template declaration, then +we should make sure that looking up the name of the +declaration doesn't schedule it for type access checking +at the time of instantiation of the current containing +template class, if any. */ + cp_no_type_access_check_p = is_friend; Why does this need to be handled differently from non-template friends? Perhaps the template type access checking code should be adjusted to use the existing deferred access checking code in semantics.c: push_deferring_access_checks and such. Jason
Re: [PATCH][cilkplus branch] Add __cilk builtin keyword
On Wed, Sep 7, 2011 at 2:32 PM, Iyer, Balaji V wrote: > Fixed the changes you mentioned. Here is an upated patch. > I checked it into cilkplus branch. -- H.J.
Re: [PATCH][cilkplus branch] Libcilkrts bug-fix patch
On Wed, Sep 7, 2011 at 3:14 PM, Iyer, Balaji V wrote: > Hello Everyone, > This patch is for the Cilk Plus GCC branch. It should fix a bug in Cilk > Plus runtime (libcilkrts) during initialization when the number of workers is > greater than 3 times the number of cores in the system. > 1. Please include ChangeLog entries. 2. Please use the same version of autoconf/automake specified at http://gcc.gnu.org/install/prerequisites.html You can get them from ftp://gcc.gnu.org/pub/gcc/infrastructure/ -- H.J.
Re: [Patch, Fortran, OOP] PR 48095: Invalid assignment to procedure pointer component not rejected
> I'll do another regtest with the updated patch (the changed error > messages might need testsuite adaptions?) and then go ahead and commit > it. Committed as r178665 with some minor corrections. Cheers, Janus
Re: [Patch, Fortran] PR44646 - Add parser support for DO CONCURRENT
On Monday 05 September 2011 18:11:47 Tobias Burnus wrote: > On 09/03/2011 02:49 PM, Tobias Burnus wrote: > > This patch implements the parsing/diagnostic for "DO[,] CONCURRENT > > for-all-header", e.g. > > > > do concurrent (i = 1:5) > > A(i) = B(i) > > end do > > (Side remark: do concurrent also supports a logical mask expression as > FORALL does.) > > > I have attached an updated version, which actually implements do > concurrent in trans-stmt.c. Additionally, "CYCLE" without a label did > not work. > > > Build and regtested on x86-64-linux. > > OK for the trunk? Patch is basically OK. One comment below. > diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c > index 436c160..3877711 100644 > --- a/gcc/fortran/resolve.c > +++ b/gcc/fortran/resolve.c > @@ -3125,11 +3126,17 @@ resolve_function (gfc_expr *expr) > { >if (forall_flag) > { > - gfc_error ("reference to non-PURE function '%s' at %L inside a " > + gfc_error ("Reference to non-PURE function '%s' at %L inside a " > "FORALL %s", name, &expr->where, > forall_flag == 2 ? "mask" : "block"); > t = FAILURE; > } > + else if (do_concurrent_flag) > + { > + gfc_error ("Reference to non-PURE function '%s' at %L inside a " > +"DO CONCURRENT block", name, &expr->where); > + t = FAILURE; > + } You could distinguish between mask and block here, like it is done for forall just above, or you could decide that mask is part of the do concurrent block and keep the error message as is (it is more i18n/gettext friendly), in which case you don't need to set do_concurrent_flag to 2 (hunk below). I'm undecided about which is the better one. > @@ -9083,6 +9107,11 @@ resolve_code (gfc_code *code, gfc_namespace *ns) > /* Blocks are handled in resolve_select_type because we have > to transform the SELECT TYPE into ASSOCIATE first. */ > break; > +case EXEC_DO_CONCURRENT: > + do_concurrent_flag = 1; > + gfc_resolve_blocks (code->block, ns); > + do_concurrent_flag = 2; > + break; Thanks for the patch Mikael
Re: [4.6 PATCH] Fix DECL_COMDAT_GROUP of thunks (PR c++/50255)
Ok. Jakub Jelinek wrote: Hi! On various targets we emit thunks into the same section as the corresponding method they are thunking to. Unfortunately, the thunk_fndecl had a DECL_COMDAT_GROUP set earlier to the thunk name, which results in assembly like: .section .text._ZN1TI1WI1XEE1hEP1A,"axG",@progbits,_ZThn8_N1TI1WI1XEE1hEP1A,comdat .weak _ZThn8_N1TI1WI1XEE1hEP1A .type _ZThn8_N1TI1WI1XEE1hEP1A, @function _ZThn8_N1TI1WI1XEE1hEP1A: .LFB4: .cfi_startproc subq$8, %rdi jmp .LTHUNK0 .cfi_endproc .LFE4: .size _ZThn8_N1TI1WI1XEE1hEP1A, .-_ZThn8_N1TI1WI1XEE1hEP1A .align 2 .weak _ZN1TI1WI1XEE1hEP1A .type _ZN1TI1WI1XEE1hEP1A, @function _ZN1TI1WI1XEE1hEP1A: .LFB3: .cfi_startproc subq$40, %rsp .cfi_def_cfa_offset 48 movl(%rsi), %edx decl%edx cmpl$4, %edx ja .L3 movq8(%rsi), %rax jmp *.L8(,%rdx,8) .section .rodata._ZN1TI1WI1XEE1hEP1A,"aG",@progbits,_ZN1TI1WI1XEE1hEP1A,comdat .align 8 .align 4 .L8: .quad .L4 Note the .text._ZN1TI1WI1XEE1hEP1A section uses incorrectly _ZThn8_N1TI1WI1XEE1hEP1A comdat group instead of _ZN1TI1WI1XEE1hEP1A, but e.g. the .rodata section for it already uses the right comdat group name, therefore e.g. if the same method is compiled with different optimization options with no need for .rodata in another CU and that CU's _ZThn8_N1TI1WI1XEE1hEP1A would be picked and this CU's _ZN1TI1WI1XEE1hEP1A, it will fail to link. This patch makes sure it uses the right thunk name. When mixing 4.6 compiled objects compiled before/after this patch, if just the .text section is used, I think the worst thing that can happen is that both comdat groups stay but as the symbols are weak, it will just result in larger code. If more than one section is used for the method+thunks and mixed comdat groups were used before, it was a problem already before. On the trunk this issue went away with Honza's cgraph thunk reorg, the make_decl_one_only for the thunk's comdat group is gone and it does cgraph_add_to_same_comdat_group. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for 4.6? Maybe for 4.5 also afterwards (4.4 wasn't emitting comdat groups). 2011-09-07 Jakub Jelinek PR c++/50255 * method.c (use_thunk): If emitting thunk into the same section as function, use the same DECL_COMDAT_GROUP as well. --- gcc/cp/method.c.jj 2011-05-19 11:48:00.0 +0200 +++ gcc/cp/method.c 2011-09-07 17:15:37.0 +0200 @@ -360,6 +360,8 @@ use_thunk (tree thunk_fndecl, bool emit_ /* Output the thunk into the same section as function. */ DECL_SECTION_NAME (thunk_fndecl) = DECL_SECTION_NAME (function); + if (DECL_COMDAT_GROUP (function)) + make_decl_one_only (thunk_fndecl, DECL_COMDAT_GROUP (function)); } } Jakub
Re: [v3] tuple round 2
> 2011-08-03 Benjamin Kosnik > François Dumont > > * testsuite/23_containers/array/at_neg.cc: Move... > * testsuite/23_containers/array/at.cc: ...here. Remove > -fno-exceptions, call const at member function. I've reverted the name change. -benjamin
[cxx-mem-model] Call torture-finish in testing infrastructure
Apparently, if you don't call torture-finish, subsequent tests in dg.exp inherit CFLAGS incorrectly. Serves me right for not testing the entire testsuite when making changes to memmodel.exp. When will I learn to expect the unexpected when making seemingly unrelated changes...? Committed to branch. * gcc.dg/memmodel/memmodel.exp: Call torture-finish. * g++.dg/memmodel/memmodel.exp: Likewise. Index: gcc.dg/memmodel/memmodel.exp === --- gcc.dg/memmodel/memmodel.exp(revision 178607) +++ gcc.dg/memmodel/memmodel.exp(working copy) @@ -54,4 +54,5 @@ if [info exists guality_gdb_name] { unsetenv GUALITY_GDB_NAME } +torture-finish dg-finish Index: g++.dg/memmodel/memmodel.exp === --- g++.dg/memmodel/memmodel.exp(revision 178607) +++ g++.dg/memmodel/memmodel.exp(working copy) @@ -54,4 +54,5 @@ if [info exists guality_gdb_name] { unsetenv GUALITY_GDB_NAME } +torture-finish dg-finish
[PATCH][Cilkplus] Local Label inside Cilk_for fix
Hello Everyone, Local label inside a _Cilk_for was giving an error in the C++ Compiler of Cilk Plus GCC branch. This patch should fix that. Thanks, Balaji V. Iyer. label_patch Description: label_patch
[PATCH][Cilkplus] _Cilk_spawn inside contructor and destructor
Hello Everyone, This patch is for the Cilk Plus C++ compiler. It will allow users to use _Cilk_spawn inside constructors and destructors. Thanks, Balaji V. Iyer. spawn_inside_ctor_dtor_patch Description: spawn_inside_ctor_dtor_patch
Re: [Patch, Fortran] PR44646 - Add parser support for DO CONCURRENT
Hi Tobias, I have attached an updated version, which actually implements do concurrent in trans-stmt.c. Additionally, "CYCLE" without a label did not work. I think you also need to add support to frontend-passes.c. Regards Thomas
Re: [Patch, Fortran] PR44646 - Add parser support for DO CONCURRENT
Mikael Morin wrote: Patch is basically OK. One comment below. diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 436c160..3877711 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -3125,11 +3126,17 @@ resolve_function (gfc_expr *expr) { if (forall_flag) - gfc_error ("reference to non-PURE function '%s' at %L inside a " + gfc_error ("Reference to non-PURE function '%s' at %L inside a " "FORALL %s", name,&expr->where, forall_flag == 2 ? "mask" : "block"); + else if (do_concurrent_flag) + gfc_error ("Reference to non-PURE function '%s' at %L inside a " +"DO CONCURRENT block", name,&expr->where); You could distinguish between mask and block here, like it is done for forall just above I have changed it to be in the line with FORALL. I have also added EXEC_DO_CONCURRENT after EXEC_FORALL in frontend-optimization.c as suggested by Thomas. Committed as Rev. 178677. Thanks for the thorough review! Tobias