Regehr: GCC 4.8 Breaks Broken SPEC 2006 Benchmarks
Regehr: GCC 4.8 Breaks Broken SPEC 2006 Benchmarks
Posted Mar 23, 2013 16:38 UTC (Sat) by ssam (guest, #46587)In reply to: Regehr: GCC 4.8 Breaks Broken SPEC 2006 Benchmarks by HelloWorld
Parent article: Regehr: GCC 4.8 Breaks Broken SPEC 2006 Benchmarks
I sometimes use code like:
int a[] = {6,8,3};
...
for (int i=0; i<(sizeof(a)/sizeof(int)); i++){
done_stuff_with(a[i]);
}
...
maybe because i want to check if a particle in a simulation is in one of my regions of interest. I may often modify a, and then recompile the code (in my work its not unusual to recompile code before each run). Sometimes a will just be {}, so i would like the compiler remove the loop.
Posted Mar 23, 2013 17:32 UTC (Sat)
by apoelstra (subscriber, #75205)
[Link] (1 responses)
I do this too, and I also compile with -Werror, but IMHO I'd rather have the warning than not. A simple (ugly) solution is to couch your loop in #ifdef's, and just flip a preprocessor variable.
Posted Mar 26, 2013 5:31 UTC (Tue)
by bronson (subscriber, #4806)
[Link]
Compiler warnings would too... If the compiler emits 22 "might be true" warnings, and 21 of them are spurious, what are the chances I'll catch the meaningful one? Knowing me, probably next to nil.
Regehr: GCC 4.8 Breaks Broken SPEC 2006 Benchmarks
Regehr: GCC 4.8 Breaks Broken SPEC 2006 Benchmarks