On Wed, Jun 1, 2011 at 7:49 PM, Ian Lance Taylor <i...@google.com> wrote:

>>>> One problem remains in the libgo testsuite: certain tests have to be
>>>> compiled with -mieee, otherwise FPE is generated for unordered values.
>>>> Any suggestions, where -mieee should be placed?
>>>
>>> That's an interesting question.  I think that ideally we would like
>>> -mieee to become the default when using gccgo.
>>
>> If the language spec requires it, then it should go into gcc/go.  See 
>> java_post_options:
>>
>> static bool
>> java_post_options (const char **pfilename)
>> {
>>   /* Excess precision other than "fast" requires front-end
>>      support.  */
>>   if (flag_excess_precision_cmdline == EXCESS_PRECISION_STANDARD
>>       && TARGET_FLT_EVAL_METHOD_NON_DEFAULT)
>>     sorry ("-fexcess-precision=standard for Java");
>>   flag_excess_precision_cmdline = EXCESS_PRECISION_FAST;
>
> Sure, the Go frontend does stuff like that too.  But of course the Go
> frontend can't directly set -mieee, because -mieee is a machine
> dependent option.
>
>
>> so, you could check the setting and reset any flag that should be off
>> or error out on incompatible flags.  I'd like to think we could get
>> more milage out of making a flag like -mieee be machine independent
>> and then ports could just check the base flag for validating machine
>> specific flags.  Certainly alpha isn't the only port that has -mieee.
>> There are likely to be very few flags promoted because of this, ieee
>> being the most obvious example.
>
> What I think you are suggesting here is another approach: Alpha should
> set -mieee based on a machine-independent option, and then the Go
> frontend can set that option instead.  I'm fine with that approach too.
> I don't think we currently have a machine-independent option which
> corresponds to the Alpha -mieee option.  According to the documentation,
> -mieee does two things: adds support for NaN and infinity, and adds
> support for denormal numbers.  The first is the -fno-finite-math-only
> option, which is actually the default for other targets.  The second has
> no machine independent option as far as I know.

Attached patch also does the trick for me.  Please note that we set
-mieee flag to compile .go files from library and also we add this
flag to default testsuite compile flags.

Using this patch, I was able to fix all "floating point exceptions"
errors from libgo testsuite.

What remains is a couple of unrelated failures in the testsuite:

Epoll unexpected fd=0
pollServer: unexpected wakeup for fd=0 mode=w
panic: test timed out
../../../gcc-svn/trunk/libgo/testsuite/gotest: line 388:  7123 Aborted
                ./a.out -test.short -test.timeout=$timeout "$@"
FAIL: http
gmake[2]: *** [http/check] Error 1

2011/07/05 18:43:28 Test RPC server listening on 127.0.0.1:50334
2011/07/05 18:43:28 Test HTTP RPC server listening on 127.0.0.1:49010
2011/07/05 18:43:28 rpc.Serve: accept:accept tcp 127.0.0.1:50334:
Resource temporarily unavailable
FAIL: rpc
gmake[2]: *** [rpc/check] Error 1

2011/07/05 18:44:22 Test WebSocket server listening on 127.0.0.1:40893
Epoll unexpected fd=0
pollServer: unexpected wakeup for fd=0 mode=w
panic: test timed out
../../../gcc-svn/trunk/libgo/testsuite/gotest: line 388: 12993 Aborted
                ./a.out -test.short -test.timeout=$timeout "$@"
FAIL: websocket
gmake[2]: *** [websocket/check] Error 1

../../../gcc-svn/trunk/libgo/testsuite/gotest: line 388: 13945
Segmentation fault      ./a.out -test.short -test.timeout=$timeout
"$@"
FAIL: compress/flate
gmake[2]: *** [compress/flate/check] Error 1

Any ideas how to attack these?

Uros.
Index: configure
===================================================================
--- configure   (revision 175840)
+++ configure   (working copy)
@@ -616,6 +616,7 @@
 USING_SPLIT_STACK_FALSE
 USING_SPLIT_STACK_TRUE
 SPLIT_STACK
+IEEE_FLAGS
 OSCFLAGS
 GO_DEBUG_PROC_REGS_OS_ARCH_FILE
 GO_SYSCALLS_SYSCALL_OS_ARCH_FILE
@@ -10913,7 +10914,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10916 "configure"
+#line 10917 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11019,7 +11020,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11022 "configure"
+#line 11023 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -13580,6 +13581,13 @@
 esac
 
 
+case "${host_cpu}" in
+  alpha*)
+    IEEE_FLAGS="-mieee"
+    ;;
+esac
+
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -fsplit-stack is 
supported" >&5
 $as_echo_n "checking whether -fsplit-stack is supported... " >&6; }
 if test "${libgo_cv_c_split_stack_supported+set}" = set; then :
Index: Makefile.in
===================================================================
--- Makefile.in (revision 175840)
+++ Makefile.in (working copy)
@@ -365,6 +365,7 @@
 GO_DEBUG_PROC_REGS_OS_ARCH_FILE = @GO_DEBUG_PROC_REGS_OS_ARCH_FILE@
 GO_SYSCALLS_SYSCALL_OS_ARCH_FILE = @GO_SYSCALLS_SYSCALL_OS_ARCH_FILE@
 GREP = @GREP@
+IEEE_FLAGS = @IEEE_FLAGS@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -1916,7 +1917,9 @@
        runtime/go-main.c
 
 LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
-AM_GOCFLAGS = $(STRINGOPS_FLAG)
+
+# Some targets require additional compiler options for IEEE compatibility.
+AM_GOCFLAGS = $(STRINGOPS_FLAG) $(IEEE_FLAGS)
 GOCOMPILE = $(GOC) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_GOCFLAGS) $(GOCFLAGS)
 LTGOCOMPILE = $(LIBTOOL) --tag GO --mode=compile $(GOC) $(INCLUDES) \
        $(AM_GOCFLAGS) $(GOCFLAGS)
@@ -1937,7 +1940,7 @@
 
 # Check a package.
 CHECK = \
-       GC="$(GOC) -L `${PWD_COMMAND}` -L `${PWD_COMMAND}`/.libs"; \
+       GC="$(GOC) $(IEEE_FLAGS) -L `${PWD_COMMAND}` -L 
`${PWD_COMMAND}`/.libs"; \
        export GC; \
        RUNTESTFLAGS="$(RUNTESTFLAGS)"; \
        export RUNTESTFLAGS; \
Index: testsuite/Makefile.in
===================================================================
--- testsuite/Makefile.in       (revision 175840)
+++ testsuite/Makefile.in       (working copy)
@@ -88,6 +88,7 @@
 GO_DEBUG_PROC_REGS_OS_ARCH_FILE = @GO_DEBUG_PROC_REGS_OS_ARCH_FILE@
 GO_SYSCALLS_SYSCALL_OS_ARCH_FILE = @GO_SYSCALLS_SYSCALL_OS_ARCH_FILE@
 GREP = @GREP@
+IEEE_FLAGS = @IEEE_FLAGS@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
Index: configure.ac
===================================================================
--- configure.ac        (revision 175840)
+++ configure.ac        (working copy)
@@ -279,6 +279,14 @@
 esac
 AC_SUBST(OSCFLAGS)
 
+dnl Some targets require additional compiler options for NaN/Inf.
+case "${host_cpu}" in
+  alpha*)
+    IEEE_FLAGS="-mieee"
+    ;;
+esac
+AC_SUBST(IEEE_FLAGS)
+
 dnl Use -fsplit-stack when compiling C code if available.
 AC_CACHE_CHECK([whether -fsplit-stack is supported],
 [libgo_cv_c_split_stack_supported],
Index: Makefile.am
===================================================================
--- Makefile.am (revision 175840)
+++ Makefile.am (working copy)
@@ -1595,6 +1595,10 @@
 
 GOCFLAGS = $(CFLAGS)
 AM_GOCFLAGS = $(STRINGOPS_FLAG)
+
+# Some targets require additional compiler options for IEEE compatibility.
+AM_GOCFLAGS += $(IEEE_FLAGS)
+
 GOCOMPILE = $(GOC) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_GOCFLAGS) $(GOCFLAGS)
 
 LTGOCOMPILE = $(LIBTOOL) --tag GO --mode=compile $(GOC) $(INCLUDES) \
@@ -1619,7 +1623,7 @@
 
 # Check a package.
 CHECK = \
-       GC="$(GOC) -L `${PWD_COMMAND}` -L `${PWD_COMMAND}`/.libs"; \
+       GC="$(GOC) $(IEEE_FLAGS) -L `${PWD_COMMAND}` -L 
`${PWD_COMMAND}`/.libs"; \
        export GC; \
        RUNTESTFLAGS="$(RUNTESTFLAGS)"; \
        export RUNTESTFLAGS; \

Reply via email to