code review 7457045: runtime, testing/quick: libffi doesn't handle complex o... (issue 7457045)

2 views
Skip to first unread message

ia...@golang.org

unread,
Mar 1, 2013, 2:26:15 PM3/1/13
to ia...@golang.org, gofront...@googlegroups.com, re...@codereview-hr.appspotmail.com
Reviewers: iant,

Message:
Hello iant (cc: gofront...@googlegroups.com),

I'd like you to review this change to
https://gofrontend.googlecode.com/hg/


Description:
runtime, testing/quick: libffi doesn't handle complex on Alpha.

From Uros Bizjak.

Please review this at https://codereview.appspot.com/7457045/

Affected files:
M libgo/go/testing/quick/quick_test.go
M libgo/runtime/go-reflect-call.c


Index: libgo/go/testing/quick/quick_test.go
===================================================================
--- a/libgo/go/testing/quick/quick_test.go
+++ b/libgo/go/testing/quick/quick_test.go
@@ -7,6 +7,7 @@
import (
"math/rand"
"reflect"
+ "runtime"
"testing"
)

@@ -72,8 +73,10 @@
reportError("fBool", CheckEqual(fBool, fBool, nil), t)
reportError("fFloat32", CheckEqual(fFloat32, fFloat32, nil), t)
reportError("fFloat64", CheckEqual(fFloat64, fFloat64, nil), t)
- reportError("fComplex64", CheckEqual(fComplex64, fComplex64, nil), t)
- reportError("fComplex128", CheckEqual(fComplex128, fComplex128, nil), t)
+ if runtime.GOARCH != "alpha" {
+ reportError("fComplex64", CheckEqual(fComplex64, fComplex64, nil), t)
+ reportError("fComplex128", CheckEqual(fComplex128, fComplex128, nil), t)
+ }
reportError("fInt16", CheckEqual(fInt16, fInt16, nil), t)
reportError("fInt32", CheckEqual(fInt32, fInt32, nil), t)
reportError("fInt64", CheckEqual(fInt64, fInt64, nil), t)
Index: libgo/runtime/go-reflect-call.c
===================================================================
--- a/libgo/runtime/go-reflect-call.c
+++ b/libgo/runtime/go-reflect-call.c
@@ -30,7 +30,7 @@
static ffi_type *go_string_to_ffi (void) __attribute__ ((no_split_stack));
static ffi_type *go_interface_to_ffi (void) __attribute__
((no_split_stack));
static ffi_type *go_complex_to_ffi (ffi_type *)
- __attribute__ ((no_split_stack));
+ __attribute__ ((no_split_stack, unused));
static ffi_type *go_type_to_ffi (const struct __go_type_descriptor *)
__attribute__ ((no_split_stack));
static ffi_type *go_func_return_ffi (const struct __go_func_type *)
@@ -185,13 +185,23 @@
return &ffi_type_double;
abort ();
case GO_COMPLEX64:
+#ifdef __alpha__
+ runtime_throw("the libffi library does not support Complex64 type
with "
+ "reflect.Call or runtime.SetFinalizer");
+#else
if (sizeof (float) == 4)
return go_complex_to_ffi (&ffi_type_float);
abort ();
+#endif
case GO_COMPLEX128:
+#ifdef __alpha__
+ runtime_throw("the libffi library does not support Complex128 type
with "
+ "reflect.Call or runtime.SetFinalizer");
+#else
if (sizeof (double) == 8)
return go_complex_to_ffi (&ffi_type_double);
abort ();
+#endif
case GO_INT16:
return &ffi_type_sint16;
case GO_INT32:


ia...@golang.org

unread,
Mar 1, 2013, 2:26:19 PM3/1/13
to ia...@golang.org, gofront...@googlegroups.com, re...@codereview-hr.appspotmail.com
*** Submitted as
https://code.google.com/p/gofrontend/source/detail?r=8c0d464139d1 ***

runtime, testing/quick: libffi doesn't handle complex on Alpha.

From Uros Bizjak.

R=iant
CC=gofrontend-dev
https://codereview.appspot.com/7457045


https://codereview.appspot.com/7457045/
Reply all
Reply to author
Forward
0 new messages