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: RFC/RFHelp: c-decl.c rewrite - almost but not quite


Gabriel Dos Reis <gdr@integrable-solutions.net> writes:
> Zack Weinberg <zack@codesourcery.com> writes:
> | 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).

Yes, actually, I think an implementation should be free to reject a
translation unit that merely has an execution path that must provoke
runtime-undefined behavior.

> 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.

I stand corrected.

zw


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