This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa] Removing useless/redundant "const" calls
- From: Richard Henderson <rth at redhat dot com>
- To: Roger Sayle <roger at eyesopen dot com>
- Cc: Zack Weinberg <zack at codesourcery dot com>, gcc-patches at gcc dot gnu dot org
- Date: Thu, 12 Jun 2003 21:29:49 -0700
- Subject: Re: [tree-ssa] Removing useless/redundant "const" calls
- References: <Pine.LNX.4.44.0306122058090.20756-100000@www.eyesopen.com>
On Thu, Jun 12, 2003 at 09:11:08PM -0600, Roger Sayle wrote:
> Indeed, I recall that not returning from a function *was* deemed to
> be a side-effect, the last time this went around on gcc-patches/gcc.
Yes.
> Everything is currently consistent within GCC that noreturn functions
> aren't pure/const, and that a function is pure/const if it only calls
> functions that are pure/const. i.e. calling abort() currently implies
> impure/side-effecting in GCC's perception routines.
Which is why GCC should not infer const-ness if a noreturn function call
is detected. (We may get this wrong for __builtin_trap at the moment.)
HOWEVER, I think that it is legal for a user to SPECIFY const-ness; what
we're being told is that the abort case "doesn't matter", probably because
it should never happen.
But that's a distinction that is impossible to make within the compiler.
r~