Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #380968
| Path | csiph.com!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Tim Rentsch <tr.17687@z991.linuxsc.com> |
| Newsgroups | comp.lang.c |
| Subject | Re: Which tools are available for catching UB? |
| Date | Thu, 25 Jan 2024 19:57:53 -0800 |
| Organization | A noiseless patient Spider |
| Lines | 30 |
| Message-ID | <8634ukeofy.fsf@linuxsc.com> (permalink) |
| References | <YXJnN.184010$xHn7.45772@fx14.iad> <uobt0a$2jo2e$1@dont-email.me> |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Injection-Info | dont-email.me; posting-host="3fb740dc5d2d937efa44f2af60b1195d"; logging-data="2831552"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19NESR9pY7FPu9VpIp/s3M06H4IuVJMASc=" |
| User-Agent | Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) |
| Cancel-Lock | sha1:0VSXyyWSnIQafvPlEMw5H2oBYNs= sha1:NjZtqFXJb7saKJ3OsUcptTfGrjw= |
| Xref | csiph.com comp.lang.c:380968 |
Show key headers only | View raw
Lew Pitcher <lew.pitcher@digitalfreehold.ca> writes: > [A] single call to a function not defined by your program source > code or by the ISO C standard will invoke "undefined behaviour". That isn't right. The C standard allows previously translated translation units "[to] be preserved individually or in libraries." Those translation units don't have to be your own code or even necessarily stored, or translated, on the same machine. In translation phase 8, "[l]ibrary components are linked to satisfy external references to functions and objects not defined in the current translation." The C standard doesn't specify how the libraries are located, or even require that you be able to inspect them, but clearly does require that libraries be consulted to satisfy external references. We don't know what code in the libraries will do, but there is a requirement /on the implementation/ that they be linked against in phase 8. The presence of that requirement means that linking to, or calling, such an external reference is not ipso facto undefined behavior. (Obviously it could be undefined behavior for other reasons, but not just by virtue of there being a call.) Not knowing what something will do is not the same as undefined behavior. The question is Does the C standard give a requirement about what implementations have to do? In this case it does. An implementation is not free to do whatever it wants just because a library was previously translated on a different machine. Code in a library might (emphasis _might_) provoke undefined behavior if it is called, but that depends on what the library code is, and is not something an implementation can just arbitrarily chose to do on its own. It's important to understand the difference.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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