[patch-rfc] N2179: Exception Propagation in C++

Sebastian Redl sebastian.redl@getdesigned.at
Wed Aug 13 22:42:00 GMT 2008


Paolo Carlini wrote:
> Hi again,
>
>   
>> Sebastian, please investigate, I'm reverting the patch. It
>> looks like the patch assumes the availability of the atomic
>> builtins also on i386 (the default x86 subtarget, unfortunately)
>>     
>
> In fact, I should have noticed that you have naked __sync_sub_and_fetch and __sync_add_and_fetch in your code, sigh, my fault. This is not going to work. If you can live with a smaller referenceCount, an int, you can probably change the patch minimally to just use __exchange_and_add and __atomic_add (check many uses in the library proper: string, locale). If you *really* need a size_t for conformance the issue is going to be much more difficult, because of the i386 default, I remind you.
>
> Paolo. 
>   

I can make it an int, but this may cause an ambiguity in the ABI 
description for 64-bit targets. Can I rely on the structure padding 
rules in the ABI to ensure cross-compiler compatibility, or do I need to 
pad this manually? And if I do, how do I best do this?

I had not assumed the availability of the built-in, but I had assumed 
the availability of replacement library functions, as the documentation 
led me to believe exist:

"If a particular operation cannot be implemented on the target 
processor, a warning will be generated and a call an external function 
will be generated."
http://gcc.gnu.org/onlinedocs/gcc/Atomic-Builtins.html

Apparently these functions aren't actually implemented by GCC's library, 
which is confusing.

Sebastian



More information about the Gcc-patches mailing list