[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] compare problem on riscv target

From: Herman ten Brugge
Subject: [Tinycc-devel] compare problem on riscv target
Date: Thu, 16 Jul 2020 16:46:23 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

While testing gmp on the riscv target I discovered a compare bug.
(t-get_d test fails in directory tests/mpq)

The code:

#include <stdio.h>

int tst(void) {
  long value = 3;
  return -value;

int main(void) {
  printf ("%d\n", tst());
  if (tst() > 0) printf ("error\n");
  return 0;

prints "error" on the riscv target. The problem is that the value returned is converted from long to int in gen_cast and is returned as 0xfffffffd from tst().
The compare in the main code fails because it does a long compare
instead of an int compare.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]