Author: hjz
Date: 2010-12-21 03:47:56 -0500 (Tue, 21 Dec 2010)
New Revision: 3444

Modified:
   trunk/osprey/be/opt/opt_alias_class.cxx
Log:
Fix Bug #702. The bug is about alias classifying. SCLASS_FORMAL and 
SCLASS_FORMAL_REF should not get its own class ID.

In opt_alias_class.cxx local variables (SCLASS_AUTO, SCLASS_FORMAL and 
SCLASS_FORMAL_REF) defined in current PU get their own class ID. However, 
uplevel variables should not get their own class ID. The old code only checks 
the level of ST for SCLASS_AUTO. This fix adds guarded code also for 
SCLASS_FORMAL and SCLASS_FORMAL_REF.

Approved by: Sun Chan

Modified: trunk/osprey/be/opt/opt_alias_class.cxx
===================================================================
--- trunk/osprey/be/opt/opt_alias_class.cxx     2010-12-21 04:08:24 UTC (rev 
3443)
+++ trunk/osprey/be/opt/opt_alias_class.cxx     2010-12-21 08:47:56 UTC (rev 
3444)
@@ -409,10 +409,10 @@
 
   // If this base_id is a local variable or parameter, it gets its
   // own class.
-  if ((storage_class == SCLASS_AUTO &&
+  if (((storage_class == SCLASS_AUTO ||
+        storage_class == SCLASS_FORMAL ||
+        storage_class == SCLASS_FORMAL_REF) &&
        ST_IDX_level(ST_st_idx(st)) == CURRENT_SYMTAB) ||
-      storage_class == SCLASS_FORMAL                  ||
-      storage_class == SCLASS_FORMAL_REF              ||
       storage_class == SCLASS_REG) {
     // Set up the LDA and LDID classes for this variable...
     ALIAS_CLASS_MEMBER *ldid_item = New_alias_class_member(id);
@@ -490,7 +490,8 @@
           // uplevel reference and therefore must be treated as
           // global because its address can be stored into a global,
           // and it may contain the address of a global. Non-uplevel
-          // references with SCLASS_AUTO are handled as locals above.
+          // references with SCLASS_AUTO, SCLASS_FORMAL or
+           // SCLASS_FORMAL_REF are handled as locals above.
           // Including uplevel references here is the fix for 555533.
           // 634200 was a milder case of the same problem, and only
           // part of the fix was required to get that one right; that
@@ -498,6 +499,8 @@
           // parameters; 555533 makes clear that we have to go
           // all the way and treat them as globals.
           storage_class == SCLASS_AUTO    ||
+           storage_class == SCLASS_FORMAL  ||
+           storage_class == SCLASS_FORMAL_REF  ||
           // storage class can be UNKNOWN for constant data because CG may
           // already have run for an earlier PU and in the process lowered
           // string (and maybe other) constants to .rodata. Unfortunately,


------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel

Reply via email to