[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

GCC crash



Hello.

Perhaps this doesn't belong here, but I start here and see where you think I 
should mail this.

Has anybody tried to compile rayshade, which is a ray-tracing program?
I have. gcc crashes while compiling a file called transform.c.
The version is 2.6.3, straight from debian 0.93R6.

This is how gcc is invoked: 
gcc -I../.. -O -c transform.c

I know that it has something to do with the -O flag, because if I try 
"gcc -I../.. -c transform.c", it compiles fine.

By removing more and more I found what function in the source file that makes 
gcc go BOOM. This is the result. Can anybody else try this? The source code is 
last.
For the record I can add that it compiles fine under SUNOS 4.1.3 and SUNOS 5.4,
Solaris with the 2.6.3 version.

I've tried to run xxgdb on gcc, whereupon I noticed:

1. gcc is compiled without -g. 

Ok, I can live with that. I took home sources of gcc and compiled and cross-
compiled with -g. Impressing size of resulting executables, I must say.

2. gcc forks soon.

What do I do now? How do run xxgdb on the child, or is it the child I'm 
debugging after the fork? I don't think so.

3. libc or whatever the library containg malloc's code is is compiled with -g.

Why? I don't mind, this means I don't have to recompile the libraries; just 
curious. (Actually I had already taken home the code for that, because I though
I would have to recompile them to get the -g flag, so I mind a little.)


gcc compiled with -g -> full hard disk, 

							MartinS

---------- File gcc_crashes.c starts. --------------------
/*
Compile with "gcc -I../.. -O -c gcc_crashes.c".
 */

typedef double Float;

typedef struct Vector {
	Float x, y, z;			/* 3D point */
} Vector;

/*
 * Transformation 'matrix'.
 */
typedef struct RSMatrix {
	Float matrix[3][3];		/* Rotation matrix */
	Vector translate;		/* Translation */
} RSMatrix;

/*
 * 'c1x' is the X (0th) component of the first column, and so on.
 */
void
ArbitraryMatrix(c1x, c2x, c3x, c1y, c2y, c3y, c1z, c2z, c3z, tx, ty, tz, trans)
Float c1x, c1y, c1z, c2x, c2y, c2z, c3x, c3y, c3z, tx, ty, tz;
RSMatrix *trans;
{
	trans->matrix[0][0] = c1x;
	trans->matrix[1][0] = c1y;
	trans->matrix[2][0] = c1z;

	trans->matrix[0][1] = c2x;
	trans->matrix[1][1] = c2y;
	trans->matrix[2][1] = c2z;

	trans->matrix[0][2] = c3x;
	trans->matrix[1][2] = c3y;
	trans->matrix[2][2] = c3z;

	trans->translate.x = tx;
	trans->translate.y = ty;
	trans->translate.z = tz;
}

---------- File gcc_crashes.c ends. --------------------


Reply to: