Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #380142

Re: Which tools are available for catching UB?

From Tim Rentsch <tr.17687@z991.linuxsc.com>
Newsgroups comp.lang.c
Subject Re: Which tools are available for catching UB?
Date 2024-01-14 09:44 -0800
Organization A noiseless patient Spider
Message-ID <86le8rlsih.fsf@linuxsc.com> (permalink)
References <YXJnN.184010$xHn7.45772@fx14.iad> <unonqf$307b8$1@dont-email.me> <hE_nN.29642$Sf59.27167@fx48.iad> <87sf33mmy3.fsf@nosuchdomain.example.com>

Show all headers | View raw


Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:

> Anthony Cuozzo <anthony@cuozzo.us> writes:
> [...]
>
>> [looking for constructs that are undefined behavior]

>> Semi-related:  Do you know if there's a resource which breaks down UB
>> per standard?  I'd like to see how things have changed over time.
>
> Each edition of the standard has an annex (Annex J in the case of C11)
> that summarizes unspecified, undefined, and implementation-defined
> behaviors.  The standards themselves cost money, but drafts are freely
> available.

Annex J (which is Annex G in C90) is an excellent resource.  A caution
is in order:  not every case of undefined behavior (and probably also
unspecified behavior and implementation-defined behavior) is listed in
Annex J.  Most are, but not all are.  Also, sometimes a statement of UB
in Annex J is not completely accurate, but only an approximation.  It
is still the case that Annex J is an excellent resource, but don't take
it as gospel.

> Some instances of undefined behavior are specified explicitly.  Others
> are undefined just because the standard provides no definition.  Both
> kinds are equivalent, and can in principle result in the same kinds of
> Bad Things Happening.

I think a fine point should be noted here.  Some kinds of undefined
behavior, in addition to being undefined behavior, also require a
diagnostic be issued.  So different kinds of undefined behavior may
not be exactly equivalent - some require some sort of message out of
the compiler, whereas others may get no indication when compiling.
None of this is meant to contradict Keith's statement, just to augment
it with a clarification.

Back to comp.lang.c | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Which tools are available for catching UB? Anthony Cuozzo <anthony@cuozzo.us> - 2024-01-10 23:15 -0500
  Re: Which tools are available for catching UB? David Brown <david.brown@hesbynett.no> - 2024-01-11 13:43 +0100
    Re: Which tools are available for catching UB? Anthony Cuozzo <anthony@cuozzo.us> - 2024-01-11 18:15 -0500
      Re: Which tools are available for catching UB? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-01-11 16:09 -0800
        Re: Which tools are available for catching UB? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-01-14 09:44 -0800
      Re: Which tools are available for catching UB? David Brown <david.brown@hesbynett.no> - 2024-01-12 14:50 +0100
  Re: Which tools are available for catching UB? Richard Kettlewell <invalid@invalid.invalid> - 2024-01-12 08:51 +0000
  Re: Which tools are available for catching UB? Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2024-01-18 18:17 +0000
  Re: Which tools are available for catching UB? Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2024-01-18 19:08 +0000
    Re: Which tools are available for catching UB? James Kuyper <jameskuyper@alumni.caltech.edu> - 2024-01-18 14:42 -0500
      Re: Which tools are available for catching UB? Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2024-01-18 20:24 +0000
    Re: Which tools are available for catching UB? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-01-25 19:57 -0800
      Re: Which tools are available for catching UB? Kaz Kylheku <433-929-6894@kylheku.com> - 2024-01-26 04:52 +0000
        Re: Which tools are available for catching UB? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-02-10 02:06 -0800
  Re: Which tools are available for catching UB? Kaz Kylheku <433-929-6894@kylheku.com> - 2024-01-18 19:41 +0000
    Re: Which tools are available for catching UB? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-01-18 13:18 -0800
    Re: Which tools are available for catching UB? gazelle@shell.xmission.com (Kenny McCormack) - 2024-01-19 03:08 +0000

csiph-web