LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   GCC 2.2.2 seems to genrate bad code (https://www.linuxquestions.org/questions/programming-9/gcc-2-2-2-seems-to-genrate-bad-code-384549/)

dogbird 11-19-2005 01:02 AM

GCC 2.2.2 seems to genrate bad code
 
I have written some bad code that I am debugging. I have a loop with several statements in it. It does not step through the code in the loop. It executes the first statement. It does not execute anything after that. There is nothing wrong with the code. GDB just will not step through the loop at all.

It looks like bad code being generated. sigh. This is a standalone machine and moving things to it is very difficult. Only the floppy can be used.

Please Tell me some work around for this.

The code is generally as follows


symbol_table ( Cchar *) inname, int id)
{
token2 = (char *) malloc(64*sizeof(char));

if ( last_name != 0 ) {

(1) for (i=1;i<=last_name;i++){


(2) token2 = symbol_name[i];

i/* the last statement is in a loop with the for loop. No other statements execute.

if (strcmp(inname, token2) == 0)

more statements and they are compileable clean.



josephus

creolophus 11-19-2005 04:59 AM

umm .... isnt everyone else using GCC 3.2/3.3/4.0 ?

*somehow* try to get one of the later releases

shanenin 11-19-2005 12:55 PM

to rule out your code being the problem, have you tried to use the code with a later verion of gcc on another machine?


All times are GMT -5. The time now is 06:01 PM.