This is the mail archive of the 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

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.

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

main (int argc, char **argv)
  int size = 10;
  int i;
  typedef struct
    char val[size];
  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  <

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


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]