https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103652

            Bug ID: 103652
           Summary: Producing profile with -O2 -flto and trying to consume
                    it with -O3 -flto leads to ICEs on indirect call
                    profiling
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: gcov-profile
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hubicka at gcc dot gnu.org
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

Building clang in the funny way (training with -O2 -flto -fprofile-generate)
and use with -O3 -flto -fprofile-generate I get ICE here:

Program received signal SIGSEGV, Segmentation fault.
compute_value_histograms (lineno_checksum=2372477078, cfg_checksum=4074682759,
values=...) at ../../gcc/profile.c:931
931                   hist->hvalue.counters[j] = act_count[t][j];
(gdb) l
926               gimple_add_histogram_value (cfun, stmt, hist);
927               hist->n_counters = total_size;
928               hist->hvalue.counters = XNEWVEC (gcov_type,
hist->n_counters);
929               for (j = 0; j < hist->n_counters; j++)
930                 if (act_count[t])
931                   hist->hvalue.counters[j] = act_count[t][j];
932                 else
933                   hist->hvalue.counters[j] = 0;
934               act_count[t] += hist->n_counters;
935               sort_hist_values (hist);
(gdb) p hist
$1 = (histogram_value) 0x21e9d40
(gdb) p *hist
$2 = {hvalue = {value = 0x7fffea4b9e10, stmt = 0x7fffea4a4ab0, counters =
0x7ffdf13db010, next = 0x0}, type = HIST_TYPE_INDIR_CALL, n_counters =
1059049550, fun = 0x7fffed96ce40, hdata = {intvl = {int_start = 0, steps = 0}}}
(gdb) p hist->n_counters
$6 = 1059049550

and I also get ICE:

/home/jh/llvm-project/clang/lib/AST/ASTContext.cpp: At top level:
/home/jh/llvm-project/clang/lib/AST/ASTContext.cpp:11856:1: internal compiler
error: in stream_out_histogram_value, at value-prof.c:340


I think it is mismatched profile but I do not know - certainly the streaming
needs more sanity checks here....

Reply via email to