This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: final intermodule patch
- From: Geoff Keating <geoffk at geoffk dot org>
- To: Nathanael Nerode <neroden at twcny dot rr dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: 14 Jul 2003 16:17:01 -0700
- Subject: Re: final intermodule patch
- References: <20030714225158.GA2023@doctormoo>
Nathanael Nerode <neroden@twcny.rr.com> writes:
> >Right. My patch does not implement any optimisations, and it is not a
> >change to the optimizers. You do not get better code generation just
> >because you use it; you must use -Osomething too.
>
> In other words, at -O0 we will *never* get *any* interaction between
> different translation units, even with your patch?
Last I knew, at -O0 we don't even get interaction between *functions*,
so how could we get interaction between modules?
> That's what one would expect from the C++ and C standards...
I don't know what that sentence means. My copy of the C standard
doesn't mention compiler options at all.
> >Yes. That's why my patch supports -O0 as well as -O3: it lets you do
> >debugging without changing your build system.
>
> That's all very well, but -O0 should really follow the principle of
> least surprise. -O0 -enable-intermodule or some such is just fine.
>
> Put it this way: If I'm doing ordinary C programming, I expect "gcc -c
> file1.c file2.c -o foo.o" to be flagged as a *mistake* by my compiler
> (this kind of mistake can creep into complex Makefiles fairly easily),
> not as an instruction silently invoking a different mode of operation.
> And indeed, this is how it used to work. The current situation is a
> regression in this regard. Does this make sense?
Not really. You asked for something, and the compiler gave it to you.
If we start having -fno-i-really-meant-this-command-line options,
where do we stop?
$ gcc -O3 -fno-unroll-loops
error: Are you sure you really want to switch off our wonderful loop
error: unroller? Use -fno-i-really-dont-want-to-unroll-loops if you do.
$ gcc -O3 -fno-unroll-loops -fno-i-really-dont-want-to-unroll-loops
error: Are you sure you really want to override our fine command-line
error: checking software? Use -fno-i-really-meant-that-command-line if you do.
$ gcc -O3 -fno-unroll-loops -fno-i-really-dont-want-to-unroll-loops \
-fno-i-really-meant-that-command-line
warning: OK, but don't say I didn't warn you.
*sigh* I should never have mentioned the word 'intermodule'. I should
have just said "looky, here's a way to compile multiple files into a
single .o!" and let people deduce for themselves what it's good for.
--
- Geoffrey Keating <geoffk@geoffk.org>