This is with gcc-Version 4.3.0 20070131 on x86_64-unknown-linux-gnu. Using the Polyhedron tests, four tests fail with the -fprofile-use option, cf. http://www.physik.fu-berlin.de/~tburnus/gcc-trunk/benchmark/#rt The tests are available from: http://www.polyhedron.co.uk/pb05/polyhedron_benchmark_suite.html I did: gfortran -fprofile-generate -march=opteron -ffast-math -funroll-loops -ftree-vectorize -msse3 -O3 -o aermod aermod.f90 ./aermod gfortran -fprofile-use -march=opteron -ffast-math -funroll-loops -ftree-vectorize -msse3 -O3 aermod.f90 The latter crashes with test.f90: In function 'setidg': test.f90:48679: internal compiler error: Floating point exception If the *.gc* file(s) don't exist, no error occures. This regression occurs between 2007-01-27-r121231 and 2007-01-30-r121332. Program received signal SIGFPE, Arithmetic exception. 0x000000000076c316 in stringop_block_profile (stmt=0x2b59f9ca67d0, expected_align=0x7fffb3a2ed70, expected_size=0x7fffb3a2ed68) at /projects/tob/gcc/gcc/value-prof.c:1440 1440 size = ((histogram->hvalue.counters[0] (gdb) bt #0 0x000000000076c316 in stringop_block_profile (stmt=0x2b59f9ca67d0, expected_align=0x7fffb3a2ed70, expected_size=0x7fffb3a2ed68) at /projects/tob/gcc/gcc/value-prof.c:1440 #1 0x00000000004c4f97 in expand_builtin_memset (arglist=<value optimized out>, target=0x2b59f70c7400, mode=VOIDmode, orig_exp=0x2b59f9ca67d0) at /projects/tob/gcc/gcc/builtins.c:3739 #2 0x00000000004c86db in expand_builtin (exp=0x2b59f9ca67d0, target=0x2b59f70c7400, subtarget=0x0, mode=VOIDmode, ignore=1) at /projects/tob/gcc/gcc/builtins.c:6228 #3 0x0000000000534bb8 in expand_expr_real_1 (exp=0x2b59f9ca67d0, target=0x0, tmode=VOIDmode, modifier=EXPAND_NORMAL, alt_rtl=0x0) at /projects/tob/gcc/gcc/expr.c:7724 #4 0x000000000053a3e3 in expand_expr_real (exp=0x2b59f9ca67d0, target=0x2b59f70c7400, tmode=VOIDmode, modifier=EXPAND_NORMAL, alt_rtl=0x0) at /projects/tob/gcc/gcc/expr.c:6746 #5 0x0000000000642049 in expand_expr_stmt (exp=0x2b59fa3e8540) at /projects/tob/gcc/gcc/expr.h:501 #6 0x00000000008ed6b5 in expand_gimple_basic_block (bb=0x2b59fa526000) at /projects/tob/gcc/gcc/cfgexpand.c:1540 #7 0x00000000008ee42e in tree_expand_cfg () at /projects/tob/gcc/gcc/cfgexpand.c:1810
Confirmed. I'm confused by the code anyways: size = ((histogram->hvalue.counters[0] + histogram->hvalue.counters[0] / 2) / histogram->hvalue.counters[0]); according to the source counter[0] is supposed to be the sum of the sizes and counters[1] the call count. Also all of this profiling stuff needs better commenting. Like #define GCOV_COUNTER_AVERAGE 6 /* The most common difference between consecutive values of expression. */ #define GCOV_COUNTER_IOR 7 /* The most common difference between consecutive values of expression. */ and case HIST_TYPE_AVERAGE: hist->n_counters = 3; break; (which should be 2?) as void __gcov_average_profiler (gcov_type *counters, gcov_type value) { counters[0] += value; counters[1] ++; } suggests. So the code in question should probably read if (!histogram || histogram->hvalue.counters[1] == 0) *expected_size = -1; else { gcov_type size; size = ((histogram->hvalue.counters[0] + histogram->hvalue.counters[0] / 2) / histogram->hvalue.counters[1]); but defering to Honza who wrote all this code.
I'm guessing "make profiledbootstrap" fails on my machine for the same reason. (I get the same ICE). Last tested with snapshot gcc-4.3.0_alpha20070202. My platform is i386 though, not x86_64, using CFLAGS "-march=pentium4 -O2 -pipe". For sake of completeness, I tried "make bootstrap-lean" to see if the same error would occur. The build failed on assembler messages trying to compile io/unix.c in libgfortran, which I'm guessing is at a later stage than the ICE we're talking about.
Testing fix.
Created attachment 13002 [details] Fix
size = ((histogram->hvalue.counters[0] + histogram->hvalue.counters[0] / 2) - / histogram->hvalue.counters[0]); + / histogram->hvalue.counters[1]); micha suggested you meant size = ((histogram->hvalue.counters[0] + histogram->hvalue.counters[1] / 2) / histogram->hvalue.counters[1]); (upward rounding)
Subject: Re: [4.3 Regression] ICE with -fprofile-use > size = ((histogram->hvalue.counters[0] > + histogram->hvalue.counters[0] / 2) > - / histogram->hvalue.counters[0]); > + / histogram->hvalue.counters[1]); > > micha suggested you meant > > size = ((histogram->hvalue.counters[0] > + histogram->hvalue.counters[1] / 2) > / histogram->hvalue.counters[1]); > > (upward rounding) Ah, yes, thanks! I probably should've scheduled updating this patch for mainline after the trip as I didn't do particularly good work on it just before leaving :(
Subject: Bug 30650 Author: hubicka Date: Sat Feb 3 23:35:42 2007 New Revision: 121554 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=121554 Log: PR gcov-profile/30650 * value-prof.c (stringop_block_profile): Fix handling of size counter; do not divide by zero for never executed counters. (tree_find_values_to_profile): Fix counters. * gcov-ui.h (GCOV_COUNTER_AVERAGE, GCOV_COUNTER_IOR): Fix comments. Modified: trunk/gcc/ChangeLog trunk/gcc/gcov-io.h trunk/gcc/value-prof.c
Thanks, aermod now works. :-) channel, gas_dyn, induct, nf, protein, rnflow still fail respectively fail now. $ gfortran -fprofile-generate -march=opteron -ffast-math -funroll-loops -ftree-vectorize -O3 -o channel channel.f90 $ ./channel $ gfortran -fprofile-use -march=opteron -ffast-math -funroll-loops -ftree-vectorize -msse3 -O3 channel.f90 -o channel channel.f90: In function 'ddx': channel.f90:280: error: coverage mismatch for function 'ddx.1399' while reading counter 'arcs' channel.f90:280: note: checksum is ba382717 instead of 69f94a4c channel.f90: In function 'ddy': channel.f90:280: error: coverage mismatch for function 'ddy.1395' while reading counter 'arcs' channel.f90:280: note: checksum is bb64fb88 instead of 68a596d3 $ gfortran -fprofile-generate -march=opteron -ffast-math -funroll-loops -ftree-vectorize -O3 -o gas_dyn gas_dyn.f90 $ ./gas_dyn $ gfortran -fprofile-use -march=opteron -ffast-math -funroll-loops -ftree-vectorize -msse3 -O3 gas_dyn.f90 -o gas_dyn gas_dyn.f90: In function 'cd': gas_dyn.f90:2381: error: coverage mismatch for function 'cd.1530' while reading counter 'arcs' gas_dyn.f90:2381: note: checksum is 84fd4f39 instead of df1d94b9 gas_dyn.f90: In function 'sgeom': gas_dyn.f90:2381: error: coverage mismatch for function 'sgeom.1760' while reading counter 'arcs' gas_dyn.f90:2381: note: checksum is d9079ae8 instead of 82e74168 gas_dyn.f90: In function 'qsort': gas_dyn.f90:2381: error: coverage mismatch for function 'qsort.2270' while reading counter 'arcs' gas_dyn.f90:2381: note: checksum is 33561d20 instead of 68b6c6a0 $ gfortran -fprofile-generate -march=opteron -ffast-math -funroll-loops -ftree-vectorize -O3 -o induct induct.f90 $ ./induct $ gfortran -fprofile-use -march=opteron -ffast-math -funroll-loops -ftree-vectorize -msse3 -O3 induct.f90 -o induct induct.f90: In function 'time_now': induct.f90:6607: error: coverage mismatch for function 'time_now.7478' while reading counter 'arcs' induct.f90:6607: note: checksum is 76f94b6a instead of caa6dac5
Hi, the reason is -msse3 that is supposed to be at both invocations. -msse3 enables the SSE builtins that do change declarations UIDs that in turn changes function names: < ;; Function ddx (ddx.1401) --- > ;; Function ddx (ddx.1390) so profiles can't match. While it is possible to ignore the SSA names, I don't think there is actual need to mess with this - the use of different swtiches that do affect input language clearly can't be much accepted in between train and compilation run (I am hoping that optimization switches like -funroll-loops will run, but for language features, like SSE is we will get different divergences anyway) The other problem was fixed, so I am closing the PR. Honza