Fix build of *86*-linux-android with --enable-shared
Hi, libcilkrts is compiled with -nostdlib, that means we have to explicitly specify the pthread library we should link with (e.g. we don't have such problem with libgomp, because it is C). And, indeed, -lpthread is hard-coded in the Makefile for cilkrts. For Android this doesn't work, because lpthread is absent and pthreads are part of libc. I also noticed, that configure check for pthread_{,attr_}[sg]etaffinity_np always fails, because at the point where it is placed in configure.ac, -pthread is not set. We just have to put this check after we added -pthread to CFLAGS. This patch addresses this as well. diff --git a/libcilkrts/ChangeLog b/libcilkrts/ChangeLog index 3881c82..ab10a0b 100644 --- a/libcilkrts/ChangeLog +++ b/libcilkrts/ChangeLog @@ -1,3 +1,15 @@ +2014-08-01 Alexander Ivchenko alexander.ivche...@intel.com + + * configure.ac: Move pthread affinity test to the place where + '-pthread' passed to CFLAGS. Otherwise the test always fails. + (XCFLAGS): New variable for correctly passing + '-pthread'. + (XLDFLAGS): New variable for passing the correct pthread lib. + * configure: Regenerate. + * Makefile.am (AM_CFLAGS): Add $XCFLAGS. + (AM_LDFLAGS): Add $XLDFLAGS. + * Makefile.in: Regenerate. + 2014-05-21 John Marino gnu...@marino.st * runtime/os-unix.c (__DragonFly__): New target. diff --git a/libcilkrts/Makefile.am b/libcilkrts/Makefile.am index 84551c8..70538a2 100644 --- a/libcilkrts/Makefile.am +++ b/libcilkrts/Makefile.am @@ -43,9 +43,9 @@ GENERAL_FLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/runtime -I$(top_srcdir)/ # Enable Intel Cilk Plus extension GENERAL_FLAGS += -fcilkplus -AM_CFLAGS = $(GENERAL_FLAGS) -std=c99 +AM_CFLAGS = $(XCFLAGS) $(GENERAL_FLAGS) -std=c99 AM_CPPFLAGS = $(GENERAL_FLAGS) -AM_LDFLAGS = -lpthread +AM_LDFLAGS = $(XLDFLAGS) # May be used by toolexeclibdir. gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER) @@ -92,7 +92,8 @@ include include/internal/rev.mk #libcilkrts_la_LDFLAGS = -rpath '$(libdir)' libcilkrts_la_LDFLAGS = -version-info 5:0:0 -libcilkrts_la_LDFLAGS += -lpthread @lt_cv_dlopen_libs@ +libcilkrts_la_LDFLAGS += @lt_cv_dlopen_libs@ +libcilkrts_la_LDFLAGS += $(AM_LDFLAGS) # If we're building on Linux, use the Linux version script if LINUX_LINKER_SCRIPT diff --git a/libcilkrts/configure.ac b/libcilkrts/configure.ac index fb21505..cc9a39f 100644 --- a/libcilkrts/configure.ac +++ b/libcilkrts/configure.ac @@ -164,6 +164,27 @@ AC_SUBST(toolexeclibdir) AC_SUBST(lt_cv_dlopen_libs) +# Check to see if -pthread or -lpthread is needed. Prefer the former. +# Note that the CILK_SELF_SPEC in gcc.c may force -pthread. +# In case the pthread.h system header is not found, this test will fail. +XCFLAGS= +XLDFLAGS= +CFLAGS=$CFLAGS -pthread +AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [#include pthread.h + void *g(void *d) { return NULL; }], + [pthread_t t; pthread_create(t,NULL,g,NULL);])], + [XCFLAGS= -Wc,-pthread], + [CFLAGS=$save_CFLAGS LIBS=-lpthread $LIBS + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( +[#include pthread.h + void *g(void *d) { return NULL; }], +[pthread_t t; pthread_create(t,NULL,g,NULL);])], + [], + [AC_MSG_ERROR([Pthreads are required to build libcilkrts])])]) + # Check for pthread_{,attr_}[sg]etaffinity_np. AC_LINK_IFELSE( [AC_LANG_PROGRAM( @@ -183,24 +204,24 @@ AC_LINK_IFELSE( AC_DEFINE(HAVE_PTHREAD_AFFINITY_NP, 1, [ Define if pthread_{,attr_}{g,s}etaffinity_np is supported.])) -# Check to see if -pthread or -lpthread is needed. Prefer the former. -# Note that the CILK_SELF_SPEC in gcc.c may force -pthread. -# In case the pthread.h system header is not found, this test will fail. -CFLAGS=$CFLAGS -pthread -AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [#include pthread.h - void *g(void *d) { return NULL; }], - [pthread_t t; pthread_create(t,NULL,g,NULL);])], - [], - [CFLAGS=$save_CFLAGS LIBS=-lpthread $LIBS - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( -[#include pthread.h - void *g(void *d) { return NULL; }], -[pthread_t t; pthread_create(t,NULL,g,NULL);])], - [], - [AC_MSG_ERROR([Pthreads are required to build libcilkrts])])]) +# Every c++ lib is linking by default with -nostdlib, which leads to the +# fact, that proper pthread library will not be given at link time. We have +# to hard-code that. +case ${target} in + + *android*) +XLDFLAGS=$XLDFLAGS -lc + ;; + *) +XLDFLAGS=$XLDFLAGS -lpthread +;; + +esac + +AC_SUBST(XCFLAGS) +AC_SUBST(XLDFLAGS) + +CFLAGS=$save_CFLAGS if test $enable_shared = yes; then link_cilkrts=-lcilkrts %{static: $LIBS} Is it ok? --Alexander
Re: [GSoC] checking for the loop parallelism
Those waw dependences seem to be correct. Should even the previous analysis only mark the j-loop as parallel? The previous and the current analysis mark the j-loop as nonparallelizable. (Possibly, I don't fully understand the question. Could you please reformulate it?) -- Cheers, Roman Gareev.
[PATCH, ivopt] Try aligned offset when get_address_cost
Hi, For some TARGET, like ARM THUMB1, the offset in load/store should be nature aligned. But in function get_address_cost, when computing max_offset, it only tries byte-aligned offsets: ((unsigned HOST_WIDE_INT) 1 i) - 1 which can not meet thumb_legitimate_offset_p check called from thumb1_legitimate_address_p for HImode and SImode. The patch adds additional try for aligned offset: ((unsigned HOST_WIDE_INT) 1 i) - GET_MODE_SIZE (address_mode). Bootstrap and no make check regression on X86-64. No make check regression on qemu for Cortex-m0 and Cortex-m3. For Cortex-m0, no performance changes with coremark and dhrystone. Coremark code size is ~0.44 smaller. And eembcv2 code size is ~0.22 smaller. CSiBE code size is ~0.05% smaller. OK for trunk? Thanks! -Zhenqiang ChangeLog 2014-08-04 Zhenqiang Chen zhenqiang.c...@arm.com * tree-ssa-loop-ivopts.c (get_address_cost): Try aligned offset. testsuite/ChangeLog: 2014-08-04 Zhenqiang Chen zhenqiang.c...@arm.com * gcc.target/arm/get_address_cost_aligned_max_offset.c: New test. diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c index 3b4a6cd..562122a 100644 --- a/gcc/tree-ssa-loop-ivopts.c +++ b/gcc/tree-ssa-loop-ivopts.c @@ -3308,6 +3308,18 @@ get_address_cost (bool symbol_present, bool var_present, XEXP (addr, 1) = gen_int_mode (off, address_mode); if (memory_address_addr_space_p (mem_mode, addr, as)) break; + /* For some TARGET, like ARM THUMB1, the offset should be nature +aligned. Try an aligned offset if address_mode is not QImode. */ + off = (address_mode == QImode) + ? 0 + : ((unsigned HOST_WIDE_INT) 1 i) + - GET_MODE_SIZE (address_mode); + if (off 0) + { + XEXP (addr, 1) = gen_int_mode (off, address_mode); + if (memory_address_addr_space_p (mem_mode, addr, as)) + break; + } } if (i == -1) off = 0; diff --git a/gcc/testsuite/gcc.target/arm/get_address_cost_aligned_max_offset.c b/gcc/testsuite/gcc.target/arm/get_address_cost_aligned_max_offset.c new file mode 100644 index 000..cc3e2f7 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/get_address_cost_aligned_max_offset.c @@ -0,0 +1,28 @@ +/* { dg-do compile } */ +/* { dg-options -mthumb -O2 } */ +/* { dg-require-effective-target arm_thumb1_ok } */ + +unsigned int +test (const short p16[6 * 64]) +{ + unsigned int i = 6; + unsigned int ret = 0; + + do +{ + unsigned long long *p64 = (unsigned long long*) p16; + unsigned int *p32 = (unsigned int*) p16; + ret += ret; + if (p16[1] || p32[1]) + ret++; + else if (p64[1] | p64[2] | p64[3]) + ret++; + p16 += 64; + i--; +} while (i != 0); + + return ret; +} + +/* { dg-final { scan-assembler-not #22 } } */ +/* { dg-final { scan-assembler-not #14 } } */
Re: [PATCH][Ping v5] Add patch for debugging compiler ICEs
On 08/01/2014 07:53 PM, Jakub Jelinek wrote: I think we should use David Malcolm's approach i.e. add some --report-bug flag to driver. This could be enabled by default at configure time via --with-spec. -freport-bug or whatever we call it should not be, at least if it attempts to communicate over the network, should not be required though, lots of people do e.g. package builds in various chroots etc. and you really don't want to perform any network activity from there. Oh sure, the actual backend of --report-bug could vary from just generating the repro and storing it in /tmp (what your patch did in the first place) to David's full blown automatic Bugzilla submission. -Y
Re: [GSoC] checking for the loop parallelism
On 04/08/2014 08:09, Roman Gareev wrote: Those waw dependences seem to be correct. Should even the previous analysis only mark the j-loop as parallel? The previous and the current analysis mark the j-loop as nonparallelizable. (Possibly, I don't fully understand the question. Could you please reformulate it?) I would expect the to mark the i loop as non-parallel, but the j-loop as parallel. What is the partial schedule, the set of dependences and the dimension you check for both the i and the j loop? Cheers, Tobias
Re: [PATCH] Keep patch file permissions in mklog
Thanks! My 2 (actually 4) cents below. +if ($#ARGV == 1 ($ARGV[0] eq -i || $ARGV[0] eq --inline)) { + $diff = $ARGV[1]; Can we shift here and then just set $diff to $ARGV[0] unconditionally? + if ($diff eq -) { + die Reading from - and using -i are not compatible; + } Hm, can't we dump ChangeLog to stdout in that case? The limitation looks rather strange. + open (FILE1, '', $tmp) or die Could not open temp file; Could we use more descriptive name? + system (cat $diff $tmp) == 0 + or die Could not append patch to temp file; ... + unlink ($tmp) == 1 or die Could not remove temp file; The checks look like an overkill given that we don't check for result of mktemp... -Y
Re: Replacement of isl_int by isl_val
LGTM. Cheers, Tobias
[Ada] Equality and class-wide instantiations with a defaulted equality
This patch modifies the implementation of AI05-0071 to allow several special cases of equality to appear in instantiations where a formal type has unknown discriminants, a defaulted equality and the actual type is class-wide. -- Source -- -- equals_gen.ads generic type Formal_Typ () is private; with function = (L : Formal_Typ; R : Formal_Typ) return Boolean is ; package Equals_Gen is end Equals_Gen; -- equals_types.ads package Equals_Types is type AT_1 is abstract tagged null record; function = (L : AT_1; R : AT_1) return Boolean; function = (L : AT_1'Class; R : AT_1'Class) return Boolean; type AT_2 is abstract tagged null record; function = (L : AT_2; R : AT_2) return Boolean; type AT_3 is abstract tagged null record; function = (L : AT_3'Class; R : AT_3'Class) return Boolean; type AT_4 is abstract tagged null record; type AT_5 is interface; function = (L : AT_5; R : AT_5) return Boolean is abstract; function = (L : AT_5'Class; R : AT_5'Class) return Boolean; type AT_6 is interface; function = (L : AT_6; R : AT_6) return Boolean is abstract; type AT_7 is interface; function = (L : AT_7'Class; R : AT_7'Class) return Boolean; type AT_8 is interface; end Equals_Types; -- equals_instances.ads with Equals_Gen; with Equals_Types; use Equals_Types; package Equals_Instances is package Inst_1 is new Equals_Gen (AT_1'Class); -- ERROR package Inst_2 is new Equals_Gen (AT_2'Class); -- ok package Inst_3 is new Equals_Gen (AT_3'Class); -- ok package Inst_4 is new Equals_Gen (AT_4'Class); -- ok package Inst_5 is new Equals_Gen (AT_5'Class); -- ERROR package Inst_6 is new Equals_Gen (AT_6'Class); -- ok package Inst_7 is new Equals_Gen (AT_7'Class); -- ok package Inst_8 is new Equals_Gen (AT_8'Class); -- ok end Equals_Instances; -- Compilation and output -- $ gcc -c equals_instances.ads equals_instances.ads:5:04: instantiation error at equals_gen.ads:3 equals_instances.ads:5:04: ambiguous actual for generic subprogram = equals_instances.ads:5:04: possible interpretation: = defined at equals_types.ads:3 equals_instances.ads:5:04: possible interpretation: = defined at equals_types.ads:4 equals_instances.ads:9:04: instantiation error at equals_gen.ads:3 equals_instances.ads:9:04: ambiguous actual for generic subprogram = equals_instances.ads:9:04: possible interpretation: = defined at equals_types.ads:15 equals_instances.ads:9:04: possible interpretation: = defined at equals_types.ads:16 Tested on x86_64-pc-linux-gnu, committed on trunk 2014-08-04 Hristian Kirtchev kirtc...@adacore.com * sem_ch8.adb (Build_Class_Wide_Wrapper): Handle various special cases related to equality. Remove the special processing for dispatching abstract subprograms as it is not needed. (Interpretation_Error): Add a specialized error message for predefined operators. (Is_Intrinsic_Equality): New routine. (Is_Suitable_Candidate): New routine. Index: sem_ch8.adb === --- sem_ch8.adb (revision 213530) +++ sem_ch8.adb (working copy) @@ -1918,6 +1918,14 @@ -- Emit a continuation error message suggesting subprogram Subp_Id as -- a possible interpretation. + function Is_Intrinsic_Equality (Subp_Id : Entity_Id) return Boolean; + -- Determine whether subprogram Subp_Id denotes the intrinsic = + -- operator. + + function Is_Suitable_Candidate (Subp_Id : Entity_Id) return Boolean; + -- Determine whether subprogram Subp_Id is a suitable candidate for + -- the role of a wrapped subprogram. + -- Build_Call -- @@ -2087,26 +2095,71 @@ procedure Interpretation_Error (Subp_Id : Entity_Id) is begin Error_Msg_Sloc := Sloc (Subp_Id); -Error_Msg_NE - (\\possible interpretation: defined #, Spec, Formal_Spec); + +if Is_Internal (Subp_Id) then + Error_Msg_NE + (\\possible interpretation: predefined #, + Spec, Formal_Spec); +else + Error_Msg_NE + (\\possible interpretation: defined #, Spec, Formal_Spec); +end if; end Interpretation_Error; + --- + -- Is_Intrinsic_Equality -- + --- + + function Is_Intrinsic_Equality (Subp_Id : Entity_Id) return Boolean is + begin +return + Ekind (Subp_Id) = E_Operator +and then Chars (Subp_Id) = Name_Op_Eq +and then Is_Intrinsic_Subprogram (Subp_Id); + end Is_Intrinsic_Equality; + + --- + --
[Ada] Wrong source locations in the profile of an instantiated subprogram
This patch modifies the formal subprogram instantiation machinery to preserve the source locations of all formal parameters when creating the corresponding renaming declaration. No reproducer as this requires ASIS. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-08-04 Hristian Kirtchev kirtc...@adacore.com * sem_ch12.adb (Instantiate_Formal_Subprogram): Move variable to their own section. Propagate the source location of a formal parameter to the corresponding formal of the subprogram renaming declaration. Code reformatting. Index: sem_ch12.adb === --- sem_ch12.adb(revision 213530) +++ sem_ch12.adb(working copy) @@ -9454,14 +9454,10 @@ Actual : Node_Id; Analyzed_Formal : Node_Id) return Node_Id is - Loc: Source_Ptr; + Analyzed_S : constant Entity_Id := + Defining_Unit_Name (Specification (Analyzed_Formal)); Formal_Sub : constant Entity_Id := Defining_Unit_Name (Specification (Formal)); - Analyzed_S : constant Entity_Id := - Defining_Unit_Name (Specification (Analyzed_Formal)); - Decl_Node : Node_Id; - Nam: Node_Id; - New_Spec : Node_Id; function From_Parent_Scope (Subp : Entity_Id) return Boolean; -- If the generic is a child unit, the parent has been installed on the @@ -9528,9 +9524,15 @@ (expect subprogram or entry name in instantiation of, Instantiation_Node, Formal_Sub); Abandon_Instantiation (Instantiation_Node); - end Valid_Actual_Subprogram; + -- Local variables + + Decl_Node : Node_Id; + Loc: Source_Ptr; + Nam: Node_Id; + New_Spec : Node_Id; + -- Start of processing for Instantiate_Formal_Subprogram begin @@ -9547,18 +9549,21 @@ Set_Defining_Unit_Name (New_Spec, Make_Defining_Identifier (Loc, Chars (Formal_Sub))); - -- Create new entities for the each of the formals in the - -- specification of the renaming declaration built for the actual. + -- Create new entities for the each of the formals in the specification + -- of the renaming declaration built for the actual. if Present (Parameter_Specifications (New_Spec)) then declare -F : Node_Id; +F: Node_Id; +F_Id : Entity_Id; + begin F := First (Parameter_Specifications (New_Spec)); while Present (F) loop + F_Id := Defining_Identifier (F); + Set_Defining_Identifier (F, - Make_Defining_Identifier (Sloc (F), -Chars = Chars (Defining_Identifier (F; + Make_Defining_Identifier (Sloc (F_Id), Chars (F_Id))); Next (F); end loop; end; @@ -9607,9 +9612,10 @@ -- identifier or operator with the same name as the formal. if Nkind (Formal_Sub) = N_Defining_Operator_Symbol then -Nam := Make_Operator_Symbol (Loc, - Chars = Chars (Formal_Sub), - Strval = No_String); +Nam := + Make_Operator_Symbol (Loc, +Chars = Chars (Formal_Sub), +Strval = No_String); else Nam := Make_Identifier (Loc, Chars (Formal_Sub)); end if; @@ -9656,9 +9662,7 @@ -- instance. If overloaded, it will be resolved when analyzing the -- renaming declaration. - if Box_Present (Formal) -and then No (Actual) - then + if Box_Present (Formal) and then No (Actual) then Analyze (Nam); if Is_Child_Unit (Scope (Analyzed_S))
[Ada] Remove unnecessary range checks
This change removes some unnecessary range checks. The following test compiled with -gnatdt -gnatc: 1. procedure RCInteger (X : Integer) is 2.type YT is new Integer; 3.Y : constant YT := YT(X) * YT(X); 4. begin 5.null; 6. end; generates a tree file that has no instances of the Do_Range_Check flag being set (the multiplication in line 3 needs an overflow check, but not a subsequent range check). This test, also compiled with -gnatdt -gnatc: 1. procedure Assign_Int (X : in out Integer) is 2.Tmp : Integer := X + 1; 3.Pos : Positive := X + 2; 4. begin 5.X := X + 3; 6. end Assign_Int; Generates a tree file with one instance of Do_Range_Check being set. Line 3 needs a range check, but line 2 does not. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-08-04 Robert Dewar de...@adacore.com * sem_eval.adb (Test_In_Range): Always in range for Is_Known_Valid target type, where input type has smaller or equal size and does not have biased rep. Index: sem_eval.adb === --- sem_eval.adb(revision 213530) +++ sem_eval.adb(working copy) @@ -6193,6 +6193,18 @@ then return In_Range; + -- Another special case. For signed integer types, if the target type + -- has Is_Known_Valid set, and the source type does not have a larger + -- size, then the source value must be in range. We exclude biased + -- types, because they bizarrely can generate out of range values. + + elsif Is_Signed_Integer_Type (Etype (N)) +and then Is_Known_Valid (Typ) +and then Esize (Etype (N)) = Esize (Typ) +and then not Has_Biased_Representation (Etype (N)) + then + return In_Range; + -- For all other cases, result is unknown else
[Ada] Reject illegal use of 'Old in complex postcondition.
A postcondition whose expression is a short-circuit is broken down into individual aspects in order to provide better exception reporting. This transformation is performed syntactically, before any analysis. The original short-circuit expression is rewritten as its second operand, and an occurrence of 'Old in that operand is potentially unevaluated, even though the parent node does not come from source. Compiling the following: gcc -c -gnatct test06.adb gcc -c test06.adb must yield: test06.adb:4:34: prefix of attribute old that is potentially unevaluated must denote an entity test06.adb:4:34: prefix of attribute old that is potentially unevaluated must denote an entity --- procedure test06 is Tab : constant array (1 .. 10) of Integer := (others = 0); procedure Bar (I : in out Natural) with Post = I 0 and then Tab(I)'Old = 1; -- Illegal procedure Bar (I : in out Natural) is begin null; end Bar; J : Natural := 0; begin Bar (J); end test06; Tested on x86_64-pc-linux-gnu, committed on trunk 2014-08-04 Ed Schonberg schonb...@adacore.com * sem_util.adb (Is_Potentially_Unevaluated): If the original node of a parent node in the tree is a short-circuit operation, the node is potentially unevaluated. Index: sem_util.adb === --- sem_util.adb(revision 213537) +++ sem_util.adb(working copy) @@ -11146,6 +11146,17 @@ begin Expr := N; Par := Parent (N); + + -- A postcondition whose expression is a short-circuit is broken down + -- into individual aspects for better exception reporting. The original + -- short-circuit expression is rewritten as the second operand, and an + -- occurrence of 'Old in that operand is potentially unevaluated. + -- See Sem_ch13.adb for details of this transformation. + + if Nkind (Original_Node (Par)) = N_And_Then then + return True; + end if; + while not Nkind_In (Par, N_If_Expression, N_Case_Expression, N_And_Then,
[Ada] Make sure that range check flag is set on real-integer conversions
This change makes sure that the Do_Range_Check flag is set in -gnatc or GNATprove mode for type conversions from real to integer. This makes sure that SPARK2014 programs properly verify that such conversions cannot raise an exception due to an out of range value. The following test compiled with -gnatdt generates a tree that has one instance of Do_Range_Check being set. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-08-04 Robert Dewar de...@adacore.com * sem_res.adb (Resolve_Type_Conversion): Set Do_Range_Check on conversion from a real type to an integer type. Index: sem_res.adb === --- sem_res.adb (revision 213537) +++ sem_res.adb (working copy) @@ -10322,11 +10322,11 @@ -- odd subtype coming from the bounds). if (Is_Entity_Name (Orig_N) - and then - (Etype (Entity (Orig_N)) = Orig_T - or else - (Ekind (Entity (Orig_N)) = E_Loop_Parameter - and then Covers (Orig_T, Etype (Entity (Orig_N)) + and then +(Etype (Entity (Orig_N)) = Orig_T + or else +(Ekind (Entity (Orig_N)) = E_Loop_Parameter + and then Covers (Orig_T, Etype (Entity (Orig_N)) -- If not an entity, then type of expression must match @@ -10504,6 +10504,17 @@ Apply_Predicate_Check (N, Target_Typ); end if; end if; + + -- If at this stage we have a real to integer conversion, make sure + -- that the Do_Range_Check flag is set, because such conversions in + -- general need a range check. + + if Nkind (N) = N_Type_Conversion +and then Is_Integer_Type (Target_Typ) +and then Is_Real_Type (Operand_Typ) + then + Set_Do_Range_Check (Operand); + end if; end Resolve_Type_Conversion; --
Re: [PATCH] Keep patch file permissions in mklog
On 04-08-14 08:45, Yury Gribov wrote: Thanks! My 2 (actually 4) cents below. Hi Yuri, thanks for the review. +if ($#ARGV == 1 ($ARGV[0] eq -i || $ARGV[0] eq --inline)) { +$diff = $ARGV[1]; Can we shift here and then just set $diff to $ARGV[0] unconditionally? Done. +if ($diff eq -) { +die Reading from - and using -i are not compatible; +} Hm, can't we dump ChangeLog to stdout in that case? The limitation looks rather strange. My original idea here was that --inline means 'in the patch file', which is not possible if the patch comes from stdin. I've now interpreted it such that --inline prints to stdout what it would print to the patch file otherwise, that is, both log and patch. Printing just the log to stdout can be already be achieved by not using --inline. +open (FILE1, '', $tmp) or die Could not open temp file; Could we use more descriptive name? I've used the slightly more descriptive 'OUTPUTFILE'. +system (cat $diff $tmp) == 0 +or die Could not append patch to temp file; ... +unlink ($tmp) == 1 or die Could not remove temp file; The checks look like an overkill given that we don't check for result of mktemp... I've added a check for the result of mktemp, and removed the unlink result check. I've left in the Could not append patch to temp file check because the patch file might be read-only. OK for trunk? Thanks, - Tom 2014-08-04 Tom de Vries t...@codesourcery.com * mklog: Add --inline option. diff --git a/contrib/mklog b/contrib/mklog index 3d17dc5..27a0929 100755 --- a/contrib/mklog +++ b/contrib/mklog @@ -56,10 +56,14 @@ if (-d $gcc_root/.git) { # Program starts here. You should not need to edit anything below this # line. #- -if ($#ARGV != 0) { +$inline = 0; +if ($#ARGV == 1 ($ARGV[0] eq -i || $ARGV[0] eq --inline)) { + shift; + $inline = 1; +} elsif ($#ARGV != 0) { $prog = `basename $0`; chop ($prog); print EOF; -usage: $prog file.diff +usage: $prog [ -i | --inline ] file.diff Generate ChangeLog template for file.diff. It assumes that patch has been created with -up or -cp. @@ -273,8 +277,39 @@ foreach (@diff_lines) { # functions. $cl_entries{$clname} .= $change_msg ? $change_msg\n : :\n; +if ($inline $diff ne -) { + $tmp = `mktemp`; + if ($? != 0) { + die Could not generate temp file; + } + chomp ($tmp); + open (OUTPUTFILE, '', $tmp) or die Could not open temp file $tmp; +} else { + *OUTPUTFILE = STDOUT; +} + +# Print the log foreach my $clname (keys %cl_entries) { - print $clname:\n\n$hdrline\n\n$cl_entries{$clname}\n; + print OUTPUTFILE $clname:\n\n$hdrline\n\n$cl_entries{$clname}\n; +} + +# Append the patch to the log +if ($inline) { + foreach (@diff_lines) { + print OUTPUTFILE $_\n; + } +} + +# Replace the patch with the temp file +if ($inline $diff ne -) { + close (OUTPUTFILE); + + # We're using cat rather than move, to keep permissions on $diff the + # same. + system (cat $tmp $diff) == 0 + or die Could not move temp file to patch file; + + unlink ($tmp); } exit 0; -- 1.9.1
Re: [PATCH][testsuite] Don't run cproj-fails-with-broken-glibc.c for broken glibc
On Aug 2, 2014, at 9:26 AM, Tom de Vries tom_devr...@mentor.com wrote: I've made it an xfail, and added documentation in attached follow-up patch. OK? Ok. Or do we go with the removal suggestion of Mike? I’ll let others weigh in. I’m fine either way. Original author likely prefers the xfail, so I’m fine with the above.
Re: [GSoC][match-and-simplify] use dt_simplify::capture_max
On Sat, Aug 2, 2014 at 8:36 PM, Prathamesh Kulkarni bilbotheelffri...@gmail.com wrote: * genmatch.c (dt_simplify::gen_gimple): Use dt_simplify::capture_max. (dt_simplify::gen_generic): Likewise. Thanks, applied. Richard. Thanks, Prathamesh
Re: [PATCH] Fix PR 61225
On 17 July 2014 11:10, Jeff Law l...@redhat.com wrote: On 05/22/14 03:52, Zhenqiang Chen wrote: On 21 May 2014 20:43, Steven Bosscher stevenb@gmail.com wrote: On Wed, May 21, 2014 at 11:58 AM, Zhenqiang Chen wrote: Hi, The patch fixes the gcc.target/i386/pr49095.c FAIL in PR61225. The test case tends to check a peephole2 optimization, which optimizes the following sequence 2: bx:SI=ax:SI 25: ax:SI=[bx:SI] 7: {ax:SI=ax:SI-0x1;clobber flags:CC;} 8: [bx:SI]=ax:SI 9: flags:CCZ=cmp(ax:SI,0) to 2: bx:SI=ax:SI 41: {flags:CCZ=cmp([bx:SI]-0x1,0);[bx:SI]=[bx:SI]-0x1;} The enhanced shrink-wrapping, which calls copyprop_hardreg_forward changes the INSN 25 to 25: ax:SI=[ax:SI] Then peephole2 can not optimize it since two memory_operands look like different. To fix it, the patch adds another peephole2 rule to read one more insn. From the register copy, it knows the address is the same. That is one complex peephole2 to deal with a transformation like this. It seems to be like it's a too specific solution for a bigger problem. Could you please try one of the following solutions instead: 1. Track register values for peephole2 and try different alternatives based on known register equivalences? E.g. in your example, perhaps there is already a REG_EQUAL/REG_EQUIV note available on insn 25 after copyprop_hardreg_forward, to annotate that [ax:SI] is equivalent to [bx:SI] at that point (or if that information is not available, it is not very difficult to make it available). Then you could try applying peephole2 on the original pattern but also on patterns modified with the known equivalences (i.e. try peephole2 on multiple equivalent patterns for the same insn). This may expose other peephole2 opportunities, not just the specific one your patch addresses. Patch is updated according to the comment. There is no REG_EQUAL. So I add it when replace_oldest_value_reg. ChangeLog: 2014-05-22 Zhenqiang Chen zhenqiang.c...@linaro.org Part of PR rtl-optimization/61225 * config/i386/i386-protos.h (ix86_peephole2_rtx_equal_p): New proto. * config/i386/i386.c (ix86_peephole2_rtx_equal_p): New function. * regcprop.c (replace_oldest_value_reg): Add REG_EQUAL note when propagating to SET. I can't help but wonder why the new 4 insn combination code isn't presenting this as a nice big fat insn to the x86 backend which would eliminate the need for the peep2. But, assuming there's a fundamental reason why that's not kicking in... Current combine pass can only handle I0 - I1 - I2 - I3. I0, I1 - I2, I2 - I3. I0 - I2; I1, I2 - I3. I0 - I1; I1, I2 - I3. For the case, it is I1 - I2 - I3; I2 - INSN I3 and INSN looks like not related. But INSN is a COMPARE to set CC and I3 can also set CC. I3 and INSN can be combined together as one instruction to set CC. The following patch enhances combine pass to handle the case. A new parameter is added for try_combine to accept INSN as TO_COMBINED_INSN. It reuses the 3-insn combine method to combine I1 - I2 - I3. If there is TO_COMBINED_INSN, combine I2 - TO_COMBINED_INSN. Then create an new insn parallel (TO_COMBINED_INSN, I3). refer_same_reg_p is some check to make sure the change is safe. Bootstrap and no make check regression on X86-64 and i686. X86-64 bootstrap logs show 358 cases were combined by the patch. Ok for trunk? Thanks! -Zhenqiang ChangeLog 2014-08-04 Zhenqiang Chen zhenqiang.c...@linaro.org Part of PR rtl-optimization/61225 * combine.c (refer_same_reg_p): New function. (combine_instructions): Handle I1 - I2 - I3; I2 - insn. (try_combine): Add one more parameter TO_COMBINED_INSN, which is used to create a new insn parallel (TO_COMBINED_INSN, I3). testsuite/ChangeLog: 2014-08-04 Zhenqiang Chen zhenqiang.c...@linaro.org * gcc.target/i386/pr61225.c: New test. diff --git a/gcc/combine.c b/gcc/combine.c index 53ac1d6..42098ab 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -412,7 +412,7 @@ static int cant_combine_insn_p (rtx); static int can_combine_p (rtx, rtx, rtx, rtx, rtx, rtx, rtx *, rtx *); static int combinable_i3pat (rtx, rtx *, rtx, rtx, rtx, int, int, rtx *); static int contains_muldiv (rtx); -static rtx try_combine (rtx, rtx, rtx, rtx, int *, rtx); +static rtx try_combine (rtx, rtx, rtx, rtx, int *, rtx, rtx); static void undo_all (void); static void undo_commit (void); static rtx *find_split_point (rtx *, rtx, bool); @@ -1099,6 +1099,46 @@ insn_a_feeds_b (rtx a, rtx b) #endif return false; } + +/* A is a compare (reg1, 0) and B is SINGLE_SET which SET_SRC is reg2. + It returns TRUE, if reg1 == reg2, and no other refer of reg1 + except A and B. */ + +static bool +refer_same_reg_p (rtx a, rtx b) +{ + rtx seta = single_set (a); + rtx setb = single_set (b); + + if (BLOCK_FOR_INSN (a) != BLOCK_FOR_INSN (b) + || !seta || !setb) +return false; + + if
Re: [PATCH, ivopt] Try aligned offset when get_address_cost
On Mon, Aug 4, 2014 at 2:28 PM, Zhenqiang Chen zhenqiang.c...@arm.com wrote: Hi, For some TARGET, like ARM THUMB1, the offset in load/store should be nature aligned. But in function get_address_cost, when computing max_offset, it only tries byte-aligned offsets: ((unsigned HOST_WIDE_INT) 1 i) - 1 which can not meet thumb_legitimate_offset_p check called from thumb1_legitimate_address_p for HImode and SImode. The patch adds additional try for aligned offset: ((unsigned HOST_WIDE_INT) 1 i) - GET_MODE_SIZE (address_mode). Bootstrap and no make check regression on X86-64. No make check regression on qemu for Cortex-m0 and Cortex-m3. For Cortex-m0, no performance changes with coremark and dhrystone. Coremark code size is ~0.44 smaller. And eembcv2 code size is ~0.22 smaller. CSiBE code size is ~0.05% smaller. OK for trunk? Thanks! -Zhenqiang ChangeLog 2014-08-04 Zhenqiang Chen zhenqiang.c...@arm.com * tree-ssa-loop-ivopts.c (get_address_cost): Try aligned offset. testsuite/ChangeLog: 2014-08-04 Zhenqiang Chen zhenqiang.c...@arm.com * gcc.target/arm/get_address_cost_aligned_max_offset.c: New test. diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c index 3b4a6cd..562122a 100644 --- a/gcc/tree-ssa-loop-ivopts.c +++ b/gcc/tree-ssa-loop-ivopts.c @@ -3308,6 +3308,18 @@ get_address_cost (bool symbol_present, bool var_present, XEXP (addr, 1) = gen_int_mode (off, address_mode); if (memory_address_addr_space_p (mem_mode, addr, as)) break; + /* For some TARGET, like ARM THUMB1, the offset should be nature +aligned. Try an aligned offset if address_mode is not QImode. */ + off = (address_mode == QImode) + ? 0 + : ((unsigned HOST_WIDE_INT) 1 i) + - GET_MODE_SIZE (address_mode); + if (off 0) + { + XEXP (addr, 1) = gen_int_mode (off, address_mode); + if (memory_address_addr_space_p (mem_mode, addr, as)) + break; + } Hi, Why not just check address_mode != QImode? Set off to 0 then check it seems unnecessary. Thanks, bin } if (i == -1) off = 0; diff --git a/gcc/testsuite/gcc.target/arm/get_address_cost_aligned_max_offset.c b/gcc/testsuite/gcc.target/arm/get_address_cost_aligned_max_offset.c new file mode 100644 index 000..cc3e2f7 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/get_address_cost_aligned_max_offset.c @@ -0,0 +1,28 @@ +/* { dg-do compile } */ +/* { dg-options -mthumb -O2 } */ +/* { dg-require-effective-target arm_thumb1_ok } */ + +unsigned int +test (const short p16[6 * 64]) +{ + unsigned int i = 6; + unsigned int ret = 0; + + do +{ + unsigned long long *p64 = (unsigned long long*) p16; + unsigned int *p32 = (unsigned int*) p16; + ret += ret; + if (p16[1] || p32[1]) + ret++; + else if (p64[1] | p64[2] | p64[3]) + ret++; + p16 += 64; + i--; +} while (i != 0); + + return ret; +} + +/* { dg-final { scan-assembler-not #22 } } */ +/* { dg-final { scan-assembler-not #14 } } */
RE: [PATCH, ivopt] Try aligned offset when get_address_cost
-Original Message- From: Bin.Cheng [mailto:amker.ch...@gmail.com] Sent: Monday, August 04, 2014 4:41 PM To: Zhenqiang Chen Cc: gcc-patches List Subject: Re: [PATCH, ivopt] Try aligned offset when get_address_cost On Mon, Aug 4, 2014 at 2:28 PM, Zhenqiang Chen zhenqiang.c...@arm.com wrote: Hi, For some TARGET, like ARM THUMB1, the offset in load/store should be nature aligned. But in function get_address_cost, when computing max_offset, it only tries byte-aligned offsets: ((unsigned HOST_WIDE_INT) 1 i) - 1 which can not meet thumb_legitimate_offset_p check called from thumb1_legitimate_address_p for HImode and SImode. The patch adds additional try for aligned offset: ((unsigned HOST_WIDE_INT) 1 i) - GET_MODE_SIZE (address_mode). Bootstrap and no make check regression on X86-64. No make check regression on qemu for Cortex-m0 and Cortex-m3. For Cortex-m0, no performance changes with coremark and dhrystone. Coremark code size is ~0.44 smaller. And eembcv2 code size is ~0.22 smaller. CSiBE code size is ~0.05% smaller. OK for trunk? Thanks! -Zhenqiang ChangeLog 2014-08-04 Zhenqiang Chen zhenqiang.c...@arm.com * tree-ssa-loop-ivopts.c (get_address_cost): Try aligned offset. testsuite/ChangeLog: 2014-08-04 Zhenqiang Chen zhenqiang.c...@arm.com * gcc.target/arm/get_address_cost_aligned_max_offset.c: New test. diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c index 3b4a6cd..562122a 100644 --- a/gcc/tree-ssa-loop-ivopts.c +++ b/gcc/tree-ssa-loop-ivopts.c @@ -3308,6 +3308,18 @@ get_address_cost (bool symbol_present, bool var_present, XEXP (addr, 1) = gen_int_mode (off, address_mode); if (memory_address_addr_space_p (mem_mode, addr, as)) break; + /* For some TARGET, like ARM THUMB1, the offset should be nature +aligned. Try an aligned offset if address_mode is not QImode. */ + off = (address_mode == QImode) + ? 0 + : ((unsigned HOST_WIDE_INT) 1 i) + - GET_MODE_SIZE (address_mode); + if (off 0) + { + XEXP (addr, 1) = gen_int_mode (off, address_mode); + if (memory_address_addr_space_p (mem_mode, addr, as)) + break; + } Hi, Why not just check address_mode != QImode? Set off to 0 then check it seems unnecessary. Thanks for the comments. ((unsigned HOST_WIDE_INT) 1 i) - GET_MODE_SIZE (address_mode) might be a negative value except QImode. A negative value can not be max_offset. So we do not need to check it. For QImode, ((unsigned HOST_WIDE_INT) 1 i) - GET_MODE_SIZE (address_mode) == ((unsigned HOST_WIDE_INT) 1 i) - 1. It is already checked. So no need to check it again. I think the compiler can optimize the patch like diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c index 3b4a6cd..213598a 100644 --- a/gcc/tree-ssa-loop-ivopts.c +++ b/gcc/tree-ssa-loop-ivopts.c @@ -3308,6 +3308,19 @@ get_address_cost (bool symbol_present, bool var_present, XEXP (addr, 1) = gen_int_mode (off, address_mode); if (memory_address_addr_space_p (mem_mode, addr, as)) break; + /* For some TARGET, like ARM THUMB1, the offset should be nature +aligned. Try an aligned offset if address_mode is not QImode. */ + if (address_mode != QImode) + { + off = ((unsigned HOST_WIDE_INT) 1 i) + - GET_MODE_SIZE (address_mode); + if (off 0) + { + XEXP (addr, 1) = gen_int_mode (off, address_mode); + if (memory_address_addr_space_p (mem_mode, addr, as)) + break; + } + } } if (i == -1) off = 0; Thanks, bin } if (i == -1) off = 0; diff --git a/gcc/testsuite/gcc.target/arm/get_address_cost_aligned_max_offset.c b/gcc/testsuite/gcc.target/arm/get_address_cost_aligned_max_offset.c new file mode 100644 index 000..cc3e2f7 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/get_address_cost_aligned_max_offset +++ .c @@ -0,0 +1,28 @@ +/* { dg-do compile } */ +/* { dg-options -mthumb -O2 } */ +/* { dg-require-effective-target arm_thumb1_ok } */ + +unsigned int +test (const short p16[6 * 64]) +{ + unsigned int i = 6; + unsigned int ret = 0; + + do +{ + unsigned long long *p64 = (unsigned long long*) p16; + unsigned int *p32 = (unsigned int*) p16; + ret += ret; + if (p16[1] || p32[1]) + ret++; + else if (p64[1] | p64[2] | p64[3]) + ret++; + p16 += 64; + i--; +} while (i != 0); + + return ret; +} + +/* { dg-final { scan-assembler-not #22 } } */ +/* { dg-final { scan-assembler-not #14 } } */
Re: [PATCH 4.9] libstdc++ pretty-printers: Backport Python 3 support from mainline
On 03/08/14 21:05 -0400, Samuel Bronson wrote: Since Jonathan Wakely independantly committed some of the changes I was preparing, I had to backport two commits, r210625 and r212453 (git commits 3a30bda and b0a6074). 2014-08-02 Samuel Bronson naes...@gmail.com Backport r212453 from trunk 2014-07-11 Samuel Bronson naes...@gmail.com Matthias Klose d...@ubuntu.com PR libstdc++/58962 * python/libstdcxx/v6/printers.py: Port to Python 2+3 (imap): New compat function. (izip): Likewise. (Iterator): New mixin to allow writing iterators in Python 3 style regardless of which version we're running on. [Python3] (long) New compat alias for int. * testsuite/lib/gdb-test.exp: Port to Python 2+3 (print syntax) Backport r210625 from trunk 2014-05-19 Jonathan Wakely jwak...@redhat.com * python/libstdcxx/v6/printers.py: Use Python3 raise syntax. This should be OK for the branch, I'll commit it today.
Re: [PATCH libstdc++ v3] - Add xmethods for std::vector and std::unique_ptr
On 25 July 2014 20:46, Siva Chandra wrote: The attached patch is identical to v2 except that I rebased it over the current head. To recollect, GDB now supports xmethods in its Python API: https://sourceware.org/gdb/current/onlinedocs/gdb/Xmethods-In-Python.html This feature will be available in GDB starting version 7.8 (which has not yet been released, but has been branched). The attached patch adds xmethods to the classes std::vector and std::unique_ptr. One can of course add xmethods to many other classes, but I am viewing this as the first patch in that series (though not a series yet) to get the basic infrastructure for adding more xmethods in place. Link to v1 posting: https://gcc.gnu.org/ml/gcc-patches/2014-06/msg02339.html Link to v2 posting: https://gcc.gnu.org/ml/gcc-patches/2014-07/msg2.html ChangeLog 2014-07-25 Siva Chandra Reddy sivachan...@google.com * python/libstdcxx/v6/xmethods.py: New file. * testsuite/lib/gdb-test.exp (gdb_version_check_xmethods): New function. (gdb-test): New optional argument LOAD_XMETHODS. Load xmethods python script if LOAD_XMETHODS is true. * testsuite/libstdc++-xmethods/unique_ptr.cc: New file. * testsuite/libstdc++-xmethods/vector.cc: New file. * testsuite/libstdc++-xmethods/xmethods.exp: New file. N.B. all patches for libstdc++ need to be sent to the libstdc++ mailing list as well as the gcc-patches list, to ensure the right reviewers see them. It looks like it should be OK, but do you know if the patch works with both Python2 and Python3? diff --git a/libstdc++-v3/python/libstdcxx/v6/xmethods.py b/libstdc++-v3/python/libstdcxx/v6/xmethods.py new file mode 100644 index 000..f20f411 --- /dev/null +++ b/libstdc++-v3/python/libstdcxx/v6/xmethods.py @@ -0,0 +1,103 @@ +# Xmethods for libstc++. + +# Copyright (C) 2014 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. + +import gdb +import gdb.xmethod +import re + +matcher_name_prefix = 'libstdc++::' + +# Xmethods for std::vector + +class VectorSizeWorker(gdb.xmethod.XMethodWorker): +def __init__(self): +self.name = 'size' +self.enabled = True + +def get_arg_types(self): +return None + +def __call__(self, obj): +return obj['_M_impl']['_M_finish'] - obj['_M_impl']['_M_start'] + +class VectorSubscriptWorker(gdb.xmethod.XMethodWorker): +def __init__(self): +self.name = 'operator[]' +self.enabled = True + +def get_arg_types(self): +return gdb.lookup_type('std::size_t') + +def __call__(self, obj, subscript): +return obj['_M_impl']['_M_start'][subscript] + +class VectorMethodsMatcher(gdb.xmethod.XMethodMatcher): +def __init__(self): +gdb.xmethod.XMethodMatcher.__init__(self, +matcher_name_prefix + 'vector') +self._subscript_worker = VectorSubscriptWorker() +self._size_worker = VectorSizeWorker() +self.methods = [self._subscript_worker, self._size_worker] + +def match(self, class_type, method_name): +if not re.match('^std::vector.*$', class_type.tag): +return None +if method_name == 'operator[]' and self._subscript_worker.enabled: +return self._subscript_worker +elif method_name == 'size' and self._size_worker.enabled: +return self._size_worker + +# Xmethods for std::unique_ptr + +class UniquePtrGetWorker(gdb.xmethod.XMethodWorker): +def __init__(self): +self.name = 'get' +self.enabled = True + +def get_arg_types(self): +return None + +def __call__(self, obj): +return obj['_M_t']['_M_head_impl'] + +class UniquePtrDerefWorker(UniquePtrGetWorker): +def __init__(self): +UniquePtrGetWorker.__init__(self) +self.name = 'operator*' + +def __call__(self, obj): +return UniquePtrGetWorker.__call__(self, obj).dereference() + +class UniquePtrMethodsMatcher(gdb.xmethod.XMethodMatcher): +def __init__(self): +gdb.xmethod.XMethodMatcher.__init__(self, +matcher_name_prefix + 'unique_ptr') +self._get_worker = UniquePtrGetWorker() +self._deref_worker = UniquePtrDerefWorker() +self.methods = [self._get_worker, self._deref_worker] + +def
[Ada] New defaults for some project attributes
Some of the project attributes have new defaults that are no longer the empty string of the empty string list. These defaults are used as values of attribute references when the attribute has not been declared. Object_Dir has as default .. Exec_Dir has as default Object_Dir, as previously specified or defaulted. Source_Dirs has as default (.), that is a string list with only one string .. Consider the following projects in the same directory dir: project Empty is for Source_Files use (); end Empty; with empty.gpr; project Prj is for Object_Dir use Empty'Object_Dir /obj; for Source_Dirs use Empty'Source_Dirs (src); for Exec_Dir use project'Exec_Dir /../bin; for Main use (main.adb); end Prj; The object directory of project Prj is dir/obj The source directories of project Prj are dir and dir/src The exec directory of project Prj is dir/bin Tested on x86_64-pc-linux-gnu, committed on trunk 2014-08-04 Vincent Celier cel...@adacore.com * prj-attr.adb: Add new default indications for attributes Object_Dir, Exec_Dir, Source_Dirs and Target. (Attribute_Default_Of): New function (Initialize): Set the default for those attributes that have one specified. * prj-attr.ads (Attribute_Data): New component Default. * prj-proc.adb (Expression): Take into account the new defaults for attributes Object_Dir, Exec_Dir and Source_Dirs. * prj-strt.adb (Attribute_Reference): Set the default for the attribute. * prj-tree.ads, prj-tree.adb (Default_Of): New function. (Set_Default_Of): New procedure. * prj.adb (The_Dot_String): New global Name_Id variable, initialized in procedure Initialize. (Dot_String): New function (Initialize): Initialize The_Dot_String. (Reset): Create the string list Shared.Dot_String_List. * prj.ads (Attribute_Default_Value): New enumeration type. (Project_Qualifier): Change enumeration value Dry to Abstract_Project. (Dot_String): New function. (Shared_Project_Tree_Data): New string list component Dot_String_List. * projects.texi: Document new defaults for attribute Object_Dir, Exec_Dir and Source_Dirs. Index: prj-attr-pm.adb === --- prj-attr-pm.adb (revision 213536) +++ prj-attr-pm.adb (working copy) @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2004-2010, Free Software Foundation, Inc. -- +-- Copyright (C) 2004-2014, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -47,6 +47,7 @@ Attr_Kind = Unknown, Read_Only = False, Others_Allowed = False, +Default= Empty_Value, Next = Package_Attributes.Table (To_Package.Value).First_Attribute)); Index: prj-attr.adb === --- prj-attr.adb(revision 213536) +++ prj-attr.adb(working copy) @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2001-2013, Free Software Foundation, Inc. -- +-- Copyright (C) 2001-2014, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -34,7 +34,7 @@ -- Data for predefined attributes and packages - -- Names are in lower case and end with '#' + -- Names are in lower case and end with '#' or 'D'. -- Package names are preceded by 'P' @@ -59,6 +59,11 @@ -- 'O' to indicate that others is allowed as an index for an associative -- array + -- If the character after the name in lower case letter is a 'D' + -- (for default), then 'D' must be followed by an enumeration value of type + -- Attribute_Default_Value, followed by a '#'. + -- Example: + --SVobject_dirDdot_value# -- End is indicated by two consecutive '#' Initialization_Data : constant String := @@ -76,9 +81,9 @@ -- Directories - SVobject_dir# - SVexec_dir# - LVsource_dirs# + SVobject_dirDdot_value#
[Ada] Apply special expansion in GNATprove mode also for pre-analysis
Some expression are only pre-analyzed in GNATprove mode, like default expressions and assertions. These also need to be light-expanded for formal verification. This is the second commit attempt, as the first one failed to build GNAT due to a bug. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-08-04 Yannick Moy m...@adacore.com * expander.adb (Expand): Always perform special expansion in GNATprove mode, even when doing pre-analysis. Index: expander.adb === --- expander.adb(revision 213536) +++ expander.adb(working copy) @@ -83,6 +83,25 @@ and then (Full_Analysis or else not Expander_Active) and then not (Inside_A_Generic and then Expander_Active)); + -- The GNATprove_Mode flag indicates that a light expansion for formal + -- verification should be used. This expansion is never done inside + -- generics, because otherwise, this breaks the name resolution + -- mechanism for generic instances. + + if GNATprove_Mode then + if not Inside_A_Generic then +Expand_SPARK (N); + end if; + + Set_Analyzed (N, Full_Analysis); + + -- Regular expansion is normally followed by special handling for + -- transient scopes for unconstrained results, etc. but this is not + -- needed, and in general cannot be done correctly, in this mode, so + -- we are all done. + + return; + -- There are three reasons for the Expander_Active flag to be false -- The first is when are not generating code. In this mode the @@ -91,11 +110,6 @@ -- which case Full_Analysis = False. See the spec of Sem for more info -- on this. - -- Additionally, the GNATprove_Mode flag indicates that a light - -- expansion for formal verification should be used. This expansion is - -- never done inside generics, because otherwise, this breaks the name - -- resolution mechanism for generic instances - -- The second reason for the Expander_Active flag to be False is that -- we are performing a pre-analysis. During pre-analysis all expansion -- activity is turned off to make sure nodes are semantically decorated @@ -112,9 +126,7 @@ -- given that the expansion actions that would normally process it will -- not take place. This prevents cascaded errors due to stack mismatch. - if not Expander_Active -and (Inside_A_Generic or not Full_Analysis or not GNATprove_Mode) - then + elsif not Expander_Active then Set_Analyzed (N, Full_Analysis); if Serious_Errors_Detected 0 and then Scope_Is_Transient then @@ -126,352 +138,333 @@ return; else - Debug_A_Entry (expanding , N); - begin --- In GNATprove mode we only need a very limited subset of --- the usual expansions. This limited subset is implemented --- in Expand_SPARK. +Debug_A_Entry (expanding , N); -if GNATprove_Mode then - Expand_SPARK (N); - Set_Analyzed (N); +-- Processing depends on node kind. For full details on the +-- expansion activity required in each case, see bodies of +-- corresponding expand routines. - -- Regular expansion is normally followed by special handling - -- for transient scopes for unconstrained results, etc. but - -- this is not needed, and in general cannot be done correctly, - -- in this mode, so we are all done. +case Nkind (N) is - return; + when N_Abort_Statement = + Expand_N_Abort_Statement (N); --- Here for normal non-SPARK mode + when N_Accept_Statement = + Expand_N_Accept_Statement (N); -else - -- Processing depends on node kind. For full details on the - -- expansion activity required in each case, see bodies of - -- corresponding expand routines. + when N_Aggregate = + Expand_N_Aggregate (N); - case Nkind (N) is + when N_Allocator = + Expand_N_Allocator (N); - when N_Abort_Statement = - Expand_N_Abort_Statement (N); + when N_And_Then = + Expand_N_And_Then (N); - when N_Accept_Statement = - Expand_N_Accept_Statement (N); + when N_Assignment_Statement = + Expand_N_Assignment_Statement (N); - when N_Aggregate = - Expand_N_Aggregate (N); + when N_Asynchronous_Select = + Expand_N_Asynchronous_Select (N); - when
[Ada] Type invariant procedure called on an uninitialized object
The compiler can generate a call to a type's invariant-checking procedure on an uninitialized object, such as a temporary object created for holding an aggregate. This is prevented by inhibiting the call when No_Initialization is set on the object. The following test must compile and execute quietly with -gnata: package Sat is type T_Sat is abstract tagged private; type T_Sat_Class_Access is access all T_Sat'Class; procedure Compute (Self : in out T_Sat; Time : in Natural; Alt : out Natural) is abstract with Pre'Class = Time = 7 * 24 * 60 * 60; private type T_Sat is abstract tagged record I : Integer:= 5; end record; -- with type_invariant = T_Sat.I in 1.. 10; end Sat; with Sat; use Sat; package Gps is type T_Gps is new T_Sat with private; type T_Gps_Access is access all T_Gps; package Constructors is function Initialize return T_Gps; end Constructors; overriding procedure Compute (Self : in out T_Gps; Time : in Natural; Alt :out Natural) with Pre'Class = Time = 7 * 24 * 60 * 60; private type T_Gps is new T_Sat with record J : Integer := 5; end record with Type_Invariant = T_Gps.J in 1 .. 10; end Gps; package body Gps is package body Constructors is function Initialize return T_Gps is begin return T_Gps'(T_Sat with J = 1); end Initialize; end Constructors; procedure Compute (Self : in out T_Gps; Time : in Natural; Alt : out Natural) is pragma Unreferenced (Self, Time); begin Alt := 20_000_000; end Compute; end Gps; with Sat; use Sat; with Gps; use Gps; procedure Main is Un_Autre_Gps : T_Gps; Un_Gps : T_Sat_Class_Access := new T_Gps'(Constructors.Initialize); Alt : Natural; begin Compute (Self = Un_Gps.all, Time = 604800, Alt = Alt); end Main; Tested on x86_64-pc-linux-gnu, committed on trunk 2014-08-04 Gary Dismukes dismu...@adacore.com * exp_ch3.adb (Expand_N_Object_Declaration): Inhibit generation of an invariant check in the case where No_Initialization is set, since the object is uninitialized. Index: exp_ch3.adb === --- exp_ch3.adb (revision 213536) +++ exp_ch3.adb (working copy) @@ -5412,11 +5412,14 @@ -- is raised, then the object will go out of scope. In the case where -- an array object is initialized with an aggregate, the expression -- is removed. Check flag Has_Init_Expression to avoid generating a - -- junk invariant check. + -- junk invariant check and flag No_Initialization to avoid checking + -- an uninitialized object such as a compiler temporary used for an + -- aggregate. if Has_Invariants (Base_Typ) and then Present (Invariant_Procedure (Base_Typ)) and then not Has_Init_Expression (N) + and then not No_Initialization (N) then Insert_After (N, Make_Invariant_Call (New_Occurrence_Of (Def_Id, Loc)));
[Ada] Aspect/pragma Default_Initial_Condition
This patch implements aspect/pragma Default_Initial_Condition. The construct has the following semantics and runtime behavior: The Default_Initial_Condition aspect is introduced by an aspect_specification where the aspect_mark is Default_Initial_Condition. The aspect may be specified only as part the aspect_specification of a private_type_declaration. The aspect_definition, if any, of such an aspect specification shall be either a null literal or a Boolean_expression. The aspect_definition may be omitted; this is semantically equivalent to specifying a static Boolean_expression having the value True. An aspect specification of null indicates that the partial view of the type does not define full default initialization. Conversely, an aspect specification of a Boolean_expression indicates that the partial view of the type does define full default initialization. In this case, the completion of the private type shall define full default initialization. Unlike the null literal case, this case has associated dynamic semantics. The Boolean_expression (which might typically mention the current instance of the type, although this is not required) is an assertion which is checked (at run time) after any object of the given type (or of any descendant of the given type for which the specified aspect is inherited and not overridden), is ??? 8?ninitialized by default??? 8?o (see Ada RM 3.3.1). The Boolean_expression, if any, causes freezing in the same way as the default_expression of a component_declaration. Default_Initial_Condition assertion is an assertion aspect, which means that it may be used in an Assertion_Policy pragma. -- Source -- -- checker.ads generic type Typ is private; Test : String; procedure Checker; -- checker.adb with Ada.Assertions; use Ada.Assertions; with Ada.Exceptions; use Ada.Exceptions; with Ada.Text_IO;use Ada.Text_IO; procedure Checker is begin declare Obj : Typ; pragma Unreferenced (Obj); begin Put_Line (ERROR Test : Assertion_Error not raised); end; exception when Ex : Assertion_Error = Put_Line (Test OK); Put_Line (Exception_Information (Ex)); when others = Put_Line (ERROR Test : unexpected exception); end Checker; -- derivations.ads package Derivations is type T1 is tagged private with Default_Initial_Condition = Crash_1 (T1); type T2 is new T1 with private; -- inherits Crash_1 type T3 is new T1 with private -- overrides with Crash_3 with Default_Initial_Condition = Crash_3 (T3); type T4 is new T2 with private -- overrides with Crash_4 with Default_Initial_Condition = Crash_4 (T4); function Crash_1 (Obj : T1) return Boolean; function Crash_3 (Obj : T3) return Boolean; function Crash_4 (Obj : T4) return Boolean; procedure Force_Body; private type T1 is tagged null record; function Crash_1 (Obj : T1) return Boolean is (False); type T2 is new T1 with null record; type T3 is new T1 with null record; function Crash_3 (Obj : T3) return Boolean is (False); type T4 is new T2 with null record; function Crash_4 (Obj : T4) return Boolean is (False); type T5 is new T1 with null record; -- inherits Crash_1 type T6 is new T2 with null record; -- inherits Crash_2 type T7 is new T3 with null record; -- inherits Crash_3 type T8 is new T4 with null record; -- inherits Crash_4 subtype T9 is T5; -- inherits Crash_1 subtype T10 is T6; -- inherits Crash_2 subtype T11 is T7; -- inherits Crash_3 subtype T12 is T8; -- inherits Crash_4 end Derivations; -- derivations.adb with Checker; package body Derivations is procedure Check_T1 is new Checker (T1, Test 1); procedure Check_T2 is new Checker (T2, Test 2); procedure Check_T3 is new Checker (T3, Test 3); procedure Check_T4 is new Checker (T4, Test 4); procedure Check_T5 is new Checker (T5, Test 5); procedure Check_T6 is new Checker (T6, Test 6); procedure Check_T7 is new Checker (T7, Test 7); procedure Check_T8 is new Checker (T8, Test 8); procedure Check_T9 is new Checker (T9, Test 9); procedure Check_T10 is new Checker (T10, Test 10); procedure Check_T11 is new Checker (T11, Test 11); procedure Check_T12 is new Checker (T12, Test 12); procedure Force_Body is begin null; end Force_Body; begin Check_T1; Check_T2; Check_T3; Check_T4; Check_T5; Check_T6; Check_T7; Check_T8; Check_T9; Check_T10; Check_T11; Check_T12; end Derivations; -- runtime_checks.adb with Derivations; procedure Runtime_Checks is begin null; end Runtime_Checks; -- Compilation and output -- $ gnatmake -q -gnata runtime_checks.adb $ ./runtime_checks Test 1 OK Exception name: SYSTEM.ASSERTIONS.ASSERT_FAILURE Message:
[Ada] Make sure Do_Range_Check flag is set when needed on OUT parameter
In -gnatc or GNATprove mode, there were cases in which the Do_Range_Check flag was not set on an OUT parameter, causing e.g. GNAT prove to miss the requirement for proving that an out parameter result was in range. This is now corrected, the following test, compiled in -gnatd.F (GNATprove mode) with -gnatdt generates a log file with a single instance of the Do_Range_Check flag set on X in line 11 of the body (the out parameter). 1. package Out_Subcheck is 2. 3.type Index_Type is range 0 .. 10; 4.subtype Valid_Index_Type is Index_Type range 1 .. 10; 5. 6.procedure Read (Z : out Index_Type); 7. 8.function Read_Validate return Valid_Index_Type; 9. end Out_Subcheck; 1. package body Out_Subcheck is 2. 3.procedure Read (Z : out Index_Type) is 4.begin 5. Z := 0; 6.end Read; 7. 8.function Read_Validate return Valid_Index_Type is 9. X : Valid_Index_Type; 10.begin 11. Read (X); --@RANGE_CHECK:FAIL 12. return X; 13.end Read_Validate; 14. 15. end Out_Subcheck; Tested on x86_64-pc-linux-gnu, committed on trunk 2014-08-04 Robert Dewar de...@adacore.com * checks.adb (Apply_Scalar_Range_Check): Make sure we handle case of OUT and IN OUT parameter correctly (where Source_Typ is set), we were missing one case where a check must be applied. Index: checks.adb === --- checks.adb (revision 213550) +++ checks.adb (working copy) @@ -2971,11 +2971,18 @@ and then Is_Discrete_Type (S_Typ) = Is_Discrete_Type (Target_Typ) and then (In_Subrange_Of (S_Typ, Target_Typ, Fixed_Int) + + -- Also check if the expression itself is in the range of the + -- target type if it is a known at compile time value. We skip + -- this test if S_Typ is set since for OUT and IN OUT parameters + -- the Expr itself is not relevant to the checking. + or else - Is_In_Range (Expr, Target_Typ, -Assume_Valid = True, -Fixed_Int= Fixed_Int, -Int_Real = Int_Real)) + (No (Source_Typ) + and then Is_In_Range (Expr, Target_Typ, +Assume_Valid = True, +Fixed_Int= Fixed_Int, +Int_Real = Int_Real))) then return;
[Ada] Freezing subprogram that returns a limited view
This patch handles properly a function declared in package A that returns the limited view of a type declared in package B, when the function is called from a context that has with_clauses on A and B. Previous to this patch such a call would crash the compiler because of a misplaced freeze node. The following must compile quietly: gcc -c builder.adb -- package body Builder is function + (Item : Wide_Wide_String) return Strings.Universal_String renames Strings.To_Universal_String; function Get_Document (Self : in out JSON_Builder) return Objects.JSON_Object is begin return Result : Objects.JSON_Object do Result.Insert (+styles, Self.Styles.To_JSON_Value); end return; end Get_Document; not overriding procedure Leave_Text_Span (Self: in out JSON_Builder; Element : not null Text_Span_Elements.ODF_Text_Span_Access) is begin Self.Current.Object.Insert (+children, Self.Current.Children.To_JSON_Value); end Leave_Text_Span; end Builder; --- limited with Values; package Arrays is pragma Preelaborate; type JSON_Array is tagged private; pragma Preelaborable_Initialization (JSON_Array); Empty_JSON_Array : constant JSON_Array; function To_JSON_Value (Self : JSON_Array'Class) return Values.JSON_Value; private type JSON_Array is tagged record null; end record; Empty_JSON_Array : constant JSON_Array := (others = ); end Arrays; --- with Objects; with Arrays; with Values; private with Strings; private with Text_Span_Elements; package Builder is type JSON_Builder is tagged limited private; function Get_Document (Self : in out JSON_Builder) return Objects.JSON_Object; private type State_Kinds is (Initial, Element); type State_Record (Kind : State_Kinds := Initial) is record case Kind is when Initial = null; when Element = Object : Objects.JSON_Object; Children : Arrays.JSON_Array; end case; end record; type JSON_Builder is tagged limited record Current : State_Record; Previous : State_Record; Styles : Arrays.JSON_Array; end record; not overriding procedure Leave_Text_Span (Self: in out JSON_Builder; Element : not null Text_Span_Elements.ODF_Text_Span_Access); end Builder; --- with Strings; limited with Values; package Objects is pragma Preelaborate; type JSON_Object is tagged private; pragma Preelaborable_Initialization (JSON_Object); procedure Insert (Self : in out JSON_Object'Class; Key : Strings.Universal_String; Value : Values.JSON_Value); private type JSON_Object is tagged record null; end record; end Objects; --- package Strings is pragma Preelaborate; type Universal_String is tagged private; function To_Universal_String (Item : Wide_Wide_String) return Universal_String; private type Universal_String is tagged record null; end record; end Strings; --- package Text_Span_Elements is pragma Preelaborate; type ODF_Text_Span is limited interface; type ODF_Text_Span_Access is access all ODF_Text_Span'Class with Storage_Size = 0; end Text_Span_Elements; -- package Values is pragma Preelaborate; type JSON_Value is tagged private; pragma Preelaborable_Initialization (JSON_Value); private type JSON_Value is tagged record null; end record; end Values; Tested on x86_64-pc-linux-gnu, committed on trunk 2014-08-04 Ed Schonberg schonb...@adacore.com * freeze.adb (Late_Freeze_Subprogram): Following AI05-151, a function can return a limited view of a type declared elsewhere. In that case the function cannot be frozen at the end of its enclosing package. If its first use is in a different unit, it cannot be frozen there, but if the call is legal the full view of the return type is available and the subprogram can now be frozen. However the freeze node cannot be inserted at the point of call, but rather must go in the package holding the function, so that the backend can process it in the proper context. Index: freeze.adb === --- freeze.adb (revision 213549) +++ freeze.adb (working copy) @@ -1815,14 +1815,19 @@ --- function Freeze_Entity (E : Entity_Id; N : Node_Id) return List_Id is - Loc: constant Source_Ptr := Sloc (N); + Loc : constant Source_Ptr := Sloc (N); + Comp : Entity_Id; + F_Node: Node_Id; + Indx : Node_Id; + Formal: Entity_Id; + Atype : Entity_Id; + Test_E : Entity_Id := E; - Comp : Entity_Id; - F_Node : Node_Id; - Indx : Node_Id; - Formal : Entity_Id; - Atype : Entity_Id; + -- This could use a comment ??? +
[AArch64] Some aarch64-builtins.c cleanup.
This patch removes the aarch64_simd_builtin_type enum. This is only really used for indexing in to an array of strings and an array of machine_mode. We don't need that. Given all the macro pasting we presently do in this file, just add another. Then we can store a proper machine_mode for each builtin and save the headache of keeping everything in sync. Regression tested for aarch64-none-elf. OK? Thanks, James --- gcc/ 2014-08-04 James Greenhalgh james.greenha...@arm.com * config/aarch64/aarch64-builtins.c (aarch64_simd_builtin_type_mode): Delete. (v8qi_UP): Remap to V8QImode. (v4hi_UP): Remap to V4HImode. (v2si_UP): Remap to V2SImode. (v2sf_UP): Remap to V2SFmode. (v1df_UP): Remap to V1DFmode. (di_UP): Remap to DImode. (df_UP): Remap to DFmode. (v16qi_UP):V16QImode. (v8hi_UP): Remap to V8HImode. (v4si_UP): Remap to V4SImode. (v4sf_UP): Remap to V4SFmode. (v2di_UP): Remap to V2DImode. (v2df_UP): Remap to V2DFmode. (ti_UP): Remap to TImode. (ei_UP): Remap to EImode. (oi_UP): Remap to OImode. (ci_UP): Map to CImode. (xi_UP): Remap to XImode. (si_UP): Remap to SImode. (sf_UP): Remap to SFmode. (hi_UP): Remap to HImode. (qi_UP): Remap to QImode. (aarch64_simd_builtin_datum): Make mode a machine_mode. (VAR1): Build builtin name. (aarch64_init_simd_builtins): Remove dead code. diff --git a/gcc/config/aarch64/aarch64-builtins.c b/gcc/config/aarch64/aarch64-builtins.c index 58db77e..ba58a99 100644 --- a/gcc/config/aarch64/aarch64-builtins.c +++ b/gcc/config/aarch64/aarch64-builtins.c @@ -47,54 +47,28 @@ #include gimple.h #include gimple-iterator.h -enum aarch64_simd_builtin_type_mode -{ - T_V8QI, - T_V4HI, - T_V2SI, - T_V2SF, - T_V1DF, - T_DI, - T_DF, - T_V16QI, - T_V8HI, - T_V4SI, - T_V4SF, - T_V2DI, - T_V2DF, - T_TI, - T_EI, - T_OI, - T_XI, - T_SI, - T_SF, - T_HI, - T_QI, - T_MAX -}; - -#define v8qi_UP T_V8QI -#define v4hi_UP T_V4HI -#define v2si_UP T_V2SI -#define v2sf_UP T_V2SF -#define v1df_UP T_V1DF -#define di_UPT_DI -#define df_UPT_DF -#define v16qi_UP T_V16QI -#define v8hi_UP T_V8HI -#define v4si_UP T_V4SI -#define v4sf_UP T_V4SF -#define v2di_UP T_V2DI -#define v2df_UP T_V2DF -#define ti_UP T_TI -#define ei_UP T_EI -#define oi_UP T_OI -#define xi_UP T_XI -#define si_UPT_SI -#define sf_UPT_SF -#define hi_UPT_HI -#define qi_UPT_QI - +#define v8qi_UP V8QImode +#define v4hi_UP V4HImode +#define v2si_UP V2SImode +#define v2sf_UP V2SFmode +#define v1df_UP V1DFmode +#define di_UPDImode +#define df_UPDFmode +#define v16qi_UP V16QImode +#define v8hi_UP V8HImode +#define v4si_UP V4SImode +#define v4sf_UP V4SFmode +#define v2di_UP V2DImode +#define v2df_UP V2DFmode +#define ti_UP TImode +#define ei_UP EImode +#define oi_UP OImode +#define ci_UP CImode +#define xi_UP XImode +#define si_UPSImode +#define sf_UPSFmode +#define hi_UPHImode +#define qi_UPQImode #define UP(X) X##_UP #define SIMD_MAX_BUILTIN_ARGS 5 @@ -134,7 +108,7 @@ enum aarch64_type_qualifiers typedef struct { const char *name; - enum aarch64_simd_builtin_type_mode mode; + enum machine_mode mode; const enum insn_code code; unsigned int fcode; enum aarch64_type_qualifiers *qualifiers; @@ -288,7 +262,7 @@ aarch64_types_storestruct_lane_qualifiers[SIMD_MAX_BUILTIN_ARGS] #define CF10(N, X) CODE_FOR_##N##X #define VAR1(T, N, MAP, A) \ - {#N, UP (A), CF##MAP (N, A), 0, TYPES_##T}, + {#N #A, UP (A), CF##MAP (N, A), 0, TYPES_##T}, #define VAR2(T, N, MAP, A, B) \ VAR1 (T, N, MAP, A) \ VAR1 (T, N, MAP, B) @@ -731,25 +705,10 @@ aarch64_init_simd_builtins (void) bool print_type_signature_p = false; char type_signature[SIMD_MAX_BUILTIN_ARGS] = { 0 }; aarch64_simd_builtin_datum *d = aarch64_simd_builtin_data[i]; - const char *const modenames[] = - { - v8qi, v4hi, v2si, v2sf, v1df, di, df, - v16qi, v8hi, v4si, v4sf, v2di, v2df, - ti, ei, oi, xi, si, sf, hi, qi - }; - const enum machine_mode modes[] = - { - V8QImode, V4HImode, V2SImode, V2SFmode, V1DFmode, DImode, DFmode, - V16QImode, V8HImode, V4SImode, V4SFmode, V2DImode, - V2DFmode, TImode, EImode, OImode, XImode, SImode, - SFmode, HImode, QImode - }; char namebuf[60]; tree ftype = NULL; tree fndecl = NULL; - gcc_assert (ARRAY_SIZE (modenames) == T_MAX); - d-fcode = fcode; /* We must track two variables here. op_num is @@ -797,7 +756,7 @@ aarch64_init_simd_builtins (void) /* Some builtins have different user-facing types for certain arguments, encoded in d-mode. */ if (qualifiers qualifier_map_mode) - op_mode = modes[d-mode]; + op_mode = d-mode; /* For pointers, we want a pointer to the basic type of the vector. */ @@ -829,11
[C PATCH] Discard P - (P + CST) optimization in pointer_diff (PR c/61240)
This PR is about bogus overflow warning that we issue for e.g. int *q = i + 1; q - (q - 1); because pointer_diff receives p - (p + -1U) which gets simplified to 1U - with overflow. We could drop the overflow flag to suppress the warning, but I think we should just remove the optimization altogether. First, FE shouldn't perform such transformations at all. Second, C++ FE has its own pointer_diff function that doesn't do such optimization. With this patch, the C FE will generate the same expression as the C++ FE. It's true that we should try to optimize this, but not in the front end. It ought to be easy to write a pattern for match-and-simplify that would handle this. Bootstrapped/regtested on x86_64-linux, ok for trunk? 2014-08-04 Marek Polacek pola...@redhat.com PR c/61240 * c-typeck.c (pointer_diff): Remove P - (P + CST) optimization. * gcc.dg/pr61240.c: New test. diff --git gcc/c/c-typeck.c gcc/c/c-typeck.c index fe9440c..5f46944 100644 --- gcc/c/c-typeck.c +++ gcc/c/c-typeck.c @@ -3460,7 +3460,6 @@ pointer_diff (location_t loc, tree op0, tree op1) addr_space_t as0 = TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (op0))); addr_space_t as1 = TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (op1))); tree target_type = TREE_TYPE (TREE_TYPE (op0)); - tree con0, con1, lit0, lit1; tree orig_op1 = op1; /* If the operands point into different address spaces, we need to @@ -3490,7 +3489,6 @@ pointer_diff (location_t loc, tree op0, tree op1) else inttype = restype; - if (TREE_CODE (target_type) == VOID_TYPE) pedwarn (loc, OPT_Wpointer_arith, pointer of type %void *% used in subtraction); @@ -3498,50 +3496,6 @@ pointer_diff (location_t loc, tree op0, tree op1) pedwarn (loc, OPT_Wpointer_arith, pointer to a function used in subtraction); - /* If the conversion to ptrdiff_type does anything like widening or - converting a partial to an integral mode, we get a convert_expression - that is in the way to do any simplifications. - (fold-const.c doesn't know that the extra bits won't be needed. - split_tree uses STRIP_SIGN_NOPS, which leaves conversions to a - different mode in place.) - So first try to find a common term here 'by hand'; we want to cover - at least the cases that occur in legal static initializers. */ - if (CONVERT_EXPR_P (op0) - (TYPE_PRECISION (TREE_TYPE (op0)) - == TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (op0, 0) -con0 = TREE_OPERAND (op0, 0); - else -con0 = op0; - if (CONVERT_EXPR_P (op1) - (TYPE_PRECISION (TREE_TYPE (op1)) - == TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (op1, 0) -con1 = TREE_OPERAND (op1, 0); - else -con1 = op1; - - if (TREE_CODE (con0) == POINTER_PLUS_EXPR) -{ - lit0 = TREE_OPERAND (con0, 1); - con0 = TREE_OPERAND (con0, 0); -} - else -lit0 = integer_zero_node; - - if (TREE_CODE (con1) == POINTER_PLUS_EXPR) -{ - lit1 = TREE_OPERAND (con1, 1); - con1 = TREE_OPERAND (con1, 0); -} - else -lit1 = integer_zero_node; - - if (operand_equal_p (con0, con1, 0)) -{ - op0 = lit0; - op1 = lit1; -} - - /* First do the subtraction as integers; then drop through to build the divide operator. Do not do default conversions on the minus operator diff --git gcc/testsuite/gcc.dg/pr61240.c gcc/testsuite/gcc.dg/pr61240.c index e69de29..e90c070 100644 --- gcc/testsuite/gcc.dg/pr61240.c +++ gcc/testsuite/gcc.dg/pr61240.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ + +void +foo (void) +{ + volatile __PTRDIFF_TYPE__ t; + int i; + int *p = i; + int *q = i + 1; + t = q - (q - 1); + t = (q - 1) - q; /* { dg-warning integer overflow in expression } */ + t = p - (p - 1); + t = (p - 1) - p ; /* { dg-warning integer overflow in expression } */ +} Marek
Re: [RFC: Patch, PR 60102] [4.9/4.10 Regression] powerpc fp-bit ices@dwf_regno
David Edelsohn wrote: On Fri, Aug 1, 2014 at 2:03 PM, rohitarul...@freescale.com rohitarul...@freescale.com wrote: [libgcc] 2014-07-31 Rohit rohitarul...@freescale.com * config/rs6000/linux-unwind.h (ppc_fallback_frame_state): Update based on change in SPE high register numbers and 3 HTM registers. [gcc] 2014-07-31 Rohit rohitarul...@freescale.com * config/rs6000/rs6000.c (rs6000_reg_names) : Add SPE high register names. (alt_reg_names) : Likewise. (rs6000_dwarf_register_span) : For SPE high registers, replace dwarf register numbers with GCC hard register numbers. (rs6000_init_dwarf_reg_sizes_extra) : Likewise. (rs6000_dbx_register_number): For SPE high registers, return dwarf register number for the corresponding GCC hard register number. * config/rs6000/rs6000.h (FIRST_PSEUDO_REGISTER) : Update based on 32 newly added GCC hard register numbers for SPE high registers. (DWARF_FRAME_REGISTERS) : Likewise. (DWARF_REG_TO_UNWIND_COLUMN) : Likewise. (DWARF_FRAME_REGNUM) : Likewise. (FIXED_REGISTERS) : Likewise. (CALL_USED_REGISTERS) : Likewise. (CALL_REALLY_USED_REGISTERS) : Likewise. (REG_ALLOC_ORDER) : Likewise. (enum reg_class) : Likewise. (REG_CLASS_NAMES) : Likewise. (REG_CLASS_CONTENTS) : Likewise. (SPE_HIGH_REGNO_P) : New macro to identify SPE high registers. * gcc.target/powerpc/pr60102.c: New testcase. The patch is okay with me if Uli is satisfied. Yes, this is fine with me. Bye, Ulrich -- Dr. Ulrich Weigand GNU/Linux compilers and toolchain ulrich.weig...@de.ibm.com
Re: [C PATCH] Discard P - (P + CST) optimization in pointer_diff (PR c/61240)
On Mon, 4 Aug 2014, Marek Polacek wrote: This PR is about bogus overflow warning that we issue for e.g. int *q = i + 1; q - (q - 1); because pointer_diff receives p - (p + -1U) which gets simplified to 1U - with overflow. We could drop the overflow flag to suppress the warning, but I think we should just remove the optimization altogether. First, FE shouldn't perform such transformations at all. Second, C++ FE has its own pointer_diff function that doesn't do such optimization. With this patch, the C FE will generate the same expression as the C++ FE. It's true that we should try to optimize this, but not in the front end. It ought to be easy to write a pattern for match-and-simplify that would handle this. I think that tree-ssa-forwprop.c already simplifies this in associate_plusminus with (T)(P + A) - (T)P - (T)A. Well, maybe not - but then the code should be massages to handle it. Can you double-check and do that? Otherwise I agree with removing this (and other) premature optimizations scattered throughout the frontends (and convert.c). Thanks, Richard. Bootstrapped/regtested on x86_64-linux, ok for trunk? 2014-08-04 Marek Polacek pola...@redhat.com PR c/61240 * c-typeck.c (pointer_diff): Remove P - (P + CST) optimization. * gcc.dg/pr61240.c: New test. diff --git gcc/c/c-typeck.c gcc/c/c-typeck.c index fe9440c..5f46944 100644 --- gcc/c/c-typeck.c +++ gcc/c/c-typeck.c @@ -3460,7 +3460,6 @@ pointer_diff (location_t loc, tree op0, tree op1) addr_space_t as0 = TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (op0))); addr_space_t as1 = TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (op1))); tree target_type = TREE_TYPE (TREE_TYPE (op0)); - tree con0, con1, lit0, lit1; tree orig_op1 = op1; /* If the operands point into different address spaces, we need to @@ -3490,7 +3489,6 @@ pointer_diff (location_t loc, tree op0, tree op1) else inttype = restype; - if (TREE_CODE (target_type) == VOID_TYPE) pedwarn (loc, OPT_Wpointer_arith, pointer of type %void *% used in subtraction); @@ -3498,50 +3496,6 @@ pointer_diff (location_t loc, tree op0, tree op1) pedwarn (loc, OPT_Wpointer_arith, pointer to a function used in subtraction); - /* If the conversion to ptrdiff_type does anything like widening or - converting a partial to an integral mode, we get a convert_expression - that is in the way to do any simplifications. - (fold-const.c doesn't know that the extra bits won't be needed. - split_tree uses STRIP_SIGN_NOPS, which leaves conversions to a - different mode in place.) - So first try to find a common term here 'by hand'; we want to cover - at least the cases that occur in legal static initializers. */ - if (CONVERT_EXPR_P (op0) - (TYPE_PRECISION (TREE_TYPE (op0)) - == TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (op0, 0) -con0 = TREE_OPERAND (op0, 0); - else -con0 = op0; - if (CONVERT_EXPR_P (op1) - (TYPE_PRECISION (TREE_TYPE (op1)) - == TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (op1, 0) -con1 = TREE_OPERAND (op1, 0); - else -con1 = op1; - - if (TREE_CODE (con0) == POINTER_PLUS_EXPR) -{ - lit0 = TREE_OPERAND (con0, 1); - con0 = TREE_OPERAND (con0, 0); -} - else -lit0 = integer_zero_node; - - if (TREE_CODE (con1) == POINTER_PLUS_EXPR) -{ - lit1 = TREE_OPERAND (con1, 1); - con1 = TREE_OPERAND (con1, 0); -} - else -lit1 = integer_zero_node; - - if (operand_equal_p (con0, con1, 0)) -{ - op0 = lit0; - op1 = lit1; -} - - /* First do the subtraction as integers; then drop through to build the divide operator. Do not do default conversions on the minus operator diff --git gcc/testsuite/gcc.dg/pr61240.c gcc/testsuite/gcc.dg/pr61240.c index e69de29..e90c070 100644 --- gcc/testsuite/gcc.dg/pr61240.c +++ gcc/testsuite/gcc.dg/pr61240.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ + +void +foo (void) +{ + volatile __PTRDIFF_TYPE__ t; + int i; + int *p = i; + int *q = i + 1; + t = q - (q - 1); + t = (q - 1) - q; /* { dg-warning integer overflow in expression } */ + t = p - (p - 1); + t = (p - 1) - p ; /* { dg-warning integer overflow in expression } */ +} Marek -- Richard Biener rguent...@suse.de SUSE / SUSE Labs SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746 GF: Jeff Hawn, Jennifer Guild, Felix Imendorffer
[Ada] Aspect Import with a value of False
In Ada 2012, boolean aspects are True by default, but can specify explicitly a value of False. In the case of an Import aspect, this indicates that the corresponding entity must have a completion in Ada, and not in the language specified in a Convention aspect. Compiling main.adb must yield: main.adb:4:04: missing body for Get_Length --- with Interfaces.C; with Ada.Text_IO; procedure Main is function Get_Length return Interfaces.C.size_t with Convention= C, Import= False, External_Name = getLength; begin Ada.Text_IO.Put_Line(Get_Length'Img); end Main; Tested on x86_64-pc-linux-gnu, committed on trunk 2014-08-04 Ed Schonberg schonb...@adacore.com * sem_prag.adb (Process_Import_Or_Interface): Handle properly an aspect Import that specifies a False value. Index: sem_prag.adb === --- sem_prag.adb(revision 213553) +++ sem_prag.adb(working copy) @@ -7993,7 +7993,37 @@ end if; end; - Set_Has_Completion (Def_Id); + -- If the pragma comes from an aspect specification, there + -- must be an Import aspect specified as well. In the rare + -- case where Import is set to False, the suprogram needs to + -- have a local completion. + + declare + Imp_Aspect : constant Node_Id := +Find_Aspect (Def_Id, Aspect_Import); + Expr : Node_Id; + + begin + if Present (Imp_Aspect) + and then Present (Expression (Imp_Aspect)) + then +Expr := Expression (Imp_Aspect); +Analyze_And_Resolve (Expr, Standard_Boolean); + +if Is_Entity_Name (Expr) + and then Entity (Expr) = Standard_True +then + Set_Has_Completion (Def_Id); +end if; + + -- If there is no expression, the default is True, as for + -- all boolean aspects. Same for the older pragma. + + else +Set_Has_Completion (Def_Id); + end if; + end; + Process_Interface_Name (Def_Id, Arg3, Arg4); end if;
[Ada] Add documentation for aspect Invariant'Class
Documentation change only, no test required Tested on x86_64-pc-linux-gnu, committed on trunk 2014-08-04 Robert Dewar de...@adacore.com * gnat_rm.texi: Add section on aspect Invariant'Class. Index: gnat_rm.texi === --- gnat_rm.texi(revision 213549) +++ gnat_rm.texi(working copy) @@ -308,6 +308,7 @@ * Aspect Initializes:: * Aspect Inline_Always:: * Aspect Invariant:: +* Aspect Invariant'Class:: * Aspect Iterable:: * Aspect Linker_Section:: * Aspect No_Elaboration_Code_All:: @@ -8061,6 +8062,7 @@ * Aspect Initializes:: * Aspect Inline_Always:: * Aspect Invariant:: +* Aspect Invariant'Class:: * Aspect Iterable:: * Aspect Linker_Section:: * Aspect Lock_Free:: @@ -8285,6 +8287,14 @@ synonym for the language defined aspect @code{Type_Invariant} except that it is separately controllable using pragma @code{Assertion_Policy}. +@node Aspect Invariant'Class +@unnumberedsec Aspect Invariant'Class +@findex Invariant'Class +@noindent +This aspect is equivalent to pragma @code{Type_Invariant_Class}. It is a +synonym for the language defined aspect @code{Type_Invariant'Class} except +that it is separately controllable using pragma @code{Assertion_Policy}. + @node Aspect Iterable @unnumberedsec Aspect Iterable @findex Iterable
Re: [C PATCH] Discard P - (P + CST) optimization in pointer_diff (PR c/61240)
On Mon, 4 Aug 2014, Marek Polacek wrote: +/* { dg-do compile } */ + +void +foo (void) +{ + volatile __PTRDIFF_TYPE__ t; + int i; + int *p = i; + int *q = i + 1; + t = q - (q - 1); + t = (q - 1) - q; /* { dg-warning integer overflow in expression } */ + t = p - (p - 1); + t = (p - 1) - p ; /* { dg-warning integer overflow in expression } */ +} Why do you want a warning for (q - 1) - q ? It looks like a perfectly correct way to say -1 to me (ptrdiff_t is a signed type for a reason). -- Marc Glisse
[Ada] Crash on entry call with limited view of synchronized object
The prefix of an entry call may be a limited view, in which case the expansion of the call must use the non-limited view, which is available at the point of an entry call. The following must compile quietly: gcc -c railway-train.adb --- package Railway is end Railway; --- limited with Railway.Platform; limited with Railway.Train; package Railway.Common is --Common stuff type Train_Ref is access all Train.Train; type Platform_Ref is access all Platform.Platform; type Route_Range is range 1..100; type Route_Array is array (Route_Range) of Platform_Ref; end Railway.Common; --- with Railway.Common; use Railway.Common; package Railway.Platform is protected type Platform is entry StopAtPlatform(Incoming_Train : in Train_Ref); procedure DepartFromPlatform; private Train_At_Platform : Train_Ref := null; end Platform; end Railway.Platform; --- package body Railway.Platform is protected body Platform is -- Train occupies the platform. This stops the access to the platform -- by all other trains, until DepartFromPlatform is called entry StopAtPlatform(Incoming_Train : in Train_Ref) when Train_At_Platform = null is begin Train_At_Platform := Incoming_Train; end StopAtPlatform; -- Train leaves the platform. This re-opens access to the platform -- by all other trains procedure DepartFromPlatform is begin Train_At_Platform := null; end DepartFromPlatform; end Platform; end Railway.Platform; --- with Railway.Common; use Railway.Common; with Ada.Text_IO; use Ada.Text_IO; package Railway.Train is task type Train is entry Create(id : in Natural; capacity : in Positive; Route : Route_Array; me : Train_Ref); end Train; end Railway.Train; --- with Railway.Platform; package body Railway.Train is task body Train is Myself : Train_Ref; Train_ID : Natural; Passenger_Load : Integer := 0; Passenger_Capacity : Positive; Train_Route : Route_Array; begin accept Create (id : in Natural; capacity : in Positive; Route : in Route_Array; me : Train_Ref) do Myself := me; Train_ID := id; Passenger_Capacity := capacity; Train_Route := Route; end Create; loop for i in Train_Route'Range loop Train_Route(i).StopAtPlatform(Myself); end loop; end loop; end Train; end Railway.Train; Tested on x86_64-pc-linux-gnu, committed on trunk 2014-08-04 Ed Schonberg schonb...@adacore.com * exp_ch9.adb (Extract_Entry): If the synchronized object is a limited view, replace with non-limited view, which is available at the point of an entry call. Index: exp_ch9.adb === --- exp_ch9.adb (revision 213536) +++ exp_ch9.adb (working copy) @@ -12819,6 +12819,14 @@ Ename := Selector_Name (Prefix (Nam)); Index := First (Expressions (Nam)); end if; + + -- Through indirection, the type may actually be a limited view of a + -- concurrent type. When compiling a call, the non-limited view of the + -- type is visible. + + if From_Limited_With (Etype (Concval)) then + Set_Etype (Concval, Non_Limited_View (Etype (Concval))); + end if; end Extract_Entry; ---
Re: [C PATCH] Discard P - (P + CST) optimization in pointer_diff (PR c/61240)
On Mon, 4 Aug 2014, Marc Glisse wrote: On Mon, 4 Aug 2014, Marek Polacek wrote: +/* { dg-do compile } */ + +void +foo (void) +{ + volatile __PTRDIFF_TYPE__ t; + int i; + int *p = i; + int *q = i + 1; + t = q - (q - 1); + t = (q - 1) - q; /* { dg-warning integer overflow in expression } */ + t = p - (p - 1); + t = (p - 1) - p ; /* { dg-warning integer overflow in expression } */ +} Why do you want a warning for (q - 1) - q ? It looks like a perfectly correct way to say -1 to me (ptrdiff_t is a signed type for a reason). But computing object - 1 does not result in a valid pointer, so p - 1 is what we want to warn about? OTOH (q - 1) - q is fine. Indeed that POINTER_PLUS_EXPR has an unsigned offset is an implementation detail. Richard.
[Ada] Aspect/pragma SPARK_Mode in generic
This patch allows the uses of aspect/pragma SPARK_Mode in generic units. It also implements the following rule concerning the interplay between instances and SPARK_Mode off: However, if an instance of a generic unit is enclosed by code where SPARK_Mode is Off and if any SPARK_Mode specifications occur within the generic unit, then the corresponding SPARK_Mode specifications occurring within the instance have no semantic effect. -- Source -- -- pack_gen_pragmas.ads generic package Pack_Gen_Pragmas with SPARK_Mode = On is Var_1 : Integer := 1 with Volatile, Async_Readers, Effective_Reads; procedure Force_Body; private pragma SPARK_Mode (Off); Var_2 : Integer := 2 with Volatile, Async_Readers, Effective_Reads; end Pack_Gen_Pragmas; -- pack_gen_pragmas.adb package body Pack_Gen_Pragmas is procedure Force_Body is begin null; end Force_Body; end Pack_Gen_Pragmas; -- pack_pragmas_inst_4.ads with Pack_Gen_Pragmas; package Pack_Pragmas_Inst_4 is package Inst is new Pack_Gen_Pragmas with SPARK_Mode = Off; end Pack_Pragmas_Inst_4; -- pack_pragmas_inst_5.ads with Pack_Gen_Pragmas; package Pack_Pragmas_Inst_5 is new Pack_Gen_Pragmas; pragma SPARK_Mode (On); -- Compilation and output -- $ gcc -c pack_pragmas_inst_4.ads $ gcc -c pack_pragmas_inst_5.ads pack_pragmas_inst_5.ads:3:01: instantiation error at pack_gen_pragmas.ads:3 pack_pragmas_inst_5.ads:3:01: illegal combination of external properties (SPARK RM 7.1.2(6)) Tested on x86_64-pc-linux-gnu, committed on trunk 2014-08-04 Hristian Kirtchev kirtc...@adacore.com * opt.ads Alphabetize various global flags. New flag Ignore_Pragma_SPARK_Mode along with a comment on usage. * sem_ch6.adb (Analyze_Generic_Subprogram_Body): Pragma SPARK_Mode is now allowed in generic units. (Analyze_Subprogram_Body_Helper): Do not verify the compatibility between the SPARK_Mode of a spec and that of a body when inside a generic. * sem_ch7.adb (Analyze_Package_Body_Helper): Do not verify the compatibility between the SPARK_Mode of a spec and that of a body when inside a generic. * sem_ch12.adb (Analyze_Generic_Subprogram_Declaration): Pragma SPARK_Mode is now allowed in generic units. (Analyze_Package_Instantiation): Save and restore the value of flag Ignore_ Pragma_SPARK_Mode in a stack-like fasion. Set the governing SPARK_Mode before analyzing the instance. (Analyze_Subprogram_Instantiation): Save and restore the value of flag Ignore_ Pragma_SPARK_Mode in a stack-like fasion. Set the governing SPARK_Mode before analyzing the instance. * sem_ch13.adb (Analyze_Aspect_Specifications): Emulate the placement of a source pragma when inserting the generated pragma for aspect SPARK_Mode. * sem_prag.adb (Analyze_Pragma): Reimplement the handling of pragma SPARK_Mode to allow for generics and their respective instantiations. * sem_util.ads, sem_util.adb (Check_SPARK_Mode_In_Generic): Removed. (Set_Ignore_Pragma_SPARK_Mode): New routine. Index: sem_ch7.adb === --- sem_ch7.adb (revision 213553) +++ sem_ch7.adb (working copy) @@ -437,11 +437,9 @@ Inspect_Deferred_Constant_Completion (Declarations (N)); end if; - -- After declarations have been analyzed, the body has been set to have - -- the final value of SPARK_Mode. Check that the SPARK_Mode for the body - -- is consistent with the SPARK_Mode for the spec. + -- Verify that the SPARK_Mode of the body agrees with that of its spec - if Present (SPARK_Pragma (Body_Id)) then + if not Inside_A_Generic and then Present (SPARK_Pragma (Body_Id)) then if Present (SPARK_Aux_Pragma (Spec_Id)) then if Get_SPARK_Mode_From_Pragma (SPARK_Aux_Pragma (Spec_Id)) = Off and then Index: sem_prag.adb === --- sem_prag.adb(revision 213566) +++ sem_prag.adb(working copy) @@ -19116,13 +19116,6 @@ -- pragma SPARK_Mode [(On | Off)]; when Pragma_SPARK_Mode = Do_SPARK_Mode : declare -Body_Id : Entity_Id; -Context : Node_Id; -Mode: Name_Id; -Mode_Id : SPARK_Mode_Type; -Spec_Id : Entity_Id; -Stmt: Node_Id; - procedure Check_Pragma_Conformance (Context_Pragma : Node_Id; Entity_Pragma : Node_Id; @@ -19163,7 +19156,7 @@ -- New mode less restrictive than the established mode if Get_SPARK_Mode_From_Pragma (Context_Pragma) = Off -and then Mode_Id = On +and then
[PATCH, i386] Add RDRND and MOVBE for AMD bdver4
Below patch adds PTA_RDRND and PTA_MOVBE for bdver4. Bootstrap passes. Ok for upstream? Regards Ganesh Index: gcc/ChangeLog === --- gcc/ChangeLog (revision 213568) +++ gcc/ChangeLog (working copy) @@ -24,6 +24,11 @@ 2014-08-04 Ganesh Gopalasubramanian ganesh.gopalasubraman...@amd.com +* gcc/config/i386/i386.c (ix86_option_override_internal): Add + PTA_RDRND and PTA_MOVBE for bdver4. + +2014-08-04 Ganesh Gopalasubramanian ganesh.gopalasubraman...@amd.com + * config/i386/driver-i386.c (host_detect_local_cpu): Handle AMD's extended family information. Handle BTVER2 cpu with cpuid family value. Index: gcc/config/i386/i386.c === --- gcc/config/i386/i386.c (revision 213568) +++ gcc/config/i386/i386.c (working copy) @@ -3267,12 +3267,13 @@ ix86_option_override_internal (bool main | PTA_FMA | PTA_PRFCHW | PTA_FXSR | PTA_XSAVE | PTA_XSAVEOPT | PTA_FSGSBASE}, {bdver4, PROCESSOR_BDVER4, CPU_BDVER4, -PTA_64BIT | PTA_MMX | PTA_SSE | PTA_SSE2 | PTA_SSE3 -| PTA_SSE4A | PTA_CX16 | PTA_ABM | PTA_SSSE3 | PTA_SSE4_1 -| PTA_SSE4_2 | PTA_AES | PTA_PCLMUL | PTA_AVX | PTA_AVX2 + PTA_64BIT | PTA_MMX | PTA_SSE | PTA_SSE2 | PTA_SSE3 + | PTA_SSE4A | PTA_CX16 | PTA_ABM | PTA_SSSE3 | PTA_SSE4_1 + | PTA_SSE4_2 | PTA_AES | PTA_PCLMUL | PTA_AVX | PTA_AVX2 | PTA_FMA4 | PTA_XOP | PTA_LWP | PTA_BMI | PTA_BMI2 | PTA_TBM | PTA_F16C | PTA_FMA | PTA_PRFCHW | PTA_FXSR - | PTA_XSAVE | PTA_XSAVEOPT | PTA_FSGSBASE}, + | PTA_XSAVE | PTA_XSAVEOPT | PTA_FSGSBASE | PTA_RDRND + | PTA_MOVBE}, {btver1, PROCESSOR_BTVER1, CPU_GENERIC, PTA_64BIT | PTA_MMX | PTA_SSE | PTA_SSE2 | PTA_SSE3 | PTA_SSSE3 | PTA_SSE4A |PTA_ABM | PTA_CX16 | PTA_PRFCHW
{patch cp]: Disable hidden-inlines for pe-coff targets
Hi, This patch makes sure that visibility-option for hidden-inlines doesn't show any effect for pe-coff as for those targets no concept of hidden-visiblitly isn't present. ChangeLog 2014-08-04 Kai Tietz kti...@redhat.com * decl2.c (determine_hidden_inline): Always fail for PE-COFF as there is no hidden visibility available. Tested for x86_64-w64-mingw32, i686-w64-mingw32, and i686-pc-cygwin. Ok for apply? Regards, Kai Index: decl2.c === --- decl2.c (Revision 213543) +++ decl2.c (Arbeitskopie) @@ -2447,6 +2447,9 @@ determine_hidden_inline (tree decl) { return (visibility_options.inlines_hidden +#ifdef TARGET_PECOFF + !TARGET_PECOFF +#endif /* Don't do this for inline templates; specializations might not be inline, and we don't want them to inherit the hidden visibility. We'll set it here for all inline instantiations. */
Prepare gcc for 64-bit obstacks
Two small changes to gcc code to support newer obstacks: 1) gcc currently calls _obstack_begin, which requires some ugly casts on alloc and free functions, and the casts will change when/if 64-bit obstacks are available. It's cleaner to use the convenience functions provided in obstack.h. 2) Current upstream obstack.h makes obstack_base() return a void*, with the result that a few places in gcc need a (char *) cast. Bootstrapped and regression tested x86_64-linux and powerpc-linux, with both the new obstack.{h,c} and the old versions. OK to apply? gcc/ * gengtype.h (obstack_chunk_alloc, obstack_chunk_free): Remove cast. * coretypes.h (obstack_chunk_alloc, obstack_chunk_free): Likewise. (gcc_obstack_init): Use obstack_specify_allocation in place of _obstack_begin. * genautomata.c (next_sep_el): Cast result of obstack_base to (char *). (regexp_representation): Likewise. * godump.c (go_output_type): Likewise. gcc/java/ * mangle.c (finish_mangling): Cast result of obstack_base to (char *). * typeck.c (build_java_argument_signature): Likewise. (build_java_signature): Likewise. gcc/objc/ * objc-encoding.c (encode_array): Cast result of obstack_base. (encode_type): Likewise. libcpp/ * symtab.c (ht_create): Use obstack_specify_allocation in place of _obstack_begin. * files.c (_cpp_init_files): Likewise. * init.c (cpp_create_reader): Likewise. * identifiers.c (_cpp_init_hashtable): Likewise. Index: gcc/gengtype.h === --- gcc/gengtype.h (revision 212477) +++ gcc/gengtype.h (working copy) @@ -20,8 +20,8 @@ #ifndef GCC_GENGTYPE_H #define GCC_GENGTYPE_H -#define obstack_chunk_alloc((void *(*) (long)) xmalloc) -#define obstack_chunk_free ((void (*) (void *)) free) +#define obstack_chunk_allocxmalloc +#define obstack_chunk_free free #define OBSTACK_CHUNK_SIZE 0 /* Sets of accepted source languages like C, C++, Ada... are Index: gcc/coretypes.h === --- gcc/coretypes.h (revision 212477) +++ gcc/coretypes.h (working copy) @@ -158,13 +158,13 @@ struct basic_block_def; typedef struct basic_block_def *basic_block; typedef const struct basic_block_def *const_basic_block; -#define obstack_chunk_alloc((void *(*) (long)) xmalloc) -#define obstack_chunk_free ((void (*) (void *)) free) +#define obstack_chunk_allocxmalloc +#define obstack_chunk_free free #define OBSTACK_CHUNK_SIZE 0 -#define gcc_obstack_init(OBSTACK) \ - _obstack_begin ((OBSTACK), OBSTACK_CHUNK_SIZE, 0,\ - obstack_chunk_alloc, \ - obstack_chunk_free) +#define gcc_obstack_init(OBSTACK) \ + obstack_specify_allocation ((OBSTACK), OBSTACK_CHUNK_SIZE, 0,\ + obstack_chunk_alloc, \ + obstack_chunk_free) /* enum reg_class is target specific, so it should not appear in target-independent code or interfaces, like the target hook declarations Index: gcc/genautomata.c === --- gcc/genautomata.c (revision 212477) +++ gcc/genautomata.c (working copy) @@ -1178,7 +1178,7 @@ next_sep_el (const char **pstr, int sep, int par_f } } obstack_1grow (irp, '\0'); - out_str = obstack_base (irp); + out_str = (char *) obstack_base (irp); obstack_finish (irp); *pstr = p; @@ -6873,7 +6873,7 @@ regexp_representation (regexp_t regexp) { form_regexp (regexp); obstack_1grow (irp, '\0'); - return obstack_base (irp); + return (char *) obstack_base (irp); } /* The function frees memory allocated for last formed string @@ -9289,7 +9289,7 @@ initiate_automaton_gen (char **argv) obstack_grow (irp, STANDARD_OUTPUT_DESCRIPTION_FILE_SUFFIX, strlen (STANDARD_OUTPUT_DESCRIPTION_FILE_SUFFIX) + 1); obstack_1grow (irp, '\0'); - output_description_file_name = obstack_base (irp); + output_description_file_name = (char *) obstack_base (irp); obstack_finish (irp); } Index: gcc/godump.c === --- gcc/godump.c(revision 212477) +++ gcc/godump.c(working copy) @@ -921,7 +921,7 @@ go_output_type (struct godump_container *container ob = container-type_obstack; obstack_1grow (ob, '\0'); - fputs (obstack_base (ob), go_dump_file); + fputs ((char *) obstack_base (ob), go_dump_file); obstack_free (ob, obstack_base (ob)); } Index: gcc/java/mangle.c === --- gcc/java/mangle.c (revision 212477) +++ gcc/java/mangle.c (working copy) @@ -711,7 +711,7 @@ finish_mangling (void) compression_table = NULL_TREE;
[patch cp]: Check for keep-inline-dllexport that we are operating on true inlines
Hi, This patch makes sure that we check for flag keep-inline-dllexport that we operate on true inlines as we do it for keep-inline-functions. ChangeLog 2014-08-04 Kai Tietz kti...@redhat.com * semantics.c (expand_or_defer_fn_1): Check for keep-inline-dllexport that we operate on a true inline. Tested for x86_64-w64-mingw32, i686-w64-mingw32, and i686-pc-cygwin. Ok for apply? Regards, Kai Index: semantics.c === --- semantics.c (Revision 213543) +++ semantics.c (Arbeitskopie) @@ -4001,11 +4001,11 @@ expand_or_defer_fn_1 (tree fn) this function as needed so that finish_file will make sure to output it later. Similarly, all dllexport'd functions must be emitted; there may be callers in other DLLs. */ - if ((flag_keep_inline_functions - DECL_DECLARED_INLINE_P (fn) - !DECL_REALLY_EXTERN (fn)) - || (flag_keep_inline_dllexport - lookup_attribute (dllexport, DECL_ATTRIBUTES (fn + if (DECL_DECLARED_INLINE_P (fn) + !DECL_REALLY_EXTERN (fn) + (flag_keep_inline_functions + || (flag_keep_inline_dllexport + lookup_attribute (dllexport, DECL_ATTRIBUTES (fn) { mark_needed (fn); DECL_EXTERNAL (fn) = 0;
Re: [C PATCH] Discard P - (P + CST) optimization in pointer_diff (PR c/61240)
On Mon, Aug 04, 2014 at 12:26:01PM +0200, Richard Biener wrote: I think that tree-ssa-forwprop.c already simplifies this in associate_plusminus with (T)(P + A) - (T)P - (T)A. Well, maybe not - but then the code should be massages to handle it. Can you double-check and do that? Otherwise I agree with removing this (and other) premature optimizations scattered throughout the frontends (and convert.c). IMHO a precondition of such changes is exactly verifying the middle-end can perform those optimizations later on and if not, teaching the middle-end to optimize that. Jakub
Re: [PATCH, i386] Add RDRND and MOVBE for AMD bdver4
On Mon, Aug 4, 2014 at 12:58 PM, Gopalasubramanian, Ganesh ganesh.gopalasubraman...@amd.com wrote: Below patch adds PTA_RDRND and PTA_MOVBE for bdver4. Bootstrap passes. Ok for upstream? 2014-08-04 Ganesh Gopalasubramanian ganesh.gopalasubraman...@amd.com +* gcc/config/i386/i386.c (ix86_option_override_internal): Add + PTA_RDRND and PTA_MOVBE for bdver4. OK for mainline. Thanks, Uros.
Re: [C PATCH] Discard P - (P + CST) optimization in pointer_diff (PR c/61240)
On Mon, 4 Aug 2014, Jakub Jelinek wrote: On Mon, Aug 04, 2014 at 12:26:01PM +0200, Richard Biener wrote: I think that tree-ssa-forwprop.c already simplifies this in associate_plusminus with (T)(P + A) - (T)P - (T)A. Well, maybe not - but then the code should be massages to handle it. Can you double-check and do that? Otherwise I agree with removing this (and other) premature optimizations scattered throughout the frontends (and convert.c). IMHO a precondition of such changes is exactly verifying the middle-end can perform those optimizations later on and if not, teaching the middle-end to optimize that. Yep. Which is why I said double-check and do that, do that in extend what tree-ssa-forwrpop.c does. Richard.
Re: [PATCH, i386] Add RDRND and MOVBE for AMD bdver4
Uros Bizjak ubiz...@gmail.com writes: On Mon, Aug 4, 2014 at 12:58 PM, Gopalasubramanian, Ganesh ganesh.gopalasubraman...@amd.com wrote: Below patch adds PTA_RDRND and PTA_MOVBE for bdver4. Bootstrap passes. Ok for upstream? 2014-08-04 Ganesh Gopalasubramanian ganesh.gopalasubraman...@amd.com +* gcc/config/i386/i386.c (ix86_option_override_internal): Add + PTA_RDRND and PTA_MOVBE for bdver4. OK for mainline. ... but please correct the ChangeLog entry to lose the gcc/ prefix. Rainer -- - Rainer Orth, Center for Biotechnology, Bielefeld University
Re: [C PATCH] Discard P - (P + CST) optimization in pointer_diff (PR c/61240)
On Mon, Aug 04, 2014 at 12:26:01PM +0200, Richard Biener wrote: On Mon, 4 Aug 2014, Marek Polacek wrote: This PR is about bogus overflow warning that we issue for e.g. int *q = i + 1; q - (q - 1); because pointer_diff receives p - (p + -1U) which gets simplified to 1U - with overflow. We could drop the overflow flag to suppress the warning, but I think we should just remove the optimization altogether. First, FE shouldn't perform such transformations at all. Second, C++ FE has its own pointer_diff function that doesn't do such optimization. With this patch, the C FE will generate the same expression as the C++ FE. It's true that we should try to optimize this, but not in the front end. It ought to be easy to write a pattern for match-and-simplify that would handle this. I think that tree-ssa-forwprop.c already simplifies this in associate_plusminus with (T)(P + A) - (T)P - (T)A. Well, maybe not - but then the code should be massages to handle it. Can you double-check and do that? Looks like .fre can optimize q - (q - 1) into 1: bb 2: q.0_3 = (long int) MEM[(void *)i + 4B]; _5 = (long int) i; - _6 = q.0_3 - _5; - t.1_7 = _6 /[ex] 4; - t ={v} t.1_7; + t ={v} 1; i ={v} {CLOBBER}; return; But associate_plusminus doesn't optimize it: else if (code == MINUS_EXPR CONVERT_EXPR_CODE_P (def_code) TREE_CODE (gimple_assign_rhs1 (def_stmt)) == SSA_NAME TREE_CODE (rhs2) == SSA_NAME) { /* (T)(P + A) - (T)P - (T)A. */ becase gimple_assign_rhs1 (def_stmt) is not an SSA_NAME, but ADDR_EXPR (it's MEM[(void *)i + 4B]). Then there's transformation A - (A +- B) - -+ B below, but that doesn't handle casts. So - should I try to handle it in associate_plusminus? Marek
Re: [patch] No allocation for empty unordered containers
On 25/07/14 22:53 +0200, François Dumont wrote: Hi I think I never get feedback regarding this patch proposal. Note I've been trying to weigh up the pros and cons and am unsure what's best, but I think my preference is to have a noexcept default constructor. Unless you hear any objections in the next 48 hours please go ahead and commit this to trunk, thanks that if accepted the doc will have to be updated regarding the default hint value. Good point. Thanks On 03/06/2014 22:44, François Dumont wrote: Hi Thanks to the single bucket introduced to make move semantic noexcept we can also avoid some over allocations. Here is a patch to avoid any allocation on default instantiation, on range constructor when range is empty and on construction from an initialization list when this list is empty too. I had to make all default hint value to 0 so that if this value is used the rehash policy next bucket returns 1 bucket. I don't know if you had in mind to noexcept qualify the default constructor but it would mean to have a real default constructor and another to deal with the hint which wouldn't match the Standard so no noexcept qualification at the moment. Tested under Linux x86_64.normal debug and profile modes. 2014-06-03 François Dumont fdum...@gcc.gnu.org * include/bits/hashtable.h: Make use of the internal single bucket to limit allocation as long as container remains empty. * include/bits/unordered_map.h: Set default bucket hint to 0 in constructors to avoid allocation. * include/bits/unordered_set.h: Likewise. * include/debug/unordered_map: Likewise. * include/debug/unordered_set: Likewise. * include/profile/unordered_map: Likewise. * include/profile/unordered_set: Likewise. * src/c++11/hashtable_c++0x.cc (_Prime_rehash_policy::_M_next_bkt): Returns 1 for hint 0. * testsuite/23_containers/unordered_map/allocator/ empty_instantiation.cc:New. * testsuite/23_containers/unordered_multimap/allocator/ empty_instantiation.cc:New. * testsuite/23_containers/unordered_set/allocator/ empty_instantiation.cc: New. * testsuite/23_containers/unordered_multiset/allocator/ empty_instantiation.cc: New. Ok to commit ? François Index: include/bits/hashtable.h === --- include/bits/hashtable.h(revision 211144) +++ include/bits/hashtable.h(working copy) @@ -407,12 +407,12 @@ // Use delegating constructors. explicit _Hashtable(const allocator_type __a) - : _Hashtable(10, _H1(), _H2(), _Hash(), key_equal(), + : _Hashtable(0, _H1(), _H2(), _Hash(), key_equal(), __key_extract(), __a) { } explicit - _Hashtable(size_type __n = 10, + _Hashtable(size_type __n = 0, const _H1 __hf = _H1(), const key_equal __eql = key_equal(), const allocator_type __a = allocator_type()) @@ -792,14 +792,18 @@ const _Equal __eq, const _ExtractKey __exk, const allocator_type __a) : __hashtable_base(__exk, __h1, __h2, __h, __eq), - __map_base(), - __rehash_base(), __hashtable_alloc(__node_alloc_type(__a)), + _M_buckets(_M_single_bucket), + _M_bucket_count(1), _M_element_count(0), - _M_rehash_policy() + _M_single_bucket(nullptr) { - _M_bucket_count = _M_rehash_policy._M_next_bkt(__bucket_hint); - _M_buckets = _M_allocate_buckets(_M_bucket_count); + auto __bkt_count = _M_rehash_policy._M_next_bkt(__bucket_hint); + if (_M_bucket_count != __bkt_count) + { + _M_bucket_count = __bkt_count; + _M_buckets = _M_allocate_buckets(_M_bucket_count); + } } templatetypename _Key, typename _Value, @@ -815,19 +819,24 @@ const _Equal __eq, const _ExtractKey __exk, const allocator_type __a) : __hashtable_base(__exk, __h1, __h2, __h, __eq), - __map_base(), - __rehash_base(), __hashtable_alloc(__node_alloc_type(__a)), + _M_buckets(_M_single_bucket), + _M_bucket_count(1), _M_element_count(0), - _M_rehash_policy() + _M_single_bucket(nullptr) { auto __nb_elems = __detail::__distance_fw(__f, __l); - _M_bucket_count = + auto __bkt_count = _M_rehash_policy._M_next_bkt( std::max(_M_rehash_policy._M_bkt_for_elements(__nb_elems), __bucket_hint)); + + if (_M_bucket_count != __bkt_count) + { + _M_bucket_count = __bkt_count; + _M_buckets = _M_allocate_buckets(_M_bucket_count); + } - _M_buckets = _M_allocate_buckets(_M_bucket_count); __try { for (; __f != __l; ++__f) @@ -864,14 +873,15 @@ { // Replacement allocator cannot free existing storage. this-_M_deallocate_nodes(_M_begin()); -
Re: [PATCH] Keep patch file permissions in mklog
thanks for the review. Np, I'm personally happy to see that script is useful. I've now interpreted it such that --inline prints to stdout what it would print to the patch file otherwise, that is, both log and patch. Printing just the log to stdout can be already be achieved by not using --inline. Could you add a note in the help message? +if ($#ARGV == 1 ($ARGV[0] eq -i || $ARGV[0] eq --inline)) { I'd do = 1 but that's a question of personal preference. +if ($inline $diff ne -) { + $tmp = `mktemp`; + if ($? != 0) { + die Could not generate temp file; + } IMHO better use consistent style: system() or ticks with $?. Or even better, encapsulate environment calls in a subfunction which would check return code and return stdout. BTW you may want to wait for Diego's and Trevor's comments (Diego is the maintainer and approver for this code). -Y
Re: [patch] No allocation for empty unordered containers
On 04/08/14 12:49 +0100, Jonathan Wakely wrote: On 25/07/14 22:53 +0200, François Dumont wrote: Hi I think I never get feedback regarding this patch proposal. Note I've been trying to weigh up the pros and cons and am unsure what's best, but I think my preference is to have a noexcept default constructor. Unless you hear any objections in the next 48 hours please go ahead and commit this to trunk, thanks I hit send too soon, I meant to say that I think this change is also needed: I don't know if you had in mind to noexcept qualify the default constructor but it would mean to have a real default constructor and another to deal with the hint which wouldn't match the Standard so no noexcept qualification at the moment. If we don't make it noexcept then I see no point in avoiding allocation. (And if the functors and allocator can throw then the noexcept might have to be condition.) So please make sure we get that change as well during stage 1.
Re: [C PATCH] Discard P - (P + CST) optimization in pointer_diff (PR c/61240)
On Mon, Aug 04, 2014 at 12:51:06PM +0200, Richard Biener wrote: On Mon, 4 Aug 2014, Marc Glisse wrote: On Mon, 4 Aug 2014, Marek Polacek wrote: +/* { dg-do compile } */ + +void +foo (void) +{ + volatile __PTRDIFF_TYPE__ t; + int i; + int *p = i; + int *q = i + 1; + t = q - (q - 1); + t = (q - 1) - q; /* { dg-warning integer overflow in expression } */ + t = p - (p - 1); + t = (p - 1) - p ; /* { dg-warning integer overflow in expression } */ +} Why do you want a warning for (q - 1) - q ? It looks like a perfectly correct way to say -1 to me (ptrdiff_t is a signed type for a reason). It's not that I want the warning there. I can probably drop the two lines from the test. But computing object - 1 does not result in a valid pointer, so p - 1 is what we want to warn about? OTOH (q - 1) - q is fine. Indeed that POINTER_PLUS_EXPR has an unsigned offset is an implementation detail. I'm inclined to think that we shouldn't issue the warning at all, note how it talks about integer overflow, but this is pointer arithmetic. We can't really decide at that point whether the pointer is valid I'm afraid. Marek
Re: [C PATCH] Discard P - (P + CST) optimization in pointer_diff (PR c/61240)
On Mon, 4 Aug 2014, Marek Polacek wrote: On Mon, Aug 04, 2014 at 12:26:01PM +0200, Richard Biener wrote: On Mon, 4 Aug 2014, Marek Polacek wrote: This PR is about bogus overflow warning that we issue for e.g. int *q = i + 1; q - (q - 1); because pointer_diff receives p - (p + -1U) which gets simplified to 1U - with overflow. We could drop the overflow flag to suppress the warning, but I think we should just remove the optimization altogether. First, FE shouldn't perform such transformations at all. Second, C++ FE has its own pointer_diff function that doesn't do such optimization. With this patch, the C FE will generate the same expression as the C++ FE. It's true that we should try to optimize this, but not in the front end. It ought to be easy to write a pattern for match-and-simplify that would handle this. I think that tree-ssa-forwprop.c already simplifies this in associate_plusminus with (T)(P + A) - (T)P - (T)A. Well, maybe not - but then the code should be massages to handle it. Can you double-check and do that? Looks like .fre can optimize q - (q - 1) into 1: bb 2: q.0_3 = (long int) MEM[(void *)i + 4B]; _5 = (long int) i; - _6 = q.0_3 - _5; - t.1_7 = _6 /[ex] 4; - t ={v} t.1_7; + t ={v} 1; i ={v} {CLOBBER}; return; But associate_plusminus doesn't optimize it: else if (code == MINUS_EXPR CONVERT_EXPR_CODE_P (def_code) TREE_CODE (gimple_assign_rhs1 (def_stmt)) == SSA_NAME TREE_CODE (rhs2) == SSA_NAME) { /* (T)(P + A) - (T)P - (T)A. */ becase gimple_assign_rhs1 (def_stmt) is not an SSA_NAME, but ADDR_EXPR (it's MEM[(void *)i + 4B]). Then there's transformation A - (A +- B) - -+ B below, but that doesn't handle casts. So - should I try to handle it in associate_plusminus? Yes please, with a (few) testcase(s). Thanks, Richard.
[PATCH][match-and-simplify] Merge from trunk
2014-08-04 Richard Biener rguent...@suse.de Merge from trunk r211444 through r213455. * genmatch.c (operators): Adjust for hash_table interface change. * tree-ssa-pre.c (eliminate_dom_walker::before_dom_children): Also fold non-call stmts inplace to avoid creating new SSA names. Bootstrapped on x86_64-unknown-linux-gnu, committed. Richard.
[PATCH][ARM] Adjust clz, rbit and rev patterns for -mrestrict-it
Hi all, While working on another patch and looking at the rbit and clz patterns, I noticed that in aarch32 the relevant patterns are not adjusted for -mrestrict-it. A program like: int foo (int a, int b) { if (a + 5 == b) return __builtin_ctz (a); return 1; } compiled with -march=armv8-a -mthumb could generate clz and rbit instructions inside an IT block, thus earning an assembler warning. Whilst there I also noticed that the output templates for the arm_rev pattern have a %? that is used to print out condition codes during predication but the pattern is not marked as predicable. So I set the predicable attribute there and adjusted it for -mrestrict-it while at it. Ok for trunk? 2014-08-04 Kyrylo Tkachov kyrylo.tkac...@arm.com * config/arm/arm.md (clzsi2): Set predicable_short_it attr to no. (rbitsi2): Likewise. (*arm_rev): Set predicable and predicable_short_it attributes.commit 1ea85f18ff46fa985ba79e6e64715ecf855751c3 Author: Kyrylo Tkachov kyrylo.tkac...@arm.com Date: Wed Jul 9 16:38:45 2014 +0100 [ARM] Handle IT deprecation for clz, rbit, rev diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md index 916d552..3e1a1bb 100644 --- a/gcc/config/arm/arm.md +++ b/gcc/config/arm/arm.md @@ -10662,6 +10662,7 @@ TARGET_32BIT arm_arch5 clz%?\\t%0, %1 [(set_attr predicable yes) + (set_attr predicable_short_it no) (set_attr type clz)]) (define_insn rbitsi2 @@ -10670,6 +10671,7 @@ TARGET_32BIT arm_arch_thumb2 rbit%?\\t%0, %1 [(set_attr predicable yes) + (set_attr predicable_short_it no) (set_attr type clz)]) (define_expand ctzsi2 @@ -10829,6 +10831,8 @@ rev%?\t%0, %1 [(set_attr arch t1,t2,32) (set_attr length 2,2,4) + (set_attr predicable no,yes,yes) + (set_attr predicable_short_it no) (set_attr type rev)] )
[PATCH][convert.c] PR 61876: Guard transformation to lrint by -fno-math-errno
Hi all, Following up on Josephs' comments on PR 61876 this patch guards the rint + cast - lrint transformation on -fno-math-errno. Bootstrapped and tested on aarch64-linux and x86. Ok for trunk? Thanks, Kyrill 2014-08-04 Kyrylo Tkachov kyrylo.tkac...@arm.com * convert.c (convert_to_integer): Guard transformation to lrint by -fno-math-errno.commit e519f002ee27701b1b890dd8b303dc45d4e4595c Author: Kyrylo Tkachov kyrylo.tkac...@arm.com Date: Fri Jul 25 16:21:23 2014 +0100 [convert.c] Guard transform to lrint with -fno-math-errno diff --git a/gcc/convert.c b/gcc/convert.c index 8dbf3cb..3834351 100644 --- a/gcc/convert.c +++ b/gcc/convert.c @@ -477,8 +477,8 @@ convert_to_integer (tree type, tree expr) break; /* ... Fall through ... */ CASE_FLT_FN (BUILT_IN_RINT): - /* Only convert in ISO C99 mode. */ - if (!targetm.libc_has_function (function_c99_misc)) + /* Only convert in ISO C99 mode and with -fno-math-errno. */ + if (!targetm.libc_has_function (function_c99_misc) || flag_errno_math) break; if (outprec TYPE_PRECISION (integer_type_node) || (outprec == TYPE_PRECISION (integer_type_node)
[PATCH] Make gimple_fold_builtin private
The following patch removes the only user of gimple_fold_builtin, using the proper fold_stmt API. Boostrapped on x86_64-unknown-linux-gnu, testing in progress. Richard. 2014-08-01 Richard Biener rguent...@suse.de * gimple-fold.h (gimple_fold_builtin): Remove. * gimple-fold.c (gimple_fold_builtin): Make static. * tree-ssa-ccp.c (pass_fold_builtins::execute): Use fold_stmt, not gimple_fold_builtin. Index: gcc/gimple-fold.h === *** gcc/gimple-fold.h.orig 2014-08-04 12:52:53.994431783 +0200 --- gcc/gimple-fold.h 2014-08-04 12:53:04.948431029 +0200 *** along with GCC; see the file COPYING3. *** 25,31 extern tree canonicalize_constructor_val (tree, tree); extern tree get_symbol_constant_value (tree); extern void gimplify_and_update_call_from_tree (gimple_stmt_iterator *, tree); - extern tree gimple_fold_builtin (gimple); extern bool fold_stmt (gimple_stmt_iterator *); extern bool fold_stmt_inplace (gimple_stmt_iterator *); extern tree maybe_fold_and_comparisons (enum tree_code, tree, tree, --- 25,30 Index: gcc/tree-ssa-ccp.c === *** gcc/tree-ssa-ccp.c.orig 2014-08-04 12:52:53.994431783 +0200 --- gcc/tree-ssa-ccp.c 2014-08-04 13:16:28.512334396 +0200 *** pass_fold_builtins::execute (function *f *** 2676,2682 for (i = gsi_start_bb (bb); !gsi_end_p (i); ) { gimple stmt, old_stmt; ! tree callee, result; enum built_in_function fcode; stmt = gsi_stmt (i); --- 2676,2682 for (i = gsi_start_bb (bb); !gsi_end_p (i); ) { gimple stmt, old_stmt; ! tree callee; enum built_in_function fcode; stmt = gsi_stmt (i); *** pass_fold_builtins::execute (function *f *** 2701,2762 gsi_next (i); continue; } callee = gimple_call_fndecl (stmt); if (!callee || DECL_BUILT_IN_CLASS (callee) != BUILT_IN_NORMAL) { gsi_next (i); continue; } - fcode = DECL_FUNCTION_CODE (callee); - - result = gimple_fold_builtin (stmt); ! if (result) ! gimple_remove_stmt_histograms (fun, stmt); ! if (!result) ! switch (DECL_FUNCTION_CODE (callee)) ! { ! case BUILT_IN_CONSTANT_P: ! /* Resolve __builtin_constant_p. If it hasn't been ! folded to integer_one_node by now, it's fairly ! certain that the value simply isn't constant. */ ! result = integer_zero_node; ! break; ! ! case BUILT_IN_ASSUME_ALIGNED: ! /* Remove __builtin_assume_aligned. */ ! result = gimple_call_arg (stmt, 0); ! break; ! ! case BUILT_IN_STACK_RESTORE: ! result = optimize_stack_restore (i); ! if (result) break; - gsi_next (i); - continue; ! case BUILT_IN_UNREACHABLE: ! if (optimize_unreachable (i)) ! cfg_changed = true; ! break; ! ! case BUILT_IN_VA_START: ! case BUILT_IN_VA_END: ! case BUILT_IN_VA_COPY: ! /* These shouldn't be folded before pass_stdarg. */ ! result = optimize_stdarg_builtin (stmt); ! if (result) break; - /* FALLTHRU */ ! default: ! gsi_next (i); ! continue; ! } ! if (result == NULL_TREE) ! break; if (dump_file (dump_flags TDF_DETAILS)) { --- 2701,2769 gsi_next (i); continue; } + callee = gimple_call_fndecl (stmt); if (!callee || DECL_BUILT_IN_CLASS (callee) != BUILT_IN_NORMAL) { gsi_next (i); continue; } ! fcode = DECL_FUNCTION_CODE (callee); ! if (fold_stmt (i)) ! ; ! else ! { ! tree result = NULL_TREE; ! switch (DECL_FUNCTION_CODE (callee)) ! { ! case BUILT_IN_CONSTANT_P: ! /* Resolve __builtin_constant_p. If it hasn't been !folded to integer_one_node by now, it's fairly !certain that the value simply isn't constant. */ ! result = integer_zero_node; ! break; ! case BUILT_IN_ASSUME_ALIGNED: ! /* Remove __builtin_assume_aligned. */ ! result = gimple_call_arg (stmt, 0); break; ! case BUILT_IN_STACK_RESTORE: ! result =
Re: [C PATCH] Discard P - (P + CST) optimization in pointer_diff (PR c/61240)
On Mon, 4 Aug 2014, Marek Polacek wrote: On Mon, Aug 04, 2014 at 12:51:06PM +0200, Richard Biener wrote: On Mon, 4 Aug 2014, Marc Glisse wrote: On Mon, 4 Aug 2014, Marek Polacek wrote: +/* { dg-do compile } */ + +void +foo (void) +{ + volatile __PTRDIFF_TYPE__ t; + int i; + int *p = i; + int *q = i + 1; + t = q - (q - 1); + t = (q - 1) - q; /* { dg-warning integer overflow in expression } */ + t = p - (p - 1); + t = (p - 1) - p ; /* { dg-warning integer overflow in expression } */ +} Why do you want a warning for (q - 1) - q ? It looks like a perfectly correct way to say -1 to me (ptrdiff_t is a signed type for a reason). It's not that I want the warning there. I can probably drop the two lines from the test. Well, no, I think we want those two lines, but to test that there is *no* warning. The bug is only halfway fixed if we still warn for (q-1)-q. But maybe you are trying to split the fix in 2 patches, in which case I don't really mind what the intermediate status is. But computing object - 1 does not result in a valid pointer, so p - 1 is what we want to warn about? OTOH (q - 1) - q is fine. Indeed that POINTER_PLUS_EXPR has an unsigned offset is an implementation detail. I'm inclined to think that we shouldn't issue the warning at all, note how it talks about integer overflow, but this is pointer arithmetic. We can't really decide at that point whether the pointer is valid I'm afraid. Richard is talking about a new, unrelated warning, that would warn for obj-1. That seems doable. Though warning for p-1 when p is defined as obj sounds much harder in the front-end. -- Marc Glisse
[Ada] Use of discriminants in derived types for SPARK 2014
This patch implements the following rules related to the discriminants of derived types: The type of a discriminant_specification shall be discrete. A discriminant_specification shall not occur as part of a derived type declaration whose parent type is discriminated. -- Source -- -- discriminants.ads package Discriminants with SPARK_Mode is type Integer_Ptr is access all Integer; type OK_1 (D : Integer) is null record; type Error_1 (D : access Integer) is null record; type Error_2 (D : Integer_Ptr) is null record; type Error_3 (D : Float) is null record; type Parent_1 (D : Integer) is tagged null record; type Error_4 (D2 : Integer) is new Parent_1 (1) with null record; type Parent_2 (D : Integer := 2) is tagged limited null record; type Error_5 (D2 : Integer) is limited new Parent_2 (2) with null record; type Parent_3 (D : Integer) is null record; type Error_6 (D2 : Integer) is new Parent_3 (3); end Discriminants; -- Compilation and output -- $ gcc -c discriminants.ads discriminants.ads:5:22: discriminant cannot have an access type discriminants.ads:6:22: discriminant cannot have an access type discriminants.ads:7:22: discriminant must have a discrete type discriminants.ads:10:19: discriminants not allowed if parent type is discriminated discriminants.ads:13:19: discriminants not allowed if parent type is discriminated discriminants.ads:16:19: discriminants not allowed if parent type is discriminated Tested on x86_64-pc-linux-gnu, committed on trunk 2014-08-04 Hristian Kirtchev kirtc...@adacore.com * a-cfhama.ads, a-cfhase.ads, a-cforma.ads, a-cforse.ads Add SPARK_Mode pragmas to the public and private part of the unit. * sem_ch3.adb (Derive_Type_Declaration): Ensure that a derived type cannot have discriminants if the parent type already has discriminants. (Process_Discriminants): Ensure that the type of a discriminant is discrete. * sem_ch6.adb (Analyze_Subprogram_Body_Helper): The check on SPARK_Mode compatibility between a spec and a body can now be safely performed while processing a generic. * sem_ch7.adb (Analyze_Package_Body_Helper): The check on SPARK_Mode compatibility between a spec and a body can now be safely performed while processing a generic. * sem_prag.adb (Analyze_Pragma): Pragma SPARK_Mode can now be safely analyzed when processing a generic. Index: sem_ch3.adb === --- sem_ch3.adb (revision 213566) +++ sem_ch3.adb (working copy) @@ -15046,7 +15046,7 @@ end if; -- Only composite types other than array types are allowed to have - -- discriminants. In SPARK, no types are allowed to have discriminants. + -- discriminants. if Present (Discriminant_Specifications (N)) then if (Is_Elementary_Type (Parent_Type) @@ -15057,8 +15057,22 @@ (elementary or array type cannot have discriminants, Defining_Identifier (First (Discriminant_Specifications (N; Set_Has_Discriminants (T, False); + + -- The type is allowed to have discriminants + else Check_SPARK_05_Restriction (discriminant type is not allowed, N); + +-- The following check is only relevant when SPARK_Mode is on as +-- it is not a standard Ada legality rule. A derived type cannot +-- have discriminants if the parent type is discriminated. + +if SPARK_Mode = On and then Has_Discriminants (Parent_Type) then + SPARK_Msg_N + (discriminants not allowed if parent type is discriminated, + Defining_Identifier +(First (Discriminant_Specifications (N; +end if; end if; end if; @@ -18024,24 +18038,44 @@ end if; end if; - if Is_Access_Type (Discr_Type) then + -- The following checks are only relevant when SPARK_Mode is on as + -- they are not standard Ada legality rules. --- Ada 2005 (AI-230): Access discriminant allowed in non-limited --- record types + if SPARK_Mode = On then +if Is_Access_Type (Discr_Type) then + SPARK_Msg_N + (discriminant cannot have an access type, + Discriminant_Type (Discr)); -if Ada_Version Ada_2005 then - Check_Access_Discriminant_Requires_Limited - (Discr, Discriminant_Type (Discr)); +elsif not Is_Discrete_Type (Discr_Type) then + SPARK_Msg_N + (discriminant must have a discrete type, + Discriminant_Type (Discr)); end if; -if Ada_Version = Ada_83
[Ada] Support for hash based message authentication codes
This change introduces a new subprogram in the GNAT secure hash framework to allow computing HMACs based on the secure hash functions. This is achieved by initializing a context with a (non-empty) key. The following example shows how to compute the first HMAC-MD5 test from RFC2104: $ gnatmake -q rfc2104_test1.adb $ ./rfc2104_test1 9294727a3638bb1c13f48ef8158bfc9d with Ada.Text_IO; use Ada.Text_IO; with GNAT.MD5;use GNAT.MD5; procedure RFC2104_Test1 is C : Context := HMAC_Initial_Context ((1 .. 16 = Character'Val (16#0b#))); begin Update (C, Hi There); Put_Line (Digest (C)); end RFC2104_Test1; Tested on x86_64-pc-linux-gnu, committed on trunk 2014-08-04 Thomas Quinot qui...@adacore.com * g-sechas.ads, g-sechas.adb (HMAC_Initial_Context): New subprogram. * gnat_rm.texi (GNAT.MD5/SHA1/SHA224/SHA256/SHA512): Document support for HMAC. Index: gnat_rm.texi === --- gnat_rm.texi(revision 213566) +++ gnat_rm.texi(working copy) @@ -19952,7 +19952,9 @@ @cindex Message Digest MD5 @noindent -Implements the MD5 Message-Digest Algorithm as described in RFC 1321. +Implements the MD5 Message-Digest Algorithm as described in RFC 1321, and +the HMAC-MD5 message authentication function as described in RFC 2104 and +FIPS PUB 198. @node GNAT.Memory_Dump (g-memdum.ads) @section @code{GNAT.Memory_Dump} (@file{g-memdum.ads}) @@ -20088,7 +20090,8 @@ @noindent Implements the SHA-1 Secure Hash Algorithm as described in FIPS PUB 180-3 -and RFC 3174. +and RFC 3174, and the HMAC-SHA1 message authentication function as described +in RFC 2104 and FIPS PUB 198. @node GNAT.SHA224 (g-sha224.ads) @section @code{GNAT.SHA224} (@file{g-sha224.ads}) @@ -20096,7 +20099,9 @@ @cindex Secure Hash Algorithm SHA-224 @noindent -Implements the SHA-224 Secure Hash Algorithm as described in FIPS PUB 180-3. +Implements the SHA-224 Secure Hash Algorithm as described in FIPS PUB 180-3, +and the HMAC-SHA224 message authentication function as described +in RFC 2104 and FIPS PUB 198. @node GNAT.SHA256 (g-sha256.ads) @section @code{GNAT.SHA256} (@file{g-sha256.ads}) @@ -20104,7 +20109,9 @@ @cindex Secure Hash Algorithm SHA-256 @noindent -Implements the SHA-256 Secure Hash Algorithm as described in FIPS PUB 180-3. +Implements the SHA-256 Secure Hash Algorithm as described in FIPS PUB 180-3, +and the HMAC-SHA256 message authentication function as described +in RFC 2104 and FIPS PUB 198. @node GNAT.SHA384 (g-sha384.ads) @section @code{GNAT.SHA384} (@file{g-sha384.ads}) @@ -20112,7 +20119,9 @@ @cindex Secure Hash Algorithm SHA-384 @noindent -Implements the SHA-384 Secure Hash Algorithm as described in FIPS PUB 180-3. +Implements the SHA-384 Secure Hash Algorithm as described in FIPS PUB 180-3, +and the HMAC-SHA384 message authentication function as described +in RFC 2104 and FIPS PUB 198. @node GNAT.SHA512 (g-sha512.ads) @section @code{GNAT.SHA512} (@file{g-sha512.ads}) @@ -20120,7 +20129,9 @@ @cindex Secure Hash Algorithm SHA-512 @noindent -Implements the SHA-512 Secure Hash Algorithm as described in FIPS PUB 180-3. +Implements the SHA-512 Secure Hash Algorithm as described in FIPS PUB 180-3, +and the HMAC-SHA512 message authentication function as described +in RFC 2104 and FIPS PUB 198. @node GNAT.Signals (g-signal.ads) @section @code{GNAT.Signals} (@file{g-signal.ads}) Index: g-sechas.adb === --- g-sechas.adb(revision 213536) +++ g-sechas.adb(working copy) @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2009-2012, Free Software Foundation, Inc. -- +-- Copyright (C) 2009-2014, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -218,8 +218,8 @@ -- the message size in bits (excluding padding). procedure Final -(C : Context; - Hash_Bits : out Stream_Element_Array) +(C : Context; + Hash_Bits : out Stream_Element_Array) is FC : Context := C; @@ -274,8 +274,73 @@ pragma Assert (FC.M_State.Last = 0); Hash_State.To_Hash (FC.H_State, Hash_Bits); + + -- HMAC case: hash outer pad + + if C.KL /= 0 then +declare + Outer_C : Context; + Opad: Stream_Element_Array := + (1 .. Stream_Element_Offset (Block_Length) = 16#5c#); + +begin + for J in
[Ada] Spurious elaboration warning on added postcondition call
This patch removes a spurious elaboration warning on some calls to postconditions. Such a call always appears within an enclosing body, and as such is not subject to an elaboration check, but the call that is inserted after the final (inserted) return statement in a procedure body is analyzed in the enclosing context, which may be a compilation unit. Such a call is now properly handled. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-08-04 Ed Schonberg schonb...@adacore.com * sem_elab.adb (Check_Elab_Call): Do not check a call to a postcondtion. * exp_ch6.adb (Expand_Call): Clarify handling of inserted postcondition call. Index: sem_elab.adb === --- sem_elab.adb(revision 213536) +++ sem_elab.adb(working copy) @@ -1218,6 +1218,17 @@ return; end if; + -- Nothing to do if this is a call to a postcondition, which is always + -- within a subprogram body, even though the current scope may be the + -- enclosing scope of the subprogram. + + if Nkind (N) = N_Procedure_Call_Statement +and then Is_Entity_Name (Name (N)) +and then Chars (Entity (Name (N))) = Name_uPostconditions + then + return; + end if; + -- Here we have a call at elaboration time which must be checked if Debug_Flag_LL then Index: exp_ch6.adb === --- exp_ch6.adb (revision 213567) +++ exp_ch6.adb (working copy) @@ -5209,6 +5209,13 @@ -- Analyze call, but something goes wrong in some weird cases -- and it is not worth worrying about ??? + -- The return statement is handled properly, and the call to + -- the postcondition, inserted below, does not require + -- information from the body either. However, that call is + -- analyzed in the enclosing scope, and an elaboration check + -- might improperly be added to it. A guard in sem_elab is + -- needed to prevent that spurious check, see Check_Elab_Call. + Append_To (S, Rtn); Set_Analyzed (Rtn);
Re: [C PATCH] Discard P - (P + CST) optimization in pointer_diff (PR c/61240)
On Mon, Aug 04, 2014 at 02:36:12PM +0200, Marc Glisse wrote: On Mon, 4 Aug 2014, Marek Polacek wrote: On Mon, Aug 04, 2014 at 12:51:06PM +0200, Richard Biener wrote: On Mon, 4 Aug 2014, Marc Glisse wrote: On Mon, 4 Aug 2014, Marek Polacek wrote: +/* { dg-do compile } */ + +void +foo (void) +{ + volatile __PTRDIFF_TYPE__ t; + int i; + int *p = i; + int *q = i + 1; + t = q - (q - 1); + t = (q - 1) - q; /* { dg-warning integer overflow in expression } */ + t = p - (p - 1); + t = (p - 1) - p ; /* { dg-warning integer overflow in expression } */ +} Why do you want a warning for (q - 1) - q ? It looks like a perfectly correct way to say -1 to me (ptrdiff_t is a signed type for a reason). It's not that I want the warning there. I can probably drop the two lines from the test. Well, no, I think we want those two lines, but to test that there is *no* warning. The bug is only halfway fixed if we still warn for (q-1)-q. But maybe you are trying to split the fix in 2 patches, in which case I don't really mind what the intermediate status is. Yeah - I'd like to deal with reimplementing the optimization in fwprop first. The (p - 1) - p warning will need a different fix. Marek
[PATCH] fix pr62009 use after free in redirect_edge_var_map_dup
From: Trevor Saunders tsaund...@mozilla.com Hi, It used to be that edge_var_maps held pointers to embedded vectors, but now it holds vectors. This means that now instead of copying the address of the embedded vector from the table we keep a pointer into the table. However that's incorrect because we may expand the table when inserting new into the map in which case our pointer into the map points at freed memory. gcc/ * tree-ssa.c (redirect_edge_var_map_dup): copy the value in the map for old before inserting new. testing ongoing on x86_64-unknown-linux-gnu, ok? Trev --- gcc/tree-ssa.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 920cbea..b949d48 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -109,7 +109,11 @@ redirect_edge_var_map_dup (edge newe, edge olde) if (!head) return; - edge_var_maps-get_or_insert (newe).safe_splice (*head); + /* Save what head points at because if we need to insert new into the map we + may end up expanding the table in which case head will no longer point at + valid memory. */ + vecedge_var_map h = *head; + edge_var_maps-get_or_insert (newe).safe_splice (h); } -- 2.0.1
[Ada] Add internal abstraction for standard string test
This adds an internal abstraction for testing for standard string types. Internal front end cleanup, no function effect, no test required. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-08-04 Robert Dewar de...@adacore.com * einfo.ads, einfo.adb (Is_Standard_String_Type): New function. * exp_ch3.adb (Build_Array_Init_Proc): Use Is_Standard_String_Type. (Expand_Freeze_Array_Type): ditto. (Get_Simple_Init_Val): ditto. (Needs_Simple_Initialization): ditto. * sem_eval.adb (Eval_String_Literal): Use Is_Standard_String_Type. * sem_warn.adb (Is_Suspicious_Type): Use Is_Standard_String_Type. Index: einfo.adb === --- einfo.adb (revision 213565) +++ einfo.adb (working copy) @@ -7264,6 +7264,29 @@ end if; end Is_Standard_Character_Type; + - + -- Is_Standard_String_Type -- + - + + function Is_Standard_String_Type (Id : E) return B is + begin + if Is_Type (Id) then + declare +R : constant Entity_Id := Root_Type (Id); + begin +return + R = Standard_String +or else + R = Standard_Wide_String +or else + R = Standard_Wide_Wide_String; + end; + + else + return False; + end if; + end Is_Standard_String_Type; + -- Is_String_Type -- Index: einfo.ads === --- einfo.ads (revision 213566) +++ einfo.ads (working copy) @@ -2940,9 +2940,14 @@ --Is_Standard_Character_Type (synthesized) -- Applies to all entities, true for types and subtypes whose root type --- is one of the standard character types (Character, Wide_Character, +-- is one of the standard character types (Character, Wide_Character, or -- Wide_Wide_Character). +--Is_Standard_String_Type (synthesized) +-- Applies to all entities, true for types and subtypes whose root +-- type is one of the standard string types (String, Wide_String, or +-- Wide_Wide_String). + --Is_Statically_Allocated (Flag28) -- Defined in all entities. This can only be set for exception, -- variable, constant, and type/subtype entities. If the flag is set, @@ -5233,6 +5238,7 @@ --Has_Foreign_Convention (synth) --Is_Dynamic_Scope(synth) --Is_Standard_Character_Type (synth) + --Is_Standard_String_Type (synth) --Underlying_Type (synth) --all classification attributes (synth) @@ -7002,6 +7008,7 @@ function Is_Protected_Interface (Id : E) return B; function Is_Protected_Record_Type(Id : E) return B; function Is_Standard_Character_Type (Id : E) return B; + function Is_Standard_String_Type (Id : E) return B; function Is_String_Type (Id : E) return B; function Is_Synchronized_Interface (Id : E) return B; function Is_Task_Interface (Id : E) return B; Index: sem_warn.adb === --- sem_warn.adb(revision 213568) +++ sem_warn.adb(working copy) @@ -3650,11 +3650,7 @@ if Is_Array_Type (Typ) and then not Is_Constrained (Typ) and then Number_Dimensions (Typ) = 1 - and then (Root_Type (Typ) = Standard_String - or else - Root_Type (Typ) = Standard_Wide_String - or else - Root_Type (Typ) = Standard_Wide_Wide_String) + and then Is_Standard_String_Type (Typ) and then not Has_Warnings_Off (Typ) then LB := Type_Low_Bound (Etype (First_Index (Typ))); Index: sem_eval.adb === --- sem_eval.adb(revision 213536) +++ sem_eval.adb(working copy) @@ -3661,16 +3661,11 @@ -- Test for illegal Ada 95 cases. A string literal is illegal in Ada 95 -- if its bounds are outside the index base type and this index type is -- static. This can happen in only two ways. Either the string literal - -- is too long, or it is null, and the lower bound is type'First. In - -- either case it is the upper bound that is out of range of the index - -- type. + -- is too long, or it is null, and the lower bound is type'First. Either + -- way it is the upper bound that is out of range of the index type. + if Ada_Version = Ada_95 then - if Root_Type (Bas) = Standard_String - or else -Root_Type (Bas) = Standard_Wide_String - or else -
Results for 4.10.0 20140802 (experimental) [trunk revision 213515] (GCC) testsuite on x86_64-apple-darwin13.3.0
LAST_UPDATED: Updated Sat Aug 2 10:33:58 CEST 2014 to revision 213515. === acats tests === === acats Summary === # of expected passes2320 # of unexpected failures0 Native configuration is x86_64-apple-darwin13.3.0 === g++ tests === Running target unix/-m32 FAIL: g++.dg/debug/dwarf2/imported-decl-2.C -std=gnu++98 scan-assembler-times ascii 0.*ascii 0.*DIE .0x[0-9a-f]*. DW_TAG_imported_declaration 1 FAIL: g++.dg/debug/dwarf2/imported-decl-2.C -std=gnu++11 scan-assembler-times ascii 0.*ascii 0.*DIE .0x[0-9a-f]*. DW_TAG_imported_declaration 1 FAIL: g++.dg/debug/dwarf2/imported-decl-2.C -std=gnu++1y scan-assembler-times ascii 0.*ascii 0.*DIE .0x[0-9a-f]*. DW_TAG_imported_declaration 1 FAIL: g++.dg/cpp0x/static_assert9.C -std=c++11 (test for excess errors) FAIL: g++.dg/cpp0x/static_assert9.C -std=c++1y (test for excess errors) FAIL: g++.dg/ext/sync-4.C -std=gnu++98 execution test FAIL: g++.dg/ext/sync-4.C -std=gnu++11 execution test FAIL: g++.dg/ext/sync-4.C -std=gnu++1y execution test FAIL: g++.dg/ipa/devirt-34.C -std=gnu++98 scan-ipa-dump devirt Targets that are not likely FAIL: g++.dg/ipa/devirt-34.C -std=gnu++11 scan-ipa-dump devirt Targets that are not likely FAIL: g++.dg/ipa/devirt-34.C -std=gnu++1y scan-ipa-dump devirt Targets that are not likely FAIL: g++.dg/ipa/pr61160-3.C -std=gnu++98 execution test FAIL: g++.dg/ipa/pr61160-3.C -std=gnu++11 execution test FAIL: g++.dg/ipa/pr61160-3.C -std=gnu++1y execution test FAIL: g++.dg/opt/vt4.C -std=gnu++98 scan-assembler-not _ZTV.A FAIL: g++.dg/opt/vt4.C -std=gnu++11 scan-assembler-not _ZTV.A FAIL: g++.dg/opt/vt4.C -std=gnu++1y scan-assembler-not _ZTV.A === g++ Summary for unix/-m32 === # of expected passes83375 # of unexpected failures17 # of expected failures 437 # of unsupported tests 3166 Running target unix/-m64 FAIL: g++.dg/debug/pr54499.C -gdwarf-2 -g1 (internal compiler error) FAIL: g++.dg/debug/pr54499.C -gdwarf-2 -g1 (test for excess errors) FAIL: g++.dg/debug/pr54499.C -gdwarf-2 -g1 -O2 (internal compiler error) FAIL: g++.dg/debug/pr54499.C -gdwarf-2 -g1 -O2 (test for excess errors) FAIL: g++.dg/debug/pr54499.C -gdwarf-2 -g1 -O3 (internal compiler error) FAIL: g++.dg/debug/pr54499.C -gdwarf-2 -g1 -O3 (test for excess errors) FAIL: g++.dg/debug/pr54499.C -gdwarf-2 (internal compiler error) FAIL: g++.dg/debug/pr54499.C -gdwarf-2 (test for excess errors) FAIL: g++.dg/debug/pr54499.C -gdwarf-2 -O2 (internal compiler error) FAIL: g++.dg/debug/pr54499.C -gdwarf-2 -O2 (test for excess errors) FAIL: g++.dg/debug/pr54499.C -gdwarf-2 -O3 (internal compiler error) FAIL: g++.dg/debug/pr54499.C -gdwarf-2 -O3 (test for excess errors) FAIL: g++.dg/debug/pr54499.C -gdwarf-2 -g3 (internal compiler error) FAIL: g++.dg/debug/pr54499.C -gdwarf-2 -g3 (test for excess errors) FAIL: g++.dg/debug/pr54499.C -gdwarf-2 -g3 -O2 (internal compiler error) FAIL: g++.dg/debug/pr54499.C -gdwarf-2 -g3 -O2 (test for excess errors) FAIL: g++.dg/debug/pr54499.C -gdwarf-2 -g3 -O3 (internal compiler error) FAIL: g++.dg/debug/pr54499.C -gdwarf-2 -g3 -O3 (test for excess errors) FAIL: g++.dg/debug/pr54499.C -gstabs1 (internal compiler error) FAIL: g++.dg/debug/pr54499.C -gstabs1 (test for excess errors) FAIL: g++.dg/debug/pr54499.C -gstabs1 -O2 (internal compiler error) FAIL: g++.dg/debug/pr54499.C -gstabs1 -O2 (test for excess errors) FAIL: g++.dg/debug/pr54499.C -gstabs1 -O3 (internal compiler error) FAIL: g++.dg/debug/pr54499.C -gstabs1 -O3 (test for excess errors) FAIL: g++.dg/debug/pr54499.C -gstabs (internal compiler error) FAIL: g++.dg/debug/pr54499.C -gstabs (test for excess errors) FAIL: g++.dg/debug/pr54499.C -gstabs -O2 (internal compiler error) FAIL: g++.dg/debug/pr54499.C -gstabs -O2 (test for excess errors) FAIL: g++.dg/debug/pr54499.C -gstabs -O3 (internal compiler error) FAIL: g++.dg/debug/pr54499.C -gstabs -O3 (test for excess errors) FAIL: g++.dg/debug/pr54499.C -gstabs3 (internal compiler error) FAIL: g++.dg/debug/pr54499.C -gstabs3 (test for excess errors) FAIL: g++.dg/debug/pr54499.C -gstabs3 -O2 (internal compiler error) FAIL: g++.dg/debug/pr54499.C -gstabs3 -O2 (test for excess errors) FAIL: g++.dg/debug/pr54499.C -gstabs3 -O3 (internal compiler error) FAIL: g++.dg/debug/pr54499.C -gstabs3 -O3 (test for excess errors) FAIL: g++.dg/debug/pr54499.C -gstabs+1 (internal compiler error) FAIL: g++.dg/debug/pr54499.C -gstabs+1 (test for excess errors) FAIL: g++.dg/debug/pr54499.C -gstabs+1 -O2 (internal compiler error) FAIL: g++.dg/debug/pr54499.C -gstabs+1 -O2 (test for excess errors) FAIL: g++.dg/debug/pr54499.C -gstabs+1 -O3 (internal compiler error) FAIL: g++.dg/debug/pr54499.C -gstabs+1 -O3 (test for excess errors) FAIL: g++.dg/debug/pr54499.C -gstabs+ (internal compiler error) FAIL: g++.dg/debug/pr54499.C -gstabs+ (test for excess
Results for 4.10.0 20140802 (experimental) [trunk revision 213515] (GCC) testsuite on x86_64-apple-darwin13.3.0
Wong list!-( Sorry, Dominique
[PATCH AArch64] Prefer dup to zip for vec_perm_const; enable dup for bigendian; add testcase.
At the moment, for two-element vectors, __builtin_shuffle (vector, (mask) {C, C}) for identical constants C outputs a zip (with both argument vectors the same) rather than a dup. Dup is more obvious and easier to read, so prefer it. For big-endian, aarch64_evpc_dup always aborts; however tests demonstrate it works ok, so enable it. Finally, add a testcase (of execution results, this gives confidence that evpc_dup is ok for bigendian - yes, a different element index is output than for little-endian). Note existing tests for zip are not affected, they always have the two arguments different. gcc/ChangeLog: * config/aarch64/aarch64.c (aarch64_evpc_dup): Enable for bigendian. (aarch64_expand_vec_perm_const): Check for dup before zip. gcc/testsuite/ChangeLog: * gcc.target/aarch64/vdup_n_2.c: New test.diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 4c65bb1dbc190165eee9dd2d9b54779ac4a362fa..153b1c3d282cbfb4872d2b267e763c9ec0ddeb90 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -9157,10 +9157,6 @@ aarch64_evpc_dup (struct expand_vec_perm_d *d) unsigned int i, elt, nelt = d-nelt; rtx lane; - /* TODO: This may not be big-endian safe. */ - if (BYTES_BIG_ENDIAN) -return false; - elt = d-perm[0]; for (i = 1; i nelt; i++) { @@ -9174,7 +9170,7 @@ aarch64_evpc_dup (struct expand_vec_perm_d *d) use d-op0 and need not do any extra arithmetic to get the correct lane number. */ in0 = d-op0; - lane = GEN_INT (elt); + lane = GEN_INT (elt); /* The pattern corrects for big-endian. */ switch (vmode) { @@ -9255,14 +9251,14 @@ aarch64_expand_vec_perm_const_1 (struct expand_vec_perm_d *d) return true; else if (aarch64_evpc_ext (d)) return true; + else if (aarch64_evpc_dup (d)) + return true; else if (aarch64_evpc_zip (d)) return true; else if (aarch64_evpc_uzp (d)) return true; else if (aarch64_evpc_trn (d)) return true; - else if (aarch64_evpc_dup (d)) - return true; return aarch64_evpc_tbl (d); } return false; diff --git a/gcc/testsuite/gcc.target/aarch64/vdup_n_2.c b/gcc/testsuite/gcc.target/aarch64/vdup_n_2.c new file mode 100644 index ..660fb0faeabcc632ae3edb1fb8fa9b96d57a4923 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/vdup_n_2.c @@ -0,0 +1,28 @@ +/* { dg-do run } */ +/* { dg-options -O2 -fno-inline --save-temps } */ + +extern void abort (void); + +typedef float float32x2_t __attribute__ ((__vector_size__ ((8; +typedef unsigned int uint32x2_t __attribute__ ((__vector_size__ ((8; + +float32x2_t +test_dup_1 (float32x2_t in) +{ + return __builtin_shuffle (in, (uint32x2_t) {1, 1}); +} + +int +main (int argc, char **argv) +{ + float32x2_t test = {2.718, 3.141}; + float32x2_t res = test_dup_1 (test); + if (res[0] != test[1] || res[1] != test[1]) +abort (); + return 0; +} + +/* { dg-final { scan-assembler-times \[ \t\]*dup\[ \t\]+v\[0-9\]+\.2s, ?v\[0-9\]+\.s\\\[\[01\]\\\] 1 } } */ +/* { dg-final { scan-assembler-not zip } } */ +/* { dg-final { cleanup-saved-temps } } */ +
Re: [PATCH] Keep patch file permissions in mklog
+if ($inline $diff ne -) { + $tmp = `mktemp`; + if ($? != 0) { + die Could not generate temp file; + } IMHO better use consistent style: system() or ticks with $?. Or let Perl itself create the temporary file: open(my $tmp_fh, +, undef) or die cannot create temp file: $!; or something. Or use File::Temp if you have to. Segher
WIP: Implement Filesystem TS
This is a 99% complete implementation of the Filesystem TS as defined by the N4099 draft, http://open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4099.html The .cc files use C++14 but the headers are C++11 so it can be used by more people. Rather than adding loads of new exports to libstdc++.so the library builds as libstdc++fs.a, so you need to link to that to use it. That might not be a permanent solution, but works for now. To use std::quoted in C++11 headers I had to split the implementation into the public C++14-only definition of std::quoted and the internals which can now be called from elsewhere in the library by C++11 code. It could do with more tests, especially for the directory iterators (I've tested them locally, but doing so needs various files and directories to exist, ideally with un-readable permissions, and that's hard to set up in the testsuite). I haven't prepared a ChangeLog entry yet either, as this is actually 33 separate patches in my local git tree (plus another one for python pretty printers). I'm not in a rush to commit this, but am posting it now for anyone interested (I know Ed wants to see this). Comments and fixes welcome! filesystem.txt.gz Description: application/gzip
[PATCH][ARM/AArch64] Add CRC32 scheduling information to Cortex-A53 and Cortex-A57
Hi all, Now that both backends have a way of generating CRC32 instructions this patch adds the crc type to the scheduling information for the Cortex-A53 and Cortex-A57 cores. For both Cortex-A53 and Cortex-A57 they behave similarly to shifted arithmetic instructions When scheduling for the Cortex-A57 we use the Cortex-A15 pipeline description, so the crc type is added to cortex-a15.md. CRC32 instructions can only be generated when targeting ARMv8-A so this will not affect codegen when tuning for the ARMv7-A Cortex-A15 core. Ok for trunk? 2014-08-04 Kyrylo Tkachov kyrylo.tkac...@arm.com * config/arm/cortex-a15.md (cortex_a15_alu_shift): Add crc type to reservation. * config/arm/cortex-a53.md (cortex_a53_alu_shift): Likewise.commit 5efe4a288368d3fc291aae86ca426acf8716901a Author: Kyrylo Tkachov kyrylo.tkac...@arm.com Date: Tue Jun 17 16:57:55 2014 +0100 [ARM/AArch64] Add scheduling information for CRC32 instructions diff --git a/gcc/config/arm/cortex-a15.md b/gcc/config/arm/cortex-a15.md index 54f3bea..cff9aa2 100644 --- a/gcc/config/arm/cortex-a15.md +++ b/gcc/config/arm/cortex-a15.md @@ -72,11 +72,14 @@ ca15_issue1,(ca15_sx1,ca15_sx1_alu)|(ca15_sx2,ca15_sx2_alu)) ;; ALU ops with immediate shift +;; crc is also included here so that appropriate scheduling of CRC32 ARMv8-A +;; instructions can be performed when tuning for the Cortex-A57 since that +;; core reuses the Cortex-A15 pipeline description for the moment. (define_insn_reservation cortex_a15_alu_shift 3 (and (eq_attr tune cortexa15) (eq_attr type extend,\ alu_shift_imm,alus_shift_imm,\ -logic_shift_imm,logics_shift_imm,\ +crc,logic_shift_imm,logics_shift_imm,\ mov_shift,mvn_shift)) ca15_issue1,(ca15_sx1,ca15_sx1+ca15_sx1_shf,ca15_sx1_alu)\ |(ca15_sx2,ca15_sx2+ca15_sx2_shf,ca15_sx2_alu)) diff --git a/gcc/config/arm/cortex-a53.md b/gcc/config/arm/cortex-a53.md index a629bd6..e342cb2 100644 --- a/gcc/config/arm/cortex-a53.md +++ b/gcc/config/arm/cortex-a53.md @@ -84,7 +84,7 @@ (define_insn_reservation cortex_a53_alu_shift 2 (and (eq_attr tune cortexa53) (eq_attr type alu_shift_imm,alus_shift_imm,\ -logic_shift_imm,logics_shift_imm,\ +crc,logic_shift_imm,logics_shift_imm,\ alu_shift_reg,alus_shift_reg,\ logic_shift_reg,logics_shift_reg,\ extend,mov_shift,mov_shift_reg,\
[GSoC][match-and-simplify] add pointerplus patterns
Added patterns in associate_pointerplus and associate_pointerplus_diff. * genmatch.c (capture_max): Change value to 6. (match-plusminus.pd): Add new patterns. [gcc/testsuite/gcc.dg/tree-ssa] * match-plusminus.c (plusminus_9): New test-case. Thanks, Prathamesh Index: gcc/genmatch.c === --- gcc/genmatch.c (revision 213574) +++ gcc/genmatch.c (working copy) @@ -412,7 +412,7 @@ struct dt_operand: public dt_node struct dt_simplify: public dt_node { static const unsigned level_max = UINT_MAX; - static const unsigned capture_max = 4; + static const unsigned capture_max = 6; simplify *s; unsigned pattern_no; dt_operand *indexes[capture_max]; Index: gcc/match-plusminus.pd === --- gcc/match-plusminus.pd (revision 213574) +++ gcc/match-plusminus.pd (working copy) @@ -106,3 +106,15 @@ along with GCC; see the file COPYING3. (convert @0)) (convert @1)) +/* associate_pointerplus: (ptr p+ off1) p+ off2 - ptr p+ (off1 + off2) */ +(match_and_simplify + (pointer_plus (pointer_plus @0 (convert@1 @2)) +(convert@3 @4)) + (pointer_plus @0 (plus @1 @3))) + +/* associate_pointerplus_diff: ptr1 p+ (ptr2 - ptr1) - ptr2 */ +(match_and_simplify + (pointer_plus @0 + (convert (minus (convert @1) +(convert @2 + @1) Index: gcc/testsuite/gcc.dg/tree-ssa/match-plusminus.c === --- gcc/testsuite/gcc.dg/tree-ssa/match-plusminus.c (revision 213574) +++ gcc/testsuite/gcc.dg/tree-ssa/match-plusminus.c (working copy) @@ -73,4 +73,14 @@ int plusminus_8(int x) } /* { dg-final { scan-tree-dump gimple_match_and_simplified to plusminus_8_val_\\d\+ = 7 - x_\\d\+\\(D\\) forwprop1 } } */ +/* ptr1 p+ (ptr2 - ptr1) - ptr2 */ +unsigned char * +plusminus_9(unsigned char *ptr1, unsigned char *ptr2) +{ + long t1 = ptr2 - ptr1; + unsigned char *plusminus_9_val = ptr1 + t1; + return plusminus_9_val; +} +/* { dg-final { scan-tree-dump gimple_match_and_simplified to plusminus_9_val_\\d\+ = ptr2 forwprop1 } } */ + /* { dg-final { cleanup-tree-dump forwprop2 } } */
Re: [PATCH 5/5] add libcc1
Mike == Mike Stump mikest...@comcast.net writes: Mike So the normal way to do this would be to make the plugin front-end Mike non-default and then never gate any release decisions upon the state Mike of the that front-end. Not sure if this is overly pedantic, but the plugin is just a library, not a front end. It works with the existing C front end. I think the main issue arising here is that the plugin doesn't have any in-tree tests. You have to have gdb to test it. Tom
Re: [GSoC] checking for the loop parallelism
I would expect the to mark the i loop as non-parallel, but the j-loop as parallel. What is the partial schedule, the set of dependences and the dimension you check for both the i and the j loop? Yes, you are right. The i loop is non-parallel and j-loop is parallel. I've found that this substraction “ int dimension = isl_space_dim (schedule_space, isl_dim_out) – 1;” was wrong. The attached patch contains the improved version of checking for the loop parallelism, which passes all the tests from libgomp/testsuite/libgomp.graphite except graphite-isl-ast-to-gimple.c. P.S.: I've added checking of the ux's emptiness and of the x's value, because ux is empty for specific test cases and produces the following error: “/home/roman/graphite_stuff/isl-0.12.2/isl_union_map.c:418: union map needs to contain elements in exactly one space” -- Cheers, Roman Gareev. 2014-08-4 Roman Gareev gareevro...@gmail.com [gcc/] * graphite-isl-ast-to-gimple.c: Add a new struct ast_build_info. (translate_isl_ast_for_loop): Add checking of the flag_loop_parallelize_all. (ast_build_before_for): New function. (scop_to_isl_ast): Add checking of the flag_loop_parallelize_all. * graphite-dependences.c: Move the defenition of the scop_get_dependences from graphite-optimize-isl.c to this file. (apply_schedule_on_deps): Add checking of the ux's emptiness. (carries_deps): Add checking of the x's value. * graphite-optimize-isl.c: Move the defenition of the scop_get_dependences to graphite-dependences.c. * graphite-poly.h: Add declarations of scop_get_dependences and carries_deps. Index: gcc/graphite-dependences.c === --- gcc/graphite-dependences.c (revision 213256) +++ gcc/graphite-dependences.c (working copy) @@ -53,6 +53,35 @@ #include graphite-poly.h #include graphite-htab.h +isl_union_map * +scop_get_dependences (scop_p scop) +{ + isl_union_map *dependences; + + if (!scop-must_raw) +compute_deps (scop, SCOP_BBS (scop), + scop-must_raw, scop-may_raw, + scop-must_raw_no_source, scop-may_raw_no_source, + scop-must_war, scop-may_war, + scop-must_war_no_source, scop-may_war_no_source, + scop-must_waw, scop-may_waw, + scop-must_waw_no_source, scop-may_waw_no_source); + + dependences = isl_union_map_copy (scop-must_raw); + dependences = isl_union_map_union (dependences, +isl_union_map_copy (scop-must_war)); + dependences = isl_union_map_union (dependences, +isl_union_map_copy (scop-must_waw)); + dependences = isl_union_map_union (dependences, +isl_union_map_copy (scop-may_raw)); + dependences = isl_union_map_union (dependences, +isl_union_map_copy (scop-may_war)); + dependences = isl_union_map_union (dependences, +isl_union_map_copy (scop-may_waw)); + + return dependences; +} + /* Add the constraints from the set S to the domain of MAP. */ static isl_map * @@ -263,6 +292,11 @@ ux = isl_union_map_copy (deps); ux = isl_union_map_apply_domain (ux, isl_union_map_copy (trans)); ux = isl_union_map_apply_range (ux, trans); + if (isl_union_map_is_empty (ux)) +{ + isl_union_map_free (ux); + return NULL; +} x = isl_map_from_union_map (ux); return x; @@ -300,7 +334,7 @@ in which all the inputs before DEPTH occur at the same time as the output, and the input at DEPTH occurs before output. */ -static bool +bool carries_deps (__isl_keep isl_union_map *schedule, __isl_keep isl_union_map *deps, int depth) @@ -315,6 +349,8 @@ return false; x = apply_schedule_on_deps (schedule, deps); + if (x == NULL) +return false; space = isl_map_get_space (x); space = isl_space_range (space); lex = isl_map_lex_le (space); Index: gcc/graphite-isl-ast-to-gimple.c === --- gcc/graphite-isl-ast-to-gimple.c(revision 213262) +++ gcc/graphite-isl-ast-to-gimple.c(working copy) @@ -73,6 +73,14 @@ static int graphite_expression_type_precision = 128 = max_mode_int_precision ? 128 : max_mode_int_precision; +struct ast_build_info +{ + ast_build_info() +: is_parallelizable(false) + { }; + bool is_parallelizable; +}; + /* Converts a GMP constant VAL to a tree and returns it. */ static tree @@ -435,7 +443,15 @@ redirect_edge_succ_nodup (next_e, after); set_immediate_dominator (CDI_DOMINATORS, next_e-dest, next_e-src); - /* TODO: Add checking for the loop parallelism. */ + if (flag_loop_parallelize_all) + { +isl_id *id =
Re: [GSoC] checking for the loop parallelism
Sorry for misprint. It passes all the tests from libgomp/testsuite/libgomp.graphite The attached patch contains the improved version of checking for the loop parallelism, which passes all the tests from libgomp/testsuite/libgomp.graphite except graphite-isl-ast-to-gimple.c. -- Cheers, Roman Gareev.
Re: [GSoC] checking for the loop parallelism
On 04/08/2014 16:23, Roman Gareev wrote: I would expect the to mark the i loop as non-parallel, but the j-loop as parallel. What is the partial schedule, the set of dependences and the dimension you check for both the i and the j loop? Yes, you are right. The i loop is non-parallel and j-loop is parallel. I've found that this substraction “ int dimension = isl_space_dim (schedule_space, isl_dim_out) – 1;” was wrong. The attached patch contains the improved version of checking for the loop parallelism, which passes all the tests from libgomp/testsuite/libgomp.graphite except graphite-isl-ast-to-gimple.c. P.S.: I've added checking of the ux's emptiness and of the x's value, because ux is empty for specific test cases and produces the following error: “/home/roman/graphite_stuff/isl-0.12.2/isl_union_map.c:418: union map needs to contain elements in exactly one space” LGTM. Very nice work! Cheers, Tobias
[PATCH 2/2] Support slim LTO bootstrap
From: Andi Kleen a...@linux.intel.com Add a new bootstrap-lto-slim config file that enables slim (non-fat) LTO bootstrap. This improves the performance of the LTO bootstrap. Speeds up the LTO bootstrap by ~18% on a 4 core system. This requires using gcc-ar/ranlib in post stage 1 builds, so these are passed to all sub builds. I made it a new config file for now because it requires the host to support linker plugins, which I believe is not supported everywhere yet? config/: 2014-08-04 Andi Kleen a...@linux.intel.com * bootstrap-lto-slim.mk: New file. /: 2014-08-04 Andi Kleen a...@linux.intel.com * Makefile.tpl (POSTSTAGE1_HOST_EXPORTS): Add LTO_EXPORTS. POSTSTAGE1_FLAGS_TO_PASS): Add LTO_FLAGS_TO_PASS. * Makefile.in: Regenerate. gcc/: 2014-08-04 Andi Kleen a...@linux.intel.com * doc/install.texi: Documentation bootstrap-lto-slim --- Makefile.in | 2 ++ Makefile.tpl | 2 ++ config/bootstrap-lto-slim.mk | 13 + gcc/doc/install.texi | 5 + 4 files changed, 22 insertions(+) create mode 100644 config/bootstrap-lto-slim.mk diff --git a/Makefile.in b/Makefile.in index 329af7f..af59823 100644 --- a/Makefile.in +++ b/Makefile.in @@ -256,6 +256,7 @@ POSTSTAGE1_HOST_EXPORTS = \ $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS; export CC; \ CC_FOR_BUILD=$$CC; export CC_FOR_BUILD; \ $(POSTSTAGE1_CXX_EXPORT) \ + $(LTO_EXPORTS) \ GNATBIND=$$r/$(HOST_SUBDIR)/prev-gcc/gnatbind; export GNATBIND; \ LDFLAGS=$(POSTSTAGE1_LDFLAGS) $(BOOT_LDFLAGS); export LDFLAGS; \ HOST_LIBS=$(POSTSTAGE1_LIBS); export HOST_LIBS; @@ -826,6 +827,7 @@ POSTSTAGE1_FLAGS_TO_PASS = \ GNATBIND=$${GNATBIND} \ LDFLAGS=$${LDFLAGS} \ HOST_LIBS=$${HOST_LIBS} \ + $(LTO_FLAGS_TO_PASS) \ `echo 'ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'` # Flags to pass down to makes which are built with the target environment. diff --git a/Makefile.tpl b/Makefile.tpl index 4822c32..261461a 100644 --- a/Makefile.tpl +++ b/Makefile.tpl @@ -259,6 +259,7 @@ POSTSTAGE1_HOST_EXPORTS = \ $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS; export CC; \ CC_FOR_BUILD=$$CC; export CC_FOR_BUILD; \ $(POSTSTAGE1_CXX_EXPORT) \ + $(LTO_EXPORTS) \ GNATBIND=$$r/$(HOST_SUBDIR)/prev-gcc/gnatbind; export GNATBIND; \ LDFLAGS=$(POSTSTAGE1_LDFLAGS) $(BOOT_LDFLAGS); export LDFLAGS; \ HOST_LIBS=$(POSTSTAGE1_LIBS); export HOST_LIBS; @@ -631,6 +632,7 @@ POSTSTAGE1_FLAGS_TO_PASS = \ GNATBIND=$${GNATBIND} \ LDFLAGS=$${LDFLAGS} \ HOST_LIBS=$${HOST_LIBS} \ + $(LTO_FLAGS_TO_PASS) \ `echo 'ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'` # Flags to pass down to makes which are built with the target environment. diff --git a/config/bootstrap-lto-slim.mk b/config/bootstrap-lto-slim.mk new file mode 100644 index 000..9e065e1 --- /dev/null +++ b/config/bootstrap-lto-slim.mk @@ -0,0 +1,13 @@ +# This option enables LTO for stage2 and stage3 in slim mode + +STAGE2_CFLAGS += -flto=jobserver -frandom-seed=1 +STAGE3_CFLAGS += -flto=jobserver -frandom-seed=1 +STAGEprofile_CFLAGS += -fno-lto + +# assumes the host supports the linker plugin +LTO_AR = $$r/$(HOST_SUBDIR)/prev-gcc/gcc-ar$(exeext) -B$$r/$(HOST_SUBDIR)/prev-gcc/ +LTO_RANLIB = $$r/$(HOST_SUBDIR)/prev-gcc/gcc-ranlib$(exeext) -B$$r/$(HOST_SUBDIR)/prev-gcc/ + +LTO_EXPORTS = AR=$(LTO_AR); export AR; \ + RANLIB=$(LTO_RANLIB); export RANLIB; +LTO_FLAGS_TO_PASS = AR=$(LTO_AR) RANLIB=$(LTO_RANLIB) diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index 31b8c8b..cac2915 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -2377,6 +2377,11 @@ Enables Link-Time Optimization for host tools during bootstrapping. @samp{BUILD_CONFIG=bootstrap-lto} is equivalent to adding @option{-flto} to @samp{BOOT_CFLAGS}. +@item @samp{bootstrap-lto-slim} +Enable slim Link-Time-Optimization for host tools during bootstrapping. +This is a faster version of @code{bootstrap-lto}, but requires +the host to support the linker plugin. + @item @samp{bootstrap-debug} Verifies that the compiler generates the same executable code, whether or not it is asked to emit debug information. To this end, this -- 2.0.1
Implement slim LTO bootstrap
This patchkit implements slim LTO bootstrap to speed up LTO bootstrap by ~18%. Passes LTO and normal bootstrap on x86_64-linux. Ok? -Andi
[PATCH 1/2] Add -B support to gcc-ar/ranlib/nm
From: Andi Kleen a...@linux.intel.com To use gcc-{ar,ranlib} for boot strap we need to add a -B option to the tool. Since ar has weird and unusual argument conventions implement the code by hand instead of using any libraries. gcc/: 2014-08-04 Andi Kleen a...@linux.intel.com * gcc-ar.c (main): Support -B option. --- gcc/gcc-ar.c | 41 + 1 file changed, 41 insertions(+) diff --git a/gcc/gcc-ar.c b/gcc/gcc-ar.c index aebaa92..372e087 100644 --- a/gcc/gcc-ar.c +++ b/gcc/gcc-ar.c @@ -132,9 +132,50 @@ main (int ac, char **av) const char **nargv; bool is_ar = !strcmp (PERSONALITY, ar); int exit_code = FATAL_EXIT_CODE; + int i; setup_prefixes (av[0]); + /* Not using getopt for now. */ + for (i = 0; i ac; i++) + if (!strncmp (av[i], -B, 2)) + { + const char *arg = av[i] + 2; + const char *end; + + memmove (av + i, av + i + 1, sizeof (char *) * ((ac + 1) - i)); + ac--; + if (*arg == 0) + { + arg = av[i] + 1; + if (!arg) + { + fprintf (stderr, Usage: gcc-ar [-B prefix] ar arguments ...\n); + exit (EXIT_FAILURE); + } + memmove (av + i, av + i + 1, sizeof (char *) * ((ac + 1) - i)); + ac--; + i++; + } + + for (end = arg; *end; end++) + ; + end--; + if (end arg *end != '/') + { + char *newarg = (char *)xmalloc (strlen(arg) + 2); + + strcpy (newarg, arg); + strcat (newarg, /); + arg = newarg; + } + + add_prefix (path, arg); + add_prefix (target_path, arg); + break; + } + + /* Find the GCC LTO plugin */ plugin = find_a_file (target_path, LTOPLUGINSONAME, R_OK); if (!plugin) -- 2.0.1
Remove unnecessary and harmful fixincludes for Android
Hi, The following patch disables stdio_va_list fix: stdio.h is already good in Android and, since ndk gcc is indented to be used with different Android sysroots, it is actually harmful, because without this fix only the version of stdio.h from the sysroot the compiler was built with will be used. complier_h_tradcpp fix is removed with this patch. This fix was made for Android, but it is outdated now. linux/compiler.h has been changed and the fix is not being applied anymore. diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog index f7effee..19d70be 100644 --- a/fixincludes/ChangeLog +++ b/fixincludes/ChangeLog @@ -1,3 +1,10 @@ +2014-08-04 Alexander Ivchenko alexander.ivche...@intel.com + + * inclhack.def (stdio_va_list): Disable fix for *android*. + (complier_h_tradcpp): Remove. + * fixincl.x: Regenerate. + * tests/base/linux/compiler.h: Remove. + 2014-04-22 Rainer Orth r...@cebitec.uni-bielefeld.de * inclhack.def (math_exception): Bypass on *-*-solaris2.1[0-9]*. diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x index dd45802..8d6f1f2 100644 --- a/fixincludes/fixincl.x +++ b/fixincludes/fixincl.x @@ -2,11 +2,11 @@ * * DO NOT EDIT THIS FILE (fixincl.x) * - * It has been AutoGen-ed Tuesday January 7, 2014 at 12:02:54 PM MET + * It has been AutoGen-ed August 4, 2014 at 07:07:22 PM by AutoGen 5.12 * From the definitionsinclhack.def * and the template file fixincl */ -/* DO NOT SVN-MERGE THIS FILE, EITHER Tue Jan 7 12:02:54 MET 2014 +/* DO NOT SVN-MERGE THIS FILE, EITHER Mon Aug 4 19:07:23 MSK 2014 * * You must regenerate it. Use the ./genfixes script. * @@ -15,7 +15,7 @@ * certain ANSI-incompatible system header files which are fixed to work * correctly with ANSI C and placed in a directory that GNU C will search. * - * This file contains 224 fixup descriptions. + * This file contains 223 fixup descriptions. * * See README for more information. * @@ -2111,41 +2111,6 @@ int vfscanf(FILE *, const char *, __builtin_va_list) __asm__ (_BSD_STRING(__USER /* * * * * * * * * * * * * * * * * * * * * * * * * * * - * Description of Complier_H_Tradcpp fix - */ -tSCC zComplier_H_TradcppName[] = - complier_h_tradcpp; - -/* - * File name selection pattern - */ -tSCC zComplier_H_TradcppList[] = - linux/compiler.h\0; -/* - * Machine/OS name selection pattern - */ -#define apzComplier_H_TradcppMachs (const char**)NULL - -/* - * content selection pattern - do fix if pattern found - */ -tSCC zComplier_H_TradcppSelect0[] = - #define __builtin_warning\\(x, y\\.\\.\\.\\) \\(1\\); - -#defineCOMPLIER_H_TRADCPP_TEST_CT 1 -static tTestDesc aComplier_H_TradcppTests[] = { - { TT_EGREP,zComplier_H_TradcppSelect0, (regex_t*)NULL }, }; - -/* - * Fix Command Arguments for Complier_H_Tradcpp - */ -static const char* apzComplier_H_TradcppPatch[] = { -format, -/* __builtin_warning(x, y...) is obsolete */, -(char*)NULL }; - -/* * * * * * * * * * * * * * * * * * * * * * * * * * - * * Description of Ctrl_Quotes_Def fix */ tSCC zCtrl_Quotes_DefName[] = @@ -7228,6 +7193,7 @@ tSCC zStdio_Va_ListList[] = */ tSCC* apzStdio_Va_ListMachs[] = { *-*-solaris2.1[0-9]*, +*android*, (const char*)NULL }; /* @@ -9187,9 +9153,9 @@ static const char* apzX11_SprintfPatch[] = { * * List of all fixes */ -#define REGEX_COUNT 261 +#define REGEX_COUNT 260 #define MACH_LIST_SIZE_LIMIT 187 -#define FIX_COUNT224 +#define FIX_COUNT223 /* * Enumerate the fixes @@ -9242,7 +9208,6 @@ typedef enum { BROKEN_CABS_FIXIDX, BROKEN_NAN_FIXIDX, BSD_STDIO_ATTRS_CONFLICT_FIXIDX, -COMPLIER_H_TRADCPP_FIXIDX, CTRL_QUOTES_DEF_FIXIDX, CTRL_QUOTES_USE_FIXIDX, CXX_UNREADY_FIXIDX, @@ -9657,11 +9622,6 @@ tFixDesc fixDescList[ FIX_COUNT ] = { BSD_STDIO_ATTRS_CONFLICT_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, aBsd_Stdio_Attrs_ConflictTests, apzBsd_Stdio_Attrs_ConflictPatch, 0 }, - { zComplier_H_TradcppName,zComplier_H_TradcppList, - apzComplier_H_TradcppMachs, - COMPLIER_H_TRADCPP_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, - aComplier_H_TradcppTests, apzComplier_H_TradcppPatch, 0 }, - { zCtrl_Quotes_DefName,zCtrl_Quotes_DefList, apzCtrl_Quotes_DefMachs, CTRL_QUOTES_DEF_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def index 6a1136c..cd3ad2d 100644 --- a/fixincludes/inclhack.def +++ b/fixincludes/inclhack.def @@ -1140,20 +1140,6 @@ fix = { }; /* - * Old Linux kernel's compiler.h header breaks Traditional CPP - */ -fix = { -hackname = complier_h_tradcpp; -files = linux/compiler.h; - -select= #define __builtin_warning\\(x, y\\.\\.\\.\\) \\(1\\); -c_fix = format; -c_fix_arg = /* __builtin_warning(x, y...) is obsolete */; - -test_text = #define __builtin_warning(x, y...) (1); -}; - -/* * Fix various macros used to define
[PATCH] Fix bootstrap failure because of -Wreturn-local-addr
Hi! I've tried to bootstrap with r213515 because later revisions broke because of the hash_map and Ada changes, but unfortunately even that revision failus to bootstrap, the new -Wreturn-local-addr warning rightfully warns about get_ivts_expr possibly returning address of a local variable. It seems that n_loc is always 1 and loc[0] is always 1, already since 4.0 when these loop-unroll.c changes have been introduced, so I think the best fix is just to remove those two fields. Bootstrapped/regtested (with r213515, rtl checking) on x86_64-linux and i686-linux, ok for trunk? 2014-08-04 Jakub Jelinek ja...@redhat.com * loop-unroll.c (struct iv_to_split): Remove n_loc and loc fields. (analyze_iv_to_split_insn): Don't initialize them. (get_ivts_expr): Removed. (allocate_basic_variable, insert_base_initialization): Use SET_SRC instead of *get_ivts_expr. (split_iv): Use SET_SRC instead of get_ivts_expr. --- gcc/loop-unroll.c.jj2014-06-24 16:41:55.0 +0200 +++ gcc/loop-unroll.c 2014-08-04 14:13:35.750917507 +0200 @@ -79,11 +79,6 @@ struct iv_to_split iterations are based. */ rtx step;/* Step of the induction variable. */ struct iv_to_split *next; /* Next entry in walking order. */ - unsigned n_loc; - unsigned loc[3]; /* Location where the definition of the induction - variable occurs in the insn. For example if - N_LOC is 2, the expression is located at - XEXP (XEXP (single_set, loc[0]), loc[1]). */ }; /* Information about accumulators to expand. */ @@ -1942,8 +1937,6 @@ analyze_iv_to_split_insn (rtx insn) ivts-base_var = NULL_RTX; ivts-step = iv.step; ivts-next = NULL; - ivts-n_loc = 1; - ivts-loc[0] = 1; return ivts; } @@ -2080,27 +2073,12 @@ determine_split_iv_delta (unsigned n_cop } } -/* Locate in EXPR the expression corresponding to the location recorded - in IVTS, and return a pointer to the RTX for this location. */ - -static rtx * -get_ivts_expr (rtx expr, struct iv_to_split *ivts) -{ - unsigned i; - rtx *ret = expr; - - for (i = 0; i ivts-n_loc; i++) -ret = XEXP (*ret, ivts-loc[i]); - - return ret; -} - /* Allocate basic variable for the induction variable chain. */ static void allocate_basic_variable (struct iv_to_split *ivts) { - rtx expr = *get_ivts_expr (single_set (ivts-insn), ivts); + rtx expr = SET_SRC (single_set (ivts-insn)); ivts-base_var = gen_reg_rtx (GET_MODE (expr)); } @@ -2111,7 +2089,7 @@ allocate_basic_variable (struct iv_to_sp static void insert_base_initialization (struct iv_to_split *ivts, rtx insn) { - rtx expr = copy_rtx (*get_ivts_expr (single_set (insn), ivts)); + rtx expr = copy_rtx (SET_SRC (single_set (insn))); rtx seq; start_sequence (); @@ -2146,7 +2124,7 @@ split_iv (struct iv_to_split *ivts, rtx } /* Figure out where to do the replacement. */ - loc = get_ivts_expr (single_set (insn), ivts); + loc = SET_SRC (single_set (insn)); /* If we can make the replacement right away, we're done. */ if (validate_change (insn, loc, expr, 0)) Jakub
Re: [PATCH] Add D demangling support to libiberty
On Sun, Aug 3, 2014 at 11:12 AM, Iain Buclaw ibuc...@gdcproject.org wrote: This adds a demangler for the D programming language to libiberty, intended to be used in GDB and Binutils. GDB already has a trimmed down implementation of this, but have been advised that here would be a better location to house it. Notes that I think are of interest / questions I have about how I've done this. - The implementation is some 1200 SLOC (and may grow), so I've put it in a new file, as opposed included cplus-dem.c. Is this reasonable? Yes. - This borrows and extends the mini string package in cplus-dem.c, because it was the simplest to use when writing this. The GDB implementation uses obstack, and I'm aware of dyn_string, but I can't say I'm a fan of using either. One thing we discovered for the C++ demangler is that sometimes it's nice to be able to invoke it from locations where the memory allocator is not available, such as when the program is crashing. That is why the C++ demangler has a cplus_demangle_v3_callback entry point. For ordinary demangling the code uses growable_string and d_growable_string_callback_adapter. It's not important for now but you may want to consider doing something like that in the future. If you do choose to follow that path, because of namespace considerations I think the right approach would be to move the growable_string code and the adapter into a .h file in libiberty that defines the functions as static. Then both demanglers could #include that file. That would let them share the code without adding unacceptable new symbols to libstdc++. - GDB has a testsuite that provides most of the coverage for what this code should be doing. That is nice but we need a small testsuite in libiberty too--see libiberty/testsuite/test-demangle.c and demangle-expected. Ideally you should be able to just add some entries to demangle-expected. - List of functions in d-demangle.c can be added to the ChangeLog upon request. Not necessary. - I haven't signed any copyright assignments to GCC. But I have papers from Donald ready to send across. Definitely necessary before we can consider this. Please get this squared away before proceeding with this patch. Let us know if you need any help with this. +#ifdef HAVE_STDLIB_H +#include stdlib.h +#else +long strtol (const char *nptr, char **endptr, int base); +long double strtold (const char *nptr, char **endptr); Use an explicit extern. +#define ASCII2HEX(c) \ + (('a' = (c) (c) = 'f') ? \ + ((c) - 'a' + 10) \ + : (('A' = (c) (c) = 'F') ? \ + ((c) - 'A' + 10) \ + : (('0' = (c) (c) = '9') ? \ + ((c) - '0') \ + : 0 \ +) \ + ) \ + ) Use a function, not a macro that multiple-evaluates its argument. +/* Prototypes for D demangling functions */ Current style is to only forward declare functions when necessary. +const char * +dlang_call_convention (string *decl, const char *mangled) This should be explicitly static. Same applies to many of the functions below. Ian
Re: [PATCH] Add D demangling support to libiberty
Iain == Iain Buclaw ibuc...@gdcproject.org writes: Iain This adds a demangler for the D programming language to libiberty, Iain intended to be used in GDB and Binutils. GDB already has a trimmed Iain down implementation of this, but have been advised that here would be Iain a better location to house it. Iain - GDB has a testsuite that provides most of the coverage for what this Iain code should be doing. I think it's better to put the tests into libiberty. That way they are right next to the code. This shouldn't be hard, as there's already a demangler test suite there. Tom
[committed] Fix GOMP_taskgroup_end
Hi! As can be seen on the depend-8.c testcase, only trying to schedule taskgroup-children in GOMP_taskgroup_end can lead to deadlock if depend clauses are involved - some task in the current taskgroup can depend on a task with the same parent, but from another taskgroup (one of the parent taskgroups). This patch will schedule taskgroup-children if available, but if there are none and taskgroup-num_children is still non-zero, attempts to schedule parent-children. num_children is increased on deferred task creation, so it includes tasks in the taskgroup waiting on dependencies, while children linked list includes only tasks ready to be scheduled. Bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk and 4.9 branch. 2014-08-04 Jakub Jelinek ja...@redhat.com * task.c (GOMP_taskgroup_end): If taskgroup-num_children is not zero, but taskgroup-children is NULL and there are any task-children, schedule those instead of waiting. * testsuite/libgomp.c/depend-6.c: New test. * testsuite/libgomp.c/depend-7.c: New test. * testsuite/libgomp.c/depend-8.c: New test. * testsuite/libgomp.c/depend-9.c: New test. * testsuite/libgomp.c/depend-10.c: New test. --- libgomp/task.c.jj 2014-08-01 10:04:11.0 +0200 +++ libgomp/task.c 2014-08-04 10:02:10.931449395 +0200 @@ -1115,18 +1115,26 @@ GOMP_taskgroup_end (void) if (taskgroup-children == NULL) { if (taskgroup-num_children) - goto do_wait; - gomp_mutex_unlock (team-task_lock); - if (to_free) { - gomp_finish_task (to_free); - free (to_free); + if (task-children == NULL) + goto do_wait; + child_task = task-children; +} + else + { + gomp_mutex_unlock (team-task_lock); + if (to_free) + { + gomp_finish_task (to_free); + free (to_free); + } + goto finish; } - goto finish; } - if (taskgroup-children-kind == GOMP_TASK_WAITING) + else + child_task = taskgroup-children; + if (child_task-kind == GOMP_TASK_WAITING) { - child_task = taskgroup-children; cancelled = gomp_task_run_pre (child_task, child_task-parent, taskgroup, team); @@ -1143,6 +1151,7 @@ GOMP_taskgroup_end (void) } else { + child_task = NULL; do_wait: /* All tasks we are waiting for are already running in other threads. Wait for them. */ @@ -1174,20 +1183,9 @@ GOMP_taskgroup_end (void) finish_cancelled:; size_t new_tasks = gomp_task_run_post_handle_depend (child_task, team); - child_task-prev_taskgroup-next_taskgroup - = child_task-next_taskgroup; - child_task-next_taskgroup-prev_taskgroup - = child_task-prev_taskgroup; - --taskgroup-num_children; - if (taskgroup-children == child_task) - { - if (child_task-next_taskgroup != child_task) - taskgroup-children = child_task-next_taskgroup; - else - taskgroup-children = NULL; - } gomp_task_run_post_remove_parent (child_task); gomp_clear_parent (child_task-children); + gomp_task_run_post_remove_taskgroup (child_task); to_free = child_task; child_task = NULL; team-task_count--; --- libgomp/testsuite/libgomp.c/depend-6.c.jj 2014-08-04 10:31:59.877674051 +0200 +++ libgomp/testsuite/libgomp.c/depend-6.c 2014-08-04 10:31:28.531825917 +0200 @@ -0,0 +1,3 @@ +/* { dg-set-target-env-var OMP_NUM_THREADS 1 } */ + +#include depend-1.c --- libgomp/testsuite/libgomp.c/depend-7.c.jj 2014-08-04 10:31:59.877674051 +0200 +++ libgomp/testsuite/libgomp.c/depend-7.c 2014-08-04 10:32:06.328641868 +0200 @@ -0,0 +1,3 @@ +/* { dg-set-target-env-var OMP_NUM_THREADS 1 } */ + +#include depend-2.c --- libgomp/testsuite/libgomp.c/depend-8.c.jj 2014-08-04 10:31:59.877674051 +0200 +++ libgomp/testsuite/libgomp.c/depend-8.c 2014-08-04 10:32:12.556611152 +0200 @@ -0,0 +1,3 @@ +/* { dg-set-target-env-var OMP_NUM_THREADS 1 } */ + +#include depend-3.c --- libgomp/testsuite/libgomp.c/depend-9.c.jj 2014-08-04 10:31:59.877674051 +0200 +++ libgomp/testsuite/libgomp.c/depend-9.c 2014-08-04 10:32:18.501579242 +0200 @@ -0,0 +1,3 @@ +/* { dg-set-target-env-var OMP_NUM_THREADS 1 } */ + +#include depend-4.c --- libgomp/testsuite/libgomp.c/depend-10.c.jj 2014-08-04 10:31:59.877674051 +0200 +++ libgomp/testsuite/libgomp.c/depend-10.c 2014-08-04 10:32:25.070548201 +0200 @@ -0,0 +1,3 @@ +/* { dg-set-target-env-var OMP_NUM_THREADS 1 } */ + +#include depend-5.c Jakub
Re: Prepare gcc for 64-bit obstacks
Alan == Alan Modra amo...@gmail.com writes: Alan Bootstrapped and regression tested x86_64-linux and powerpc-linux, Alan with both the new obstack.{h,c} and the old versions. OK to apply? Alan gcc/java/ Alan * mangle.c (finish_mangling): Cast result of obstack_base to (char *). Alan * typeck.c (build_java_argument_signature): Likewise. Alan (build_java_signature): Likewise. Alan libcpp/ Alan * symtab.c (ht_create): Use obstack_specify_allocation in place of Alan _obstack_begin. Alan * files.c (_cpp_init_files): Likewise. Alan * init.c (cpp_create_reader): Likewise. Alan * identifiers.c (_cpp_init_hashtable): Likewise. Thanks Alan. The java and libcpp bits are ok. Tom
[C++ Patch/RFC] PR 43906
Hi, I suppose we can quickly resolve, one way or another, this rather old issue. Considering: extern void z(); void h() { if ( z != (void*)0 ); } we -Waddress warn in C and we don't in C++, due to the rather subtle differences between null_pointer_constant_p and null_ptr_cst_p. I believe we could as well warn in C++ too, but then I'm afraid we have to handle the case specially, like in the below. What do you think? Thanks! Paolo. // Index: cp/typeck.c === --- cp/typeck.c (revision 213573) +++ cp/typeck.c (working copy) @@ -4353,12 +4353,11 @@ cp_build_binary_op (location_t location, (code1 == INTEGER_TYPE || code1 == REAL_TYPE || code1 == COMPLEX_TYPE || code1 == ENUMERAL_TYPE)) short_compare = 1; - else if ((code0 == POINTER_TYPE code1 == POINTER_TYPE) - || (TYPE_PTRDATAMEM_P (type0) TYPE_PTRDATAMEM_P (type1))) - result_type = composite_pointer_type (type0, type1, op0, op1, - CPO_COMPARISON, complain); else if ((code0 == POINTER_TYPE || TYPE_PTRDATAMEM_P (type0)) - null_ptr_cst_p (op1)) + (null_ptr_cst_p (op1) + /* Handle (void*)0 too. */ + || (TYPE_PTR_P (type1) VOID_TYPE_P (TREE_TYPE (type1)) + integer_zerop (op1 { if (TREE_CODE (op0) == ADDR_EXPR decl_with_nonnull_addr_p (TREE_OPERAND (op0, 0))) @@ -4371,7 +4370,10 @@ cp_build_binary_op (location_t location, result_type = type0; } else if ((code1 == POINTER_TYPE || TYPE_PTRDATAMEM_P (type1)) - null_ptr_cst_p (op0)) + (null_ptr_cst_p (op0) + /* Handle (void*)0 too. */ + || (TYPE_PTR_P (type0) VOID_TYPE_P (TREE_TYPE (type0)) + integer_zerop (op0 { if (TREE_CODE (op1) == ADDR_EXPR decl_with_nonnull_addr_p (TREE_OPERAND (op1, 0))) @@ -4383,6 +4385,10 @@ cp_build_binary_op (location_t location, } result_type = type1; } + else if ((code0 == POINTER_TYPE code1 == POINTER_TYPE) + || (TYPE_PTRDATAMEM_P (type0) TYPE_PTRDATAMEM_P (type1))) + result_type = composite_pointer_type (type0, type1, op0, op1, + CPO_COMPARISON, complain); else if (null_ptr_cst_p (op0) null_ptr_cst_p (op1)) /* One of the operands must be of nullptr_t type. */ result_type = TREE_TYPE (nullptr_node); Index: testsuite/g++.dg/warn/Waddress-1.C === --- testsuite/g++.dg/warn/Waddress-1.C (revision 0) +++ testsuite/g++.dg/warn/Waddress-1.C (working copy) @@ -0,0 +1,7 @@ +// PR c++/43906 +// { dg-options -Waddress } + +extern void z(); +void f() { if ( z ) z(); } // { dg-warning address } +void g() { if ( z != 0 ) z(); } // { dg-warning address } +void h() { if ( z != (void*)0 ) z(); } // { dg-warning address }
[PATCH][AArch64] Implement some vmul*_lane*_f* intrinsics in arm_neon.h
Hi all, As part of other intrinsics-related messing around due to the float64x1_t changes I noticed these can be (re)implemented relatively easily. Tested on aarch64-none-elf and aarch64_be-none-elf to make sure the lane-wise intrinsics do the right thing. Ok for trunk? 2014-08-04 Kyrylo Tkachov kyrylo.tkac...@arm.com * config/aarch64/arm_neon.h (vmul_f64): New intrinsic. (vmuld_laneq_f64): Likewise. (vmuls_laneq_f32): Likewise. (vmul_n_f64): Likewise. (vmuld_lane_f64): Reimplement in C. (vmuls_lane_f32): Likewise. 2014-08-04 Kyrylo Tkachov kyrylo.tkac...@arm.com * gcc.target/aarch64/simd/vmul_f64_1.c: New test. * gcc.target/aarch64/simd/vmul_n_f64_1.c: Likewise. * gcc.target/aarch64/simd/vmuld_lane_f64_1.c: Likewise. * gcc.target/aarch64/simd/vmuld_laneq_f64_1.c: Likewise. * gcc.target/aarch64/simd/vmuls_lane_f32_1.c: Likewise. * gcc.target/aarch64/simd/vmuls_laneq_f32_1.c: Likewise.commit c1ba193030ba81fd69669036c7f706a957f44b5d Author: Kyrylo Tkachov kyrylo.tkac...@arm.com Date: Wed Jun 25 15:00:35 2014 +0100 [Needs-tests][AArch64] Implement some vmul* intrinsics diff --git a/gcc/config/aarch64/arm_neon.h b/gcc/config/aarch64/arm_neon.h index 3e26345..b23fa64 100644 --- a/gcc/config/aarch64/arm_neon.h +++ b/gcc/config/aarch64/arm_neon.h @@ -1277,6 +1277,12 @@ vmul_f32 (float32x2_t __a, float32x2_t __b) return __a * __b; } +__extension__ static __inline float64x1_t __attribute__ ((__always_inline__)) +vmul_f64 (float64x1_t __a, float64x1_t __b) +{ + return __a * __b; +} + __extension__ static __inline uint8x8_t __attribute__ ((__always_inline__)) vmul_u8 (uint8x8_t __a, uint8x8_t __b) { @@ -8299,19 +8305,6 @@ vmul_n_u32 (uint32x2_t a, uint32_t b) return result; } -#define vmuld_lane_f64(a, b, c) \ - __extension__ \ -({ \ - float64x2_t b_ = (b);\ - float64_t a_ = (a); \ - float64_t result;\ - __asm__ (fmul %d0,%d1,%2.d[%3] \ -: =w(result) \ -: w(a_), w(b_), i(c) \ -: /* No clobbers */); \ - result; \ - }) - #define vmull_high_lane_s16(a, b, c)\ __extension__ \ ({ \ @@ -8828,19 +8821,6 @@ vmulq_n_u32 (uint32x4_t a, uint32_t b) return result; } -#define vmuls_lane_f32(a, b, c) \ - __extension__ \ -({ \ - float32x4_t b_ = (b);\ - float32_t a_ = (a); \ - float32_t result;\ - __asm__ (fmul %s0,%s1,%2.s[%3] \ -: =w(result) \ -: w(a_), w(b_), i(c) \ -: /* No clobbers */); \ - result; \ - }) - __extension__ static __inline float32x2_t __attribute__ ((__always_inline__)) vmulx_f32 (float32x2_t a, float32x2_t b) { @@ -19041,6 +19021,34 @@ vmul_lane_u32 (uint32x2_t __a, uint32x2_t __b, const int __lane) return __a * __aarch64_vget_lane_u32 (__b, __lane); } +/* vmuld_lane */ + +__extension__ static __inline float64_t __attribute__ ((__always_inline__)) +vmuld_lane_f64 (float64_t __a, float64x1_t __b, const int __lane) +{ + return __a * vget_lane_f64 (__b, __lane); +} + +__extension__ static __inline float64_t __attribute__ ((__always_inline__)) +vmuld_laneq_f64 (float64_t __a, float64x2_t __b, const int __lane) +{ + return __a * vgetq_lane_f64 (__b, __lane); +} + +/* vmuls_lane */ + +__extension__ static __inline float32_t __attribute__ ((__always_inline__)) +vmuls_lane_f32 (float32_t __a, float32x2_t __b, const int __lane) +{ + return __a * vget_lane_f32 (__b, __lane); +} + +__extension__ static __inline float32_t __attribute__ ((__always_inline__)) +vmuls_laneq_f32 (float32_t __a, float32x4_t __b, const int __lane) +{ + return __a * vgetq_lane_f32 (__b, __lane); +} + /* vmul_laneq */ __extension__ static __inline float32x2_t __attribute__ ((__always_inline__)) @@ -19079,6 +19087,14 @@ vmul_laneq_u32
Re: [PATCH] Add D demangling support to libiberty
On 4 August 2014 16:52, Ian Lance Taylor i...@google.com wrote: On Sun, Aug 3, 2014 at 11:12 AM, Iain Buclaw ibuc...@gdcproject.org wrote: This adds a demangler for the D programming language to libiberty, intended to be used in GDB and Binutils. GDB already has a trimmed down implementation of this, but have been advised that here would be a better location to house it. Notes that I think are of interest / questions I have about how I've done this. - The implementation is some 1200 SLOC (and may grow), so I've put it in a new file, as opposed included cplus-dem.c. Is this reasonable? Yes. - This borrows and extends the mini string package in cplus-dem.c, because it was the simplest to use when writing this. The GDB implementation uses obstack, and I'm aware of dyn_string, but I can't say I'm a fan of using either. One thing we discovered for the C++ demangler is that sometimes it's nice to be able to invoke it from locations where the memory allocator is not available, such as when the program is crashing. That is why the C++ demangler has a cplus_demangle_v3_callback entry point. For ordinary demangling the code uses growable_string and d_growable_string_callback_adapter. It's not important for now but you may want to consider doing something like that in the future. If you do choose to follow that path, because of namespace considerations I think the right approach would be to move the growable_string code and the adapter into a .h file in libiberty that defines the functions as static. Then both demanglers could #include that file. That would let them share the code without adding unacceptable new symbols to libstdc++. - GDB has a testsuite that provides most of the coverage for what this code should be doing. That is nice but we need a small testsuite in libiberty too--see libiberty/testsuite/test-demangle.c and demangle-expected. Ideally you should be able to just add some entries to demangle-expected. OK, I'll examine this. - List of functions in d-demangle.c can be added to the ChangeLog upon request. Not necessary. - I haven't signed any copyright assignments to GCC. But I have papers from Donald ready to send across. Definitely necessary before we can consider this. Please get this squared away before proceeding with this patch. Let us know if you need any help with this. I'll let you know when it's been processed. Last time they had a fast turnaround. +#ifdef HAVE_STDLIB_H +#include stdlib.h +#else +long strtol (const char *nptr, char **endptr, int base); +long double strtold (const char *nptr, char **endptr); Use an explicit extern. +#define ASCII2HEX(c) \ + (('a' = (c) (c) = 'f') ? \ + ((c) - 'a' + 10) \ + : (('A' = (c) (c) = 'F') ? \ + ((c) - 'A' + 10) \ + : (('0' = (c) (c) = '9') ? \ + ((c) - '0') \ + : 0 \ +) \ + ) \ + ) Use a function, not a macro that multiple-evaluates its argument. +/* Prototypes for D demangling functions */ Current style is to only forward declare functions when necessary. +const char * +dlang_call_convention (string *decl, const char *mangled) This should be explicitly static. Same applies to many of the functions below. I've dealt with the above, but I'll re-submit the patch when I've added in the testsuite items. Regards Iain
Re: [PATCH] Add D demangling support to libiberty
On 4 August 2014 17:06, Tom Tromey tro...@redhat.com wrote: Iain == Iain Buclaw ibuc...@gdcproject.org writes: Iain This adds a demangler for the D programming language to libiberty, Iain intended to be used in GDB and Binutils. GDB already has a trimmed Iain down implementation of this, but have been advised that here would be Iain a better location to house it. Iain - GDB has a testsuite that provides most of the coverage for what this Iain code should be doing. I think it's better to put the tests into libiberty. That way they are right next to the code. This shouldn't be hard, as there's already a demangler test suite there. Tom I've found it, thanks.
Re: [PATCH] Fix bootstrap failure because of -Wreturn-local-addr
On Mon, 4 Aug 2014, Jakub Jelinek wrote: I've tried to bootstrap with r213515 because later revisions broke because of the hash_map and Ada changes, but unfortunately even that revision failus to bootstrap, the new -Wreturn-local-addr warning rightfully warns about get_ivts_expr possibly returning address of a local variable. It seems that n_loc is always 1 and loc[0] is always 1, already since 4.0 when these loop-unroll.c changes have been introduced, so I think the best fix is just to remove those two fields. Thanks, that will fix PR 62005. I'll try to remember to test with RTL checking for the next warning patch. -- Marc Glisse
[PATCH][AArch64] Implement some saturating math NEON intrinsics
Hi all, This patch implements some saturating math *laneq_s* intrinsics. The implementation is fairly straightforward, just use more general mode iterators, add appropriate builtins etc. Some execution tests are added with some scan-assembly parts to make sure we generate the correct lane number for both big and little endian versions of the lanewise intrinsics. Tested aarch64-none-elf, aarch64_be-none-elf and bootstrapped on aarch64-linux. Ok for trunk? 2014-08-04 Kyrylo Tkachov kyrylo.tkac...@arm.com * config/aarch64/aarch64-simd.md (aarch64_sqdmulh_laneqmode): Use VSDQ_HSI mode iterator. (aarch64_sqrdmulh_laneqmode): Likewise. (aarch64_sqrdmulh_laneqmode_internal): New define_insn. * config/aarch64/aarch64-simd-builtins.def (sqdmulh_laneq): Use BUILTIN_VDQHS macro. (sqrdmulh_laneq): Likewise. * config/aarch64/arm_neon.h (vqdmlalh_laneq_s16): New intrinsic. (vqdmlals_laneq_s32): Likewise. (vqdmlslh_laneq_s16): Likewise. (vqdmlsls_laneq_s32): Likewise. (vqdmulhh_laneq_s16): Likewise. (vqdmulhs_laneq_s32): Likewise. (vqrdmulhh_laneq_s16): Likewise. (vqrdmulhs_laneq_s32): Likewise. 2014-08-04 Kyrylo Tkachov kyrylo.tkac...@arm.com * gcc.target/aarch64/simd/vqdmlalh_laneq_s16_1.c: New test. * gcc.target/aarch64/simd/vqdmlals_laneq_s32_1.c: Likewise. * gcc.target/aarch64/simd/vqdmlslh_laneq_s16_1.c: Likewise. * gcc.target/aarch64/simd/vqdmlsls_laneq_s32_1.c: Likewise. * gcc.target/aarch64/simd/vqdmulhh_laneq_s16_1.c: Likewise. * gcc.target/aarch64/simd/vqdmulhs_laneq_s32_1.c: Likewise. * gcc.target/aarch64/simd/vqrdmulhh_laneq_s16_1.c: Likewise. * gcc.target/aarch64/simd/vqrdmulhs_laneq_s32_1.c: Likewise.commit 53142c1282ab6a902ed8c5c1afc5089657c4437a Author: Kyrylo Tkachov kyrylo.tkac...@arm.com Date: Tue Jun 17 13:33:57 2014 +0100 [AArch64] Implement some saturating math *laneq_s* intrinsics diff --git a/gcc/config/aarch64/aarch64-simd-builtins.def b/gcc/config/aarch64/aarch64-simd-builtins.def index 268432c..a33b151 100644 --- a/gcc/config/aarch64/aarch64-simd-builtins.def +++ b/gcc/config/aarch64/aarch64-simd-builtins.def @@ -192,9 +192,9 @@ BUILTIN_VSDQ_HSI (BINOP, sqrdmulh, 0) /* Implemented by aarch64_sqrdmulh_laneqmode. */ BUILTIN_VDQHS (TERNOP, sqdmulh_lane, 0) - BUILTIN_VDQHS (TERNOP, sqdmulh_laneq, 0) + BUILTIN_VSDQ_HSI (TERNOP, sqdmulh_laneq, 0) BUILTIN_VDQHS (TERNOP, sqrdmulh_lane, 0) - BUILTIN_VDQHS (TERNOP, sqrdmulh_laneq, 0) + BUILTIN_VSDQ_HSI (TERNOP, sqrdmulh_laneq, 0) BUILTIN_SD_HSI (TERNOP, sqdmulh_lane, 0) BUILTIN_SD_HSI (TERNOP, sqrdmulh_lane, 0) diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md index 6300b9b..39faf2f 100644 --- a/gcc/config/aarch64/aarch64-simd.md +++ b/gcc/config/aarch64/aarch64-simd.md @@ -2793,8 +2793,8 @@ ) (define_expand aarch64_sqdmulh_laneqmode - [(match_operand:VDQHS 0 register_operand ) - (match_operand:VDQHS 1 register_operand ) + [(match_operand:VSDQ_HSI 0 register_operand ) + (match_operand:VSDQ_HSI 1 register_operand ) (match_operand:VCONQ 2 register_operand ) (match_operand:SI 3 immediate_operand )] TARGET_SIMD @@ -2810,8 +2810,8 @@ ) (define_expand aarch64_sqrdmulh_laneqmode - [(match_operand:VDQHS 0 register_operand ) - (match_operand:VDQHS 1 register_operand ) + [(match_operand:VSDQ_HSI 0 register_operand ) + (match_operand:VSDQ_HSI 1 register_operand ) (match_operand:VCONQ 2 register_operand ) (match_operand:SI 3 immediate_operand )] TARGET_SIMD @@ -2890,6 +2890,21 @@ [(set_attr type neon_sat_mul_Vetype_scalarq)] ) +(define_insn aarch64_sqrdmulh_laneqmode_internal + [(set (match_operand:SD_HSI 0 register_operand =w) +(unspec:SD_HSI + [(match_operand:SD_HSI 1 register_operand w) + (vec_select:VEL + (match_operand:VCONQ 2 register_operand vwx) + (parallel [(match_operand:SI 3 immediate_operand i)]))] + VQDMULH))] + TARGET_SIMD + * + operands[3] = GEN_INT (ENDIAN_LANE_N (VCONQmode, INTVAL (operands[3]))); + return \sqrdmulh\\t%v0, %v1, %2.v[%3]\; + [(set_attr type neon_sat_mul_Vetype_scalarq)] +) + ;; vqdml[sa]l (define_insn aarch64_sqdmlSBINQOPS:aslmode diff --git a/gcc/config/aarch64/arm_neon.h b/gcc/config/aarch64/arm_neon.h index 66968e8..3e26345 100644 --- a/gcc/config/aarch64/arm_neon.h +++ b/gcc/config/aarch64/arm_neon.h @@ -19426,6 +19426,12 @@ vqdmlalh_lane_s16 (int32x1_t __a, int16x1_t __b, int16x4_t __c, const int __d) return __builtin_aarch64_sqdmlal_lanehi (__a, __b, __c, __d); } +__extension__ static __inline int32_t __attribute__ ((__always_inline__)) +vqdmlalh_laneq_s16 (int32_t __a, int16_t __b, int16x8_t __c, const int __d) +{ + return __builtin_aarch64_sqdmlal_laneqhi (__a, __b, __c, __d); +} + __extension__ static __inline int64_t __attribute__ ((__always_inline__)) vqdmlals_s32 (int64_t __a, int32x1_t __b, int32x1_t __c) { @@ -19439,6 +19445,12
[PATCH][AArch64] Fix types for vqdmlals_lane_s32 and vqdmlsls_lane_s32 intrinsics
Hi all, Now that uint64x1_t and uint64_t are not interchangeable these intrinsics have an incorrect type. The reason is that these intrinsics should have had the scalar type for some of their arguments and results according to the NEON intrinsics spec. This patch fixes that and updates the relevant tests. Tested on aarch64-none-elf and bootstrapped on aarch64-linux. Ok for trunk? 2014-08-04 Kyrylo Tkachov kyrylo.tkac...@arm.com * config/aarch64/arm_neon.h (vqdmlals_lane_s32): Use scalar types rather than singleton vectors. (vqdmlsls_lane_s32): Likewise. 2014-08-04 Kyrylo Tkachov kyrylo.tkac...@arm.com * gcc.target/aarch64/scalar_intrinsics.c (test_vqdmlals_lane_s32): Fix types. (test_vqdmlsls_lane_s32): Likewise. * gcc.target/aarch64/simd/vqdmlals_lane_s32.c: Likewise. * gcc.target/aarch64/simd/vqdmlsls_lane_s32.c: Likewise.commit 4ad448d1d1d6f2c3376a04ab29b7d719870c932c Author: Kyrylo Tkachov kyrylo.tkac...@arm.com Date: Thu Jun 26 10:34:04 2014 +0100 [AArch64] Fix vqdmlsls_lane_s32 and vqdmlals_lane_s32 types diff --git a/gcc/config/aarch64/arm_neon.h b/gcc/config/aarch64/arm_neon.h index b466b0e..7807181 100644 --- a/gcc/config/aarch64/arm_neon.h +++ b/gcc/config/aarch64/arm_neon.h @@ -19453,11 +19453,10 @@ vqdmlals_s32 (int64_t __a, int32x1_t __b, int32x1_t __c) return __builtin_aarch64_sqdmlalsi (__a, __b, __c); } -__extension__ static __inline int64x1_t __attribute__ ((__always_inline__)) -vqdmlals_lane_s32 (int64x1_t __a, int32x1_t __b, int32x2_t __c, const int __d) +__extension__ static __inline int64_t __attribute__ ((__always_inline__)) +vqdmlals_lane_s32 (int64_t __a, int32_t __b, int32x2_t __c, const int __d) { - return (int64x1_t) - {__builtin_aarch64_sqdmlal_lanesi (__a[0], __b, __c, __d)}; + return __builtin_aarch64_sqdmlal_lanesi (__a, __b, __c, __d); } __extension__ static __inline int64_t __attribute__ ((__always_inline__)) @@ -19592,10 +19591,10 @@ vqdmlsls_s32 (int64_t __a, int32x1_t __b, int32x1_t __c) return __builtin_aarch64_sqdmlslsi (__a, __b, __c); } -__extension__ static __inline int64x1_t __attribute__ ((__always_inline__)) -vqdmlsls_lane_s32 (int64x1_t __a, int32x1_t __b, int32x2_t __c, const int __d) +__extension__ static __inline int64_t __attribute__ ((__always_inline__)) +vqdmlsls_lane_s32 (int64_t __a, int32_t __b, int32x2_t __c, const int __d) { - return (int64x1_t) {__builtin_aarch64_sqdmlsl_lanesi (__a[0], __b, __c, __d)}; + return __builtin_aarch64_sqdmlsl_lanesi (__a, __b, __c, __d); } __extension__ static __inline int64_t __attribute__ ((__always_inline__)) diff --git a/gcc/testsuite/gcc.target/aarch64/scalar_intrinsics.c b/gcc/testsuite/gcc.target/aarch64/scalar_intrinsics.c index 624348e..afdbf01 100644 --- a/gcc/testsuite/gcc.target/aarch64/scalar_intrinsics.c +++ b/gcc/testsuite/gcc.target/aarch64/scalar_intrinsics.c @@ -390,8 +390,8 @@ test_vqdmlals_s32 (int64_t a, int32x1_t b, int32x1_t c) /* { dg-final { scan-assembler-times \\tsqdmlal\\td\[0-9\]+, s\[0-9\]+, v 1 } } */ -int64x1_t -test_vqdmlals_lane_s32 (int64x1_t a, int32x1_t b, int32x2_t c) +int64_t +test_vqdmlals_lane_s32 (int64_t a, int32_t b, int32x2_t c) { return vqdmlals_lane_s32 (a, b, c, 1); } @@ -422,8 +422,8 @@ test_vqdmlsls_s32 (int64_t a, int32x1_t b, int32x1_t c) /* { dg-final { scan-assembler-times \\tsqdmlsl\\td\[0-9\]+, s\[0-9\]+, v 1 } } */ -int64x1_t -test_vqdmlsls_lane_s32 (int64x1_t a, int32x1_t b, int32x2_t c) +int64_t +test_vqdmlsls_lane_s32 (int64_t a, int32_t b, int32x2_t c) { return vqdmlsls_lane_s32 (a, b, c, 1); } diff --git a/gcc/testsuite/gcc.target/aarch64/simd/vqdmlals_lane_s32.c b/gcc/testsuite/gcc.target/aarch64/simd/vqdmlals_lane_s32.c index ef94e95..38352c5 100644 --- a/gcc/testsuite/gcc.target/aarch64/simd/vqdmlals_lane_s32.c +++ b/gcc/testsuite/gcc.target/aarch64/simd/vqdmlals_lane_s32.c @@ -5,8 +5,8 @@ #include arm_neon.h -int64x1_t -t_vqdmlals_lane_s32 (int64x1_t a, int32x1_t b, int32x2_t c) +int64_t +t_vqdmlals_lane_s32 (int64_t a, int32_t b, int32x2_t c) { return vqdmlals_lane_s32 (a, b, c, 0); } diff --git a/gcc/testsuite/gcc.target/aarch64/simd/vqdmlsls_lane_s32.c b/gcc/testsuite/gcc.target/aarch64/simd/vqdmlsls_lane_s32.c index 9e351bc..3c60898 100644 --- a/gcc/testsuite/gcc.target/aarch64/simd/vqdmlsls_lane_s32.c +++ b/gcc/testsuite/gcc.target/aarch64/simd/vqdmlsls_lane_s32.c @@ -5,8 +5,8 @@ #include arm_neon.h -int64x1_t -t_vqdmlsls_lane_s32 (int64x1_t a, int32x1_t b, int32x2_t c) +int64_t +t_vqdmlsls_lane_s32 (int64_t a, int32_t b, int32x2_t c) { return vqdmlsls_lane_s32 (a, b, c, 0); }
Re: [PATCH][optabs.c] Fix PR 61713: ICE when expanding single-threaded version of atomic_test_and_set
On 25/07/14 23:05, Jeff Law wrote: On 07/23/14 02:53, Kyrill Tkachov wrote: Darn, had forgotten to attach the patch... On 16/07/14 12:30, Kyrill Tkachov wrote: Hi all, This fixes the PR mentioned in the subject. When expanding atomic_test_and_set we try the corresponding sync optabs and if none exist, like for pre-SMP ARM architectures (-march=armv6 and earlier) the code in optabs.c reverts to a single-threaded implementation that just does a load and store. However, if the result of the operation is to be ignored the code in builtins.c follows the convention that the target RTX is set to const0_rtx to signify that the result is ignored and the expand functions in optabs.c are supposed to check for that and act appropriately. The code in the single-threaded codepath in expand_atomic_test_and_set in optabs.c didn't perform this check and instead tried to emit a move to a const0_rtx which ICEs further down the line. This patch fixes that by checking if the result is ignored, and if it is omits the load. I wouldn't dare to remove the load in normal atomic handling code due to all the memory ordering subtleties, but this code path occurs only when we have a trivially single-threaded bare-metal target and the compiler assumes no races anyway and no dodgy context switches and tries to implement this with a ldrb+strb, so I think removing the ldrb is valid. Bootstrapped on arm, aarch64 and x86 and tested as well. Ok for trunk? This appears on 4.9 as well, I'll test it on that branch as well 2014-07-16 Kyrylo Tkachov kyrylo.tkac...@arm.com PR target/61713 * gcc/optabs.c (expand_atomic_test_and_set): Do not try to emit move to subtarget in serial version if result is ignored. OK. jeff Thanks Jeff, Is this ok for the 4.9 branch as well if testing comes back ok? (It applies cleanly there.) Kyrill
Re: [RFC: Patch, PR 60102] [4.9/4.10 Regression] powerpc fp-bit ices@dwf_regno
Committed on trunk, revision 213596 Committed on 4.9 branch, revision 213597 I made an omission on the first commit. I did not add the test case and corresponding ChangeLog entry. Committed as obvious on trunk, revision 213598 Thanks Edmar On 08/04/2014 05:25 AM, Ulrich Weigand wrote: David Edelsohn wrote: On Fri, Aug 1, 2014 at 2:03 PM, rohitarul...@freescale.com rohitarul...@freescale.com wrote: [libgcc] 2014-07-31 Rohitrohitarul...@freescale.com * config/rs6000/linux-unwind.h (ppc_fallback_frame_state): Update based on change in SPE high register numbers and 3 HTM registers. [gcc] 2014-07-31 Rohitrohitarul...@freescale.com * config/rs6000/rs6000.c (rs6000_reg_names) : Add SPE high register names. (alt_reg_names) : Likewise. (rs6000_dwarf_register_span) : For SPE high registers, replace dwarf register numbers with GCC hard register numbers. (rs6000_init_dwarf_reg_sizes_extra) : Likewise. (rs6000_dbx_register_number): For SPE high registers, return dwarf register number for the corresponding GCC hard register number. * config/rs6000/rs6000.h (FIRST_PSEUDO_REGISTER) : Update based on 32 newly added GCC hard register numbers for SPE high registers. (DWARF_FRAME_REGISTERS) : Likewise. (DWARF_REG_TO_UNWIND_COLUMN) : Likewise. (DWARF_FRAME_REGNUM) : Likewise. (FIXED_REGISTERS) : Likewise. (CALL_USED_REGISTERS) : Likewise. (CALL_REALLY_USED_REGISTERS) : Likewise. (REG_ALLOC_ORDER) : Likewise. (enum reg_class) : Likewise. (REG_CLASS_NAMES) : Likewise. (REG_CLASS_CONTENTS) : Likewise. (SPE_HIGH_REGNO_P) : New macro to identify SPE high registers. * gcc.target/powerpc/pr60102.c: New testcase. The patch is okay with me if Uli is satisfied. Yes, this is fine with me. Bye, Ulrich
[PATCH] Add patch for debugging compiler ICEs.
Hi, A years ago there was a discussion (https://gcc.gnu.org/ml/gcc-patches/2004-01/msg02437.html) about debugging compiler ICEs that resulted in a patch from Jakub, which dumps useful information into temporary file, but for some reasons this patch wasn't applied to trunk. This is the resurrected patch with added GCC version information into generated repro file. I've updated the patch that I've posted earlier (https://gcc.gnu.org/ml/gcc-patches/2014-07/msg01649.html ) according to recent upstream discussion (https://gcc.gnu.org/ml/gcc-patches/2014-08/msg00020.html). The debugging functionality is disabled by default and can be enabled with adding -freport-bug into compile options. It can be also enabled by default with --with-spec during GCC build. There are several directions in which this can be improved e.g: 1) more user-friendly ways to report bugs (autosubmitting to Bugzilla, etc.) 2) generate repro in case of segfault. but having basic functionality (autogenerating reprocase in temprorary file) already seems quite useful. -Maxim 2014-08-04 Jakub Jelinek ja...@redhat.com Max Ostapenko m.ostape...@partner.samsung.com * common.opt: New option. * doc/invoke.texi: Describe new option. * diagnostic.c (diagnostic_action_after_output): Exit with ICE_EXIT_CODE instead of FATAL_EXIT_CODE. * gcc.c (execute): Don't free first string early, but at the end of the function. Call retry_ice if compiler exited with ICE_EXIT_CODE. (main): Factor out common code. (print_configuration): New function. (try_fork): Likewise. (redirect_stdout_stderr): Likewise. (files_equal_p): Likewise. (check_repro): Likewise. (run_attempt): Likewise. (do_report_bug): Likewise. (append_text): Likewise. (try_generate_repro): Likewise diff --git a/gcc/common.opt b/gcc/common.opt index 0c4f86b..aa79250 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -1120,6 +1120,11 @@ fdump-noaddr Common Report Var(flag_dump_noaddr) Suppress output of addresses in debugging dumps +freport-bug +Common Driver Var(flag_report_bug) +Collect and dump debug information into temporary file if ICE in C/C++ +compiler occured. + fdump-passes Common Var(flag_dump_passes) Init(0) Dump optimization passes diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c index 0cc7593..67b8c5b 100644 --- a/gcc/diagnostic.c +++ b/gcc/diagnostic.c @@ -492,7 +492,7 @@ diagnostic_action_after_output (diagnostic_context *context, real_abort (); diagnostic_finish (context); fnotice (stderr, compilation terminated.\n); - exit (FATAL_EXIT_CODE); + exit (ICE_EXIT_CODE); default: gcc_unreachable (); diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 4f327df..dafb573 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -6271,6 +6271,11 @@ feasible to use diff on debugging dumps for compiler invocations with different compiler binaries and/or different text / bss / data / heap / stack / dso start locations. +@item -freport-bug +@opindex freport-bug +Collect and dump debug information into temporary file if ICE in C/C++ +compiler occured. + @item -fdump-unnumbered @opindex fdump-unnumbered When doing debugging dumps, suppress instruction numbers and address output. diff --git a/gcc/gcc.c b/gcc/gcc.c index 44d0416..f7a56d1 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -43,6 +43,13 @@ compilation is specified by a string called a spec. */ #include params.h #include vec.h #include filenames.h +#ifdef HAVE_UNISTD_H +#include unistd.h +#endif + +#if !(defined (__MSDOS__) || defined (OS2) || defined (VMS)) +#define RETRY_ICE_SUPPORTED +#endif /* By default there is no special suffix for target executables. */ /* FIXME: when autoconf is fixed, remove the host check - dj */ @@ -253,6 +260,9 @@ static void init_gcc_specs (struct obstack *, const char *, const char *, static const char *convert_filename (const char *, int, int); #endif +#ifdef RETRY_ICE_SUPPORTED +static void try_generate_repro (const char *prog, const char **argv); +#endif static const char *getenv_spec_function (int, const char **); static const char *if_exists_spec_function (int, const char **); static const char *if_exists_else_spec_function (int, const char **); @@ -2849,7 +2859,7 @@ execute (void) } } - if (string != commands[i].prog) + if (i string != commands[i].prog) free (CONST_CAST (char *, string)); } @@ -2902,6 +2912,17 @@ execute (void) else if (WIFEXITED (status) WEXITSTATUS (status) = MIN_FATAL_STATUS) { +#ifdef RETRY_ICE_SUPPORTED + /* For ICEs in cc1, cc1obj, cc1plus see if it is + reproducible or not. */ + const char *p; + if (flag_report_bug + WEXITSTATUS (status) == ICE_EXIT_CODE + i == 0 + (p = strrchr (commands[0].argv[0], DIR_SEPARATOR)) + ! strncmp (p + 1, cc1, 3)) + try_generate_repro (commands[0].prog, commands[0].argv); +#endif if (WEXITSTATUS (status) greatest_status) greatest_status
Re: [PATCH][Ping v5] Add patch for debugging compiler ICEs
Thanks Jeff and Jakub, I've reposted ICE debugging patch into gcc-patches mailing list (https://gcc.gnu.org/ml/gcc-patches/2014-08/msg00285.html). -Maxim On 08/01/2014 11:29 PM, Jeff Law wrote: On 08/01/14 02:00, Jakub Jelinek wrote: On Thu, Jul 24, 2014 at 04:39:28PM +0400, Maxim Ostapenko wrote: Ping. Don't want to review a patch I wrote partially, so just a few comments: 1) IMHO it should be configure time selectable (not sure about the default, but for non-release branches IMHO it should default to off, for release branches I don't know). The point is that while it is useful for people to report gcc bugs in production compilers, it is not useful for gcc developers on their boxes, having ICEs take 3 times as long is not desirable for people who deal with those all the time We definitely want the ability to select. Waiting on an ICE to trigger 3 times would be painful for the developers. So I'd think that enabled for the release branches and disabled for the trunk would be the right default. 2) recently a bug has been reported that some ICEs which print RTL to stderr are considered non-reproduceable, because the addresses e.g. in call_insn fndecl change through address space randomization. For the retries the driver should supposedly append -fdump-noaddr. Right. I think we discussed this at Cauldron. I think it's conceptually ok with those two changes, then it's just reviewing the details. If you or Maxim could make those changes and repost, I'll cover the review. jeff
Re: [patch] Update catch(...) handlers to deal with __forced_unwind
On 16 July 2014 17:22, Uros Bizjak ubiz...@gmail.com wrote: On Fri, Jun 6, 2014 at 4:31 PM, Jonathan Wakely jwak...@redhat.com wrote: On 06/06/14 12:40 +0200, Uros Bizjak wrote: On Fri, Jun 6, 2014 at 11:19 AM, Jonathan Wakely jwak...@redhat.com wrote: On 06/06/14 10:27 +0200, Uros Bizjak wrote: These two tests timeout on alpha-linux-gnu: FAIL: 30_threads/async/forced_unwind.cc execution test WARNING: program timed out. FAIL: 30_threads/packaged_task/forced_unwind.cc execution test WARNING: program timed out. Sorry about that, I don't know why. Does pthread_exit(0) use a __forced_unwind exception on alpha-linux-gnu? This should tell you ... #include bits/cxxabi_forced.h #include pthread.h void* f(void*) { try { pthread_exit(0); } catch (__cxxabiv1::__forced_unwind const) { __builtin_puts(unwind); throw; } catch (...) { __builtin_puts(something else); throw; } } int main() { pthread_t t; pthread_create(t, 0, f, 0); pthread_join(t, 0); } Strange, I don't get anything ... $ g++ -lpthread pt.C $ ./a.out That explains it then: the thread just goes away, and the waiting function hangs forever expecting the future to be made ready. The test assumes pthread_exit is implemented by throwing __forced_unwind, which apparently isn't true for all glibc targets. If the thread just goes away there's no way to make the future ready. I guess we should just XFAIL it for alpha, and maybe other targets. Actually, the testcase uncovered a target bug in glibc NPTL, where saved stack pointer value in jmp_buf is not mangled as expected by unwind_stop function. The detailed analysis is available at [1]. [1] https://sourceware.org/bugzilla/show_bug.cgi?id=17165 Uros. Uros, would backporting this to the 4.9 branch cause problems for alpha? I assume since the change is already on trunk and the glibc bug is already fixed that putting it on the 4.9 branch wouldn't make things any worse than they are now? The change is needed to make the code correct in the face of pthread cancellations.
Re: [PATCH][optabs.c] Fix PR 61713: ICE when expanding single-threaded version of atomic_test_and_set
On 08/04/14 10:54, Kyrill Tkachov wrote: On 25/07/14 23:05, Jeff Law wrote: On 07/23/14 02:53, Kyrill Tkachov wrote: Darn, had forgotten to attach the patch... On 16/07/14 12:30, Kyrill Tkachov wrote: Hi all, This fixes the PR mentioned in the subject. When expanding atomic_test_and_set we try the corresponding sync optabs and if none exist, like for pre-SMP ARM architectures (-march=armv6 and earlier) the code in optabs.c reverts to a single-threaded implementation that just does a load and store. However, if the result of the operation is to be ignored the code in builtins.c follows the convention that the target RTX is set to const0_rtx to signify that the result is ignored and the expand functions in optabs.c are supposed to check for that and act appropriately. The code in the single-threaded codepath in expand_atomic_test_and_set in optabs.c didn't perform this check and instead tried to emit a move to a const0_rtx which ICEs further down the line. This patch fixes that by checking if the result is ignored, and if it is omits the load. I wouldn't dare to remove the load in normal atomic handling code due to all the memory ordering subtleties, but this code path occurs only when we have a trivially single-threaded bare-metal target and the compiler assumes no races anyway and no dodgy context switches and tries to implement this with a ldrb+strb, so I think removing the ldrb is valid. Bootstrapped on arm, aarch64 and x86 and tested as well. Ok for trunk? This appears on 4.9 as well, I'll test it on that branch as well 2014-07-16 Kyrylo Tkachov kyrylo.tkac...@arm.com PR target/61713 * gcc/optabs.c (expand_atomic_test_and_set): Do not try to emit move to subtarget in serial version if result is ignored. OK. jeff Thanks Jeff, Is this ok for the 4.9 branch as well if testing comes back ok? (It applies cleanly there.) Yes. jeff
Re: [PATCH] add hash_set
On 08/04/14 11:15, Trevor Saunders wrote: On Sat, Aug 02, 2014 at 03:44:17PM -0700, Andrew Pinski wrote: On Tue, Jul 29, 2014 at 5:50 AM, tsaund...@mozilla.com wrote: From: Trevor Saunders tsaund...@mozilla.com Hi, this adds a hash_set wrapper around hash_table, and then replaces usage of pointer_set with it. bootstrapped +regtested on x86_64-unknown-linux-gnu, ok? Trev ada/ * gcc-interface/trans.c: Use hash_set instead of pointer_set. c-family/ * c-gimplify.c: Use hash_set instead of pointer_set. c/ * c-decl.c: Use hash_set instead of pointer_set. cp/ * class.c, cp-gimplify.c, cp-tree.h, decl.c, decl2.c, error.c, method.c, name-lookup.c, pt.c, semantics.c, tree.c: Use hash_set instead of pointer_set. fortran/ * openmp.c, trans-decl.c: Use hash_set instead of pointer_set. gcc/ * hash-set.h: new File. * cfgexpand.c, cfgloop.c, cgraph.c, cgraphbuild.c, cgraphunit.c, cprop.c, cse.c, gimple-walk.c, gimple-walk.h, gimplify.c, godump.c, ipa-devirt.c, ipa-pure-const.c, ipa-visibility.c, ipa.c, lto-cgraph.c, lto-streamer-out.c, stmt.c, tree-cfg.c, tree-core.h, tree-eh.c, tree-inline.c, tree-inline.h, tree-nested.c, tree-pretty-print.c, tree-ssa-loop-niter.c, tree-ssa-phiopt.c, tree-ssa-threadedge.c, tree-ssa-uninit.c, tree.c, tree.h, value-prof.c, varasm.c, varpool.c: Use hash_set instead of pointer_set. This changelog is less than useful and really does not follow the GCC/GNU coding style. Please expand and place all functions which are I'm pretty sure its written somewhere that format is ok, and there's precedent for it. Note the update all callers rule could also be used to just write Note we discussed this at Cauldron and there was a general consensus that the update all callers style was reasonable. FWIW, that's actually be approved for use in GCC for a very long time. We've allowed using that style, without having to list each function changed, since the late 90s. jeff
Re: Go 1.3 update broke Solaris bootstrap
On Tue, Jul 22, 2014 at 1:14 AM, Rainer Orth r...@cebitec.uni-bielefeld.de wrote: The recent Go 1.3 update (which I couldn't find posted to gcc-patches) broke Solaris bootstrap: /vol/gcc/src/hg/trunk/local/libgo/runtime/mem.c:50:20: error: pointer targets in passing argument 1 of 'mincore' differ in signedness [-Werror=pointer-sign] errval = mincore((int8*)v + off, chunk, vec); ^ In file included from /vol/gcc/src/hg/trunk/local/libgo/runtime/runtime.h:22:0, from /vol/gcc/src/hg/trunk/local/libgo/runtime/mem.c:8: /usr/include/sys/mman.h:232:12: note: expected 'caddr_t' but argument is of type 'int8 *' extern int mincore(caddr_t, size_t, char *); ^ /vol/gcc/src/hg/trunk/local/libgo/runtime/mem.c:50:43: error: pointer targets in passing argument 3 of 'mincore' differ in signedness [-Werror=pointer-sign] errval = mincore((int8*)v + off, chunk, vec); ^ In file included from /vol/gcc/src/hg/trunk/local/libgo/runtime/runtime.h:22:0, from /vol/gcc/src/hg/trunk/local/libgo/runtime/mem.c:8: /usr/include/sys/mman.h:232:12: note: expected 'char *' but argument is of type 'byte *' extern int mincore(caddr_t, size_t, char *); ^ The following patch restores it, though there are certainly other options (uint8* for the v cast, a void* cast for vec). Thanks. I had to adjust your patch to work on GNU/Linux, for which the third argument to mincore is unsigned char *. This is what I've committed to mainline after a bootstrap and testsuite run on x86_64-unknown-linux-gnu. Ian diff -r 95e1b9f06590 libgo/runtime/mem.c --- a/libgo/runtime/mem.c Fri Aug 01 17:43:51 2014 -0700 +++ b/libgo/runtime/mem.c Mon Aug 04 10:46:17 2014 -0700 @@ -47,7 +47,7 @@ chunk = page_size * sizeof vec; if(chunk (n - off)) chunk = n - off; - errval = mincore((int8*)v + off, chunk, vec); + errval = mincore((char*)v + off, chunk, (void*)vec); // ENOMEM means unmapped, which is what we want. // Anything else we assume means the pages are mapped. if(errval == 0 || errno != ENOMEM)
Re: [patch] Update catch(...) handlers to deal with __forced_unwind
On Mon, Aug 4, 2014 at 7:29 PM, Jonathan Wakely jwakely@gmail.com wrote: These two tests timeout on alpha-linux-gnu: FAIL: 30_threads/async/forced_unwind.cc execution test WARNING: program timed out. FAIL: 30_threads/packaged_task/forced_unwind.cc execution test WARNING: program timed out. Sorry about that, I don't know why. Does pthread_exit(0) use a __forced_unwind exception on alpha-linux-gnu? This should tell you ... #include bits/cxxabi_forced.h #include pthread.h void* f(void*) { try { pthread_exit(0); } catch (__cxxabiv1::__forced_unwind const) { __builtin_puts(unwind); throw; } catch (...) { __builtin_puts(something else); throw; } } int main() { pthread_t t; pthread_create(t, 0, f, 0); pthread_join(t, 0); } Strange, I don't get anything ... $ g++ -lpthread pt.C $ ./a.out That explains it then: the thread just goes away, and the waiting function hangs forever expecting the future to be made ready. The test assumes pthread_exit is implemented by throwing __forced_unwind, which apparently isn't true for all glibc targets. If the thread just goes away there's no way to make the future ready. I guess we should just XFAIL it for alpha, and maybe other targets. Actually, the testcase uncovered a target bug in glibc NPTL, where saved stack pointer value in jmp_buf is not mangled as expected by unwind_stop function. The detailed analysis is available at [1]. [1] https://sourceware.org/bugzilla/show_bug.cgi?id=17165 Uros. Uros, would backporting this to the 4.9 branch cause problems for alpha? No, I don't think so. The problem was identified as glibc bug that was fixed almost a year ago for 2.18. I assume since the change is already on trunk and the glibc bug is already fixed that putting it on the 4.9 branch wouldn't make things any worse than they are now? No. As said before, it is not gcc's fault. Uros.
Re: [PATCH] add hash_set
On Aug 4, 2014, at 10:46 AM, Trevor Saunders tsaund...@mozilla.com wrote: I had a conflict which is why I noticed this issue in the first place. And I was using git merge :). I bet git log or blaim would get you better data faster. So, git merging I would recommend: [merge] conflictstyle = diff3 [rerere] enabled = 1 if you don’t already. I think diff3 should be the default it is so handy.
Re: [patch] libstdc++/61374 fix string_view conversion and update to latest draft
On 01/06/14 18:24 +0100, Jonathan Wakely wrote: Tested x86_64-linux, committed to trunk. This should probably go on the 4.9 branch too, although we could leave the old default cosntructor semantics and just fix the conversion operator. Now committed to the 4.9 branch too. PR libstdc++/61374 * include/experimental/string_view (operator basic_string): Correct order of arguments. (to_string): Replace with member function. Add inline specifiers. Remove unused header. Remove _S_empty_rep and allow _M_str to be null. * testsuite/experimental/string_view/cons/char/1.cc: Adjust to new default constructor semantics. * testsuite/experimental/string_view/cons/wchar_t/1.cc: Likewise. * testsuite/experimental/string_view/operations/copy/char/1.cc: Fix copyright dates. Remove unused header. * testsuite/experimental/string_view/operations/copy/wchar_t/1.cc: Likewise. * testsuite/experimental/string_view/operations/data/char/1.cc: Fix copyright dates. Adjust to new default constructor semantics. * testsuite/experimental/string_view/operations/data/wchar_t/1.cc: Likewise. * testsuite/experimental/string_view/operations/to_string/1.cc: New.
Re: [patch] Update catch(...) handlers to deal with __forced_unwind
On 04/08/14 19:59 +0200, Uros Bizjak wrote: On Mon, Aug 4, 2014 at 7:29 PM, Jonathan Wakely jwakely@gmail.com wrote: Uros, would backporting this to the 4.9 branch cause problems for alpha? No, I don't think so. The problem was identified as glibc bug that was fixed almost a year ago for 2.18. I assume since the change is already on trunk and the glibc bug is already fixed that putting it on the 4.9 branch wouldn't make things any worse than they are now? No. As said before, it is not gcc's fault. Great - committed to the 4.9 branch.