This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Robustify REAL_MODE_FORMAT
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Richard Biener <richard dot guenther at gmail dot com>, Bernd Schmidt <bschmidt at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, richard dot sandiford at arm dot com
- Date: Fri, 30 Oct 2015 09:59:17 +0100
- Subject: Re: Robustify REAL_MODE_FORMAT
- Authentication-results: sourceware.org; auth=none
- References: <87eggdu1z4 dot fsf at e105548-lin dot cambridge dot arm dot com> <56323C3D dot 7010209 at redhat dot com> <ED3D9DB7-4C27-478B-AED8-AB04ECAFC212 at gmail dot com> <871tcdtz2v dot fsf at e105548-lin dot cambridge dot arm dot com>
On Thu, Oct 29, 2015 at 5:32 PM, Richard Sandiford
<richard.sandiford@arm.com> wrote:
> Richard Biener <richard.guenther@gmail.com> writes:
>> On October 29, 2015 4:33:17 PM GMT+01:00, Bernd Schmidt
>> <bschmidt@redhat.com> wrote:
>>>On 10/29/2015 04:30 PM, Richard Sandiford wrote:
>>>> Make sure that REAL_MODE_FORMAT aborts if it is passed an invalid
>>>mode,
>>>> rather than stepping beyond the bounds of an array. It turned out
>>>that
>>>> some code was passing non-float modes to the real.h routines.
>>>
>>>> gcc/
>>>> * real.h (REAL_MODE_FORMAT): Abort if the mode isn't a
>>>> SCALAR_FLOAT_MODE_P.
>>>
>>>I'm assuming that the code you mention has already been fixed so that
>>>we
>>>don't trigger the abort. Ok.
>>
>> Rather than the weird macro can't we turn real_mode_format to an inline
>> function?
>
> It needs to be an lvalue for things like:
>
> REAL_MODE_FORMAT (TFmode) = &ibm_extended_format;
>
> I suppose we could return a non-const reference, but I'd rather stay
> clear of returning those :-)
Yes please. But SET_REAL_MODE_FORMAT (TFmode, &ibm_extended_format)
would work as well.
Richard.
> Thanks,
> Richard
>