From: Matthew Wilcox <matthew@wil.cx>
To: James Bottomley <James.Bottomley@SteelEye.com>
Cc: PARISC list <parisc-linux@lists.parisc-linux.org>
Subject: Re: [parisc-linux] gcc (3.3.5) causing problems in our latest kernel.
Date: Sun, 3 Apr 2005 23:13:32 +0100 [thread overview]
Message-ID: <20050403221332.GC18349@parcelfarce.linux.theplanet.co.uk> (raw)
In-Reply-To: <1112564457.5858.7.camel@mulgrave>
On Sun, Apr 03, 2005 at 04:40:57PM -0500, James Bottomley wrote:
> The problem is that the macros depend on clever optimisation using
> sizeof(*ptr) as an argument to an inline function. The following
> program illustrates the issue:
Perhaps there's a difference between an inline function and a macro
in terms of constant propagation? If you turn __test_width() into
a macro, it should work (see the implementation of __get_user() in
asm-parisc/uaccess.h)
> extern void bad_function(void);
>
> static inline void __test_width(char *var, int size) {
> switch (size) {
> case 1:
> case 2:
> case 4:
> case 8:
> *var++ = 0;
> break;
> default:
> bad_function();
> }
> }
>
> #define test_width(x) __test_width((char *)(x), sizeof(x))
>
> main(int argc, char *argv) {
> int test;
>
> test_width(&test);
> }
>
> If I compile this on an ia64 box, everything is fine:
>
> jejb@titanic> gcc -O2 test.c
> jejb@titanic> gcc -v
> Reading specs from /usr/lib/gcc-lib/ia64-linux/3.3.5/specs
> Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --with-system-libunwind --enable-clocale=gnu --enable-debug --enable-java-gc=boehm --enable-java-awt=xlib --enable-objc-gc ia64-linux
> Thread model: posix
> gcc version 3.3.5 (Debian 1:3.3.5-8)
>
> But on a parisc system it fails:
>
> jejb@raven> gcc -O2 test.c
> /tmp/cccwaI1E.o(.text+0x60): In function `main':
> : undefined reference to `bad_function'
> collect2: ld returned 1 exit status
> jejb@raven> gcc -v
> Reading specs from /usr/lib/gcc-lib/hppa-linux/3.3.5/specs
> Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-sjlj-exceptions --enable-clocale=gnu --enable-debug --enable-java-gc=boehm --enable-java-awt=xlib --enable-objc-gc hppa-linux
> Thread model: posix
> gcc version 3.3.5 (Debian 1:3.3.5-5)
>
> Before I have to tell Dave Miller that his clever trick won't work for
> us, is there a way of fixing it?
--
"Next the statesmen will invent cheap lies, putting the blame upon
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince
himself that the war is just, and will thank God for the better sleep
he enjoys after this process of grotesque self-deception." -- Mark Twain
_______________________________________________
parisc-linux mailing list
parisc-linux@lists.parisc-linux.org
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux
next parent reply other threads:[~2005-04-03 22:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1112564457.5858.7.camel@mulgrave>
2005-04-03 22:13 ` Matthew Wilcox [this message]
2005-04-03 23:56 ` [parisc-linux] gcc (3.3.5) causing problems in our latest kernel James Bottomley
2005-04-04 0:07 ` Matthew Wilcox
2005-04-03 23:43 ` John David Anglin
2005-04-04 0:43 ` Randolph Chung
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=20050403221332.GC18349@parcelfarce.linux.theplanet.co.uk \
--to=matthew@wil.cx \
--cc=James.Bottomley@SteelEye.com \
--cc=parisc-linux@lists.parisc-linux.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