current CP2K CVS fails to compile with [trunk revision 134945] /data03/vondele/clean/cp2k/src/../src/atomic_kind_types.F: In function ‘read_atomic_kind’: /data03/vondele/clean/cp2k/src/../src/atomic_kind_types.F:1158: error: Dead histogram IOR value ior:0. __builtin_memset (&element_symbol[2]{lb: 1 sz: 1}, 32, 1); /data03/vondele/clean/cp2k/src/../src/atomic_kind_types.F:1158: internal compiler error: verify_h istograms failed Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. when compiled with command line: gfortran -c -fprofile-use -O3 -ffast-math -funroll-loops -ftree-vectorize -march=native -ffree-form -D__GFORTRAN -D__FFTSG -D__COMPILE_ARCH="\"Linux-x86-64-gfortran\"" -D__COMPILE_DATE="\"Mon May 5 12:27:17 CEST 2008\"" -D__COMPILE_HOST="\"pcihopt3\"" -D__COMPILE_LASTCVS="\"/qs_integrate_potential.F/1.136/Fri May 2 13:45:49 2008//\"" /data03/vondele/clean/cp2k/src/../src/atomic_kind_types.F what is the best way to get this to a reasonable testcase?
at least a back trace, but I guess that is not very useful: #0 internal_error (gmsgid=0xc34369 "verify_histograms failed") at /data03/vondele/gcc_trunk/gcc/gcc/diagnostic.c:594 #1 0x00000000008c949d in verify_histograms () at /data03/vondele/gcc_trunk/gcc/gcc/value-prof.c:393 #2 0x0000000000701aab in verify_stmts () at /data03/vondele/gcc_trunk/gcc/gcc/tree-cfg.c:4411 #3 0x00000000008531a9 in verify_ssa (check_modified_stmt=1 '\001') at /data03/vondele/gcc_trunk/gcc/gcc/tree-ssa.c:732 #4 0x000000000067886d in execute_function_todo (data=<value optimized out>) at /data03/vondele/gcc_trunk/gcc/gcc/passes.c:970 #5 0x0000000000678a4f in execute_todo (flags=3919132792) at /data03/vondele/gcc_trunk/gcc/gcc/passes.c:996 #6 0x0000000000678de1 in execute_one_pass (pass=0xf09780) at /data03/vondele/gcc_trunk/gcc/gcc/passes.c:1276 #7 0x0000000000678fc5 in execute_pass_list (pass=0xf09780) at /data03/vondele/gcc_trunk/gcc/gcc/passes.c:1304 #8 0x0000000000678fdd in execute_pass_list (pass=0xf090c0) at /data03/vondele/gcc_trunk/gcc/gcc/passes.c:1305 #9 0x0000000000763d26 in tree_rest_of_compilation (fndecl=0x2b40e9c56c30) at /data03/vondele/gcc_trunk/gcc/gcc/tree-optimize.c:420 #10 0x0000000000916f82 in cgraph_expand_function (node=0x2b40e9d83000) at /data03/vondele/gcc_trunk/gcc/gcc/cgraphunit.c:1157 #11 0x0000000000919934 in cgraph_optimize () at /data03/vondele/gcc_trunk/gcc/gcc/cgraphunit.c:1220 #12 0x0000000000483855 in gfc_be_parse_file (set_yydebug=<value optimized out>) at /data03/vondele/gcc_trunk/gcc/gcc/fortran/f95-lang.c:262
also happens if profiles are generated/used at -O2 instead of -O3
Created attachment 15585 [details] files (.f .gcda .mod) needed to reproduce the ICE and a README attached the files needed to trigger the verify_histograms ICE, plus a README with the exact command used to do so
older gcc versions (tested 4.2.3 and 4.3.0) seem to work fine
Probably duplicate of or at least related to PR35215 ?
Something interesting: In atomic_kind_types.F.085t.copyprop3, we have: <bb 76>: D.2711_888 = *atomic_kind_38(D); D.2731_889 = &D.2711_888->element_symbol[1]{lb: 1 sz: 1}; __builtin_memcpy (&element_symbol[1]{lb: 1 sz: 1}, D.2731_889, 1); __builtin_memset (&element_symbol[2]{lb: 1 sz: 1}, 32, 1);IOR value ior:0. Average value sum:0 times:0. goto <bb 78>; and in atomic_kind_types.F.086.fab, we have: <bb 75>: D.2711_885 = *atomic_kind_38(D); D.2731_886 = &D.2711_885->element_symbol[1]{lb: 1 sz: 1}; __builtin_memmove (&element_symbol[1]{lb: 1 sz: 1}, D.2731_886, 2); goto <bb 78>; As can be seen, "__builtin_memset (&element_symbol[2]{lb: 1 sz: 1}, 32, 1)" expression that troubles us just vanished, apparently leaving dead histogram behind.
-fdump-tree-fab-details: ;; Function read_atomic_kind (__atomic_kind_types_MOD_read_atomic_kind) Simplified __builtin_memset (&element_symbol[2]{lb: 1 sz: 1}, 32, 1); to (void) 0;
Patch in testing: Index: tree-ssa-ccp.c =================================================================== --- tree-ssa-ccp.c (revision 135108) +++ tree-ssa-ccp.c (working copy) @@ -2916,6 +2916,9 @@ execute_fold_all_builtins (void) continue; } + if (result) + gimple_remove_stmt_histograms (cfun, *stmtp); + if (dump_file && (dump_flags & TDF_DETAILS)) { fprintf (dump_file, "Simplified\n ");
*** Bug 35215 has been marked as a duplicate of this bug. ***
The same problem is on 4.3 branch, as confirmed by the dupe.
Patch at http://gcc.gnu.org/ml/gcc-patches/2008-05/msg00562.html.
Subject: Bug 36129 Author: uros Date: Fri May 9 18:21:05 2008 New Revision: 135123 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=135123 Log: PR tree-optimization/36129 * tree-ssa-cpp.c: Include value-prof.h. (execute_fold_all_builtins): Call gimple_remove_stmt_histograms if built-in function was folded to a constant. * Makefile.in (tree-ssa-cpp.c): Depend on value-prof.h Modified: trunk/gcc/ChangeLog trunk/gcc/Makefile.in trunk/gcc/tree-ssa-ccp.c
Fixed for 4.4, patch needs to be backported to 4.3 branch.
(In reply to comment #13) > Fixed for 4.4, patch needs to be backported to 4.3 branch. > thanks for the patch, testing it, I ran into another ICE (PR36198) before reaching the crucial point.
Subject: Bug 36129 Author: uros Date: Sun May 11 18:54:15 2008 New Revision: 135180 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=135180 Log: Backport from mainline: 2008-05-09 Uros Bizjak <ubizjak@gmail.com> PR tree-optimization/36129 * tree-ssa-ccp.c: Include value-prof.h. (execute_fold_all_builtins): Call gimple_remove_stmt_histograms if built-in function was folded to a constant. * Makefile.in (tree-ssa-ccp.c): Depend on value-prof.h Modified: branches/gcc-4_3-branch/gcc/ChangeLog branches/gcc-4_3-branch/gcc/Makefile.in branches/gcc-4_3-branch/gcc/tree-ssa-ccp.c
Fixed.