This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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: PR40011 -fwhole-file problems


Andrew Pinski wrote:
2009/6/2 Paul Richard Thomas <paul.richard.thomas@gmail.com>:
Tobias,

This is the issue, apparently the optimizer can't handle inlining functions
with static variables (SAVE in Fortran).  I verified with a C example that
indeed functions with static variables are not inlined if they're called
more than once.

Huh? It works for me: int f(int g1, int b) { static int g; if (b) g = 1; return g; }

int h(void)
{
  return f(1, 0);
}

int j(int a, int b)
{
  return f(a, b);
}

Ah, I hadn't checked with trunk, thanks. Andrew, I guess Paul would appreciate to learn what is the magic incantation that's needed to get functions with static variables to be inlined correctly. Do you know?


Cheers,
- Tobi


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