public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
* [Patch] Fortran: Fix type-decl for PDT / wrong-code pdt_14.f03 issue [PR97652]
@ 2020-11-06  1:03 Tobias Burnus
  2020-11-06  7:10 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Tobias Burnus @ 2020-11-06  1:03 UTC (permalink / raw)
  To: gcc-patches, fortran, Paul Richard Thomas

[-- Attachment #1: Type: text/plain, Size: 553 bytes --]

Recent IPA work exposed this issue by causing wrong-code for gfortran.dg/pdt_15.f03
with optimization turned on; this shows up rather prominently with an endless loop,
until after 300s (per optimization level) the timeout kicks in.

OK? It probably should be backported to GCC 9 + 10, I think, even though IPA
patches are mainline/GCC 11, only.

Tobias

-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter

[-- Attachment #2: pdt-fix.diff --]
[-- Type: text/x-patch, Size: 1041 bytes --]

Fortran: Fix type-decl for PDT / wrong-code pdt_14.f03 issue [PR97652]

Parameterized derived types are handled in a special way and start with 'Pdt'.
If the 'P' is not uppercase, gfc_get_derived_type (which calls
gfc_get_module_backend_decl) does not find the existing declaration and
builds a new type. The middle end then sees those types as being different
and nonalising, creating an endless loop for pdt_14.f03.

gcc/fortran/ChangeLog:

	PR fortran/97652
	* module.c (mio_symbol): Fix symbol name for pdt_type.

diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index 33e7df7d6a4..4c6ff22d5c1 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -4549,6 +4549,9 @@ mio_symbol (gfc_symbol *sym)
 
   mio_symbol_attribute (&sym->attr);
 
+  if (sym->attr.pdt_type)
+    sym->name = gfc_dt_upper_string (sym->name);
+
   /* Note that components are always saved, even if they are supposed
      to be private.  Component access is checked during searching.  */
   mio_component_list (&sym->components, sym->attr.vtype);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Patch] Fortran: Fix type-decl for PDT / wrong-code pdt_14.f03 issue [PR97652]
  2020-11-06  1:03 [Patch] Fortran: Fix type-decl for PDT / wrong-code pdt_14.f03 issue [PR97652] Tobias Burnus
@ 2020-11-06  7:10 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2020-11-06  7:10 UTC (permalink / raw)
  To: Tobias Burnus; +Cc: gcc-patches, fortran, Paul Richard Thomas

On Fri, Nov 6, 2020 at 2:04 AM Tobias Burnus <tobias@codesourcery.com> wrote:
>
> Recent IPA work exposed this issue by causing wrong-code for gfortran.dg/pdt_15.f03
> with optimization turned on; this shows up rather prominently with an endless loop,
> until after 300s (per optimization level) the timeout kicks in.
>
> OK? It probably should be backported to GCC 9 + 10, I think, even though IPA
> patches are mainline/GCC 11, only.

OK for trunk, the issue is still latent wrong-code on branches when for example
inlining is involved.  But backporting is your call.

Thanks,
Richard.

> Tobias
>
> -----------------
> Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
> Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-06  7:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-06  1:03 [Patch] Fortran: Fix type-decl for PDT / wrong-code pdt_14.f03 issue [PR97652] Tobias Burnus
2020-11-06  7:10 ` Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).