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: [RFC Patch]: Implement remainder() as built-in function [PR fortran/24518]

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.
> Roger

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

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