This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
v850-elf-gcc produces corrupted debugging info
- To: egcs-bugs at cygnus dot com
- Subject: v850-elf-gcc produces corrupted debugging info
- From: Franz Sirl <Franz dot Sirl-kernel at lauterbach dot com>
- Date: Fri, 05 Jun 1998 13:50:04 +0200
- Cc: nickc at cygnus dot com
Hi,
I was trying to compile the attached program with
[root@linuxpc1:/var/home/gcc/v850/demo]# v850-elf-gcc -v -save-temps -g -c
gnu.c Reading specs from
/var/home/gcc/v850/lib/gcc-lib/v850-elf/egcs-2.91.34/specs
gcc version egcs-2.91.34 19980604 (gcc2 ss-980502 experimental)
/var/home/gcc/v850/lib/gcc-lib/v850-elf/egcs-2.91.34/cpp -lang-c -v -undef
-D__GNUC__=2 -D__GNUC_MINOR__=91 -D__v851__ -D__v850 -D__v851__ -D__v850 -g
-D__v850__ gnu.c gnu.i
GNU CPP version egcs-2.91.34 19980604 (gcc2 ss-980502 experimental) (NEC V850)
#include "..." search starts here:
#include <...> search starts here:
/var/home/gcc/v850/lib/gcc-lib/v850-elf/egcs-2.91.34/include
/var/home/gcc/v850/v850-elf/include
End of search list.
/var/home/gcc/v850/lib/gcc-lib/v850-elf/egcs-2.91.34/cc1 gnu.i -quiet
-dumpbase gnu.c -g -version -o gnu.s
GNU C version egcs-2.91.34 19980604 (gcc2 ss-980502 experimental)
(v850-elf) compiled by GNU C version 2.7.2.1.
/var/home/gcc/v850/v850-elf/bin/as -o gnu.o gnu.s
and linked it with
v850-elf-ld -v -o gnu.out gnu.o
../lib/gcc-lib/v850-elf/egcs-2.91.34/libgcc.a --entry _main -Ttext 0x0
--oformat elf32-v850
GNU ld version 2.9.4 (with BFD 980602)
The resulting gnu.out is corrupted. I cannot load it into our debugger and
v850-elf-objdump -d --source segfaults on it.
Thanks,
Franz.
#define TRUE 1
#define FALSE 0
#define SIZE 18
static int mstatic1, mstatic2;
float vfloat = 1.0;
double vdouble = 1.0;
typedef int tdef1;
tdef1 vtdef1;
typedef short tdef2[10];
tdef2 vtdef2;
struct
{
int x, y;
}
vstruct1;
char vchar;
short vshort;
int vint;
long vlong;
char * vpchar;
short * vpshort;
int * vpint;
long * vplong;
unsigned char vuchar;
unsigned short vushort;
unsigned int vuint;
unsigned long vulong;
unsigned char * vpuchar;
unsigned short * vpushort;
unsigned int * vpuint;
unsigned long * vpulong;
unsigned char * * vppuchar;
unsigned short * * vppushort;
unsigned int * * vppuint;
unsigned long * * vppulong;
int varray[10];
typedef int tarray[10];
tarray vtarray;
char vdarray[5];
char vdiarray[] = "abcd";
char vdblarray[5][6];
struct struct4 {
struct struct5 * pstruct5;
struct struct5 * * ppstruct5;
struct struct5 * pastruct5[2];
} ;
struct struct5 {
struct struct4 * pstruct4;
struct struct4 * * ppstruct4;
struct struct4 * pastruct4[2];
} ;
typedef struct struct1 {
char * word;
int count;
struct struct1 * left;
struct struct1 * right;
int field1:2;
unsigned field2:3;
} strtype1 ;
strtype1 ast;
typedef struct struct1 structarray[10];
structarray stra1;
struct struct4 stra2[5][5];
struct union1 {
char * word;
int count;
struct struct1 * left;
struct struct1 * right;
union {
int ival;
float fval;
char * pval;
} uval;
int field1:2;
unsigned field2:3;
} aun;
struct struct2 {
char * word;
int count;
} str2;
struct struct6 {
int x;
struct struct7 {
char * word;
int count;
} vstruct7;
int y;
} str6;
struct abc
{
int x;
int y;
};
struct abc def;
union tunion
{
int z1;
short z2;
char z3;
struct abc z4;
} vunion;
enum enumtyp { enum1, enum2, enum4=4, enum7=7, enum8, enumx= -1 } enumvar;
int ( *funcptr ) ();
func0() /* empty function */
{
}
static void func1( intptr ) /* static function */
int * intptr;
{
(*intptr)++;
}
void func2()
{
int autovar;
register int regvar;
static int fstatic = 44; /* initialized static variable */
static int fstatic2; /* not initialized static variable */
autovar = regvar = fstatic;
autovar++;
func1( &autovar ); /* to force autovar as stack-scope */
func1( &fstatic ); /* to force fstatic as static-scope */
for ( regvar = 0; regvar < 5 ; regvar++ )
mstatic1 += regvar*autovar;
fstatic += mstatic1;
fstatic2 = 2*fstatic;
func1( &fstatic2 );
}
static int func3() /* simple function */
{
return 5;
}
struct struct1 func4( str ) /* function returning struct */
struct struct1 str;
{
str.count++;
return str;
}
int func5( a, b, c ) /* multiple arguments */
int a;
char b;
long c;
{
return a+b*c;
}
float func6( a, b )
float a;
float b;
{
vfloat = 1.0;
vfloat = -1.0;
vfloat = 10.0;
vfloat = 1.6;
return a*b;
}
double func7( a, b )
double a;
double b;
{
vdouble = 1.0;
vdouble = -1.0;
vdouble = 10.0;
vdouble = 1.6;
return a*b;
}
struct bfield
{
int a:1;
int b:2;
int c:3;
int d:7;
int e:8;
int f:15;
int g:1;
int h:15;
int i:1;
int j:16;
unsigned k:1;
unsigned l:2;
unsigned m:16;
long n;
char o;
long p:27;
char q:6;
char r:1;
enum enumtyp enum1:4;
enum enumtyp enum2:7;
};
struct bfield vbfield;
void func8()
{
vbfield.a = 1;
vbfield.b = 1;
vbfield.c = 1;
vbfield.d = 1;
vbfield.e = 1;
vbfield.f = 1;
vbfield.g = 1;
vbfield.h = 1;
vbfield.i = 1;
vbfield.j = 1;
vbfield.k = 1;
vbfield.l = 1;
vbfield.m = 1;
vbfield.n = 1;
vbfield.o = 1;
vbfield.p = 1;
vbfield.q = 1;
vbfield.r = 1;
vbfield.enum1 = enum2;
vbfield.enum2 = enum2;
vbfield.a = -1;
vbfield.b = -1;
vbfield.c = -1;
vbfield.d = -1;
vbfield.e = -1;
vbfield.f = -1;
vbfield.g = -1;
vbfield.h = -1;
vbfield.i = -1;
vbfield.j = -1;
vbfield.k = -1;
vbfield.l = -1;
vbfield.m = -1;
vbfield.n = -1;
vbfield.o = -1;
vbfield.p = -1;
vbfield.q = -1;
vbfield.r = -1;
vbfield.enum1 = enumx;
vbfield.enum2 = enumx;
}
static int * func9() /* nested local variables */
{
static stat1 = 0;
register reg1;
auto auto1;
for ( reg1 = 0 ; reg1 < 2 ; reg1++ )
{
static stat2 = 0;
register reg2;
auto auto2;
for ( reg2 = 0 ; reg2 < reg1 ; reg2++ )
{
func1( &stat1 );
func1( &auto1 );
func1( &stat2 );
func1( &auto2 );
}
{
auto inblock1;
inblock1 = 2*reg1;
func1( &inblock1 );
}
{
auto inblock2;
inblock2 = 2*reg1;
func1( &inblock2 );
}
}
return &stat1;
}
func10() /* lokal variables with coloring */
{
register i, j;
register v1, v2, v3, v4, v5, v6, v7, v8;
register v9, v10, v11, v12, v13, v14, v15, v16, v17;
v17 = 0;
for ( i = 0 ; i < 3 ; i++ )
v17 += i;
for ( v1 = 0 ; v1 < 3 ; v1++ )
v17 += v1;
for ( v2 = 0 ; v2 < 3 ; v2++ )
v17 += v2;
for ( v3 = 0 ; v3 < 3 ; v3++ )
v17 += v3;
for ( v4 = 0 ; v4 < 3 ; v4++ )
v17 += v4;
for ( v5 = 0 ; v5 < 3 ; v5++ )
v17 += v5;
for ( v6 = 0 ; v6 < 3 ; v6++ )
v17 += v6;
for ( v7 = 0 ; v7 < 3 ; v7++ )
v17 += v7;
for ( v8 = 0 ; v8 < 3 ; v8++ )
v17 += v8;
for ( v9 = 0 ; v9 < 3 ; v9++ )
v17 += v9;
for ( v10 = 0 ; v10 < 3 ; v10++ )
v17 += v10;
for ( v11 = 0 ; v11 < 3 ; v11++ )
v17 += v11;
for ( v12 = 0 ; v12 < 3 ; v12++ )
v17 += v12;
for ( v13 = 0 ; v13 < 3 ; v13++ )
v17 += v13;
for ( v14 = 0 ; v14 < 3 ; v14++ )
v17 += v14;
for ( v15 = 0 ; v15 < 3 ; v15++ )
v17 += v15;
for ( v16 = 0 ; v16 < 3 ; v16++ )
v17 += v16;
i = j = v17;
for ( v1 = 0 ; v1 < 3 ; v1++ )
v17 += v1;
for ( v2 = 0 ; v2 < 3 ; v2++ )
v17 += v2;
for ( v3 = 0 ; v3 < 3 ; v3++ )
v17 += v3;
for ( v4 = 0 ; v4 < 3 ; v4++ )
v17 += v4;
for ( v5 = 0 ; v5 < 3 ; v5++ )
v17 += v5;
for ( v6 = 0 ; v6 < 3 ; v6++ )
v17 += v6;
for ( v7 = 0 ; v7 < 3 ; v7++ )
v17 += v7;
for ( v8 = 0 ; v8 < 3 ; v8++ )
v17 += v8;
for ( v9 = 0 ; v9 < 3 ; v9++ )
v17 += v9;
for ( v10 = 0 ; v10 < 3 ; v10++ )
v17 += v10;
for ( v11 = 0 ; v11 < 3 ; v11++ )
v17 += v11;
for ( v12 = 0 ; v12 < 3 ; v12++ )
v17 += v12;
for ( v13 = 0 ; v13 < 3 ; v13++ )
v17 += v13;
for ( v14 = 0 ; v14 < 3 ; v14++ )
v17 += v14;
for ( v15 = 0 ; v15 < 3 ; v15++ )
v17 += v15;
for ( v16 = 0 ; v16 < 3 ; v16++ )
v17 += v16;
return v17;
}
int func11( x ) /* problems with optimizer */
int x;
{
switch ( x )
{
case 1:
x = x+1;
x = x*2;
return x*x;
case 2:
return x+x;
case 3:
return x-x;
case 4:
x = x+1;
x = x*2;
return x*x;
case 5:
break;
case 6:
return x+x;
default:
break;
}
return x;
}
typedef char undefarray[];
typedef undefarray * undefptr;
int func12( ptr ) /* pointer to array of unknown size */
undefptr ptr;
{
(*ptr)[0] = 1;
}
int func13( a, c, e ) /* arguments and locals stack-tracking */
int a, c, e;
{
int b, d, f;
b = a+c+e;
f = b+a;
d = f*b;
if ( e > 0 )
c += func13( b, f, e-1 );
return c+e+d;
}
main()
{
int j;
func2();
funcptr = func3;
ast.count = 12345;
ast.left = *
ast.field1 = 1;
ast.field2 = 2;
ast = func4( ast );
j = (*funcptr)();
start:
j = func5( j, 2, 3 );
if ( j == 0 )
goto start;
enumvar = enumx;
vfloat = 2.0;
func6( vfloat, (float) 3.0 );
vdouble = 2.0;
func7( vdouble, (double) 3.0 );
func8();
func9();
func10();
func11( 5 );
func12( "abc" );
func13( 1, 2, 3 );
while ( TRUE )
{
sieve();
}
}
char flags[SIZE+1];
int sieve() /* sieve of erathostenes */
{
register int i, primz, k;
int anzahl;
anzahl = 0;
for ( i = 0 ; i <= SIZE ; flags[ i++ ] = TRUE ) ;
for ( i = 0 ; i <= SIZE ; i++ )
{
if ( flags[ i ] )
{
primz = i + i + 3;
k = i + primz;
while ( k <= SIZE )
{
flags[ k ] = FALSE;
k += primz;
}
anzahl++;
}
}
return anzahl;
}
int background() /* job for background-demo */
{
register long count1, count2;
count1 = count2 = 0;
while ( TRUE )
{
while ( ++count1 ) ;
count2++;
}
return TRUE;
}