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 c/9262


Eric Botcazou <ebotcazou@libertysurf.fr> writes:

>> Well, wait a minute; it seems pretty clear that pushcase is what the
>> C front end is really supposed to be using.  There's a whole bunch of
>> checks in there that are not being done.  What's the history here?
>
> The current situation was inherited from the take-over of the C front-end by 
> the C++ front-end circa fall 2000 :-)
>
> When c-semantics.c was added preparatively to the event,  genrtl_case_label() 
> still called c-decl.c:do_case() which in turn called pushcase() and 
> pushcase_range(). Then:
[...]

I talked to Mark about this and we figured out the history of these
changes.  Basically, when the C front end was converted to
function-at-a-time mode it was intended that these problems be caught
much earlier, during parsing instead of RTL generation, and that
add_case_node would never see ill-formed trees like this.  That is
presently the case for the C++ front end -- if you run your test case
through cc1plus you'll see it gives (too many) error messages but does
not crash -- but not for the C front end.

First, please try to change the C parser so that it does not add case
labels to the chain of statements if there is no enclosing SWITCH_STMT.  
This may be impractical.  If so, then change genrtl_case_label to call
pushcase, but provide a converter function that aborts if the label
value doesn't already have the right type -- the conversion is
supposed to have happened already.

zw


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