This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


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

Re: [testsuite] failure to optimize out dead code


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

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