This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, Fortran] Simplify lbound
- From: Mikael Morin <mikael dot morin at sfr dot fr>
- To: Thomas Koenig <tkoenig at netcologne dot de>, fortran at gcc dot gnu dot org
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 11 May 2015 15:17:32 +0200
- Subject: Re: [Patch, Fortran] Simplify lbound
- Authentication-results: sourceware.org; auth=none
- Authentication-results: sfrmc.priv.atos.fr; dkim=none (no signature); dkim-adsp=none (no policy) header dot from=mikael dot morin at sfr dot fr
- References: <553B7BA4 dot 6040103 at netcologne dot de> <553BD925 dot 3050401 at sfr dot fr> <553E83B4 dot 8020005 at netcologne dot de> <5542722E dot 3030307 at sfr dot fr> <5543EA34 dot 6060304 at sfr dot fr> <5546872F dot 7040507 at netcologne dot de> <554F640D dot 5020506 at sfr dot fr> <CAMe9rOra_hoDhhkrrTzY3VSAo-A+Bww-FgZ1avKVPFWxnie8-Q at mail dot gmail dot com> <554FD6E1 dot 8090202 at netcologne dot de>
Le 11/05/2015 00:08, Thomas Koenig a Ãcrit :
> Am 10.05.2015 um 22:43 schrieb H.J. Lu:
>
>>> Here is what I have committed.
>>>
>>
>> It caused:
>>
>> /export/gnu/import/git/sources/gcc/gcc/testsuite/gfortran.dg/inline_matmul_3.f90:38:39:
>> Error: Variable 'c1' cannot appear in the expression at (1)^M
>
> I know that error message, I got it when developing the inline
> matmul patches with the same test cases. I had a fix for this
> error message in one of my matmul patches, but it was removed
> in the review process because it could no longer be reproduced.
>
> So, here is the fix again. I think it is close to obvious (since it
> fixes the problem and can obviously do no harm), but anyway: OK for
> trunk?
>
For what it's worth, I have looked at it further, and it seems to be
gfc_current_ns not being set to the internal namespace.
A patch like this also removes the error.
Index: frontend-passes.c
===================================================================
--- frontend-passes.c (rÃvision 223002)
+++ frontend-passes.c (copie de travail)
@@ -581,6 +581,9 @@ insert_block ()
else
ns = inserted_block->ext.block.ns;
+ /* From now on, everything will happen in the inserted block. */
+ gfc_current_ns = ns;
+
return ns;
}
To be honest, both patches look fragile to me. Yours because it leaves
gfc_current_ns to its value, leaving the door open to other problems.
Mine, well, because it's playing with a global variable, with the
possible side-effects this could have.
However, without a better idea, I'm OK with either patch (or both).
Mikael