From: Joerg Czeranski <jc@joerch.org>
Subject: DEC C -tune ev6 optimization bug
Date: 1999/06/14 [thread overview]
Message-ID: <5vWGOC4gy$0aG$1@joerch.org> (raw)
Another compiler bug found while compiling Objective Caml :-)
The source for reproducing the problem:
-------------------- snip here --------------------
#pragma noinline fill /* force main to call fill() */
void fill(unsigned long n, long *a)
{
unsigned long i;
for (i = 0; i < n; i++) a[i] = 0;
}
int main(void)
{
static long a[4];
fill(4, a);
return 0;
}
-------------------- snip here --------------------
I compiled it as "cc -std1 -fast -tune ev6 source.c" and with
"cc.alt" with the same options on a factory installed DU4.0E
with compiler versions:
DEC C V5.8-009 on Digital UNIX V4.0 (Rev. 1091)
DEC C V6.0-007 (cc.alt) on Digital UNIX V4.0 (Rev. 1091)
The type of "n" (unsigned long) seems to confuse the optimizer -
it seems to work with "int n", "unsigned n", "long n", but I didn't
test it thoroughly.
It uses wh64 instructions (nice optimization BTW) but miscalculates
the bound as &a[(1L << 32) + n] (with the lowest 6 bits cleared)
instead of &a[n].
This leads to cache corruption for memory after the array "a".
"long *volatile a" disables the use of wh64 and can be used to work
around this problem.
I didn't find a patch for this problem in patch kit 1.
joerch
next reply other threads:[~1999-06-14 4:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-06-14 4:00 Joerg Czeranski [this message]
1999-06-14 4:00 ` DEC C -tune ev6 optimization bug Jeff Sullivan
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox