This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Clarifying attribute-const
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: Alexander Monakov <amonakov at ispras dot ru>
- Cc: gcc at gcc dot gnu dot org
- Date: Fri, 02 Oct 2015 00:40:20 +0200
- Subject: Re: Clarifying attribute-const
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot LNX dot 2 dot 20 dot 1509251933001 dot 23590 at monopod dot intra dot ispras dot ru> <1449338 dot uM7p4ILj71 at polaris> <alpine dot LNX dot 2 dot 20 dot 1510011821460 dot 15118 at monopod dot intra dot ispras dot ru>
> Can you expand on the "etc." a bit, i.e., may the compiler ...
>
> - move a call to a "const" function above a conditional branch,
> causing a conditional throw to happen unconditionally?
>
> - move a call to a "const" function below a conditional branch,
> causing an unconditional throw to happen only conditionally?
The implementation permission is that you may omit calls to such functions,
not that you can introduce them, so No and Yes respectively.
> - reorder calls to "const" functions w.r.t. code with side effects, or
> other throwing functions?
This one is less clear, but I'd say Yes.
--
Eric Botcazou