Re: [Patch, fortran] PR100110 - Parameterized Derived Types, problems with global variable

2021-04-20 Thread Paul Richard Thomas via Fortran
Hi Tobias,

That was entirely accidental. I should have been more careful about
checking the timing of the merge. When I last checked the number of P1s
seemed to indicate that there was a while before it would happen.

Apologies to all.

Paul


On Tue, 20 Apr 2021 at 11:07, Tobias Burnus  wrote:

> Answer: Because my 'git pull' somehow got stuck – and showed an old trunk.
>
> Your patch just went in before the merge – thus it was on mainline GCC
> 11 and is now
> on mainline GCC 12 + GCC 11 branch ...
>
> Sorry for the confusion.
>
> Tobias
>
> On 20.04.21 11:58, Tobias Burnus wrote:
> > Hi Paul,
> >
> > is there a reason why you did not apply the patch to mainline ('master')
> > but only to GCC 11 ('releases/gcc-11')?
> >
> > While GCC 11 is okay, I had expected it to be (only) on mainline!
> >
> > Tobias
> >
> > On 20.04.21 10:55, Paul Richard Thomas wrote:
> >> Hi Tobias,
> >>
> >> Thanks. Commit r11-8255-g67378cd63d62bf0c69e966d1d202a1e586550a68.
> >>
> >> By the way, I did check that there were no problems with pdt_26.f03
> >> reported by valgrind, given the decrease in the malloc count.
> >>
> >> Cheers
> >>
> >> Paul
> >>
> >>
> >> On Mon, 19 Apr 2021 at 14:08, Tobias Burnus  >> > wrote:
> >>
> >> Hi Paul,
> >>
> >> On 19.04.21 14:40, Paul Richard Thomas via Gcc-patches wrote:
> >> > I was just about to announce that I will only do backports and
> >> regressions,
> >> > while I finally attack the fundamental problem with the
> >> representation of
> >> > Parameterized Derived Types. Then this PR came up that was such
> >> clear low
> >> > hanging fruit that I decided to fix it right away.
> >> >
> >> > Regtests on FC33/x86_64 - OK for mainline?
> >>
> >> LGTM.
> >>
> >> Thanks,
> >>
> >> Tobias
> >>
> >> -
> >> Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634
> >> München Registergericht München HRB 106955, Geschäftsführer:
> >> Thomas Heurung, Frank Thürauf
> >>
> >>
> >>
> >> --
> >> "If you can't explain it simply, you don't understand it well enough"
> >> - Albert Einstein
> > -
> > Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 München
> > Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung,
> > Frank Thürauf
> -
> Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 München
> Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Frank
> Thürauf
>


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


Re: [Patch, fortran] PR100110 - Parameterized Derived Types, problems with global variable

2021-04-20 Thread Tobias Burnus

Answer: Because my 'git pull' somehow got stuck – and showed an old trunk.

Your patch just went in before the merge – thus it was on mainline GCC
11 and is now
on mainline GCC 12 + GCC 11 branch ...

Sorry for the confusion.

Tobias

On 20.04.21 11:58, Tobias Burnus wrote:

Hi Paul,

is there a reason why you did not apply the patch to mainline ('master')
but only to GCC 11 ('releases/gcc-11')?

While GCC 11 is okay, I had expected it to be (only) on mainline!

Tobias

On 20.04.21 10:55, Paul Richard Thomas wrote:

Hi Tobias,

Thanks. Commit r11-8255-g67378cd63d62bf0c69e966d1d202a1e586550a68.

By the way, I did check that there were no problems with pdt_26.f03
reported by valgrind, given the decrease in the malloc count.

Cheers

Paul


On Mon, 19 Apr 2021 at 14:08, Tobias Burnus mailto:tob...@codesourcery.com>> wrote:

Hi Paul,

On 19.04.21 14:40, Paul Richard Thomas via Gcc-patches wrote:
> I was just about to announce that I will only do backports and
regressions,
> while I finally attack the fundamental problem with the
representation of
> Parameterized Derived Types. Then this PR came up that was such
clear low
> hanging fruit that I decided to fix it right away.
>
> Regtests on FC33/x86_64 - OK for mainline?

LGTM.

Thanks,

Tobias

-
Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634
München Registergericht München HRB 106955, Geschäftsführer:
Thomas Heurung, Frank Thürauf



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

-
Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 München
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung,
Frank Thürauf

-
Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 München 
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Frank 
Thürauf


Re: [Patch, fortran] PR100110 - Parameterized Derived Types, problems with global variable

2021-04-20 Thread Jakub Jelinek via Fortran
On Tue, Apr 20, 2021 at 11:58:32AM +0200, Tobias Burnus wrote:
> is there a reason why you did not apply the patch to mainline ('master')
> but only to GCC 11 ('releases/gcc-11')?
> 
> While GCC 11 is okay, I had expected it to be (only) on mainline!

r11-8255 is before the branchpoint, so is both in GCC 11 and trunk.
r11-8256 was the last revision on both, followed by r12-0 on trunk
and r11-8257 on releases/gcc-11.

Jakub



Re: [Patch, fortran] PR100110 - Parameterized Derived Types, problems with global variable

2021-04-20 Thread Tobias Burnus

Hi Paul,

is there a reason why you did not apply the patch to mainline ('master')
but only to GCC 11 ('releases/gcc-11')?

While GCC 11 is okay, I had expected it to be (only) on mainline!

Tobias

On 20.04.21 10:55, Paul Richard Thomas wrote:

Hi Tobias,

Thanks. Commit r11-8255-g67378cd63d62bf0c69e966d1d202a1e586550a68.

By the way, I did check that there were no problems with pdt_26.f03
reported by valgrind, given the decrease in the malloc count.

Cheers

Paul


On Mon, 19 Apr 2021 at 14:08, Tobias Burnus mailto:tob...@codesourcery.com>> wrote:

Hi Paul,

On 19.04.21 14:40, Paul Richard Thomas via Gcc-patches wrote:
> I was just about to announce that I will only do backports and
regressions,
> while I finally attack the fundamental problem with the
representation of
> Parameterized Derived Types. Then this PR came up that was such
clear low
> hanging fruit that I decided to fix it right away.
>
> Regtests on FC33/x86_64 - OK for mainline?

LGTM.

Thanks,

Tobias

-
Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634
München Registergericht München HRB 106955, Geschäftsführer:
Thomas Heurung, Frank Thürauf



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

-
Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 München 
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Frank 
Thürauf


Re: [Patch, fortran] PR100110 - Parameterized Derived Types, problems with global variable

2021-04-20 Thread Paul Richard Thomas via Fortran
Hi Tobias,

Thanks. Commit r11-8255-g67378cd63d62bf0c69e966d1d202a1e586550a68.

By the way, I did check that there were no problems with pdt_26.f03
reported by valgrind, given the decrease in the malloc count.

Cheers

Paul


On Mon, 19 Apr 2021 at 14:08, Tobias Burnus  wrote:

> Hi Paul,
>
> On 19.04.21 14:40, Paul Richard Thomas via Gcc-patches wrote:
> > I was just about to announce that I will only do backports and
> regressions,
> > while I finally attack the fundamental problem with the representation of
> > Parameterized Derived Types. Then this PR came up that was such clear low
> > hanging fruit that I decided to fix it right away.
> >
> > Regtests on FC33/x86_64 - OK for mainline?
>
> LGTM.
>
> Thanks,
>
> Tobias
>
> -
> Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 München
> Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Frank
> Thürauf
>


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


Re: [Patch, fortran] PR100110 - Parameterized Derived Types, problems with global variable

2021-04-19 Thread Tobias Burnus

Hi Paul,

On 19.04.21 14:40, Paul Richard Thomas via Gcc-patches wrote:

I was just about to announce that I will only do backports and regressions,
while I finally attack the fundamental problem with the representation of
Parameterized Derived Types. Then this PR came up that was such clear low
hanging fruit that I decided to fix it right away.

Regtests on FC33/x86_64 - OK for mainline?


LGTM.

Thanks,

Tobias

-
Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 München 
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Frank 
Thürauf


[Patch, fortran] PR100110 - Parameterized Derived Types, problems with global variable

2021-04-19 Thread Paul Richard Thomas via Fortran
Hi All,

I was just about to announce that I will only do backports and regressions,
while I finally attack the fundamental problem with the representation of
Parameterized Derived Types. Then this PR came up that was such clear low
hanging fruit that I decided to fix it right away.

Regtests on FC33/x86_64 - OK for mainline?

Note that this is sufficiently safe that it could be applied to 11-branch
right now. However, I am prepared to hold off until 11-branch is released.

Regards

Paul

Fortran: Fix host associated PDT entity initialization [PR99307].

2021-04-19  Paul Thomas  

gcc/fortran
PR fortran/100110
* trans-decl.c (gfc_get_symbol_decl): Replace test for host
association with a check that the current and symbol namespaces
are the same.

gcc/testsuite/
PR fortran/100110
* gfortran.dg/pdt_31.f03: New test.
* gfortran.dg/pdt_26.f03: Reduce 'builtin_malloc' count from 9
to 8.
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 34a0d49bae7..cc9d85543ca 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -1548,7 +1548,8 @@ gfc_get_symbol_decl (gfc_symbol * sym)
  declaration of the entity and memory allocated/deallocated.  */
   if ((sym->ts.type == BT_DERIVED || sym->ts.type == BT_CLASS)
   && sym->param_list != NULL
-  && !(sym->attr.host_assoc || sym->attr.use_assoc || sym->attr.dummy))
+  && gfc_current_ns == sym->ns
+  && !(sym->attr.use_assoc || sym->attr.dummy))
 gfc_defer_symbol_init (sym);
 
   /* Dummy PDT 'len' parameters should be checked when they are explicit.  */
diff --git a/gcc/testsuite/gfortran.dg/pdt_26.f03 b/gcc/testsuite/gfortran.dg/pdt_26.f03
index bf1273743d3..59ddcfb6cc4 100644
--- a/gcc/testsuite/gfortran.dg/pdt_26.f03
+++ b/gcc/testsuite/gfortran.dg/pdt_26.f03
@@ -2,7 +2,7 @@
 ! { dg-options "-fdump-tree-original" }
 !
 ! Test the fix for PR83567 in which the parameterized component 'foo' was
-! being deallocated before return from 'addw', with consequent segfault in 
+! being deallocated before return from 'addw', with consequent segfault in
 ! the main program.
 !
 ! Contributed by Berke Durak  
@@ -43,4 +43,4 @@ program test_pdt
   if (any (c(1)%foo .ne. [13,15,17])) STOP 2
 end program test_pdt
 ! { dg-final { scan-tree-dump-times "__builtin_free" 8 "original" } }
-! { dg-final { scan-tree-dump-times "__builtin_malloc" 9 "original" } }
+! { dg-final { scan-tree-dump-times "__builtin_malloc" 8 "original" } }


pdt_31.f03
Description: Binary data