This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [tree-ssa] Removing useless/redundant "const" calls


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~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]