Re: Optimization techniques and undefined behavior in Go

Ian Lance Taylor <ianlancetaylor@gmail.com>
Mon, 6 May 2019 21:16:19 -0700

          From comp.compilers

Related articles
Re: Optimization techniques and undefined behavior in Go ianlancetaylor@gmail.com (Ian Lance Taylor) (2019-05-06)
| List of all articles for this month |

From: Ian Lance Taylor <ianlancetaylor@gmail.com>
Newsgroups: comp.compilers
Date: Mon, 6 May 2019 21:16:19 -0700
Organization: Compilers Central
Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="27987"; mail-complaints-to="abuse@iecc.com"
Keywords: Go
Posted-Date: 07 May 2019 18:48:32 EDT

Martin Ward <martin@gkc.org.uk> writes:


> There are many language in which all behaviour is defined:
> for example, Go has no undefined behaviour. Some behaviour
> may be "unspecified" (eg it could do X, or could do Y,
> but cannot do anything else).


(Setting aside the use of the "unsafe" package, of course.)


We hope to get to that point, but it's not true today. The language
spec is not clear on the effects of race conditions. With today's
implementations you can set up a race condition that lets you change a
slice pointer to anything at all, which effectively leads to undefined
behavior even without using the "unsafe" package. See, e.g.,
https://research.swtch.com/gorace.


Ian


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.