in reply to Reference of constants and literals

Is this a defined behaviour

At the very least, you're relying on the memory allocation system allocating the same block twice in a row. That sounds very fragile to me. I can easily see this failing for non-trivial pr or in a multi-threaded application.

why does the compiler not just send one stable ref too a scalar?

The memory allocation needs of "creating an array, creating two scalars, assigning the scalars to the array, creating a reference to the array, returning the reference and passing it to a function" (pr [1,2]) are very different than the memory allocation needs of "passing a constant to a function" (pr 1).