Re: RFA: Testsuite PATCH to add support for dlopen tests
On Thu, Apr 10, 2014 at 02:18:26PM +0100, Ramana Radhakrishnan wrote: > I see failures from last night on aarch64-none-elf and arm-none-eabi > (both bare-metal) configurations even after moving up to dejagnu > 1.5.1. If this can't be fixed easily should we consider reverting this > patch in the interest of getting sane test results on bare-metal > targets before the release ? > > Should we also update the prereqs page to say dejagnu 1.5.1 ? > (http://gcc.gnu.org/install/prerequisites.html) Jason has disabled the problematic test temporarily last night, can you please verify bare-metal cross-testing now works? Thanks. Jakub
Re: Fix indirect call profiling for COMDAT symbols
On 04/11/2014 08:00 AM, Jan Hubicka wrote: Hi, while looking into firefox profiles, I noticed that we miss devirtualizations to comdat symbols, because we manage to get different profile_id in each unit. This is easily fixed by the following patch that makes profiled_id to by crc32 of the symbol name in this case. Bootstrapped/regtested x86_64-linux, tested with firefox, will commit it tomorrow. * coverage.c (coverage_compute_profile_id): Make stable for global symbols * ipa-utils.c (ipa_merge_profiles): Merge profile_id. * lto/lto-symtab.c (lto_cgraph_replace_node): Don't re-merge tp_first_run. Index: coverage.c === --- coverage.c (revision 209170) +++ coverage.c (working copy) @@ -555,18 +555,31 @@ coverage_compute_lineno_checksum (void) unsigned coverage_compute_profile_id (struct cgraph_node *n) { - expanded_location xloc -= expand_location (DECL_SOURCE_LOCATION (n->decl)); - unsigned chksum = xloc.line; + unsigned chksum; - chksum = coverage_checksum_string (chksum, xloc.file); - chksum = coverage_checksum_string -(chksum, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (n->decl))); - if (first_global_object_name) -chksum = coverage_checksum_string - (chksum, first_global_object_name); - chksum = coverage_checksum_string -(chksum, aux_base_name); + /* Externally visible symbols have unique name. */ + if (TREE_PUBLIC (n->decl) || DECL_EXTERNAL (n->decl)) +{ + /* Do not use coverage_checksum_string here; we really want unique +symbol name id. */ + chksum = crc32_string + (0, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (n->decl))); +} + else +{ + expanded_location xloc + = expand_location (DECL_SOURCE_LOCATION (n->decl)); + + chksum = xloc.line; + chksum = coverage_checksum_string (chksum, xloc.file); + chksum = coverage_checksum_string + (chksum, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (n->decl))); + if (first_global_object_name) + chksum = coverage_checksum_string + (chksum, first_global_object_name); + chksum = coverage_checksum_string + (chksum, aux_base_name); +} /* Non-negative integers are hopefully small enough to fit in all targets. */ return chksum & 0x7fff; Index: ipa-utils.c === --- ipa-utils.c (revision 209170) +++ ipa-utils.c (working copy) @@ -660,6 +660,21 @@ ipa_merge_profiles (struct cgraph_node * if (dst->tp_first_run > src->tp_first_run && src->tp_first_run) dst->tp_first_run = src->tp_first_run; + if (src->profile_id) +{ + if (!dst->profile_id) + dst->profile_id = src->profile_id; + else + { +if (src->profile_id != dst->profile_id) + { +dump_cgraph_node (stderr, src); +dump_cgraph_node (stderr, dst); + } +gcc_assert (src->profile_id == dst->profile_id); + } +} + if (!dst->count) return; if (cgraph_dump_file) Index: lto/lto-symtab.c === --- lto/lto-symtab.c(revision 209170) +++ lto/lto-symtab.c(working copy) @@ -91,12 +91,6 @@ lto_cgraph_replace_node (struct cgraph_n if (node->decl != prevailing_node->decl) cgraph_release_function_body (node); - /* Time profile merging */ - if (node->tp_first_run) -prevailing_node->tp_first_run = prevailing_node->tp_first_run ? - MIN (prevailing_node->tp_first_run, node->tp_first_run) : - node->tp_first_run; - Hello Honza, I just want to ask if this time profile merging is not necessary any more? Martin /* Finally remove the replaced node. */ cgraph_remove_node (node); }
[Patch, GCC/Thumb1] Improve 64bit constant load for Thumb1
Hi there, Current gcc prefers to using two LDR instructions to load 64bit constants. This could miss some chances that 64bit load can be done in fewer instructions or fewer cycles. For example, below code to load 0x10001 mov r0, #1 mov r1, #1 is better than current solution: ldr r1, .L2+4 ldr r0, .L2 .L2: .word 1 .word 1 The attached patch intends to split 64bit load to take advantage of such chances. Tested with gcc regression test on cortex-m0. No new regressions. Is it ok to stage 1? BR, Terry gcc/ 2014-04-11 Terry Guo * config/arm/arm.md (split 64-bit constant for Thumb1): New split pattern. gcc/testsuite/ 2014-04-11 Terry Guo * gcc.target/arm/thumb1-load-64bit-constant-1.c: New test. * gcc.target/arm/thumb1-load-64bit-constant-2.c: Ditto. * gcc.target/arm/thumb1-load-64bit-constant-3.c: Ditto.diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md index 2ddda02..b339e83 100644 --- a/gcc/config/arm/arm.md +++ b/gcc/config/arm/arm.md @@ -6422,7 +6422,26 @@ (set_attr "pool_range" "*,*,*,*,*,*,1018,*,*") (set_attr "conds" "set,clob,*,*,nocond,nocond,nocond,nocond,nocond")]) -(define_split +; Split the load of 64-bit constant into two loads for high and low 32-bit parts respectively +; to see if we can load them in fewer instructions or fewer cycles. +; For the small 64-bit integer constants that satisfy constraint J, the instruction pattern +; thumb1_movdi_insn has a better way to handle them. +(define_split + [(set (match_operand:ANY64 0 "arm_general_register_operand" "") + (match_operand:ANY64 1 "const_double_operand" ""))] + "TARGET_THUMB1 && reload_completed && !satisfies_constraint_J (operands[1])" + [(set (match_dup 0) (match_dup 1)) + (set (match_dup 2) (match_dup 3))] + " + operands[2] = gen_highpart (SImode, operands[0]); + operands[3] = gen_highpart_mode (SImode, GET_MODE (operands[0]), + operands[1]); + operands[0] = gen_lowpart (SImode, operands[0]); + operands[1] = gen_lowpart (SImode, operands[1]); + " +) + +(define_split [(set (match_operand:SI 0 "register_operand" "") (match_operand:SI 1 "const_int_operand" ""))] "TARGET_THUMB1 && satisfies_constraint_J (operands[1])" diff --git a/gcc/testsuite/gcc.target/arm/thumb1-load-64bit-constant-1.c b/gcc/testsuite/gcc.target/arm/thumb1-load-64bit-constant-1.c new file mode 100644 index 000..9537aaf --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/thumb1-load-64bit-constant-1.c @@ -0,0 +1,14 @@ +/* { dg-require-effective-target arm_thumb1_ok } */ +/* { dg-do compile } */ +/* { dg-options "-Os" } */ +/* { dg-skip-if "" { ! { arm_thumb1 } } } */ + +extern long long madd (long long a, long long b); + +long long +foo () +{ + return madd (0x00010001LL, 0x01110001LL); +} + +/* { dg-final { scan-assembler-not "ldr" } } */ diff --git a/gcc/testsuite/gcc.target/arm/thumb1-load-64bit-constant-2.c b/gcc/testsuite/gcc.target/arm/thumb1-load-64bit-constant-2.c new file mode 100644 index 000..836682b --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/thumb1-load-64bit-constant-2.c @@ -0,0 +1,14 @@ +/* { dg-require-effective-target arm_thumb1_ok } */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +/* { dg-skip-if "" { ! { arm_thumb1 } } } */ + +extern long long madd (long long a); + +long long +foo () +{ + return madd (0x00010001LL); +} + +/* { dg-final { scan-assembler-not "ldr" } } */ diff --git a/gcc/testsuite/gcc.target/arm/thumb1-load-64bit-constant-3.c b/gcc/testsuite/gcc.target/arm/thumb1-load-64bit-constant-3.c new file mode 100644 index 000..cf4d0be --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/thumb1-load-64bit-constant-3.c @@ -0,0 +1,14 @@ +/* { dg-require-effective-target arm_thumb1_ok } */ +/* { dg-do compile } */ +/* { dg-options "-Os" } */ +/* { dg-skip-if "" { ! { arm_thumb1 } } } */ + +long long +foo (int len) +{ + return (long long) (((long long) 1 << len) - 1); +} + +/* { dg-final { scan-assembler-not "ldr" } } */ +/* { dg-final { scan-assembler-times "neg" 1 } } */ +
Re: [PATCH] PR debug/16063. Add DW_AT_type to DW_TAG_enumeration.
On Thu, 2014-04-10 at 10:51 -0700, Cary Coutant wrote: > > However it would be nice to be assured that the gcc change is ok in > > principle first. > > The DWARF bits are fine with me. Thanks. Who can approve the other bits? When approved should I wait till stage 1 opens before committing? Thanks, Mark
[Ping][PATCH, GCC/THUMB1] New define_insn_and_split pattern to enable optimizing out certain unnecessary uxtb instruction
Hi there, Could you please review patch at http://gcc.gnu.org/ml/gcc-patches/2014-03/msg00790.html? Thanks. BR, Terry > -Original Message- > From: gcc-patches-ow...@gcc.gnu.org [mailto:gcc-patches- > ow...@gcc.gnu.org] On Behalf Of Terry Guo > Sent: Monday, March 17, 2014 11:36 AM > To: gcc-patches@gcc.gnu.org > Cc: Ramana Radhakrishnan; Richard Earnshaw > Subject: [PATCH, GCC/THUMB1] New define_insn_and_split pattern to > enable optimizing out certain unnecessary uxtb instruction > > Hi > > The existing test case gcc.target/arm/unsigned-extend-1.c fails for Thumb1 > target like cortex-m0 because the thumb1_addsi3_addgeu insn pattern isn't > friendly to gcc combine pass. Before combine pass, we have such insn for > this test case: > > (insn 10 9 12 2 (set (reg:SI 118) > (plus:SI (plus:SI (reg:SI 120) > (reg:SI 120)) > (geu:SI (reg:SI 119) > (reg:SI 117 > > When the operand (reg:SI 120) is zero and operand (reg:SI 119) is constant > 9, combine pass will turn this insn into: > > (insn 10 9 12 2 (set (reg:SI 118) > (leu:SI (reg:SI 116) (const_int 9 > > Unfortunately this new insn doesn't match any existing patterns, this causes > combine pass to undo all attempts and results in sub-optimal code. The > attached patch intends to legitimize the new insn. > > Tested with gcc regression test and no new regression. > > Is it OK to trunk? > > BR, > Terry > > 2014-03-17 Terry Guo > > * config/arm/arm.md (cstoresi_leu_thumb1): New > define_insn_and_split > pattern. > (cstoresi4): Use above new pattern.
Re: Avoid unnecesary GGC runs during LTO
On Fri, 11 Apr 2014, Jan Hubicka wrote: > > Hi, > while looking into -ftime-report, I noticed that ggc can take up to 10% of > WPA memory > while it does almost nothing: it is run just after streaming that explicitly > frees memory that becomes unreachable. The first GGC run usually saves at > most 1% of memory and then it is never run again. > I believe this ought to also help in case we get into swap, since ltranses > will > also ggc less. > > Bootstrapped/regtested x86_64-linux, OK? > > Honza > > * lto.c (read_cgraph_and_symbols): Grow ggc memory after streaming. > * ggc.h (ggc_grow): New function. > * ggc-none.c (ggc_grow): New function. > * ggc-page.c (ggc_grow): Likewise. > Index: ggc.h > === > --- ggc.h (revision 209170) > +++ ggc.h (working copy) > @@ -225,6 +225,9 @@ extern const char *ggc_alloc_string_stat > function is called, not during allocations. */ > extern void ggc_collect (void); > > +/* Assume that all GGC memory is reachable and grow the limits for next > collection. */ > +extern void ggc_grow (void); > + > /* Register an additional root table. This can be useful for some > plugins. Does nothing if the passed pointer is NULL. */ > extern void ggc_register_root_tab (const struct ggc_root_tab *); > Index: lto/lto.c > === > --- lto/lto.c (revision 209170) > +++ lto/lto.c (working copy) > @@ -2999,6 +3000,10 @@ read_cgraph_and_symbols (unsigned nfiles >gimple_canonical_types = NULL; >delete canonical_type_hash_cache; >canonical_type_hash_cache = NULL; > + > + /* At this stage we know that majority of GGC memory is reachable. > + Growing the limits prevents unnecesary invocation of GGC. */ > + ggc_grow (); >ggc_collect (); Isn't the collect here pointless? I see not in ENABLE_CHECKING, but shouldn't this be abstracted away, thus call ggc_collect from ggc_grow? Or maybe rather even for ENABLE_CHECKING adjust G.allocated_last_gc and simply drop the ggc_collect above (). Anyway, this is sth for stage1 at this point. Thanks, Richard. >/* Set the hooks so that all of the ipa passes can read in their data. */ > Index: ggc-none.c > === > --- ggc-none.c(revision 209170) > +++ ggc-none.c(working copy) > @@ -63,3 +63,8 @@ ggc_free (void *p) > { >free (p); > } > + > +void > +ggc_grow (void) > +{ > +} > Index: ggc-page.c > === > --- ggc-page.c(revision 209170) > +++ ggc-page.c(working copy) > @@ -2095,6 +2095,19 @@ ggc_collect (void) > fprintf (G.debug_file, "END COLLECTING\n"); > } > > +/* Assume that all GGC memory is reachable and grow the limits for next > collection. */ > + > +void > +ggc_grow (void) > +{ > +#ifndef ENABLE_CHECKING > + G.allocated_last_gc = MAX (G.allocated_last_gc, > + G.allocated); > +#endif > + if (!quiet_flag) > +fprintf (stderr, " {GC start %luk} ", (unsigned long) G.allocated / > 1024); > +} > + > /* Print allocation statistics. */ > #define SCALE(x) ((unsigned long) ((x) < 1024*10 \ > ? (x) \ > > -- Richard Biener SUSE / SUSE Labs SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746 GF: Jeff Hawn, Jennifer Guild, Felix Imend"orffer
Re: [PATCH] Don't dump bb details when removing a block
On Tue, Apr 8, 2014 at 6:55 PM, Teresa Johnson wrote: > This patch removes the printing of details for BBs that are being removed. > > When printing bb details, dump_bb_info will invoke check_bb_profile, which > will > flag spurious profile insanities in the removed bb since the incoming edges > have already been removed. This makes it harder to identify true profile > insanities in dumps, both for the gcc testsuite and in my own testing when I > have been trying to identify and fix profile insanities introduced by > optimization. > > The other effects of removing the details printing is that the profile counts > on the bb being removed, as well as its prev and next blocks, are suppressed, > which doesn't strike me as a problem. In fact, one of the tests needed its > expected dump output adjusted from my change, and in looking at that I > discovered that the profile count it was scanning for was matching that of a > removed block after a recent change (r208165), instead of a block in the > optimized code. > > Bootstrapped and tested on x86_64-unknown-linux-gnu. Ok for either trunk or > stage 1? IMHO it's odd to strip just a single flag - I'd go for specifying the desired flags explicitely, like dumping with TDF_BLOCKS only (dumping edges is certainly useful IMHO). Or dump with 0. Either way ok for stage1. Thanks, Richard. > Thanks, > Teresa > > 2014-04-08 Teresa Johnson > > * tree-cfg.c (remove_bb): Don't dump details during bb removal. > > 2014-04-08 Teresa Johnson > > * gcc.dg/tree-prof/update-loopch.c: Update expected output. > > Index: tree-cfg.c > === > --- tree-cfg.c (revision 208492) > +++ tree-cfg.c (working copy) > @@ -1947,7 +1947,7 @@ remove_bb (basic_block bb) >fprintf (dump_file, "Removing basic block %d\n", bb->index); >if (dump_flags & TDF_DETAILS) > { > - dump_bb (dump_file, bb, 0, dump_flags); > + dump_bb (dump_file, bb, 0, dump_flags && ~TDF_DETAILS); > fprintf (dump_file, "\n"); > } > } > Index: testsuite/gcc.dg/tree-prof/update-loopch.c > === > --- testsuite/gcc.dg/tree-prof/update-loopch.c (revision 208492) > +++ testsuite/gcc.dg/tree-prof/update-loopch.c (working copy) > @@ -15,8 +15,9 @@ main () > is once reached directly from entry point of function, rest via loopback > edge. */ > /* { dg-final-use { scan-ipa-dump "loop depth 1, count 4" "profile"} } */ > -/* { dg-final-use { scan-tree-dump "loop depth 1, count 2" > "optimized"} } */ > -/* { dg-final-use { scan-tree-dump-times "Removing basic block > \[^\r\n\]*\[\\r\\n\]+\[^\r\n\]*\[\\r\\n\]+Invalid sum > of\[^\r\n\]*\[\\r\\n\]+Invalid sum of" 1 "optimized"} } */ > -/* { dg-final-use { scan-tree-dump-times "Invalid sum of" 2 "optimized"} } */ > +/* { dg-final-use { scan-tree-dump "loop depth 1, count 3" > "optimized"} } */ > +/* { dg-final-use { scan-tree-dump-not "loop depth 1, count 2" > "optimized"} } */ > +/* { dg-final-use { scan-tree-dump "Removing basic block" "optimized"} } */ > +/* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */ > /* { dg-final-use { cleanup-ipa-dump "profile" } } */ > /* { dg-final-use { cleanup-tree-dump "optimized" } } */ > > > -- > Teresa Johnson | Software Engineer | tejohn...@google.com | 408-460-2413
Re: [PATCH wwwdocs] Changes for ARM / AArch64 backends 4.9
On Thu, Apr 10, 2014 at 10:42 AM, Ramana Radhakrishnan wrote: > 4.9 changes for ARM / AArch64. Sorry it's taken me a while to get this out > but better late than never :) > > Ok ? Ok. Thanks, Richard. > Ramana > -- > Ramana Radhakrishnan > Principal Engineer > ARM Ltd.
Re: [PATCH] Don't dump bb details when removing a block
Hi Teresa, > @@ -1947,7 +1947,7 @@ remove_bb (basic_block bb) >fprintf (dump_file, "Removing basic block %d\n", bb->index); >if (dump_flags & TDF_DETAILS) > { > - dump_bb (dump_file, bb, 0, dump_flags); > + dump_bb (dump_file, bb, 0, dump_flags && ~TDF_DETAILS); > fprintf (dump_file, "\n"); > } > } did you mean "dump_flags & ~TDF_DETAILS", logical & ??? Bernd.
Re: Avoid unnecesary GGC runs during LTO
On 04/11/2014 08:07 AM, Jan Hubicka wrote: Hi, while looking into -ftime-report, I noticed that ggc can take up to 10% of WPA memory while it does almost nothing: it is run just after streaming that explicitly frees memory that becomes unreachable. The first GGC run usually saves at most 1% of memory and then it is never run again. I believe this ought to also help in case we get into swap, since ltranses will also ggc less. Bootstrapped/regtested x86_64-linux, OK? Hi! I applied both patches you sent today and there are Firefox LTO -O3 results: https://drive.google.com/file/d/0B0pisUJ80pO1ajRzLWFneTJpcE0/edit?usp=sharing It shows that you saved a bit memory in WPA. Martin Honza * lto.c (read_cgraph_and_symbols): Grow ggc memory after streaming. * ggc.h (ggc_grow): New function. * ggc-none.c (ggc_grow): New function. * ggc-page.c (ggc_grow): Likewise. Index: ggc.h === --- ggc.h (revision 209170) +++ ggc.h (working copy) @@ -225,6 +225,9 @@ extern const char *ggc_alloc_string_stat function is called, not during allocations. */ extern void ggc_collect (void); +/* Assume that all GGC memory is reachable and grow the limits for next collection. */ +extern void ggc_grow (void); + /* Register an additional root table. This can be useful for some plugins. Does nothing if the passed pointer is NULL. */ extern void ggc_register_root_tab (const struct ggc_root_tab *); Index: lto/lto.c === --- lto/lto.c (revision 209170) +++ lto/lto.c (working copy) @@ -2999,6 +3000,10 @@ read_cgraph_and_symbols (unsigned nfiles gimple_canonical_types = NULL; delete canonical_type_hash_cache; canonical_type_hash_cache = NULL; + + /* At this stage we know that majority of GGC memory is reachable. + Growing the limits prevents unnecesary invocation of GGC. */ + ggc_grow (); ggc_collect (); /* Set the hooks so that all of the ipa passes can read in their data. */ Index: ggc-none.c === --- ggc-none.c (revision 209170) +++ ggc-none.c (working copy) @@ -63,3 +63,8 @@ ggc_free (void *p) { free (p); } + +void +ggc_grow (void) +{ +} Index: ggc-page.c === --- ggc-page.c (revision 209170) +++ ggc-page.c (working copy) @@ -2095,6 +2095,19 @@ ggc_collect (void) fprintf (G.debug_file, "END COLLECTING\n"); } +/* Assume that all GGC memory is reachable and grow the limits for next collection. */ + +void +ggc_grow (void) +{ +#ifndef ENABLE_CHECKING + G.allocated_last_gc = MAX (G.allocated_last_gc, +G.allocated); +#endif + if (!quiet_flag) +fprintf (stderr, " {GC start %luk} ", (unsigned long) G.allocated / 1024); +} + /* Print allocation statistics. */ #define SCALE(x) ((unsigned long) ((x) < 1024*10 \ ? (x) \
Re: [PATCH, PR 60556] Fix ICE on platforms with signed pointer extension.
On Thu, Mar 20, 2014 at 09:48:58AM -0700, Steve Ellcey wrote: > This patch fixes pr60556, a GCC ICE. The problem is in convert_move where, > if we are trying to put a 32 bit address into a 64 bit destination we > can wind up calling emit_move_insn with NULL_RTX as a source. > > The problem comes when creating fill_value. If unsignedp is false > then we call emit_store_flag to set fill_value. If lowfrom is a symbol > reference then emit_store_flag returns NULL_RTX (because symbol references > are constant) and we wind up calling emit_move_insn with NULL_RTX as a > source and getting an ICE. I think the right fix is instead to use emit_store_flag_force, that will force into register only when necessary, and will do so even in the numerous other cases when emit_store_flag may return NULL (LABEL_REF, other constants, different branch costs, etc.). Will bootstrap/regtest this on x86_64-linux and i686-linux, Steve, can you please test on mips? Ok for trunk if testing passes? 2014-04-11 Steve Ellcey Jakub Jelinek PR middle-end/60556 * expr.c (convert_move): Use emit_store_flag_force instead of emit_store_flag. Pass lowpart_mode instead of VOIDmode as 5th argument to it. * gcc.c-torture/compile/pr60556.c: New test. --- gcc/expr.c.jj 2014-03-28 23:06:44.0 +0100 +++ gcc/expr.c 2014-04-11 10:59:24.664014557 +0200 @@ -551,9 +551,9 @@ convert_move (rtx to, rtx from, int unsi if (unsignedp) fill_value = const0_rtx; else - fill_value = emit_store_flag (gen_reg_rtx (word_mode), - LT, lowfrom, const0_rtx, - VOIDmode, 0, -1); + fill_value = emit_store_flag_force (gen_reg_rtx (word_mode), + LT, lowfrom, const0_rtx, + lowpart_mode, 0, -1); /* Fill the remaining words. */ for (i = GET_MODE_SIZE (lowpart_mode) / UNITS_PER_WORD; i < nwords; i++) --- gcc/testsuite/gcc.c-torture/compile/pr60556.c.jj2014-04-11 11:01:53.535218278 +0200 +++ gcc/testsuite/gcc.c-torture/compile/pr60556.c 2014-04-11 11:01:53.535218278 +0200 @@ -0,0 +1,8 @@ +/* PR middle-end/60556 */ + +int g (int); + +unsigned long long f (void) +{ + return (unsigned long long)(long)&g; +} Jakub
Re: [PING] [PATCH] Fix PR rtl-optimization/pr60663
On 11 April 2014 00:10, Jakub Jelinek wrote: > On Tue, Apr 01, 2014 at 11:41:12AM +0800, Zhenqiang Chen wrote: >> Ping? >> >> Bootstrap and no make check regression on X86-64. >> >> Bootstrap on ARM. In ARM regression test, some new PASS and FAIL of >> debug info check for gcc.dg/guality/pr36728-1.c and >> gcc.dg/guality/pr36728-2.c since register allocation result is >> different with the patch. There is no real new FAIL due to the patch. > >> > --- a/gcc/cse.c >> > +++ b/gcc/cse.c >> > @@ -4280,6 +4280,19 @@ find_sets_in_insn (rtx insn, struct set **psets) >> > ; >> > else if (GET_CODE (SET_SRC (y)) == CALL) >> > ; >> > + else if (GET_CODE (SET_SRC (y)) == ASM_OPERANDS) >> > + { >> > + if (i + 1 < lim) >> > + { >> > + rtx n = XVECEXP (x, 0, i + 1); >> > + /* For inline assemble with multiple outputs, we can >> > not >> > +handle the SET separately. Refer PR60663. */ >> > + if (GET_CODE (n) == SET >> > + && GET_CODE (SET_SRC (n)) == ASM_OPERANDS) >> > + break; >> > + } >> > + sets[n_sets++].rtl = y; >> > + } >> > else >> > sets[n_sets++].rtl = y; >> > } > > This doesn't look like a correct fix. First of all, it will not handle > many of the cases where we should not break the inline asm appart, > e.g. if you have: > int > foo (void) > { > unsigned i; > asm ("%0" : "=r" (i) : : "r5"); > return i; > } > then it will still happily drop the clobber on the floor. > But also, e.g. volatile asm or asm goto which is even stronger reason > not to fiddle with it too much, isn't handled by not adding the sets in > find_sets_in_insn, but rather just setting src_volatile flag. > So, I'd say a better fix than this is something like following patch > (untested yet, but fixes the testcase). Thanks. The patch can fix the issue. I tested it on X86-64 and ARM. There is no regression. > Or, fix up the insane arm costs for ASM_OPERANDS: > case ASM_OPERANDS: > /* Just a guess. Cost one insn per input. */ > *cost = COSTS_N_INSNS (ASM_OPERANDS_INPUT_LENGTH (x)); > return true; > I don't think this heuristics is even close to reality most of the > time, more importantly, for no inputs, just outputs and clobbers it means > *cost = 0; and that is why ARM is supposedly the only target now where CSE > thinks it is worthwhile to break all inline asms without inputs appart. I will raise a patch to discuss it for ARM backend. Thanks! -Zhenqiang > 2014-04-10 Jakub Jelinek > > PR rtl-optimization/60663 > * cse.c (cse_insn): Set src_volatile on ASM_OPERANDS in > PARALLEL. > > * gcc.target/arm/pr60663.c: New test. > > --- gcc/cse.c.jj2014-03-12 10:13:41.0 +0100 > +++ gcc/cse.c 2014-04-10 17:21:27.517330918 +0200 > @@ -4642,6 +4642,13 @@ cse_insn (rtx insn) > && REGNO (dest) >= FIRST_PSEUDO_REGISTER) > sets[i].src_volatile = 1; > > + /* Also do not record result of a non-volatile inline asm with > +more than one result or with clobbers, we do not want CSE to > +break the inline asm apart. */ > + else if (GET_CODE (src) == ASM_OPERANDS > + && GET_CODE (x) == PARALLEL) > + sets[i].src_volatile = 1; > + > #if 0 >/* It is no longer clear why we used to do this, but it doesn't > appear to still be needed. So let's try without it since this > --- gcc/testsuite/gcc.target/arm/pr60663.c.jj 2014-04-10 17:30:04.392608591 > +0200 > +++ gcc/testsuite/gcc.target/arm/pr60663.c 2014-04-10 17:29:25.0 > +0200 > @@ -0,0 +1,11 @@ > +/* PR rtl-optimization/60663 */ > +/* { dg-do compile } */ > +/* { dg-options "-O2 -march=armv7-a" } */ > + > +int > +foo (void) > +{ > + unsigned i, j; > + asm ("%0 %1" : "=r" (i), "=r" (j)); > + return i; > +} > > > Jakub
Re: [PING] [PATCH] Fix PR rtl-optimization/pr60663
On Fri, Apr 11, 2014 at 05:19:59PM +0800, Zhenqiang Chen wrote: > > Or, fix up the insane arm costs for ASM_OPERANDS: > > case ASM_OPERANDS: > > /* Just a guess. Cost one insn per input. */ > > *cost = COSTS_N_INSNS (ASM_OPERANDS_INPUT_LENGTH (x)); > > return true; > > I don't think this heuristics is even close to reality most of the > > time, more importantly, for no inputs, just outputs and clobbers it means > > *cost = 0; and that is why ARM is supposedly the only target now where CSE > > thinks it is worthwhile to break all inline asms without inputs appart. > > I will raise a patch to discuss it for ARM backend. AFAIK Kyrill is already working on such a patch, but it was agreed to put it into stage1 only and eventually backport for 4.9.1. Jakub
Re: [PATCH, PR 60556] Fix ICE on platforms with signed pointer extension.
On Fri, 11 Apr 2014, Jakub Jelinek wrote: > On Thu, Mar 20, 2014 at 09:48:58AM -0700, Steve Ellcey wrote: > > This patch fixes pr60556, a GCC ICE. The problem is in convert_move where, > > if we are trying to put a 32 bit address into a 64 bit destination we > > can wind up calling emit_move_insn with NULL_RTX as a source. > > > > The problem comes when creating fill_value. If unsignedp is false > > then we call emit_store_flag to set fill_value. If lowfrom is a symbol > > reference then emit_store_flag returns NULL_RTX (because symbol references > > are constant) and we wind up calling emit_move_insn with NULL_RTX as a > > source and getting an ICE. > > I think the right fix is instead to use emit_store_flag_force, that will > force into register only when necessary, and will do so even in the numerous > other cases when emit_store_flag may return NULL (LABEL_REF, other > constants, different branch costs, etc.). > > Will bootstrap/regtest this on x86_64-linux and i686-linux, Steve, can you > please test on mips? Ok for trunk if testing passes? Ok. Thanks, Richard. > 2014-04-11 Steve Ellcey > Jakub Jelinek > > PR middle-end/60556 > * expr.c (convert_move): Use emit_store_flag_force instead of > emit_store_flag. Pass lowpart_mode instead of VOIDmode as 5th > argument to it. > > * gcc.c-torture/compile/pr60556.c: New test. > > --- gcc/expr.c.jj 2014-03-28 23:06:44.0 +0100 > +++ gcc/expr.c2014-04-11 10:59:24.664014557 +0200 > @@ -551,9 +551,9 @@ convert_move (rtx to, rtx from, int unsi >if (unsignedp) > fill_value = const0_rtx; >else > - fill_value = emit_store_flag (gen_reg_rtx (word_mode), > - LT, lowfrom, const0_rtx, > - VOIDmode, 0, -1); > + fill_value = emit_store_flag_force (gen_reg_rtx (word_mode), > + LT, lowfrom, const0_rtx, > + lowpart_mode, 0, -1); > >/* Fill the remaining words. */ >for (i = GET_MODE_SIZE (lowpart_mode) / UNITS_PER_WORD; i < nwords; > i++) > --- gcc/testsuite/gcc.c-torture/compile/pr60556.c.jj 2014-04-11 > 11:01:53.535218278 +0200 > +++ gcc/testsuite/gcc.c-torture/compile/pr60556.c 2014-04-11 > 11:01:53.535218278 +0200 > @@ -0,0 +1,8 @@ > +/* PR middle-end/60556 */ > + > +int g (int); > + > +unsigned long long f (void) > +{ > + return (unsigned long long)(long)&g; > +}
[PATCH] Fix PRs 60453 and 59817
The following patch fixes the two related ICEs in the PRs by properly implementing the recursion in graphite_can_represent_scev to catch all CHRECs and reject remains with CHRECs. Bootstrap and regtest ongoing on x86_64-unknown-linux-gnu, will commit shortly if that succeeds. Richard. 2014-04-11 Richard Biener PR tree-optimization/59817 PR tree-optimization/60453 * graphite-scop-detection.c (graphite_can_represent_scev): Complete recursion to catch all CHRECs in the scalar evolution and restrict the predicate for the remains appropriately. * gfortran.dg/graphite/pr59817.f: New testcase. * gcc.dg/graphite/pr59817-1.c: Likewise. * gcc.dg/graphite/pr59817-2.c: Likewise. Index: gcc/graphite-scop-detection.c === *** gcc/graphite-scop-detection.c (revision 209292) --- gcc/graphite-scop-detection.c (working copy) *** graphite_can_represent_scev (tree scev) *** 219,225 --- 219,232 switch (TREE_CODE (scev)) { + case NEGATE_EXPR: + case BIT_NOT_EXPR: + CASE_CONVERT: + case NON_LVALUE_EXPR: + return graphite_can_represent_scev (TREE_OPERAND (scev, 0)); + case PLUS_EXPR: + case POINTER_PLUS_EXPR: case MINUS_EXPR: return graphite_can_represent_scev (TREE_OPERAND (scev, 0)) && graphite_can_represent_scev (TREE_OPERAND (scev, 1)); *** graphite_can_represent_scev (tree scev) *** 247,253 } /* Only affine functions can be represented. */ ! if (!scev_is_linear_expression (scev)) return false; return true; --- 254,261 } /* Only affine functions can be represented. */ ! if (tree_contains_chrecs (scev, NULL) ! || !scev_is_linear_expression (scev)) return false; return true; Index: gcc/testsuite/gfortran.dg/graphite/pr59817.f === *** gcc/testsuite/gfortran.dg/graphite/pr59817.f(revision 0) --- gcc/testsuite/gfortran.dg/graphite/pr59817.f(working copy) *** *** 0 --- 1,14 + ! { dg-do compile } + ! { dg-options "-O2 -floop-interchange" } + SUBROUTINE PREPD(ICAST,ICAS,ICASX,ICAS1,ICAS2,NDET,NM,III,IMP, + * CASMIN) + LOGICAL CASMIN + DIMENSION ICAST(NDET,NM),IMP(NM) + IF(CASMIN) THEN + DO K=1,NDET + DO L=1,NM +IF(L.EQ.K-1) ICAST(K,L) = 1 + END DO + END DO + END IF + END SUBROUTINE Index: gcc/testsuite/gcc.dg/graphite/pr59817-2.c === *** gcc/testsuite/gcc.dg/graphite/pr59817-2.c (revision 0) --- gcc/testsuite/gcc.dg/graphite/pr59817-2.c (working copy) *** *** 0 --- 1,15 + /* { dg-do compile } */ + /* { dg-options "-O2 -floop-interchange" } */ + + void + xl(void) + { + static int j3; + for (j3 = 0; j3 < 1; ++j3) { + static int f2; + static int w7; + short int b5; + int ok; + f2 = (b5 += ok) ? (w7 = 0): (w7 ? 0 : (f2 = ok)); + } + } Index: gcc/testsuite/gcc.dg/graphite/pr59817-1.c === *** gcc/testsuite/gcc.dg/graphite/pr59817-1.c (revision 0) --- gcc/testsuite/gcc.dg/graphite/pr59817-1.c (working copy) *** *** 0 --- 1,16 + /* { dg-do compile } */ + /* { dg-options "-O2 -floop-interchange" } */ + + int kd; + + void + n2(void) + { + static int so; + static short int i5; + int wj; + int *il; + int *nk = &so; + for (wj = 0; wj < 2; ++wj) + *nk = ((i5 += *il) || kd ); + }
[PATCH] Fix PR60797
This fixes the endless error reporting for unhandled aliases by setting TREE_ASM_WRITTEN on the decls we complained about. Bootstrapped on x86_64-unknown-linux-gnu, testing in progress (sort-of pointless on that target of course). Richard. 2014-04-11 Richard Biener PR middle-end/60797 * varasm.c (assemble_alias): Avoid endless error reporting recursion by setting TREE_ASM_WRITTEN. * gcc.dg/pr60797.c: New testcase. Index: gcc/varasm.c === *** gcc/varasm.c(revision 209292) --- gcc/varasm.c(working copy) *** assemble_alias (tree decl, tree target) *** 5665,5670 --- 5665,5671 # if !defined(ASM_OUTPUT_WEAK_ALIAS) && !defined (ASM_WEAKEN_DECL) error_at (DECL_SOURCE_LOCATION (decl), "alias definitions not supported in this configuration"); + TREE_ASM_WRITTEN (decl) = 1; return; # else if (!DECL_WEAK (decl)) *** assemble_alias (tree decl, tree target) *** 5675,5680 --- 5676,5682 else error_at (DECL_SOURCE_LOCATION (decl), "only weak aliases are supported in this configuration"); + TREE_ASM_WRITTEN (decl) = 1; return; } # endif Index: gcc/testsuite/gcc.dg/pr60797.c === *** gcc/testsuite/gcc.dg/pr60797.c (revision 0) --- gcc/testsuite/gcc.dg/pr60797.c (working copy) *** *** 0 --- 1,8 + /* { dg-do compile } */ + /* { dg-skip-if "" { alias } } */ + + extern int foo __attribute__((alias("bar"))); /* { dg-error "supported" } */ + int main() + { + return 0; + }
[Committed] S/390: Fix htm target check
Hi, I've just applied the attached patch to mainline and 4.8 branch. The patch makes htm target check to also cover the required assembler support and does some minor cleanup work. Bye, -Andreas- 2014-04-11 Andreas Krebbel * gcc.target/s390/htm-nofloat-1.c: Rename to ... * gcc.target/s390/htm-nofloat-compile-1.c: ... this one. * gcc.target/s390/htm-nofloat-2.c: Add check for htm target and rename to ... * gcc.target/s390/htm-nofloat-1.c: ... this one. * gcc.target/s390/s390.exp: Make sure the assembler supports htm instructions as well. diff --git a/gcc/testsuite/gcc.target/s390/htm-nofloat-1.c b/gcc/testsuite/gcc.target/s390/htm-nofloat-1.c index df7e2ba..6022efb 100644 --- a/gcc/testsuite/gcc.target/s390/htm-nofloat-1.c +++ b/gcc/testsuite/gcc.target/s390/htm-nofloat-1.c @@ -1,12 +1,50 @@ -/* { dg-do compile } */ -/* { dg-options "-O3 -march=zEC12 -mzarch" } */ +/* { dg-do run } */ +/* { dg-require-effective-target htm } */ +/* { dg-options "-O3 -march=zEC12 -mzarch --save-temps" } */ -int -foo () +/* __builtin_tbegin has to emit clobbers for all FPRs since the tbegin + instruction does not automatically preserves them. If the + transaction body is fully contained in a function the backend tries + after reload to get rid of the FPR save/restore operations + triggered by the clobbers. This testcase failed since the backend + was able to get rid of all FPR saves/restores and since these were + the only stack operations also of the entire stack space. So even + the save/restore of the stack pointer was omitted in the end. + However, since the frame layout has been fixed before, the prologue + still generated the stack pointer decrement making foo return with + a modified stack pointer. */ + +void abort(void); + +void __attribute__((noinline)) +foo (int a) +{ + if (__builtin_tbegin (0) == 0) +__builtin_tend (); +} + +#ifdef __s390x__ +#define GET_STACK_POINTER(SP) \ + asm volatile ("stg %%r15, %0" : "=QRST" (SP)); +#else +#define GET_STACK_POINTER(SP) \ + asm volatile ("st %%r15, %0" : "=QR" (SP)); +#endif + +int main(void) { - __builtin_tbegin_nofloat (0); - __builtin_tbegin_retry_nofloat (0, 42); + unsigned long new_sp, old_sp; + + GET_STACK_POINTER (old_sp); + foo(42); + GET_STACK_POINTER (new_sp); + + if (old_sp != new_sp) +abort (); + + return 0; } + /* Make sure no FPR saves/restores are emitted. */ -/* { dg-final { scan-assembler-not "std" } } */ -/* { dg-final { scan-assembler-not "ld" } } */ +/* { dg-final { scan-assembler-not "\tstd\t" } } */ +/* { dg-final { scan-assembler-not "\tld\t" } } */ diff --git a/gcc/testsuite/gcc.target/s390/htm-nofloat-2.c b/gcc/testsuite/gcc.target/s390/htm-nofloat-2.c deleted file mode 100644 index 59621a4..000 --- a/gcc/testsuite/gcc.target/s390/htm-nofloat-2.c +++ /dev/null @@ -1,55 +0,0 @@ -/* { dg-do run } */ -/* { dg-options "-O3 -mhtm -Wa,-march=zEC12,-mzarch --save-temps" } */ - -/* __builtin_tbegin has to emit clobbers for all FPRs since the tbegin - instruction does not automatically preserves them. If the - transaction body is fully contained in a function the backend tries - after reload to get rid of the FPR save/restore operations - triggered by the clobbers. This testcase failed since the backend - was able to get rid of all FPR saves/restores and since these were - the only stack operations also of the entire stack space. So even - the save/restore of the stack pointer was omitted in the end. - However, since the frame layout has been fixed before, the prologue - still generated the stack pointer decrement making foo return with - a modified stack pointer. */ - -void abort(void); - -void __attribute__((noinline)) -foo (int a) -{ - /* This is just to prevent the tbegin code from actually being - executed. That way the test may even run on machines prior to - zEC12. */ - if (a == 42) -return; - - if (__builtin_tbegin (0) == 0) -__builtin_tend (); -} - -#ifdef __s390x__ -#define GET_STACK_POINTER(SP) \ - asm volatile ("stg %%r15, %0" : "=QRST" (SP)); -#else -#define GET_STACK_POINTER(SP) \ - asm volatile ("st %%r15, %0" : "=QR" (SP)); -#endif - -int main(void) -{ - unsigned long new_sp, old_sp; - - GET_STACK_POINTER (old_sp); - foo(42); - GET_STACK_POINTER (new_sp); - - if (old_sp != new_sp) -abort (); - - return 0; -} - -/* Make sure no FPR saves/restores are emitted. */ -/* { dg-final { scan-assembler-not "\tstd\t" } } */ -/* { dg-final { scan-assembler-not "\tld\t" } } */ diff --git a/gcc/testsuite/gcc.target/s390/htm-nofloat-compile-1.c b/gcc/testsuite/gcc.target/s390/htm-nofloat-compile-1.c new file mode 100644 index 000..df7e2ba --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/htm-nofloat-compile-1.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -march=zEC12 -mzarch" } */ + +int +foo
[PATCH] Remove directional rounding division negate folding
Both premature (can't find or think of an existing place that would rely on those) and bogus, - (4 /[fl] 5) isn't equal to (4 /[fl] -5). Removing and not trying to fold into 4 /[cl] -5 as we have no good way of creating testcases (that also include the negation). Bootstrap / regtest on x86_64-unknown-linux-gnu pending. Ok for trunk? (not a regression AFAIK) Thanks, Richard. 2014-04-11 Richard Biener PR middle-end/55022 * fold-const.c (negate_expr_p): Don't negate directional rounding division. (fold_negate_expr): Likewise. Index: gcc/fold-const.c === *** gcc/fold-const.c(revision 209292) --- gcc/fold-const.c(working copy) *** negate_expr_p (tree t) *** 484,491 case TRUNC_DIV_EXPR: case ROUND_DIV_EXPR: - case FLOOR_DIV_EXPR: - case CEIL_DIV_EXPR: case EXACT_DIV_EXPR: /* In general we can't negate A / B, because if A is INT_MIN and B is 1, we may turn this into INT_MIN / -1 which is undefined --- 484,489 *** fold_negate_expr (location_t loc, tree t *** 682,689 case TRUNC_DIV_EXPR: case ROUND_DIV_EXPR: - case FLOOR_DIV_EXPR: - case CEIL_DIV_EXPR: case EXACT_DIV_EXPR: /* In general we can't negate A / B, because if A is INT_MIN and B is 1, we may turn this into INT_MIN / -1 which is undefined --- 680,685
Re: [PATCH, FORTRAN] Fix PR fortran/60718
Hi Bernd, Bernd Edlinger wrote: > It was caused by a strict aliasing violation, when passing a value of the type > "class(x),pointer" to a formal procedure parameter of the type > "class(x),target". I assume a VIEW_CONVERT_EXPR is directly on the argument is insufficient? Otherwise, I think I would prefer that: + gfc_conv_expr (&parmse, e); + parmse.expr = fold_build1_loc (input_location, + VIEW_CONVERT_EXPR, + type, parmse.expr)); + parmse.expr = gfc_build_addr_expr (parmse.expr) Otherwise, the approach of using a temporary is okay, but I believe the condition > + else if (e->ts.type == BT_CLASS && fsym > +&& fsym->ts.type == BT_CLASS > +&& fsym->attr.target) is wrong. What you intent to do is independent of the target attribute (~ restrict qualifier). We have three different cases: * Allocatable * Pointer * Nonalloc/nonpointer Besides staying in one's own group, one can do: Pointer -> Nonalloc Allocatable - > Noalloc Nonallocatable*/Allocatable* -> Pointer with intent(in) * = must have the target attribute Thus, you need to handle those; gfc_expr_attr(e) should give you information about the expression. Or one could always check against gfc_typenode_for_spec (&fsym->ts); of both fsym and e. Tobias
Re: [PATCH] Fix PRs 60453 and 59817
On Fri, 11 Apr 2014, Richard Biener wrote: > > The following patch fixes the two related ICEs in the PRs by > properly implementing the recursion in graphite_can_represent_scev > to catch all CHRECs and reject remains with CHRECs. > > Bootstrap and regtest ongoing on x86_64-unknown-linux-gnu, will > commit shortly if that succeeds. Bah, I have to recurse for the chrecs as well, of course. Otherwise all scop detection fails. Richard. 2014-04-11 Richard Biener PR tree-optimization/59817 PR tree-optimization/60453 * graphite-scop-detection.c (graphite_can_represent_scev): Complete recursion to catch all CHRECs in the scalar evolution and restrict the predicate for the remains appropriately. * gfortran.dg/graphite/pr59817.f: New testcase. * gcc.dg/graphite/pr59817-1.c: Likewise. * gcc.dg/graphite/pr59817-2.c: Likewise. Index: gcc/testsuite/gfortran.dg/graphite/pr59817.f === *** gcc/testsuite/gfortran.dg/graphite/pr59817.f(revision 0) --- gcc/testsuite/gfortran.dg/graphite/pr59817.f(working copy) *** *** 0 --- 1,14 + ! { dg-do compile } + ! { dg-options "-O2 -floop-interchange" } + SUBROUTINE PREPD(ICAST,ICAS,ICASX,ICAS1,ICAS2,NDET,NM,III,IMP, + * CASMIN) + LOGICAL CASMIN + DIMENSION ICAST(NDET,NM),IMP(NM) + IF(CASMIN) THEN + DO K=1,NDET + DO L=1,NM +IF(L.EQ.K-1) ICAST(K,L) = 1 + END DO + END DO + END IF + END SUBROUTINE Index: gcc/testsuite/gcc.dg/graphite/pr59817-2.c === *** gcc/testsuite/gcc.dg/graphite/pr59817-2.c (revision 0) --- gcc/testsuite/gcc.dg/graphite/pr59817-2.c (working copy) *** *** 0 --- 1,15 + /* { dg-do compile } */ + /* { dg-options "-O2 -floop-interchange" } */ + + void + xl(void) + { + static int j3; + for (j3 = 0; j3 < 1; ++j3) { + static int f2; + static int w7; + short int b5; + int ok; + f2 = (b5 += ok) ? (w7 = 0): (w7 ? 0 : (f2 = ok)); + } + } Index: gcc/testsuite/gcc.dg/graphite/pr59817-1.c === *** gcc/testsuite/gcc.dg/graphite/pr59817-1.c (revision 0) --- gcc/testsuite/gcc.dg/graphite/pr59817-1.c (working copy) *** *** 0 --- 1,16 + /* { dg-do compile } */ + /* { dg-options "-O2 -floop-interchange" } */ + + int kd; + + void + n2(void) + { + static int so; + static short int i5; + int wj; + int *il; + int *nk = &so; + for (wj = 0; wj < 2; ++wj) + *nk = ((i5 += *il) || kd ); + } Index: gcc/graphite-scop-detection.c === *** gcc/graphite-scop-detection.c (revision 209292) --- gcc/graphite-scop-detection.c (working copy) *** graphite_can_represent_scev (tree scev) *** 219,225 --- 219,232 switch (TREE_CODE (scev)) { + case NEGATE_EXPR: + case BIT_NOT_EXPR: + CASE_CONVERT: + case NON_LVALUE_EXPR: + return graphite_can_represent_scev (TREE_OPERAND (scev, 0)); + case PLUS_EXPR: + case POINTER_PLUS_EXPR: case MINUS_EXPR: return graphite_can_represent_scev (TREE_OPERAND (scev, 0)) && graphite_can_represent_scev (TREE_OPERAND (scev, 1)); *** graphite_can_represent_scev (tree scev) *** 241,253 if (!evolution_function_right_is_integer_cst (scev) || !graphite_can_represent_init (scev)) return false; default: break; } /* Only affine functions can be represented. */ ! if (!scev_is_linear_expression (scev)) return false; return true; --- 248,262 if (!evolution_function_right_is_integer_cst (scev) || !graphite_can_represent_init (scev)) return false; + return graphite_can_represent_scev (CHREC_LEFT (scev)); default: break; } /* Only affine functions can be represented. */ ! if (tree_contains_chrecs (scev, NULL) ! || !scev_is_linear_expression (scev)) return false; return true;
Re: [patch] Fix texinfo warnings for doc/gcc.texi [was: Re: doc bugs]
On Sat, Mar 29, 2014 at 10:51:58AM +0100, Tobias Burnus wrote: > 2014-03-29 Tobias Burnus > > PR other/59055 > * doc/bugreport.texi (Bugs): Remove nodes pointing to the > nirvana. > * doc/gcc.texi (Service): Update description in the @menu > * doc/invoke.texi (Option Summary): Remove misplaced and > duplicated @menu. Ok. Jakub
Re: [PATCH] Remove directional rounding division negate folding
On Fri, 11 Apr 2014, Richard Biener wrote: > > Both premature (can't find or think of an existing place that would > rely on those) and bogus, - (4 /[fl] 5) isn't equal to (4 /[fl] -5). > Removing and not trying to fold into 4 /[cl] -5 as we have no good > way of creating testcases (that also include the negation). > > Bootstrap / regtest on x86_64-unknown-linux-gnu pending. > > Ok for trunk? (not a regression AFAIK) With testcase now. Richard. 2014-04-11 Richard Biener PR middle-end/55022 * fold-const.c (negate_expr_p): Don't negate directional rounding division. (fold_negate_expr): Likewise. * gcc.dg/graphite/pr55022.c: New testcase. Index: gcc/fold-const.c === *** gcc/fold-const.c(revision 209292) --- gcc/fold-const.c(working copy) *** negate_expr_p (tree t) *** 484,491 case TRUNC_DIV_EXPR: case ROUND_DIV_EXPR: - case FLOOR_DIV_EXPR: - case CEIL_DIV_EXPR: case EXACT_DIV_EXPR: /* In general we can't negate A / B, because if A is INT_MIN and B is 1, we may turn this into INT_MIN / -1 which is undefined --- 484,489 *** fold_negate_expr (location_t loc, tree t *** 682,689 case TRUNC_DIV_EXPR: case ROUND_DIV_EXPR: - case FLOOR_DIV_EXPR: - case CEIL_DIV_EXPR: case EXACT_DIV_EXPR: /* In general we can't negate A / B, because if A is INT_MIN and B is 1, we may turn this into INT_MIN / -1 which is undefined --- 680,685 Index: gcc/testsuite/gcc.dg/graphite/pr55022.c === *** gcc/testsuite/gcc.dg/graphite/pr55022.c (revision 0) --- gcc/testsuite/gcc.dg/graphite/pr55022.c (working copy) *** *** 0 --- 1,27 + /* { dg-do run } */ + /* { dg-options "-O2 -fgraphite-identity" } */ + + extern void abort (void); + + void __attribute__((noinline,noclone)) + f(int *limit, int minLen, int maxLen) + { + int i; + + for (i = minLen; i <= maxLen; i++) { + limit[i] = i; + } + } + + int main() + { + int limit[256], i; + f (limit, 0, 255); + for (i = 0; i < 256; ++i) + { + if (limit[i] != i) + abort (); + __asm__ volatile ("" : : : "memory"); + } + return 0; + }
[C++ Patch] PR 58600
Hi, some time ago I looked a bit into this issue: from the diagnostic point of view, we can probably do better, but we can safely avoid a couple of ICEs by simply checking the second argument for error_mark_node and by using get_attribute_name instead of TREE_PURPOSE for an attribute which may or may not be a C++11 attribute. Tested x86_64-linux. Thanks, Paolo. /// /cp 2014-04-11 Paolo Carlini PR c++/58600 * name-lookup.c (parse_using_directive): Return early if the attribs argument is error_mark_node; use get_attribute_name. /testsuite 2014-04-11 Paolo Carlini PR c++/58600 * g++.dg/cpp0x/gen-attrs-58.C: New. * g++.dg/cpp0x/gen-attrs-59.C: Likewise. Index: cp/name-lookup.c === --- cp/name-lookup.c(revision 209275) +++ cp/name-lookup.c(working copy) @@ -4019,13 +4019,14 @@ do_using_directive (tree name_space) void parse_using_directive (tree name_space, tree attribs) { - tree a; - do_using_directive (name_space); - for (a = attribs; a; a = TREE_CHAIN (a)) + if (attribs == error_mark_node) +return; + + for (tree a = attribs; a; a = TREE_CHAIN (a)) { - tree name = TREE_PURPOSE (a); + tree name = get_attribute_name (a); if (is_attribute_p ("strong", name)) { if (!toplevel_bindings_p ()) Index: testsuite/g++.dg/cpp0x/gen-attrs-58.C === --- testsuite/g++.dg/cpp0x/gen-attrs-58.C (revision 0) +++ testsuite/g++.dg/cpp0x/gen-attrs-58.C (working copy) @@ -0,0 +1,5 @@ +// PR c++/58600 +// { dg-do compile { target c++11 } } + +namespace N { int i; } +using namespace N alignas(int); // { dg-warning "ignored" } Index: testsuite/g++.dg/cpp0x/gen-attrs-59.C === --- testsuite/g++.dg/cpp0x/gen-attrs-59.C (revision 0) +++ testsuite/g++.dg/cpp0x/gen-attrs-59.C (working copy) @@ -0,0 +1,5 @@ +// PR c++/58600 +// { dg-do compile { target c++11 } } + +namespace N {} +using namespace N alignas(X); // { dg-error "declared" }
Re: [PATCH] Remove directional rounding division negate folding
On Fri, Apr 11, 2014 at 01:03:51PM +0200, Richard Biener wrote: > Both premature (can't find or think of an existing place that would > rely on those) and bogus, - (4 /[fl] 5) isn't equal to (4 /[fl] -5). > Removing and not trying to fold into 4 /[cl] -5 as we have no good > way of creating testcases (that also include the negation). > > Bootstrap / regtest on x86_64-unknown-linux-gnu pending. > > Ok for trunk? (not a regression AFAIK) I'd prefer to defer for stage1 and perhaps 4.9.1 at this point. > 2014-04-11 Richard Biener > > PR middle-end/55022 > * fold-const.c (negate_expr_p): Don't negate directional rounding > division. > (fold_negate_expr): Likewise. Jakub
RE: [PATCH, FORTRAN] Fix PR fortran/60718
Hi Tobias, On Fri, 11 Apr 2014 13:37:46, Tobias Burnus wrote: > > Hi Bernd, > > Bernd Edlinger wrote: >> It was caused by a strict aliasing violation, when passing a value of the >> type >> "class(x),pointer" to a formal procedure parameter of the type >> "class(x),target". > > I assume a VIEW_CONVERT_EXPR is directly on the argument is insufficient? > Otherwise, > I think I would prefer that: > > + gfc_conv_expr (&parmse, e); > + parmse.expr = fold_build1_loc (input_location, > + VIEW_CONVERT_EXPR, > + type, parmse.expr)); > + parmse.expr = gfc_build_addr_expr (parmse.expr) > > > Otherwise, the approach of using a temporary is okay, but I believe the > condition > Yes, I tried that qickly, but this does not fix the test case. >> + else if (e->ts.type == BT_CLASS && fsym >> + && fsym->ts.type == BT_CLASS >> + && fsym->attr.target) > > is wrong. What you intent to do is independent of the target attribute (~ > restrict > qualifier). > Hmm, I was hoping somehow that only that test case is broken, and needs to be fixed. The target attribute is somehow simple, it implies intent(in) and the actual value will in most cases be a pointer, as in the example. > > We have three different cases: > > * Allocatable > * Pointer > * Nonalloc/nonpointer > > Besides staying in one's own group, one can do: > > Pointer -> Nonalloc > Allocatable -> Noalloc > Nonallocatable*/Allocatable* -> Pointer with intent(in) > > * = must have the target attribute > Well, this approach does not handle intent(inout) at all. If that is possible, the changed value must be written back again. Are there any test cases for these conversions? > Thus, you need to handle those; gfc_expr_attr(e) should give you > information about the expression. Or one could always check against > gfc_typenode_for_spec (&fsym->ts); > of both fsym and e. > I am not sure, does gfc_typenode_for_spec always allocate new nodes? Thanks Bernd. > Tobias
Hurd port for gcc go PATCH 0-3 (9)
Hi, Attached are patches to enable gccgo to build properly on Debian GNU/Hurd on gcc-4.9 (4.9-20140406). With split stack disabled around 70 libgo tests PASS and 50 FAIL (result seems to be somewhat random, alignment problems there too?). With split stack enabled _all_ tests fail, see https://lists.gnu.org/archive/html/bug-hurd/2013-06/msg00100.html patch0.diff is Debian specific, patch1.diff should be applied when split-stack works properly while the rest are available for upstream. patch0.diff: debian/rules.defs: go_no_systems: remove gnu, with_go: Check for DEB_TARGET_GNU_OS instead of DEB_TARGET_GNU_SYSTEM. Otherwise kfreebsd-gnu causes go_no_systems to still be true for gnu. patch1.diff: src/gcc/config/i386/gnu.h: Enables split stack for GNU/Hurd. Until split-stack works properly with the pthread library of Hurd this patch should not be applied. Maybe the offsets should change, but that has to be synchronized with the src/libgcc/config/i386/morestack.S assembly routine (unfortunately asm is not my piece of cake). patch2.diff: src/libgo/configure.ac: Add GNU as a supported target OS for go. patch3.diff: src/libgo/Makefile.am, src/libgo/Makefile.in Add GNU specific go routines with the LIBGO_IS_GNU conditional. Note: Creating the Makefile.in is hard (unnecessary) work since automake is no longer used in the build system. Both (cd src/libgo;automake-1.11) and (cd src/libgo;autoreconf2.64) fails. The diff for Makefile.in has to be patched by hand with the aid of the diff for Makefile.am :( This file should be possible to generate from Makefile.am when modifying manually. In my opinion the build system is broken wrt libgo. --- a/debian/rules.defs 2014-01-07 11:10:44.0 +0100 +++ b/debian/rules.defs 2014-01-07 11:23:47.0 +0100 @@ -721,7 +721,7 @@ ifeq (,$(filter $(distrelease),lenny etch squeeze dapper hardy jaunty karmic lucid maverick natty oneiric)) go_no_cpus := $(filter-out arm, $(go_no_cpus)) endif -go_no_systems := gnu kfreebsd-gnu +go_no_systems := kfreebsd-gnu ifneq ($(with_base_only),yes) ifneq ($(separate_lang),yes) @@ -731,7 +731,7 @@ ifneq (,$(filter $(DEB_TARGET_ARCH_CPU),$(go_no_cpus))) with_go := disabled for cpu $(DEB_TARGET_ARCH_CPU) endif -ifneq (,$(findstring $(DEB_TARGET_GNU_SYSTEM),$(go_no_systems))) +ifneq (,$(findstring $(DEB_TARGET_ARCH_OS),$(go_no_systems))) with_go := disabled for system $(DEB_TARGET_GNU_SYSTEM) endif ifeq ($(go_no_cross)-$(DEB_CROSS),yes-yes) --- a/src/gcc/config/i386/gnu.h.orig 2014-01-05 20:58:22.0 +0100 +++ b/src/gcc/config/i386/gnu.h 2014-04-07 11:21:00.0 +0200 @@ -36,12 +36,14 @@ #endif #ifdef TARGET_LIBC_PROVIDES_SSP +/* i386 glibc provides __stack_chk_guard in %gs:0x14. */ +#define TARGET_THREAD_SSP_OFFSET 0x14 -/* Not supported yet. */ -# undef TARGET_THREAD_SSP_OFFSET - -/* Not supported yet. */ -# undef TARGET_CAN_SPLIT_STACK -# undef TARGET_THREAD_SPLIT_STACK_OFFSET - +/* We only build the -fsplit-stack support in libgcc if the + assembler has full support for the CFI directives. */ +#if HAVE_GAS_CFI_PERSONALITY_DIRECTIVE +#define TARGET_CAN_SPLIT_STACK +#endif +/* We steal the last transactional memory word. */ +#define TARGET_THREAD_SPLIT_STACK_OFFSET 0x30 #endif --- a/src/libgo/configure.ac +++ b/src/libgo/configure.ac @@ -136,6 +136,7 @@ is_dragonfly=no is_rtems=no is_solaris=no +is_gnu=no GOOS=unknown case ${host} in *-*-darwin*) is_darwin=yes; GOOS=darwin ;; @@ -147,6 +148,7 @@ *-*-dragonfly*) is_dragonfly=yes; GOOS=dragonfly ;; *-*-rtems*)is_rtems=yes; GOOS=rtems ;; *-*-solaris2*) is_solaris=yes; GOOS=solaris ;; + *-*-gnu*) is_gnu=yes; GOOS=gnu ;; esac AM_CONDITIONAL(LIBGO_IS_DARWIN, test $is_darwin = yes) AM_CONDITIONAL(LIBGO_IS_FREEBSD, test $is_freebsd = yes) @@ -157,6 +159,7 @@ AM_CONDITIONAL(LIBGO_IS_DRAGONFLY, test $is_dragonfly = yes) AM_CONDITIONAL(LIBGO_IS_RTEMS, test $is_rtems = yes) AM_CONDITIONAL(LIBGO_IS_SOLARIS, test $is_solaris = yes) +AM_CONDITIONAL(LIBGO_IS_GNU, test $is_gnu = yes) AC_SUBST(GOOS) dnl Test whether we need to use DejaGNU or whether we can use the --- a/src/libgo/Makefile.am +++ b/src/libgo/Makefile.am @@ -418,9 +418,13 @@ if LIBGO_IS_SOLARIS runtime_netpoll_files = runtime/netpoll_select.c else +if LIBGO_IS_GNU +runtime_netpoll_files = runtime/netpoll_select.c +else runtime_netpoll_files = runtime/netpoll_kqueue.c endif endif +endif runtime_files = \ runtime/go-append.c \ @@ -682,7 +686,7 @@ go_net_cgo_file = go/net/cgo_linux.go go_net_sock_file = go/net/sock_linux.go go_net_sockopt_file = go/net/sockopt_linux.go -go_net_sockoptip_file = go/net/sockoptip_linux.go go/net/sockoptip_posix.go +go_net_sockoptip_file = go/net/sockoptip_linux.go go/net/sockoptip_bsd.go else if LIBGO_IS_SOLARIS go_net_cgo_file = go/net/cgo_linux.go @@ -702,6 +706,12 @@ go_net_sockopt_file = go/net/sockopt_bsd.go go_net_sockoptip_file = go/net/sockoptip_bsd.go go/net/sockoptip_posix.go else +if LIBGO_
[Fwd: Hurd port for gcc go PATCH 4-6 (9)]
--- Begin Message --- (continued) patch4.diff: src/libgo/go/syscall/libcall_posix-1.go: New file, a copy of libcall_posix.go with the mount call removed. mount/umount functionality exists but is currently part of Hurd utilities. patch5.diff: src/libgo/go/net/sock_gnu.go Create a dummy function for maxListenerBacklog() until implemented. patch6.diff: src/libgo/go/syscall/libcall_gnu.go Create a dummy function for raw_ptrace() until implemented. --- a/src/libgo/go/syscall/libcall_posix.go +++ b/src/libgo/go/syscall/libcall_posix.go @@ -3,6 +3,8 @@ // license that can be found in the LICENSE file. // POSIX library calls. +// Removed the mount call for GNU/Hurd, it exists but use translators. +// Functionality is not the same as descibed in sys/mount.h // This file is compiled as ordinary Go code, // but it is also input to mksyscall, // which parses the //sys lines and generates library call stubs. @@ -271,9 +273,6 @@ //sys Mknod(path string, mode uint32, dev int) (err error) //mknod(path *byte, mode Mode_t, dev _dev_t) _C_int -//sys Mount(source string, target string, fstype string, flags uintptr, data string) (err error) -//mount(source *byte, target *byte, fstype *byte, flags _C_long, data *byte) _C_int - //sys Nanosleep(time *Timespec, leftover *Timespec) (err error) //nanosleep(time *Timespec, leftover *Timespec) _C_int --- /dev/null +++ b/src/libgo/go/net/sock_gnu.go @@ -0,0 +1,14 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build gnu + +package net + +import "syscall" + +func maxListenerBacklog() int { + // TODO: Implement this + return syscall.SOMAXCONN +} --- /dev/null +++ b/src/libgo/go/syscall/libcall_gnu.go @@ -0,0 +1,11 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. +//FIXME: Try with libcall_irix.go + +package syscall + +// Dummy function +func raw_ptrace(request int, pid int, addr *byte, data *byte) Errno { +return ENOSYS +} --- End Message ---
[Fwd: Hurd port for gcc go PATCH 7-9 (9)]
--- Begin Message --- (continued) patch7.diff: src/libgo/go/syscall/wait.c Set WCONTINUED to zero if not defined (same fix as for lto in gcc-4.9) patch8.diff: src/libgo/mksysinfo.sh Add special treatment of EWOULDBLOCK, SYS_FCNTL and st_dev since they are either not defined or defined differently for the script to catch them. patch9.diff: src/libgo/runtime/netpoll.goc Rename errno to errno1 since errno clashes with included in that file on Hurd. --- a/src/libgo/go/syscall/wait.c +++ b/src/libgo/go/syscall/wait.c @@ -8,6 +8,9 @@ OS-independent. */ #include +#ifndef WCONTINUED +#define WCONTINUED 0 +#endif #include #include "runtime.h" --- a/src/libgo/mksysinfo.sh +++ b/src/libgo/mksysinfo.sh @@ -210,6 +210,11 @@ egrep '#define E[A-Z0-9_]+ ' | \ sed -e 's/^#define \(E[A-Z0-9_]*\) .*$/const \1 = Errno(_\1)/' >> ${OUT} +# Special treatment of EWOULDBLOCK for GNU/Hurd +# /usr/include/bits/errno.h: #define EWOULDBLOCK EAGAIN +egrep '^const EWOULDBLOCK = Errno(_EWOULDBLOCK)' ${OUT} | \ +sed -i.bak -e 's/_EWOULDBLOCK/_EAGAIN/' ${OUT} + # The O_xxx flags. egrep '^const _(O|F|FD)_' gen-sysinfo.go | \ sed -e 's/^\(const \)_\([^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT} @@ -225,6 +230,11 @@ echo "const F_DUPFD_CLOEXEC = 0" >> ${OUT} fi +# Special treatment of SYS_FCNTL for GNU/Hurd +if ! grep '^const SYS_FCNTL' ${OUT} >/dev/null 2>&1; then + echo "const SYS_FCNTL = 0" >> ${OUT} +fi + # These flags can be lost on i386 GNU/Linux when using # -D_FILE_OFFSET_BITS=64, because we see "#define F_SETLK F_SETLK64" # before we see the definition of F_SETLK64. @@ -528,6 +538,8 @@ # The stat type. # Prefer largefile variant if available. +# Special treatment of st_dev for GNU/Hurd +# /usr/include/i386-gnu/bits/stat.h: #define st_dev st_fsid stat=`grep '^type _stat64 ' gen-sysinfo.go || true` if test "$stat" != ""; then grep '^type _stat64 ' gen-sysinfo.go @@ -536,6 +548,7 @@ fi | sed -e 's/type _stat64/type Stat_t/' \ -e 's/type _stat/type Stat_t/' \ -e 's/st_dev/Dev/' \ + -e 's/st_fsid/Dev/' \ -e 's/st_ino/Ino/g' \ -e 's/st_nlink/Nlink/' \ -e 's/st_mode/Mode/' \ --- a/src/libgo/runtime/netpoll.goc.orig 2013-11-07 01:23:21.0 +0100 +++ b/src/libgo/runtime/netpoll.goc 2014-03-28 09:07:15.0 +0100 @@ -68,7 +68,7 @@ runtime_netpollinit(); } -func runtime_pollOpen(fd uintptr) (pd *PollDesc, errno int) { +func runtime_pollOpen(fd uintptr) (pd *PollDesc, errno1 int) { pd = allocPollDesc(); runtime_lock(pd); if(pd->wg != nil && pd->wg != READY) @@ -84,7 +84,7 @@ pd->wd = 0; runtime_unlock(pd); - errno = runtime_netpollopen(fd, pd); + errno1 = runtime_netpollopen(fd, pd); } func runtime_pollClose(pd *PollDesc) { --- End Message ---
Re: [PATCH, FORTRAN] Fix PR fortran/60718
Hi Tobias, On Fri, Apr 11, 2014 at 02:39:57PM +0200, Bernd Edlinger wrote: > On Fri, 11 Apr 2014 13:37:46, Tobias Burnus wrote: > Hmm, > > I was hoping somehow that only that test case is broken, > and needs to be fixed. The target attribute is somehow simple, > it implies intent(in) and the actual value will in most cases > be a pointer, as in the example. I think that passing another nonpointer TARGET to a dummy argument which has a TARGET attribute is at least as common as passing a POINTER to a TARGET. TARGET is roughtly the opposite to the restrict qualifier. By default any nonpointer variable does not alias with something else, unless it has the TARGET attribute; if it has, it (its address) can then be assigned to a pointer. POINTER intrinsically alias and cannot have the TARGET attribute. > > Pointer -> Nonalloc > > Allocatable -> Noalloc > > Nonallocatable*/Allocatable* -> Pointer with intent(in) > > Well, this approach does not handle intent(inout) at all. Note: Intent(in) can mean two different things. For normal variables, it means that those may not be modified at all (although, the value but not address of pointer components of structs [derived types] is permitted to be changed). And for pointers, it means that the pointer association status may not be changed (i.e. the pointer address, allocating, deallocating) - the value of the variable to which the pointer points to may still be modified. > If that is possible, the changed value must be written back again. > Are there any test cases for these conversions? For normal variables: Sure. For polymorphic variables, I have no idea. I am also not sure whether the value has to be written back or not; if only the value of the address pointed to changes and not the pointer itself (which can't in this context), everything should be fine. In any case, I am not really happy with the way we handle polymorphic types - and I am considering to change it when we implement the new array descriptor. Another issue is the handling of the restrict qualifier. GCC's implementation is not really compatible with the Fortran standard and gfortran's use. To fix that properly, we need Michael Matz restrict patch ... > > Thus, you need to handle those; gfc_expr_attr(e) should give you > > information about the expression. Or one could always check against > > gfc_typenode_for_spec (&fsym->ts); > > of both fsym and e. > > > > I am not sure, does gfc_typenode_for_spec always allocate new nodes? No idea - I had to look at the source code. Tobias
[PING] [PATCH, DOC] Mention -free enabled by default for -O2 and above on AArch64
Ping~ Originally posted here: http://gcc.gnu.org/ml/gcc-patches/2014-03/msg01282.html Thanks, Yufeng On 03/24/14 17:45, Yufeng Zhang wrote: Hi, -free has been enabled by default for -O2 and above on AArch64 a while ago. This patch updates the relevant part of user manual to reflect the fact. OK for stage-4? Thanks, Yufeng gcc/ * doc/invoke.texi (free): Document AArch64.
Re: Hurd port for gcc go PATCH 0-3 (9)
On Fri, Apr 11, 2014 at 5:47 AM, Svante Signell wrote: > > Attached are patches to enable gccgo to build properly on Debian > GNU/Hurd on gcc-4.9 (4.9-20140406). Thanks. Will review after 4.9 has branched. > Note: Creating the Makefile.in is hard (unnecessary) work since automake > is no longer used in the build system. > Both (cd src/libgo;automake-1.11) and (cd src/libgo;autoreconf2.64) > fails. The diff for Makefile.in has to be patched by hand with the aid > of the diff for Makefile.am :( This file should be possible to generate > from Makefile.am when modifying manually. In my opinion the build system > is broken wrt libgo. I don't understand this comment. The GCC libraries do still use automake. I regularly use automake to regenerate the libgo Makefile.in file. What fails when you try it? Ian
Re: [PATCH, PR60189, Cilk+] Fix for ICE with incorrect Cilk_sync usage
On 04/10/2014 10:27 AM, Jakub Jelinek wrote: I don't see the point of adding the extra {} around the whole case, there is no variable declared at that point. Agreed. + token = cp_lexer_peek_token (parser->lexer); + if (token->type != CPP_SEMICOLON) + { + error_at (token->location, "%<_Cilk_sync%> must be followed" + " by semicolon"); + postfix_expression = error_mark_node; + break; + } Any reason not to use cp_parser_require here? Jason
Re: [C++ Patch] PR 58600
OK. Jason
Re: [patch] Fix PR59295 -- move redundant friend decl warning under -Wredundant-decls
Ping? On Fri, Mar 21, 2014 at 9:16 AM, Paul Pluzhnikov wrote: > Greetings, > > To fix PR59295, this patch moves (generally useless) warning about > repeated / redundant friend declarations under -Wredundant-decls. > > Tested on Linux/x86_64 with no regressions. > > Ok for trunk once it opens in stage 1? Which has just happened. > > Thanks, > > -- > > 2014-03-21 Paul Pluzhnikov > > PR c++/59295 > * gcc/cp/friend.c (add_friend, make_friend_class): Move repeated > friend warning under Wredundant_decls. > > Index: gcc/cp/friend.c > === > --- gcc/cp/friend.c (revision 208748) > +++ gcc/cp/friend.c (working copy) > @@ -148,7 +148,8 @@ > if (decl == TREE_VALUE (friends)) > { > if (complain) > - warning (0, "%qD is already a friend of class %qT", > + warning (OPT_Wredundant_decls, > +"%qD is already a friend of class %qT", > decl, type); > return; > } > @@ -376,7 +377,8 @@ > if (friend_type == probe) > { > if (complain) > - warning (0, "%qD is already a friend of %qT", probe, type); > + warning (OPT_Wredundant_decls, > +"%qD is already a friend of %qT", probe, type); > break; > } > } > @@ -385,7 +387,8 @@ > if (same_type_p (probe, friend_type)) > { > if (complain) > - warning (0, "%qT is already a friend of %qT", probe, type); > + warning (OPT_Wredundant_decls, > +"%qT is already a friend of %qT", probe, type); > break; > } > } -- Paul Pluzhnikov
Re: [patch] Fix PR59295 -- move redundant friend decl warning under -Wredundant-decls
On Fri, Apr 11, 2014 at 09:20:13AM -0700, Paul Pluzhnikov wrote: > > To fix PR59295, this patch moves (generally useless) warning about > > repeated / redundant friend declarations under -Wredundant-decls. > > > > Tested on Linux/x86_64 with no regressions. > > > > Ok for trunk once it opens in stage 1? > > Which has just happened. CCing Jason as C++ maintainer. > > 2014-03-21 Paul Pluzhnikov > > > > PR c++/59295 > > * gcc/cp/friend.c (add_friend, make_friend_class): Move repeated > > friend warning under Wredundant_decls. No gcc/cp/ prefix in the ChangeLog entry. Jakub
C++ PATCH for c++/51253 (wrong init-list evaluation order)
Although the order of evaluation of function arguments is unspecified, the order of evaluation of elements of a braced initializer list is fixed, even if they end up being used as arguments to a constructor; this was clarified by DR 1030. This patch handles this by preevaluating affected arguments during gimplification, in the C++ hook. I also considered adding a language-independent flag to force in-order evaluation for a particular CALL_EXPR, but decided against it. Tested x86_64-pc-linux-gnu, applying to trunk. commit 7797f694b5229b41c4b640e076eb60bff024993e Author: Jason Merrill Date: Thu Apr 10 10:25:36 2014 -0400 DR 1030 PR c++/51253 * cp-tree.h (CALL_EXPR_LIST_INIT_P): New. * call.c (struct z_candidate): Add flags field. (add_candidate): Add flags parm. (add_function_candidate, add_conv_candidate, build_builtin_candidate) (add_template_candidate_real): Pass it. (build_over_call): Set CALL_EXPR_LIST_INIT_P. * tree.c (build_aggr_init_expr): Copy it. * semantics.c (simplify_aggr_init_expr): Preevaluate args if it's set. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index ae0d4ff..7c0dcc2 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -206,7 +206,7 @@ static conversion *maybe_handle_ref_bind (conversion **); static void maybe_handle_implicit_object (conversion **); static struct z_candidate *add_candidate (struct z_candidate **, tree, tree, const vec *, size_t, - conversion **, tree, tree, int, struct rejection_reason *); + conversion **, tree, tree, int, struct rejection_reason *, int); static tree source_type (conversion *); static void add_warning (struct z_candidate *, struct z_candidate *); static bool reference_compatible_p (tree, tree); @@ -520,7 +520,6 @@ struct z_candidate { sequence from the type returned by FN to the desired destination type. */ conversion *second_conv; - int viable; struct rejection_reason *reason; /* If FN is a member function, the binfo indicating the path used to qualify the name of FN at the call site. This path is used to @@ -538,6 +537,10 @@ struct z_candidate { tree explicit_targs; candidate_warning *warnings; z_candidate *next; + int viable; + + /* The flags active in add_candidate. */ + int flags; }; /* Returns true iff T is a null pointer constant in the sense of @@ -1810,7 +1813,8 @@ add_candidate (struct z_candidate **candidates, tree fn, tree first_arg, const vec *args, size_t num_convs, conversion **convs, tree access_path, tree conversion_path, - int viable, struct rejection_reason *reason) + int viable, struct rejection_reason *reason, + int flags) { struct z_candidate *cand = (struct z_candidate *) conversion_obstack_alloc (sizeof (struct z_candidate)); @@ -1825,6 +1829,7 @@ add_candidate (struct z_candidate **candidates, cand->viable = viable; cand->reason = reason; cand->next = *candidates; + cand->flags = flags; *candidates = cand; return cand; @@ -2061,7 +2066,7 @@ add_function_candidate (struct z_candidate **candidates, out: return add_candidate (candidates, fn, orig_first_arg, args, len, convs, - access_path, conversion_path, viable, reason); + access_path, conversion_path, viable, reason, flags); } /* Create an overload candidate for the conversion function FN which will @@ -2163,7 +2168,7 @@ add_conv_candidate (struct z_candidate **candidates, tree fn, tree obj, } return add_candidate (candidates, totype, first_arg, arglist, len, convs, - access_path, conversion_path, viable, reason); + access_path, conversion_path, viable, reason, flags); } static void @@ -2238,7 +2243,7 @@ build_builtin_candidate (struct z_candidate **candidates, tree fnname, num_convs, convs, /*access_path=*/NULL_TREE, /*conversion_path=*/NULL_TREE, - viable, reason); + viable, reason, flags); } static bool @@ -3056,7 +3061,7 @@ add_template_candidate_real (struct z_candidate **candidates, tree tmpl, return cand; fail: return add_candidate (candidates, tmpl, first_arg, arglist, nargs, NULL, - access_path, conversion_path, 0, reason); + access_path, conversion_path, 0, reason, flags); } @@ -7219,7 +7224,11 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain) return error_mark_node; } - return build_cxx_call (fn, nargs, argarray, complain|decltype_flag); + tree call = build_cxx_call (fn, nargs, argarray, complain|decltype_flag); + if (TREE_CODE (call) == CALL_EXPR + && (cand->flags & LOOKUP_LIST_INIT_CTOR)) +CALL_EXPR_LIST_INIT_P (call) = true; + return call; } /* Build and return a call to FN, using NARGS arguments in ARGARRAY. diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index e9fe86e..bafc32d 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -101,12 +101,14 @@ c-common.h, not after. FNDECL_USED_AUTO (in FUNCTION_DECL) DECLTYPE_FOR_LAMBDA_PR
RE: [PATCH, PR60189, Cilk+] Fix for ICE with incorrect Cilk_sync usage
> > >> + token = cp_lexer_peek_token (parser->lexer); > >> + if (token->type != CPP_SEMICOLON) > >> + { > >> + error_at (token->location, "%<_Cilk_sync%> must be > >> followed" > >> + " by semicolon"); > >> + postfix_expression = error_mark_node; > >> + break; > >> + } > > Any reason not to use cp_parser_require here? Right! Will try it and repost the patch. Thanks! Igor > > Jason
[Patch, avr] Propagate -mrelax gcc driver flag to assembler
This patch modifies AVR target's ASM spec to pass -mlink-relax to the assembler if -mrelax is passed to the compiler driver. This was already being passed on to the linker, this patch merely makes the assembler also aware of it. The corresponding patch in binutils to handle the -mlink-relax patch is already committed in the binutils repo. I'm not sure how to manage a running a newer gcc with an older version of binutils though - how is this generally handled? If ok, could someone commit please? I don't have commit access. Regards Senthil 2014-04-11 Senthil Kumar Selvaraj * config/avr/avr.h: Modify ASM_SPEC to pass -mlink-relax to assembler. diff --git gcc/config/avr/avr.h gcc/config/avr/avr.h index 78434ec..c1b4dd9 100644 --- gcc/config/avr/avr.h +++ gcc/config/avr/avr.h @@ -512,7 +512,8 @@ extern const char *avr_device_to_sp8 (int argc, const char **argv); %{!fenforce-eh-specs:-fno-enforce-eh-specs} \ %{!fexceptions:-fno-exceptions}" -#define ASM_SPEC "%:device_to_as(%{mmcu=*:%*}) " +#define ASM_SPEC "%:device_to_as(%{mmcu=*:%*})\ +%{mrelax:-mlink-relax}" #define LINK_SPEC "\ %{mrelax:--relax\
Re: [PATCH] PR debug/16063. Add DW_AT_type to DW_TAG_enumeration.
>> The DWARF bits are fine with me. > > Thanks. Who can approve the other bits? You should probably get C and C++ front end approval. I'm not really sure who needs to review patches in c-family/. Since the part in c/ is so tiny, maybe all you need is a C++ front end maintainer. Both Richard Henderson and Jason Merrill are global reviewers, so either of them could approve the whole thing. > When approved should I wait till stage 1 opens before committing? Yes. The PR you're fixing is an enhancement request, not a regression, so it needs to wait. -cary
C++ PATCH for DR 1338 (operator new aliasing)
At the last C++ meeting I got the committee to accept wording that ought to allow us to set DECL_IS_MALLOC on the built-in operator new: Furthermore, for the library allocation functions in 18.6.1.1 [new.delete.single] and 18.6.1.2 [new.delete.array], p0 shall point to a block of storage disjoint from the storage for any other object accessible to the caller. Tested x86_64-pc-linux-gnu, applying to trunk. commit decb849d1c9670c5e5cd07e1bea776244ae9a9d2 Author: Jason Merrill Date: Tue Feb 18 09:15:02 2014 -0500 DR 1338 * decl.c (cxx_init_decl_processing): Set DECL_IS_MALLOC on built-in operator new. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 3400594..069b374 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -3847,8 +3847,12 @@ cxx_init_decl_processing (void) newtype = build_exception_variant (newtype, new_eh_spec); deltype = cp_build_type_attribute_variant (void_ftype_ptr, extvisattr); deltype = build_exception_variant (deltype, empty_except_spec); -DECL_IS_OPERATOR_NEW (push_cp_library_fn (NEW_EXPR, newtype, 0)) = 1; -DECL_IS_OPERATOR_NEW (push_cp_library_fn (VEC_NEW_EXPR, newtype, 0)) = 1; +tree opnew = push_cp_library_fn (NEW_EXPR, newtype, 0); +DECL_IS_MALLOC (opnew) = 1; +DECL_IS_OPERATOR_NEW (opnew) = 1; +opnew = push_cp_library_fn (VEC_NEW_EXPR, newtype, 0); +DECL_IS_MALLOC (opnew) = 1; +DECL_IS_OPERATOR_NEW (opnew) = 1; global_delete_fndecl = push_cp_library_fn (DELETE_EXPR, deltype, ECF_NOTHROW); push_cp_library_fn (VEC_DELETE_EXPR, deltype, ECF_NOTHROW);
C++ PATCH for c++/51747 (list-initialization from same type)
Recent changes to the C++ standard have allowed the use of list-initialization with a single initializer of the same type as the target; this patch updates reshape_init accordingly. Tested x86_64-pc-linux-gnu, applying to trunk. commit 0bb6493b9f08021d00a636fe5b4ea777bd4cbc13 Author: Jason Merrill Date: Fri Mar 21 06:15:02 2014 -0400 DR 1467 PR c++/51747 * decl.c (reshape_init_r): Handle a single element of class type. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 069b374..f8ae07c 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -5405,6 +5405,18 @@ reshape_init_r (tree type, reshape_iter *d, bool first_initializer_p, return init; } + /* "If T is a class type and the initializer list has a single element of + type cv U, where U is T or a class derived from T, the object is + initialized from that element." Even if T is an aggregate. */ + if (cxx_dialect >= cxx11 && CLASS_TYPE_P (type) + && first_initializer_p + && d->end - d->cur == 1 + && reference_related_p (type, TREE_TYPE (init))) +{ + d->cur++; + return init; +} + /* [dcl.init.aggr] All implicit type conversions (clause _conv_) are considered when diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist83.C b/gcc/testsuite/g++.dg/cpp0x/initlist83.C new file mode 100644 index 000..4a5eeb6 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist83.C @@ -0,0 +1,7 @@ +// DR 1467, c++/51747 +// { dg-do compile { target c++11 } } + +struct X { }; + +X x; +X x2{x}; diff --git a/gcc/testsuite/g++.dg/init/aggr4.C b/gcc/testsuite/g++.dg/init/aggr4.C index 7120e68..b0eae2e 100644 --- a/gcc/testsuite/g++.dg/init/aggr4.C +++ b/gcc/testsuite/g++.dg/init/aggr4.C @@ -4,4 +4,4 @@ struct A }; A a1 = { 1 }; // ok -A a2 = { a1 }; // { dg-error "cannot convert" } +A a2 = { a1 }; // { dg-error "cannot convert" "" { target { ! c++11 } } }
[PATCH, AArch64] Enable shuffle on big-endian and turn on the testsuite
As a followup to http://gcc.gnu.org/ml/gcc-patches/2014-04/msg00079.html, which implements the shuffle operation but still leaves that unused - if/once that's gone in, I see no reason now we can't start using it, and enable the appropriate tests. I see the following test changes: FAIL->PASS: gcc.c-torture/execute/2112-1.c execution, -O0 gcc.c-torture/execute/2112-1.c execution, -O1 gcc.c-torture/execute/900409-1.c execution, -O0 gcc.c-torture/execute/900409-1.c execution, -O1 gcc.c-torture/execute/ieee/2320-1.c execution, -O0 gcc.c-torture/execute/ieee/2320-1.c execution, -O1 gcc.dg/vect/no-vfa-vect-depend-2.c scan-tree-dump-times vect "dependence distance negative" 1 gcc.dg/vect/no-vfa-vect-depend-2.c scan-tree-dump-times vect "vectorized 1 loops" 1 gcc.dg/vect/no-vfa-vect-depend-3.c scan-tree-dump-times vect "dependence distance negative" 4 gcc.dg/vect/no-vfa-vect-depend-3.c scan-tree-dump-times vect "vectorized 1 loops" 4 gcc.dg/vect/slp-perm-1.c -flto -ffat-lto-objects execution test gcc.dg/vect/slp-perm-1.c execution test gcc.dg/vect/slp-perm-3.c -flto -ffat-lto-objects execution test gcc.dg/vect/slp-perm-3.c execution test gcc.dg/vect/slp-perm-5.c -flto -ffat-lto-objects execution test gcc.dg/vect/slp-perm-5.c execution test gcc.dg/vect/slp-perm-6.c -flto -ffat-lto-objects execution test gcc.dg/vect/slp-perm-6.c execution test gcc.dg/vect/slp-perm-7.c -flto -ffat-lto-objects execution test gcc.dg/vect/slp-perm-7.c execution test UNSUPPORTED/NA->PASS: gcc.dg/vect/nodump-forwprop-22.c (test for excess errors) gcc.dg/vect/nodump-forwprop-22.c scan-tree-dump-not copyprop1 "BIT_FIELD_REF" gcc.dg/vect/nodump-forwprop-22.c scan-tree-dump-times copyprop1 "VEC_PERM_EXPR" 1 gcc.dg/vect/pr43432.c -flto -ffat-lto-objects scan-tree-dump-times vect "vectorized 1 loops" 1 gcc.dg/vect/pr43432.c scan-tree-dump-times vect "vectorized 1 loops" 1 gcc.dg/vect/pr45752.c -flto -ffat-lto-objects scan-tree-dump vect "permutation requires at least three vectors" gcc.dg/vect/pr45752.c scan-tree-dump vect "permutation requires at least three vectors" gcc.dg/vect/slp-38.c -flto -ffat-lto-objects scan-tree-dump-times vect "vectorized 1 loops in function" 1 gcc.dg/vect/slp-38.c scan-tree-dump-times vect "vectorized 1 loops in function" 1 gcc.dg/vect/slp-perm-1.c -flto -ffat-lto-objects scan-tree-dump-times vect "vectorized 1 loops" 1 gcc.dg/vect/slp-perm-1.c -flto -ffat-lto-objects scan-tree-dump-times vect "vectorizing stmts using SLP" 1 gcc.dg/vect/slp-perm-1.c scan-tree-dump-times vect "vectorized 1 loops" 1 gcc.dg/vect/slp-perm-1.c scan-tree-dump-times vect "vectorizing stmts using SLP" 1 gcc.dg/vect/slp-perm-2.c -flto -ffat-lto-objects scan-tree-dump-times vect "vectorized 1 loops" 1 gcc.dg/vect/slp-perm-2.c -flto -ffat-lto-objects scan-tree-dump-times vect "vectorizing stmts using SLP" 1 gcc.dg/vect/slp-perm-2.c scan-tree-dump-times vect "vectorized 1 loops" 1 gcc.dg/vect/slp-perm-2.c scan-tree-dump-times vect "vectorizing stmts using SLP" 1 gcc.dg/vect/slp-perm-3.c -flto -ffat-lto-objects scan-tree-dump-times vect "vectorized 1 loops" 1 gcc.dg/vect/slp-perm-3.c -flto -ffat-lto-objects scan-tree-dump-times vect "vectorizing stmts using SLP" 1 gcc.dg/vect/slp-perm-3.c scan-tree-dump-times vect "vectorized 1 loops" 1 gcc.dg/vect/slp-perm-3.c scan-tree-dump-times vect "vectorizing stmts using SLP" 1 gcc.dg/vect/slp-perm-4.c -flto -ffat-lto-objects scan-tree-dump vect "permutation requires at least three vectors" gcc.dg/vect/slp-perm-4.c scan-tree-dump vect "permutation requires at least three vectors" gcc.dg/vect/slp-perm-5.c -flto -ffat-lto-objects scan-tree-dump-times vect "vectorized 1 loops" 1 gcc.dg/vect/slp-perm-5.c -flto -ffat-lto-objects scan-tree-dump-times vect "vectorizing stmts using SLP" 2 gcc.dg/vect/slp-perm-5.c scan-tree-dump-times vect "vectorized 1 loops" 1 gcc.dg/vect/slp-perm-5.c scan-tree-dump-times vect "vectorizing stmts using SLP" 2 gcc.dg/vect/slp-perm-6.c -flto -ffat-lto-objects scan-tree-dump-times vect "vectorized 1 loops" 1 gcc.dg/vect/slp-perm-6.c -flto -ffat-lto-objects scan-tree-dump-times vect "vectorizing stmts using SLP" 2 gcc.dg/vect/slp-perm-6.c scan-tree-dump-times vect "vectorized 1 loops" 1 gcc.dg/vect/slp-perm-6.c scan-tree-dump-times vect "vectorizing stmts using SLP" 2 gcc.dg/vect/slp-perm-7.c -flto -ffat-lto-objects scan-tree-dump-times vect "vectorized 1 loops" 1 gcc.dg/vect/slp-perm-7.c -flto -ffat-lto-objects scan-tree-dump-times vect "vectorizing stmts using SLP" 1 gcc.dg/vect/slp-perm-7.c scan-tree-dump-times vect "vectorized 1 loops" 1 gcc.dg/vect/slp-perm-7.c scan-tree-dump-times vect "vectorizing stmts using SLP" 1 gcc.dg/vect/vect-114.c -flto -ffat-lto-objects scan-tree-dump-times vect "vectorized 1 loops" 1 gcc.dg/vect/vect-114.c scan-tree-dump-times vect "vectorized 1 loops" 1 gcc.dg/vect/vect-15-big-array.c -flto -ffat-lto-objects scan-tree-dump-times vect "vectorized 1 loops" 1 gcc.d
C++ PATCH to avoid duplicate parser errors
When I fixed 60375, I noticed that we were giving the error multiple times. We already have a mechanism for avoiding repeated diagnostics for ambiguous lookup; this patch uses that mechanism for the lambda error as well. Tested x86_64-pc-linux-gnu, applying to trunk. commit 8e24a9920a302fe140d9e4385f4de23905baf7bd Author: Jason Merrill Date: Mon Mar 24 16:11:02 2014 -0400 * parser.h (struct cp_token): Rename ambiguous_p to error_reported. * parser.c: Adjust. (cp_lexer_get_preprocessor_token): Always clear it. (cp_parser_lambda_expression): Use it to avoid duplicate diagnostics. diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index f386eed..bb59e3b 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -762,6 +762,7 @@ cp_lexer_get_preprocessor_token (cp_lexer *lexer, cp_token *token) token->keyword = RID_MAX; token->pragma_kind = PRAGMA_NONE; token->purged_p = false; + token->error_reported = false; /* On some systems, some header files are surrounded by an implicit extern "C" block. Set a flag in the token if it @@ -797,7 +798,6 @@ cp_lexer_get_preprocessor_token (cp_lexer *lexer, cp_token *token) C_SET_RID_CODE (token->u.value, RID_MAX); } - token->ambiguous_p = false; token->keyword = RID_MAX; } } @@ -3011,7 +3011,7 @@ cp_parser_parse_and_diagnose_invalid_type_name (cp_parser *parser) if (token->type == CPP_NESTED_NAME_SPECIFIER) { cp_token *next = cp_lexer_peek_nth_token (parser->lexer, 2); - if (next->type == CPP_NAME && next->ambiguous_p) + if (next->type == CPP_NAME && next->error_reported) goto out; } @@ -4535,7 +4535,7 @@ cp_parser_primary_expression (cp_parser *parser, we've already issued an error message; there's no reason to check again. */ if (id_expr_token->type == CPP_NAME - && id_expr_token->ambiguous_p) + && id_expr_token->error_reported) { cp_parser_simulate_error (parser); return error_mark_node; @@ -5313,7 +5313,7 @@ cp_parser_nested_name_specifier_opt (cp_parser *parser, token = cp_lexer_consume_token (parser->lexer); if (!error_p) { - if (!token->ambiguous_p) + if (!token->error_reported) { tree decl; tree ambiguous_decls; @@ -8719,14 +8719,18 @@ cp_parser_lambda_expression (cp_parser* parser) tree lambda_expr = build_lambda_expr (); tree type; bool ok = true; + cp_token *token = cp_lexer_peek_token (parser->lexer); - LAMBDA_EXPR_LOCATION (lambda_expr) -= cp_lexer_peek_token (parser->lexer)->location; + LAMBDA_EXPR_LOCATION (lambda_expr) = token->location; if (cp_unevaluated_operand) { - error_at (LAMBDA_EXPR_LOCATION (lambda_expr), - "lambda-expression in unevaluated context"); + if (!token->error_reported) + { + error_at (LAMBDA_EXPR_LOCATION (lambda_expr), + "lambda-expression in unevaluated context"); + token->error_reported = true; + } ok = false; } @@ -19129,7 +19133,7 @@ cp_parser_class_name (cp_parser *parser, /* Look for the identifier. */ identifier_token = cp_lexer_peek_token (parser->lexer); - ambiguous_p = identifier_token->ambiguous_p; + ambiguous_p = identifier_token->error_reported; identifier = cp_parser_identifier (parser); /* If the next token isn't an identifier, we are certainly not looking at a class-name. */ diff --git a/gcc/cp/parser.h b/gcc/cp/parser.h index d558c60..758c6df 100644 --- a/gcc/cp/parser.h +++ b/gcc/cp/parser.h @@ -51,10 +51,10 @@ typedef struct GTY (()) cp_token { ENUM_BITFIELD (pragma_kind) pragma_kind : 6; /* True if this token is from a context where it is implicitly extern "C" */ BOOL_BITFIELD implicit_extern_c : 1; - /* True for a CPP_NAME token that is not a keyword (i.e., for which - KEYWORD is RID_MAX) iff this name was looked up and found to be - ambiguous. An error has already been reported. */ - BOOL_BITFIELD ambiguous_p : 1; + /* True if an error has already been reported for this token, such as a + CPP_NAME token that is not a keyword (i.e., for which KEYWORD is + RID_MAX) iff this name was looked up and found to be ambiguous. */ + BOOL_BITFIELD error_reported : 1; /* True for a token that has been purged. If a token is purged, it is no longer a valid token and it should be considered deleted. */
C++ PATCH for c++/57926 (atomic builtins and C++ arrays)
In the C front end, arrays used as expressions immediately decay to pointers. In C++, they don't decay until we know that the expression is being used as an rvalue, as we might want to bind a reference to the array as a whole. The atomics code in c-common expects pointers, so let's force any array arguments to decay. Tested x86_64-pc-linux-gnu, applying to trunk. commit 36cb4ee17f1d0e9fd14210fda1eb43e21637e981 Author: Jason Merrill Date: Mon Apr 7 12:57:34 2014 -0400 PR c++/57926 * c-common.c (sync_resolve_size, get_atomic_generic_size): Call default_conversion for an array argument. diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 03731b4..1d56bc0 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -10202,6 +10202,13 @@ sync_resolve_size (tree function, vec *params) } type = TREE_TYPE ((*params)[0]); + if (TREE_CODE (type) == ARRAY_TYPE) +{ + /* Force array-to-pointer decay for C++. */ + gcc_assert (c_dialect_cxx()); + (*params)[0] = default_conversion ((*params)[0]); + type = TREE_TYPE ((*params)[0]); +} if (TREE_CODE (type) != POINTER_TYPE) goto incompatible; @@ -10353,6 +10360,13 @@ get_atomic_generic_size (location_t loc, tree function, /* Get type of first parameter, and determine its size. */ type_0 = TREE_TYPE ((*params)[0]); + if (TREE_CODE (type_0) == ARRAY_TYPE) +{ + /* Force array-to-pointer decay for C++. */ + gcc_assert (c_dialect_cxx()); + (*params)[0] = default_conversion ((*params)[0]); + type_0 = TREE_TYPE ((*params)[0]); +} if (TREE_CODE (type_0) != POINTER_TYPE || VOID_TYPE_P (TREE_TYPE (type_0))) { error_at (loc, "argument 1 of %qE must be a non-void pointer type", diff --git a/gcc/testsuite/g++.dg/ext/atomic-2.C b/gcc/testsuite/g++.dg/ext/atomic-2.C new file mode 100644 index 000..ac363eb --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/atomic-2.C @@ -0,0 +1,14 @@ +// PR c++/57926 + +long Mutex[1]; + +int AcquireLogMutex(void) +{ + return __atomic_exchange_n(Mutex, 1, __ATOMIC_SEQ_CST); +} + +void ReleaseLogMutex(void) +{ + long i = 0; + __atomic_store(Mutex, &i, __ATOMIC_SEQ_CST); +}
[PATCH] [MIPS] Fix operands for microMIPS SW16, SH16 and SB16
Hi Richard, This patch fixes a problem with the SW16, SH16 and SB16 microMIPS instructions. GCC is incorrectly calculating the length of these instructions if $16 is used as the source operand. The incorrect length calculation can cause a 32-bit instruction to be placed in a short delay slot. The assembler does detect this and issues a warning. This patch changes the allowable registers for the short store instructions to $0, $2-$7, and $17. Okay to install? Okay to install for 4.9? Thanks, Catherine umips-store.cl Description: umips-store.cl umips-store.patch Description: umips-store.patch
Re: [v3] complex functions with expression template reals
On Wed, 26 Feb 2014, Paolo Carlini wrote: On 02/26/2014 10:57 AM, Jonathan Wakely wrote: On 24 February 2014 09:10, Paolo Carlini wrote: Another option would be just using boost/multiprecision/mpfr.hpp when available. In general, I think it makes sense to have a minimum of infrastructure enabling tests checking interoperability with boost. If only we had a check_v3_target_header { args } it would be most of it, but it doesn't seem we do?!? Anyway I guess we can take care of that post 4.9.0 and commit the straightforward code tweak now. Jon? I'd be happy with it for Stage 1, but I don't think we should apply it now if it is only useful for people doing unusual (unsupported) things with std::complex. Ok. Marc, please remember to apply it as soon as Stage 1 re-opens. r209321 (for a patch accepted long ago, I guess it is better to leave a trace in gcc-patches near the commit date) -- Marc Glisse
New Swedish PO file for 'gcc' (version 4.9-b20140202)
Hello, gentle maintainer. This is a message from the Translation Project robot. A revised PO file for textual domain 'gcc' has been submitted by the Swedish team of translators. The file is available at: http://translationproject.org/latest/gcc/sv.po (This file, 'gcc-4.9-b20140202.sv.po', has just now been sent to you in a separate email.) All other PO files for your package are available in: http://translationproject.org/latest/gcc/ Please consider including all of these in your next release, whether official or a pretest. Whenever you have a new distribution with a new version number ready, containing a newer POT file, please send the URL of that distribution tarball to the address below. The tarball may be just a pretest or a snapshot, it does not even have to compile. It is just used by the translators when they need some extra translation context. The following HTML page has been updated: http://translationproject.org/domain/gcc.html If any question arises, please contact the translation coordinator. Thank you for all your work, The Translation Project robot, in the name of your translation coordinator.
RE: [PATCH, PR60189, Cilk+] Fix for ICE with incorrect Cilk_sync usage
> > >> + token = cp_lexer_peek_token (parser->lexer); > >> + if (token->type != CPP_SEMICOLON) > >> + { > >> + error_at (token->location, "%<_Cilk_sync%> must be > >> followed" > >> + " by semicolon"); > >> + postfix_expression = error_mark_node; > >> + break; > >> + } > > Any reason not to use cp_parser_require here? I remembered - I haven't used cp_parser_require since it calls cp_lexer_consume_token which is not needed at this point. It is already called a bit earlier. Igor > > Jason
Re: Avoid unnecesary GGC runs during LTO
> > + > > + /* At this stage we know that majority of GGC memory is reachable. > > + Growing the limits prevents unnecesary invocation of GGC. */ > > + ggc_grow (); > >ggc_collect (); > > Isn't the collect here pointless? I see not in ENABLE_CHECKING, but > shouldn't this be abstracted away, thus call ggc_collect from ggc_grow? > Or maybe rather even for ENABLE_CHECKING adjust G.allocated_last_gc > and simply drop the ggc_collect above (). I am fine with both. I basically decided to keep the explicit ggc_collect() to make it clear (from lto.c source code) that we are GGC safe at this point and to have way to double check that we do not produce too much of garbage with checking disabled. (so with -Q I will see how much it is collected at that place). We can embed it into ggc_grow and document that w/o checking it is equivalent to ggc_cooect. > > Anyway, this is sth for stage1 at this point. OK, Honza > > Thanks, > Richard. > > >/* Set the hooks so that all of the ipa passes can read in their data. > > */ > > Index: ggc-none.c > > === > > --- ggc-none.c (revision 209170) > > +++ ggc-none.c (working copy) > > @@ -63,3 +63,8 @@ ggc_free (void *p) > > { > >free (p); > > } > > + > > +void > > +ggc_grow (void) > > +{ > > +} > > Index: ggc-page.c > > === > > --- ggc-page.c (revision 209170) > > +++ ggc-page.c (working copy) > > @@ -2095,6 +2095,19 @@ ggc_collect (void) > > fprintf (G.debug_file, "END COLLECTING\n"); > > } > > > > +/* Assume that all GGC memory is reachable and grow the limits for next > > collection. */ > > + > > +void > > +ggc_grow (void) > > +{ > > +#ifndef ENABLE_CHECKING > > + G.allocated_last_gc = MAX (G.allocated_last_gc, > > +G.allocated); > > +#endif > > + if (!quiet_flag) > > +fprintf (stderr, " {GC start %luk} ", (unsigned long) G.allocated / > > 1024); > > +} > > + > > /* Print allocation statistics. */ > > #define SCALE(x) ((unsigned long) ((x) < 1024*10 \ > > ? (x) \ > > > > > > -- > Richard Biener > SUSE / SUSE Labs > SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746 > GF: Jeff Hawn, Jennifer Guild, Felix Imend"orffer
Re: [v3] LWG 2106: move_iterator::reference
On Wed, 5 Mar 2014, Jonathan Wakely wrote: On 5 March 2014 19:36, Marc Glisse wrote: Hello, this issue got delayed in LWG, apparently because of a failed "improvement" to the wording along the way (happens, that's ok), but there seems to be a consensus on the resolution and I don't really see the point of waiting (it changes code that currently returns a reference to a temporary). Tested on x86_64-linux-gnu. Stage 1? Yes, OK for Stage 1. Please put _GLIBCXX_RESOLVE_DEFECTS (or whatever it is we use elsewhere) in the comment, rather than just "DR 2106". r209323 (again, only posting because this was accepted long ago) -- Marc Glisse
Re: r201440 - in /branches/gcc-4_8-branch: gcc/Chan...
Hi, This commit added LIBITM_CHECK_AS_HTM to libitm/configure.ac, but did not add it to acinclude.m4, so configure complains about an unrecognised command (4.8 only). I don't know if LIBITM_CHECK_AS_HTM is supposed to check anything that needs checking on 4.8, I just got confused by the message. Cheers, Harald van Dijk On 02/08/13 17:41, kreb...@gcc.gnu.org wrote: > Author: krebbel > Date: Fri Aug 2 15:41:10 2013 > New Revision: 201440 > > URL: http://gcc.gnu.org/viewcvs?rev=201440&root=gcc&view=rev > Log: > 2013-08-02 Andreas Krebbel > > Backports from mainline: > 2013-06-27 Andreas Krebbel > > * config/s390/s390.c: Rename UNSPEC_CCU_TO_INT to > UNSPEC_STRCMPCC_TO_INT and UNSPEC_CCZ_TO_INT to UNSPEC_CC_TO_INT. > (struct machine_function): Add tbegin_p. > (s390_canonicalize_comparison): Fold CC mode compares to > conditional jump if possible. > (s390_emit_jump): Return the emitted jump. > (s390_branch_condition_mask, s390_branch_condition_mnemonic): > Handle CCRAWmode compares. > (s390_option_override): Default to -mhtm if available. > (s390_reg_clobbered_rtx): Handle floating point regs as well. > (s390_regs_ever_clobbered): Use s390_regs_ever_clobbered also for > FPRs instead of df_regs_ever_live_p. > (s390_optimize_nonescaping_tx): New function. > (s390_init_frame_layout): Extend clobbered_regs array to cover > FPRs as well. > (s390_emit_prologue): Call s390_optimize_nonescaping_tx. > (s390_expand_tbegin): New function. > (enum s390_builtin): New enum definition. > (code_for_builtin): New array definition. > (s390_init_builtins): New function. > (s390_expand_builtin): New function. > (TARGET_INIT_BUILTINS): Define. > (TARGET_EXPAND_BUILTIN): Define. > * common/config/s390/s390-common.c (processor_flags_table): Add > PF_TX. > * config/s390/predicates.md (s390_comparison): Handle CCRAWmode. > (s390_alc_comparison): Likewise. > * config/s390/s390-modes.def: Add CCRAWmode. > * config/s390/s390.h (processor_flags): Add PF_TX. > (TARGET_CPU_HTM): Define macro. > (TARGET_HTM): Define macro. > (TARGET_CPU_CPP_BUILTINS): Define __HTM__ for htm. > * config/s390/s390.md: Rename UNSPEC_CCU_TO_INT to > UNSPEC_STRCMPCC_TO_INT and UNSPEC_CCZ_TO_INT to UNSPEC_CC_TO_INT. > (UNSPECV_TBEGIN, UNSPECV_TBEGINC, UNSPECV_TEND, UNSPECV_TABORT) > (UNSPECV_ETND, UNSPECV_NTSTG, UNSPECV_PPA): New unspecv enum > values. > (TBEGIN_MASK, TBEGINC_MASK): New constants. > ("*cc_to_int"): Move up. > ("*movcc", "*cjump_64", "*cjump_31"): Accept integer > constants other than 0. > ("*ccraw_to_int"): New insn and splitter definition. > ("tbegin", "tbegin_nofloat", "tbegin_retry") > ("tbegin_retry_nofloat", "tbeginc", "tend", "tabort") > ("tx_assist"): New expander. > ("tbegin_1", "tbegin_nofloat_1", "*tbeginc_1", "*tend_1") > ("*tabort_1", "etnd", "ntstg", "*ppa"): New insn definition. > * config/s390/s390.opt: Add -mhtm option. > * config/s390/s390-protos.h (s390_emit_jump): Add return type. > * config/s390/htmxlintrin.h: New file. > * config/s390/htmintrin.h: New file. > * config/s390/s390intrin.h: New file. > * doc/extend.texi: Document htm builtins. > * config.gcc: Add the new header files to extra_headers. > > 2013-07-17 Andreas Krebbel > > * config/s390/s390.c: (s390_expand_builtin): Allow -mhtm to be > enabled without -march=zEC12. > * config/s390/s390.h (TARGET_HTM): Do not require EC12 machine > flags to be set. > > 2013-08-02 Andreas Krebbel > > Backports from mainline: > 2013-04-23 Andreas Krebbel > > * config/s390/sjlj.S: New file. > * config/s390/target.h: New file. > * configure.tgt: Set options for S/390. > > 2013-06-27 Andreas Krebbel > > * config/s390/target.h: Include htmintrin.h. > (_HTM_ITM_RETRIES): New macro definition. > (htm_available, htm_init, htm_begin, htm_begin_success) > (htm_commit, htm_abort, htm_abort_should_retry): New functions. > > 2013-07-17 Andreas Krebbel > > * acinclude.m4: Add htm asm check for s390. > * configure.tgt: Add -mhtm and -Wa,-march=zEC12 to the > options. > * configure: Regenerate. > * config/s390/target.h: Remove __HTM__ check. > (htm_available): Call getauxval to get hwcaps and check > whether HTM is available or not. > > 2013-07-29 Andreas Krebbel > > * config/s390/target.h (htm_begin, htm_commit, htm_abort) > (htm_transaction_active): Enable zEC12 instructions in the > assembler. > * configure.tgt: Remove -Wa,-march=zEC12 from XCFLAGS. > > 2013-08-02 Andreas Krebbel > > * configure.tgt: Add -msoft-float to XCFLAGS. > > 2013-08-02 A
RE: [PATCH] [MIPS] Fix operands for microMIPS SW16, SH16 and SB16
Hi Catherine/Richard, I think there may be some impact on register move costs by introducing this class. Is it worth having mips_canonicalize_move_class return M16_REGS for M16_STORE_REGS to reduce the effect on costings? Given the extra register is only $0 then this would seem mostly acceptable albeit slightly strange. What do you think? regards, Matthew > -Original Message- > From: gcc-patches-ow...@gcc.gnu.org [mailto:gcc-patches- > ow...@gcc.gnu.org] On Behalf Of Moore, Catherine > Sent: 11 April 2014 19:25 > To: gcc-patches@gcc.gnu.org > Cc: Richard Sandiford > Subject: [PATCH] [MIPS] Fix operands for microMIPS SW16, SH16 and SB16 > > Hi Richard, > > This patch fixes a problem with the SW16, SH16 and SB16 microMIPS > instructions. GCC is incorrectly calculating the length of these > instructions if $16 is used as the source operand. The incorrect length > calculation can cause a 32-bit instruction to be placed in a short delay > slot. The assembler does detect this and issues a warning. > > This patch changes the allowable registers for the short store > instructions to $0, $2-$7, and $17. > > Okay to install? Okay to install for 4.9? > > Thanks, > Catherine >
[i386] Replace builtins with vector extensions
Hello, the previous discussion on the topic was before we added all those #pragma target in *mmintrin.h: http://gcc.gnu.org/ml/gcc-patches/2013-04/msg00374.html I believe that removes a large part of the arguments against it. Note that I only did a few of the more obvious intrinsics, I am waiting to see if this patch is accepted before doing more. Bootstrap+testsuite on x86_64-linux-gnu. 2014-04-11 Marc Glisse * config/i386/xmmintrin.h (_mm_add_ps, _mm_sub_ps, _mm_mul_ps, _mm_div_ps, _mm_store_ss, _mm_cvtss_f32): Use vector extensions instead of builtins. * config/i386/emmintrin.h (_mm_store_sd, _mm_cvtsd_f64, _mm_storeh_pd, _mm_cvtsi128_si64, _mm_cvtsi128_si64x, _mm_add_pd, _mm_sub_pd, _mm_mul_pd, _mm_div_pd, _mm_storel_epi64, _mm_movepi64_pi64, _mm_loadh_pd, _mm_loadl_pd): Likewise. (_mm_sqrt_sd): Fix comment. -- Marc GlisseIndex: gcc/config/i386/emmintrin.h === --- gcc/config/i386/emmintrin.h (revision 209323) +++ gcc/config/i386/emmintrin.h (working copy) @@ -161,40 +161,40 @@ _mm_store_pd (double *__P, __m128d __A) extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_storeu_pd (double *__P, __m128d __A) { __builtin_ia32_storeupd (__P, __A); } /* Stores the lower DPFP value. */ extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_store_sd (double *__P, __m128d __A) { - *__P = __builtin_ia32_vec_ext_v2df (__A, 0); + *__P = __A[0]; } extern __inline double __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_cvtsd_f64 (__m128d __A) { - return __builtin_ia32_vec_ext_v2df (__A, 0); + return __A[0]; } extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_storel_pd (double *__P, __m128d __A) { _mm_store_sd (__P, __A); } /* Stores the upper DPFP value. */ extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_storeh_pd (double *__P, __m128d __A) { - *__P = __builtin_ia32_vec_ext_v2df (__A, 1); + *__P = __A[1]; } /* Store the lower DPFP value across two words. The address must be 16-byte aligned. */ extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_store1_pd (double *__P, __m128d __A) { _mm_store_pd (__P, __builtin_ia32_shufpd (__A, __A, _MM_SHUFFLE2 (0,0))); } @@ -215,86 +215,86 @@ extern __inline int __attribute__((__gnu _mm_cvtsi128_si32 (__m128i __A) { return __builtin_ia32_vec_ext_v4si ((__v4si)__A, 0); } #ifdef __x86_64__ /* Intel intrinsic. */ extern __inline long long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_cvtsi128_si64 (__m128i __A) { - return __builtin_ia32_vec_ext_v2di ((__v2di)__A, 0); + return __A[0]; } /* Microsoft intrinsic. */ extern __inline long long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_cvtsi128_si64x (__m128i __A) { - return __builtin_ia32_vec_ext_v2di ((__v2di)__A, 0); + return __A[0]; } #endif extern __inline __m128d __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_add_pd (__m128d __A, __m128d __B) { - return (__m128d)__builtin_ia32_addpd ((__v2df)__A, (__v2df)__B); + return __A + __B; } extern __inline __m128d __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_add_sd (__m128d __A, __m128d __B) { return (__m128d)__builtin_ia32_addsd ((__v2df)__A, (__v2df)__B); } extern __inline __m128d __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_sub_pd (__m128d __A, __m128d __B) { - return (__m128d)__builtin_ia32_subpd ((__v2df)__A, (__v2df)__B); + return __A - __B; } extern __inline __m128d __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_sub_sd (__m128d __A, __m128d __B) { return (__m128d)__builtin_ia32_subsd ((__v2df)__A, (__v2df)__B); } extern __inline __m128d __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_mul_pd (__m128d __A, __m128d __B) { - return (__m128d)__builtin_ia32_mulpd ((__v2df)__A, (__v2df)__B); + return __A * __B; } extern __inline __m128d __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_mul_sd (__m128d __A, __m128d __B) { return (__m128d)__builtin_ia32_mulsd ((__v2df)__A, (__v2df)__B); } extern __inline __m128d __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_div_pd (__m128d __A, __m128d __B) { - return (__m128d)__builtin_ia32_divpd ((__v2df)__A, (__v2df)__B); + return __A / __B; } extern __inline __m128d __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _mm_div_sd (__m128d __A, __m128d __B) { return (__m128d)__builtin_ia32_divsd ((__v2df)__A, (__v2df)__B); } extern __inline __m128d __attribute__((__gnu_inline__, __always_inline
PATCH: PR target/60827: Inconsistent optimize_function_for_speed_p in in *fixuns_trunc_1
Since fixuns_truncsi2 expander checks optimize_insn_for_size_p before generating *fixuns_trunc_1, we should use optimize_insn_for_speed_p in *fixuns_trunc_1 for consistency. OK for trunk? Thanks. H.J. --- 2014-04-11 H.J. Lu PR target/60827 * config/i386/i386.md (*fixuns_trunc_1): Check optimize_insn_for_speed_p instead of optimize_function_for_speed_p. --- gcc/config/i386/i386.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 25e2e93..80ebe54 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -4367,7 +4367,7 @@ (clobber (match_scratch: 1 "=x,&x")) (clobber (match_scratch: 2 "=x,x"))] "!TARGET_64BIT && TARGET_SSE2 && TARGET_SSE_MATH - && optimize_function_for_speed_p (cfun)" + && optimize_insn_for_speed_p ()" "#" "&& reload_completed" [(const_int 0)] -- 1.9.0
Re: [PATCH] Don't dump bb details when removing a block
On Fri, Apr 11, 2014 at 1:36 AM, Bernd Edlinger wrote: > Hi Teresa, > >> @@ -1947,7 +1947,7 @@ remove_bb (basic_block bb) >>fprintf (dump_file, "Removing basic block %d\n", bb->index); >>if (dump_flags & TDF_DETAILS) >> { >> - dump_bb (dump_file, bb, 0, dump_flags); >> + dump_bb (dump_file, bb, 0, dump_flags && ~TDF_DETAILS); >> fprintf (dump_file, "\n"); >> } >> } > > > did you mean "dump_flags & ~TDF_DETAILS", logical & ??? > Bernd. > Yep, that is a mistake. I had fixed the issue I was trying to solve by inadvertently passing '0'. In any case, the new patch (see below) addresses this differently. On Fri, Apr 11, 2014 at 1:14 AM, Richard Biener wrote: > IMHO it's odd to strip just a single flag - I'd go for specifying the desired > flags explicitely, like dumping with TDF_BLOCKS only (dumping edges > is certainly useful IMHO). Or dump with 0. Ok, I have addressed this by passing only TDF_BLOCKS. This exposed a bug in dump_bb_info in the condition guarding the call to check_bb_profile, which was not actually checking if flags contained TDF_DETAILS, also fixed in the new patch below. > > Either way ok for stage1. > > Thanks, > Richard. Thanks, I have retested with the new patch below and will wait for stage 1 before committing. Teresa 2014-04-11 Teresa Johnson * cfg.c (dump_bb_info): Fix flags check. * tree-cfg.c (remove_bb): Only dump TDF_BLOCKS when removing. 2014-04-11 Teresa Johnson * gcc.dg/tree-prof/update-loopch.c: Update expected output. Index: cfg.c === --- cfg.c (revision 208492) +++ cfg.c (working copy) @@ -743,11 +743,10 @@ dump_bb_info (FILE *outf, basic_block bb, int inde fputs (", probably never executed", outf); } fputc ('\n', outf); - if (TDF_DETAILS) - check_bb_profile (bb, outf, indent, flags); if (flags & TDF_DETAILS) { + check_bb_profile (bb, outf, indent, flags); if (flags & TDF_COMMENT) fputs (";; ", outf); fprintf (outf, "%s prev block ", s_indent); Index: testsuite/gcc.dg/tree-prof/update-loopch.c === --- testsuite/gcc.dg/tree-prof/update-loopch.c (revision 208492) +++ testsuite/gcc.dg/tree-prof/update-loopch.c (working copy) @@ -15,8 +15,9 @@ main () is once reached directly from entry point of function, rest via loopback edge. */ /* { dg-final-use { scan-ipa-dump "loop depth 1, count 4" "profile"} } */ -/* { dg-final-use { scan-tree-dump "loop depth 1, count 2" "optimized"} } */ -/* { dg-final-use { scan-tree-dump-times "Removing basic block \[^\r\n\]*\[\\r\\n\]+\[^\r\n\]*\[\\r\\n\]+Invalid sum of\[^\r\n\]*\[\\r\\n\]+Invalid sum of" 1 "optimized"} } */ -/* { dg-final-use { scan-tree-dump-times "Invalid sum of" 2 "optimized"} } */ +/* { dg-final-use { scan-tree-dump "loop depth 1, count 3" "optimized"} } */ +/* { dg-final-use { scan-tree-dump-not "loop depth 1, count 2" "optimized"} } */ +/* { dg-final-use { scan-tree-dump "Removing basic block" "optimized"} } */ +/* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */ /* { dg-final-use { cleanup-ipa-dump "profile" } } */ /* { dg-final-use { cleanup-tree-dump "optimized" } } */ Index: tree-cfg.c === --- tree-cfg.c (revision 208492) +++ tree-cfg.c (working copy) @@ -1947,7 +1947,7 @@ remove_bb (basic_block bb) fprintf (dump_file, "Removing basic block %d\n", bb->index); if (dump_flags & TDF_DETAILS) { - dump_bb (dump_file, bb, 0, dump_flags); + dump_bb (dump_file, bb, 0, TDF_BLOCKS); fprintf (dump_file, "\n"); } } -- Teresa Johnson | Software Engineer | tejohn...@google.com | 408-460-2413
Re: Hurd port for gcc go PATCH 0-3 (9)
Svante Signell, le Fri 11 Apr 2014 14:47:21 +0200, a écrit : > #ifdef TARGET_LIBC_PROVIDES_SSP > +/* i386 glibc provides __stack_chk_guard in %gs:0x14. */ > +#define TARGET_THREAD_SSP_OFFSET 0x14 Err, not the Hurd variant, no. Is it really needed? > @@ -682,7 +686,7 @@ > go_net_cgo_file = go/net/cgo_linux.go > go_net_sock_file = go/net/sock_linux.go > go_net_sockopt_file = go/net/sockopt_linux.go > -go_net_sockoptip_file = go/net/sockoptip_linux.go go/net/sockoptip_posix.go > +go_net_sockoptip_file = go/net/sockoptip_linux.go go/net/sockoptip_bsd.go > else This seems doubtful, isn't that the Linux case? Samuel
Re: [patch, libgfortran] PR60128 Wrong ouput using en edit descriptor
On Mon, 31 Mar 2014, Dominique d'Humières wrote: > Updated gfortran.dg/fmt_en.f90 to skip some tests not > supported on i?86-*-solaris2.9* and hppa*-*-hpux* (these tests > assume rounding to nearest and to even on tie, AFAICT > i?86-*-solaris2.9* rounds real(16) to zero and hppa*-*-hpux* > rounds all kinds to zero on tie, with some exceptions I don?t > understand). The detection of the rounding is based on the F and > E edit descriptors. > > OK for trunk and 4.8? This test, after the update on 4.8 in r209070 when the test-case was modified substantially (not really covered by the ChangeLog entry) to be identical to that on trunk, apparently takes a different route in the fortran run-time library on 4.8 compared to trunk. For 4.8, it requires more run-time support on the target system, trigging the tell-tale error message found in gfortran.log: "Fortran runtime error: required ftruncate or chsize support not present" on some targets, then aborting and flagged as a regression as it passed before that commit. Committed to 4.8 as obvious. Again, this is not required on trunk. gcc/testsuite: * gfortran.dg/fmt_en.f90: Gate test on effective_target fd_truncate. Index: gfortran.dg/fmt_en.f90 === --- gfortran.dg/fmt_en.f90 (revision 209324) +++ gfortran.dg/fmt_en.f90 (working copy) @@ -1,4 +1,4 @@ -! { dg-do run } +! { dg-do run { target fd_truncate } } ! PR60128 Invalid outputs with EN descriptors ! Test case provided by Walt Brainerd. program pr60128 brgds, H-P
Re: GCC's -fsplit-stack disturbing Mach's vm_allocate
Thomas Schwinge, le Wed 09 Apr 2014 09:36:42 +0200, a écrit : > Well, the first step is to verify that TARGET_THREAD_SPLIT_STACK_OFFSET > and similar configury is correct for the Hurd, It's not. I've checked what TARGET_THREAD_SPLIT_STACK_OFFSET is, it's an offset inside the tcbhead_t structure, and we don't have that field at all... We may want to extend our tcbhead_t the same way as Linux i386. > and figure out what's > going on with the zero-page unmapping (discussed earlier in this thread), > and then mmap failing with 1073741846 (EINVAL). Here is the backtrace #0 __vm_map (target_task=1, address=address@entry=0x1029cc4, size=size@entry=0, mask=mask@entry=0, anywhere=1, memory_object=memory_object@entry=0, offset=offset@entry=0, copy=copy@entry=1, cur_protection=cur_protection@entry=1, max_protection=max_protection@entry=7, inheritance=inheritance@entry=1) at /usr/src/eglibc-2.18/build-tree/hurd-i386-libc/mach/vm_map.c:56 #1 0x0118a3e8 in __mmap (addr=0x0, len=0, prot=4, flags=2, fd=-1, offset=0) at ../sysdeps/mach/hurd/mmap.c:145 #2 0x0804960d in __morestack_load_mmap () #3 0x08049d12 in __libc_csu_init () #4 0x010b4671 in __libc_start_main (main=0x80489dd , argc=1, argv=0x1029de4, init=0x8049cc0 <__libc_csu_init>, fini=0x8049d30 <__libc_csu_fini>, rtld_fini=0xfb90 <_dl_fini>, stack_end=0x1029ddc) at libc-start.c:246 #5 0x08048901 in _start () It's indeed: /* This function is called at program startup time to make sure that mmap, munmap, and getpagesize are resolved if linking dynamically. We want to resolve them while we have enough stack for them, rather than calling into the dynamic linker while low on stack space. */ void __morestack_load_mmap (void) { /* Call with bogus values to run faster. We don't care if the call fails. Pass __MORESTACK_CURRENT_SEGMENT to make sure that any TLS accessor function is resolved. */ mmap (__morestack_current_segment, 0, PROT_READ, MAP_ANONYMOUS, -1, 0); mprotect (NULL, 0, 0); munmap (0, getpagesize ()); } Yes... So, do we really want to let munmap poke a hole at address 0 and thus let further vm_map() return address 0? Samuel
Ping - RE: PATCH] (configure.ac) Add support for TI-RTOS
Ping... -Original Message- From: Kapania, Ashish Sent: Friday, April 04, 2014 4:53 PM To: 'gcc-patches@gcc.gnu.org' Subject: RE: [PATCH] (configure.ac) Add support for TI-RTOS Forgot to attach the patch file :) -Original Message- From: Kapania, Ashish Sent: Friday, April 04, 2014 4:50 PM To: 'gcc-patches@gcc.gnu.org' Subject: [PATCH] (configure.ac) Add support for TI-RTOS Hi All, This is a request to apply the attached patch to GCC project. I am adding support for TI-RTOS to newlib and require the attached change in configure.ac file. Thanks, Ashish Change log: From: Ashish Kapania Date: Fri, 4 Apr 2014 16:34:20 -0700 Subject: [PATCH] configure.ac: Add support for TI-RTOS --- ChangeLog | 4 configure.ac | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) tirtos_support.patch Description: tirtos_support.patch
Re: GCC's -fsplit-stack disturbing Mach's vm_allocate
Samuel Thibault, le Fri 11 Apr 2014 23:51:44 +0200, a écrit : > So, do we really want to let munmap poke a hole at address 0 and thus > let further vm_map() return address 0? i.e. we could apply this: diff --git a/sysdeps/mach/munmap.c b/sysdeps/mach/munmap.c index 57d99f9..a46e3f1 100644 --- a/sysdeps/mach/munmap.c +++ b/sysdeps/mach/munmap.c @@ -27,6 +27,11 @@ int __munmap (__ptr_t addr, size_t len) { kern_return_t err; + if (addr == 0) +{ + errno = EINVAL; + return -1; +} if (err = __vm_deallocate (__mach_task_self (), (vm_address_t) addr, (vm_size_t) len)) { Samuel
[patch, libgfortran] [4.7/4.8/4.9/4.10 Regression] list directed io from array results in end of file
I plan to commit the following patch to 4.10, 4.9, 4.8, and 4.7. It is a partial revert of the patch to PR38199 which is an optimization of internal unit reads. The original patch was too aggressive. After this revert, I will investigate further to see if I can refine it further. Regards, Jerry Index: unit.c === --- unit.c (revision 209325) +++ unit.c (working copy) @@ -382,9 +382,7 @@ is_trim_ok (st_parameter_dt *dtp) { /* Check rank and stride. */ - if (dtp->internal_unit_desc - && (GFC_DESCRIPTOR_RANK (dtp->internal_unit_desc) > 1 - || GFC_DESCRIPTOR_STRIDE(dtp->internal_unit_desc, 0) != 1)) + if (dtp->internal_unit_desc) return false; /* Format strings can not have 'BZ' or '/'. */ if (dtp->common.flags & IOPARM_DT_HAS_FORMAT)
Re: [patch, libgfortran][4.7/4.8/4.9/4.10 Regression]PR60810 list directed io from array results in end of file
Relates to PR60810 On 04/11/2014 04:10 PM, Jerry DeLisle wrote: > I plan to commit the following patch to 4.10, 4.9, 4.8, and 4.7. > > It is a partial revert of the patch to PR38199 which is an optimization of > internal unit reads. > > The original patch was too aggressive. After this revert, I will investigate > further to see if I can refine it further. > > Regards, > > Jerry > > Index: unit.c > === > --- unit.c(revision 209325) > +++ unit.c(working copy) > @@ -382,9 +382,7 @@ > is_trim_ok (st_parameter_dt *dtp) > { >/* Check rank and stride. */ > - if (dtp->internal_unit_desc > - && (GFC_DESCRIPTOR_RANK (dtp->internal_unit_desc) > 1 > - || GFC_DESCRIPTOR_STRIDE(dtp->internal_unit_desc, 0) != 1)) > + if (dtp->internal_unit_desc) > return false; >/* Format strings can not have 'BZ' or '/'. */ >if (dtp->common.flags & IOPARM_DT_HAS_FORMAT) > > >
Re: [patch, libgfortran] [4.7/4.8/4.9/4.10 Regression] list directed io from array results in end of file
Jerry DeLisle wrote: I plan to commit the following patch to 4.10, 4.9, 4.8, and 4.7. It is a partial revert of the patch to PR38199 which is an optimization of internal unit reads. The original patch was too aggressive. After this revert, I will investigate further to see if I can refine it further. This partial revert looks fine to me - too bad that we have only now learned about this problem. For 4.9 prior the 4.9.0 release, you need approval by Jakub, who probably would like to avoid to have another RC. In case that there is a second RC, I think it would make sense to include this patch as well. Tobias
Re: [patch, libgfortran] [4.7/4.8/4.9/4.10 Regression] list directed io from array results in end of file
On 04/11/2014 04:31 PM, Tobias Burnus wrote: > Jerry DeLisle wrote: >> I plan to commit the following patch to 4.10, 4.9, 4.8, and 4.7. >> >> It is a partial revert of the patch to PR38199 which is an optimization of >> internal unit reads. >> >> The original patch was too aggressive. After this revert, I will investigate >> further to see if I can refine it further. > > This partial revert looks fine to me - too bad that we have only now learned > about this problem. > > For 4.9 prior the 4.9.0 release, you need approval by Jakub, who probably > would > like to avoid to have another RC. In case that there is a second RC, I think > it > would make sense to include this patch as well. > > Tobias > I am waiting for Jakub's approval for 4.9. Regards, Jerry
[PATCH,cygwin] config/i386/cygwin-w64.h: Remove duplicate undef LONG_TYPE_SIZE
Hi, The patch below addresses what I consider to be an obvious typo in gcc/config/i386/cygwin-w64.h on trunk and gcc-4_9-branch OK to commit to both branches? Ralf 2014-04-12 Ralf Corsépius * config/i386/cygwin-w64.h: Remove duplicate undef LONG_TYPE_SIZE. Index: gcc/config/i386/cygwin-w64.h === --- gcc/config/i386/cygwin-w64.h (revision 209333) +++ gcc/config/i386/cygwin-w64.h (working copy) @@ -70,7 +70,6 @@ /* Cygwin64 will have a 64-bit long type. */ #undef LONG_TYPE_SIZE -#undef LONG_TYPE_SIZE #define LONG_TYPE_SIZE (TARGET_64BIT ? 64 : 32) /* Override default "long long unsigned int" from cygming.h. */