[cfe-dev] Summer of Code idea -- detecting undefined behavior (fwd)

John Regehr regehr at cs.utah.edu
Sun Mar 28 15:05:49 PDT 2010


On Wed, 24 Mar 2010, Chris Lattner wrote:

>>   http://wiki.llvm.org/Detecting_undefined_behavior_in_Clang
>
> One minor piece of feedback on the list of undefined behavior: it is 
> probably worth removing pieces of this that are implementation defined 
> (e.g. how token pasting works), and pieces that do not manifest as 
> undefined behavior at runtime.

To be precise: Every behavior in this list is genuine undefined behavior, 
not implementation-defined behavior.  I know this because I took the list 
directly from the C standard :).  Also, every kind of undefined behavior 
can manifest at runtime, because undefined behavior is undefined.

But of course I take yor point.  I've split the list into two parts: 
behaviors that seem to require runtime checks, and behaviors that do not.

I don't want to remove any behaviors from the list because every behavior 
undefined by C should be checked somewhere.  Token pasting problems should 
be checked in the frontend, for example.  If the ideal case of a compiler 
that fully checks every item on the list remains unrealized, then fine, 
but I still like the list.

Next steps include:

- dividing the undefined behaviors into groups that share an 
implementation (FP-related, file-related, signal-related, memory safety, 
etc.)

- prioritizing these groups

I appreciate any help.

John



More information about the cfe-dev mailing list