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: Jan Nieuwenhuizen
Subject: Re: [WIP v3] Introduce mescc.a for division algorithm and move the latter there.
Date: Fri, 29 May 2020 18:33:01 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

Danny Milosavljevic writes:

Hi Danny,

> 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.

Ah, right!  I seen that before but never imagined someone/somearch would
be doing such a thing for real.  Hmm.

> 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

Yeah -- so, these being 7x tests means that they were "taken from tcc".
When starting to target tcc, it took me quite a while before it compiled
and once it compiled it took me months before it ran -- bug free.

So I tried to isolate very specific failing snippets, fix them in
isolation, wash, rinse, repeat.  Of course, also being very specific to
x86.

It would be good to go back to the origin of the test: find what tcc
actually does here; and then /especially/ when compiling it for ARM.

Then, rewrite/disable/paramiterise the test for ARM.

Does that make sense?

> 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

Yeah -- same story about tcc though; I'm pretty sure this is related to
detection of EOF (and fails to use an integer.

Janneke

-- 
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | AvatarĀ® http://AvatarAcademy.com



reply via email to

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