public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: Jim Wilson <wilson@cygnus.com>
To: linux-ia64@vger.kernel.org
Subject: Re: [Linux-ia64] gcc won't inline function returning struct?
Date: Thu, 01 Nov 2001 00:27:17 +0000	[thread overview]
Message-ID: <marc-linux-ia64-105590698805430@msgid-missing> (raw)
In-Reply-To: <marc-linux-ia64-105590698805421@msgid-missing>

	typedef struct {
		float re, im;
		int dummy;
	} complex;

I tried this, and it works.

>Since this is no longer an HFA would this kick the compiler into
>a mode where the code would at least work, all be it not in the most
>efficient manner?

Just to clarify, the code that gcc emits is correct.  The testcase can fail
only if the "extern inline" feature is misused.  I assumed that was the
case without explicitly mentioning it.  Thus my recommended solution would be
to stop using extern inline, or else use it correctly.  I can understand that
this might be inconvenient, and that you might want to keep the current
unsafe uses of extern inline.

extern inline means emit this function inline if you can, otherwise emit
nothing.  Since gcc makes no promise that it will inline any function, it
is inherently unsafe to put extern inline in a C file.  There is no guarantee
that it will work.

There are some programs that do this for functions that the IA-32 compiler
happens to inline, but which the IA-64 compiler does not happen to inline.
This always gets reported as an IA-64 gcc "bug", but really it isn't.  It
is programmer error; extern inline has been used incorrectly.

A correct use of extern inline is how glibc uses it.  It puts extern inline
in header files, and static functions in C files linked into libc/libm.
If gcc can inline the function, then you get the fast inline version from
the header file.  If gcc cannot inline the function, then you get the slow
static version from libc/libm.

Jim


  parent reply	other threads:[~2001-11-01  0:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-31 21:39 [Linux-ia64] gcc won't inline function returning struct? Bdale Garbee
2001-10-31 22:23 ` Jim Wilson
2001-10-31 23:02 ` n0ano
2001-11-01  0:27 ` Jim Wilson [this message]
2001-11-01  0:40 ` Matthew Wilcox
2001-11-01  0:49 ` Jim Wilson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=marc-linux-ia64-105590698805430@msgid-missing \
    --to=wilson@cygnus.com \
    --cc=linux-ia64@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox