Red Hat Bugzilla – Bug 78413
(alpha) deflate.c mis-compiled with -O2
Last modified: 2007-04-18 12:48:39 EDT
Description of Problem:
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. gzip lutBS08.pcf segfaults
2. compile deflate.c with -O0 rather than -O2
3. gzip lutBS08.pcf compresses
Created attachment 86066 [details]
file to reproduce problem
Workaround (compile deflate.c with -O0) in gzip-1.3.3-7
This smells like a compiler bug, since -O0 is a fix.
Bounce back to gzip so I can get the workaround removed, please.
Using no optimization does *not* fix the problem for me.
I see the same crash with all files compiled -O0. Sticking
the debugger on this shows that the program is walking off
the end of the data segment.
I rebuilt gzip with gcc 2.96, which does not exhibit the
crash and debugged things there, trying to see what happens
differently. Turns out: nothing at all. The code really
does walk off the end of the "window" array.
With the 2.96 compiler, the data segment is aligned differently,
and the end of the last page ends 0x1990 bytes past the end of
the window array. With the 3.2 compiler, the last page ends
0xd0 bytes past the end of the array.