Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #150858
| From | Tim Rentsch <tr.17687@z991.linuxsc.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: "How one word broke C" |
| Date | 2020-03-27 07:18 -0700 |
| Organization | A noiseless patient Spider |
| Message-ID | <86v9mp98z7.fsf@linuxsc.com> (permalink) |
| References | (2 earlier) <OdfcG.384376$MX1.25017@fx43.iad> <r4tlbf$oqg$1@solani.org> <5a2a8006-dac6-45d2-985a-f6b9f5f3fb32@googlegroups.com> <r4tv07$14q$1@solani.org> <1%AcG.171306$8h.41300@fx26.iad> |
Richard Damon <Richard@Damon-Family.org> writes: > On 3/18/20 4:06 PM, Philipp Klaus Krause wrote: > >> Am 18.03.20 um 20:11 schrieb already5chosen@yahoo.com:> Itanium is quite >> similar to few other supported gcc targets. Yet >> >>> another byte-addressable machine with two-complement arithmetic, >>> 4byte words, 8byte double words and 8byte pointers, run-of-the-mill >>> assortment of arithmetic, logic and shift operations. And absence of >>> integer divide instruction is not extraordinary. Mandatory "natural" >>> alignment of 4-byte and 8-byte numbers is required by few other gcc >>> targets as well. So, generation of correct Itanium code is quite >>> easy. >> >> Thanks to undefined behaviour. Otherwise the trap representations would >> be a problem (reading uninitialized local variables can actually crash >> programs on Itanium). > > That behavior is actually quite old. There were machines that had > instructions to erase a word of core to a bad memory value (bad parity) > and if that word was later read before it was written to the program > would trap on the parity error. Yes but such things have not always been undefined behavior. In C90, reading any uninitialized (auto) variable is UB. In C99, reading an uninitialized variable is UB only if the stored value is a trap representation; a type that doesn't have any trap representations (which these days includes most integer types in most implementations) cannot transgress into UB land. It wasn't until C11 that the Standard added a provision that specifies UB for such accesses, and even then only for variables that do not have their address taken. It is the C11 rule that allows UB for Itanium-style variables, which can trap even though their type has no trap representations.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
"How one word broke C" Lynn McGuire <lynnmcguire5@gmail.com> - 2020-03-17 14:29 -0500
Re: "How one word broke C" Real Troll <Real.Troll@Trolls.com> - 2020-03-17 15:40 -0400
Re: "How one word broke C" John Bode <jfbode1029@gmail.com> - 2020-03-19 11:57 -0700
Re: "How one word broke C" James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-03-19 18:20 -0400
Re: "How one word broke C" Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-03-17 13:39 -0700
Re: "How one word broke C" Jorgen Grahn <grahn+nntp@snipabacken.se> - 2020-03-17 21:55 +0000
Re: "How one word broke C" felix@palmen-it.de (Felix Palmen) - 2020-03-17 23:02 +0100
Re: "How one word broke C" Richard Damon <Richard@Damon-Family.org> - 2020-03-17 21:57 -0400
Re: "How one word broke C" Dan Purgert <dan@djph.net> - 2020-03-18 11:02 +0000
Re: "How one word broke C" Richard Damon <Richard@Damon-Family.org> - 2020-03-18 08:58 -0400
Re: "How one word broke C" Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2020-03-18 06:04 -0700
Re: "How one word broke C" Richard Damon <Richard@Damon-Family.org> - 2020-03-18 09:53 -0400
Re: "How one word broke C" felix@palmen-it.de (Felix Palmen) - 2020-03-18 14:46 +0100
Re: "How one word broke C" Richard Damon <Richard@Damon-Family.org> - 2020-03-19 08:55 -0400
Re: "How one word broke C" Philipp Klaus Krause <pkk@spth.de> - 2020-03-18 18:21 +0100
Re: "How one word broke C" already5chosen@yahoo.com - 2020-03-18 12:11 -0700
Re: "How one word broke C" Philipp Klaus Krause <pkk@spth.de> - 2020-03-18 21:06 +0100
Re: "How one word broke C" Richard Damon <Richard@Damon-Family.org> - 2020-03-18 22:43 -0400
Re: "How one word broke C" Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-03-27 07:18 -0700
Re: "How one word broke C" Dan Purgert <dan@djph.net> - 2020-03-19 01:40 +0000
Re: "How one word broke C" Eli the Bearded <*@eli.users.panix.com> - 2020-03-18 19:12 +0000
Re: "How one word broke C" Philipp Klaus Krause <pkk@spth.de> - 2020-03-18 21:09 +0100
Re: "How one word broke C" David Brown <david.brown@hesbynett.no> - 2020-03-18 21:35 +0100
Re: "How one word broke C" felix@palmen-it.de (Felix Palmen) - 2020-03-18 23:27 +0100
Re: "How one word broke C" Richard Damon <Richard@Damon-Family.org> - 2020-03-19 08:57 -0400
Re: "How one word broke C" felix@palmen-it.de (Felix Palmen) - 2020-03-19 15:00 +0100
Re: "How one word broke C" David Brown <david.brown@hesbynett.no> - 2020-03-19 15:02 +0100
Re: "How one word broke C" felix@palmen-it.de (Felix Palmen) - 2020-03-19 15:10 +0100
Re: "How one word broke C" gazelle@shell.xmission.com (Kenny McCormack) - 2020-03-19 14:34 +0000
Re: "How one word broke C" Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2020-03-19 07:44 -0700
Re: "How one word broke C" Jorgen Grahn <grahn+nntp@snipabacken.se> - 2020-03-19 14:57 +0000
Re: "How one word broke C" felix@palmen-it.de (Felix Palmen) - 2020-03-19 15:58 +0100
Re: "How one word broke C" David Brown <david.brown@hesbynett.no> - 2020-03-19 16:26 +0100
Re: "How one word broke C" David Brown <david.brown@hesbynett.no> - 2020-03-19 16:08 +0100
Troll, gadfly, whatever... (Was: "How one word broke C") gazelle@shell.xmission.com (Kenny McCormack) - 2020-03-21 11:08 +0000
Re: Troll, gadfly, whatever... (Was: "How one word broke C") Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2020-03-21 04:50 -0700
Re: "How one word broke C" David Brown <david.brown@hesbynett.no> - 2020-03-19 16:04 +0100
Re: "How one word broke C" felix@palmen-it.de (Felix Palmen) - 2020-03-19 16:16 +0100
Re: "How one word broke C" Richard Damon <Richard@Damon-Family.org> - 2020-03-19 23:36 -0400
Re: "How one word broke C" James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-03-19 18:13 -0400
Re: "How one word broke C" Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2020-03-17 19:43 -0600
Re: "How one word broke C" John Bode <jfbode1029@gmail.com> - 2020-03-24 16:07 -0700
Re: "How one word broke C" James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-03-24 19:41 -0400
csiph-web