#270 divide by zero does indefinite busy-wait

Jim Bell

gcc-4.4 and gcc-4.5.

A program that divides by zero does a busy wait, hogging its CPU and never terminating.

Build the attached simple program with "g++ -o Div0.exe Div0.cpp"

Very repeatable. ^C does break out.

See more detail at <https://svn.boost.org/trac/boost/ticket/6425>


  • Jim Bell

    Jim Bell - 2012-02-14

    Divides by zero.

  • Scott Michel

    Scott Michel - 2012-04-25

    What compiler flags are you using? Theoretically, the gcc optimizer would emit a warning about a constant division by zero when it does constant value propagation analysis.

  • Jim Bell

    Jim Bell - 2012-04-26

    No compiler flags, per the above example. The optimizer you mention doesn't seem to be catching it, fortunately, since it's a run-time issue and that would just mask the problem.

    The boost regression test, which repeats the problem, compiles as such:
    "g++" -ftemplate-depth-128 -O0 -fno-inline -Wall -pedantic -g -Wno-long-long -pedantic -DBOOST_ALL_NO_LIB=1 -DBOOST_TEST_NO_AUTO_LINK=1 -I".." -c -o "G:\boost\GCC\release\results\boost\bin.v2\libs\test\test\prg_exec_fail2.test\gcc-mingw-4.5.4\debug\prg_exec_fail2.o" "..\libs\test\test\prg_exec_fail2.cpp"

    "g++" -o "G:\boost\GCC\release\results\boost\bin.v2\libs\test\test\prg_exec_fail2.test\gcc-mingw-4.5.4\debug\prg_exec_fail2.exe" -Wl,--start-group "G:\boost\GCC\release\results\boost\bin.v2\libs\test\test\prg_exec_fail2.test\gcc-mingw-4.5.4\debug\prg_exec_fail2.o" "G:\boost\GCC\release\results\boost\bin.v2\libs\test\build\gcc-mingw-4.5.4\debug\link-static\libboost_prg_exec_monitor-mgw45-d-1_50.a" -Wl,-Bstatic -Wl,-Bdynamic -Wl,--end-group -g

  • Ozkan Sezer

    Ozkan Sezer - 2014-06-05

    What is the status of this issue?

  • Kai Tietz

    Kai Tietz - 2014-06-05

    Hmm, sounds like a exception-hook issue.


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks