public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Error with gcc-4.6 -O1 -ftree-vectorize
@ 2011-01-12 13:35 Victor Stinner
  0 siblings, 0 replies; 3+ messages in thread
From: Victor Stinner @ 2011-01-12 13:35 UTC (permalink / raw)
  To: gcc-help

[-- Attachment #1: Type: text/plain, Size: 1143 bytes --]

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

[-- Attachment #2: peephole.c --]
[-- Type: text/x-csrc, Size: 1531 bytes --]

#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;
}


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Error with gcc-4.6 -O1 -ftree-vectorize
  2011-01-12 13:37 Victor Stinner
@ 2011-01-12 18:39 ` Victor Stinner
  0 siblings, 0 replies; 3+ messages in thread
From: Victor Stinner @ 2011-01-12 18:39 UTC (permalink / raw)
  To: gcc-help

Le mercredi 12 janvier 2011 à 14:40 +0100, Victor Stinner a écrit :
> 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.

I opened an issue in GCC bug tracker:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47271

Victor

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Error with gcc-4.6 -O1 -ftree-vectorize
@ 2011-01-12 13:37 Victor Stinner
  2011-01-12 18:39 ` Victor Stinner
  0 siblings, 1 reply; 3+ messages in thread
From: Victor Stinner @ 2011-01-12 13:37 UTC (permalink / raw)
  To: gcc-help

[-- Attachment #1: Type: text/plain, Size: 1144 bytes --]

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


[-- Attachment #2: peephole.c --]
[-- Type: text/x-csrc, Size: 1531 bytes --]

#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;
}


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-01-12 18:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-12 13:35 Error with gcc-4.6 -O1 -ftree-vectorize Victor Stinner
2011-01-12 13:37 Victor Stinner
2011-01-12 18:39 ` Victor Stinner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).