This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

A proposed patch for bug no 8081


Hello ,

   I had forgotten to mail the patch to the gcc-patches mailing list. So I'm
doing it now.

This is in reference to bug no 8081
<http://gcc.gnu.org/bugzilla/show_bug.cgi?id=8081>

Analysis of the Fix:
 When a nested function,returning a structure of variable size is called it
is unable to create a temporary space on the stack frame for storing the
returning value.
      This was observed when with slight modification of the program was
successfully compiled.

modifications:
declaration of a block b;
and assigning the return value of the function to b.

int
main (int argc, char **argv)
{
  int size = 10;
  int i;
  typedef struct
  {
    char val[size];
  }
  block;
  block b;
  block retframe_block ()
  {
    return *(block *) 0;
  }
  b=retframe_block ();
  return 0;
} 

  The obvious reason of its successful compilation is that ,there was no
need of assigning a temporary space to the stack frame as the return block
was returned to address of block b. 
   This gave the inspiration of dynamically allocating the temporary space
to the frame when a nested function is called without assignment.

2003-09-02 Sitikant Sahu  <sitikants@noida.hcltech.com
<mailto:sitikants@noida.hcltech.com>>

* calls.c (expand_call): Allocate dynamically on stack for
  variable size structure return (PR 8081 <show_bug.cgi?id=8081>).


 <<PR8081FIX.txt>> 


Thanks and Regards, 
Sitikant Sahu,
MTS, System Software Group, 
HCL Technologies Ltd., 
A-11, Sector-16, Noida 201301, UP, India,
Tel : +91 120 2510701/702 /813 (Extn: 3165),



Attachment: PR8081FIX.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]