Project Home
Project Home
Source Code
Source Code
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - ceilf() causing infinite loop: (5 Items)
   
ceilf() causing infinite loop  
I was having trouble using unordered_map<> with the gcc 4.6.1 tool chain targeting x86 and linking against "GNU with 
exceptions". The release build would hang when unordered_map<> constructor was called, but not hang in the debug build. 
Debugging the release build shows it gets stuck in ceilf().

After looking over gcc source I see that unordered_map<> is fairly different between release and debug, so debug 
apparently doesn't call ceilf(). The release version actually calls __builtin_ceil() in hashtable_policy.h.

So I decided to call ceilf() myself and sure enough, it hangs in debug and release builds. Then I tried gcc 4.4.2 and it
 also hangs.

Appears that C ceilf() calls C++ 'float ceil( float )', which calls C ceilf() again...hence an infinite loop.

I downloaded and tried the exact same code in MinGW with gcc 4.6.1 and it works fine.

I'm getting by with using map<> instead, but I would like to use unordered_map<> if there is a fix.
Re: ceilf() causing infinite loop  
On 11-11-10 04:26 PM, Mark Thomas wrote:
> I was having trouble using unordered_map<>  with the gcc 4.6.1 tool chain targeting x86 and linking against "GNU with 
exceptions". The release build would hang when unordered_map<>  constructor was called, but not hang in the debug build.
 Debugging the release build shows it gets stuck in ceilf().
>
> After looking over gcc source I see that unordered_map<>  is fairly different between release and debug, so debug 
apparently doesn't call ceilf(). The release version actually calls __builtin_ceil() in hashtable_policy.h.
>
> So I decided to call ceilf() myself and sure enough, it hangs in debug and release builds. Then I tried gcc 4.4.2 and 
it also hangs.
>
> Appears that C ceilf() calls C++ 'float ceil( float )', which calls C ceilf() again...hence an infinite loop.
>
> I downloaded and tried the exact same code in MinGW with gcc 4.6.1 and it works fine.
>
> I'm getting by with using map<>  instead, but I would like to use unordered_map<>  if there is a fix.

This is a known issue which has been fixed. I'll try to get post a build 
as soon as possible for it.

Regards,

Ryan Mansfield
Re: ceilf() causing infinite loop  
Thanks for the quick acknowledgement. I look forward to the fixed build.
Re: ceilf() causing infinite loop  
I've posted packages for gcc 4.6.2 which contain a fix for this issue. Please let me know if you have any problems.

Regards,

Ryan Mansfield
Re: ceilf() causing infinite loop  
Works perfectly now.  Thanks!