"Nadav Har'El" <[EMAIL PROTECTED]> writes:

> But if you're going to compile some of the code with -O1 and -O3, your
> Makefile or configure script are going to look realy hairy :( It will
> look like black magic. A better (but more time consuming) thing to do is
> to try to find the offending piece of code (which compiles wrong) and send
> a bug report to gcc and/or try to circumvent the bug.

I agree completely, but just for the hell of it, I don't think there
will be much black magic in the Makefile. Here is one possible make
hackery to skin this particular cat (UNTESTED, GNU make):

OBJ_O1 := foo.o1 bar.o1

CFLAGS_O1 := $(CFLAGS) -O1

OBJ_O3 := xyzzy.o3

CFLAGS_O3 := $(CFLAGS) -O3

target: $(OBJ_O1) $(OBJ_O3)
        $(CC) -o $@ $^ $(REST_OF_LINK_CMD)

%.o1:   %.c
        $(CC) -c $(CFLAGS_O1) $(CPPFLAGS) $< -o $@

%.o3:   %.c
        $(CC) -c $(CFLAGS_O3) $(CPPFLAGS) $< -o $@


As mentioned before, it should be perfectly fine to compile various
files with different optimizations (or without optimization at all)
and then link them together. -O3 is especially (mostly) harmless,
since the only thing it does compared to -O2 is inlining. Can that be 
affecting some of your code, btw?

-- 
Oleg Goldshmidt | [EMAIL PROTECTED] 
=================================================
"We work by wit, and not by witchcraft,
 And wit depends on dilatory time."

=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to