This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
c/4607: Optimization bug, (miscompilation of boehm-gc)
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c/4607: Optimization bug, (miscompilation of boehm-gc)
- From: Martin Kahlert <martin dot kahlert at infineon dot com>
- Date: Thu, 18 Oct 2001 10:58:11 +0200
>Number: 4607
>Category: c
>Synopsis: Optimization bug, (miscompilation of boehm-gc)
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Thu Oct 18 02:06:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Martin Kahlert
>Release: 3.1 20011017 (experimental)
>Organization:
Infineon AG
>Environment:
System: Linux keksy 2.4.12 #1 SMP Thu Oct 11 16:34:10 MEST 2001 i686 unknown
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc-3.1/configure --prefix=/sw/gcc-3.1 --enable-languages=c++,f77,java --enable-threads=posix
>Description:
gcc miscompiles its sources (boehm-gc/mark_rts.c)
see http://gcc.gnu.org/ml/gcc/2001-10/msg01009.html for the original posting.
>How-To-Repeat:
$ cat t.c
#include <stdio.h>
struct exclusion
{
int a1;
int array[5];
} Table;
int *f(int start)
{
return Table.array + start;
}
int main(int argc, char *argv[])
{
int *next;
if ( argc == 2 )
next = f(atoi(argv[1]));
else
next = f(0);
printf("next = %p, Table.array = %p, diff = %d\n",
next, Table.array, next-Table.array);
return 0;
}
$ gcc -O -o t t.c
$ t
next = 0x8049710, Table.array = 0x8049710, diff = 2
>Fix:
do not use -O (but libjava is built using -O -g)
>Release-Note:
>Audit-Trail:
>Unformatted: