Author: xiaohua_zhang
Date: 2011-02-22 13:00:27 -0500 (Tue, 22 Feb 2011)
New Revision: 3488
Modified:
trunk/osprey/wgen/wgen_decl.cxx
trunk/osprey/wgen/wgen_stmt.cxx
Log:
The global scope inline assemly code is handled as fake function whose
function name contains the assemble code string, the body of the fake
function is empty. The fake function is not constructed with proper
attributes, especialy the language kind and function type are not correct,
which caused assertion in pre-opt. The fix for now is to set the attributes
to avoid the assertion: language kind to be the same as compiler language
kind, function type to be void return type function.
Approved By Sun Chan
Modified: trunk/osprey/wgen/wgen_decl.cxx
===================================================================
--- trunk/osprey/wgen/wgen_decl.cxx 2011-02-22 09:14:56 UTC (rev 3487)
+++ trunk/osprey/wgen/wgen_decl.cxx 2011-02-22 18:00:27 UTC (rev 3488)
@@ -1021,6 +1021,7 @@
New_INITO (ST_st_idx (etable), exc_ptr_iv));
}
+extern TY_IDX Type_For_Function_Returning_Void (void);
// Generate WHIRL representing an asm at file scope (between functions).
@@ -1029,13 +1030,14 @@
WGEN_Assemble_Asm(char *asm_string)
{
ST *asm_st = New_ST(GLOBAL_SYMTAB);
+ TY_IDX ty_idx = Type_For_Function_Returning_Void();
ST_Init(asm_st,
Str_To_Index (Save_Str (asm_string),
Global_Strtab),
CLASS_NAME,
SCLASS_UNKNOWN,
EXPORT_LOCAL,
- (TY_IDX) 0);
+ ty_idx);
Set_ST_asm_function_st(*asm_st);
@@ -1124,11 +1126,15 @@
PU_IDX pu_idx;
PU &pu = New_PU(pu_idx);
- PU_Init(pu, (TY_IDX) 0, CURRENT_SYMTAB);
+ PU_Init(pu, ty_idx, CURRENT_SYMTAB);
Set_PU_no_inline(pu);
Set_PU_no_delete(pu);
Set_ST_pu(*asm_st, pu_idx);
+ if (lang_cplus)
+ Set_PU_cxx_lang (Pu_Table [ST_pu (asm_st)]);
+ else Set_PU_c_lang (Pu_Table [ST_pu (asm_st)]);
+
Write_PU_Info (pu_info);
// What does the following line do?
Modified: trunk/osprey/wgen/wgen_stmt.cxx
===================================================================
--- trunk/osprey/wgen/wgen_stmt.cxx 2011-02-22 09:14:56 UTC (rev 3487)
+++ trunk/osprey/wgen/wgen_stmt.cxx 2011-02-22 18:00:27 UTC (rev 3488)
@@ -293,7 +293,7 @@
static INT32 scope_number;
-static TY_IDX
+TY_IDX
Type_For_Function_Returning_Void (void)
{
static TY_IDX result = 0;
------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in
Real-Time with Splunk. Collect, index and harness all the fast moving IT data
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business
insights. http://p.sf.net/sfu/splunk-dev2dev
_______________________________________________
Open64-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/open64-devel