[lkml]   [2002]   [Jan]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] C undefined behavior fix
On Jan  2, 2002, David Woodhouse <> wrote:

> said:
>> (and for CONSTANT < 5 it of course generated correct code to fill dst
>> with string contents; and yes, I know that code will sigsegv on run
>> because of dst is not initialized - but it should die at runtime, not
>> at compile time).

> An ICE, while it's not quite what was expected and it'll probably get fixed,
> is nonetheless a perfectly valid implementation of 'undefined behaviour'.

Not really. Think of code whose execution is guarded by a test that
guarantees it won't invoke undefined behavior, but whose test is in a
separate translation unit. Or even of code that is never executed.
The compiler has no business telling whether the code may potentially
invoke undefined behavior, or whether it's going to be executed at
all, it has to compile it to something that does whatever it wishes
*if* it's executed. So, it should indeed die at runtime, not at
compile time.

Alexandre Oliva Enjoy Guarana', see
Red Hat GCC Developer aoliva@{,}
CS PhD student at IC-Unicamp oliva@{,}
Free Software Evangelist *Please* write to mailing lists, not to me
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:15    [W:0.082 / U:0.872 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site