Re: [PATCH PR62151]Fix uninitialized register issue caused by distribute_notes in combine pass
On Fri, Aug 29, 2014 at 11:58:37PM -0600, Jeff Law wrote: One could argue that this mess is a result of trying to optimize a reg that is set more than once.Though I guess that might be a bit of a big hammer. It works fine in other cases, and is quite beneficial for e.g. optimising instruction sequences that set a fixed carry register twice. In the testcase (and comment in the proposed patch), why is combine combining four insns at all? That means it rejected combining just the first three. Why did it do that? Segher
[PATCH 1/2] Add -B support to gcc-ar/ranlib/nm
From: Andi Kleen a...@linux.intel.com To use gcc-{ar,ranlib} for boot strap we need to add a -B option to the tool. Since ar has weird and unusual argument conventions implement the code by hand instead of using any libraries. v2: Fix typo v3: Improve comments. Use strlen. Use DIR_SEPARATOR. Add prefixes at begin. gcc/: 2014-08-31 Andi Kleen a...@linux.intel.com * file-find.c (add_prefix_begin): Add. (do_add_prefix): Rename from add_prefix with first argument. (add_prefix): Add new wrapper. * file-find.h (add_prefix_begin): Add. * gcc-ar.c (main): Support -B option. --- gcc/file-find.c | 23 --- gcc/file-find.h | 1 + gcc/gcc-ar.c| 43 +++ 3 files changed, 64 insertions(+), 3 deletions(-) diff --git a/gcc/file-find.c b/gcc/file-find.c index 87d486d..be608b2 100644 --- a/gcc/file-find.c +++ b/gcc/file-find.c @@ -105,15 +105,16 @@ find_a_file (struct path_prefix *pprefix, const char *name, int mode) return 0; } -/* Add an entry for PREFIX to prefix list PPREFIX. */ +/* Add an entry for PREFIX to prefix list PREFIX. + Add at beginning if FIRST is true. */ void -add_prefix (struct path_prefix *pprefix, const char *prefix) +do_add_prefix (struct path_prefix *pprefix, const char *prefix, bool first) { struct prefix_list *pl, **prev; int len; - if (pprefix-plist) + if (pprefix-plist !first) { for (pl = pprefix-plist; pl-next; pl = pl-next) ; @@ -138,6 +139,22 @@ add_prefix (struct path_prefix *pprefix, const char *prefix) *prev = pl; } +/* Add an entry for PREFIX at the end of prefix list PREFIX. */ + +void +add_prefix (struct path_prefix *pprefix, const char *prefix) +{ + do_add_prefix (pprefix, prefix, false); +} + +/* Add an entry for PREFIX at the begin of prefix list PREFIX. */ + +void +add_prefix_begin (struct path_prefix *pprefix, const char *prefix) +{ + do_add_prefix (pprefix, prefix, true); +} + /* Take the value of the environment variable ENV, break it into a path, and add of the entries to PPREFIX. */ diff --git a/gcc/file-find.h b/gcc/file-find.h index b438056..0754d99 100644 --- a/gcc/file-find.h +++ b/gcc/file-find.h @@ -40,6 +40,7 @@ struct path_prefix extern void find_file_set_debug (bool); extern char *find_a_file (struct path_prefix *, const char *, int); extern void add_prefix (struct path_prefix *, const char *); +extern void add_prefix_begin (struct path_prefix *, const char *); extern void prefix_from_env (const char *, struct path_prefix *); extern void prefix_from_string (const char *, struct path_prefix *); diff --git a/gcc/gcc-ar.c b/gcc/gcc-ar.c index aebaa92..b5199e6 100644 --- a/gcc/gcc-ar.c +++ b/gcc/gcc-ar.c @@ -132,9 +132,52 @@ main (int ac, char **av) const char **nargv; bool is_ar = !strcmp (PERSONALITY, ar); int exit_code = FATAL_EXIT_CODE; + int i; setup_prefixes (av[0]); + /* Not using getopt for now. */ + for (i = 0; i ac; i++) + if (!strncmp (av[i], -B, 2)) + { + const char *arg = av[i] + 2; + const char *end; + size_t len; + + memmove (av + i, av + i + 1, sizeof (char *) * ((ac + 1) - i)); + ac--; + if (*arg == 0) + { + arg = av[i + 1]; + if (!arg) + { + fprintf (stderr, Usage: gcc-ar [-B prefix] ar arguments ...\n); + exit (EXIT_FAILURE); + } + memmove (av + i, av + i + 1, sizeof (char *) * ((ac + 1) - i)); + ac--; + i++; + } + /* else it's a joined argument */ + + len = strlen (arg); + if (len 0) + len--; + end = arg + len; + + /* Always add a dir separator for the prefix list. */ + if (end arg !IS_DIR_SEPARATOR (*end)) + { + static const char dir_separator_str[] = { DIR_SEPARATOR, 0 }; + arg = concat (arg, dir_separator_str, NULL); + } + + add_prefix_begin (path, arg); + add_prefix_begin (target_path, arg); + break; + } + + /* Find the GCC LTO plugin */ plugin = find_a_file (target_path, LTOPLUGINSONAME, R_OK); if (!plugin) -- 2.0.4
[PATCH 2/2] Support slim LTO bootstrap
From: Andi Kleen a...@linux.intel.com Change the bootstrap-lto config file to use slim (non fat) LTO.. Speeds up the LTO bootstrap by ~18% on a 4 core system. This requires using gcc-ar/ranlib in post stage 1 builds, so these are passed to all sub builds. v2: Change existing config file as requested by Honza. config/: 2014-08-31 Andi Kleen a...@linux.intel.com * bootstrap-lto.mk: Implement slim bootstrap. /: 2014-08-31 Andi Kleen a...@linux.intel.com * Makefile.tpl (POSTSTAGE1_HOST_EXPORTS): Add LTO_EXPORTS. POSTSTAGE1_FLAGS_TO_PASS): Add LTO_FLAGS_TO_PASS. * Makefile.in: Regenerate. --- Makefile.in | 2 ++ Makefile.tpl | 2 ++ config/bootstrap-lto-slim.mk | 13 + config/bootstrap-lto.mk | 16 +++- 4 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 config/bootstrap-lto-slim.mk diff --git a/Makefile.in b/Makefile.in index add8cf6..d6105b3 100644 --- a/Makefile.in +++ b/Makefile.in @@ -257,6 +257,7 @@ POSTSTAGE1_HOST_EXPORTS = \ $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS; export CC; \ CC_FOR_BUILD=$$CC; export CC_FOR_BUILD; \ $(POSTSTAGE1_CXX_EXPORT) \ + $(LTO_EXPORTS) \ GNATBIND=$$r/$(HOST_SUBDIR)/prev-gcc/gnatbind; export GNATBIND; \ LDFLAGS=$(POSTSTAGE1_LDFLAGS) $(BOOT_LDFLAGS); export LDFLAGS; \ HOST_LIBS=$(POSTSTAGE1_LIBS); export HOST_LIBS; @@ -828,6 +829,7 @@ POSTSTAGE1_FLAGS_TO_PASS = \ GNATBIND=$${GNATBIND} \ LDFLAGS=$${LDFLAGS} \ HOST_LIBS=$${HOST_LIBS} \ + $(LTO_FLAGS_TO_PASS) \ `echo 'ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'` # Flags to pass down to makes which are built with the target environment. diff --git a/Makefile.tpl b/Makefile.tpl index 00dba36..f7c7e38 100644 --- a/Makefile.tpl +++ b/Makefile.tpl @@ -260,6 +260,7 @@ POSTSTAGE1_HOST_EXPORTS = \ $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS; export CC; \ CC_FOR_BUILD=$$CC; export CC_FOR_BUILD; \ $(POSTSTAGE1_CXX_EXPORT) \ + $(LTO_EXPORTS) \ GNATBIND=$$r/$(HOST_SUBDIR)/prev-gcc/gnatbind; export GNATBIND; \ LDFLAGS=$(POSTSTAGE1_LDFLAGS) $(BOOT_LDFLAGS); export LDFLAGS; \ HOST_LIBS=$(POSTSTAGE1_LIBS); export HOST_LIBS; @@ -633,6 +634,7 @@ POSTSTAGE1_FLAGS_TO_PASS = \ GNATBIND=$${GNATBIND} \ LDFLAGS=$${LDFLAGS} \ HOST_LIBS=$${HOST_LIBS} \ + $(LTO_FLAGS_TO_PASS) \ `echo 'ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'` # Flags to pass down to makes which are built with the target environment. diff --git a/config/bootstrap-lto-slim.mk b/config/bootstrap-lto-slim.mk new file mode 100644 index 000..9e065e1 --- /dev/null +++ b/config/bootstrap-lto-slim.mk @@ -0,0 +1,13 @@ +# This option enables LTO for stage2 and stage3 in slim mode + +STAGE2_CFLAGS += -flto=jobserver -frandom-seed=1 +STAGE3_CFLAGS += -flto=jobserver -frandom-seed=1 +STAGEprofile_CFLAGS += -fno-lto + +# assumes the host supports the linker plugin +LTO_AR = $$r/$(HOST_SUBDIR)/prev-gcc/gcc-ar$(exeext) -B$$r/$(HOST_SUBDIR)/prev-gcc/ +LTO_RANLIB = $$r/$(HOST_SUBDIR)/prev-gcc/gcc-ranlib$(exeext) -B$$r/$(HOST_SUBDIR)/prev-gcc/ + +LTO_EXPORTS = AR=$(LTO_AR); export AR; \ + RANLIB=$(LTO_RANLIB); export RANLIB; +LTO_FLAGS_TO_PASS = AR=$(LTO_AR) RANLIB=$(LTO_RANLIB) diff --git a/config/bootstrap-lto.mk b/config/bootstrap-lto.mk index 27bad15..9e065e1 100644 --- a/config/bootstrap-lto.mk +++ b/config/bootstrap-lto.mk @@ -1,7 +1,13 @@ -# This option enables LTO for stage2 and stage3. -# FIXME: Our build system is not yet able to use gcc-ar wrapper, so we need -# to go with -ffat-lto-objects. +# This option enables LTO for stage2 and stage3 in slim mode -STAGE2_CFLAGS += -flto=jobserver -frandom-seed=1 -ffat-lto-objects -STAGE3_CFLAGS += -flto=jobserver -frandom-seed=1 -ffat-lto-objects +STAGE2_CFLAGS += -flto=jobserver -frandom-seed=1 +STAGE3_CFLAGS += -flto=jobserver -frandom-seed=1 STAGEprofile_CFLAGS += -fno-lto + +# assumes the host supports the linker plugin +LTO_AR = $$r/$(HOST_SUBDIR)/prev-gcc/gcc-ar$(exeext) -B$$r/$(HOST_SUBDIR)/prev-gcc/ +LTO_RANLIB = $$r/$(HOST_SUBDIR)/prev-gcc/gcc-ranlib$(exeext) -B$$r/$(HOST_SUBDIR)/prev-gcc/ + +LTO_EXPORTS = AR=$(LTO_AR); export AR; \ + RANLIB=$(LTO_RANLIB); export RANLIB; +LTO_FLAGS_TO_PASS = AR=$(LTO_AR) RANLIB=$(LTO_RANLIB) -- 2.0.4
Updated slim LTO patchkit
This patchkit implements slim LTO bootstrap, which speeds up LTO bootstrap by only compiling once. I implemented all of Richard's feedback for the new -B option for gcc-ar. Passes full bootstrap and test on x86_64-linux and LTO bootstrap. Ok to commit now? -Andi
Re: [PATCH 5/5] add libcc1 [gcc-5/changes.html]
Hi Jan, On Fri, 8 Aug 2014, Jan Kratochvil wrote: Jeff == Jeff Law l...@redhat.com writes: Does this deserve a mention in the news file? Attached (based on Tom's PATCH 0/5 mail). Index: htdocs/gcc-5/changes.html === +h3 id=cC/h3 + ul +liGDB evaluation of a block of source code is now provided by new GCC +plugin.br / How does one obtain/install/trigger this plugin? Where are more details documented? This is information I'd add here. +A user can compile a code snippet and it will be inserted into the inferior +and evaluated. Declarations needed by the snippet are supplied by GDB, and +there is a GDB--GCC interface so that the snippets can refer to local +variables in the current inferior frame. The validator probably is going to complain that this needs to be within p.../p markers. In HTML, I'd just say GDB-GCC (one dash). I'm good with this patch modulo these suggestion, but perhaps Jeff or Tom have some further input? Gerald
Re: [PATCH 2/2] Support slim LTO bootstrap
Andi Kleen a...@firstfloor.org writes: diff --git a/config/bootstrap-lto-slim.mk b/config/bootstrap-lto-slim.mk new file mode 100644 index 000..9e065e1 --- /dev/null +++ b/config/bootstrap-lto-slim.mk This file was not supposed to be included anymore. I removed it in my version. Instead the existing bootstrap-lto.mk has the same changes. -andi -- a...@linux.intel.com -- Speaking for myself only
Re: [ARM Documentation] Clarify -mcpu, -mtune, -march
On Wed, 5 Feb 2014, James Greenhalgh wrote: As far as I know the behaviour of this flag has always been this way. So is this also OK to backport to release branches? 2014-02-05 James Greenhalgh james.greenha...@arm.com PR target/59718 * doc/invoke.texi (-march=): Clarify documentation for ARM. (-mtune=): Likewise. (-mcpu=): Likewise. Where this piece of documentations says At present, this feature is only supported on Linux (more than once), should this be GNU/Linux instead per FSF guidelines? Gerald
Re: [PATCH][1-3] New configure options that make the compiler use -fPIE and -pie as default option
On Fri, 1 Aug 2014, Rainer Orth wrote: +NOTE: With configure --enable-default-pie this option is enabled by default With the @option{--enable-default-pie} configure option, ... And just Note: or perhaps @emph{Note}: as in many other cases. Gerald
[wwwdocs] Patch for Re: _contribute.html_: missing information regarding feedback procedure
On Fri, 10 May 2013, Jonathan Wakely wrote: At the very bottom of the above page (http://gcc.gnu.org/contribute.html), there is no indication of GCC only accepting *plain text* messages. That would belong on http://gcc.gnu.org/lists.html but it could be improved, as it only says Please refrain from sending messages in HTML, RTF or similar formats. Good feedback. I just applied the clarification below which also makes some surrounding text a little bit shorter. Gerald Index: lists.html === RCS file: /cvs/gcc/wwwdocs/htdocs/lists.html,v retrieving revision 1.111 diff -u -r1.111 lists.html --- lists.html 1 Jul 2014 16:02:44 - 1.111 +++ lists.html 31 Aug 2014 16:31:11 - @@ -157,11 +157,11 @@ pWe have a strong policy of not editing the web archives./p pWhen posting messages, please select an appropriate list for the message -and try to avoid cross posting a message to several lists./p +and try to avoid cross posting to several lists./p -pPlease refrain from sending messages in HTML, RTF or similar formats./p +pPlease send plain text (as opposed to HTML, RTF,...)./p -p id=confidentialPlease do not include or reference confidentiality +p id=confidentialDo not include or reference confidentiality notices, like:/p blockquote pThe referring document contains privileged and confidential
C++ PATCH for c++/62302 (wrong comdat group)
Honza's earlier change to the assert at the end of cdtor_comdat_group was wrong; we really do need to make sure that we've created the '5' group that we want. This is complicated by the change to alias creation that automatically copies DECL_COMDAT_GROUP over, but since comdat groups are copied from DECL_ASSEMBLER_NAME anyway, we can just look there to find the names we want. Tested x86_64-pc-linux-gnu, applying to trunk. commit fad4e2d51d8773fb1297f51cc8771fd14635a4b0 Author: Jason Merrill ja...@redhat.com Date: Fri Aug 29 17:23:14 2014 -0400 PR c++/62302 * optimize.c (cdtor_comdat_group): Just look at the DECL_ASSEMBLER_NAME of the 'tors. diff --git a/gcc/cp/optimize.c b/gcc/cp/optimize.c index f9a236e..31acb07 100644 --- a/gcc/cp/optimize.c +++ b/gcc/cp/optimize.c @@ -159,18 +159,12 @@ build_delete_destructor_body (tree delete_dtor, tree complete_dtor) static tree cdtor_comdat_group (tree complete, tree base) { - tree complete_name = DECL_COMDAT_GROUP (complete); - tree base_name = DECL_COMDAT_GROUP (base); + tree complete_name = DECL_ASSEMBLER_NAME (complete); + tree base_name = DECL_ASSEMBLER_NAME (base); char *grp_name; const char *p, *q; bool diff_seen = false; size_t idx; - if (complete_name == NULL) -complete_name = cxx_comdat_group (complete); - if (base_name == NULL) -base_name = cxx_comdat_group (base); - complete_name = DECL_ASSEMBLER_NAME (complete_name); - base_name = DECL_ASSEMBLER_NAME (base_name); gcc_assert (IDENTIFIER_LENGTH (complete_name) == IDENTIFIER_LENGTH (base_name)); grp_name = XALLOCAVEC (char, IDENTIFIER_LENGTH (complete_name) + 1); @@ -190,7 +184,7 @@ cdtor_comdat_group (tree complete, tree base) diff_seen = true; } grp_name[idx] = '\0'; - gcc_assert (diff_seen || symtab_node::get (complete)-alias); + gcc_assert (diff_seen); return get_identifier (grp_name); } diff --git a/gcc/testsuite/g++.dg/abi/comdat1.C b/gcc/testsuite/g++.dg/abi/comdat1.C new file mode 100644 index 000..e1025e3 --- /dev/null +++ b/gcc/testsuite/g++.dg/abi/comdat1.C @@ -0,0 +1,13 @@ +// PR c++/62302 + +// { dg-do compile { target *-*-*gnu* } } +// { dg-final { scan-assembler _ZN3optIiED5Ev,comdat } } +// { dg-final { scan-assembler-not _ZN3optIiED0Ev,comdat } } +// { dg-final { scan-assembler-not _ZN3optIiED1Ev,comdat } } +// { dg-final { scan-assembler-not _ZN3optIiED2Ev,comdat } } + +struct Option { + virtual ~Option() {} +}; +template class DataType class opt : public Option {}; +template class optint;
Re: [wwwdocs] Add Porting to GCC 4.9 document
On Tue, 4 Mar 2014, 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 Very nice! Thank you for doing this. What do you think about the following patch with minor changes? The only material one (apart from making the URL relative, is there any problem with that?) is that I'm toning down the language in how disruptive this release is. Compared to releases around GCC 4.4 this looks like a very harmless one. :-) Gerald Index: porting_to.html === RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.9/porting_to.html,v retrieving revision 1.6 diff -u -r1.6 porting_to.html --- porting_to.html 11 Jun 2014 18:49:26 - 1.6 +++ porting_to.html 31 Aug 2014 19:20:52 - @@ -8,12 +8,11 @@ h1Porting to GCC 4.9/h1 p -The GCC 4.9 release series differs from previous GCC releases in more -than the usual list of -a href=https://gcc.gnu.org/gcc-4.9/changes.html;changes/a. Some of +The GCC 4.9 release series differs from previous GCC releases in +a href=changes.htmla number of ways/a. Some of these are a result of bug fixing, and some old behaviors have been intentionally changed in order to support new standards, or relaxed -in standards-conforming ways to facilitate compilation or runtime +in standards-conforming ways to facilitate compilation or run-time performance. Some of these changes are not visible to the naked eye and will not cause problems when updating from older versions. /p @@ -35,7 +34,7 @@ h2C/C++ language issues/h2 -h3Invalid OpenMP #pragma omp end directive now diagnosed/h3 +h3Invalid OpenMP code#pragma omp end/code directive now diagnosed/h3 p GCC no longer accepts invalid OpenMP like: /p @@ -90,6 +89,7 @@ pThis optimization can also affect implicit null pointer checks such as the one done by the C++ runtime for the codedelete[]/code operator./p + h2C language issues/h2 h3Right operand of comma operator without effect/h3 @@ -117,6 +117,7 @@ bar (), (void) i; /code/pre + h2C++ language issues/h2 h3Shadowing name of exception in codecatch/code handler now rejected/h3 @@ -208,6 +209,7 @@ using ::max_align_t; b style='color:lime'^/b /pre + pAnother possible error is:/p pre bsomeheader.h:99:13:/b b style='color:red'error:/b lsquo;bptrdiff_t/brsquo; does not name a type @@ -237,4 +239,3 @@ /body /html -
Re: [wwwdocs] Add Porting to GCC 4.9 document
On 31/08/14 21:23 +0200, Gerald Pfeifer wrote: On Tue, 4 Mar 2014, 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 Very nice! Thank you for doing this. What do you think about the following patch with minor changes? The only material one (apart from making the URL relative, is there any problem with that?) is that I'm toning down the language in how disruptive this release is. Compared to releases around GCC 4.4 this looks like a very harmless one. :-) I just copied that text from previous porting_to.html pages, your changes look good to me.
[wwwdocs, committed] gcc-5/changes.html: Update Fortran section
Dear all, I have committed the attached patch. Comment and suggestions are welcome! See also: https://gcc.gnu.org/gcc-5/changes.html#fortran Tobias Index: changes.html === RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-5/changes.html,v retrieving revision 1.7 diff -u -p -r1.7 changes.html --- changes.html 26 Aug 2014 17:18:40 - 1.7 +++ changes.html 31 Aug 2014 20:34:49 - @@ -91,6 +91,18 @@ h3 id=fortranFortran/h3 ul +liIncomplete support for colorizing diagnostics emitted by gfortran has + been added. The codea + href=https://gcc.gnu.org/onlinedocs/gcc/Language-Independent-Options.html#index-fdiagnostics-color-256; + -fdiagnostics-color=/aauto/code will enable it when outputting to + terminals, code-fdiagnostics-color=always/code unconditionally. The + codeGCC_COLORS/code environment variable can be used to customize the + colors or disable coloring. If codeGCC_COLORS/code variable is present + in the environment, the default is code-fdiagnostics-color=auto/code, + otherwise code-fdiagnostics-color=never/code./li +liThe code-Wuse-without-only/code option has been added to warn when a + codeUSE/code statement has no codeONLY/code qualifier and, thus, + implicitly imports all public entities of the used module./li lia href=https://gcc.gnu.org/wiki/Fortran2003Status;Fortran 2003/a: ul liThe intrinsic IEEE modules (codeIEEE_FEATURES/code, @@ -99,11 +111,14 @@ /ul/li lia href=https://gcc.gnu.org/wiki/Fortran2008Status;Fortran 2008/a: ul - liCoarrays: Full experimental support of Fortran 2008's coarrays with + lia href=https://gcc.gnu.org/wiki/Coarray;Coarrays/a: Full + experimental support of Fortran 2008's coarrays with code-fcoarray=lib/code except for locking and allocatable/pointer - components of derived-type coarrays. Note that GCC currently only ships - with a library which only supports a single image - (codelibcaf_single/code)./li + components of derived-type coarrays. GCC currently only ships with a + single-image library (codelibcaf_single/code), but + mult-image support based on MPI and GASNet is provided by the libraries + of the a href=http://www.opencoarrays.org/;OpenCoarrays project/a. + /li /ul/li liTS18508 Additional Parallel Features in Fortran: ul
Re: [PATCH] doc/generic.texi: Fix typo
On Fri, 29 Aug 2014, Mike Stump wrote: These errors are on purpose. -There are many places in which this document is incomplet and incorrekt. +There are many places in which this document is incomplete or incorrect. Since this now came up for the second time this year, I went ahead and applied the patch below. Gerald 2014-08-31 Gerald Pfeifer ger...@pfeifer.com * doc/generic.texi (Deficiencies): Add note on exemplary mistakes. Index: doc/generic.texi === --- doc/generic.texi(revision 214765) +++ doc/generic.texi(working copy) @@ -53,6 +53,7 @@ @node Deficiencies @section Deficiencies +@c The spelling of incomplet and incorrekt below is intentional. There are many places in which this document is incomplet and incorrekt. It is, as of yet, only @emph{preliminary} documentation.
Re: [PATCH] 2014-08-29 Honggyu Kim hong.gyu....@lge.com
On Fri, 29 Aug 2014, Marek Polacek wrote: -There are many places in which this document is incomplet and incorrekt. +There are many places in which this document is incomplete or incorrect. I believe these typos are intentional. That is my understanding as well, so I added a comment to that extent. Cf. https://gcc.gnu.org/ml/gcc-patches/2014-08/msg02720.html Gerald
[RFC/PATCH] Fix-it hints
This patch implements fix-it hints. See https://gcc.gnu.org/PR62314 When the caret line is active (which is the default), this adds an additional source-line indicating how to fix the code: gcc/testsuite/g++.dg/template/crash83.C:5:21: error: an explicit specialization must be preceded by 'template ' templatetypename = class A0: struct B {}; // { dg-error explicit specialization|expected } ^ template When the caret line is disabled with -fno-diagnostics-show-caret, the fix-it hint is printed as: gcc/testsuite/g++.dg/template/crash83.C:5:21: error: an explicit specialization must be preceded by 'template ' gcc/testsuite/g++.dg/template/crash83.C:5:21: fixit: template The latter form may allow an IDE (such as emacs) to automatically apply the fix. Currently, fix-it hints are limited to insertions at one single location, whereas Clang allows insertions, deletions, and replacements at arbitrary location ranges. Opinions? Is the proposed interface/implementation acceptable? Any other diagnostics that could use a fix-it hint? In principle, we should only give them when we are sure that the proposed fix will fix the error or silence a warning. For example, the C++ parser often says 'x' expected before 'y' but adding x before y rarely fixes anything. gcc/ChangeLog: 2014-08-31 Manuel López-Ibáñez m...@gcc.gnu.org PR c++/62314 * diagnostic.def (DK_FIXIT): New. * diagnostic.c (adjust_column): New. (adjust_line): Factor out adjust_column. (get_source_line_and_column): New. (diagnostic_show_locus): Call get_source_line_and_column. (diagnostic_action_after_output): Ignore DK_FIXIT. (fixit_hint): New. * diagnostic-core.h (fixit_hint): Declare. gcc/cp/ChangeLog: 2014-08-31 Manuel López-Ibáñez m...@gcc.gnu.org PR c++/62314 * parser.c (cp_parser_diagnose_invalid_type_name): Call fixit_hint. (cp_parser_expression_statement): Likewise. (cp_parser_class_head): Likewise. Update location. gcc/testsuite/ChangeLog: 2014-08-31 Manuel López-Ibáñez m...@gcc.gnu.org PR c++/62314 * g++.old-deja/g++.oliva/typename1.C: Handle fixit hint. * g++.old-deja/g++.oliva/typename2.C: Likewise. * g++.old-deja/g++.other/typename1.C: Likewise. * g++.old-deja/g++.pt/typename6.C: Likewise. * g++.old-deja/g++.pt/typename3.C: Likewise. * g++.old-deja/g++.pt/typename4.C: Likewise. * g++.dg/parse/error36.C: Likewise. * g++.dg/parse/typedef2.C: Likewise. * g++.dg/template/error6.C: Likewise. * g++.dg/template/dependent-name5.C: Likewise. * g++.dg/template/crash83.C: Likewise. * g++.dg/template/typename3.C: Likewise. Index: gcc/diagnostic.def === --- gcc/diagnostic.def (revision 214756) +++ gcc/diagnostic.def (working copy) @@ -35,10 +35,11 @@ DEFINE_DIAGNOSTIC_KIND (DK_ICE, interna DEFINE_DIAGNOSTIC_KIND (DK_ERROR, error: , error) DEFINE_DIAGNOSTIC_KIND (DK_SORRY, sorry, unimplemented: , error) DEFINE_DIAGNOSTIC_KIND (DK_WARNING, warning: , warning) DEFINE_DIAGNOSTIC_KIND (DK_ANACHRONISM, anachronism: , warning) DEFINE_DIAGNOSTIC_KIND (DK_NOTE, note: , note) +DEFINE_DIAGNOSTIC_KIND (DK_FIXIT, fixit: , note) DEFINE_DIAGNOSTIC_KIND (DK_DEBUG, debug: , note) /* These two would be re-classified as DK_WARNING or DK_ERROR, so the prefix does not matter. */ DEFINE_DIAGNOSTIC_KIND (DK_PEDWARN, pedwarn: , NULL) DEFINE_DIAGNOSTIC_KIND (DK_PERMERROR, permerror: , NULL) Index: gcc/diagnostic.c === --- gcc/diagnostic.c(revision 214756) +++ gcc/diagnostic.c(working copy) @@ -254,61 +254,81 @@ diagnostic_build_prefix (diagnostic_cont s.column, locus_ce, text_cs, text, text_ce) : build_message_string (%s%s:%d:%s %s%s%s, locus_cs, s.file, s.line, locus_ce, text_cs, text, text_ce)); } + +static int +adjust_column (int line_width, int max_width, int column) + +{ + int right_margin = 10; + gcc_checking_assert (line_width = column); + if (line_width = max_width) +{ + right_margin = MIN (line_width - column, right_margin); + right_margin = max_width - right_margin; + if (column right_margin) + return right_margin; +} + return column; +} + /* If LINE is longer than MAX_WIDTH, and COLUMN is not smaller than MAX_WIDTH by some margin, then adjust the start of the line such that the COLUMN is smaller than MAX_WIDTH minus the margin. The margin is either 10 characters or the difference between the column and the length of the line, whatever is smaller. The length of LINE is given by LINE_WIDTH. */ static const char * adjust_line (const char *line, int line_width, int max_width, int *column_p) { - int right_margin = 10; - int column = *column_p; + int old_column = *column_p; - gcc_checking_assert (line_width = column); -
Re: [PATCH] doc/generic.texi: Fix typo
On 8/31/2014 4:49 PM, Gerald Pfeifer wrote: On Fri, 29 Aug 2014, Mike Stump wrote: These errors are on purpose. Surprising that someone would not get this obvious clever joke. -There are many places in which this document is incomplet and incorrekt. +There are many places in which this document is incomplete or incorrect. Since this now came up for the second time this year, I went ahead and applied the patch below. Seems a shame that anyone should need an explanation, but oh well :-) P.S. my favorite instance of this kind of documentation is an early IBM Fortran manual, which says that you should put exactly the character you want to see come out on the printer [in some context], e.g. an I for an I and a 2 for a 2. :-)
Re: [PATCH, Fortran] -fno-automatic with -finit-local prevents initialization of automatics in recursive functions
Fritz Reese wrote: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62309 It seems with gcc-4.8.3 -fno-automatic prevents initializers from being applied to automatic variables. [...] According to gfortran's manual page, -fno-automatic should Treat each program unit (except those marked as RECURSIVE) as if the SAVE statement were specified for every local variable [...]. As far as I can tell, -finit-local-zero should still initialize automatic variables in RECURSIVE functions. I believe this is a simple fix; to actually follow the specification set forth in the man page, don't treat symbols in a RECURSIVE namespace as if they are saved in resolve.c (apply_default_init_local): Thanks for the patch. I think it qualifies as obvious. But note for potential future contributions that for nontrivial contributions a copyright assignment with the FSF is required: https://gcc.gnu.org/contribute.html (Tiny nit: 8 spaces are replaced by a tab.) I initially thought that one had to be more careful because of BLOCK, but the RECURSIVE is passed on those namespaces, hence, the patch works fine. I have extended the test case to cover that part as well. I have now committed the attached version of the patch to the trunk (GCC 5) as Rev. 214771. Tobias (Side remark: I think it is bad style to rely on -finit-local with new code - and RECURSIVE is new since Fortran 90) code.) 2014-08-29 Fritz Reese reese-fr...@zai.com * resolve.c (apply_default_init_local): Don't treat variables in RECURSIVE units as saved. Index: gcc/fortran/ChangeLog === --- gcc/fortran/ChangeLog (Revision 214770) +++ gcc/fortran/ChangeLog (Arbeitskopie) @@ -1,3 +1,9 @@ +2014-08-31 Fritz Reese reese-fr...@zai.com + + PR fortran/62309 + * resolve.c (apply_default_init_local): Don't treat variables + in RECURSIVE procedures as saved. + 2014-08-31 Tobias Burnus bur...@net-b.de * trans-decl.c (gfc_build_builtin_function_decls): Add Index: gcc/fortran/resolve.c === --- gcc/fortran/resolve.c (Revision 214770) +++ gcc/fortran/resolve.c (Arbeitskopie) @@ -10780,6 +10780,7 @@ apply_default_init_local (gfc_symbol *sym) result variable, which are also nonstatic. */ if (sym-attr.save || sym-ns-save_all || (gfc_option.flag_max_stack_var_size == 0 !sym-attr.result + !sym-ns-proc_name-attr.recursive (!sym-attr.dimension || !is_non_constant_shape_array (sym { /* Don't clobber an existing initializer! */ Index: gcc/testsuite/ChangeLog === --- gcc/testsuite/ChangeLog (Revision 214770) +++ gcc/testsuite/ChangeLog (Arbeitskopie) @@ -1,3 +1,9 @@ +2014-08-31 Fritz Reese reese-fr...@zai.com + Tobias Burnus bur...@net-b.de + + PR fortran/62309 + * gcc/testsuite/gfortran.dg/auto_save_2.f90: New. + 2014-08-31 Tobias Burnus bur...@net-b.de * gfortran.dg/coarray_lib_comm_1.f90: New. Index: gcc/testsuite/gfortran.dg/auto_save_2.f90 === --- gcc/testsuite/gfortran.dg/auto_save_2.f90 (Revision 0) +++ gcc/testsuite/gfortran.dg/auto_save_2.f90 (Arbeitskopie) @@ -0,0 +1,84 @@ +! { dg-do run } +! { dg-options -fno-automatic -finit-local-zero -fdump-tree-original } +! +! PR fortran/62309 +! +! Make sure variables are saved with -fno-automatic except in +! functions marked RECURSIVE, and that they are still initialized with +! -finit-local-zero. +! + +function f (x) +implicit none + integer f, x + integer a ! should be SAVEd + a = a + x ! should increment by y every time + f = a + return +endfunction + +function f2 (x) +implicit none + integer f2, x + block + named: block +block +integer a ! should be SAVEd +a = a + x ! should increment by y every time +f2 = a +end block + end block named + end block + return +endfunction + +recursive function g (x) +implicit none + integer g, x + integer b ! should be automatic + b = b + x ! should be set to y every time + g = b + return +endfunction + +recursive function g2 (x) +implicit none + integer g2, x + block + named: block +block +integer b ! should be automatic +b = b + x ! should be set to y every time +g2 = b +end block + end block named + end block + return +endfunction + +implicit none +integer f, f2, g, g2 + +! Should return static value of a; accumulates y +if ( f(3) .ne. 3 ) call abort () +if ( f(4) .ne. 7 ) call abort () +if ( f(2) .ne. 9 ) call abort () + +if ( f2(3) .ne. 3 ) call abort () +if ( f2(4) .ne. 7 ) call abort () +if ( f2(2) .ne. 9 ) call abort () + +! Should return automatic value of a; equal to y each time +if ( g(3) .ne. 3 ) call abort () +if ( g(4) .ne. 4 ) call abort () +if ( g(2) .ne. 2 ) call abort () + +if ( g2(3) .ne. 3 ) call abort () +if ( g2(4) .ne. 4 ) call abort () +if ( g2(2) .ne. 2 ) call abort () +
Re: [PATCH, Fortran] -fno-automatic with -finit-local prevents initialization of automatics in recursive functions
On Mon, Sep 01, 2014 at 12:28:39AM +0200, Tobias Burnus wrote: Fritz Reese wrote: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62309 It seems with gcc-4.8.3 -fno-automatic prevents initializers from being applied to automatic variables. [...] According to gfortran's manual page, -fno-automatic should Treat each program unit (except those marked as RECURSIVE) as if the SAVE statement were specified for every local variable [...]. As far as I can tell, -finit-local-zero should still initialize automatic variables in RECURSIVE functions. I believe this is a simple fix; to actually follow the specification set forth in the man page, don't treat symbols in a RECURSIVE namespace as if they are saved in resolve.c (apply_default_init_local): (large snip) +implicit none + integer f, x + integer a ! should be SAVEd + a = a + x ! should increment by y every time a is undefined on the RHS. Relying a compiler option to make the code conforming is rather dubious. I'd rather see an error here; even if the user uses a option because the user is too lazy to write conforming code. + f = a + return +endfunction + +function f2 (x) +implicit none + integer f2, x + block + named: block +block +integer a ! should be SAVEd +a = a + x ! should increment by y every time +f2 = a a is undefined on the RHS and this should elicit an error. PS: the comment is wrong as there is no y. +end block + end block named + end block + return +endfunction + +recursive function g (x) +implicit none + integer g, x + integer b ! should be automatic + b = b + x ! should be set to y every time b is undefined on the RHS and this should elicit an error. PS: the comment is wrong as there is no y. The -finit-* option were implemented for compatibility with g77 and to allow the compilation of dusty deck code. New code should be written to conform to the standard. -- Steve
[BUILDROBOT][PATCH] mcore-elf: Fix bad declaration
Hi! This patch fixes a non-matching declaration, which lets G++ 4.8.1 (as of Debian's g++ package) barf: g++ -c -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common -DHAVE_CONFIG_H -I. -I. -I/home/vaxbuild/repos/gcc/gcc -I/home/vaxbuild/repos/gcc/gcc/. -I/home/vaxbuild/repos/gcc/gcc/../include -I/home/vaxbuild/repos/gcc/gcc/../libcpp/include -I/home/vaxbuild/repos/gcc/gcc/../libdecnumber -I/home/vaxbuild/repos/gcc/gcc/../libdecnumber/dpd -I../libdecnumber -I/home/vaxbuild/repos/gcc/gcc/../libbacktrace-o mcore.o -MT mcore.o -MMD -MP -MF ./.deps/mcore.TPo /home/vaxbuild/repos/gcc/gcc/config/mcore/mcore.c /home/vaxbuild/repos/gcc/gcc/config/mcore/mcore.c: In function ‘const char* output_inline_const(machine_mode, rtx_def**)’: /home/vaxbuild/repos/gcc/gcc/config/mcore/mcore.c:1216:82: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 5 has type ‘long long int’ [-Wformat=] sprintf (buf, %s\n\tnot\t%s\t// %ld 0x%lx, load_op, dst_fmt, value, value); ^ /home/vaxbuild/repos/gcc/gcc/config/mcore/mcore.c:1216:82: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 6 has type ‘long long int’ [-Wformat=] /home/vaxbuild/repos/gcc/gcc/config/mcore/mcore.c:1219:87: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 5 has type ‘long long int’ [-Wformat=] sprintf (buf, %s\n\taddi\t%s,%%2\t// %ld 0x%lx, load_op, dst_fmt, value, value); ^ /home/vaxbuild/repos/gcc/gcc/config/mcore/mcore.c:1219:87: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 6 has type ‘long long int’ [-Wformat=] /home/vaxbuild/repos/gcc/gcc/config/mcore/mcore.c:1222:87: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 5 has type ‘long long int’ [-Wformat=] sprintf (buf, %s\n\tsubi\t%s,%%2\t// %ld 0x%lx, load_op, dst_fmt, value, value); ^ /home/vaxbuild/repos/gcc/gcc/config/mcore/mcore.c:1222:87: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 6 has type ‘long long int’ [-Wformat=] /home/vaxbuild/repos/gcc/gcc/config/mcore/mcore.c:1226:88: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 5 has type ‘long long int’ [-Wformat=] sprintf (buf, %s\n\trsubi\t%s,%%2\t// %ld 0x%lx, load_op, dst_fmt, value, value); ^ /home/vaxbuild/repos/gcc/gcc/config/mcore/mcore.c:1226:88: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 6 has type ‘long long int’ [-Wformat=] /home/vaxbuild/repos/gcc/gcc/config/mcore/mcore.c:1229:89: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 5 has type ‘long long int’ [-Wformat=] sprintf (buf, %s\n\tbseti\t%s,%%P2\t// %ld 0x%lx, load_op, dst_fmt, value, value); ^ /home/vaxbuild/repos/gcc/gcc/config/mcore/mcore.c:1229:89: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 6 has type ‘long long int’ [-Wformat=] /home/vaxbuild/repos/gcc/gcc/config/mcore/mcore.c:1232:89: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 5 has type ‘long long int’ [-Wformat=] sprintf (buf, %s\n\tbclri\t%s,%%Q2\t// %ld 0x%lx, load_op, dst_fmt, value, value); ^ /home/vaxbuild/repos/gcc/gcc/config/mcore/mcore.c:1232:89: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 6 has type ‘long long int’ [-Wformat=] /home/vaxbuild/repos/gcc/gcc/config/mcore/mcore.c:1235:88: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 5 has type ‘long long int’ [-Wformat=] sprintf (buf, %s\n\trotli\t%s,%%2\t// %ld 0x%lx, load_op, dst_fmt, value, value); ^ /home/vaxbuild/repos/gcc/gcc/config/mcore/mcore.c:1235:88: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 6 has type ‘long long int’ [-Wformat=] /home/vaxbuild/repos/gcc/gcc/config/mcore/mcore.c:1238:87: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 5 has type ‘long long int’ [-Wformat=] sprintf (buf, %s\n\tlsli\t%s,%%2\t// %ld 0x%lx, load_op, dst_fmt, value, value);
RE: [PATCH] doc/generic.texi: Fix typo
On 9/1/2014 7:11 AM, Robert Dewar wrote: Seems a shame that anyone should need an explanation, but oh well :-) Sorry about that. I should have thought about it twice :) P.S. my favorite instance of this kind of documentation is an early IBM Fortran manual, which says that you should put exactly the character you want to see come out on the printer [in some context], e.g. an I for an I and a 2 for a 2. :-) Maybe I should learn something for that document :) Thanks, Honggyu
RE: [PATCH] doc/generic.texi: Fix typo
On 9/1/2014 5:50 AM, Gerald Pfeifer wrote: Since this now came up for the second time this year, I went ahead and applied the patch below. Thanks for the comment :) Honggyu
[PATCH] Add header guard to several header files.
Hi all: This patch is add header guard to several header files :) From 1647c5d3ee3a7e086f57863b2503d11c1a699f00 Mon Sep 17 00:00:00 2001 From: Kito Cheng kito.ch...@gmail.com Date: Fri, 22 Aug 2014 17:34:49 +0800 Subject: [PATCH] Add header guard to several header files. 2014-09-01 Kito Cheng k...@0xlab.org except.h: Fix header guard. addresses.h: Add missing header guard. cfghooks.h: Likewise. collect-utils.h: Likewise. collect2-aix.h: Likewise. conditions.h: Likewise. cselib.h: Likewise. dwarf2asm.h: Likewise. graphds.h: Likewise. graphite-scop-detection.h: Likewise. gsyms.h: Likewise. gsyslimits.h: Likewise. hw-doloop.h: Likewise. incpath.h: Likewise. ipa-inline.h: Likewise. ipa-ref.h: Likewise. ira-int.h: Likewise. ira.h: Likewise. lra-int.h: Likewise. lra.h: Likewise. lto-section-names.h: Likewise. read-md.h: Likewise. reload.h: Likewise. rtl-error.h: Likewise. sdbout.h: Likewise. target-def.h: Likewise. target-hooks-macros.h: Likewise. targhooks.h: Likewise. tree-affine.h: Likewise. xcoff.h: Likewise. xcoffout.h: Likewise. --- gcc/addresses.h | 5 + gcc/cfghooks.h| 4 gcc/collect-utils.h | 5 + gcc/collect2-aix.h| 4 gcc/conditions.h | 5 + gcc/cselib.h | 5 + gcc/dwarf2asm.h | 4 gcc/except.h | 5 +++-- gcc/graphds.h | 5 + gcc/graphite-scop-detection.h | 4 gcc/gsyms.h | 4 gcc/gsyslimits.h | 5 + gcc/hw-doloop.h | 5 + gcc/incpath.h | 5 + gcc/ipa-inline.h | 5 + gcc/ipa-ref.h | 5 + gcc/ira-int.h | 5 + gcc/ira.h | 5 + gcc/lra-int.h | 5 + gcc/lra.h | 5 + gcc/lto-section-names.h | 5 + gcc/read-md.h | 5 + gcc/reload.h | 4 gcc/rtl-error.h | 5 + gcc/sdbout.h | 5 + gcc/target-def.h | 5 + gcc/target-hooks-macros.h | 5 + gcc/targhooks.h | 5 + gcc/tree-affine.h | 5 + gcc/xcoff.h | 5 + gcc/xcoffout.h| 4 31 files changed, 146 insertions(+), 2 deletions(-) diff --git a/gcc/addresses.h b/gcc/addresses.h index e323b58..3f0089a 100644 --- a/gcc/addresses.h +++ b/gcc/addresses.h @@ -21,6 +21,9 @@ along with GCC; see the file COPYING3. If not see MODE_BASE_REG_REG_CLASS, MODE_BASE_REG_CLASS and BASE_REG_CLASS. Arguments as for the MODE_CODE_BASE_REG_CLASS macro. */ +#ifndef GCC_ADDRESSES_H +#define GCC_ADDRESSES_H + static inline enum reg_class base_reg_class (enum machine_mode mode ATTRIBUTE_UNUSED, addr_space_t as ATTRIBUTE_UNUSED, @@ -82,3 +85,5 @@ regno_ok_for_base_p (unsigned regno, enum machine_mode mode, addr_space_t as, return ok_for_base_p_1 (regno, mode, as, outer_code, index_code); } + +#endif /* GCC_ADDRESSES_H */ diff --git a/gcc/cfghooks.h b/gcc/cfghooks.h index 8ff808c..1b8587a 100644 --- a/gcc/cfghooks.h +++ b/gcc/cfghooks.h @@ -18,6 +18,9 @@ You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see http://www.gnu.org/licenses/. */ +#ifndef GCC_CFGHOOKS_H +#define GCC_CFGHOOKS_H + /* Only basic-block.h includes this. */ struct cfg_hooks @@ -221,3 +224,4 @@ extern void gimple_register_cfg_hooks (void); extern struct cfg_hooks get_cfg_hooks (void); extern void set_cfg_hooks (struct cfg_hooks); +#endif /* GCC_CFGHOOKS_H */ diff --git a/gcc/collect-utils.h b/gcc/collect-utils.h index 2989c6b..ba1985e 100644 --- a/gcc/collect-utils.h +++ b/gcc/collect-utils.h @@ -17,6 +17,9 @@ You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see http://www.gnu.org/licenses/. */ +#ifndef GCC_COLLECT_UTILS_H +#define GCC_COLLECT_UTILS_H + /* Provided in collect-utils.c. */ extern void notice (const char *, ...) __attribute__ ((format (printf, 1, 2))); @@ -42,3 +45,5 @@ extern const char tool_name[]; /* Called by utils_cleanup. */ extern void tool_cleanup (bool); extern void maybe_unlink (const char *); + +#endif /* GCC_COLLECT_UTILS_H */ diff --git a/gcc/collect2-aix.h b/gcc/collect2-aix.h index 953b877..40f855e 100644 --- a/gcc/collect2-aix.h +++ b/gcc/collect2-aix.h @@ -17,6 +17,8 @@ You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see http://www.gnu.org/licenses/. */ +#ifndef GCC_COLLECT2_AIX_H +#define GCC_COLLECT2_AIX_H /* collect2-aix.c requires mmap support. It should otherwise be fairly portable. */ #if defined(CROSS_DIRECTORY_STRUCTURE) \ @@ -300,3 +302,5 @@ extern int ldtbread (LDFILE *, long, SYMENT *); extern int ldclose (LDFILE *); #endif + +#endif
Re: [PATCH] GCC/test: Don't try ARM cortex-M check on non-ARM
On Aug 29, 2014, at 5:04 PM, Maciej W. Rozycki ma...@codesourcery.com wrote: Executing on host: powerpc-linux-gnu-gcc arm_cortex_m25641.c -fno-diagnostics-show-caret -fdiagnostics-color=never -mthumb -S -o arm_cortex_m25641.s(timeout = 300) OK to apply? Ok.
Re: [PATCH] Add header guard to several header files.
Oops, ChangeLog here: ChangeLog 2014-09-01 Kito Cheng k...@0xlab.org except.h: Fix header guard. addresses.h: Add missing header guard. cfghooks.h: Likewise. collect-utils.h: Likewise. collect2-aix.h: Likewise. conditions.h: Likewise. cselib.h: Likewise. dwarf2asm.h: Likewise. graphds.h: Likewise. graphite-scop-detection.h: Likewise. gsyms.h: Likewise. gsyslimits.h: Likewise. hw-doloop.h: Likewise. incpath.h: Likewise. ipa-inline.h: Likewise. ipa-ref.h: Likewise. ira-int.h: Likewise. ira.h: Likewise. lra-int.h: Likewise. lra.h: Likewise. lto-section-names.h: Likewise. read-md.h: Likewise. reload.h: Likewise. rtl-error.h: Likewise. sdbout.h: Likewise. target-def.h: Likewise. target-hooks-macros.h: Likewise. targhooks.h: Likewise. tree-affine.h: Likewise. xcoff.h: Likewise. xcoffout.h: Likewise. On Mon, Sep 1, 2014 at 9:58 AM, Kito Cheng kito.ch...@gmail.com wrote: Hi all: This patch is add header guard to several header files :)
[PATCH] Add missing size directive for arm-*-elf
Hi all: In arm-*-elf target some variable will missing size directive, for example: foo.c: void foo (void) { static char bufbuf[8]; } $ arm-none-eabi-gcc ./foo.c -S -o - ... .align 2 bufbuf.4078: .space 8 ... .ident GCC: (GNU) 5.0.0 20140828 (experimental) And then the size info will missing: $ arm-none-eabi-objdump ./foo.o -t ./foo.o: file format elf32-littlearm SYMBOL TABLE: ldf *ABS* zoo.c ld .text .text ld .data .data ld .bss .bss l .bss 0008 bufbuf.4078 ld .comment .comment ld .ARM.attributes .ARM.attributes g F .text 0018 foo ChangeLog 2014-09-01 Kito Cheng k...@0xlab.org * config/arm/unknown-elf.h (ASM_OUTPUT_ALIGNED_DECL_LOCAL): Add size directive. From e0034653a4d457708fc4d858ea20fab70a42d798 Mon Sep 17 00:00:00 2001 From: Kito Cheng kito.ch...@gmail.com Date: Mon, 1 Sep 2014 11:19:13 +0800 Subject: [PATCH] Add missing size directive for arm-elf ChangeLog 2014-09-01 Kito Cheng k...@0xlab.org * config/arm/unknown-elf.h (ASM_OUTPUT_ALIGNED_DECL_LOCAL): Add size directive. --- gcc/config/arm/unknown-elf.h | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/config/arm/unknown-elf.h b/gcc/config/arm/unknown-elf.h index 56aa166..b4d1757 100644 --- a/gcc/config/arm/unknown-elf.h +++ b/gcc/config/arm/unknown-elf.h @@ -81,6 +81,7 @@ ASM_OUTPUT_ALIGN (FILE, floor_log2 (ALIGN / BITS_PER_UNIT)); \ ASM_OUTPUT_LABEL (FILE, NAME); \ fprintf (FILE, \t.space\t%d\n, SIZE ? (int)(SIZE) : 1); \ + ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, SIZE); \ } \ while (0) -- 1.9.3
Re: [PATCH PR62151]Fix uninitialized register issue caused by distribute_notes in combine pass
On Sun, Aug 31, 2014 at 8:18 PM, Segher Boessenkool seg...@kernel.crashing.org wrote: On Fri, Aug 29, 2014 at 11:58:37PM -0600, Jeff Law wrote: One could argue that this mess is a result of trying to optimize a reg that is set more than once.Though I guess that might be a bit of a big hammer. It works fine in other cases, and is quite beneficial for e.g. optimising instruction sequences that set a fixed carry register twice. In the testcase (and comment in the proposed patch), why is combine combining four insns at all? That means it rejected combining just the first three. Why did it do that? It is explicitly reject by below code in can_combine_p. if (GET_CODE (PATTERN (i3)) == PARALLEL) for (i = XVECLEN (PATTERN (i3), 0) - 1; i = 0; i--) if (GET_CODE (XVECEXP (PATTERN (i3), 0, i)) == CLOBBER) { /* Don't substitute for a register intended as a clobberable operand. */ rtx reg = XEXP (XVECEXP (PATTERN (i3), 0, i), 0); if (rtx_equal_p (reg, dest)) return 0; Since insn i2 in the list of i0/i1/i2 as below contains parallel clobber of dest_of_insn76/use_of_insn77. 32: r84:SI=0 76: flags:CC=cmp(r84:SI,0x1) REG_DEAD r84:SI 77: {r84:SI=-ltu(flags:CC,0);clobber flags:CC;} REG_DEAD flags:CC REG_UNUSED flags:CC Thanks, bin
Re: [PATCH PR62151]Fix uninitialized register issue caused by distribute_notes in combine pass
On Sat, Aug 30, 2014 at 1:58 PM, Jeff Law l...@redhat.com wrote: On 08/27/14 23:04, Bin.Cheng wrote: On Wed, Aug 27, 2014 at 6:34 PM, Richard Earnshaw rearn...@arm.com wrote: On 27/08/14 11:08, Bin Cheng wrote: Hi As reported in bug pr62151, combine pass may wrongly delete necessary instruction in function distribute_notes thus leaving register uninitialized. This patch is to fix the issue by checking if i2 immediately modifies the register in REG_DEAD note. If yes, set tem_insn accordingly to start finding right place for note distribution from i2. I once sent a RFC patch at https://gcc.gnu.org/ml/gcc-patches/2014-08/msg01718.html, but got no comments, here I added some comments in this patch to make it a formal one. I tested the original patch, and will re-test it against the latest code later. So is it OK? Any comments will be appreciated. Isn't this the sort of sequence that combinable_i3pat is supposed to reject? Hi Richard, I think it's not. combinable_i3pat checks cases in which i1 feeds to i3 directly, while i2 kills reg_use in i1. For this case the feeding chain is i0-i1-i2-i3, the combination is valid and beneficial. What needs to be handled is if i2dest is anticipated after i3. If not, then i2 could be deleted; if yes, i2 should be preserved. Moreover, following constant propagation could delete i2 after propagating the new i2src into i4. Note combine pass already handles this kind of case using variable added_sets_2 in function try_combine. The problem is in distribute_notes which mis-deleted i2. I added one test case in the updated patch. Hi Jeff, Thanks very much for the review. One could argue that this mess is a result of trying to optimize a reg that is set more than once.Though I guess that might be a bit of a big hammer. As noted by Segher, it's a quite useful optimization which we don't want to disable. I haven't thought real hard, but isn't it the case that for a pseudo with multiple sets that we never want to move a REG_DEAD note across a set of that pseudo? It would seem that in these cases we want to drop the REG_DEAD note completely. Note that i0..i4 need not be consecutive insns, so you'd have to walk the chain from the location with the death note to the proposed death note site. If between those locations there's another set of the same pseudo, then drop the note. Since this may be an expensive check it should probably be conditionalized on REG_N_SETS (pseudo) 1 Here is the complicated part. The from_insn is i1, i2/i3 are the following instructions. The original logic seems to me is scanning from i3 for one insn for distribution of REG_DEAD note in from_insn. Since the last use is in from_insn, it makes no sense to scan from i3 (after from_insn). What we need to do is scanning from from_insn in backward trying to find a place for note distribution. If we run into a useless set of the note reg, we can just delete that insn or add REG_UNUSED to it. It just seems not right to do this on instructions after from_insn, which causes the wrong code in this specific case. Any comments? Thanks, bin