Re: Optimization techniques and undefined behavior in Go

Ian Lance Taylor <>
Mon, 6 May 2019 21:16:19 -0700

          From comp.compilers

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

From: Ian Lance Taylor <>
Newsgroups: comp.compilers
Date: Mon, 6 May 2019 21:16:19 -0700
Organization: Compilers Central
Injection-Info:; posting-host=""; logging-data="27987"; mail-complaints-to=""
Keywords: Go
Posted-Date: 07 May 2019 18:48:32 EDT

Martin Ward <> 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.,


Post a followup to this message

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