This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: gcc miscompiles its sources (boehm-gc)


Sorry to reply to my own message, but i finally found a small testcase
(i filed a gnats report, but i do not know whether it came through).
Here it is:

$ 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

seems to be wrong a bit.

Bye,
Martin.

-- 
The early bird catches the worm. If you want something else for       
breakfast, get up later.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]