This is the mail archive of the
mailing list for the GCC project.
Re: [RFC Patch]: Implement remainder() as built-in function [PR fortran/24518]
- From: "Kaveh R. GHAZI" <ghazi at caip dot rutgers dot edu>
- To: Roger Sayle <roger at eyesopen dot com>
- Cc: Mike Stump <mrs at apple dot com>, Richard Guenther <richard dot guenther at gmail dot com>, Uros Bizjak <ubizjak at gmail dot com>, FX Coudert <fxcoudert at gmail dot com>, gcc-patches at gcc dot gnu dot org
- Date: Wed, 25 Oct 2006 17:04:09 -0400 (EDT)
- Subject: Re: [RFC Patch]: Implement remainder() as built-in function [PR fortran/24518]
- References: <Pine.LNX.email@example.com>
On Wed, 25 Oct 2006, Roger Sayle wrote:
> However, it then occured to me that we can be even cleverer still:
> extern FILE *__libgcc_stdout = stdout;
> We can completely avoid the function call. Our issue is that libc's
> stdout isn't guaranteed to be mapped to a single simple symbol, and
> is often #defined to something cryptic. libgcc can avoid this by
> declaring the required stable symbol itself. Hence, in generated
> code we can simply refer to "__libgcc_stdout".
> Unless I'm missing something.
I think this came up before. Someone once told me that it's legal to
reassign stdout, in which case your __libgcc_stdout variable won't track
the new value of stdout and code that relies on this will break.
What may do the trick is "FILE **__libgcc_stdout = &stdout;", then you
would always insert *__libgcc_stdout in the builtin transformations.
Or maybe if we had something like a C++ reference to stdout, I don't know
if we can construct something like this from the middle-end in trees.
Kaveh R. Ghazi firstname.lastname@example.org