[wwwdocs] nds32 documentation - remove broken reference

2019-07-28 Thread Gerald Pfeifer
I could not find an updated link on www.andestech.com, in fact the
reference I could find there was broken as well.

If anyone has an update link, happy to add that again!

Applied for now.

Gerald

Index: readings.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/readings.html,v
retrieving revision 1.315
diff -u -r1.315 readings.html
--- readings.html   19 Jun 2019 20:27:02 -  1.315
+++ readings.html   28 Jul 2019 08:52:46 -
@@ -70,7 +70,6 @@
  andes (nds32)
   Manufacturer: Various licenses of Andes Technology Corporation.
   CPUs include: AndesCore families N7, N8, SN8, N9, N10, N12 and N13.
-  http://www.andestech.com/product.php?cls=9";>Andes 
Documentation
   GDB includes a simulator for all CPUs.
  
 


[libstdc++,doc]

2019-07-28 Thread Gerald Pfeifer
www.stack.nl/~dimitri/doxygen started to return "403 Forbidden" a 
while ago. Let's hope that www.doxygen.nl stays in place for a while
now; it's getting a little annoying chase those Doxygen URLs.

On the way I rewrote one reference to avoid a "here" link, which 
are recommended against from a usability perspective (and also do
not help search engines).

Committed.

Gerald

2019-07-28  Gerald Pfeifer  

* doc/xml/manual/documentation_hacking.xml: Fix broken reference
to the Doxygen manual. Avoid a "here" link on the way.
Fix another broken link to Doxygen docblocks.

Index: doc/xml/manual/documentation_hacking.xml
===
--- doc/xml/manual/documentation_hacking.xml(revision 273851)
+++ doc/xml/manual/documentation_hacking.xml(working copy)
@@ -445,9 +445,10 @@
 
   
Adding Doxygen markup to a file (informally called
-   doxygenating) is very simple. The Doxygen manual can be
-   found
-   http://www.w3.org/1999/xlink"; 
xlink:href="http://www.stack.nl/~dimitri/doxygen/download.html#latestman";>here.
+   doxygenating) is very simple. See the
+   http://www.w3.org/1999/xlink"; 
+ xlink:href="http://www.doxygen.nl/download.html#latestman";>Doxygen
+ manual for details.
We try to use a very-recent version of Doxygen.
   
 
@@ -463,7 +464,8 @@
 
   
Some commentary to accompany
-   the first list in the http://www.w3.org/1999/xlink"; 
xlink:href="http://www.stack.nl/~dimitri/doxygen/manual/docblocks.html";>Special
+   the first list in the http://www.w3.org/1999/xlink";
+xlink:href="http://www.doxygen.nl/manual/docblocks.html";>Special
Documentation Blocks section of the Doxygen manual:
   
 


Re: [RS6000] Make assembler command line cpu match default for gcc

2019-07-28 Thread Alan Modra
On Sat, Jul 27, 2019 at 01:22:57PM -0500, Segher Boessenkool wrote:
> On Sat, Jul 27, 2019 at 02:56:23PM +0930, Alan Modra wrote:
> > The patch also introduces ASM_DEFAULT_EXTRA for the altivec variant
> > targets so as to enable -maltivec by default.
> 
> That is a behaviour change I think?  I don't know if it is correct...

This -maltivec is the one passed to the assembler, so no real gcc
behaviour change.

> It doesn't by default use -mabi=altivec as well, for example?
> 
> > Bootstrapped and regression tested powerpc64le-linux, and a number of
> > powerpc variants built to inspect flags passed to the assembler.  OK
> > for mainline?
> 
> Did you try with those *altivec targets as well?  Well I guess you did,
> or why else did you do this change?

Actually I spotted the need for a fix by grepping over the sources,
but I did build a powerpc-linuxaltivec target.

-- 
Alan Modra
Australia Development Lab, IBM


Re: [RS6000] Make assembler command line cpu match default for gcc

2019-07-28 Thread Segher Boessenkool
On Sun, Jul 28, 2019 at 07:01:32PM +0930, Alan Modra wrote:
> On Sat, Jul 27, 2019 at 01:22:57PM -0500, Segher Boessenkool wrote:
> > On Sat, Jul 27, 2019 at 02:56:23PM +0930, Alan Modra wrote:
> > > The patch also introduces ASM_DEFAULT_EXTRA for the altivec variant
> > > targets so as to enable -maltivec by default.
> > 
> > That is a behaviour change I think?  I don't know if it is correct...
> 
> This -maltivec is the one passed to the assembler, so no real gcc
> behaviour change.

Ah oh right, that is fine then of course, and I need more coffee :-)

Thanks,


Segher


Re: Subject: [PATCH] [PR 89330] Remove non-useful speculations from new_edges

2019-07-28 Thread Rainer Orth
Hi Martin,

> the following patch prevents the call speculation machinery from
> deallocating call graph edges from under the indirect inlining machinery
> and it also fixes a potential issue in speculation which could in some
> cases undo an earlier inlining decision, something that the inliner is
> not built to expect.
>
> That latter change requires disabling speculation on a testcase through
> adding -fno-profile-values, otherwise a devirtualziation happens before
> it is dump-scanned for.
>
> Bootstrapped and tested on an x86_64-linux, OK for trunk?
[...]
> 2019-07-25  Martin Jambor  
>
>   PR ipa/89330
>   * ipa-inline-transform.c (check_speculations_1): New function.
>   (push_all_edges_in_set_to_vec): Likewise.
>   (check_speculations): Use check_speculations_1, new parameter
>   new_edges.
>   (inline_call): Pass new_edges to check_speculations.
>   * ipa-inline.c (add_new_edges_to_heap): Assert edge_callee is not
>   NULL.
>   (speculation_useful_p): Early return true if edge is inlined, remove
>   later checks for inline_failed.
>
>   testsuite/
>   * g++.dg/lto/pr89330_[01].C: New test.

the new test FAILs on Solaris:

+FAIL: g++.dg/lto/pr89330 cp_lto_pr89330_0.o-cp_lto_pr89330_1.o link,  -O3 -g 
-flto -shared -Wno-odr 

Text relocation remains referenced
against symbol  offset  in file
Inkscape::XML::Node::root() 0x9ccp_lto_pr89330_1.o
virtual thunk to Inkscape::XML::SimpleNode::name() const 0x6c   
cp_lto_pr89330_1.o
Inkscape::XML::Node::parent()   0xa4cp_lto_pr89330_1.o
Inkscape::XML::Node::document() const 0x98  cp_lto_pr89330_1.o
Inkscape::XML::Node::next() 0xaccp_lto_pr89330_1.o
[...]
Inkscape::XML::Node::code() 0x70cp_lto_pr89330_1.o
Inkscape::XML::SimpleNode::name() const 0xc cp_lto_pr89330_1.o
Inkscape::XML::Node::document() 0x94cp_lto_pr89330_1.o
ld: fatal: relocations remain against allocatable but non-writable sections
collect2: error: ld returned 1 exit status

This happens because ld defaults to -z text here and can easily be
avoided by compiling the code as PIC.

This is what the following patch does.  Tested on i386-pc-solaris2.11,
sparc-sun-solaris2.11, and x86_64-pc-linux-gnu, installed on mainline.

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


2019-07-28  Rainer Orth  

* g++.dg/lto/pr89330_0.C (dg-lto-options): Add -fPIC.
Require fpic support.

# HG changeset patch
# Parent  d121877e3d1d53929c62025b84c0a4a357901a96
Fix g++.dg/lto/pr89330 on Solaris

diff --git a/gcc/testsuite/g++.dg/lto/pr89330_0.C b/gcc/testsuite/g++.dg/lto/pr89330_0.C
--- a/gcc/testsuite/g++.dg/lto/pr89330_0.C
+++ b/gcc/testsuite/g++.dg/lto/pr89330_0.C
@@ -1,5 +1,6 @@
 // { dg-lto-do link }
-// { dg-lto-options { { -O3 -g -flto -shared -Wno-odr } } }
+// { dg-lto-options { { -O3 -g -flto -shared -fPIC -Wno-odr } } }
+// { dg-require-effective-target fpic }
 
 namespace Inkscape {
 class Anchored {};


[doc] Use https for www.gnu.org (doc/include/gpl_v3.texi)

2019-07-28 Thread Gerald Pfeifer
Applied.

Gerald

2019-07-28  Gerald Pfeifer  

* doc/include/gpl_v3.texi (Copying): Use https for www.gnu.org.

Index: doc/include/gpl_v3.texi
===
--- doc/include/gpl_v3.texi (revision 273850)
+++ doc/include/gpl_v3.texi (working copy)
@@ -729,5 +729,5 @@ program into proprietary programs.  If your progra
 library, you may consider it more useful to permit linking proprietary
 applications with the library.  If this is what you want to do, use
 the GNU Lesser General Public License instead of this License.  But
-first, please read @url{http://www.gnu.org/philosophy/why-not-lgpl.html}.
+first, please read @url{https://www.gnu.org/philosophy/why-not-lgpl.html}.
 @c man end


[PATCH] Remove also 2nd argument for unused delete operator (PR tree-optimization/91270).

2019-07-28 Thread Martin Liška

Hi.

And there's one more patch that deals with delete operator
which has a second argument (size). That definition GIMPLE
statement of the size must be also properly marked.

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

Ready to be installed?
Thanks,
Martin
>From 3d69c779ad5de447cd5ddba2595d2b1586dc5d3c Mon Sep 17 00:00:00 2001
From: Martin Liska 
Date: Sun, 28 Jul 2019 13:04:28 +0200
Subject: [PATCH] Remove also 2nd argument for unused delete operator (PR
 tree-optimization/91270).

gcc/ChangeLog:

2019-07-28  Martin Liska  

	PR tree-optimization/91270
	* tree-ssa-dce.c (eliminate_unnecessary_stmts): Delete also 2nd
	argument of a delete operator.

gcc/testsuite/ChangeLog:

2019-07-28  Martin Liska  

	PR tree-optimization/91270
	* g++.dg/torture/pr91270.C: New test.
---
 gcc/testsuite/g++.dg/torture/pr91270.C | 10 ++
 gcc/tree-ssa-dce.c | 14 ++
 2 files changed, 24 insertions(+)
 create mode 100644 gcc/testsuite/g++.dg/torture/pr91270.C

diff --git a/gcc/testsuite/g++.dg/torture/pr91270.C b/gcc/testsuite/g++.dg/torture/pr91270.C
new file mode 100644
index 000..60d766e9e9f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr91270.C
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+
+struct S {
+  ~S();
+};
+int a = 123;
+void fn1() {
+  S *s = new S[a];
+  delete[] s;
+}
diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c
index cf507fa0453..e5a1a9b7aa3 100644
--- a/gcc/tree-ssa-dce.c
+++ b/gcc/tree-ssa-dce.c
@@ -1294,6 +1294,20 @@ eliminate_unnecessary_stmts (void)
 		  && !gimple_plf (def_stmt, STMT_NECESSARY))
 		gimple_set_plf (stmt, STMT_NECESSARY, false);
 		}
+
+	  /* Some delete operators have 2 arguments, where
+		 the second argument is size of the deallocated memory.  */
+	  if (gimple_call_num_args (stmt) == 2)
+		{
+		  tree ptr = gimple_call_arg (stmt, 1);
+		  if (TREE_CODE (ptr) == SSA_NAME)
+		{
+		  gimple *def_stmt = SSA_NAME_DEF_STMT (ptr);
+		  if (!gimple_nop_p (def_stmt)
+			  && !gimple_plf (def_stmt, STMT_NECESSARY))
+			gimple_set_plf (stmt, STMT_NECESSARY, false);
+		}
+		}
 	}
 
 	  /* If GSI is not necessary then remove it.  */
-- 
2.22.0



[patch, fortran] Fix PR 90813

2019-07-28 Thread Thomas Koenig

Hello world,

the attached patch fixes PR 90813, a regression with proc pointers.
The problem was quite complex, and I'd like to thank the people
who helped debug this; the most important clue came from Richard.

The problem was that, for a procedure pointer variable declared
in a module in the same file, we were using a different backend
decl in the module than in the main program. This led to the
later parts of the compiler to think that the procedure pointer
was actually two variables which could not alias.  Optimization
on some architectures such as Aarch64 and POWER (but not
on x86_64) then led to reordering of stores, leading to a segfault.

The solution is to put the mangled names into the global
variable table, and to look for it when getting its backend
declaration.

While debugging it, I also put in an option to dump the global
symbol table to standard output.  I have included this in this
patch because I think this may not be the last bug in that
area :-)

Regression-tested on powerpc64le-unknown-linux-gnu, where the
segfault showed up.  No test case because is is already
in the test suite. Doc changes checked with "make dvi" and
"make pdf".

OK for trunk?

Regards

Thomas
2019-07-28  Thomas Koenig  

PR fortran/90813
* dump-parse-tree.c (show_global_symbol): New function.
(gfc_dump_global_symbols): New function.
* gfortran.h (gfc_traverse_gsymbol): Add prototype.
(gfc_dump_global_symbols): Likewise.
* invoke.texi: Document -fdump-fortran-global.
* lang.opt: Add -fdump-fortran-global.
* parse.c (gfc_parse_file): Handle flag_dump_fortran_global.
* symbol.c (gfc_traverse_gsymbol): New function.
* trans-decl.c (sym_identifier): New function.
(mangled_identifier): New function, doing most of the work
of gfc_sym_mangled_identifier.
(gfc_sym_mangled_identifier): Use mangled_identifier.  Add mangled
identifier to global symbol table.
(get_proc_pointer_decl): Use backend decl from global identifier
if present.
Index: dump-parse-tree.c
===
--- dump-parse-tree.c	(Revision 273855)
+++ dump-parse-tree.c	(Arbeitskopie)
@@ -3462,3 +3462,36 @@ write_interop_decl (gfc_symbol *sym)
   else if (sym->attr.flavor == FL_PROCEDURE)
 write_proc (sym, true);
 }
+
+/* This section deals with dumping the global symbol tree.  */
+
+/* Callback function for printing out the contents of the tree.  */
+
+static void
+show_global_symbol (gfc_gsymbol *gsym, void *f_data)
+{
+  FILE *out;
+  out = (FILE *) f_data;
+
+  if (gsym->name)
+fprintf (out, "name=%s", gsym->name);
+
+  if (gsym->sym_name)
+fprintf (out, ", sym_name=%s", gsym->sym_name);
+
+  if (gsym->mod_name)
+fprintf (out, ", mod_name=%s", gsym->mod_name);
+
+  if (gsym->binding_label)
+fprintf (out, ", binding_label=%s", gsym->binding_label);
+
+  fputc ('\n', out);
+}
+
+/* Show all global symbols.  */
+
+void
+gfc_dump_global_symbols (FILE *f)
+{
+  gfc_traverse_gsymbol (gfc_gsym_root, show_global_symbol, (void *) f);
+}
Index: gfortran.h
===
--- gfortran.h	(Revision 273855)
+++ gfortran.h	(Arbeitskopie)
@@ -3128,6 +3128,7 @@ void gfc_enforce_clean_symbol_state (void);
 gfc_gsymbol *gfc_get_gsymbol (const char *, bool bind_c);
 gfc_gsymbol *gfc_find_gsymbol (gfc_gsymbol *, const char *);
 gfc_gsymbol *gfc_find_case_gsymbol (gfc_gsymbol *, const char *);
+void gfc_traverse_gsymbol (gfc_gsymbol *, void (*)(gfc_gsymbol *, void *), void *);
 
 gfc_typebound_proc* gfc_get_typebound_proc (gfc_typebound_proc*);
 gfc_symbol* gfc_get_derived_super_type (gfc_symbol*);
@@ -3471,6 +3472,7 @@ void gfc_delete_bbt (void *, void *, compare_fn);
 void gfc_dump_parse_tree (gfc_namespace *, FILE *);
 void gfc_dump_c_prototypes (gfc_namespace *, FILE *);
 void gfc_dump_external_c_prototypes (FILE *);
+void gfc_dump_global_symbols (FILE *);
 
 /* parse.c */
 bool gfc_parse_file (void);
Index: invoke.texi
===
--- invoke.texi	(Revision 273855)
+++ invoke.texi	(Arbeitskopie)
@@ -157,7 +157,8 @@ and warnings}.
 @item Debugging Options
 @xref{Debugging Options,,Options for debugging your program or GNU Fortran}.
 @gccoptlist{-fbacktrace -fdump-fortran-optimized -fdump-fortran-original @gol
--fdump-parse-tree -ffpe-trap=@var{list} -ffpe-summary=@var{list}
+-fdump-fortran-global -fdump-parse-tree -ffpe-trap=@var{list} @gol
+-ffpe-summary=@var{list}
 }
 
 @item Directory Options
@@ -1199,6 +1200,14 @@ change between releases. This option may also gene
 compiler errors for features which have only recently been added. This
 option is deprecated; use @code{-fdump-fortran-original} instead.
 
+@item -fdump-fortran-global
+@opindex @code{fdump-fortran-global}
+Output a list of the global identifiers after translating into
+middle-end representation. Mos

[PATCH] PR fortran/88227 -- Revenge of the BOZ

2019-07-28 Thread Steve Kargl
The attach patch fixes a problem with the conversion of a
BOZ literal constant to a REAL where the size of the REAL
exceeds the size of the largest INTEGER.  The problem can
be seen on 32-bit targets that provide support for REAL(10)
and/or REAL(16), or it can be seen with a multilib target
when using -m32 and REAL(10) and/or REAL(16).

If needed, the patch converts an octal or hexidecimal string
to the equivalent binary string, and then converts the binary
string to a REAL.  In principle, bin2real() can convert to 
REAL(4), REAL(8), REAL(10), and REAL(16), but I have elected
to use the old conversion method if the size of the largest
INTEGER exceeds the size the REAL(XXX) of interest.  A future
patch may remove the old method and make this new approach the
only way to convert a BOZ.

I have attached a short test program.  There is no testcase
for testsuite.

PLEASE TEST.

2019-07-28  Steven G. Kargl  

PR fortran/88227
* check.c (oct2bin):  New function.  Convert octal string to binary.
(hex2bin): New function.  Convert hexidecimal string to binary.
(bin2real): New function.  Convert binary string to REAL.  Use
oct2bin and hex2bin.
(gfc_boz2real):  Use fallback conversion bin2real.

-- 
Steve
Index: gcc/fortran/check.c
===
--- gcc/fortran/check.c	(revision 273766)
+++ gcc/fortran/check.c	(working copy)
@@ -55,6 +55,7 @@ gfc_invalid_boz (const char *msg, locus *loc)
 
 
 /* Issue an error for an illegal BOZ argument.  */
+
 static bool
 illegal_boz_arg (gfc_expr *x)
 {
@@ -101,6 +102,167 @@ is_boz_constant (gfc_expr *a)
 }
 
 
+/* Convert a octal string into a binary string.  This is used in the
+   fallback conversion of an octal string to a REAL.  */
+
+static char *
+oct2bin(int nbits, char *oct)
+{
+  const char bits[8][5] = {
+"000", "001", "010", "011", "100", "101", "110", "111"};
+
+  char *buf, *bufp;
+  int i, j, n;
+
+  j = nbits + 1;
+  if (nbits == 64) j++;
+
+  bufp = buf = XCNEWVEC (char, j + 1);
+  memset (bufp, 0, j + 1);
+
+  n = strlen (oct);
+  for (i = 0; i < n; i++, oct++)
+{
+  j = *oct - 48;
+  strcpy (bufp, &bits[j][0]);
+  bufp += 3;
+}
+
+  bufp = XCNEWVEC (char, nbits + 1);
+  if (nbits == 64)
+strcpy (bufp, buf + 2);
+  else
+strcpy (bufp, buf + 1);
+
+  free (buf);
+
+  return bufp;
+}
+
+
+/* Convert a hexidecimal string into a binary string.  This is used in the
+   fallback conversion of a hexidecimal string to a REAL.  */
+
+static char *
+hex2bin(int nbits, char *hex)
+{
+  const char bits[16][5] = {
+"", "0001", "0010", "0011", "0100", "0101", "0110", "0111",
+"1000", "1001", "1010", "1011", "1100", "1101", "1110", ""};
+
+  char *buf, *bufp;
+  int i, j, n;
+
+  bufp = buf = XCNEWVEC (char, nbits + 1);
+  memset (bufp, 0, nbits + 1);
+
+  n = strlen (hex);
+  for (i = 0; i < n; i++, hex++)
+{
+  j = *hex;
+  if (j > 47 && j < 58)
+ j -= 48;
+  else if (j > 64 && j < 71)
+ j -= 55;
+  else if (j > 96 && j < 103)
+ j -= 87;
+  else
+ gcc_unreachable ();
+
+  strcpy (bufp, &bits[j][0]);
+  bufp += 4;
+   }
+
+   return buf;
+}
+
+
+/* Fallback conversion of a BOZ string to REAL.  */
+
+static void
+bin2real (gfc_expr *x, int kind)
+{
+  char buf[114], *sp;
+  int b, i, ie, t, w;
+  bool sgn;
+  mpz_t em;
+
+  i = gfc_validate_kind (BT_REAL, kind, false);
+  t = gfc_real_kinds[i].digits - 1;
+
+  /* Number of bits in the exponent.  */
+  if (gfc_real_kinds[i].max_exponent == 16384)
+w = 15;
+  else if (gfc_real_kinds[i].max_exponent == 1024)
+w = 11;
+  else
+w = 8;
+
+  if (x->boz.rdx == 16)
+sp = hex2bin (gfc_real_kinds[i].mode_precision, x->boz.str);
+  else if (x->boz.rdx == 8)
+sp = oct2bin (gfc_real_kinds[i].mode_precision, x->boz.str);
+  else
+sp = x->boz.str;
+
+  /* Extract sign bit. */
+  sgn = *sp != '0';
+
+  /* Extract biased exponent. */
+  memset (buf, 0, 114);
+  strncpy (buf, ++sp, w);
+  mpz_init (em);
+  mpz_set_str (em, buf, 2);
+  ie = mpz_get_si (em);
+
+  mpfr_init2 (x->value.real, t + 1);
+  x->ts.type = BT_REAL;
+  x->ts.kind = kind;
+
+  sp += w;		/* Set to first digit in significand. */
+  b = (1 << w) - 1;
+  if ((i == 0 && ie == b) || (i == 1 && ie == b)
+  || ((i == 2 || i == 3) && ie == b))
+{
+  bool zeros = true;
+  if (i == 2) sp++;
+  for (; *sp; sp++)
+	{
+	  if (*sp != '0')
+	{
+	  zeros = false;
+	  break;
+	}
+	}
+
+  if (zeros)
+	mpfr_set_inf (x->value.real, 1);
+  else
+	mpfr_set_nan (x->value.real);
+}
+  else
+{
+  if (i == 2)
+	strncpy (buf, sp, t + 1);
+  else
+	{
+	  /* Significand with hidden bit. */
+ 	  buf[0] = '1';
+	  strncpy (&buf[1], sp, t);
+	}
+
+  /* Convert to significand to integer. */
+  mpz_set_str (em, buf, 2);
+  ie -= ((1 << (w - 1)) - 1);	/* Unbiased exponent. */
+  mpfr_set_z_2exp (x->value

Re: [patch, fortran] Fix PR 90813

2019-07-28 Thread Steve Kargl
On Sun, Jul 28, 2019 at 11:50:03PM +0200, Thomas Koenig wrote:
> Index: parse.c
> ===
> --- parse.c   (Revision 273855)
> +++ parse.c   (Arbeitskopie)
> @@ -6366,6 +6366,13 @@ done:
>/* Do the translation.  */
>translate_all_program_units (gfc_global_ns_list);
>  
> +  /* Dump the global symbol ist.  We only do this here because part

s/ist/list

> + of it is generated after mangling the identifiers in
> + trans-decl.c.  */
> +
> +  if (flag_dump_fortran_global)
> +gfc_dump_global_symbols (stdout);
> +  
>gfc_end_source_files ();
>return true;

Other than the typo above, the patch looks good to me.
You may want to give others a day or 2 to review the
patch.

-- 
Steve


Re: [patch, fortran] Fix PR 90813

2019-07-28 Thread Paul Richard Thomas
Hi Thomas,

That is very well done. Thanks for picking it up and running with it.
OK on both the fix and the dumping of the gsymbols.

You might consider back porting both this patch and my fix for the
original bug to 9-branch.

Regards

Paul

On Sun, 28 Jul 2019 at 22:50, Thomas Koenig  wrote:
>
> Hello world,
>
> the attached patch fixes PR 90813, a regression with proc pointers.
> The problem was quite complex, and I'd like to thank the people
> who helped debug this; the most important clue came from Richard.
>
> The problem was that, for a procedure pointer variable declared
> in a module in the same file, we were using a different backend
> decl in the module than in the main program. This led to the
> later parts of the compiler to think that the procedure pointer
> was actually two variables which could not alias.  Optimization
> on some architectures such as Aarch64 and POWER (but not
> on x86_64) then led to reordering of stores, leading to a segfault.
>
> The solution is to put the mangled names into the global
> variable table, and to look for it when getting its backend
> declaration.
>
> While debugging it, I also put in an option to dump the global
> symbol table to standard output.  I have included this in this
> patch because I think this may not be the last bug in that
> area :-)
>
> Regression-tested on powerpc64le-unknown-linux-gnu, where the
> segfault showed up.  No test case because is is already
> in the test suite. Doc changes checked with "make dvi" and
> "make pdf".
>
> OK for trunk?
>
> Regards
>
> Thomas
> 2019-07-28  Thomas Koenig  
>
> PR fortran/90813
> * dump-parse-tree.c (show_global_symbol): New function.
> (gfc_dump_global_symbols): New function.
> * gfortran.h (gfc_traverse_gsymbol): Add prototype.
> (gfc_dump_global_symbols): Likewise.
> * invoke.texi: Document -fdump-fortran-global.
> * lang.opt: Add -fdump-fortran-global.
> * parse.c (gfc_parse_file): Handle flag_dump_fortran_global.
> * symbol.c (gfc_traverse_gsymbol): New function.
> * trans-decl.c (sym_identifier): New function.
> (mangled_identifier): New function, doing most of the work
> of gfc_sym_mangled_identifier.
> (gfc_sym_mangled_identifier): Use mangled_identifier.  Add mangled
> identifier to global symbol table.
> (get_proc_pointer_decl): Use backend decl from global identifier
> if present.



-- 
"If you can't explain it simply, you don't understand it well enough"
- Albert Einstein