This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[MIPS, committed] Avoid loongson.h conversion errors on 32-bit mips*-elf*


As explained in PR 52155, a disagreement between GCC and newlib about
the best choice of 32-bit type causes lots of conversion errors when
loongson.h is included on 32-bit mips*-elf* targets.  This patch works
around them by forcing -mlong64.  An alternative would be to use
-flax-vector-conversions, like we do for loongson-simd.c, but I thought
it would be better to always have something that tests loongson.h without
that flag.

Tested on mips64-linux-gnu and various ELF targets.  Applied.

Richard


gcc/testsuite/
	PR target/52155
	* gcc.target/mips/mips.exp (mips-dg-options): Handle target.
	* gcc.target/mips/loongson-shift-count-truncated-1.c: Force -mlong64
	for MIPS ELF.

Index: gcc/testsuite/gcc.target/mips/mips.exp
===================================================================
--- gcc/testsuite/gcc.target/mips/mips.exp	2012-02-06 20:35:25.000000000 +0000
+++ gcc/testsuite/gcc.target/mips/mips.exp	2012-02-07 18:51:32.000000000 +0000
@@ -855,6 +855,15 @@ proc mips-dg-options { args } {
     # Information about this run.
     global mips_base_options
 
+    if { [llength $args] >= 3 } {
+        switch { [dg-process-target [lindex $args 2]] } {
+            "S" { }
+            "N" { return }
+            "F" { error "[lindex $args 0]: `xfail' not allowed here" }
+            "P" { error "[lindex $args 0]: `xfail' not allowed here" }
+        }
+    }
+
     # Start out with the default option state.
     array set options [array get mips_base_options]
 
Index: gcc/testsuite/gcc.target/mips/loongson-shift-count-truncated-1.c
===================================================================
--- gcc/testsuite/gcc.target/mips/loongson-shift-count-truncated-1.c	2012-02-06 20:35:25.000000000 +0000
+++ gcc/testsuite/gcc.target/mips/loongson-shift-count-truncated-1.c	2012-02-07 18:59:41.000000000 +0000
@@ -5,6 +5,8 @@
    seem any good reason for it to, given that the Loongson processors
    do not support MIPS16.  */
 /* { dg-options "isa=loongson -mhard-float -mno-mips16 -O1" } */
+/* See PR 52155.  */
+/* { dg-options "isa=loongson -mhard-float -mno-mips16 -O1 -mlong64" { mips*-*-elf* && ilp32 } } */
 
 #include "loongson.h"
 #include <assert.h>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]