This is the mail archive of the gcc-bugs@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]

[Bug c/36941] gcc does not reject invalid cast



------- Comment #4 from joseph at codesourcery dot com  2008-07-25 22:59 -------
Subject: Re:  gcc does not reject invalid cast

On Fri, 25 Jul 2008, sabre at nondot dot org wrote:

> Though that does raise a question.  Does GCC normally emit errors for undefined
> behavior?  I thought the policy was to insert runtime traps?  If so, doesn't
> the { x; } case qualify, or does it violate some other constraint?

What's valid for expressions of incomplete types - including whether the 
cases of undefined behavior here are undefined only at execution or 
undefined as a property of the program (the former being where traps are 
inserted, the latter being where diagnostics are OK) is exceedingly 
obscure.  We do have a bit of guidance in the form of DR 106 allowing the 
dereference of pointers to qualified void in certain cases (note that 
qualified void is an incomplete type other than void).  It doesn't help 
that neither C90 nor C99 got the definition of "lvalue" right.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36941


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