The testcase that I will attach when compiled with -O3 generates incorrect
results.  Good results are obtained at -O0

The testcase should be compiled like this:

$ mipsel-linux-gcj --main=TestMultSimple -O2 TestMultSimple.java -o
TestMultSimple-O2

$ mipsel-linux-gcj --main=TestMultSimple -O0 TestMultSimple.java -o
TestMultSimple-O0

When running I get this:
/junk # ./TestMultSimple-O2
test10a3
off    = -28800000      = 0800
soff   = 1106931389806  = 2005.01.28 08:56:29.806
syscur = 1106960189806  = 2005.01.28 16:56:29.806
d      = -5287802103562112000   = 7090.-33554411.-33554413 23:51:28.000
/junk # ./TestMultSimple-O0
test10a3
off    = -28800000      = 0800
soff   = 1106931392290  = 2005.01.28 08:56:32.290
syscur = 1106960192290  = 2005.01.28 16:56:32.290
d      = 1106870400000  = 2005.01.27 16:00:00.000

The second result is correct.  d should be a positive number of about the same
value as syscur.

When build with x86 targeted compiler the bug is not seen.
gcj (GCC) 3.4.2 20041017 (Red Hat 3.4.2-6.fc3) for example gives good results.

-- 
           Summary: MIPS wrong-code for 64-bit multiply from java program.
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: daney at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux
  GCC host triplet: i686-pc-linux
GCC target triplet: mipsel-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19683

Reply via email to