导致问题的代码行是
char command_tb_temp[][1000]={"gcc -Wall ","-o3 -ftree-ccp -fno-align-jumps "," Scripts/*.c -o output -lm && time -f \"%e\" -o TB.log ./output 1.dat"};
当通过只提供如下 1 个优化选项来编写相同的代码时,它不会返回任何错误。
char command_tb_temp[][1000]={"gcc -Wall ","-o3 -ftree-ccp "," Scripts/*.c -o output -lm && time -f \"%e\" -o TB.log ./output 1.dat"};
请帮我解决这个问题。非常感谢任何帮助。谢谢你。
这是整个功能..
int findtb(int flag)
{
printf("debug -1-1-1");
char command_tb_temp[][1000]={"gcc -Wall ","-o3 -ftree-ccp -fno-align-jumps "," Scripts/*.c -o output -lm && time -f \"%e\" -o TB.log ./output 1.dat"};
char command_tb[]="",line[100];
if(var[initial].exetime>0.00&&flag==1)
{
if(var[initial].rip<0.00)
strcat(finalop,var[initial].name);
else
return 0;
}
strcpy(command_tb_temp[1],finalop);
//strcat(command_tb_temp[1]," -ftree-ccp ");
for(int i=0;i<3;i++)
strcat(command_tb,command_tb_temp[i]);
printf("***** %s ****",command_tb);
system(command_tb);
fp=fopen("TB.log","r");
fscanf(fp,"%s",line);
tb=atof(line);
printf("\nTb=%f\n",tb);
fclose(fp);
return 1;
}
错误是...
*** stack smashing detected ***: ./3 terminated