[Bug other/59648] -O2 -flto compilation of xorg-server-1.15.0 fails
trippels at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Jan 1 15:54:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59648
--- Comment #7 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
You cannot use full paths for your test output, because
creduce will run each iteration in a new directory. So
try changing it from:
-flto=4 -o /dev/null /home/dave2/$TESTCASE /home/dave2/libxservertest.a >
/home/dave2/test.txt 2>&1
cat /home/dave2/test.txt | grep ...
to:
-flto=4 -o /dev/null $TESTCASE /home/dave2/libxservertest.a > test.txt 2>&1
cat test.txt | grep ...
To reduce /home/dave2/libxservertest.a first extract its contents:
ar x /home/dave2/libxservertest.a
and then produce a list of the object files:
ls -al *.o > list
Edit "list" and prepend the full path to all object files.
The run delta on "list" as described here:
http://gcc.gnu.org/wiki/A_guide_to_testcase_reduction#Reducing_LTO_bugs
and generate preprocessed source for the files.
Now reduce the preprocessed files one by one.
After a few iterations you'll end up with something like:
x4 test # cat test.i
long a;
extern int noPanoramiXExtension, PanoramiXNumScreens, CheckVirtualMotion_x;
typedef struct {
int screens[16];
int numScreens;
} ScreenInfo;
ScreenInfo screenInfo;
int fn1() {
if (noPanoramiXExtension) {
int i;
i = PanoramiXNumScreens - 1;
while (i--)
CheckVirtualMotion_x = (long)screenInfo.screens[i];
}
return 0;
}
int main() {
screenInfo.numScreens = 0;
a = (long)*fn1;
return 0;
}
x4 test # cat panoramiX.i
int PanoramiXNumScreens;
int noPanoramiXExtension=1;
int CheckVirtualMotion_x;
x4 test # gcc -O2 -Werror=array-bounds test.i panoramiX.i
x4 test # gcc -O2 -flto -Werror=array-bounds test.i panoramiX.i
test.i: In function ‘fn1’:
test.i:13:54: warning: iteration 16 invokes undefined behavior
[-Waggressive-loop-optimizations]
CheckVirtualMotion_x = (long)screenInfo.screens[i];
^
test.i:12:11: note: containing loop
while (i--)
^
test.i:13:54: error: array subscript is below array bounds
[-Werror=array-bounds]
CheckVirtualMotion_x = (long)screenInfo.screens[i];
^
lto1: some warnings being treated as errors
lto-wrapper: /usr/x86_64-pc-linux-gnu/gcc-bin/4.9.0/gcc returned 1 exit status
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.0/../../../../x86_64-pc-linux-gnu/bin/ld:
fatal error: lto-wrapper failed
collect2: error: ld returned 1 exit status
x4 test #
More information about the Gcc-bugs
mailing list