------- Comment #4 from jbuehler at spirentcom dot com 2007-08-09 11:38 ------- Created an attachment (id=14045) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14045&action=view) gcc 4.0.4 global register variable optimizer patch
The attached patch fixes the optimizer bug for gcc 4.0.4 and allows GHC 6.6.1 to be compiled with optimization turned on. The problem is that lifetime analysis is marking global registers as REG_UNUSED and then the combiner pass is eliminating them. The fix is to not mark global registers as unused. The fix is based on a review of the flow.c code for gcc 4.2.0. Code was added to flow.c somewhere after 4.0.4 to handle "stack registers" and no mark them as REG_UNUSED. This patch merely mimics "stack register" handling in flow.c for global registers. I am not a gcc expert and make no claims for the correctness of this patch -- it does fix my ghc compile though. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32820