bug-mes
[Top][All Lists]
Advanced

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

Re: [WIP v3] Introduce mescc.a for division algorithm and move the latte


From: Danny Milosavljevic
Subject: Re: [WIP v3] Introduce mescc.a for division algorithm and move the latter there.
Date: Fri, 29 May 2020 17:46:30 +0200

Hi Janneke,

On Fri, 29 May 2020 15:44:56 +0200
Jan Nieuwenhuizen <janneke@gnu.org> wrote:

> > (1) gcc-lib
> >
> > Failed tests:
> >  
> >>lib/tests/scaffold/7l-struct-any-size-array-simple.c

Char isn't signed on ARM gcc.  The C standard doesn't say one way or another 
either.

You can change behavior by "gcc -fsigned-char" or "gcc -funsigned-char" though.

See:
$ cat b.c
#include <stdio.h>

int main() {
        char x = -3;
        printf("%d\n", x);
        return 0;
}

$ gcc b.c # on armhf machine
$ ./a.out
253
$ gcc -fsigned-char b.c
$ ./a.out
-3

Also, the test has an array of packed structs.  Eeew.

struct foo13
{
  int a;
  int b;
  int c;
  char d;
} __attribute__ ((packed));

struct foo13 tab14[3];

Not sure what that is--but I have the sudden urge to take a shower :P

That one doesn't fail on mescc, probably because mescc doesn't pack the struct 
in the first place... which is the correct solution almost always anyway 
(except when hardware or file format expects packed struct--even then, C 
standard recommends to do the arithmetic yourself and not use structs).

> >>lib/tests/scaffold/7r-sign-extend.c  

That one doesn't fail on mescc ;)

Reason for failure: Char is unsigned on ARM gcc, and the test does this:

  {
    char c = -1;
    int i = c;
    if (i != -1)
      return 1; <---- reached
  }

Just no :P

Attachment: pgpbFJxZvihLb.pgp
Description: OpenPGP digital signature


reply via email to

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