RFC/RFHelp: c-decl.c rewrite - almost but not quite

Gabriel Dos Reis gdr@integrable-solutions.net
Wed Mar 17 15:29:00 GMT 2004


Zack Weinberg <zack@codesourcery.com> writes:

| "Joseph S. Myers" <jsm@polyomino.org.uk> writes:
| 
| > On Tue, 16 Mar 2004, Zack Weinberg wrote:
| >
| >> I think that both here and in 6326 you are making a distinction
| >> without a difference.  I think we're allowed to reject the sample
| >> translation unit in 6326 (compile-time undefined behavior) and I don't
| >
| > We can reject it because the invalid calls are in main and so _every_
| > possible execution is run-time undefined (DR#109).
| 
| Bleah.
| 
| You may have guessed that I'm not at all enthusiastic about this
| compile-time/run-time undefined behavior distinction.

So, do you propose to reject

      extern int foo;

      void bar(void)
      {
         if (foo)
           *(int*)0 = 89;
      } 

?

It is a runtime undefined behaviour, not compile-time -- unless you
can prove that any execution path makes foo true.  (The same is true
in C++ by the way).

| I much prefer
| C++'s "ill-formed but no diagnostic required" locution, which gives
| the implementation the freedom not to put up with such code.

I think you misunderstood what that locution is for.  It is used in
the very few cases where requiring an implementation to issue a
diagnostic would lead to either a halting problem or excedingly
advanced technology requirement.   The number of occurances of that
"ill-formed but no diagnostic is required" is astonishingly small.

-- Gaby



More information about the Gcc-patches mailing list