This is the mail archive of the gcc-bugs@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]

[Bug fortran/45786] Relational operators .eq. and == are not recognized as equivalent


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45786

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2011.05.28 21:44:52
         AssignedTo|unassigned at gcc dot       |tkoenig at gcc dot gnu.org
                   |gnu.org                     |
     Ever Confirmed|0                           |1

--- Comment #8 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2011-05-28 21:44:52 UTC ---
Which test cases still fail, and which ones are fixed?

It is a bit unclear from the log...(In reply to comment #7)
> So what is the status of this defect?   It would appear to be "will not fix".

The status is more like "Nobody hasn't gotten a round tuit"...

Looking at the original test case, this now fails because the
public statement for == does not pick up the interface for .eq.
This can be seen from the module dump.

If you remove the "private", or use "interface operator(.eq.)", then
it works.  Hmm...

This patch

Index: decl.c                                                            
===================================================================      
--- decl.c      (revision 173754)                                        
+++ decl.c      (working copy)                                           
@@ -6478,9 +6478,24 @@                                                   
        case INTERFACE_INTRINSIC_OP:                                     
          if (gfc_current_ns->operator_access[op] == ACCESS_UNKNOWN)     
            {                                                            
+             gfc_intrinsic_op same_op;                                  
+                                                                        
+             same_op = INTRINSIC_NONE;                                  
+                                                                        
              gfc_current_ns->operator_access[op] =                      
                (st == ST_PUBLIC) ? ACCESS_PUBLIC : ACCESS_PRIVATE;      
+                                                                        
+             if (op == INTRINSIC_EQ)                                    
+               same_op = INTRINSIC_EQ_OS;                               
+             else if (op == INTRINSIC_EQ_OS)                            
+               same_op = INTRINSIC_EQ;                                  
+                                                                        
+             if (same_op != INTRINSIC_NONE)                             
+               gfc_current_ns->operator_access[same_op] =               
+                 (st == ST_PUBLIC) ? ACCESS_PUBLIC : ACCESS_PRIVATE;    
+                                                                        
            }                                                            
+                                                                        
          else                                                           
            {                                                            
              gfc_error ("Access specification of the %s operator at %C has "

seems to fix the bug.  It doesn't fix all cases, because it only
looks at == and .eq. and not at the other operators, but the principle
appears to be sound.

Let's see if we can get this fixed for 4.7.


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