Re: [build, i386] Disable local dynamic TLS model on Solaris/x86 if as/ld cannot handle it
Il 05/03/2014 16:53, Rainer Orth ha scritto: When using GNU as with Solaris ld, the TLS local dynamic tests (gcc.dg/torture/tls/run-ld.c etc.) FAIL to execute before Solaris 11: the programs crash with an illegal instruction: e.g. in the gcc.dg/lto/20090210 test, we have 0x8050ce0 : mov%gs:0x0,%eax 0x8050ce6 : call 0x8050ce7 0x8050ce7 : cld 0x8050ce8 : (bad) The reason is that Solaris ld before Solaris 11 requires the use of the @tlsldmplt relocation documented in the Solaris 10 Linker and Libraries Guide: http://docs.oracle.com/cd/E26505_01/html/E26506/chapter8-20.html#gentextid-23600 Unfortunately, gas doesn't support that relocation. While adding the gas side was easy, I completely failed for gld and didn't propose the incomplete patch to binutils since it would (rightly) have been rejected. Old versions of ld mishandle the TLS LD code sequence emitted by gcc when @tlsldmplt isn't available, causing the crashes observed. So ld cannot handle what gas emits and gas cannot emit what ld requires. The only solution seems to fall back to the GD model in that case, which is ugly but certainly better than having perfectly valid programs crash. The following patch does just that. It carefully restricts its actions to Solaris. I'm falling back to using dis when objdump isn't available to avoid enabling this fallback unnecessarily. Bootstraps on i386-pc-solaris2.{9,10,11} (as/ld, gas/ld, gas/gld, as/gld), amd64-pc-solaris2.{10,11} (as/ld, gas/ld), x86_64-unknown-linux-gnu, and i686-unknown-linux-gnu either completed successfully or still running. Ok for mainline if those pass? Thanks. Rainer 2014-03-04 Rainer Orth * configure.ac (TLS_SECTION_ASM_FLAG): Save as tls_section_flag. (LIB_TLS_SPEC): Save as ld_tls_libs. (HAVE_AS_IX86_TLSLDMPLT): Define as 1/0. (HAVE_AS_IX86_TLSLDM): New test. * configure, config.in: Regenerate. * config/i386/i386.c (legitimize_tls_address): Fall back to TLS_MODEL_GLOBAL_DYNAMIC on 32-bit Solaris/x86 if tool chain cannot support TLS_MODEL_LOCAL_DYNAMIC. * config/i386/i386.md (*tls_local_dynamic_base_32_gnu): Use if instead of #ifdef in HAVE_AS_IX86_TLSLDMPLT test. Looks good. Perhaps GCC would gain from having a separate maintainer for the gcc/ target-specific configuration (configure.ac/config.gcc/config/*/*.h basically)... guess who I would propose for such a role :) Paolo
Re: [PATCH] [lto/55113] Fix use of -fshort-double with -flto for powerpc
On Fri, Mar 7, 2014 at 12:29 AM, Paulo Matos wrote: > On 06/03/14 11:19, Richard Biener wrote: >> >> On Wed, Mar 5, 2014 at 12:55 PM, Paulo Matos >> wrote: >>> >>> On 05/03/2014 11:51, Richard Biener wrote: On Wed, Mar 5, 2014 at 12:43 PM, Dominique Dhumieres wrote: > > > > Revision 208312 causes > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60427 Uhm. pointer comparison against double_type_node ... I'd say we want to revert the patch. Paulo, please do that. Let's do the alternate approach of marking -fshort-double eligible for LTO as well and handle it there properly. >>> >>> Sure, I will prepare a new patch and post it for approval by the end of >>> the >>> day. >>> >>> Apologies for the regression. >> >> >> I have reverted the patch for now. >> >> Richard. >> > > > Please find new patch attached. I have enabled LTO for short-double and > passed flag_short_double to build_common_tree_nodes. > > I have tested this for C on powerpc-eabipse (target for which we are fixing > pr55113), and C/Fortran on a x86_64. Saw no regressions. > > OK to commit? Ok. Thanks, Richard. > gcc/c-family/ > 2014-03-06 Paulo Matos > > * c.opt: Enable LTO FE for fshort-double. > > gcc/lto/ > 2014-03-06 Paulo Matos > > * lto-lang.c (lto_init): Pass flag_short_double to > build_common_tree_nodes. > > gcc/testsuite/ > 2014-03-06 Paulo Matos > > * gcc.dg/lto/pr55113_0.c: New testcase. > > > -- > Paulo Matos
Re: [PATCH] [lto/55113] Fix use of -fshort-double with -flto for powerpc
On Fri, Mar 7, 2014 at 9:59 AM, Richard Biener wrote: > On Fri, Mar 7, 2014 at 12:29 AM, Paulo Matos wrote: >> On 06/03/14 11:19, Richard Biener wrote: >>> >>> On Wed, Mar 5, 2014 at 12:55 PM, Paulo Matos >>> wrote: On 05/03/2014 11:51, Richard Biener wrote: > > > On Wed, Mar 5, 2014 at 12:43 PM, Dominique Dhumieres > > wrote: >> >> >> >> Revision 208312 causes >> >> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60427 > > > > Uhm. pointer comparison against double_type_node ... > > I'd say we want to revert the patch. Paulo, please do that. Let's > do the alternate approach of marking -fshort-double eligible for LTO > as well and handle it there properly. > Sure, I will prepare a new patch and post it for approval by the end of the day. Apologies for the regression. >>> >>> >>> I have reverted the patch for now. >>> >>> Richard. >>> >> >> >> Please find new patch attached. I have enabled LTO for short-double and >> passed flag_short_double to build_common_tree_nodes. >> >> I have tested this for C on powerpc-eabipse (target for which we are fixing >> pr55113), and C/Fortran on a x86_64. Saw no regressions. >> >> OK to commit? > > Ok. Btw, can you check the attached as well? It makes sure all TUs have -fshort-double set consistently and it automatically enables it at link-time, not allowing to override the setting. If it works for you please check it in, too. (I can't really test it because -fshort-double brokeness on x86_64). Thanks, Richard. > Thanks, > Richard. > >> gcc/c-family/ >> 2014-03-06 Paulo Matos >> >> * c.opt: Enable LTO FE for fshort-double. >> >> gcc/lto/ >> 2014-03-06 Paulo Matos >> >> * lto-lang.c (lto_init): Pass flag_short_double to >> build_common_tree_nodes. >> >> gcc/testsuite/ >> 2014-03-06 Paulo Matos >> >> * gcc.dg/lto/pr55113_0.c: New testcase. >> >> >> -- >> Paulo Matos p Description: Binary data
Re: [PATCH] Mark fira-loop-pressure as optimization
On Fri, Mar 7, 2014 at 12:36 AM, Paulo J. Matos wrote: > On 06/03/14 23:34, Paulo J. Matos wrote: >> >> Hi, >> >> This patch marks fira-loop-pressure as an optimization so it shows in >> gcc --help=optimizers. >> >> 2014-03-06 Paulo Matos >> >> * common.opt (fira-loop-pressure): Mark as optimization. >> >> OK to commit? >> > > Patch is attached. Ok. Richard. > -- > PMatos
Re: [PATCH] Fix up make bootstrap-lean; make install (PR bootstrap/58572)
On Thu, Mar 6, 2014 at 7:58 PM, Jakub Jelinek wrote: > Hi! > > As discussed in the PR, doing > make bootstrap-lean > make install > right now may fail (if host compiler is too old), or recompile various > objects of the compiler with system gcc before it is installed. > This happens because starting with the automatic dependency changes, > we have in gcc/.deps/*.Po lines like: > dfp.Po: > /usr/src/gcc/obj942/prev-x86_64-unknown-linux-gnu/libstdc++-v3/include/gstdint.h > \ > alias.Po: > /usr/src/gcc/obj942/prev-x86_64-unknown-linux-gnu/libstdc++-v3/include/cstring > \ > alias.Po: > /usr/src/gcc/obj942/prev-x86_64-unknown-linux-gnu/libstdc++-v3/include/cstdlib > \ > (apparently just those 3 headers so far), but the prev-* directories are for > bootstrap-lean removed as soon as the new stage finishes (or after > comparison finishes), so they aren't available during make install. > > As that is the whole point of the *-lean bootstraps to save disk space, > keeping the previous stage around is against the intent of that. Note that after building the last stage we still have the previous stage available, so unless make install uses diskspace on its own delaying the removal of the previous stage until after install (which basically means not removing it at all) doesn't reduce peak disk usage requirements. Disk usage after 'make' is higher of course, but does that really matter? > I've tried to manually just symlink > ln -sf x86_64-unknown-linux-gnu prev-x86_64-unknown-linux-gnu > but that apparently didn't help either. > > So, this patch instead ensures we don't add the libstdc++-v3/ headers > into the *.Po files at all. As the libstdc++ headers are all already > #pragma GCC system_header, this patch should make no change to > what warnings are emitted and will only affect the .deps/* files. Nice idea ;) > Bootstrapped/regtested on x86_64-linux and i686-linux and tested also > with make bootstrap-lean; make install, ok for trunk? > > 2014-03-06 Jakub Jelinek > > PR bootstrap/58572 > * configure.ac (CXX_FOR_TARGET): Replace -I with -isystem > in testsuite_flags --build-includes output. > * Makefile.tpl (POSTSTAGE1_CXX_EXPORT): Use -isystem instead of > -I for libstdc++-v3 includes. > * configure: Regenerated. > * Makefile.in: Regenerated. > > --- configure.ac.jj 2014-03-03 00:55:36.0 +0100 > +++ configure.ac2014-03-06 15:24:47.067298246 +0100 > @@ -3208,7 +3208,7 @@ GCC_TARGET_TOOL(as, AS_FOR_TARGET, AS, [ > GCC_TARGET_TOOL(cc, CC_FOR_TARGET, CC, [gcc/xgcc -B$$r/$(HOST_SUBDIR)/gcc/]) > dnl see comments for CXX_FOR_TARGET_FLAG_TO_PASS > GCC_TARGET_TOOL(c++, CXX_FOR_TARGET, CXX, > - [gcc/xg++ -B$$r/$(HOST_SUBDIR)/gcc/ -nostdinc++ `if test -f > $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags; then $(SHELL) > $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags --build-includes; > else echo -funconfigured-libstdc++-v3 ; fi` > -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src > -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs > -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs], > + [gcc/xg++ -B$$r/$(HOST_SUBDIR)/gcc/ -nostdinc++ `if test -f > $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags; then $(SHELL) > $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags --build-includes | > sed "s/^-I/-isystem /;s/ -I/ -isystem /g"; else echo > -funconfigured-libstdc++-v3 ; fi` -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src > -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs > -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs], > c++) > GCC_TARGET_TOOL(c++ for libstdc++, RAW_CXX_FOR_TARGET, CXX, > [gcc/xgcc -shared-libgcc -B$$r/$(HOST_SUBDIR)/gcc -nostdinc++ > -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src > -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs > -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs], > --- Makefile.tpl.jj 2013-11-11 22:38:29.0 +0100 > +++ Makefile.tpl2014-03-06 15:49:02.290211483 +0100 > @@ -242,9 +242,9 @@ POSTSTAGE1_CXX_EXPORT = \ > -B$$r/$(HOST_SUBDIR)/prev-gcc/ -B$(build_tooldir)/bin/ -nostdinc++ \ > -B$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \ > -B$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs \ > - -I$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/include/$(TARGET_SUBDIR) \ > - -I$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/include \ > - -I$$s/libstdc++-v3/libsupc++ \ > + -isystem > $$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/include/$(TARGET_SUBDIR) \ > + -isystem $$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/include \ > + -isystem $$s/libstdc++-v3/libsupc++ \ > -L$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \ > -L$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs"; \ > export CXX; \ > --- configure.jj2014-03-03 00:55:36.0 +0100 > +++ configure 2014-03-06 15:28:41.094284292 +0100 > @@ -
[PATCH] Fix incorrect byte swap detection (PR tree-optimization/60454)
The bswap optimization has a bug where a code can be incorrectly detected as doing a byte swap, therefore leading to change of behavior for the program compiled. This is tracked as PR60454. The patch below fixes the issue. Best regards, Thomas Preud'homme diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 748805e..b6d7d93 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2014-03-07 Thomas Preud'homme + + PR tree-optimization/60454 + * tree-ssa-math-opts.c (find_bswap_1): Fix bswap detection. + 2014-02-23 David Holsgrove * config/microblaze/microblaze.md: Correct ashrsi_reg / lshrsi_reg names diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f3c0c85..d3e0385 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2014-03-07 Thomas Preud'homme + + PR tree-optimization/60454 + * gcc.dg/optimize-bswapsi-2.c (fake_swap32): Testcase to track + regression of PR60454. + 2014-02-23 David Holsgrove * gcc/testsuite/gcc.target/microblaze/others/mem_reload.c: New test. diff --git a/gcc/testsuite/gcc.dg/optimize-bswapsi-2.c b/gcc/testsuite/gcc.dg/optimize-bswapsi-2.c new file mode 100644 index 000..f20269e --- /dev/null +++ b/gcc/testsuite/gcc.dg/optimize-bswapsi-2.c @@ -0,0 +1,26 @@ +/* { dg-do compile { target arm*-*-* alpha*-*-* i?86-*-* powerpc*-*-* rs6000-*-* x86_64-*-* s390*-*-* } } */ +/* { dg-require-effective-target stdint_types } */ +/* { dg-options "-O2 -fdump-tree-bswap" } */ +/* { dg-options "-O2 -fdump-tree-bswap -march=z900" { target s390-*-* } } */ + +#include + +#define __fake_const_swab32(x) ((uint32_t)( \ +(((uint32_t)(x) & (uint32_t)0x00ffUL) << 24) |\ +(((uint32_t)(x) & (uint32_t)0xff00UL) << 8) |\ +(((uint32_t)(x) & (uint32_t)0x00ffUL) << 8) |\ +(((uint32_t)(x) & (uint32_t)0xff00UL) ) |\ +(((uint32_t)(x) & (uint32_t)0xff00UL) >> 24))) + +/* Previous version of bswap optimization would detect byte swap when none + happen. This test aims at catching such wrong detection to avoid + regressions. */ + +uint32_t +fake_swap32 (uint32_t in) +{ + return __fake_const_swab32 (in); +} + +/* { dg-final { scan-tree-dump-times "32 bit bswap implementation found at" 0 "bswap" } } */ +/* { dg-final { cleanup-tree-dump "bswap" } } */ diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c index 8e372ed..10a11ec 100644 --- a/gcc/tree-ssa-math-opts.c +++ b/gcc/tree-ssa-math-opts.c @@ -1801,7 +1801,9 @@ find_bswap_1 (gimple stmt, struct symbolic_number *n, int limit) if (rhs_class == GIMPLE_BINARY_RHS) { + int i; struct symbolic_number n1, n2; + unsigned HOST_WIDEST_INT mask; tree source_expr2; if (code != BIT_IOR_EXPR) @@ -1827,6 +1829,15 @@ find_bswap_1 (gimple stmt, struct symbolic_number *n, int limit) return NULL_TREE; n->size = n1.size; + for (i = 0, mask = 0xff; i < n->size; i++, mask <<= 8) + { + unsigned HOST_WIDEST_INT masked1, masked2; + + masked1 = n1.n & mask; + masked2 = n2.n & mask; + if (masked1 && masked2 && masked1 != masked2) + return NULL_TREE; + } n->n = n1.n | n2.n; if (!verify_symbolic_number_p (n, stmt))
Re: [Testsuite] Skip torture/pr60183.c for AVR target
2014-02-17 20:00 GMT+08:00 Rainer Orth : > Senthil Kumar Selvaraj writes: > >> The newly added gcc.dg/torture/pr60183.c test fails for the AVR target >> with an "array size too large" error. This patch marks the test as >> unsupported for AVR, following the example of other such tests in the >> testsuite. > [...] Seems it has something to do with PR57821: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57821#c7 Maybe setting need_64bit_hwint for AVR target is able to make it pass the testcase, but I am not sure such change is correct for AVR port. Best regards, jasonwucj
Re: [PATCH ARM]: Fix more -mapcs-frame failures
Hi Ramana, Thanks for your comments, > Please respin using plus_constant instead of gen_addsi3. Here is my feeling about this: I experimented on using plus_constant instead of gen_addsi3. But there are cases when the emitted code is not equivalent for large frames (!const_ok_for_op (val, PLUS)) and leads to complications. We could fix this case with a call to arm_split_constant (PLUS, Pmode, NULL, amount, stack_pointer_rtx, stack_pointer_rtx, 0), but I'm not sure we gain in clarity here. Also for consistency, the same interface change would preferably be needed in the other parts of the arm.c file (that I didn't modify) sharing the same sequence. For instance "arm_expand_epilogue" > Otherwise > this looks good to me. > > Please repost updated patch and I will look at it again. For the reasons expressed above it'd prefer to consider this new change as a separate development with a new patch. For the time being (considering only the original apcs issue) is it OK to apply only the patch as it ? and validate a global gen_addsi3/plus_constant interface review as a separate step ? Many thanks, Christian > > Ramana
Re: [PATCH 1/4] [GOMP4] [Fortran] OpenACC 1.0+ support in fortran front-end
Hi Tobias! Thanks a lot for your review! !$acc loop outer_loop: do i = 1, n inner_loop: do j = 1,m ! ... cycle outer_loop exit outer_loop end do inner_loop end do outer_loop That's a new Fortran 2008 feature that CYCLE and EXIT can leave the inner DO loop. I added the following to test suite: !$acc loop outer_loop: do i = 1, 5 inner_loop: do j = 1,5 if (i .eq. j) cycle outer_loop if (i .ne. j) exit outer_loop ! { dg-error "EXIT statement" } end do inner_loop end do outer_loop outer_loop1: do i = 1, 5 !$acc loop inner_loop1: do j = 1,5 if (i .eq. j) cycle outer_loop1 ! { dg-error "CYCLE statement" } end do inner_loop1 end do outer_loop1 !$acc loop collapse(2) outer_loop2: do i = 1, 5 inner_loop2: do j = 1,5 if (i .eq. j) cycle outer_loop2 ! { dg-error "CYCLE statement" } if (i .ne. j) exit outer_loop2 ! { dg-error "EXIT statement" } end do inner_loop2 end do outer_loop2 All cases pass. The second one passes due to check of structured blocks: if (o != NULL) { gfc_error ("%s statement at %C leaving OpenMP structured block", gfc_ascii_statement (st)); return MATCH_ERROR; } So, I needed to change error message. Also I fixed checks of polymofphic type and indentation. OK for gomp4 branch? -- Ilmir.
Re: [PATCH 2/4] [GOMP4] [Fortran] OpenACC 1.0+ support in fortran front-end
OpenACC 1.0 fortran FE support -- matching and resolving. * gcc/fortran/openmp.c (gfc_free_omp_clauses): Remove also OpenACC clauses. (gfc_free_expr_list): New function to clear expression list. (match_oacc_expr_list): New function to match expression list. (match_oacc_clause_gang): New function to match OpenACC 2.0 gang clauses. (OMP_CLAUSE_ASYNC, OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS, OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_COPY, OMP_CLAUSE_OACC_COPYIN, OMP_CLAUSE_COPYOUT, OMP_CLAUSE_CREATE, OMP_CLAUSE_PRESENT, OMP_CLAUSE_PRESENT_OR_COPY, OMP_CLAUSE_PRESENT_OR_COPYIN, OMP_CLAUSE_PRESENT_OR_COPYOUT, OMP_CLAUSE_PRESENT_OR_CREATE, OMP_CLAUSE_DEVICEPTR, OMP_CLAUSE_GANG, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, OMP_CLAUSE_SEQ, OMP_CLAUSE_INDEPENDENT, OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE_HOST, OMP_CLAUSE_DEVICE_RESIDENT, OMP_CLAUSE_DEVICE, OMP_CLAUSE_DEFAULT, OMP_CLAUSE_WAIT, OMP_CLAUSE_DELETE, OMP_CLAUSE_AUTO, OMP_CLAUSE_TILE): New clauses. (OACC_PARALLEL_CLAUSES, OACC_KERNELS_CLAUSES, OACC_DATA_CLAUSES, OACC_LOOP_CLAUSES, OACC_PARALLEL_LOOP_CLAUSES, OACC_KERNELS_LOOP_CLAUSES, OACC_HOST_DATA_CLAUSES, OACC_DECLARE_CLAUSES, OACC_UPDATE_CLAUSES, OACC_ENTER_DATA_CLAUSES, OACC_EXIT_DATA_CLAUSES): New defines. (gfc_match_oacc_parallel_loop, gfc_match_oacc_parallel, gfc_match_oacc_kernels_loop, gfc_match_oacc_kernels, gfc_match_oacc_data, gfc_match_oacc_host_data, gfc_match_oacc_loop, gfc_match_oacc_declare, gfc_match_oacc_update, gfc_match_oacc_enter_data, gfc_match_oacc_exit_data, gfc_match_oacc_wait, gfc_match_oacc_cache, oacc_is_loop, check_symbol_not_pointer, resolve_oacc_scalar_int_expr, resolve_oacc_positive_int_expr, check_array_not_assumed, resolve_oacc_data_clauses, resolve_oacc_deviceptr_clause, oacc_is_parallel, oacc_is_kernels, omp_code_to_statement, oacc_code_to_statement, resolve_oacc_directive_inside_omp_region, resolve_omp_directive_inside_oacc_region, resolve_oacc_nested_loops, resolve_oacc_params_in_parallel, resolve_oacc_loop_blocks, gfc_resolve_oacc_blocks, resolve_oacc_loop, resolve_oacc_cache, resolve_oacc_wait, gfc_resolve_oacc_declare, gfc_resolve_oacc_directive): New functions. (resolve_omp_clauses): Resolve also OpenACC clauses. (gfc_resolve_omp_directive): Check for enclosing OpenACC region. >From b783a60855f6649b6b8b440f177c1076f9af6521 Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Fri, 7 Mar 2014 14:33:17 +0400 Subject: [PATCH 2/4] OpenACC Fortran FE -- part 2 --- gcc/fortran/openmp.c | 1222 +- 1 file changed, 1200 insertions(+), 22 deletions(-) diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c index dff3ab1..e37c4c2 100644 --- a/gcc/fortran/openmp.c +++ b/gcc/fortran/openmp.c @@ -69,11 +69,37 @@ gfc_free_omp_clauses (gfc_omp_clauses *c) gfc_free_expr (c->final_expr); gfc_free_expr (c->num_threads); gfc_free_expr (c->chunk_size); + gfc_free_expr (c->async_expr); + gfc_free_expr (c->gang_expr); + gfc_free_expr (c->worker_expr); + gfc_free_expr (c->vector_expr); + gfc_free_expr (c->num_gangs_expr); + gfc_free_expr (c->num_workers_expr); + gfc_free_expr (c->vector_length_expr); + gfc_free_expr (c->non_clause_wait_expr); + for (i = 0; i < OMP_LIST_NUM; i++) gfc_free_namelist (c->lists[i]); + + gfc_free_expr_list (c->wait_list); + gfc_free_expr_list (c->tile_list); + free (c); } +/* Free expression list. */ +void +gfc_free_expr_list (gfc_expr_list *list) +{ + gfc_expr_list *n; + + for (; list; list = n) +{ + n = list->next; + free (list); +} +} + /* Match a variable/common block list and construct a namelist from it. */ static match @@ -169,6 +195,87 @@ cleanup: return MATCH_ERROR; } +static match +match_oacc_expr_list (const char *str, gfc_expr_list **list, bool allow_asterisk) +{ + gfc_expr_list *head, *tail, *p; + locus old_loc; + gfc_expr *expr; + match m; + + head = tail = NULL; + + old_loc = gfc_current_locus; + + m = gfc_match (str); + if (m != MATCH_YES) +return m; + + for (;;) +{ + m = gfc_match_expr (&expr); + if (m == MATCH_YES || allow_asterisk) + { + p = gfc_get_expr_list (); + if (head == NULL) + head = tail = p; + else + { + tail->next = p; + tail = tail->next; + } + if (m == MATCH_YES) + tail->expr = expr; + else if (gfc_match (" *") != MATCH_YES) + goto syntax; + goto next_item; + } + if (m == MATCH_ERROR) + goto cleanup; + goto syntax; + +next_item: + if (gfc_match_char (')') == MATCH_YES) + break; + if (gfc_match_char (',') != MATCH_YES) + goto syntax; +} + + while (*list) +list = &(*list)->next; + + *list = head; + return MATCH_YES; + +syntax: + gfc_error ("Syntax error in OpenACC expression list at %C"); + +cleanup: + gfc_free_expr_list (head); + gfc_current_locus = old_loc; +
Re: [PATCH 3/4] [GOMP4] [Fortran] OpenACC 1.0+ support in fortran front-end
OpenACC 1.0 fortran FE support -- translation to GENERIC. gcc/fortran/ * trans-decl.c (gfc_generate_function_code): Insert OACC_DECLARE GENERIC node. * trans-openmp.c (gfc_convert_expr_to_tree): New helper function. (gfc_trans_omp_array_reduction): Support also OpenACC. Add parameter. (gfc_trans_omp_reduction_list): Update. (gfc_trans_oacc_construct): New transform function. (gfc_trans_omp_map_clause_list): Likewise. (gfc_trans_oacc_executable_directive): Likewise. (gfc_trans_oacc_combined_directive, gfc_trans_oacc_declare): Likewise. (gfc_trans_oacc_directive): Use them. (gfc_trans_oacc_loop): Stub. (gfc_trans_omp_clauses): Transform OpenACC clauses. * trans-stmt.h (gfc_trans_oacc_directive): New function prototype. (gfc_trans_oacc_declare): Likewise. * trans.c (trans_code): Transform also OpenACC directives. >From 70dca7f32b50e762f1295a2054bb484ef7fbb42e Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Fri, 7 Mar 2014 14:33:47 +0400 Subject: [PATCH 3/4] OpenACC Fortran FE -- part 3 --- gcc/fortran/trans-decl.c | 7 + gcc/fortran/trans-openmp.c | 357 + gcc/fortran/trans-stmt.c | 8 + gcc/fortran/trans-stmt.h | 4 + gcc/fortran/trans.c| 15 ++ 5 files changed, 391 insertions(+) diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 9c86653..ad26ef8 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -5606,6 +5606,13 @@ gfc_generate_function_code (gfc_namespace * ns) if ((gfc_option.rtcheck & GFC_RTCHECK_BOUNDS) && !sym->attr.is_bind_c) add_argument_checking (&body, sym); + /* Generate !$ACC DECLARE directive. */ + if (ns->oacc_declare_clauses) +{ + tree tmp = gfc_trans_oacc_declare (&body, ns); + gfc_add_expr_to_block (&body, tmp); +} + tmp = gfc_trans_code (ns->code); gfc_add_expr_to_block (&body, tmp); diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c index 41020a8..a1abd66 100644 --- a/gcc/fortran/trans-openmp.c +++ b/gcc/fortran/trans-openmp.c @@ -767,6 +767,40 @@ gfc_trans_omp_reduction_list (gfc_namelist *namelist, tree list, } static tree +gfc_trans_omp_map_clause_list (enum omp_clause_map_kind kind, + gfc_namelist *namelist, tree list) +{ + for (; namelist != NULL; namelist = namelist->next) +if (namelist->sym->attr.referenced) + { + tree t = gfc_trans_omp_variable (namelist->sym); + if (t != error_mark_node) + { + tree node = build_omp_clause (input_location, OMP_CLAUSE_MAP); + OMP_CLAUSE_DECL (node) = t; + OMP_CLAUSE_MAP_KIND (node) = kind; + list = gfc_trans_add_clause (node, list); + } + } + return list; +} + +static inline tree +gfc_convert_expr_to_tree (stmtblock_t *block, gfc_expr *expr) +{ + gfc_se se; + tree result; + + gfc_init_se (&se, NULL ); + gfc_conv_expr (&se, expr); + gfc_add_block_to_block (block, &se.pre); + result = gfc_evaluate_now (se.expr, block); + gfc_add_block_to_block (block, &se.post); + + return result; +} + +static tree gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses, locus where) { @@ -834,6 +868,51 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses, where); continue; } + if (list >= OMP_LIST_DATA_CLAUSE_FIRST + && list <= OMP_LIST_DATA_CLAUSE_LAST) + { + enum omp_clause_map_kind kind; + switch (list) + { + case OMP_LIST_COPY: + kind = OMP_CLAUSE_MAP_FORCE_TOFROM; + break; + case OMP_LIST_OACC_COPYIN: + kind = OMP_CLAUSE_MAP_FORCE_TO; + break; + case OMP_LIST_COPYOUT: + kind = OMP_CLAUSE_MAP_FORCE_FROM; + break; + case OMP_LIST_CREATE: + kind = OMP_CLAUSE_MAP_FORCE_ALLOC; + break; + case OMP_LIST_DELETE: + kind = OMP_CLAUSE_MAP_FORCE_DEALLOC; + break; + case OMP_LIST_PRESENT: + kind = OMP_CLAUSE_MAP_FORCE_PRESENT; + break; + case OMP_LIST_PRESENT_OR_COPY: + kind = OMP_CLAUSE_MAP_TOFROM; + break; + case OMP_LIST_PRESENT_OR_COPYIN: + kind = OMP_CLAUSE_MAP_TO; + break; + case OMP_LIST_PRESENT_OR_COPYOUT: + kind = OMP_CLAUSE_MAP_FROM; + break; + case OMP_LIST_PRESENT_OR_CREATE: + kind = OMP_CLAUSE_MAP_ALLOC; + break; + case OMP_LIST_DEVICEPTR: + kind = OMP_CLAUSE_MAP_FORCE_DEVICEPTR; + break; + default: + gcc_unreachable (); + } + omp_clauses = gfc_trans_omp_map_clause_list (kind, n, omp_clauses); + continue; + } switch (list) { case OMP_LIST_PRIVATE: @@ -853,6 +932,21 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses, goto add_clause; case OMP_LIST_COPYPRIVATE: clause_code = OMP_CLAUSE_COPYPRIVATE; + goto add_clause; + case OMP_LIST_USE_DEVICE: + clause_code = OMP_CLAUSE_USE_DEVICE; + goto add_clause; + case OMP_LIST_DEVICE_RESIDENT: + clause_code = OMP_CLAUSE_
Re: [PATCH] Fix up make bootstrap-lean; make install (PR bootstrap/58572)
On Fri, Mar 07, 2014 at 08:26:47AM +0100, Paolo Bonzini wrote: > Il 06/03/2014 19:58, Jakub Jelinek ha scritto: > >Bootstrapped/regtested on x86_64-linux and i686-linux and tested also > >with make bootstrap-lean; make install, ok for trunk? > > Nice fix! Did you check that on a regular bootstrap (formerly > bubblestrap) you can modify the source code for the affected headers > in libstdc++-v3, and alias.o/dfp.o will be rebuilt? It isn't rebuilt with the patch, but I don't see how it is any different from all the other -isystem headers (e.g. the gcc/include headers like stddef.h etc. that we use -isystem for too). I'm not sure it is worth bothering, while there are occassional changes to those headers, it is at most a few occurrences a year and usually just addition of new stuff, after all the headers should remain ABI compatible. Anyway, bootstrapping/regtesting now this variant where it only changes things for *-lean cases and not for normal bootstrap. 2014-03-07 Jakub Jelinek PR bootstrap/58572 * Makefile.tpl (POSTSTAGE1_CXX_EXPORT): Use -isystem instead of -I for libstdc++-v3 includes if $(LEAN). * Makefile.in: Regenerated. --- Makefile.tpl.jj 2013-11-11 22:38:29.0 +0100 +++ Makefile.tpl2014-03-07 10:56:42.221105929 +0100 @@ -242,9 +242,9 @@ POSTSTAGE1_CXX_EXPORT = \ -B$$r/$(HOST_SUBDIR)/prev-gcc/ -B$(build_tooldir)/bin/ -nostdinc++ \ -B$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \ -B$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs \ - -I$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/include/$(TARGET_SUBDIR) \ - -I$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/include \ - -I$$s/libstdc++-v3/libsupc++ \ + `if $(LEAN); then echo ' -isystem '; else echo ' -I'; fi`$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/include/$(TARGET_SUBDIR) \ + `if $(LEAN); then echo ' -isystem '; else echo ' -I'; fi`$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/include \ + `if $(LEAN); then echo ' -isystem '; else echo ' -I'; fi`$$s/libstdc++-v3/libsupc++ \ -L$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \ -L$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs"; \ export CXX; \ --- Makefile.in.jj 2013-11-11 22:38:21.0 +0100 +++ Makefile.in 2014-03-07 10:56:13.059107667 +0100 @@ -239,9 +239,9 @@ POSTSTAGE1_CXX_EXPORT = \ -B$$r/$(HOST_SUBDIR)/prev-gcc/ -B$(build_tooldir)/bin/ -nostdinc++ \ -B$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \ -B$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs \ - -I$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/include/$(TARGET_SUBDIR) \ - -I$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/include \ - -I$$s/libstdc++-v3/libsupc++ \ + `if $(LEAN); then echo ' -isystem '; else echo ' -I'; fi`$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/include/$(TARGET_SUBDIR) \ + `if $(LEAN); then echo ' -isystem '; else echo ' -I'; fi`$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/include \ + `if $(LEAN); then echo ' -isystem '; else echo ' -I'; fi`$$s/libstdc++-v3/libsupc++ \ -L$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \ -L$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs"; \ export CXX; \ Jakub
Re: [PATCH] Fix up make bootstrap-lean; make install (PR bootstrap/58572)
Il 07/03/2014 11:45, Jakub Jelinek ha scritto: On Fri, Mar 07, 2014 at 08:26:47AM +0100, Paolo Bonzini wrote: > Il 06/03/2014 19:58, Jakub Jelinek ha scritto: > >Bootstrapped/regtested on x86_64-linux and i686-linux and tested also > >with make bootstrap-lean; make install, ok for trunk? > > Nice fix! Did you check that on a regular bootstrap (formerly > bubblestrap) you can modify the source code for the affected headers > in libstdc++-v3, and alias.o/dfp.o will be rebuilt? It isn't rebuilt with the patch, but I don't see how it is any different from all the other -isystem headers (e.g. the gcc/include headers like stddef.h etc. that we use -isystem for too). I'm not sure it is worth bothering, while there are occassional changes to those headers, it is at most a few occurrences a year and usually just addition of new stuff, after all the headers should remain ABI compatible. Anyway, bootstrapping/regtesting now this variant where it only changes things for *-lean cases and not for normal bootstrap. 2014-03-07 Jakub Jelinek PR bootstrap/58572 * Makefile.tpl (POSTSTAGE1_CXX_EXPORT): Use -isystem instead of -I for libstdc++-v3 includes if $(LEAN). * Makefile.in: Regenerated. Ok. Paolo
Re: Patch RFC: Use internal qsort function in libbacktrace
Hi, On 03/05/2014 04:34 AM, Ian Lance Taylor wrote: The GNU glibc qsort function will call malloc in some cases. That makes it unsuitable for libbacktrace, which is intended to work when called from a signal handler. This patch changes libbacktrace to use an internal qsort function. I'm posting this for comments in case anybody sees anything wrong with the implementation. I'll commit it in a day or two if I don't hear anything. Bootstrapped and ran libbacktrace and Go tests on x86_64-unknown-linux-gnu. Sorry if I missed some messages or I'm just confused, but today I'm seeing a lot of regressions all of the same form: libsanitizer/asan/.libs/libasan.so: undefined reference to `backtrace_qsort' Confirmed in eg: http://gcc.gnu.org/ml/gcc-testresults/2014-03/msg00399.html Any idea what's up? Thanks, Paolo.
[PATCH] [gomp4] Initial OpenACC support to C++ front-end
Hi Thomas! I prepared simple patch to add support of OpenACC data, kernels and parallel constructs to C++ FE. It adds support of data clauses too. OK to gomp4 branch? -- Ilmir.
Re: [PATCH 2/2] [gomp4] Initial OpenACC support to C++ front-end
Initial OpenACC support to C++ front-end -- tests * gcc/testsuite/c-c++-common/goacc/deviceptr-1.c: Move to ... * gcc/testsuite/gcc.dg/goacc/deviceptr-1.c ... here. * gcc/testsuite/g++.dg/goacc/goacc.exp: New test directory. * gcc/testsuite/g++.dg/goacc-gomp/goacc-gomp.exp: Likewise. gcc/testsuite/g++.dg/goacc/ * deviceptr-1.cpp: New test. * sb-1.cpp: Likewise. * sb-2.cpp: Likewise. >From c7cbe59516a1c21cfbad48863311e6d5389c Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Fri, 7 Mar 2014 15:12:30 +0400 Subject: [PATCH 2/2] Initial OpenACC support to C++ front-end -- tests --- gcc/testsuite/c-c++-common/goacc/deviceptr-1.c | 64 - gcc/testsuite/g++.dg/goacc-gomp/goacc-gomp.exp | 39 gcc/testsuite/g++.dg/goacc/deviceptr-1.cpp | 65 ++ gcc/testsuite/g++.dg/goacc/goacc.exp | 38 +++ gcc/testsuite/g++.dg/goacc/sb-1.cpp| 59 +++ gcc/testsuite/g++.dg/goacc/sb-2.cpp| 25 ++ gcc/testsuite/gcc.dg/goacc/deviceptr-1.c | 64 + 7 files changed, 290 insertions(+), 64 deletions(-) delete mode 100644 gcc/testsuite/c-c++-common/goacc/deviceptr-1.c create mode 100644 gcc/testsuite/g++.dg/goacc-gomp/goacc-gomp.exp create mode 100644 gcc/testsuite/g++.dg/goacc/deviceptr-1.cpp create mode 100644 gcc/testsuite/g++.dg/goacc/goacc.exp create mode 100644 gcc/testsuite/g++.dg/goacc/sb-1.cpp create mode 100644 gcc/testsuite/g++.dg/goacc/sb-2.cpp create mode 100644 gcc/testsuite/gcc.dg/goacc/deviceptr-1.c diff --git a/gcc/testsuite/c-c++-common/goacc/deviceptr-1.c b/gcc/testsuite/c-c++-common/goacc/deviceptr-1.c deleted file mode 100644 index 1ac63bd..000 --- a/gcc/testsuite/c-c++-common/goacc/deviceptr-1.c +++ /dev/null @@ -1,64 +0,0 @@ -void -fun1 (void) -{ -#pragma acc parallel deviceptr(u) /* { dg-error "'u' undeclared" } */ - ; -#pragma acc kernels deviceptr(u[0:4]) /* { dg-error "expected '\\\)' before '\\\[' token" } */ - ; - -#pragma acc data deviceptr(fun1) /* { dg-error "'fun1' is not a variable" } */ - ; -#pragma acc parallel deviceptr(fun1[2:5]) - /* { dg-error "'fun1' is not a variable" "not a variable" { target *-*-* } 11 } */ - /* { dg-error "expected '\\\)' before '\\\[' token" "array" { target *-*-* } 11 } */ - ; - - int i; -#pragma acc kernels deviceptr(i) /* { dg-error "'i' is not a pointer variable" } */ - ; -#pragma acc data deviceptr(i[0:4]) - /* { dg-error "'i' is not a pointer variable" "not a pointer variable" { target *-*-* } 19 } */ - /* { dg-error "expected '\\\)' before '\\\[' token" "array" { target *-*-* } 19 } */ - ; - - float fa[10]; -#pragma acc parallel deviceptr(fa) /* { dg-error "'fa' is not a pointer variable" } */ - ; -#pragma acc kernels deviceptr(fa[1:5]) - /* { dg-error "'fa' is not a pointer variable" "not a pointer variable" { target *-*-* } 27 } */ - /* { dg-error "expected '\\\)' before '\\\[' token" "array" { target *-*-* } 27 } */ - ; - - float *fp; -#pragma acc data deviceptr(fp) - ; -#pragma acc parallel deviceptr(fp[0:4]) /* { dg-error "expected '\\\)' before '\\\[' token" } */ - ; -} - -void -fun2 (void) -{ - int i; - float *fp; -#pragma acc kernels deviceptr(fp,u,fun2,i,fp) - /* { dg-error "'u' undeclared" "u undeclared" { target *-*-* } 44 } */ - /* { dg-error "'fun2' is not a variable" "fun2 not a variable" { target *-*-* } 44 } */ - /* { dg-error "'i' is not a pointer variable" "i not a pointer variable" { target *-*-* } 44 } */ - /* { dg-error "'fp' appears more than once in map clauses" "fp more than once" { target *-*-* } 44 } */ - ; -} - -void -fun3 (void) -{ - float *fp; -#pragma acc data deviceptr(fp,fp) /* { dg-error "'fp' appears more than once in map clauses" } */ - ; -#pragma acc parallel deviceptr(fp) deviceptr(fp) /* { dg-error "'fp' appears more than once in map clauses" } */ - ; -#pragma acc kernels copy(fp) deviceptr(fp) /* { dg-error "'fp' appears more than once in map clauses" } */ - ; -} - -/* { dg-prune-output "sorry, unimplemented: data clause not yet implemented" } */ diff --git a/gcc/testsuite/g++.dg/goacc-gomp/goacc-gomp.exp b/gcc/testsuite/g++.dg/goacc-gomp/goacc-gomp.exp new file mode 100644 index 000..0658b4a --- /dev/null +++ b/gcc/testsuite/g++.dg/goacc-gomp/goacc-gomp.exp @@ -0,0 +1,39 @@ +# Copyright (C) 2006-2013 Free Software Foundation, Inc. +# +# This file is part of GCC. +# +# GCC is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GCC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU Ge
Re: [PATCH 1/2] [gomp4] Initial OpenACC support to C++ front-end
Initial OpenACC support to C++ front-end: parallel, kernels and data construct with data clauses. gcc/cp/ * cp-tree.h (finish_oacc_data): New function prototype. (finish_oacc_kernels, finish_oacc_parallel): Likewise. * parser.c (cp_parser_omp_clause_name): Support data clauses. (cp_parser_oacc_data_clause): New function. (cp_parser_oacc_data_clause_deviceptr, cp_parser_oacc_all_clauses, cp_parser_oacc_data, cp_parser_oacc_kernels, cp_parser_oacc_parallel): Likewise. (OACC_DATA_CLAUSE_MASK): New define. (OACC_KERNELS_CLAUSE_MASK, OACC_PARALLEL_CLAUSE_MASK): Likewise. (cp_parser_omp_construct, cp_parser_pragma): Support OpenACC directives. * semantics.c (finish_oacc_data): New function. (finish_oacc_kernels, finish_oacc_parallel): Likewise. >From 422e398c375ce6a62691bfc4cc9dd71c38f87b40 Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Fri, 7 Mar 2014 15:09:47 +0400 Subject: [PATCH 1/2] Initial OpenACC support to C++ front-end --- gcc/cp/cp-tree.h | 3 + gcc/cp/parser.c| 347 - gcc/cp/semantics.c | 54 + 3 files changed, 403 insertions(+), 1 deletion(-) diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 7681b27..3d734ac 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -5822,6 +5822,9 @@ extern tree finish_omp_clauses (tree); extern void finish_omp_threadprivate (tree); extern tree begin_omp_structured_block (void); extern tree finish_omp_structured_block (tree); +extern tree finish_oacc_data (tree, tree); +extern tree finish_oacc_kernels (tree, tree); +extern tree finish_oacc_parallel (tree, tree); extern tree begin_omp_parallel (void); extern tree finish_omp_parallel (tree, tree); extern tree begin_omp_task (void); diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index ff481ab..ba9cda65 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -26868,16 +26868,26 @@ cp_parser_omp_clause_name (cp_parser *parser) case 'c': if (!strcmp ("collapse", p)) result = PRAGMA_OMP_CLAUSE_COLLAPSE; + else if (!strcmp ("copy", p)) + result = PRAGMA_OMP_CLAUSE_COPY; else if (!strcmp ("copyin", p)) result = PRAGMA_OMP_CLAUSE_COPYIN; + else if (!strcmp ("copyout", p)) + result = PRAGMA_OMP_CLAUSE_COPYOUT; else if (!strcmp ("copyprivate", p)) result = PRAGMA_OMP_CLAUSE_COPYPRIVATE; + else if (!strcmp ("create", p)) + result = PRAGMA_OMP_CLAUSE_CREATE; break; case 'd': - if (!strcmp ("depend", p)) + if (!strcmp ("delete", p)) + result = PRAGMA_OMP_CLAUSE_DELETE; + else if (!strcmp ("depend", p)) result = PRAGMA_OMP_CLAUSE_DEPEND; else if (!strcmp ("device", p)) result = PRAGMA_OMP_CLAUSE_DEVICE; + else if (!strcmp ("deviceptr", p)) + result = PRAGMA_OMP_CLAUSE_DEVICEPTR; else if (!strcmp ("dist_schedule", p)) result = PRAGMA_OMP_CLAUSE_DIST_SCHEDULE; break; @@ -26926,6 +26936,22 @@ cp_parser_omp_clause_name (cp_parser *parser) case 'p': if (!strcmp ("parallel", p)) result = PRAGMA_OMP_CLAUSE_PARALLEL; + else if (!strcmp ("present", p)) + result = PRAGMA_OMP_CLAUSE_PRESENT; + else if (!strcmp ("present_or_copy", p) + || !strcmp ("pcopy", p)) + result = PRAGMA_OMP_CLAUSE_PRESENT_OR_COPY; + else if (!strcmp ("present_or_copyin", p) + || !strcmp ("pcopyin", p)) + result = PRAGMA_OMP_CLAUSE_PRESENT_OR_COPYIN; + else if (!strcmp ("present_or_copyout", p) + || !strcmp ("pcopyout", p)) + result = PRAGMA_OMP_CLAUSE_PRESENT_OR_COPYOUT; + else if (!strcmp ("present_or_create", p) + || !strcmp ("pcreate", p)) + result = PRAGMA_OMP_CLAUSE_PRESENT_OR_CREATE; + else if (!strcmp ("private", p)) + result = PRAGMA_OMP_CLAUSE_PRIVATE; else if (!strcmp ("proc_bind", p)) result = PRAGMA_OMP_CLAUSE_PROC_BIND; break; @@ -27133,6 +27159,111 @@ cp_parser_omp_var_list (cp_parser *parser, enum omp_clause_code kind, tree list) return list; } +/* OpenACC 2.0: + copy ( variable-list ) + copyin ( variable-list ) + copyout ( variable-list ) + create ( variable-list ) + delete ( variable-list ) + present ( variable-list ) + present_or_copy ( variable-list ) + pcopy ( variable-list ) + present_or_copyin ( variable-list ) + pcopyin ( variable-list ) + present_or_copyout ( variable-list ) + pcopyout ( variable-list ) + present_or_create ( variable-list ) + pcreate ( variable-list ) */ + +static tree +cp_parser_oacc_data_clause (cp_parser *parser, pragma_omp_clause c_kind, + tree list) +{ + enum omp_clause_map_kind kind; + switch (c_kind) +{ +default: + gcc_unreachable (); +case PRAGMA_OMP_CLAUSE_COPY: + kind = OMP_CLAUSE_MAP_FORCE_TOFROM; + break; +case PRAGMA_OMP_CLAUSE_COPYIN: + kind = OMP_CLAUSE_MAP_FORCE_TO; + break; +case PRAGMA_OMP_CLAUSE_COPYOUT: + kind = OMP_CLAUSE_MAP_FORCE_FROM; + break; +case PRAGMA_OMP_C
Re: [build, i386] Disable local dynamic TLS model on Solaris/x86 if as/ld cannot handle it
Hi Paolo, > Perhaps GCC would gain from having a separate maintainer for the gcc/ > target-specific configuration (configure.ac/config.gcc/config/*/*.h > basically)... guess who I would propose for such a role :) ... and add the corresponding files in libgcc for good measure :-) But seriously, despite the recent flurry of activity (mostly due to the 4.9 release approaching) I've only just been able to keep up a minimal level of Solaris port housekeeping over the last two years. While I hope to ramp up gcc work again in the future, I'm rather reluctant to accept any additional maintainer roles until it's clear that I'll be able to fill them. I still plan to resume my libgcc move patch series again. Lets talk again about such a role if and when that happens. Rainer -- - Rainer Orth, Center for Biotechnology, Bielefeld University
Re: [PATCH] Fix incorrect byte swap detection (PR tree-optimization/60454)
On 7 March 2014 09:35, Thomas Preud'homme wrote: > +++ b/gcc/testsuite/gcc.dg/optimize-bswapsi-2.c > @@ -0,0 +1,26 @@ > +/* { dg-do compile { target arm*-*-* alpha*-*-* i?86-*-* powerpc*-*-* > rs6000-*-* x86_64-*-* s390*-*-* } } */ I'm fairly sure the target list here should include aarch64*-*-*, I tried to apply the patch to my tree to check but failed because the patch appears to have been corrupted by email... Cheers /Marcus
[C++ Patch] Remove dead code
Hi, while looking into c++/58609 I noticed this dead code. Can I remove it? Tested x86_64-linux. Thanks, Paolo. / 2014-03-07 Paolo Carlini * decl.c (check_initializer): Remove dead code. Index: decl.c === --- decl.c (revision 208397) +++ decl.c (working copy) @@ -5603,7 +5603,6 @@ check_initializer (tree decl, tree init, int flags { tree type = TREE_TYPE (decl); tree init_code = NULL; - tree extra_init = NULL_TREE; tree core_type; /* Things that are going to be initialized need to have complete @@ -5799,9 +5798,6 @@ check_initializer (tree decl, tree init, int flags if (init && init != error_mark_node) init_code = build2 (INIT_EXPR, type, decl, init); - if (extra_init) -init_code = add_stmt_to_compound (extra_init, init_code); - if (init_code && DECL_IN_AGGR_P (decl)) { static int explained = 0;
Re: Patch RFC: Use internal qsort function in libbacktrace
Hi Paolo, > On 03/05/2014 04:34 AM, Ian Lance Taylor wrote: >> The GNU glibc qsort function will call malloc in some cases. That makes >> it unsuitable for libbacktrace, which is intended to work when called >> from a signal handler. This patch changes libbacktrace to use an >> internal qsort function. >> >> I'm posting this for comments in case anybody sees anything wrong with >> the implementation. I'll commit it in a day or two if I don't hear >> anything. >> >> Bootstrapped and ran libbacktrace and Go tests on >> x86_64-unknown-linux-gnu. > Sorry if I missed some messages or I'm just confused, but today I'm seeing > a lot of regressions all of the same form: > > libsanitizer/asan/.libs/libasan.so: undefined reference to `backtrace_qsort' > > Confirmed in eg: > > http://gcc.gnu.org/ml/gcc-testresults/2014-03/msg00399.html > > Any idea what's up? I suspect the following patch (yet untested) will fix this: 2014-03-07 Rainer Orth * libbacktrace/Makefile.am (libsanitizer_libbacktrace_la_SOURCES): Add ../../libbacktrace/sort.c. * libbacktrace/Makefile.in: Regenerate. * libbacktrace/backtrace-rename.h (backtrace_qsort): Define. # HG changeset patch # Parent 4cf44f327506e7ae03a9bdecee301cddc2cb29b3 Handle backtrace_qsort diff --git a/libsanitizer/libbacktrace/Makefile.am b/libsanitizer/libbacktrace/Makefile.am --- a/libsanitizer/libbacktrace/Makefile.am +++ b/libsanitizer/libbacktrace/Makefile.am @@ -50,6 +50,7 @@ libsanitizer_libbacktrace_la_SOURCES = \ ../../libbacktrace/fileline.c \ ../../libbacktrace/internal.h \ ../../libbacktrace/posix.c \ + ../../libbacktrace/sort.c \ ../../libbacktrace/state.c \ ../../libiberty/cp-demangle.c \ bridge.cc diff --git a/libsanitizer/libbacktrace/backtrace-rename.h b/libsanitizer/libbacktrace/backtrace-rename.h --- a/libsanitizer/libbacktrace/backtrace-rename.h +++ b/libsanitizer/libbacktrace/backtrace-rename.h @@ -8,6 +8,7 @@ #define backtrace_initialize __asan_backtrace_initialize #define backtrace_open __asan_backtrace_open #define backtrace_pcinfo __asan_backtrace_pcinfo +#define backtrace_qsort __asan_backtrace_qsort #define backtrace_release_view __asan_backtrace_release_view #define backtrace_syminfo __asan_backtrace_syminfo #define backtrace_vector_finish __asan_backtrace_vector_finish -- - Rainer Orth, Center for Biotechnology, Bielefeld University
Re: Patch RFC: Use internal qsort function in libbacktrace
Hi, On 03/07/2014 01:12 PM, Rainer Orth wrote: Hi Paolo, On 03/05/2014 04:34 AM, Ian Lance Taylor wrote: The GNU glibc qsort function will call malloc in some cases. That makes it unsuitable for libbacktrace, which is intended to work when called from a signal handler. This patch changes libbacktrace to use an internal qsort function. I'm posting this for comments in case anybody sees anything wrong with the implementation. I'll commit it in a day or two if I don't hear anything. Bootstrapped and ran libbacktrace and Go tests on x86_64-unknown-linux-gnu. Sorry if I missed some messages or I'm just confused, but today I'm seeing a lot of regressions all of the same form: libsanitizer/asan/.libs/libasan.so: undefined reference to `backtrace_qsort' Confirmed in eg: http://gcc.gnu.org/ml/gcc-testresults/2014-03/msg00399.html Any idea what's up? I suspect the following patch (yet untested) will fix this: 2014-03-07 Rainer Orth * libbacktrace/Makefile.am (libsanitizer_libbacktrace_la_SOURCES): Add ../../libbacktrace/sort.c. * libbacktrace/Makefile.in: Regenerate. * libbacktrace/backtrace-rename.h (backtrace_qsort): Define. Thanks Rainer. Makes a lot of sense to me too. In my personal opinion if it passes testing you could commit it as obvious. Paolo.
Re: Patch RFC: Use internal qsort function in libbacktrace
On Fri, Mar 07, 2014 at 01:12:02PM +0100, Rainer Orth wrote: > 2014-03-07 Rainer Orth > > * libbacktrace/Makefile.am (libsanitizer_libbacktrace_la_SOURCES): > Add ../../libbacktrace/sort.c. > * libbacktrace/Makefile.in: Regenerate. > * libbacktrace/backtrace-rename.h (backtrace_qsort): Define. Ok, thanks. > --- a/libsanitizer/libbacktrace/Makefile.am > +++ b/libsanitizer/libbacktrace/Makefile.am > @@ -50,6 +50,7 @@ libsanitizer_libbacktrace_la_SOURCES = \ > ../../libbacktrace/fileline.c \ > ../../libbacktrace/internal.h \ > ../../libbacktrace/posix.c \ > + ../../libbacktrace/sort.c \ > ../../libbacktrace/state.c \ > ../../libiberty/cp-demangle.c \ > bridge.cc > diff --git a/libsanitizer/libbacktrace/backtrace-rename.h > b/libsanitizer/libbacktrace/backtrace-rename.h > --- a/libsanitizer/libbacktrace/backtrace-rename.h > +++ b/libsanitizer/libbacktrace/backtrace-rename.h > @@ -8,6 +8,7 @@ > #define backtrace_initialize __asan_backtrace_initialize > #define backtrace_open __asan_backtrace_open > #define backtrace_pcinfo __asan_backtrace_pcinfo > +#define backtrace_qsort __asan_backtrace_qsort > #define backtrace_release_view __asan_backtrace_release_view > #define backtrace_syminfo __asan_backtrace_syminfo > #define backtrace_vector_finish __asan_backtrace_vector_finish Jakub
Re: [PATCH] Fix incorrect byte swap detection (PR tree-optimization/60454)
On Fri, Mar 7, 2014 at 12:45 PM, Marcus Shawcroft wrote: > On 7 March 2014 09:35, Thomas Preud'homme wrote: > >> +++ b/gcc/testsuite/gcc.dg/optimize-bswapsi-2.c >> @@ -0,0 +1,26 @@ >> +/* { dg-do compile { target arm*-*-* alpha*-*-* i?86-*-* powerpc*-*-* >> rs6000-*-* x86_64-*-* s390*-*-* } } */ > > I'm fairly sure the target list here should include aarch64*-*-*, I > tried to apply the patch to my tree to check but failed because the > patch appears to have been corrupted by email... It would be better to make it a runtime testcase that abort()s when miscompiled. Richard. > Cheers > /Marcus
[jit] Tweaks to location-handling
Committed to branch dmalcolm/jit: gcc/jit/ * internal-api.c (gcc::jit::playback::context::handle_locations): Add a disabled call to line_table_dump, in case it's handy for debugging in the future. (gcc::jit::playback::context::set_tree_location): Assert that the location is non-NULL. (gcc::jit::playback::location::location): Initialize m_src_loc to UNKNOWN_LOCATION. This field should always be overwritten by handle_locations before use, but given recent issues with bogus locations it seems safer to initialize it. --- gcc/jit/ChangeLog.jit | 12 gcc/jit/internal-api.c | 11 +++ 2 files changed, 23 insertions(+) diff --git a/gcc/jit/ChangeLog.jit b/gcc/jit/ChangeLog.jit index b0058b9..2298e49 100644 --- a/gcc/jit/ChangeLog.jit +++ b/gcc/jit/ChangeLog.jit @@ -1,3 +1,15 @@ +2014-03-07 David Malcolm + + * internal-api.c (gcc::jit::playback::context::handle_locations): + Add a disabled call to line_table_dump, in case it's handy for + debugging in the future. + (gcc::jit::playback::context::set_tree_location): Assert that + the location is non-NULL. + (gcc::jit::playback::location::location): Initialize m_src_loc + to UNKNOWN_LOCATION. This field should always be overwritten by + handle_locations before use, but given recent issues with bogus + locations it seems safer to initialize it. + 2014-03-06 David Malcolm * internal-api.c (gcc::jit::recording::context:: diff --git a/gcc/jit/internal-api.c b/gcc/jit/internal-api.c index f80c40b..1cb15ce 100644 --- a/gcc/jit/internal-api.c +++ b/gcc/jit/internal-api.c @@ -3723,6 +3723,15 @@ handle_locations () linemap_add (line_table, LC_LEAVE, false, NULL, 0); } + /* line_table should now be populated; every playback::location should + now have an m_srcloc. */ + + if (0) +line_table_dump (stderr, +line_table, +LINEMAPS_ORDINARY_USED (line_table), +LINEMAPS_MACRO_USED (line_table)); + /* Now assign them to tree nodes as appropriate. */ std::pair *cached_location; @@ -3822,6 +3831,7 @@ void playback::context:: set_tree_location (tree t, location *loc) { + gcc_assert (loc); m_cached_locations.safe_push (std::make_pair (t, loc)); } @@ -3899,6 +3909,7 @@ get_location (int column_num) } playback::location::location (source_line *line, int column_num) : + m_srcloc (UNKNOWN_LOCATION), m_line (line), m_column_num(column_num) { -- 1.7.11.7
Re: [C++ Patch] Remove dead code
OK. Jason
[jit] Add creating globals to C++ wrapper API
Committed to branch dmalcolm/jit: gcc/jit/ * libgccjit++.h (gccjit::context::new_global): New. --- gcc/jit/ChangeLog.jit | 4 gcc/jit/libgccjit++.h | 15 +++ 2 files changed, 19 insertions(+) diff --git a/gcc/jit/ChangeLog.jit b/gcc/jit/ChangeLog.jit index 2298e49..ef820ea 100644 --- a/gcc/jit/ChangeLog.jit +++ b/gcc/jit/ChangeLog.jit @@ -1,5 +1,9 @@ 2014-03-07 David Malcolm + * libgccjit++.h (gccjit::context::new_global): New. + +2014-03-07 David Malcolm + * internal-api.c (gcc::jit::playback::context::handle_locations): Add a disabled call to line_table_dump, in case it's handy for debugging in the future. diff --git a/gcc/jit/libgccjit++.h b/gcc/jit/libgccjit++.h index da7471b..71bb855 100644 --- a/gcc/jit/libgccjit++.h +++ b/gcc/jit/libgccjit++.h @@ -121,6 +121,10 @@ namespace gccjit function get_builtin_function (const std::string &name); +lvalue new_global (type type_, + const std::string &name, + location loc = location ()); + rvalue new_rvalue (type numeric_type, int value); rvalue zero (type numeric_type); @@ -640,6 +644,17 @@ context::get_builtin_function (const std::string &name) name.c_str ())); } +inline lvalue +context::new_global (type type_, +const std::string &name, +location loc) +{ + return lvalue (gcc_jit_context_new_global (m_inner_ctxt, +loc.get_inner_location (), +type_.get_inner_type (), +name.c_str ())); +} + inline rvalue context::new_rvalue (type numeric_type, int value) -- 1.7.11.7
Re: [RFC] Do not consider volatile asms as optimization barriers #1
Bernd Schmidt writes: > On 03/03/2014 11:01 PM, Richard Sandiford wrote: > >> I'll run a full test overnight, but does this look like it might be >> a way out, at least for 4.9? > > Pretty much agree with everything you've written in this thread. I > think this patch is fine. Thanks. The thread seems to have died down, so should I go ahead and install it? I didn't want to be too hasty since it's obviously a bit of a controversial area. Richard
Re: [PATCH] Fix incorrect byte swap detection (PR tree-optimization/60454)
Hi! On Fri, Mar 07, 2014 at 05:35:01PM +0800, Thomas Preud'homme wrote: > --- a/gcc/tree-ssa-math-opts.c > +++ b/gcc/tree-ssa-math-opts.c > @@ -1801,7 +1801,9 @@ find_bswap_1 (gimple stmt, struct symbolic_number *n, > int limit) > >if (rhs_class == GIMPLE_BINARY_RHS) > { > + int i; >struct symbolic_number n1, n2; > + unsigned HOST_WIDEST_INT mask; >tree source_expr2; > >if (code != BIT_IOR_EXPR) > @@ -1827,6 +1829,15 @@ find_bswap_1 (gimple stmt, struct symbolic_number *n, > int limit) > return NULL_TREE; > > n->size = n1.size; > + for (i = 0, mask = 0xff; i < n->size; i++, mask <<= 8) This should be mask <<= BITS_PER_UNIT for consistency. And, as has been said earlier, the testcase should be a runtime testcase (in gcc.c-torture/execute/), probably with __attribute__((noinline, noclone)) on the function, where main calls the function with a couple of different values, verifies the result and aborts if it is incorrect. Jakub
Re: [PATCH][RFC] Updated: Meta-description for tree and gimple folding
(extremely minor comments, not directly related to the machinery) On Fri, 7 Mar 2014, Richard Biener wrote: + /* fold_negate_exprs convert - (~A) to A + 1. */ + (match_and_simplify + (negate (bit_not @0)) + if (INTEGRAL_TYPE_P (TREE_TYPE (@0))) + (plus @0 { build_int_cst (TREE_TYPE (@0), 1); } )) We are obviously not at the stage of reviewing individual patterns, but it would be nice to keep in mind, while doing this, that a lot of those transformations (most of them?) should apply just the same to vectors. So it should be easy to test: the type is integral or a vector of integers (and maybe complex as well, with the subtlety that sometimes the constant 1 should be 1+0i, but for this transformation it should be 1+i), something is either the constant 2 or a vector of 2, etc, and build a constant. + /* (x >> 31) & 1 -> (x >> 31). Folding in fold-const is more +complicated here, it does + Fold (X << C1) & C2 into (X << C1) & (C2 | ((1 << C1) - 1)) + (X >> C1) & C2 into (X >> C1) & (C2 | ~((type) -1 >> C1)) + if the new mask might be further optimized. */ + (match_and_simplify + (bit_and (rshift@0 @1 INTEGER_CST_P@2) integer_onep) + if (compare_tree_int (@2, TYPE_PRECISION (TREE_TYPE (@1)) - 1) == 0) + @0) s/TYPE_PRECISION/element_precision/ will make it easier to port to vectors. I think this transformation shouldn't output x>>31 but (unsigned)x>>31, that would give an example of how to convert in this language. -- Marc Glisse
Re: Patch RFC: Use internal qsort function in libbacktrace
On Fri, Mar 7, 2014 at 4:12 AM, Rainer Orth wrote: > Hi Paolo, > >> On 03/05/2014 04:34 AM, Ian Lance Taylor wrote: >>> The GNU glibc qsort function will call malloc in some cases. That makes >>> it unsuitable for libbacktrace, which is intended to work when called >>> from a signal handler. This patch changes libbacktrace to use an >>> internal qsort function. >>> >>> I'm posting this for comments in case anybody sees anything wrong with >>> the implementation. I'll commit it in a day or two if I don't hear >>> anything. >>> >>> Bootstrapped and ran libbacktrace and Go tests on >>> x86_64-unknown-linux-gnu. >> Sorry if I missed some messages or I'm just confused, but today I'm seeing >> a lot of regressions all of the same form: >> >> libsanitizer/asan/.libs/libasan.so: undefined reference to `backtrace_qsort' >> >> Confirmed in eg: >> >> http://gcc.gnu.org/ml/gcc-testresults/2014-03/msg00399.html >> >> Any idea what's up? > > I suspect the following patch (yet untested) will fix this: > > 2014-03-07 Rainer Orth > > * libbacktrace/Makefile.am (libsanitizer_libbacktrace_la_SOURCES): > Add ../../libbacktrace/sort.c. > * libbacktrace/Makefile.in: Regenerate. > * libbacktrace/backtrace-rename.h (backtrace_qsort): Define. Sorry about that. It did not occur to me to run the sanitizer tests. Thanks for the fix. Ian
libbacktrace patch committed: Speed up sort
The new libbacktrace sort routine has, no doubt, many flaws, but one is quite significant. The backtrace data tends to be roughly sorted in practice (though unfortunately not perfectly sorted). By pivoting on the first element in the array, the sort routine was tending to maximize the number of recursive steps. This patch uses the middle element array as the pivot. This reduced the backtrace time on a large executable by two orders of magnitude. Bootstrapped and ran Go and sanitizer testsuites on x86_64-unknown-linux-gnu. Committed to mainline. Ian 2014-03-07 Ian Lance Taylor * sort.c (backtrace_qsort): Use middle element as pivot. Index: sort.c === --- sort.c (revision 208402) +++ sort.c (working copy) @@ -69,6 +69,12 @@ backtrace_qsort (void *basearg, size_t c if (count < 2) return; + /* The symbol table and DWARF tables, which is all we use this + routine for, tend to be roughly sorted. Pick the middle element + in the array as our pivot point, so that we are more likely to + cut the array in half for each recursion step. */ + swap (base, base + (count / 2) * size, size); + mid = 0; for (i = 1; i < count; i++) {
PATCH to add -std=c++14
It's looking very likely that we will have a new C++ standard this year, so I'm going to go ahead and add the -std=c++14 flag for 4.9; I just won't advertise it yet. Tested x86_64-pc-linux-gnu, applying to trunk. commit f966b130e3b011c6ac2169472fdf6508b5373eeb Author: Jason Merrill Date: Wed Mar 5 13:22:47 2014 -0500 * c.opt: Add -std=c++14. diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt index aad54e2..93fb7c2 100644 --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -1349,15 +1349,18 @@ Conform to the ISO 1998 C++ standard revised by the 2003 technical corrigendum std=c++11 C++ ObjC++ -Conform to the ISO 2011 C++ standard (experimental and incomplete support) +Conform to the ISO 2011 C++ standard std=c++0x -C++ ObjC++ Alias(std=c++11) +C++ ObjC++ Alias(std=c++11) Undocumented Deprecated in favor of -std=c++11 std=c++1y C++ ObjC++ -Conform to the ISO 201y(7?) C++ draft standard (experimental and incomplete support) +Conform to the ISO 2014(?) C++ draft standard (experimental and incomplete support) + +std=c++14 +C++ ObjC++ Alias(std=c++1y) Undocumented std=c11 C ObjC diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 4a5caa3..2ee091a 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -1722,14 +1722,12 @@ C++ code. @item c++11 @itemx c++0x -The 2011 ISO C++ standard plus amendments. Support for C++11 is still -experimental, and may change in incompatible ways in future releases. +The 2011 ISO C++ standard plus amendments. The name @samp{c++0x} is deprecated. @item gnu++11 @itemx gnu++0x -GNU dialect of @option{-std=c++11}. Support for C++11 is still -experimental, and may change in incompatible ways in future releases. +GNU dialect of @option{-std=c++11}. The name @samp{gnu++0x} is deprecated. @item c++1y
[patch] Remove two maintainers of avr port
Committed. 2014-03-07 Denis Chertykov * MAINTAINERS: Remove avr maintainers: Anatoly Sokolov and Eric Weddington Index: MAINTAINERS === --- MAINTAINERS (revision 208404) +++ MAINTAINERS (working copy) @@ -51,8 +51,6 @@ arm port Paul Brook p...@codesourcery.com arm port Ramana Radhakrishnan ramana.radhakrish...@arm.com avr port Denis Chertykov cherty...@gmail.com -avr port Anatoly Sokolov ae...@post.ru -avr port Eric Weddington eric.wedding...@atmel.com bfin port Bernd Schmidt ber...@codesourcery.com bfin port Jie Zhang jzhang...@gmail.com c6x port Bernd Schmidt ber...@codesourcery.com Denis.
Re: [patch] Remove two maintainers of avr port
Denis Chertykov writes: > 2014-03-07 Denis Chertykov > > * MAINTAINERS: Remove avr maintainers: Anatoly Sokolov and > Eric Weddington Don't maintainers usually retain their write-after-approval status even if they step down from the maintainership? Rainer -- - Rainer Orth, Center for Biotechnology, Bielefeld University
Re: [PATCH] Fix PR c++/60393
On 03/04/2014 04:46 PM, Adam Butcher wrote: PR c++/60393 * parser.c (cp_parser_parameter_declaration_clause): Move generic function template unwinding on error into a move general location, ... (cp_parser_error): ... here. Hmm, I'm uncomfortable with this change; not all errors lead to unwinding the whole declaration context. Typically they just mean we're changing from one tentative parse to another. If for instance you had a function with one generic parameter and one with a type like A<42>, we would try to parse 42 as a type and hit cp_parser_error before parsing it as an expression. Jason
[PATCH, libgcc]: Avoid warning: array subscript is above array bounds when compiling crtstuff.c
Hello! Attached patch avoids a bunch of: ../../../gcc-svn/trunk/libgcc/crtstuff.c: In function 'frame_dummy': ../../../gcc-svn/trunk/libgcc/crtstuff.c:463:19: warning: array subscript is above array bounds [-Warray-bounds] if (__JCR_LIST__[0]) ^ when compiling libgcc. 2014-03-08 Uros Bizjak * crtstuff.c (__JCR_LIST__): Declare as zero-length array. Bootstrapped and regression tested on x86_64-pc-linux-gnu {,-m32}. OK for mainline? Uros. Index: crtstuff.c === --- crtstuff.c (revision 208403) +++ crtstuff.c (working copy) @@ -257,7 +257,7 @@ STATIC EH_FRAME_SECTION_CONST char __EH_FRAME_BEGI #ifdef JCR_SECTION_NAME /* Stick a label at the beginning of the java class registration info so we can register them properly. */ -STATIC void *__JCR_LIST__[] +STATIC void *__JCR_LIST__[0] __attribute__ ((used, section(JCR_SECTION_NAME), aligned(sizeof(void* = { }; #endif /* JCR_SECTION_NAME */
Re: [C++ Patch/RFC] PR 60389
Inherited constructors inherit 'constexpr' from the designated base; B::B isn't constexpr because A::A isn't, and we should say that at the beginning of is_valid_constexpr_fn. Jason
[C++ Patch] PR 58609
Hi, in this regression we ICE during error recovery, much, much later, in the middle-end. In order to avoid that it seems to me that we can safely return NULL_TREE. I'm also taking the occasion to change a pair of errors to error + inform (this is also consistent with eg, the explain-once type messages we have got in do_friend and in resolve_address_of_overloaded_function) Tested x86_64-linux. Thanks, Paolo. /cp 2014-03-07 Paolo Carlini PR c++/58609 * decl.c (check_initializer): Return NULL_TREE after error; consistently use inform. /testsuite 2014-03-07 Paolo Carlini PR c++/58609 * g++.dg/cpp0x/constexpr-ice12.C: New. Index: cp/decl.c === --- cp/decl.c (revision 208406) +++ cp/decl.c (working copy) @@ -5809,9 +5809,11 @@ check_initializer (tree decl, tree init, int flags "member %qD", decl); if (!explained) { - error ("(an out of class initialization is required)"); + inform (input_location, + "(an out of class initialization is required)"); explained = 1; } + return NULL_TREE; } return init_code; Index: testsuite/g++.dg/cpp0x/constexpr-ice12.C === --- testsuite/g++.dg/cpp0x/constexpr-ice12.C(revision 0) +++ testsuite/g++.dg/cpp0x/constexpr-ice12.C(working copy) @@ -0,0 +1,9 @@ +// PR c++/58609 +// { dg-do compile { target c++11 } } + +struct A +{ + static constexpr int&& i = 0; // { dg-error "initialization" } +}; + +int j = A::i;
Re: [C++ Patch] PR 58609
OK. Jason
Re: [wwwdocs] Add "Porting to GCC 4.9" document
On 04/03/14 22:32 +, Jonathan Wakely wrote: I've added an initial "Porting to GCC 4.9" page at http://gcc.gnu.org/gcc-4.9/porting_to.html So far it only contains a couple of C++ changes that caused some failures during mass rebuilds, other additions are welcome. The attached patch adds some more changes (thanks to Jakub for the OpenMP one) and links to the porting guide form gcc-4.9/changes.html Index: changes.html === RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.9/changes.html,v retrieving revision 1.59 retrieving revision 1.60 diff -u -r1.59 -r1.60 --- changes.html4 Mar 2014 05:40:02 - 1.59 +++ changes.html7 Mar 2014 18:04:49 - 1.60 @@ -35,6 +35,14 @@ + +More information on porting to GCC 4.9 from previous versions +of GCC can be found in +the http://gcc.gnu.org/gcc-4.9/porting_to.html";>porting +guide for this release. + + + General Optimizer Improvements @@ -217,8 +225,8 @@ G++ supports the C++1y [[deprecated]] -attribute modulo bugs in the underying [[gnu::deprecated]] attribute. Classes -and functions can be marked deprecated and +attribute modulo bugs in the underlying [[gnu::deprecated]] attribute. Classes +and functions can be marked deprecated and a diagnostic message added: class A; int bar(int n); Index: porting_to.html === RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.9/porting_to.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- porting_to.html 4 Mar 2014 22:28:30 - 1.1 +++ porting_to.html 7 Mar 2014 18:04:48 - 1.2 @@ -33,13 +33,40 @@ New warnings --> +C/C++ language issues + +Invalid OpenMP #pragma omp end directive now diagnosed + + GCC no longer accepts invalid OpenMP like: + + + #pragma omp critical +foo (); + #pragma omp end critical + + +This example now gives the following diagnostic: + + +t.c:6:19: error: expected ‘declare’ before ‘critical’ + #pragma omp end critical + ^ + + +There is no #pragma omp end critical directive for C/C++ +(whereas for Fortran there is !$omp end critical) but before +OpenMP 4.0 support was added, this would be diagnosed only with +-Wunknown-pragmas. As OpenMP 4.0 includes the +#pragma omp end declare target directive, this is now a parsing +error. + C++ language issues -Shadowing name of exception in catch clause now rejected +Shadowing name of exception in catch handler now rejected GCC by default no longer accepts code such as: @@ -64,40 +91,86 @@ The standard says the example is ill-formed, so GCC was changed to reject it -for http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31952";>PR 31952. +for http://gcc.gnu.org/PR31952";>PR31952. To fix the error either rename one of the variables or use an additional nested scope for the second one. -Default arguments on redeclaration of member function of class template no rejected +Default arguments on redeclaration of member function of class template now rejected GCC by default no longer accepts code such as: - template+ template struct A { void f(int); }; - template + template void A ::f(int i=0) { } This example now gives the following diagnostic: -r.cc:8:21: error: redeclaration of ‘void A ::f(int)’ may not have default arguments [-fpermissive] +r.cc:8:21: error: redeclaration of ‘void A ::f(int)’ may not have default arguments [-fpermissive] -The standard says the example is ill-formed, so GCC was changed to reject it. +The standard says the example is ill-formed, so GCC was changed to reject it +for http://gcc.gnu.org/PR54485";>PR54485. To fix the error the default argument must appear when the member function is first declared. +Header changes + +The contents of the header were reorganized to +allow easier reuse within libstdc++. +As a result, some code which directly includes headers such as + will no longer compile and may produce +a diagnostic like: + +/usr/include/c++/4.9.0/bits/shared_ptr_base.h: In member function 'virtual void* std::_Sp_counted_deleter<_Ptr, _Deleter, _Alloc, _Lp>::_M_get_deleter(const std::type_info&)’: +/usr/include/c++/4.9.0/bits/shared_ptr_base.h:479:39: error: must #include before using typeid + return __ti == typeid(_Deleter) ? &_M_impl._M_del() : nullptr; + ^ + + +All headers are internal library headers +and including them directly is not supported and may be made into a hard +error in a future GCC release. + +Header changes + +The header was updated for C++11 support and +this breaks some libraries which misuse macros meant for internal use by GCC +only. +For instance with GMP versions up to 5.1.3, yo
Merge from trunk to gccgo branch
I merged GCC trunk revision 208403 to the gccgo branch. Ian
Re: [PATCH, libgcc]: Avoid warning: array subscript is above array bounds when compiling crtstuff.c
On Fri, Mar 7, 2014 at 9:36 AM, Uros Bizjak wrote: > > Attached patch avoids a bunch of: > > ../../../gcc-svn/trunk/libgcc/crtstuff.c: In function 'frame_dummy': > ../../../gcc-svn/trunk/libgcc/crtstuff.c:463:19: warning: array > subscript is above array bounds [-Warray-bounds] >if (__JCR_LIST__[0]) >^ > > when compiling libgcc. > > 2014-03-08 Uros Bizjak > > * crtstuff.c (__JCR_LIST__): Declare as zero-length array. > > Bootstrapped and regression tested on x86_64-pc-linux-gnu {,-m32}. > > OK for mainline? > > Uros. > > > Index: crtstuff.c > === > --- crtstuff.c (revision 208403) > +++ crtstuff.c (working copy) > @@ -257,7 +257,7 @@ STATIC EH_FRAME_SECTION_CONST char __EH_FRAME_BEGI > #ifdef JCR_SECTION_NAME > /* Stick a label at the beginning of the java class registration info > so we can register them properly. */ > -STATIC void *__JCR_LIST__[] > +STATIC void *__JCR_LIST__[0] >__attribute__ ((used, section(JCR_SECTION_NAME), aligned(sizeof(void* >= { }; > #endif /* JCR_SECTION_NAME */ I don't understand why this works. You can't index element 0 of a 0 element array. This code is relying on linker magic and it's not surprising that it confuses the compiler. Can you use a type cast or variable assignment in frame_dummy instead? Ian
Re: [PATCH] Fix PR c++/60393
On 2014-03-07 17:29, Jason Merrill wrote: On 03/04/2014 04:46 PM, Adam Butcher wrote: PR c++/60393 * parser.c (cp_parser_parameter_declaration_clause): Move generic function template unwinding on error into a move general location, ... (cp_parser_error): ... here. Hmm, I'm uncomfortable with this change; not all errors lead to unwinding the whole declaration context. Typically they just mean we're changing from one tentative parse to another. If for instance you had a function with one generic parameter and one with a type like A<42>, we would try to parse 42 as a type and hit cp_parser_error before parsing it as an expression. Ah right. I did wonder about tentative parsing. What about in cp_parser_skip_to_end_of_statement? Alternative seems to be that we explicitly handle each case.
[jit] Reorganize jit.dg/test-functions.c
Committed to branch dmalcolm/jit: gcc/testsuite/ * jit.dg/test-functions.c: Reorder function definitions, grouping them by subject-matter rather than by create-vs-verify phase. --- gcc/testsuite/ChangeLog.jit | 5 ++ gcc/testsuite/jit.dg/test-functions.c | 107 +++--- 2 files changed, 65 insertions(+), 47 deletions(-) diff --git a/gcc/testsuite/ChangeLog.jit b/gcc/testsuite/ChangeLog.jit index 52b606e..08fe76c 100644 --- a/gcc/testsuite/ChangeLog.jit +++ b/gcc/testsuite/ChangeLog.jit @@ -1,3 +1,8 @@ +2014-03-07 David Malcolm + + * jit.dg/test-functions.c: Reorder function definitions, grouping + them by subject-matter rather than by create-vs-verify phase. + 2014-03-06 David Malcolm * jit.dg/test-nested-contexts.c (main): Dump the contexts to diff --git a/gcc/testsuite/jit.dg/test-functions.c b/gcc/testsuite/jit.dg/test-functions.c index a42f304..b3e3251 100644 --- a/gcc/testsuite/jit.dg/test-functions.c +++ b/gcc/testsuite/jit.dg/test-functions.c @@ -6,6 +6,10 @@ #include "harness.h" +/** + Builtin functions + **/ + static void create_test_of_builtin_strcmp (gcc_jit_context *ctxt) { @@ -124,53 +128,6 @@ create_use_of_builtins (gcc_jit_context *ctxt) } static void -create_use_of_void_return (gcc_jit_context *ctxt) -{ - /* Let's try to inject the equivalent of: - void - test_of_void_return (int *out) - { - *out = 1; -return; - } - */ - gcc_jit_type *void_t = -gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_VOID); - gcc_jit_type *int_t = -gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_INT); - gcc_jit_type *int_ptr_t = -gcc_jit_type_get_pointer (int_t); - - /* Build the test_fn. */ - gcc_jit_param *param_out = -gcc_jit_context_new_param (ctxt, NULL, int_ptr_t, "out"); - gcc_jit_function *test_fn = -gcc_jit_context_new_function (ctxt, NULL, - GCC_JIT_FUNCTION_EXPORTED, - void_t, - "test_of_void_return", - 1, ¶m_out, - 0); - gcc_jit_block *initial = -gcc_jit_function_new_block (test_fn, "initial"); - - gcc_jit_block_add_assignment ( -initial, NULL, -/* "*out = ..." */ -gcc_jit_rvalue_dereference (gcc_jit_param_as_rvalue (param_out), - NULL), -gcc_jit_context_one (ctxt, int_t)); - gcc_jit_block_end_with_void_return (initial, NULL); -} - -void -create_code (gcc_jit_context *ctxt, void *user_data) -{ - create_use_of_builtins (ctxt); - create_use_of_void_return (ctxt); -} - -static void verify_test_of_builtin_strcmp (gcc_jit_context *ctxt, gcc_jit_result *result) { typedef int (*fn_type) (const char *, const char *); @@ -213,6 +170,50 @@ verify_use_of_builtins (gcc_jit_context *ctxt, gcc_jit_result *result) verify_test_of_builtin_trig (ctxt, result); } +/** + "void" return + **/ + +static void +create_use_of_void_return (gcc_jit_context *ctxt) +{ + /* Let's try to inject the equivalent of: + void + test_of_void_return (int *out) + { + *out = 1; +return; + } + */ + gcc_jit_type *void_t = +gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_VOID); + gcc_jit_type *int_t = +gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_INT); + gcc_jit_type *int_ptr_t = +gcc_jit_type_get_pointer (int_t); + + /* Build the test_fn. */ + gcc_jit_param *param_out = +gcc_jit_context_new_param (ctxt, NULL, int_ptr_t, "out"); + gcc_jit_function *test_fn = +gcc_jit_context_new_function (ctxt, NULL, + GCC_JIT_FUNCTION_EXPORTED, + void_t, + "test_of_void_return", + 1, ¶m_out, + 0); + gcc_jit_block *initial = +gcc_jit_function_new_block (test_fn, "initial"); + + gcc_jit_block_add_assignment ( +initial, NULL, +/* "*out = ..." */ +gcc_jit_rvalue_dereference (gcc_jit_param_as_rvalue (param_out), + NULL), +gcc_jit_context_one (ctxt, int_t)); + gcc_jit_block_end_with_void_return (initial, NULL); +} + static void verify_void_return (gcc_jit_context *ctxt, gcc_jit_result *result) { @@ -228,6 +229,18 @@ verify_void_return (gcc_jit_context *ctxt, gcc_jit_result *result) CHECK_VALUE (i, 1); /* ensure correct value was written back */ } +/** + Code for harness + **/ + +void +create_cod
Re: [wwwdocs] Add "Porting to GCC 4.9" document
On 07/03/14 18:08 +, Jonathan Wakely wrote: On 04/03/14 22:32 +, Jonathan Wakely wrote: I've added an initial "Porting to GCC 4.9" page at http://gcc.gnu.org/gcc-4.9/porting_to.html So far it only contains a couple of C++ changes that caused some failures during mass rebuilds, other additions are welcome. The attached patch adds some more changes (thanks to Jakub for the OpenMP one) and links to the porting guide form gcc-4.9/changes.html This patch adds a note about a new warning (thanks to Marek), which caused some build failures in binutils and gdb. ? .porting_to.html.swp Index: porting_to.html === RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.9/porting_to.html,v retrieving revision 1.3 diff -u -r1.3 porting_to.html --- porting_to.html 7 Mar 2014 19:19:51 - 1.3 +++ porting_to.html 7 Mar 2014 19:42:36 - @@ -60,9 +60,32 @@ #pragma omp end declare target directive, this is now a parsing error. - + +Right operand of comma operator without effect + +GCC now warns about unused right-hand side of a comma expression that +contains no side effects: + + + int i = 42; + bar (), i; + + +This example now gives the following diagnostic: + + +w.c:5:9: warning: right-hand operand of comma expression has no effect [-Wunused-value] + bar (), i; + ^ + + +To suppress this warning cast the right-hand operand to void: + + + int i = 42; + bar (), (void) i; + C++ language issues
[jit] Add GCC_JIT_FUNCTION_ALWAYS_INLINE and fix GCC_JIT_FUNCTION_INTERNAL.
Committed to branch dmalcolm/jit: gcc/jit/ * libgccjit.h (enum gcc_jit_function_kind): Add GCC_JIT_FUNCTION_ALWAYS_INLINE. * internal-api.c (gcc::jit::recording::function::write_to_dump): Handle GCC_JIT_FUNCTION_ALWAYS_INLINE. (gcc::jit::playback::context::new_function): Likewise. (gcc::jit::playback::context::postprocess): Handle GCC_JIT_FUNCTION_INTERNAL and GCC_JIT_FUNCTION_ALWAYS_INLINE by clearing DECL_EXTERNAL and TREE_PUBLIC. Doing so fixes the "undefined symbol" bug seen with GCC_JIT_FUNCTION_INTERNAL. * TODO.rst: Update. gcc/testsuite/ * jit.dg/test-functions.c (create_test_of_hidden_function): New, adding test coverage for GCC_JIT_FUNCTION_ALWAYS_INLINE and GCC_JIT_FUNCTION_INTERNAL. (create_tests_of_hidden_functions): Likewise. (verify_hidden_functions): Likewise. (create_code): Add call to create_tests_of_hidden_functions. (verify_code): Add call to verify_hidden_functions. * jit.dg/test-quadratic.c (make_calc_discriminant): Convert from GCC_JIT_FUNCTION_EXPORTED to GCC_JIT_FUNCTION_INTERNAL. --- gcc/jit/ChangeLog.jit | 13 + gcc/jit/TODO.rst | 5 -- gcc/jit/internal-api.c| 21 +++ gcc/jit/libgccjit.h | 12 +++- gcc/testsuite/ChangeLog.jit | 12 gcc/testsuite/jit.dg/test-functions.c | 107 ++ gcc/testsuite/jit.dg/test-quadratic.c | 4 +- 7 files changed, 166 insertions(+), 8 deletions(-) diff --git a/gcc/jit/ChangeLog.jit b/gcc/jit/ChangeLog.jit index ef820ea..223fd6a 100644 --- a/gcc/jit/ChangeLog.jit +++ b/gcc/jit/ChangeLog.jit @@ -1,5 +1,18 @@ 2014-03-07 David Malcolm + * libgccjit.h (enum gcc_jit_function_kind): Add + GCC_JIT_FUNCTION_ALWAYS_INLINE. + * internal-api.c (gcc::jit::recording::function::write_to_dump): + Handle GCC_JIT_FUNCTION_ALWAYS_INLINE. + (gcc::jit::playback::context::new_function): Likewise. + (gcc::jit::playback::context::postprocess): Handle + GCC_JIT_FUNCTION_INTERNAL and GCC_JIT_FUNCTION_ALWAYS_INLINE by + clearing DECL_EXTERNAL and TREE_PUBLIC. Doing so fixes the + "undefined symbol" bug seen with GCC_JIT_FUNCTION_INTERNAL. + * TODO.rst: Update. + +2014-03-07 David Malcolm + * libgccjit++.h (gccjit::context::new_global): New. 2014-03-07 David Malcolm diff --git a/gcc/jit/TODO.rst b/gcc/jit/TODO.rst index ea09e45..b2d8c04 100644 --- a/gcc/jit/TODO.rst +++ b/gcc/jit/TODO.rst @@ -114,11 +114,6 @@ Initial Release Bugs -* INTERNAL functions don't seem to work (see e.g. test-quadratic, on trying - to make calc_disc be internal leads to: -/tmp/libgccjit-4FZm6B/fake.so: undefined symbol: calc_discriminant - works at -O3 (because it inlines away the call); fails at -O0 - * fixing all the state issues: make it work repeatedly with optimization turned up to full. diff --git a/gcc/jit/internal-api.c b/gcc/jit/internal-api.c index 1cb15ce..17c8e9e 100644 --- a/gcc/jit/internal-api.c +++ b/gcc/jit/internal-api.c @@ -1317,6 +1317,9 @@ recording::function::write_to_dump (dump &d) case GCC_JIT_FUNCTION_INTERNAL: d.write ("static "); break; +case GCC_JIT_FUNCTION_ALWAYS_INLINE: + d.write ("static inline "); + break; } d.write ("%s\n", m_return_type->get_debug_string ()); @@ -2534,6 +2537,17 @@ new_function (location *loc, DECL_ARGUMENTS(fndecl) = param_decl_list; } + if (kind == GCC_JIT_FUNCTION_ALWAYS_INLINE) +{ + DECL_DECLARED_INLINE_P (fndecl) = 1; + + /* Add attribute "always_inline": */ + DECL_ATTRIBUTES (fndecl) = + tree_cons (get_identifier ("always_inline"), + NULL, + DECL_ATTRIBUTES (fndecl)); +} + function *func = new function (this, fndecl, kind); m_functions.safe_push (func); return func; @@ -3195,6 +3209,13 @@ postprocess () DECL_PRESERVE_P (m_inner_fndecl) = 1; } + if (m_kind == GCC_JIT_FUNCTION_INTERNAL + ||m_kind == GCC_JIT_FUNCTION_ALWAYS_INLINE) +{ + DECL_EXTERNAL (m_inner_fndecl) = 0; + TREE_PUBLIC (m_inner_fndecl) = 0; +} + if (m_kind != GCC_JIT_FUNCTION_IMPORTED) { /* Seem to need this in gimple-low.c: */ diff --git a/gcc/jit/libgccjit.h b/gcc/jit/libgccjit.h index e8f35b9..3019449 100644 --- a/gcc/jit/libgccjit.h +++ b/gcc/jit/libgccjit.h @@ -468,8 +468,18 @@ enum gcc_jit_function_kind /* Function is not defined by the client code; we're merely referring to it. Analogous to using an "extern" function from a header file. */ - GCC_JIT_FUNCTION_IMPORTED + GCC_JIT_FUNCTION_IMPORTED, + /* Function is only ever inlined into other functions, and is + invisible outside of the JIT. + + Analogous to prefixing with "inline" and adding + __attribute__((always_inline))
Re: [PATCH] Fix ARM TLS handling (PR target/58595)
Hi, It seems the new test fails at execution on aarch64-none-elf (and aarch64_be-none-elf) using the ARM Foundation Model as simulator. Sorry, I don't have access to more detail right now. Christophe. On 6 March 2014 06:44, Ramana Radhakrishnan wrote: > On Wed, Mar 5, 2014 at 9:12 AM, Jakub Jelinek wrote: >> Hi! >> >> arm_legitimize_address may be called with a TLS symbol referenced, even when >> x is not itself a SYMBOL_REF. Most often it is something like: >> (const:SI (plus:SI (symbol_ref:SI "tlsvar") (const_int NNN))) >> but generally it can be something else (e.g. from expansion of >> TARGET_MEM_REF). Unfortunately this function legitimizes only the >> SYMBOL_REF TLS case as TLS load, but the more complex forms with e.g. -fpic >> can e.g. fall thru into legitimize_pic_address -> gen_calculate_pic_address, >> which means either wrong-code or ICE later on. >> Fixed by legitimizing both the SYMBOL_REF and >> CONST+PLUS+SYMBOL_REF+CONST_INT case, and for more complex TLS containing >> expressions just returning x (in that case the caller will split the PLUS >> on its own). >> >> Kyrill has kindly bootstrapped/regtested this on Chromebook, ok for >> trunk/4.8? >> >> 2014-03-05 Jakub Jelinek >> Meador Inge >> >> PR target/58595 >> * config/arm/arm.c (arm_tls_symbol_p): Remove. >> (arm_legitimize_address): Call legitimize_tls_address for any >> arm_tls_referenced_p expression, handle constant addend. Call it >> before testing for !TARGET_ARM. >> (thumb_legitimize_address): Don't handle arm_tls_symbol_p here. >> >> * gcc.dg/tls/pr58595.c: New test. > > > OK if no regressions. Please let any auto testers catch any issues and > back port to 4.8 in about 48 hours. > > Regards, > Ramana >> >> --- gcc/config/arm/arm.c.jj 2014-03-04 08:51:39.620081210 +0100 >> +++ gcc/config/arm/arm.c2014-03-04 14:06:26.776277688 +0100 >> @@ -235,7 +235,6 @@ static tree arm_gimplify_va_arg_expr (tr >> static void arm_option_override (void); >> static unsigned HOST_WIDE_INT arm_shift_truncation_mask (enum machine_mode); >> static bool arm_cannot_copy_insn_p (rtx); >> -static bool arm_tls_symbol_p (rtx x); >> static int arm_issue_rate (void); >> static void arm_output_dwarf_dtprel (FILE *, int, rtx) ATTRIBUTE_UNUSED; >> static bool arm_output_addr_const_extra (FILE *, rtx); >> @@ -7336,6 +7335,32 @@ legitimize_tls_address (rtx x, rtx reg) >> rtx >> arm_legitimize_address (rtx x, rtx orig_x, enum machine_mode mode) >> { >> + if (arm_tls_referenced_p (x)) >> +{ >> + rtx addend = NULL; >> + >> + if (GET_CODE (x) == CONST && GET_CODE (XEXP (x, 0)) == PLUS) >> + { >> + addend = XEXP (XEXP (x, 0), 1); >> + x = XEXP (XEXP (x, 0), 0); >> + } >> + >> + if (GET_CODE (x) != SYMBOL_REF) >> + return x; >> + >> + gcc_assert (SYMBOL_REF_TLS_MODEL (x) != 0); >> + >> + x = legitimize_tls_address (x, NULL_RTX); >> + >> + if (addend) >> + { >> + x = gen_rtx_PLUS (SImode, x, addend); >> + orig_x = x; >> + } >> + else >> + return x; >> +} >> + >>if (!TARGET_ARM) >> { >>/* TODO: legitimize_address for Thumb2. */ >> @@ -7344,9 +7369,6 @@ arm_legitimize_address (rtx x, rtx orig_ >>return thumb_legitimize_address (x, orig_x, mode); >> } >> >> - if (arm_tls_symbol_p (x)) >> -return legitimize_tls_address (x, NULL_RTX); >> - >>if (GET_CODE (x) == PLUS) >> { >>rtx xop0 = XEXP (x, 0); >> @@ -7459,9 +7481,6 @@ arm_legitimize_address (rtx x, rtx orig_ >> rtx >> thumb_legitimize_address (rtx x, rtx orig_x, enum machine_mode mode) >> { >> - if (arm_tls_symbol_p (x)) >> -return legitimize_tls_address (x, NULL_RTX); >> - >>if (GET_CODE (x) == PLUS >>&& CONST_INT_P (XEXP (x, 1)) >>&& (INTVAL (XEXP (x, 1)) >= 32 * GET_MODE_SIZE (mode) >> @@ -7756,20 +7775,6 @@ thumb_legitimize_reload_address (rtx *x_ >> >> /* Test for various thread-local symbols. */ >> >> -/* Return TRUE if X is a thread-local symbol. */ >> - >> -static bool >> -arm_tls_symbol_p (rtx x) >> -{ >> - if (! TARGET_HAVE_TLS) >> -return false; >> - >> - if (GET_CODE (x) != SYMBOL_REF) >> -return false; >> - >> - return SYMBOL_REF_TLS_MODEL (x) != 0; >> -} >> - >> /* Helper for arm_tls_referenced_p. */ >> >> static int >> --- gcc/testsuite/gcc.dg/tls/pr58595.c.jj 2014-03-04 >> 12:56:48.337915114 +0100 >> +++ gcc/testsuite/gcc.dg/tls/pr58595.c 2014-03-04 12:56:48.337915114 +0100 >> @@ -0,0 +1,28 @@ >> +/* PR target/58595 */ >> +/* { dg-do run } */ >> +/* { dg-options "-O2" } */ >> +/* { dg-additional-options "-fpic" { target fpic } } */ >> +/* { dg-require-effective-target tls } */ >> +/* { dg-require-effective-target sync_int_long } */ >> + >> +struct S { unsigned long a, b; }; >> +__thread struct S s; >> +void bar (unsigned long *); >> + >> +__attribute__((noinline)) void >> +foo (void) >> +{
C++ PATCHes for C++14 testsuite regressions
These patches address regressions revealed by my work to run the testsuite in C++14 mode. The first patch addresses multiple failures caused by force_paren_expr wrapping simple expressions so that decltype(auto) will treat them differently. The static_cast to reference trick was breaking bitfields, so I've switched to setting a flag on the COMPONENT_REF instead. And then I stopped doing the wrapping in unevaluated context to address problems with addressof. The second patch fixes an ICE on auto11.C due to confusion between 'auto' and 'T'. The third patch fixes many missed errors in auto9.C. The fourth patch harmonizes the default VLA warning level in C++14 mode with C++98/11: now we mostly won't get warnings about VLAs with -std=gnu++1y, but we will with -std=c++1y or with -Wvla. It also fixes the text of a pedwarn in build_new to be more helpful. The last patch applies to C++11 mode as well; running vt-34051 with -pedantic-errors was producing a spurious extra semicolon pedwarn. Tested x86_64-pc-linux-gnu, applying to trunk. commit 478642f744b15bfc6e9170e760a94a3ff073df42 Author: Jason Merrill Date: Thu Mar 6 11:36:49 2014 -0500 * cp-tree.h (REF_PARENTHESIZED_P): New. * semantics.c (force_paren_expr): Set it. * pt.c (do_auto_deduction): Check it. (tsubst) [COMPONENT_REF]: Copy it. * typeck.c (maybe_warn_about_useless_cast): Don't strip dereference. diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 8ec7d6a..45e4d82 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -100,6 +100,7 @@ c-common.h, not after. TARGET_EXPR_DIRECT_INIT_P (in TARGET_EXPR) FNDECL_USED_AUTO (in FUNCTION_DECL) DECLTYPE_FOR_LAMBDA_PROXY (in DECLTYPE_TYPE) + REF_PARENTHESIZED_P (in COMPONENT_REF, SCOPE_REF) 3: (TREE_REFERENCE_EXPR) (in NON_LVALUE_EXPR) (commented-out). ICS_BAD_FLAG (in _CONV) FN_TRY_BLOCK_P (in TRY_BLOCK) @@ -3031,6 +3032,12 @@ extern void decl_shadowed_for_var_insert (tree, tree); #define PAREN_STRING_LITERAL_P(NODE) \ TREE_LANG_FLAG_0 (STRING_CST_CHECK (NODE)) +/* Indicates whether a COMPONENT_REF has been parenthesized. Currently + only set some of the time in C++14 mode. */ + +#define REF_PARENTHESIZED_P(NODE) \ + TREE_LANG_FLAG_2 (COMPONENT_REF_CHECK (NODE)) + /* Nonzero if this AGGR_INIT_EXPR provides for initialization via a constructor call, rather than an ordinary function call. */ #define AGGR_INIT_VIA_CTOR_P(NODE) \ diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 6476d8a..d4d54b8 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -14915,6 +14915,7 @@ tsubst_copy_and_build (tree t, tree object; tree object_type; tree member; + tree r; object = tsubst_non_call_postfix_expression (TREE_OPERAND (t, 0), args, complain, in_decl); @@ -14999,11 +15000,19 @@ tsubst_copy_and_build (tree t, RETURN (error_mark_node); } else if (TREE_CODE (member) == FIELD_DECL) - RETURN (finish_non_static_data_member (member, object, NULL_TREE)); + { + r = finish_non_static_data_member (member, object, NULL_TREE); + if (TREE_CODE (r) == COMPONENT_REF) + REF_PARENTHESIZED_P (r) = REF_PARENTHESIZED_P (t); + RETURN (r); + } - RETURN (finish_class_member_access_expr (object, member, - /*template_p=*/false, - complain)); + r = finish_class_member_access_expr (object, member, + /*template_p=*/false, + complain); + if (TREE_CODE (r) == COMPONENT_REF) + REF_PARENTHESIZED_P (r) = REF_PARENTHESIZED_P (t); + RETURN (r); } case THROW_EXPR: @@ -21619,7 +21628,8 @@ do_auto_deduction (tree type, tree init, tree auto_node) targs = make_tree_vec (1); if (AUTO_IS_DECLTYPE (auto_node)) { - bool id = (DECL_P (init) || TREE_CODE (init) == COMPONENT_REF); + bool id = (DECL_P (init) || (TREE_CODE (init) == COMPONENT_REF + && !REF_PARENTHESIZED_P (init))); TREE_VEC_ELT (targs, 0) = finish_decltype_type (init, id, tf_warning_or_error); if (type != auto_node) diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index b9c1271..fcd8409 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -1605,11 +1605,18 @@ force_paren_expr (tree expr) if (cxx_dialect < cxx1y) return expr; + /* If we're in unevaluated context, we can't be deducing a + return/initializer type, so we don't need to mess with this. */ + if (cp_unevaluated_operand) +return expr; + if (!DECL_P (expr) && TREE_CODE (expr) != COMPONENT_REF && TREE_CODE (expr) != SCOPE_REF) return expr; - if (type_dependent_expression_p (expr)) + if (TREE_CODE (expr) == COMPONENT_REF) +REF_PARENTHESIZED_P (expr) = true; + else if (type_dependent_expression_p (expr)) expr = build1 (PAREN_EXPR, TREE_TYPE (expr), expr); else { @@ -1619,7 +1626,7 @@ force_paren_expr (tree expr) tree type = unlowered_expr_type (expr); bool rval = !!(kind & clk_rvalueref); type = cp_build_reference_type (type,
Re: [PATCH] Fix PR c++/60393
On 03/07/2014 02:10 PM, Adam Butcher wrote: Ah right. I did wonder about tentative parsing. What about in cp_parser_skip_to_end_of_statement? That sounds OK. Jason
Re: [PATCH] Fix ARM TLS handling (PR target/58595)
On Fri, Mar 7, 2014 at 11:56 AM, Christophe Lyon wrote: > Hi, > > It seems the new test fails at execution on aarch64-none-elf (and > aarch64_be-none-elf) using the ARM Foundation Model as simulator. The new testcase should have been disabled for the aarch64-elf target as it does not have TLS support. Thanks, Andrew Pinski > > Sorry, I don't have access to more detail right now. > > Christophe. > > > On 6 March 2014 06:44, Ramana Radhakrishnan wrote: >> On Wed, Mar 5, 2014 at 9:12 AM, Jakub Jelinek wrote: >>> Hi! >>> >>> arm_legitimize_address may be called with a TLS symbol referenced, even when >>> x is not itself a SYMBOL_REF. Most often it is something like: >>> (const:SI (plus:SI (symbol_ref:SI "tlsvar") (const_int NNN))) >>> but generally it can be something else (e.g. from expansion of >>> TARGET_MEM_REF). Unfortunately this function legitimizes only the >>> SYMBOL_REF TLS case as TLS load, but the more complex forms with e.g. -fpic >>> can e.g. fall thru into legitimize_pic_address -> gen_calculate_pic_address, >>> which means either wrong-code or ICE later on. >>> Fixed by legitimizing both the SYMBOL_REF and >>> CONST+PLUS+SYMBOL_REF+CONST_INT case, and for more complex TLS containing >>> expressions just returning x (in that case the caller will split the PLUS >>> on its own). >>> >>> Kyrill has kindly bootstrapped/regtested this on Chromebook, ok for >>> trunk/4.8? >>> >>> 2014-03-05 Jakub Jelinek >>> Meador Inge >>> >>> PR target/58595 >>> * config/arm/arm.c (arm_tls_symbol_p): Remove. >>> (arm_legitimize_address): Call legitimize_tls_address for any >>> arm_tls_referenced_p expression, handle constant addend. Call it >>> before testing for !TARGET_ARM. >>> (thumb_legitimize_address): Don't handle arm_tls_symbol_p here. >>> >>> * gcc.dg/tls/pr58595.c: New test. >> >> >> OK if no regressions. Please let any auto testers catch any issues and >> back port to 4.8 in about 48 hours. >> >> Regards, >> Ramana >>> >>> --- gcc/config/arm/arm.c.jj 2014-03-04 08:51:39.620081210 +0100 >>> +++ gcc/config/arm/arm.c2014-03-04 14:06:26.776277688 +0100 >>> @@ -235,7 +235,6 @@ static tree arm_gimplify_va_arg_expr (tr >>> static void arm_option_override (void); >>> static unsigned HOST_WIDE_INT arm_shift_truncation_mask (enum >>> machine_mode); >>> static bool arm_cannot_copy_insn_p (rtx); >>> -static bool arm_tls_symbol_p (rtx x); >>> static int arm_issue_rate (void); >>> static void arm_output_dwarf_dtprel (FILE *, int, rtx) ATTRIBUTE_UNUSED; >>> static bool arm_output_addr_const_extra (FILE *, rtx); >>> @@ -7336,6 +7335,32 @@ legitimize_tls_address (rtx x, rtx reg) >>> rtx >>> arm_legitimize_address (rtx x, rtx orig_x, enum machine_mode mode) >>> { >>> + if (arm_tls_referenced_p (x)) >>> +{ >>> + rtx addend = NULL; >>> + >>> + if (GET_CODE (x) == CONST && GET_CODE (XEXP (x, 0)) == PLUS) >>> + { >>> + addend = XEXP (XEXP (x, 0), 1); >>> + x = XEXP (XEXP (x, 0), 0); >>> + } >>> + >>> + if (GET_CODE (x) != SYMBOL_REF) >>> + return x; >>> + >>> + gcc_assert (SYMBOL_REF_TLS_MODEL (x) != 0); >>> + >>> + x = legitimize_tls_address (x, NULL_RTX); >>> + >>> + if (addend) >>> + { >>> + x = gen_rtx_PLUS (SImode, x, addend); >>> + orig_x = x; >>> + } >>> + else >>> + return x; >>> +} >>> + >>>if (!TARGET_ARM) >>> { >>>/* TODO: legitimize_address for Thumb2. */ >>> @@ -7344,9 +7369,6 @@ arm_legitimize_address (rtx x, rtx orig_ >>>return thumb_legitimize_address (x, orig_x, mode); >>> } >>> >>> - if (arm_tls_symbol_p (x)) >>> -return legitimize_tls_address (x, NULL_RTX); >>> - >>>if (GET_CODE (x) == PLUS) >>> { >>>rtx xop0 = XEXP (x, 0); >>> @@ -7459,9 +7481,6 @@ arm_legitimize_address (rtx x, rtx orig_ >>> rtx >>> thumb_legitimize_address (rtx x, rtx orig_x, enum machine_mode mode) >>> { >>> - if (arm_tls_symbol_p (x)) >>> -return legitimize_tls_address (x, NULL_RTX); >>> - >>>if (GET_CODE (x) == PLUS >>>&& CONST_INT_P (XEXP (x, 1)) >>>&& (INTVAL (XEXP (x, 1)) >= 32 * GET_MODE_SIZE (mode) >>> @@ -7756,20 +7775,6 @@ thumb_legitimize_reload_address (rtx *x_ >>> >>> /* Test for various thread-local symbols. */ >>> >>> -/* Return TRUE if X is a thread-local symbol. */ >>> - >>> -static bool >>> -arm_tls_symbol_p (rtx x) >>> -{ >>> - if (! TARGET_HAVE_TLS) >>> -return false; >>> - >>> - if (GET_CODE (x) != SYMBOL_REF) >>> -return false; >>> - >>> - return SYMBOL_REF_TLS_MODEL (x) != 0; >>> -} >>> - >>> /* Helper for arm_tls_referenced_p. */ >>> >>> static int >>> --- gcc/testsuite/gcc.dg/tls/pr58595.c.jj 2014-03-04 >>> 12:56:48.337915114 +0100 >>> +++ gcc/testsuite/gcc.dg/tls/pr58595.c 2014-03-04 12:56:48.337915114 +0100 >>> @@ -0,0 +1,28 @@ >>> +/* PR target/58595 */ >>> +/* { dg-do run } */ >>> +/* { dg-opti
Re: [PATCH] Fix ARM TLS handling (PR target/58595)
On Fri, Mar 07, 2014 at 12:10:05PM -0800, Andrew Pinski wrote: > On Fri, Mar 7, 2014 at 11:56 AM, Christophe Lyon > wrote: > > It seems the new test fails at execution on aarch64-none-elf (and > > aarch64_be-none-elf) using the ARM Foundation Model as simulator. > > > The new testcase should have been disabled for the aarch64-elf target > as it does not have TLS support. The testcase is: /* { dg-require-effective-target tls } */ so if some target doesn't have TLS support (not even emulated? There should be none, there is no reason why some target wouldn't support even emutls), then it shouldn't be true for that target. Jakub
Re: [PATCH] Fix ARM TLS handling (PR target/58595)
On Fri, Mar 07, 2014 at 09:14:04PM +0100, Jakub Jelinek wrote: > On Fri, Mar 07, 2014 at 12:10:05PM -0800, Andrew Pinski wrote: > > On Fri, Mar 7, 2014 at 11:56 AM, Christophe Lyon > > wrote: > > > It seems the new test fails at execution on aarch64-none-elf (and > > > aarch64_be-none-elf) using the ARM Foundation Model as simulator. > > > > > > The new testcase should have been disabled for the aarch64-elf target > > as it does not have TLS support. > > The testcase is: > /* { dg-require-effective-target tls } */ > so if some target doesn't have TLS support (not even emulated? There should > be none, there is no reason why some target wouldn't support even emutls), > then it shouldn't be true for that target. Ah, looking at other tests, perhaps it should use: /* { dg-require-effective-target tls_runtime } */ /* { dg-add-options tls } */ instead of that line. Jakub
Re: PING: Fwd: Re: [patch] implement Cilk Plus simd loops on trunk
Hi! On Fri, 15 Nov 2013 14:44:45 -0700, Aldy Hernandez wrote: > I fixed a few nits Jason pointed out off-line, and both him and Jakub > have approved the patch for trunk. > > In running the final round of tests I noticed a few problems with my > choice of bit numbers for the GF_OMP_* masks. I fixed them, and re-ran > tests on x86-64 Linux. > > Attached is the final version of the patch I have committed to trunk. > Date: Mon Oct 14 18:32:13 2013 -0500 > --- a/gcc/omp-low.c > +++ b/gcc/omp-low.c > @@ -3587,7 +3619,7 @@ lower_rec_input_clauses (tree clauses, gimple_seq > *ilist, gimple_seq *dlist, >/* Don't add any barrier for #pragma omp simd or >#pragma omp distribute. */ >if (gimple_code (ctx->stmt) != GIMPLE_OMP_FOR > - || gimple_omp_for_kind (ctx->stmt) == GF_OMP_FOR_KIND_FOR) > + || gimple_omp_for_kind (ctx->stmt) & GF_OMP_FOR_KIND_FOR) > gimple_seq_add_stmt (ilist, build_omp_barrier (NULL_TREE)); > } Maybe it's just too late on a Friday evening, but I don't understand this change, part of r204863. GF_OMP_FOR_KIND_FOR has the value zero; shouldn't this comparison have remained unchanged? Is the following (untested) patch OK for trunk? Does this need a test case? commit f3c7834ecbedc50e04223d24b1b671fc8a62c169 Author: Thomas Schwinge Date: Fri Mar 7 21:11:43 2014 +0100 Restore check for OpenMP for construct. gcc/ * omp-low.c (lower_rec_input_clauses) : Restore check for GF_OMP_FOR_KIND_FOR. diff --git gcc/omp-low.c gcc/omp-low.c index 4dc3956..713a4ae 100644 --- gcc/omp-low.c +++ gcc/omp-low.c @@ -3915,7 +3915,7 @@ lower_rec_input_clauses (tree clauses, gimple_seq *ilist, gimple_seq *dlist, /* Don't add any barrier for #pragma omp simd or #pragma omp distribute. */ if (gimple_code (ctx->stmt) != GIMPLE_OMP_FOR - || gimple_omp_for_kind (ctx->stmt) & GF_OMP_FOR_KIND_FOR) + || gimple_omp_for_kind (ctx->stmt) == GF_OMP_FOR_KIND_FOR) gimple_seq_add_stmt (ilist, build_omp_barrier (NULL_TREE)); } Grüße, Thomas pgpzfHzTcaz7D.pgp Description: PGP signature
Re: [PATCH] Fix PR c++/60033
On 03/04/2014 02:58 PM, Adam Butcher wrote: PR c++/60033 * pt.c (retrieve_specialization): When retrieving a capture pack from a generic lambda, remove the lambda's own template argument list prior to fetching the specialization. I think I'd prefer to handle this at the call site in tsubst_copy. Jason
[wwwdocs, committed] svn.html->branches - Add NEW fortran-caf branch, retire fortran-exp
Hi all, I have retired the old fortran-exp branch in svn.html. In addition, I have started a new branch "fortran-caf", which I will use for coarray changes. Besides the new fortran-caf branch, there is still the somewhat active fortran-dev branch, used for the new array descriptor. Tobias Index: svn.html === RCS file: /cvs/gcc/wwwdocs/htdocs/svn.html,v retrieving revision 1.191 diff -p -u -r1.191 svn.html --- svn.html 3 Dec 2013 01:11:52 - 1.191 +++ svn.html 7 Mar 2014 20:28:09 - @@ -485,6 +485,11 @@ the command svn log --stop-on-copy Language-specific + fortran-caf + This branch is for coarray changes to the Fortran front end. It is +maintained by Tobias Burnus +. + fortran-dev This branch is for disruptive changes to the Fortran front end, especially for OOP development and @@ -492,12 +497,6 @@ the command svn log --stop-on-copy array descriptor update. It is maintained by Jerry DeLisle . - fortran-exp - This branch is for experimental changes to the Fortran front end, initially -for array constructor refactoring using splay-tree and other areas of -optimization. It is maintained by Jerry DeLisle - . - gccgo This branch is for the Go frontend to gcc. For more information about the Go programming language, @@ -1169,6 +1168,12 @@ be prefixed with the initials of the dis and analysis (http://gcc.gnu.org/wiki/ThreadSafetyAnnotation";>http://gcc.gnu.org/wiki/ThreadSafetyAnnotation). The branch was maintained by Delesley Hutchins. + + fortran-exp + This branch contained experimental changes to the Fortran front end, initially +for array constructor refactoring using splay-tree and other areas of +optimization. It was maintained by Jerry DeLisle + .
[Ada] PR ada/60411
This change enables ZCX on armel linux, and should fix PR ada/60411, at least for the native part reported in comment #1 PR ada/60411 * system-linux-armel.ads (Backend_Overflow_Checks): Set to True. (Support_64_Bit_Divides): Removed, no longer used. (ZCX_By_Default): Enabled. Index: system-linux-armel.ads === --- system-linux-armel.ads (revision 208067) +++ system-linux-armel.ads (working copy) @@ -7,7 +7,7 @@ -- S p e c -- --(GNU-Linux/ARMEL Version) -- -- -- --- Copyright (C) 1992-2011, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2014, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- @@ -124,7 +124,7 @@ -- of the individual switch values. Backend_Divide_Checks : constant Boolean := False; - Backend_Overflow_Checks : constant Boolean := False; + Backend_Overflow_Checks : constant Boolean := True; Command_Line_Args : constant Boolean := True; Configurable_Run_Time : constant Boolean := False; Denorm: constant Boolean := True; @@ -139,7 +139,6 @@ Stack_Check_Default : constant Boolean := False; Stack_Check_Probes: constant Boolean := True; Stack_Check_Limits: constant Boolean := False; - Support_64_Bit_Divides: constant Boolean := True; Support_Aggregates: constant Boolean := True; Support_Composite_Assign : constant Boolean := True; Support_Composite_Compare : constant Boolean := True; @@ -147,6 +146,6 @@ Always_Compatible_Rep : constant Boolean := False; Suppress_Standard_Library : constant Boolean := False; Use_Ada_Main_Program_Name : constant Boolean := False; - ZCX_By_Default: constant Boolean := False; + ZCX_By_Default: constant Boolean := True; end System;
Re: [patch] Remove two maintainers of avr port
Hello. Please retain me write-after-approval status. I must return to active work on the GCC in the near future. Anatoly. - Original Message - From: "Denis Chertykov" To: "gcc-patches" ; "Анатолий Соколов" ; "Eric Weddington" Sent: Friday, March 07, 2014 8:56 PM Subject: [patch] Remove two maintainers of avr port Committed. 2014-03-07 Denis Chertykov * MAINTAINERS: Remove avr maintainers: Anatoly Sokolov and Eric Weddington Index: MAINTAINERS === --- MAINTAINERS (revision 208404) +++ MAINTAINERS (working copy) @@ -51,8 +51,6 @@ arm port Paul Brook p...@codesourcery.com arm port Ramana Radhakrishnan ramana.radhakrish...@arm.com avr port Denis Chertykov cherty...@gmail.com -avr port Anatoly Sokolov ae...@post.ru -avr port Eric Weddington eric.wedding...@atmel.com bfin port Bernd Schmidt ber...@codesourcery.com bfin port Jie Zhang jzhang...@gmail.com c6x port Bernd Schmidt ber...@codesourcery.com Denis.
[PATCH, PR58066] preferred_stack_boundary update for tls expanded call
Hi, This patch is to fix the problem described here: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58066 I follow Ian's suggestion and set ix86_tls_descriptor_calls_expanded_in_cfun in tls_global_dynamic_64_ and tls_local_dynamic_base_64_. Although 32bit doesn't have the problem, ix86_tls_descriptor_calls_expanded_in_cfun is also set for tls_global_dynamic_32 and tls_local_dynamic_base_32 to make ix86_tls_descriptor_calls_expanded_in_cfun setting consistent across 32bits and 64bits. If ix86_current_function_calls_tls_descriptor is set, we know that there is tls expanded call in current function. Update crtl->preferred_stack_boundary and crtl->stack_alignment_needed to be no less than PREFERED_STACK_ALIGNMENT at the start of ix86_compute_frame_layout. We don't do the update in legitimize_tls_address in cfgexpand stage, which is too early because according to the comments before ix86_current_function_calls_tls_descriptor, tls call may be optimized away. ix86_compute_frame_layout is the latest place to do the update. bootstrap on x86_64-linux-gnu is ok. regression test is going on. Ok for trunk if tests pass? Thanks, Wei. gcc/ChangeLog: 2014-03-07 Wei Mi * config/i386/i386.c (ix86_compute_frame_layout): Update preferred_stack_boundary when there is tls expanded call. * config/i386/i386.md: Set ix86_tls_descriptor_calls_expanded_in_cfun. gcc/testsuite/ChangeLog: 2014-03-07 Wei Mi * g++.dg/pr58066.C: New test. Index: gcc/config/i386/i386.c === --- gcc/config/i386/i386.c (revision 208410) +++ gcc/config/i386/i386.c (working copy) @@ -9504,6 +9504,19 @@ ix86_compute_frame_layout (struct ix86_f crtl->preferred_stack_boundary = 128; crtl->stack_alignment_needed = 128; } + /* For 64-bit target, preferred_stack_boundary is never updated for call + expanded from tls descriptor. Update it here. We don't update it in + expand stage because according to the comments before + ix86_current_function_calls_tls_descriptor, tls calls may be optimized + away. */ + else if (TARGET_64BIT + && ix86_current_function_calls_tls_descriptor + && crtl->preferred_stack_boundary < PREFERRED_STACK_BOUNDARY) +{ + crtl->preferred_stack_boundary = PREFERRED_STACK_BOUNDARY; + if (crtl->stack_alignment_needed < PREFERRED_STACK_BOUNDARY) + crtl->stack_alignment_needed = PREFERRED_STACK_BOUNDARY; +} gcc_assert (!size || stack_alignment_needed); gcc_assert (preferred_alignment >= STACK_BOUNDARY / BITS_PER_UNIT); Index: gcc/config/i386/i386.md === --- gcc/config/i386/i386.md (revision 208410) +++ gcc/config/i386/i386.md (working copy) @@ -12891,7 +12891,11 @@ UNSPEC_TLS_GD)) (clobber (match_scratch:SI 4)) (clobber (match_scratch:SI 5)) - (clobber (reg:CC FLAGS_REG))])]) + (clobber (reg:CC FLAGS_REG))])] + "" +{ + ix86_tls_descriptor_calls_expanded_in_cfun = true; +}) (define_insn "*tls_global_dynamic_64_" [(set (match_operand:P 0 "register_operand" "=a") @@ -12946,7 +12950,10 @@ (const_int 0))) (unspec:P [(match_operand 1 "tls_symbolic_operand")] UNSPEC_TLS_GD)])] - "TARGET_64BIT") + "TARGET_64BIT" +{ + ix86_tls_descriptor_calls_expanded_in_cfun = true; +}) (define_insn "*tls_local_dynamic_base_32_gnu" [(set (match_operand:SI 0 "register_operand" "=a") @@ -12982,7 +12989,11 @@ UNSPEC_TLS_LD_BASE)) (clobber (match_scratch:SI 3)) (clobber (match_scratch:SI 4)) - (clobber (reg:CC FLAGS_REG))])]) + (clobber (reg:CC FLAGS_REG))])] + "" +{ + ix86_tls_descriptor_calls_expanded_in_cfun = true; +}) (define_insn "*tls_local_dynamic_base_64_" [(set (match_operand:P 0 "register_operand" "=a") @@ -13029,7 +13040,10 @@ (mem:QI (match_operand 1)) (const_int 0))) (unspec:P [(const_int 0)] UNSPEC_TLS_LD_BASE)])] - "TARGET_64BIT") + "TARGET_64BIT" +{ + ix86_tls_descriptor_calls_expanded_in_cfun = true; +}) ;; Local dynamic of a single variable is a lose. Show combine how ;; to convert that back to global dynamic. Index: gcc/testsuite/g++.dg/pr58066.C === --- gcc/testsuite/g++.dg/pr58066.C (revision 0) +++ gcc/testsuite/g++.dg/pr58066.C (revision 0) @@ -0,0 +1,12 @@ +/* { dg-do compile { target {{ i?86-*-* x86_64-*-* } && lp64 } } } */ +/* { dg-options "-fPIC -O2 -m64" } */ + +/* Check whether the stack frame starting address of tls expanded call + in __cxa_get_globals() is 16bytes aligned. */ +static __thread char ccc; +extern "C" void* __cxa_get_globals() throw() +{ + return &ccc; +} + +/* { dg-final { scan-assembler ".cfi_def_cfa_offset 16" } } */
Re: [PATCH, PR58066] preferred_stack_boundary update for tls expanded call
Regression test is ok. Thanks, Wei. On Fri, Mar 7, 2014 at 1:26 PM, Wei Mi wrote: > Hi, > > This patch is to fix the problem described here: > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58066 > > I follow Ian's suggestion and set > ix86_tls_descriptor_calls_expanded_in_cfun in > tls_global_dynamic_64_ and tls_local_dynamic_base_64_. > Although 32bit doesn't have the problem, > ix86_tls_descriptor_calls_expanded_in_cfun is also set for > tls_global_dynamic_32 and tls_local_dynamic_base_32 to make > ix86_tls_descriptor_calls_expanded_in_cfun setting consistent across > 32bits and 64bits. > > If ix86_current_function_calls_tls_descriptor is set, we know that > there is tls expanded call in current function. Update > crtl->preferred_stack_boundary and crtl->stack_alignment_needed to be > no less than PREFERED_STACK_ALIGNMENT at the start of > ix86_compute_frame_layout. We don't do the update in > legitimize_tls_address in cfgexpand stage, which is too early because > according to the comments before > ix86_current_function_calls_tls_descriptor, tls call may be optimized > away. ix86_compute_frame_layout is the latest place to do the update. > > bootstrap on x86_64-linux-gnu is ok. regression test is going on. Ok > for trunk if tests pass? > > Thanks, > Wei. > > gcc/ChangeLog: > > 2014-03-07 Wei Mi > > * config/i386/i386.c (ix86_compute_frame_layout): Update > preferred_stack_boundary when there is tls expanded call. > * config/i386/i386.md: Set > ix86_tls_descriptor_calls_expanded_in_cfun. > > gcc/testsuite/ChangeLog: > > 2014-03-07 Wei Mi > > * g++.dg/pr58066.C: New test. > > > Index: gcc/config/i386/i386.c > === > --- gcc/config/i386/i386.c (revision 208410) > +++ gcc/config/i386/i386.c (working copy) > @@ -9504,6 +9504,19 @@ ix86_compute_frame_layout (struct ix86_f >crtl->preferred_stack_boundary = 128; >crtl->stack_alignment_needed = 128; > } > + /* For 64-bit target, preferred_stack_boundary is never updated for call > + expanded from tls descriptor. Update it here. We don't update it in > + expand stage because according to the comments before > + ix86_current_function_calls_tls_descriptor, tls calls may be optimized > + away. */ > + else if (TARGET_64BIT > + && ix86_current_function_calls_tls_descriptor > + && crtl->preferred_stack_boundary < PREFERRED_STACK_BOUNDARY) > +{ > + crtl->preferred_stack_boundary = PREFERRED_STACK_BOUNDARY; > + if (crtl->stack_alignment_needed < PREFERRED_STACK_BOUNDARY) > + crtl->stack_alignment_needed = PREFERRED_STACK_BOUNDARY; > +} > >gcc_assert (!size || stack_alignment_needed); >gcc_assert (preferred_alignment >= STACK_BOUNDARY / BITS_PER_UNIT); > Index: gcc/config/i386/i386.md > === > --- gcc/config/i386/i386.md (revision 208410) > +++ gcc/config/i386/i386.md (working copy) > @@ -12891,7 +12891,11 @@ > UNSPEC_TLS_GD)) > (clobber (match_scratch:SI 4)) > (clobber (match_scratch:SI 5)) > - (clobber (reg:CC FLAGS_REG))])]) > + (clobber (reg:CC FLAGS_REG))])] > + "" > +{ > + ix86_tls_descriptor_calls_expanded_in_cfun = true; > +}) > > (define_insn "*tls_global_dynamic_64_" >[(set (match_operand:P 0 "register_operand" "=a") > @@ -12946,7 +12950,10 @@ >(const_int 0))) > (unspec:P [(match_operand 1 "tls_symbolic_operand")] >UNSPEC_TLS_GD)])] > - "TARGET_64BIT") > + "TARGET_64BIT" > +{ > + ix86_tls_descriptor_calls_expanded_in_cfun = true; > +}) > > (define_insn "*tls_local_dynamic_base_32_gnu" >[(set (match_operand:SI 0 "register_operand" "=a") > @@ -12982,7 +12989,11 @@ > UNSPEC_TLS_LD_BASE)) >(clobber (match_scratch:SI 3)) >(clobber (match_scratch:SI 4)) > - (clobber (reg:CC FLAGS_REG))])]) > + (clobber (reg:CC FLAGS_REG))])] > + "" > +{ > + ix86_tls_descriptor_calls_expanded_in_cfun = true; > +}) > > (define_insn "*tls_local_dynamic_base_64_" >[(set (match_operand:P 0 "register_operand" "=a") > @@ -13029,7 +13040,10 @@ > (mem:QI (match_operand 1)) > (const_int 0))) >(unspec:P [(const_int 0)] UNSPEC_TLS_LD_BASE)])] > - "TARGET_64BIT") > + "TARGET_64BIT" > +{ > + ix86_tls_descriptor_calls_expanded_in_cfun = true; > +}) > > ;; Local dynamic of a single variable is a lose. Show combine how > ;; to convert that back to global dynamic. > Index: gcc/testsuite/g++.dg/pr58066.C > === > --- gcc/testsuite/g++.dg/pr58066.C (revision 0) > +++ gcc/testsuite/g++.dg/pr58066.C (revision 0) > @@ -0,0 +1,12 @@ > +/* { dg-do compile { target {{ i?86-*-* x86_64-*-* } && lp64 } } } */ > +/* { dg-options "-fPIC -O2 -m64" } */ > + > +/* Check whether the stack frame startin
Re: [PATCH, PR58066] preferred_stack_boundary update for tls expanded call
On Fri, Mar 7, 2014 at 1:26 PM, Wei Mi wrote: > Hi, > > This patch is to fix the problem described here: > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58066 > > I follow Ian's suggestion and set > ix86_tls_descriptor_calls_expanded_in_cfun in > tls_global_dynamic_64_ and tls_local_dynamic_base_64_. > Although 32bit doesn't have the problem, > ix86_tls_descriptor_calls_expanded_in_cfun is also set for > tls_global_dynamic_32 and tls_local_dynamic_base_32 to make > ix86_tls_descriptor_calls_expanded_in_cfun setting consistent across > 32bits and 64bits. > > If ix86_current_function_calls_tls_descriptor is set, we know that > there is tls expanded call in current function. Update > crtl->preferred_stack_boundary and crtl->stack_alignment_needed to be > no less than PREFERED_STACK_ALIGNMENT at the start of > ix86_compute_frame_layout. We don't do the update in > legitimize_tls_address in cfgexpand stage, which is too early because > according to the comments before > ix86_current_function_calls_tls_descriptor, tls call may be optimized > away. ix86_compute_frame_layout is the latest place to do the update. > > bootstrap on x86_64-linux-gnu is ok. regression test is going on. Ok > for trunk if tests pass? > > Thanks, > Wei. > > gcc/ChangeLog: > > 2014-03-07 Wei Mi > > * config/i386/i386.c (ix86_compute_frame_layout): Update > preferred_stack_boundary when there is tls expanded call. > * config/i386/i386.md: Set > ix86_tls_descriptor_calls_expanded_in_cfun. > > gcc/testsuite/ChangeLog: > > 2014-03-07 Wei Mi > > * g++.dg/pr58066.C: New test. > > > Index: gcc/config/i386/i386.c > === > --- gcc/config/i386/i386.c (revision 208410) > +++ gcc/config/i386/i386.c (working copy) > @@ -9504,6 +9504,19 @@ ix86_compute_frame_layout (struct ix86_f >crtl->preferred_stack_boundary = 128; >crtl->stack_alignment_needed = 128; > } > + /* For 64-bit target, preferred_stack_boundary is never updated for call > + expanded from tls descriptor. Update it here. We don't update it in > + expand stage because according to the comments before > + ix86_current_function_calls_tls_descriptor, tls calls may be optimized > + away. */ > + else if (TARGET_64BIT > + && ix86_current_function_calls_tls_descriptor > + && crtl->preferred_stack_boundary < PREFERRED_STACK_BOUNDARY) > +{ > + crtl->preferred_stack_boundary = PREFERRED_STACK_BOUNDARY; > + if (crtl->stack_alignment_needed < PREFERRED_STACK_BOUNDARY) > + crtl->stack_alignment_needed = PREFERRED_STACK_BOUNDARY; > +} > >gcc_assert (!size || stack_alignment_needed); >gcc_assert (preferred_alignment >= STACK_BOUNDARY / BITS_PER_UNIT); > Index: gcc/config/i386/i386.md > === > --- gcc/config/i386/i386.md (revision 208410) > +++ gcc/config/i386/i386.md (working copy) > @@ -12891,7 +12891,11 @@ > UNSPEC_TLS_GD)) > (clobber (match_scratch:SI 4)) > (clobber (match_scratch:SI 5)) > - (clobber (reg:CC FLAGS_REG))])]) > + (clobber (reg:CC FLAGS_REG))])] > + "" > +{ > + ix86_tls_descriptor_calls_expanded_in_cfun = true; > +}) > > (define_insn "*tls_global_dynamic_64_" >[(set (match_operand:P 0 "register_operand" "=a") > @@ -12946,7 +12950,10 @@ >(const_int 0))) > (unspec:P [(match_operand 1 "tls_symbolic_operand")] >UNSPEC_TLS_GD)])] > - "TARGET_64BIT") > + "TARGET_64BIT" > +{ > + ix86_tls_descriptor_calls_expanded_in_cfun = true; > +}) > > (define_insn "*tls_local_dynamic_base_32_gnu" >[(set (match_operand:SI 0 "register_operand" "=a") > @@ -12982,7 +12989,11 @@ > UNSPEC_TLS_LD_BASE)) >(clobber (match_scratch:SI 3)) >(clobber (match_scratch:SI 4)) > - (clobber (reg:CC FLAGS_REG))])]) > + (clobber (reg:CC FLAGS_REG))])] > + "" > +{ > + ix86_tls_descriptor_calls_expanded_in_cfun = true; > +}) > > (define_insn "*tls_local_dynamic_base_64_" >[(set (match_operand:P 0 "register_operand" "=a") > @@ -13029,7 +13040,10 @@ > (mem:QI (match_operand 1)) > (const_int 0))) >(unspec:P [(const_int 0)] UNSPEC_TLS_LD_BASE)])] > - "TARGET_64BIT") > + "TARGET_64BIT" > +{ > + ix86_tls_descriptor_calls_expanded_in_cfun = true; > +}) > > ;; Local dynamic of a single variable is a lose. Show combine how > ;; to convert that back to global dynamic. > Index: gcc/testsuite/g++.dg/pr58066.C > === > --- gcc/testsuite/g++.dg/pr58066.C (revision 0) > +++ gcc/testsuite/g++.dg/pr58066.C (revision 0) > @@ -0,0 +1,12 @@ > +/* { dg-do compile { target {{ i?86-*-* x86_64-*-* } && lp64 } } } */ ^ It should be not ia32. since we also want to test it for x32. > +/* { dg-options "-fPIC -O2 -m64" } */
[patch, libgfortran] PR60128 Wrong ouput using en edit descriptor
Hi all! Patch for pr60128. It is basically the patch posted at = http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D60128#c7. I have made tmp = volatile (although I did not see any differences between -m32 and -m64) = and added a comment (please feel free to improve the wording). I have = also fixed a double space and removed the unused variable nzero_real. I have regtested 4.8.4 and trunk on x86_64-apple-darwin13 and trunk on = powerpc-apple-darwin9. Dominique 2014-03-08 Dominique d'Humieres PR libgfortran/60128 * io/write_float.def (output_float): Remove unused variable nzero_real. Replace a double space with a single one. (determine_en_precision): Fix wrong handling of the EN format. PR libfortran/60128 * gfortran.dg/fmt_en.f90: New test. --- ../_clean/libgfortran/io/write_float.def2014-01-21 08:30:57.0 +0100 +++ libgfortran/io/write_float.def 2014-03-04 16:13:05.0 +0100 @@ -125,8 +125,6 @@ output_float (st_parameter_dt *dtp, cons int nzero; /* Number of digits after the decimal point. */ int nafter; - /* Number of zeros after the decimal point, whatever the precision. */ - int nzero_real; int leadzero; int nblanks; int ndigits, edigits; @@ -138,7 +136,6 @@ output_float (st_parameter_dt *dtp, cons p = dtp->u.p.scale_factor; rchar = '5'; - nzero_real = -1; /* We should always know the field width and precision. */ if (d < 0) @@ -191,7 +188,7 @@ output_float (st_parameter_dt *dtp, cons if (nafter < 0) nafter = 0; nafter = d; - nzero = nzero_real = 0; + nzero = 0; } else /* p < 0 */ { @@ -211,14 +208,13 @@ output_float (st_parameter_dt *dtp, cons nafter = d + nbefore; nbefore = 0; } - nzero_real = nzero; if (nzero > d) nzero = d; } } else { - nzero = nzero_real = 0; + nzero = 0; nafter = d; } @@ -373,7 +369,7 @@ output_float (st_parameter_dt *dtp, cons updown: rchar = '0'; - if (ft != FMT_F && w > 0 && d == 0 && p == 0) + if (ft != FMT_F && w > 0 && d == 0 && p == 0) nbefore = 1; /* Scan for trailing zeros to see if we really need to round it. */ for(i = nbefore + nafter; i < ndigits; i++) @@ -1153,17 +1149,39 @@ OUTPUT_FLOAT_FMT_G(16,L) /* EN format is tricky since the number of significant digits depends on the magnitude. Solve it by first printing a temporary value and figure out the number of significant digits from the printed - exponent. */ - -#define EN_PREC(x,y)\ -{\ -GFC_REAL_ ## x tmp;\ -tmp = * (GFC_REAL_ ## x *)source; \ -if (ISFINITE (y,tmp)) \ - nprinted = DTOA(y,0,tmp);\ -else\ - nprinted = -1;\ -}\ + exponent. Values y, 0.95*10.0**e <= y <10.0**e, are rounded to + 10.0**e even when the final result will not be rounded to 10.0**e. + For these values the exponent returned by atoi has to be decremented + by one. The values y in the ranges + (1000.0-0.5*10.0**(-d))*10.0**(3*n) <= y < 10.0*(3*(n+1)) +(100.0-0.5*10.0**(-d))*10.0**(3*n) <= y < 10.0*(3*n+2) + (10.0-0.5*10.0**(-d))*10.0**(3*n) <= y < 10.0*(3*n+1) + are correctly rounded respectively to 1.0...0*10.0*(3*(n+1)), + 100.0...0*10.0*(3*n), and 10.0...0*10.0*(3*n), where 0...0 + represents d zeroes, by the lines 279 to 297. */ + +#define EN_PREC(x,y) \ +{ \ +volatile GFC_REAL_ ## x tmp, one = 1.0;\ +tmp = * (GFC_REAL_ ## x *)source; \ +if (ISFINITE (y,tmp)) \ + {\ + nprinted = DTOA(y,0,tmp); \ + int e = atoi (&buffer[4]); \ + if (buffer[1] == '1') \ + { \ + tmp = (calculate_exp_ ## x (-e)) * tmp; \ + tmp = one - (tmp < 0 ? -tmp : tmp); \ + if (tmp > 0)\ + e = e - 1;\ + } \ + nbefore = e%3; \ + if (nbefore < 0)\ + nbefore = 3 + nbefore;\ + }\ +else \ + nprinted = -1; \ +} \ static int determine_en_precision (st_parameter_dt *dtp
Re: [PATCH, PR58066] preferred_stack_boundary update for tls expanded call
Yes, x32 has the same problem. It should be tested. Fixed. Thanks, Wei. On Fri, Mar 7, 2014 at 2:06 PM, H.J. Lu wrote: > On Fri, Mar 7, 2014 at 1:26 PM, Wei Mi wrote: >> Hi, >> >> This patch is to fix the problem described here: >> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58066 >> >> I follow Ian's suggestion and set >> ix86_tls_descriptor_calls_expanded_in_cfun in >> tls_global_dynamic_64_ and tls_local_dynamic_base_64_. >> Although 32bit doesn't have the problem, >> ix86_tls_descriptor_calls_expanded_in_cfun is also set for >> tls_global_dynamic_32 and tls_local_dynamic_base_32 to make >> ix86_tls_descriptor_calls_expanded_in_cfun setting consistent across >> 32bits and 64bits. >> >> If ix86_current_function_calls_tls_descriptor is set, we know that >> there is tls expanded call in current function. Update >> crtl->preferred_stack_boundary and crtl->stack_alignment_needed to be >> no less than PREFERED_STACK_ALIGNMENT at the start of >> ix86_compute_frame_layout. We don't do the update in >> legitimize_tls_address in cfgexpand stage, which is too early because >> according to the comments before >> ix86_current_function_calls_tls_descriptor, tls call may be optimized >> away. ix86_compute_frame_layout is the latest place to do the update. >> >> bootstrap on x86_64-linux-gnu is ok. regression test is going on. Ok >> for trunk if tests pass? >> >> Thanks, >> Wei. >> >> gcc/ChangeLog: >> >> 2014-03-07 Wei Mi >> >> * config/i386/i386.c (ix86_compute_frame_layout): Update >> preferred_stack_boundary when there is tls expanded call. >> * config/i386/i386.md: Set >> ix86_tls_descriptor_calls_expanded_in_cfun. >> >> gcc/testsuite/ChangeLog: >> >> 2014-03-07 Wei Mi >> >> * g++.dg/pr58066.C: New test. >> >> >> Index: gcc/config/i386/i386.c >> === >> --- gcc/config/i386/i386.c (revision 208410) >> +++ gcc/config/i386/i386.c (working copy) >> @@ -9504,6 +9504,19 @@ ix86_compute_frame_layout (struct ix86_f >>crtl->preferred_stack_boundary = 128; >>crtl->stack_alignment_needed = 128; >> } >> + /* For 64-bit target, preferred_stack_boundary is never updated for call >> + expanded from tls descriptor. Update it here. We don't update it in >> + expand stage because according to the comments before >> + ix86_current_function_calls_tls_descriptor, tls calls may be optimized >> + away. */ >> + else if (TARGET_64BIT >> + && ix86_current_function_calls_tls_descriptor >> + && crtl->preferred_stack_boundary < PREFERRED_STACK_BOUNDARY) >> +{ >> + crtl->preferred_stack_boundary = PREFERRED_STACK_BOUNDARY; >> + if (crtl->stack_alignment_needed < PREFERRED_STACK_BOUNDARY) >> + crtl->stack_alignment_needed = PREFERRED_STACK_BOUNDARY; >> +} >> >>gcc_assert (!size || stack_alignment_needed); >>gcc_assert (preferred_alignment >= STACK_BOUNDARY / BITS_PER_UNIT); >> Index: gcc/config/i386/i386.md >> === >> --- gcc/config/i386/i386.md (revision 208410) >> +++ gcc/config/i386/i386.md (working copy) >> @@ -12891,7 +12891,11 @@ >> UNSPEC_TLS_GD)) >> (clobber (match_scratch:SI 4)) >> (clobber (match_scratch:SI 5)) >> - (clobber (reg:CC FLAGS_REG))])]) >> + (clobber (reg:CC FLAGS_REG))])] >> + "" >> +{ >> + ix86_tls_descriptor_calls_expanded_in_cfun = true; >> +}) >> >> (define_insn "*tls_global_dynamic_64_" >>[(set (match_operand:P 0 "register_operand" "=a") >> @@ -12946,7 +12950,10 @@ >>(const_int 0))) >> (unspec:P [(match_operand 1 "tls_symbolic_operand")] >>UNSPEC_TLS_GD)])] >> - "TARGET_64BIT") >> + "TARGET_64BIT" >> +{ >> + ix86_tls_descriptor_calls_expanded_in_cfun = true; >> +}) >> >> (define_insn "*tls_local_dynamic_base_32_gnu" >>[(set (match_operand:SI 0 "register_operand" "=a") >> @@ -12982,7 +12989,11 @@ >> UNSPEC_TLS_LD_BASE)) >>(clobber (match_scratch:SI 3)) >>(clobber (match_scratch:SI 4)) >> - (clobber (reg:CC FLAGS_REG))])]) >> + (clobber (reg:CC FLAGS_REG))])] >> + "" >> +{ >> + ix86_tls_descriptor_calls_expanded_in_cfun = true; >> +}) >> >> (define_insn "*tls_local_dynamic_base_64_" >>[(set (match_operand:P 0 "register_operand" "=a") >> @@ -13029,7 +13040,10 @@ >> (mem:QI (match_operand 1)) >> (const_int 0))) >>(unspec:P [(const_int 0)] UNSPEC_TLS_LD_BASE)])] >> - "TARGET_64BIT") >> + "TARGET_64BIT" >> +{ >> + ix86_tls_descriptor_calls_expanded_in_cfun = true; >> +}) >> >> ;; Local dynamic of a single variable is a lose. Show combine how >> ;; to convert that back to global dynamic. >> Index: gcc/testsuite/g++.dg/pr58066.C >> === >> --- gcc/testsuite/g++.dg/pr58066.C (revision 0) >> +++ gcc/testsuite/g
[PATCH] Fix PR c++/60033
PR c++/60033 * pt.c (tsubst_copy): When retrieving a capture pack from a generic lambda, remove the lambda's own template argument list prior to fetching the specialization. PR c++/60033 * g++.dg/cpp1y/pr60033.C: New testcase. --- gcc/cp/pt.c | 10 ++ gcc/testsuite/g++.dg/cpp1y/pr60033.C | 20 2 files changed, 30 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1y/pr60033.C diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 8126905..9d7063b 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -12572,6 +12572,16 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl) return r; } + /* When retrieving a capture pack from a generic lambda, remove the +lambda call op's own template argument list from ARGS. Only the +template arguments active for the closure type should be used to +retrieve the pack specialization. */ + if (TREE_CODE (t) == FIELD_DECL + && LAMBDA_FUNCTION_P (current_function_decl) + && (template_class_depth (DECL_CONTEXT (t)) + != TMPL_ARGS_DEPTH (args))) + args = strip_innermost_template_args (args, 1); + /* Otherwise return the full NONTYPE_ARGUMENT_PACK that tsubst_decl put in the hash table. */ return retrieve_specialization (t, args, 0); diff --git a/gcc/testsuite/g++.dg/cpp1y/pr60033.C b/gcc/testsuite/g++.dg/cpp1y/pr60033.C new file mode 100644 index 000..8194bec --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/pr60033.C @@ -0,0 +1,20 @@ +// PR c++/60033 +// { dg-options -std=c++1y } + +template +auto f(T&&... ts) +{ + return sizeof...(ts); +} + +template +auto g(T&&... ts) { + return [&] (auto v) { +return f(ts...); + }; +} + +int main() +{ + return g(1,2,3,4)(5) == 4 ? 0 : 1; +} -- 1.9.0
[PATCH] Fix PR c++/60393
PR c++/60393 * parser.c (cp_parser_parameter_declaration_clause): Move generic function template unwinding on error into a more general location, ... (cp_parser_skip_to_end_of_statement): ... here. PR c++/60393 * g++.dg/cpp1y/pr60393.C: New testcase. --- gcc/cp/parser.c | 11 +-- gcc/testsuite/g++.dg/cpp1y/pr60393.C | 9 + 2 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp1y/pr60393.C diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 8c78262..523a059 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -3128,6 +3128,10 @@ cp_parser_skip_to_end_of_statement (cp_parser* parser) { unsigned nesting_depth = 0; + /* Unwind generic function template scope if necessary. */ + if (parser->fully_implicit_function_template_p) +finish_fully_implicit_template (parser, /*member_decl_opt=*/0); + while (true) { cp_token *token = cp_lexer_peek_token (parser->lexer); @@ -18208,12 +18212,7 @@ cp_parser_parameter_declaration_clause (cp_parser* parser) parameter-declaration-list, then the entire parameter-declaration-clause is erroneous. */ if (is_error) -{ - /* Unwind generic function template scope if necessary. */ - if (parser->fully_implicit_function_template_p) - finish_fully_implicit_template (parser, /*member_decl_opt=*/0); - return NULL; -} +return NULL; /* Peek at the next token. */ token = cp_lexer_peek_token (parser->lexer); diff --git a/gcc/testsuite/g++.dg/cpp1y/pr60393.C b/gcc/testsuite/g++.dg/cpp1y/pr60393.C new file mode 100644 index 000..38b8b91 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/pr60393.C @@ -0,0 +1,9 @@ +// PR c++/60393 +// { dg-options -std=c++1y } + +void (*f)(auto) + 0; // { dg-error "expected" } + +struct A +{ + int i; +}; -- 1.9.0
Re: [patch, libgfortran] PR60128 Wrong ouput using en edit descriptor
On 03/07/2014 02:05 PM, Dominique d'Humières wrote: > > Hi all! > > Patch for pr60128. It is basically the patch posted at = > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D60128#c7. I have made tmp = > volatile (although I did not see any differences between -m32 and -m64) = > and added a comment (please feel free to improve the wording). I have = > also fixed a double space and removed the unused variable nzero_real. > > I have regtested 4.8.4 and trunk on x86_64-apple-darwin13 and trunk on = > powerpc-apple-darwin9. > Super, I will reapply, test and commit. I also added the volatile, but did not see any difference on -m32 and -m64 either. Thanks for the patch. Jerry
Re: [PATCH] Fix PR c++/60033
On 03/07/2014 06:07 PM, Adam Butcher wrote: + /* When retrieving a capture pack from a generic lambda, remove the +lambda call op's own template argument list from ARGS. Only the +template arguments active for the closure type should be used to +retrieve the pack specialization. */ + if (TREE_CODE (t) == FIELD_DECL + && LAMBDA_FUNCTION_P (current_function_decl) + && (template_class_depth (DECL_CONTEXT (t)) + != TMPL_ARGS_DEPTH (args))) + args = strip_innermost_template_args (args, 1); You don't need to check for FIELD_DECL here; at this point we know t is a FIELD_DECL. OK with that change. Jason
Re: [PATCH] Fix PR c++/60393
OK. Jason
[patch, libfortran] [4.7/4.8/4.9 Regression] PR38199 missed optimization: I/O performance
The attached patch addresses the problem identified in comment #22 of the PR. For character array internal unit reads, eat_spaces must call next_char to advance every single character until the end of the string is reached. In the case sited which is very contrived, this amounts to about 10 calls to next_char. For clarity, this test case: character buffer(1)*10 integer i,j j = 1234 write(buffer(1),'(i4)') j DO j=1, !write(*,*) buffer(1)(1:4) read(buffer,*) i !write(*,*) i ENDDO end Without the patch takes about 25 seconds to run. With the patch this takes about 2.8 seconds. The speedup is accomplished by simply skipping over spaces without calling next_read, then backing up one character and letting the existing execution path proceed, preserving all the end of record code needed in next_char. I also remove some unneeded error checks. Regression tested on X86_64 gnu. No need for a new test case since no new functionality is added. OK for trunk? The PR is marked as a regression, so I think this could be the last piece and call it done. Regards, Jerry 2014-03-08 Jerry DeLisle PR libfortran/38199 * io/list_read.c (next_char): Delete unuseful error checks. (eat_spaces): For character array reading, skip ahead over spaces rather than call next_char multiple times. Index: list_read.c === --- list_read.c (revision 208303) +++ list_read.c (working copy) @@ -160,7 +160,7 @@ next_char (st_parameter_dt *dtp) dtp->u.p.line_buffer_pos = 0; dtp->u.p.line_buffer_enabled = 0; -} +} /* Handle the end-of-record and end-of-file conditions for internal array unit. */ @@ -208,20 +208,8 @@ next_char (st_parameter_dt *dtp) c = cc; } - if (length < 0) - { - generate_error (&dtp->common, LIBERROR_OS, NULL); - return '\0'; - } - if (is_array_io (dtp)) { - /* Check whether we hit EOF. */ - if (length == 0) - { - generate_error (&dtp->common, LIBERROR_INTERNAL_UNIT, NULL); - return '\0'; - } dtp->u.p.current_unit->bytes_left--; } else @@ -264,6 +252,28 @@ eat_spaces (st_parameter_dt *dtp) { int c; + /* If internal character array IO, peak ahead and seek past spaces. + This is an optimazation to eliminate numerous calls to + next character unique to character arrays with large character + lengths (PR38199). */ + if (is_array_io (dtp)) +{ + gfc_offset offset = stell (dtp->u.p.current_unit->s); + gfc_offset limit = dtp->u.p.current_unit->bytes_left; + + do + { + c = dtp->internal_unit[offset++]; + dtp->u.p.current_unit->bytes_left--; + } + while (offset < limit && (c == ' ' || c == '\t')); + /* Back up, seek ahead, and fall through to complete the process + so that END conditions are handled correctly. */ + dtp->u.p.current_unit->bytes_left++; + sseek (dtp->u.p.current_unit->s, offset-1, SEEK_SET); +} + + /* Now skip spaces, EOF and EOL are handled in next_char. */ do c = next_char (dtp); while (c != EOF && (c == ' ' || c == '\t'));
Re: [Patch, Fortran] -fcoarray=lib: Change handling of this_image() and num_images()
Tobias Burnus wrote: Hence, the attached patch adds a this_image() and num_images() library function. As the library is only build statically and -fcoarray=lib is not widely used due to lacking communication support, I wouldn't count this patch as real ABI break and there shouldn't be a problem from that side. PPS: I intent to create an SVN branch to collect the coarray changes. I have now committed it to the fortran-caf branch (Rev. 208424). Tobias
[Patch, Fortran] Update gfortran.texi's 2003/2008 status
An update the gfortran.texi's F2003/F2008 status. OK for the trunk? Tobias 2014-03-08 Tobias Burnus * gfortran.texi (Fortran 2003 Status): Mention finalization, deferred-length character support and input rounding. (Fortran 2008 Status): Mention that at termination signalling exceptions are shown. diff --git a/gcc/fortran/gfortran.texi b/gcc/fortran/gfortran.texi index cb7fde2..7bab3e2 100644 --- a/gcc/fortran/gfortran.texi +++ b/gcc/fortran/gfortran.texi @@ -811,9 +811,10 @@ operators bound to a type. @item Abstract interfaces and type extension with the possibility to override type-bound procedures or to have deferred binding. -@item Polymorphic entities (``@code{CLASS}'') for derived types -- including -@code{SAME_TYPE_AS}, @code{EXTENDS_TYPE_OF} and @code{SELECT TYPE} for -scalars and arrays, including unlimited polymorphism. +@item Polymorphic entities (``@code{CLASS}'') for derived types and unlimited +polymorphism (``@code{CLASS(*)}'') -- including @code{SAME_TYPE_AS}, +@code{EXTENDS_TYPE_OF} and @code{SELECT TYPE} for scalars and arrays and +finalization. @item Generic interface names, which have the same name as derived types, are now supported. This allows one to write constructor functions. Note @@ -839,6 +840,10 @@ used, an allocatable variable on the left-hand side is automatically allocated deferred character length left-hand sides are correctly handled but arrays are not yet fully implemented. +@item Deferred-length character variables and scalar deferred-length character +components of derived types are supported. (Note that array-valued compoents +are not yet implemented.) + @item Transferring of allocations via @code{MOVE_ALLOC}. @item The @code{PRIVATE} and @code{PUBLIC} attributes may be given individually @@ -919,9 +924,10 @@ allowing I/O without any record structure. @item Namelist input/output for internal files. -@item Further I/O extensions: Rounding during formatted output, using of +@item Minor I/O features: Rounding during formatted output, using of a decimal comma instead of a decimal point, setting whether a plus sign -should appear for positive numbers. +should appear for positive numbers. On system where @code{strtod} honours +the rounding mode, the rounding mode is also supported for input. @item @cindex @code{PROTECTED} statement @@ -1035,7 +1041,8 @@ flag. @item The @code{BLOCK} construct is supported. @item The @code{STOP} and the new @code{ERROR STOP} statements now -support all constant expressions. +support all constant expressions. Both show the signals which were signaling +at termination. @item Support for the @code{CONTIGUOUS} attribute.