On 11/01/16 16:02, Jason Merrill wrote:
> On 10/17/2016 03:18 PM, Bernd Edlinger wrote:
>> Regarding this hunk:
>>
>>         /* Whether or not the builtin can throw exceptions has no
>>           bearing on this declarator.  */
>> -      TREE_NOTHROW (olddecl) = 0;
>> +      TREE_NOTHROW (olddecl) = TREE_NOTHROW (newdecl);
>>
>> You may ask, why the old code was working most of the time.
>> I think, usually, when types_match == true, there happens another
>> assignment to TREE_NOTHROW, later in that function around line 2183:
>>
>>        /* Merge the type qualifiers.  */
>>        if (TREE_READONLY (newdecl))
>>          TREE_READONLY (olddecl) = 1;
>>        if (TREE_THIS_VOLATILE (newdecl))
>>          TREE_THIS_VOLATILE (olddecl) = 1;
>>        if (TREE_NOTHROW (newdecl))
>>          TREE_NOTHROW (olddecl) = 1;
>>
>> This is in a big "if (types_match)", so I think that explains,
>> why the old code did work normally, and why it fails if the
>> parameter don't match, but I still have no idea what to say
>> in the comment, except that the code should exactly do what
>> the comment above says.
>
> I think a better fix would be to add a copy of TREE_NOTHROW to the else
> block of the if (types_match), to go with the existing copies of
> TREE_READONLY and TREE_THIS_VOLATILE.  But yes, duplicate_decls is a mess.
>

Possibly, but I am only aware of problems with redeclarations
of builtins functions, TREE_CODE (olddecl) == FUNCTION_DECL
&& DECL_ARTIFICIAL (olddecl), but the "if (types_match)" can
be called for many other types of decls.

So super scary code here....

Reply via email to