Re: [2.6 patch] offer CC_OPTIMIZE_FOR_SIZE only if EXPERIMENTAL

From: Krzysztof Halasa
Date: Thu Dec 15 2005 - 10:00:59 EST


Dave Jones <davej@xxxxxxxxxx> writes:

> Fedora has had this enabled most of the time for x86, x86-64, ia64,
> s390, s390x, ppc32 and ppc64 for a long time. From time to time
> when a gcc bug has been tickled it's been disabled again until its
> been worked out, but for the most part, it's been a complete non-event
> wrt regressions.

BTW: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=173764

gcc generates incorrect code with -Os (i386).

Version-Release number of selected component (if applicable):
gcc-4.0.1-4.fc4 and gcc-4.0.2-8.fc4 (i.e., FC4-current)

gcc -W -Wall -Os test.c -o test -Werror && ./test
array: 1 2
array: 1 2

gcc -W -Wall -O2 test.c -o test -Werror && ./test
array: 1 2
array: 2 3

Additional info:
Marked "high" as it miscompiles the Linux kernel.

#include <stdio.h>

void test_it(int *array)
{
int i;

for (i = 0; i < 2; i++) {
int value = array[i];
if (i != 1000 && i != 1001)
array[i] = value + 1;
}
}

int main(void)
{
int array[2] = {1, 2};

printf("array: %i %i\n", array[0], array[1]);

test_it(array);

printf("array: %i %i\n", array[0], array[1]);

return 0;
}

--
Krzysztof Halasa
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/