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]

Re: Patch for Bug No-8081

"Sitikant Sahu, Noida" <> writes:

> Hello,
> I've proposed a Patch for GCC bug no 8081 and uploaded in the required page.
> <>

The patch reviewers do not watch the bug database for attached
patches.  It's good that you did what you did, but you should also
have sent the patch to <> with change log and

(Sending the patch to gcc-patches does not guarantee that it will be
looked at, alas.  Reminder messages to gcc-patches when something has
gone unreviewed for awhile are appreciated.)

Now, looking at your patch, I do not believe it is correct.
Allocating space in the callee means that it will get deallocated
immediately, when the callee returns, and may then be trashed by
further stack operations in the caller.  It's true that the caller
failed to provide space because the return value is not used, but that
may not be the only way to get a null target at this point, and you
would then have turned an ICE into a silent miscompilation.

The patch also appears to have broken the case where the target *was*
provided by the caller - you allocate dynamic space anyway.

The proper fix for the bug is to allocate space in the caller, for a
function returning a variable-sized object like this, even if that
space isn't going to get used.


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