I use different options to compile and excute the same programs, most of the results are the same, however, their are some are different, which are with the same problem. the same problem occurs in 4.1.2, 4.2.0, 4.2.1, 4.2.2., 4.2.3, 4.2.4, but the others are right. the test case is (automation generated): #include "stdio.h" #define divHelper(a) ((a)!=0?(a):1) #define shiftHelper(a) ((a)<0?0:((a)>8?8:(a)))
long ID118 = 33; double ID121 = 124.0F; double * ID123 = &ID121; volatile double ID125 = 137.0F; volatile double * ID126 = &ID125; double ID127[20][21]; double ID128[20][21]; double (* ID131)[21] = ID128; double ID129[20][21]; volatile double ID130[20][21]; double ID114[20][21]; double ID132[20][21]; double ID133[20][21]; double ID134[20][21]; double ID139 = 120.0F; long ID140 = 17; long * ID141 = &ID140; void func(void); int main(void) { volatile long ID115 = 20; long ID116 = 12; auto long ID117 = 29; long ID119 = 24; long ID120 = 13; double ID122 = 177.0F; double ID124 = 69.0F; const double ID135 = 179.0F; double ID136 = 172.0F; double * ID137 = &ID136; auto double ID138 = 171.0F; long ID142 = 44; long * ID143 = &ID142; int ID52 = 0; int ID21 = 0; int ID22 = 0; int ID38 = 0; int ID144 = 0; int ID145 = 0; int ID146 = 0; int ID147 = 0; int ID148 = 0; int ID149 = 0; int ID150 = 0; int ID151 = 0; int ID152 = 0; int ID153 = 0; int ID154 = 0; int ID155 = 0; int ID156 = 0; int ID157 = 0; int ID158 = 0; int ID159 = 0; FILE * fp; int ID160 = 0; int ID161 = 0; int ID162 = 0; int ID163 = 0; int ID164 = 0; int ID165 = 0; int ID166 = 0; int ID167 = 0; int ID168 = 0; int ID169 = 0; int ID170 = 0; int ID171 = 0; int ID172 = 0; int ID173 = 0; int ID174 = 0; int ID175 = 0; for(ID144 = 0; ID144 < 20; ID144++) for(ID145 = 0; ID145 < 21; ID145++) ID127[ID144][ID145] = ID144 * ID145 + 195.0F; for(ID146 = 0; ID146 < 20; ID146++) for(ID147 = 0; ID147 < 21; ID147++) ID128[ID146][ID147] = ID146 + ID147 + 199.0F; for(ID148 = 0; ID148 < 20; ID148++) for(ID149 = 0; ID149 < 21; ID149++) ID129[ID148][ID149] = ID148 - ID149 + 57.0F; for(ID150 = 0; ID150 < 20; ID150++) for(ID151 = 0; ID151 < 21; ID151++) ID130[ID150][ID151] = ID150 + ID151 + 7.0F; for(ID152 = 0; ID152 < 20; ID152++) for(ID153 = 0; ID153 < 21; ID153++) ID114[ID152][ID153] = ID152 - ID153 + 153.0F; for(ID154 = 0; ID154 < 20; ID154++) for(ID155 = 0; ID155 < 21; ID155++) ID132[ID154][ID155] = ID154 * ID155 + 89.0F; for(ID156 = 0; ID156 < 20; ID156++) for(ID157 = 0; ID157 < 21; ID157++) ID133[ID156][ID157] = ID156 + ID157 + 82.0F; for(ID158 = 0; ID158 < 20; ID158++) for(ID159 = 0; ID159 < 21; ID159++) ID134[ID158][ID159] = ID158 * ID159 + 101.0F; ID115 = ID118 % divHelper(ID117 > (ID116 <= ID115)); ID117 = ID116 / divHelper(ID115) <= ID118 | ID119; ID115 = (ID117 << shiftHelper(ID116)) - ID115; ID117 = (ID115 < ID117 + ID116) << shiftHelper(ID120); *ID123 = ID122 + ID121; for(ID52 = 0; ID52 < 102; ID52++) func(); ID121 = ID125 + (ID124 || ID122 >= ID121); for(ID21 = 1; ID21 < 20; ID21++) for(ID22 = 5; ID22 < 24; ID22++) { ID114[ID21][ID22 - 3] = (ID129[ID21][ID22 - 3] != (ID128[ID21][ID22 - 3] != ID127[ID21][ID22 - 3])) <= ID130[ID21][ID22 - 3]; ID134[ID21 - 1][ID22 - 5] = ID132[ID21 - 1][ID22 - 5] * ID114[ID21 - 1][ID22 - 5] + ID133[ID21 - 1][ID22 - 5]; } ID115 = ID117 == ID116; *ID123 = ID135 / divHelper(ID124 < ID122); ID124 = (ID121 && ID122) >= ID136; if(ID119 < 25) *ID126 = ID136 >= (*ID123 || ID122) != ID138; else ID138 = ID139 + (!(ID138 + ID125) && ID122); ID124 = *ID126 * ID135; ID115 = ID120 + (ID119 < ID118); ID119 = ID115 & !ID116 & ID119 | ID120; for(ID38 = 0; ID38 < 144; ID38++) { ID115 = ID119 == ID116; ID138 = ID136 + *ID123; *ID137 = ID135 == *ID123 < ID124 / divHelper(ID139); } ID120 = (ID120 && ID118) ^ *ID141; ID120 = ID115 && *ID143; *ID137 = ID122 <= *ID123 + ID135; fp = fopen("case7.out", "wt"); fprintf(fp, "ID115=%d\n", ID115); fprintf(fp, "ID116=%d\n", ID116); fprintf(fp, "ID117=%d\n", ID117); fprintf(fp, "ID118=%d\n", ID118); fprintf(fp, "ID119=%d\n", ID119); fprintf(fp, "ID120=%d\n", ID120); fprintf(fp, "ID121=%.2f\n", ID121); fprintf(fp, "ID122=%.2f\n", ID122); fprintf(fp, "ID124=%.2f\n", ID124); fprintf(fp, "ID125=%.2f\n", ID125); for(ID160 = 0; ID160 < 20; ID160++) for(ID161 = 0; ID161 < 21; ID161++) fprintf(fp, "ID127[%d][%d]=%.2f\n", ID160, ID161, ID127[ID160][ID161]); for(ID162 = 0; ID162 < 20; ID162++) for(ID163 = 0; ID163 < 21; ID163++) fprintf(fp, "ID128[%d][%d]=%.2f\n", ID162, ID163, ID128[ID162][ID163]); for(ID164 = 0; ID164 < 20; ID164++) for(ID165 = 0; ID165 < 21; ID165++) fprintf(fp, "ID129[%d][%d]=%.2f\n", ID164, ID165, ID129[ID164][ID165]); for(ID166 = 0; ID166 < 20; ID166++) for(ID167 = 0; ID167 < 21; ID167++) fprintf(fp, "ID130[%d][%d]=%.2f\n", ID166, ID167, ID130[ID166][ID167]); for(ID168 = 0; ID168 < 20; ID168++) for(ID169 = 0; ID169 < 21; ID169++) fprintf(fp, "ID114[%d][%d]=%.2f\n", ID168, ID169, ID114[ID168][ID169]); for(ID170 = 0; ID170 < 20; ID170++) for(ID171 = 0; ID171 < 21; ID171++) fprintf(fp, "ID132[%d][%d]=%.2f\n", ID170, ID171, ID132[ID170][ID171]); for(ID172 = 0; ID172 < 20; ID172++) for(ID173 = 0; ID173 < 21; ID173++) fprintf(fp, "ID133[%d][%d]=%.2f\n", ID172, ID173, ID133[ID172][ID173]); for(ID174 = 0; ID174 < 20; ID174++) for(ID175 = 0; ID175 < 21; ID175++) fprintf(fp, "ID134[%d][%d]=%.2f\n", ID174, ID175, ID134[ID174][ID175]); fprintf(fp, "ID135=%.2f\n", ID135); fprintf(fp, "ID136=%.2f\n", *ID137); fprintf(fp, "ID138=%.2f\n", ID138); fprintf(fp, "ID139=%.2f\n", ID139); fprintf(fp, "ID140=%d\n", *ID141); fprintf(fp, "ID142=%d\n", ID142); fclose(fp); return 0; } void func(void) { ID121 += 1; ID125 += 1; ID139 += 1; } when I use option (just with tree-loop-linear on): -O3 -fno-align-functions -fno-align-jumps -fno-align-labels -fno-align-loops -fno-bounds-check -fno-branch-probabilities -fno-profile-values -fno-vpt -fno-branch-target-load-optimize -fno-branch-target-load-optimize2 -fno-btr-bb-exclusive -fno-caller-saves -fno-cprop-registers -fno-cse-follow-jumps -fno-cse-skip-blocks -fno-cx-limited-range -fno-data-sections -fno-delayed-branch -fno-delete-null-pointer-checks -fno-expensive-optimizations -fno-fast-math -fno-float-store -fno-force-addr -fno-function-sections -fno-gcse -fno-strict-aliasing -fno-gcse-lm -fno-gcse-sm -fno-gcse-las -fno-gcse-after-reload -fno-crossjumping -fno-if-conversion -fno-if-conversion2 -fno-inline-functions -fno-keep-inline-functions -fno-keep-static-consts -fno-merge-constants -fno-merge-all-constants -fno-modulo-sched -fno-branch-count-reg -fno-defer-pop -fno-move-loop-invariants -fno-function-cse -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole -fno-peephole2 -fno-unsafe-math-optimizations -fno-finite-math-only -fno-trapping-math -fno-zero-initialized-in-bss -fno-omit-frame-pointer -fno-optimize-register-move -fno-optimize-sibling-calls -fno-prefetch-loop-arrays -fno-profile-generate -fno-profile-use -fno-regmove -fno-rename-registers -fno-reorder-blocks -fno-reorder-blocks-and-partition -fno-reorder-functions -fno-rerun-cse-after-loop -fno-rounding-math -fno-schedule-insns -fno-schedule-insns2 -fno-sched-interblock -fno-sched-spec -fno-sched-spec-load -fno-sched-spec-load-dangerous -fno-sched-stalled-insns -fno-sched2-use-superblocks -fno-sched2-use-traces -fno-reschedule-modulo-scheduled-loops -fno-signaling-nans -fno-single-precision-constant -fno-tracer -fno-thread-jumps -fno-unroll-all-loops -fno-unroll-loops -fno-peel-loops -fno-split-ivs-in-unroller -fno-variable-expansion-in-unroller -fno-tree-pre -fno-tree-ccp -fno-tree-dce -ftree-loop-optimize -ftree-loop-linear -fno-tree-loop-im -fno-tree-loop-ivcanon -fno-ivopts -fno-tree-dominator-opts -fno-tree-dse -fno-tree-copyrename -fno-tree-ch -fno-tree-sra -fno-tree-ter -fno-tree-fre -fno-tree-vectorize -fno-web and run, the result is error. however when I use the option O0 (all optimizations are off), the result is right. the same problem occurs with some other test cases. the problem is when one of the array indexes reaches the upbound, the result is error. -- Summary: the result when excuted with loop-linear on is different to that with O0 Product: gcc Version: 4.2.4 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: yu19820428 at 163 dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38778