This is the mail archive of the
mailing list for the GCC project.
Re: Patch for Bug No-8081
"Sitikant Sahu, Noida" <firstname.lastname@example.org> writes:
> 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 <email@example.com> 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.