Author: dgilmore
Date: 2010-11-15 19:18:31 -0500 (Mon, 15 Nov 2010)
New Revision: 3401

Modified:
   trunk/osprey/crayf90/fe90/s_utils.c
   trunk/osprey/crayf90/fe90/sytb.c
   trunk/osprey/crayf90/fe90/sytb.h
Log:
Fix for bug 677, compiler temp names used for data initialization
need to to have their own namespace, since they can be exported
though module files.

Reviewed by Jian-Xin Lai and approved by Michael Lai.



Modified: trunk/osprey/crayf90/fe90/s_utils.c
===================================================================
--- trunk/osprey/crayf90/fe90/s_utils.c 2010-11-15 22:58:07 UTC (rev 3400)
+++ trunk/osprey/crayf90/fe90/s_utils.c 2010-11-16 00:18:31 UTC (rev 3401)
@@ -1,4 +1,7 @@
 /*
+ * Copyright (C) 2010 Advanced Micro Devices, Inc.  All Rights Reserved.
+ */
+/*
  *  Copyright (C) 2006. QLogic Corporation. All Rights Reserved.
  */
 
@@ -8206,6 +8209,8 @@
    int         list_idx;
    int         save_curr_stmt_sh_idx;
    int         sub_idx;
+   char                *endptr;
+   int         tmpnum;
 
 
    TRACE (Func_Entry, "insert_init_stmt_for_tmp", NULL);
@@ -8323,6 +8328,25 @@
 
    ATD_TMP_INIT_NOT_DONE(tmp_idx) = FALSE;
 
+   /* Fix for bug 677, compiler temp names used for data initialization
+    * need to to have their own namespace, since they can be exported
+    * though module files.
+    */
+   if (strncmp(AT_OBJ_NAME_PTR(tmp_idx), compiler_tmp_prefix, 
COMPILER_TMP_PREFIX_LEN) == 0
+       && strtod(AT_OBJ_NAME_PTR(tmp_idx) + COMPILER_TMP_PREFIX_LEN, &endptr)
+       && *endptr == 0) {
+      char buf[1000];
+      int length;
+      int np_idx;
+
+      sprintf(buf, "%s%s", AT_OBJ_NAME_PTR(tmp_idx),
+              SB_NAME_PTR(ATD_STOR_BLK_IDX(tmp_idx)));
+      length = strlen(buf);
+      NTR_NAME_POOL((long *)buf, length, np_idx);
+      AT_NAME_LEN(tmp_idx) = length;
+      AT_NAME_IDX(tmp_idx) = np_idx;
+   }
+
    TRACE (Func_Exit, "insert_init_stmt_for_tmp", NULL);
 
    return;

Modified: trunk/osprey/crayf90/fe90/sytb.c
===================================================================
--- trunk/osprey/crayf90/fe90/sytb.c    2010-11-15 22:58:07 UTC (rev 3400)
+++ trunk/osprey/crayf90/fe90/sytb.c    2010-11-16 00:18:31 UTC (rev 3401)
@@ -1,4 +1,7 @@
 /*
+ * Copyright (C) 2010 Advanced Micro Devices, Inc.  All Rights Reserved.
+ */
+/*
  *  Copyright (C) 2006. QLogic Corporation. All Rights Reserved.
  */
 
@@ -4267,6 +4270,9 @@
 |*                                                                           *|
 
\******************************************************************************/
 
+
+char compiler_tmp_prefix[] = "t$";
+
 int gen_compiler_tmp (int              tmp_line,
                      int               tmp_column,
                      task_scope_type   scope,
@@ -4287,7 +4293,7 @@
    CREATE_ID(name, " ", 1);
 
 # if defined(_HOST_OS_UNICOS) || defined(_HOST_OS_MAX)
-   length = sprintf(name.string, "t$%d", curr_tmp);
+   length = sprintf(name.string, "%s%d", compiler_tmp_prefix, curr_tmp);
 # else
    sprintf(name.string, "t$%d", curr_tmp);
    length = strlen(name.string);

Modified: trunk/osprey/crayf90/fe90/sytb.h
===================================================================
--- trunk/osprey/crayf90/fe90/sytb.h    2010-11-15 22:58:07 UTC (rev 3400)
+++ trunk/osprey/crayf90/fe90/sytb.h    2010-11-16 00:18:31 UTC (rev 3401)
@@ -1,4 +1,7 @@
 /*
+ * Copyright (C) 2010 Advanced Micro Devices, Inc.  All Rights Reserved.
+ */
+/*
  * Copyright (C) 2008. PathScale, LLC. All Rights Reserved.
  */
 /*
@@ -1809,6 +1812,9 @@
 
 extern char                    *pgm_unit_str[];
 
+#define COMPILER_TMP_PREFIX_LEN 2
+extern char compiler_tmp_prefix[];
+
 # ifdef _DEBUG
 extern void print_so(size_offset_type);
 # endif


------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel

Reply via email to