source: trunk/docs/README.gcc_bug@ 222

Last change on this file since 222 was 1, checked in by katerina, 19 years ago

Initial import

File size: 1.2 KB
Line 
1
2GCC Compiler Bug
3----------------
4
5Reference: http://boudicca.tux.org/hypermail/linux-kernel/2000week05/0983.html
6
7From: Johan Kullstam (kullstam@ne.mediaone.net)
8Date: Thu Jan 27 2000 - 18:00:28 EST
9
10Horst von Brand <vonbrand@sleipnir.valparaiso.cl> writes:
11
12> My question in this vein would be the -fno-strength-reduce. The gcc bug
13> that placed this in the kernel was in gcc-2.7.2, and was worked around in
14> 2.7.2.3 by just making this option unconditional. Both 2.2.15pre4 and
15> 2.3.41pre2 at least demand gcc-2.7.2.3 as minimal version.
16
17just when you thought it was safe to go into the water...
18
19strength-reduction is broken again in gcc-2.95.2 (aka the current
20release). i'm not sure about what versions actually do work.
21
22for fun, try this one out. cut and paste the program bug.c.
23
24$ gcc -O2 bug.c -o b0
25$ gcc -O2 -fno-strength-reduce bug.c -o b1
26
27run b1. notice it finish immediately.
28now run b0. notice how b0 never terminates (until you ^C it).
29
30
31-- bug.c -----------------------------------------
32static void bug(int size, int tries)
33{
34 int i;
35 int num = 0;
36
37 while (num < size)
38 {
39 for (i = 1; i < tries; i++) num++;
40 }
41}
42
43int main()
44{
45 bug(5, 10);
46 return 0;
47}
48-- bug.c -----------------------------------------
49
Note: See TracBrowser for help on using the repository browser.