Hello!

Attached patch adds -mieee to tests that need full IEEE compliance to
pass. While working on patch, I have noticed that go-test.exp doesn't
pass DEFAULT_GOCFLAGS to go_target_compile procedure in expected
format (so, these simply get ignored). With this issue fixed, we can
add -mieee to DEFAULT_GOCFLAGS. Tests, compiled through torture
procedure, expects their special flags in a separate driver file.

Attached patch fixes all "floating point errors" on
alphaev68-pc-linux-gnu through these two methods.

2012-01-19  Uros Bizjak  <ubiz...@gmail.com>

        * go.test/go-test.exp (go-gc-tests): Add -mieee to DEFAULT_GOCFLAGS
        for alpha*-*-* and sh*-*-* to enable full IEEE compliance mode.
        Pass correctly formatted options to go_target_compile.
        * go.test/test/fixedbugs/bug321.x: New file.
        * go.test/test/zerodivide.x: Ditto.
        * go.test/test/floatcmp.x: Ditto.

Patch was tested on alphaev68-pc-linux-gnu and x86_64-pc-linux-gnu.

OK for mainline SVN?

Uros.
Index: test/zerodivide.x
===================================================================
--- test/zerodivide.x   (revision 0)
+++ test/zerodivide.x   (revision 0)
@@ -0,0 +1,6 @@
+if { [istarget "alpha*-*-*"] || [istarget "sh*-*-*"] } {
+        # alpha and SH require -mieee for this test.
+        set additional_flags "-mieee"
+}
+
+return 0
Index: test/floatcmp.x
===================================================================
--- test/floatcmp.x     (revision 0)
+++ test/floatcmp.x     (revision 0)
@@ -0,0 +1,6 @@
+if { [istarget "alpha*-*-*"] || [istarget "sh*-*-*"] } {
+        # alpha and SH require -mieee for this test.
+        set additional_flags "-mieee"
+}
+
+return 0
Index: test/fixedbugs/bug321.x
===================================================================
--- test/fixedbugs/bug321.x     (revision 0)
+++ test/fixedbugs/bug321.x     (revision 0)
@@ -0,0 +1,6 @@
+if { [istarget "alpha*-*-*"] || [istarget "sh*-*-*"] } {
+        # alpha and SH require -mieee for this test.
+        set additional_flags "-mieee"
+}
+
+return 0
Index: go-test.exp
===================================================================
--- go-test.exp (revision 183305)
+++ go-test.exp (working copy)
@@ -208,6 +208,15 @@
        set DEFAULT_GOCFLAGS " -pedantic-errors"
     }
 
+    # Enable full IEEE compliance mode.
+    if { [istarget alpha*-*-*]
+         || [istarget sh*-*-*] } then {
+       lappend DEFAULT_GOCFLAGS "-mieee"
+    }
+
+    set options ""
+    lappend options "additional_flags=$DEFAULT_GOCFLAGS"
+
     # Set GOARCH for tests that need it.
     go-set-goarch
 
@@ -585,7 +594,7 @@
            set dg-do-what-default "link"
            set output_file "./[file rootname [file tail $test]].exe"
            set comp_output [go_target_compile "$ofile1 $ofile2" \
-                                $output_file "executable" "$DEFAULT_GOCFLAGS"]
+                                $output_file "executable" "$options"]
            set comp_output [go-dg-prune $target_triplet $comp_output]
            verbose -log $comp_output
            set result [go_load "$output_file" "" ""]
@@ -610,7 +619,7 @@
            set dg-do-what-default "link"
            set output_file "./[file rootname [file tail $test]].exe"
            set comp_output [go_target_compile "$ofile1 $ofile2 $ofile3" \
-                                $output_file "executable" "$DEFAULT_GOCFLAGS"]
+                                $output_file "executable" "$options"]
            set comp_output [go-dg-prune $target_triplet $comp_output]
            if [string match "" $comp_output] {
                pass $name
@@ -633,7 +642,7 @@
            set ofile2 "[file rootname [file tail $test]].o"
            set output_file "./[file rootname [file tail $test]].exe"
            set comp_output [go_target_compile "$ofile1 $ofile2" \
-                                $output_file "executable" "$DEFAULT_GOCFLAGS"]
+                                $output_file "executable" "$options"]
            set comp_output [go-dg-prune $target_triplet $comp_output]
            if [string match "" $comp_output] {
                set result [go_load "$output_file" "" ""]
@@ -660,7 +669,7 @@
            set dg-do-what-default "link"
            set output_file "./[file rootname [file tail $file2]].exe"
            set comp_output [go_target_compile "$ofile1 $ofile2" \
-                                $output_file "executable" "$DEFAULT_GOCFLAGS"]
+                                $output_file "executable" "$options"]
            set comp_output [go-dg-prune $target_triplet $comp_output]
            if [string match "" $comp_output] {
                set result [go_load "$output_file" "" ""]
@@ -726,7 +735,7 @@
            errchk $file3 ""
            set output_file "./[file rootname [file tail $test]].exe"
            set comp_output [go_target_compile "$ofile0 $ofile1 $ofile2" \
-                                $output_file "executable" "$DEFAULT_GOCFLAGS"]
+                                $output_file "executable" "$options"]
            set comp-output [go-dg-prune $target_triplet $comp_output]
            if [string match "" $comp_output] {
                set result [go_load "$output_file" "" ""]
@@ -759,7 +768,7 @@
            set ofile2 "[file rootname [file tail $test]].o"
            set output_file "./[file rootname [file tail $test]].exe"
            set comp_output [go_target_compile "$ofile1 $ofile2" \
-                                $output_file "executable" "$DEFAULT_GOCFLAGS"]
+                                $output_file "executable" "$options"]
            set comp_output [go-dg-prune $target_triplet $comp_output]
            if [string match "" $comp_output] {
                set result [go_load "$output_file" "" ""]
@@ -775,7 +784,7 @@
            regsub "/\[^/\]*$" $test "/cmplxdivide1.go" test2
            set output_file "./[file rootname [file tail $test]].o"
            set comp_output [go_target_compile "$test $test2" \
-                            $output_file "executable" "$DEFAULT_GOCFLAGS"]
+                                $output_file "executable" "$options"]
            set comp_output [go-dg-prune $target_triplet $comp_output]
            if [string match "" $comp_output] {
                set result [go_load "$output_file" "" ""]
@@ -853,7 +862,7 @@
            set ofile2 "[file rootname [file tail $file2]].o"
            set output_file "./[file rootname [file tail $test]].exe"
            set comp_output [go_target_compile "$ofile1 $ofile2" \
-                                $output_file "executable" "$DEFAULT_GOCFLAGS"]
+                                $output_file "executable" "$options"]
            set comp_output [go-dg-prune $target_triplet $comp_output]
            if [string match "" $comp_output] {
                setup_xfail "*-*-*"

Reply via email to