Author: pallavimathew
Date: 2011-06-24 13:30:15 -0400 (Fri, 24 Jun 2011)
New Revision: 3662
Modified:
trunk/osprey/ipa/main/optimize/ipo_inline.cxx
trunk/osprey/ipa/main/optimize/ipo_inline_util.h
Log:
Testcase
#include <stdio.h>
typedef void (*inlinedFuncPtr)(char *, int, ...);
void
inlined_subr(char *str, int i, ...)
{
int idx;
if( i == 0 )
return;
printf( "%s=%d\n", str, i);
}
void
inliner_subr( inlinedFuncPtr fcn)
{
(*fcn)("i", 3);
}
int
main()
{
inliner_subr(inlined_subr);
return 1;
}
Problem/Fix Description
Open64 bug #726.
When above testcase is compiled with 'opencc -Ofast',
ipa_link segfaults or produces the internal error:
Invalid argument for ST_type()
The problem occurs when IPA tries to inline a function pointer that:
- has varargs,
- is determined to be partially inlinable (see
Identify_Partial_Inline_Candiate()
and Has_Partial_Inline_Attrib()), and
- has a void return type.
The assert failure occurs in function ST_Type when called from
ipo_inline.cxx:IPO_INLINE::Post_Process_Caller because it is not recognized
that the callee has a void return type.
Note that a fix for this problem was introduced at revision 3480.
This fix backs out the previous change for bug #726 and implements a new fix
for
the original problem affecting partial inlining of a smaller set of functions
(only those
that have void return type). The new fix, in routine
IPO_INLINE::Post_Process_Caller,
is to add checks for the opcodes OPR_VICALL (void return indirect call) and
OPR_VINTRINSIC_CALL (void return intrinsic call) to the existing check for
OPR_VCALL.
C.R. by Michael Lai
Modified: trunk/osprey/ipa/main/optimize/ipo_inline.cxx
===================================================================
--- trunk/osprey/ipa/main/optimize/ipo_inline.cxx 2011-06-23 15:57:41 UTC
(rev 3661)
+++ trunk/osprey/ipa/main/optimize/ipo_inline.cxx 2011-06-24 17:30:15 UTC
(rev 3662)
@@ -4643,7 +4643,8 @@
WN_next (call) = NULL;
// Check to see if "call" has a return value.
- if (aux.rp.size () > 0 && WN_opcode (call) != OPC_VCALL) {
+ if (aux.rp.size () > 0 && WN_opcode (call) != OPC_VCALL &&
+ WN_opcode (call) != OPC_VICALL && WN_opcode (call) !=
OPC_VINTRINSIC_CALL) {
// Place the call site in a block.
LWN_Insert_Block_Before(aux.part_inl_leftover_call_site, NULL, call);
WN_Set_Parent(call, aux.part_inl_leftover_call_site, Parent_Map,
Current_Map_Tab);
Modified: trunk/osprey/ipa/main/optimize/ipo_inline_util.h
===================================================================
--- trunk/osprey/ipa/main/optimize/ipo_inline_util.h 2011-06-23 15:57:41 UTC
(rev 3661)
+++ trunk/osprey/ipa/main/optimize/ipo_inline_util.h 2011-06-24 17:30:15 UTC
(rev 3662)
@@ -126,7 +126,7 @@
public:
- RETURN_PREG () : use_return_val (FALSE) {
+ RETURN_PREG () : use_return_val (TRUE) {
_u.old_style.num_pregs = 0;
}
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense..
http://p.sf.net/sfu/splunk-d2d-c1
_______________________________________________
Open64-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/open64-devel