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: [PATCH] Fix PR optimization/12085


> From: Eric Botcazou <ebotcazou@libertysurf.fr>
> Date: Wed, 17 Dec 2003 13:45:02 +0100

> > This is runtime undefined behavior (if the function that ends up getting
> > called at runtime has type incompatible with that used for the call), not
> > compile-time.  So it should be a warning (not pedwarn), optionally with a
> > trap generated (as for va_arg on bad types); only an error if you can
> > prove that all possible executions of the program must execute the bad
> > code.
> 
> Thanks for the clarification.
> 
> Since the check must be performed by the front-end, I'll need to propagate 
> the result to the tree-inliner, and to the RTL expander to generate a trap.  
> Would it be possible to define a new flag for CALL_EXPR?
> 
> The other solution I see is to directly build a CALL_EXPR to __builtin_trap 
> in the front-end.  However, there is a problem when the return value of the 
> call is used, because __builtin_trap returns void.

You really want to do something like

__builtin_trap();
retval = 0;

as expand_builtin_va_arg does.

-- 
- Geoffrey Keating <geoffk@geoffk.org>


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