Commit 94acfde2 authored by Rémy Oudompheng's avatar Rémy Oudompheng

cmd/gc: make rnd() more 64-bit-friendly.

Fixes #4200.

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6619057
parent bcccad40
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
static int defercalc; static int defercalc;
uint32 vlong
rnd(uint32 o, uint32 r) rnd(vlong o, vlong r)
{ {
if(r < 1 || r > 8 || (r&(r-1)) != 0) if(r < 1 || r > 8 || (r&(r-1)) != 0)
fatal("rnd"); fatal("rnd");
......
...@@ -936,7 +936,7 @@ void checkwidth(Type *t); ...@@ -936,7 +936,7 @@ void checkwidth(Type *t);
void defercheckwidth(void); void defercheckwidth(void);
void dowidth(Type *t); void dowidth(Type *t);
void resumecheckwidth(void); void resumecheckwidth(void);
uint32 rnd(uint32 o, uint32 r); vlong rnd(vlong o, vlong r);
void typeinit(void); void typeinit(void);
/* /*
......
// compile
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Issue 4200: 6g crashes when a type is larger than 4GB.
package main
import "unsafe"
// N=16 on 32-bit arches, 256 on 64-bit arches.
// On 32-bit arches we don't want to test types
// that are over 4GB large.
const N = 1 << unsafe.Sizeof(uintptr(0))
type T [N][10][10][10][10][3]byte
func F(t *T) byte {
return t[0][0][0][0][0][0]
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment