This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [testsuite] failure to optimize out dead code
- To: gcc-patches at gcc dot gnu dot org
- Subject: Re: [testsuite] failure to optimize out dead code
- From: Linus Torvalds <torvalds at transmeta dot com>
- Date: Fri, 19 Jan 2001 10:50:19 -0800
- Newsgroups: linux.egcs.patches
In article <20010119184353.B16050@sunsite.ms.mff.cuni.cz> you write:
>Hi!
>
>This testcase is regression against 2.95.2 and egcs 1.1.2.
>__builtin_constant_p is properly optimized out, but the 10 > 20000 test is
>kept (tested with -O and above and fails both on i386, sparc and sparc -m64).
>This causes some Linux 2.4.0 to have unresolved symbols.
Just a note for people who wonder how the h*ll Linux would get
unresolved symbols from this, as Jakub didn't explain: Linux
intentionally has a few inline functions and macros that sanity-test
their arguments at compile-time by depending on dead code elimination.
Basically, Linux has a few macros that end up being essentially case
statements, where there intentionally is a "default:" case that calls a
declared but non-existing function.
This makes sure that we test that the compiler wouldn't be so silly to
actually _expand_ a case-statement which is compile-time resolvable.
It's also good at catching bad users that specify invalid arguments to
the macro - causing a link error rather than any run-time strangeness.
Linus