@
@(none)
I have the following file:
bugtest.c
I compile it on a RedHat Linux machine, using gcc
ehud@localhost ~>gcc --version
gcc (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
the compilation command line is:
gcc -ggdb -O0 -o bug_test bug_test.c
When looking in kdbg at the "test" variable, it has no valid address,
and I can not view its contents.
The file bugtest.out is however OK...
Any help?
Thanks
Ehud
=================================================================================
#include <stdio.h>
#define GRAND_N 624
typedef struct {
unsigned long state[GRAND_N]; /*!< the array for the state vector
*/
int left; /*!< can *next++ this many times before
reloading */
unsigned long *next; /*!< next random value is computed from here */
} genRandT;
int main() {
genRandT test;
genRandT test2;
int i;
FILE *fp;
for (i=0; i<GRAND_N; i++) {
test.state = i;
}
test.left = 1;
test.next = &(test.state[50]);
fp = fopen("bugtest.out","w");
for (i=0;i<GRAND_N;i++) {
fprintf(fp, "%d ", test.state);
}
return 0;
}
bugtest.c
I compile it on a RedHat Linux machine, using gcc
ehud@localhost ~>gcc --version
gcc (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
the compilation command line is:
gcc -ggdb -O0 -o bug_test bug_test.c
When looking in kdbg at the "test" variable, it has no valid address,
and I can not view its contents.
The file bugtest.out is however OK...
Any help?
Thanks
Ehud
=================================================================================
#include <stdio.h>
#define GRAND_N 624
typedef struct {
unsigned long state[GRAND_N]; /*!< the array for the state vector
*/
int left; /*!< can *next++ this many times before
reloading */
unsigned long *next; /*!< next random value is computed from here */
} genRandT;
int main() {
genRandT test;
genRandT test2;
int i;
FILE *fp;
for (i=0; i<GRAND_N; i++) {
test.state = i;
}
test.left = 1;
test.next = &(test.state[50]);
fp = fopen("bugtest.out","w");
for (i=0;i<GRAND_N;i++) {
fprintf(fp, "%d ", test.state);
}
return 0;
}