[Insight-developers] Nasty GCC Compiler Bug
Hans Johnson
hans-johnson at uiowa.edu
Mon Sep 12 18:30:06 EDT 2005
Hello All,
I have tracked down a nasty gcc compiler bug that was causing 13 errors on
theoptimized james.uiowa builds to fail! I had inherited a set of
compiler options for a legacy application and have been using them to build
all the iowa builds of ITK. This was working without failure until about a
month ago. Something (I have no idea what) changed in the ITK source code,
and has allowed a known gcc bug to surface. This is documented in the gcc4
man page, but not in any of the gcc3 series man pages.
In short, the problem is that the compiler option -frename-registers has a
known bug. After removing this flag, the previously failing test began
passing again.
I know this is an obscure compiler flag, but since I found the problem, I
would like others to be able to avoid it. I will be committing the
following patch tomorrow if I do not hear any objections from the larger
community:
cvs diff CMakeLists.txt
Index: CMakeLists.txt
===================================================================
RCS file: /cvsroot/Insight/Insight/CMakeLists.txt,v
retrieving revision 1.206
diff -r1.206 CMakeLists.txt
523a524,536
> #-----------------------------------------------------------------------------
> # The frename-registers option does not work due to a bug in the gnu compiler.
> # It must be removed or data errors will be produced and incorrect results
> # will be produced. This is first documented in the gcc4 man page.
> SET(ALL_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}
${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_MODULE_LINKER_FLAGS}" )
> SEPARATE_ARGUMENTS(ALL_FLAGS)
> FOREACH(COMP_OPTION ${ALL_FLAGS})
> # MESSAGE("${COMP_OPTION} being checked.")
> IF("${COMP_OPTION}" STREQUAL "-frename-registers")
> MESSAGE(FATAL_ERROR "-frename-registers causes runtime bugs. It must be
removed from your compilation options.")
> ENDIF("${COMP_OPTION}" STREQUAL "-frename-registers")
> ENDFOREACH(COMP_OPTION)
>
More information about the Insight-developers
mailing list