On Sun, Dec 9, 2012 at 10:06 PM, Jason Gunthorpe
<jguntho...@obsidianresearch.com> wrote:

...

> It is definately a bug in the code, it should be 'static inline' - the
> reason it doesn't blow up on gcc is most likely because nobody ever
> compiled it with a low enough optimization level to see it.
>
> Looks to me like clang is fine, no bug there.

I've been corrected by several people both in the FreeBSD and clang
projects today. The summary is:
1. What clang's doing is correct via c99. static inline is the most
correct way to do this while inline'ing the function per-c99 (which I
didn't understand until today because I was unaware of that point in
the standard). In particular:
    i. With -O0 and -O1 it will fail as noted before.
    ii. With -O2 and higher it will optimize out without error (which
could account for me not seeing this until I ran the build on Fedora
17 as I haven't installed a make.conf with non-default CFLAGS and
didn't call the Makefiles with any optimization settings).
2. gcc silently optimizes it out. This is a gcc extension to c89 and
c99 (aka gnu89 and gnu99).
Thanks!
-Garrett
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to