This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Ada] Stop mapping Pure on Ada functions to GCC const
- From: "Richard Guenther" <richard dot guenther at gmail dot com>
- To: "Duncan Sands" <baldrick at free dot fr>
- Cc: gcc-patches at gcc dot gnu dot org, "Olivier Hainque" <hainque at adacore dot com>
- Date: Fri, 1 Aug 2008 13:28:00 +0200
- Subject: Re: [Ada] Stop mapping Pure on Ada functions to GCC const
- References: <20080801122900.B22959@rome.act-europe.fr> <200808011302.46723.baldrick@free.fr>
On Fri, Aug 1, 2008 at 1:02 PM, Duncan Sands <baldrick@free.fr> wrote:
> Hi,
>
>> Pure functions in Ada might raise and this doesn't match (any more)
>> "const" functions in the middle-end, currently assumed to be
>> SIDE_EFFECTS free, so ...
>
> so a decision was finally made that const functions can't throw?
> Is the reasoning behind that explained anywhere? I'm worried
> that this will represent a big performance hit for Ada: for
> example, the routines in Ada.Numerics.Elementary_Functions
> won't be "const" anymore, so won't be CSE'd etc.
const functions can be CSE'd and DCE'd
if their result is not used. const functions without a return value do
not make sense (this is even documented).
But - stmt_could_throw_p only returns false if NOTRHOW is set
on a function. So, what is the failure mode you are seeing? That
a const call is DCE'd?
Richard.