On Wed, 19 Jun 2002, Stas Bekman wrote:
 
> I cannot see this in gcc manpages, but I don't think -g implies -O0

that's not what i meant.  when MP_DEBUG=1 then we drop the 
$Config{optimize} flag (unless $Config{cflags} =~ -DDEBUGGING).

so with MP_DEBUG=1 there is no -On flag used when building.

pretty sure -O0 is only meant to turn off any previous -On and that no 
optimizations are done unless -O1 or higher is used.

% perl test-compile.pl
out and out-O0 are the same
out-O0 and out-O1 are different
out-O1 and out-O2 are different

#test-compile.pl
use strict;
my $last = "";

my $cfile = 'test.c';

open my $fh, '>', $cfile or die;
print $fh <DATA>;
close $fh;

for my $n (undef, 0, 1, 2) {
    my $o = defined $n ? "-O$n" : "";
    my $file = "out";
    $file .= $o if defined $n;

    my $cmd = "gcc $o -S $cfile -o $file";

    system $cmd;
    if ($last) {
        my $diff = `diff -u $file $last`;
        printf "$last and $file are %s\n", $diff ? "different" : "the same";
    }
    $last = $file;
}
__END__
#include <stdio.h>

int main() {
    if (0) {
        puts("hi");
    }
    return 1;
}


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to