This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, Fortran] Simplify lbound


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]