And find_base_attr() works as well as find_left_attr() when opnd is not struct.
Pallavi, this fix looks good to me.

Thanks,
Michael Lai

From: Mathew, Pallavi [mailto:pallavi.mat...@amd.com]
Sent: Thursday, March 31, 2011 3:45 PM
To: open64-devel@lists.sourceforge.net
Subject: [Open64-devel] Code review request for fix to bug# 756

Hi,

Appended below is a proposed fix ported from PathScale 3.3 beta. Sample program 
exposing the error and the IR dumps before and after the fix are attached and 
also available in the bug-report.
Can a gatekeeper please review the patch?

Thanks.
Pallavi

Index: osprey/crayf90/fe90/s_io.c
===================================================================
--- osprey/crayf90/fe90/s_io.c   (revision 3526)
+++ osprey/crayf90/fe90/s_io.c                (working copy)
@@ -1537,7 +1537,7 @@
       }
       else {

-         attr_idx = find_left_attr(&opnd);
+         attr_idx = find_base_attr(&opnd, &line, &col);

          /* create tmp for iolength */

Problem:
 In the source statement:
       inquire( iolength=Tvar%field1 ) 100,200
 variable 'Tvar%field1' passed to inquire/iolength is expected to be an
integer,
 however in the generated WHIRL, the type is MTYPE_M (type of 'Tvar'). The
 assertion failure shown in the earlier comment is from the non-debug
 compiler. The debug compiler catches the problem earlier on.

Fix:
During the semantic pass in the front-end, use function 'find_base_attr'
instead of 'find_left_attr' to get to the attribute for 'field1' in
'Tvar%field1'.

>From documentation of find_base_attr:
|* Description:
|*           finds the base attr pointer from reference tree.
|*           The difference between find_base_attr and find_left_attr is:
|*       a%b%c(1:10)(1:3)
*|
|*       find_base_attr finds 'c'
*|
|*       find_left_attr finds 'a'
*|

The attached file 'originalIR.txt' shows the WHIRL IR dump and front-end trace
with the incorrect types marked out. The attachment 'IRafterfix.txt' shows the
correct trace generated after the patch is applied.
------------------------------------------------------------------------------
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel

Reply via email to