Hey guys,
  I discovered a strange bug in gcc 4.4.7, which causes differences between
the debug and opt/fast gem5 builds.  It looks like the compiler is
optimizing this code incorrectly (src/cpu/o3/iew.hh:230):

     void decrWb(InstSeqNum &sn)
     {
         if (*wbOutstanding-- == wbMax*)
             ableToIssue = true;
         DPRINTF(IEW, "wbOutstanding: %i [sn:%lli]\n", wbOutstanding, sn);
         assert(wbOutstanding >= 0);
     }

  Looking at the assembly of gem5.opt, the line wbOutstanding-- == wbMax is
being optimized as wbOutstanding -= wbMax, which decreases wbOutstanding by
more than just a decrement if wbMax > 1.  The assertion fails quickly in
this case.  Since this optimization bug doesn't exist with lesser
optimization, I'm not able to reproduce it with gem5.debug.

  An easy fix is simply to add parentheses around the decrement of
wbOutstanding.  Since this is a problem with the compiler, I'm not sure how
to proceed for gem5.  Should a fix be submitted for review?

  Thanks,
  Joel


-- 
  Joel Hestness
  PhD Student, Computer Architecture
  Dept. of Computer Science, University of Wisconsin - Madison
  http://www.cs.utexas.edu/~hestness
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to