This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Error with gcc-4.6 -O1 -ftree-vectorize
- From: Victor Stinner <victor dot stinner at haypocalc dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Wed, 12 Jan 2011 14:28:47 +0100
- Subject: Error with gcc-4.6 -O1 -ftree-vectorize
Hi,
Python 3.2 doesn't compile correctly with -O3:
http://bugs.python.org/issue9880
It looks like there are errors related to the -ftree-vectorize flag.
Attached file (peephole.c, code extracted from Python/peephole.c) shows
an error: I suppose that it is a compiler bug.
The program works fine with -O1, extract of the correct output:
----
addrmap[0]=0
addrmap[3]=3
addrmap[4]=4
addrmap[7]=7
addrmap[10]=10
addrmap[13]=13
addrmap[16]=16
addrmap[19]=19
addrmap[22]=22
...
----
With -O1 -ftree-vectorize, there are errors for addrmap[13] and
addrmap[19]:
----
addrmap[0]=0
addrmap[3]=3
addrmap[4]=0
addrmap[7]=0
addrmap[10]=0
addrmap[13]=32767
addrmap[16]=0
addrmap[19]=32767
addrmap[22]=0
...
----
Well, the output is completly different (eg. addrmap[4]=4 vs
addrmap[4]=0).
My setup:
* Intel(R) Pentium(R) 4 CPU 3.00GHz
* Debian Sid
* gcc (Debian 20110106-1) 4.6.0 20110106 (experimental) [trunk revision
168538]
* Python 3.2 (r87949)
See also the previous thread about Python+gcc 4.6:
"gcc version 4.6.0 20100908 (experimental) (GCC) Fails to Build Python
2.7"
http://gcc.gnu.org/ml/gcc-help/2010-09/msg00170.html
Victor Stinner
#include <stdio.h>
#include <unistd.h> /* ssize_t */
#define HAVE_ARGUMENT 90 /* Opcodes from here have an argument: */
#define HAS_ARG(op) ((op) >= HAVE_ARGUMENT)
#define CODESIZE(op) (HAS_ARG(op) ? 3 : 1)
#define NOP 9
typedef ssize_t Py_ssize_t;
void func()
{
Py_ssize_t i;
int nops;
unsigned char *codestr =
"|\000\000Ee\000\000Z\001\000d\000\000Z\002\000d\025\000Z\003\000"
"\t\t\t\t\t\t\t\t\t\t\t\td\026\000Z\004\000d\005\000\204\000\000Z"
"\005\000e\006\000e\a\000j\005\000e\b\000d\006\000\204\002\000\203"
"\001\000Z\t\000d\a\000\204\000\000Z\n\000d\b\000\204\000\000Z\v\000d"
"\t\000\204\000\000Z\f\000d\n\000\204\000\000Z\r\000e\016\000e\017\000d"
"\v\000\203\001\000d\f\000d\r\000\203\001\001Z\020\000e\016\000e\017"
"\000d\016\000\203\001\000d\f\000d\017\000\203\001\001Z\021\000e\016"
"\000e\017\000d\020\000\203\001\000d\f\000d\021\000\203\001\001Z\022"
"\000e\016\000e\017\000d\022\000\203\001\000d\f\000d\023\000\203\001"
"\001Z\023\000d\024\000S"
;
Py_ssize_t codelen = 209;
int addrmap[500];
/* Fixup linenotab */
for (i=0, nops=0 ; i<codelen ; i += CODESIZE(codestr[i])) {
addrmap[i] = i - nops;
if (codestr[i] == NOP)
nops++;
}
for (i=0, nops=0 ; i<codelen ; i += CODESIZE(codestr[i]))
printf("addrmap[%i]=%i\n", i, addrmap[i]);
for (i=0, nops=0 ; i<codelen ; i += CODESIZE(codestr[i]))
{
if (addrmap[i] > codelen)
printf("ERROR FOR addrmap[%i]\n", i);
}
}
int main()
{
func();
return 0;
}