Re: [Tinycc-devel] missing dlfcn.h but defined in tcclib.h, also missing RTLD_LOCAL

2020-07-15 Thread UnknownGamer40464
Alright thanks, I get its purpose now.

Thanks for taking the time to explain.

On Wed, Jul 15, 2020 at 9:41 AM Michael Matz  wrote:

> Hello,
>
> On Tue, 14 Jul 2020, UnknownGamer40464 wrote:
>
> > I see. I had assumed it was for unix compatibility but I guess not.
> >
> > Is it supposed to show up in the win32 tcclib.h file then?
>
> tcclib.h is a small convenience header that exists merely to show how a
> minimal installation on unix-like systems could look like, i.e. it's a
> replacement for a subset of standard headers.  As such it declares a
> couple functions and macros that are useful for simple standard C
> programs.  It might or might not declare more facilities than are actually
> available on the system at hand, and noone bothered to add the #ifdef-ery
> to make it declare only available things.  Similarly it also doesn't
> declare all facilities that are available on the system (for that you have
> to use the standard headers).
>
> I.e. that it declares also dlfcn facilities is not an issue, though it
> might lead to the expectation that those are available on Windows, and
> hence confusion.  The best way to avoid this is actually to simply not use
> that header at all.
>
>
> Ciao,
> Michael.
>
> >
> > It seems to be placed there by the win32 batch script,
> >  but indeed using dlfcn functions cause undefined symbol errors.
> >
> > Either way, sounds like a minor thing to me now.
> >
> > Thanks a lot.
> >
> > On Tue, Jul 14, 2020 at 1:02 AM Christian JULLIEN 
> wrote:
> >   Hi,
> > dlfcn provides declarations for functions dlopen/dlsym/dlclose that
> > allow to dynamically load a shared lib at runtime on unix systems.
> > Windows uses a similar but different interface to load DLL (which are
> > different from .so shared libs).
> > Hence, you don't need dlfcn.h on Windows.
> >
> > Systems like mingw/cygnwin add some unix compatibiliy on Windows. This
> > is not the case with tcc which supports only C standard and most
> > Windows API on Windows.
> >
> > C.
> >
> >
> >
> >   Le : 14 juillet 2020 à 05:27 (GMT +02:00)
> >   De : "UnknownGamer40464"
> >   
> >   À : "tinycc-devel@nongnu.org" 
> >   Objet : [Tinycc-devel] missing dlfcn.h but defined in
> >   tcclib.h, also missing RTLD_LOCAL
> >
> >
> >   Is there any reason dlfcn.h is missing (at least on
> >   windows) and yet its functions and macros
> >  are defined in tcclib.h, and that tcclib.h references it in a
> > comment as if it were a file?
> >
> > I also noticed RTLD_LOCAL was missing but it seems like
> >  it should just be 0x000 since, according to oracle man pages,
> >  local is the default option.
> >
> > I see this on a windows build of 50abaae, which I'm using, and
> > in windows mob.
> >
> > Thanks.
> >
> >
> >
> > ___
> > Tinycc-devel mailing list
> > Tinycc-devel@nongnu.org
> > https://lists.nongnu.org/mailman/listinfo/tinycc-devel
> >
> > ___
> > Tinycc-devel mailing list
> > Tinycc-devel@nongnu.org
> > https://lists.nongnu.org/mailman/listinfo/tinycc-devel
> >
> >
> >___
> Tinycc-devel mailing list
> Tinycc-devel@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/tinycc-devel
>
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] aarch64: subnormal double to long double conversion bug

2020-07-15 Thread Vincent Lefevre
On 2020-07-15 23:15:59 +0200, Michael Matz wrote:
> Hello,
> 
> On Wed, 15 Jul 2020, Vincent Lefevre wrote:
> 
> > With TCC mob on aarch64, the double to long double conversion
> > is buggy on subnormal values. This makes a MPFR test fail
> > (reported by Christian Jullien).
> 
> Thanks for the report, it was indeed unhandled in the support routines. I
> fixed this in mob for riscv64, but the routines are shared with aarch64 so
> it's likely also fixed there, please check.

Thanks. Everything is fine now.

-- 
Vincent Lefèvre  - Web: 
100% accessible validated (X)HTML - Blog: 
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] aarch64: subnormal double to long double conversion bug

2020-07-15 Thread Michael Matz

Hello,

On Wed, 15 Jul 2020, Vincent Lefevre wrote:


With TCC mob on aarch64, the double to long double conversion
is buggy on subnormal values. This makes a MPFR test fail
(reported by Christian Jullien).


Thanks for the report, it was indeed unhandled in the support routines. 
I fixed this in mob for riscv64, but the routines are shared with aarch64 
so it's likely also fixed there, please check.



Ciao,
Michael.

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


[Tinycc-devel] the format of the __TINYC__ macro should be documented

2020-07-15 Thread Vincent Lefevre
The TCC manual just says about the __TINYC__ macro:

   * '__TINYC__' is a predefined macro to indicate that you use TCC.

But it actually contains the version, computed with

  sprintf(buffer, "%d", a*1 + b*100 + c);

This should be documented (this is not obvious without reading the
source since a = 0 currently).

-- 
Vincent Lefèvre  - Web: 
100% accessible validated (X)HTML - Blog: 
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


[Tinycc-devel] aarch64: subnormal double to long double conversion bug

2020-07-15 Thread Vincent Lefevre
With TCC mob on aarch64, the double to long double conversion
is buggy on subnormal values. This makes a MPFR test fail
(reported by Christian Jullien).

Testcase:

#include 

int main (void)
{
  volatile double d = 0x0.88p-1022;  /* subnormal */
  printf ("d = %a\n", d);
  printf ("d = %.40g\n", d);
  volatile long double x = d;
  printf ("x = %La\n", x);
  printf ("x = %.40Lg\n", x);
  return 0;
}

With GCC (correct):

d = 0x0.88p-1022
d = 1.182070487331950734766686131082839659116e-308
x = 0x1.1p-1023
x = 1.182070487331950734766686131082839659116e-308

With TCC (incorrect):

d = 0x0.88p-1022
d = 1.182070487331950734766686131082839659116e-308
x = 0x1.88p-1023
x = 1.703572172919576058928459424207621861668e-308

I suspect that the code adds the usual implicit bit 1, but there is
no such bit with subnormals.

-- 
Vincent Lefèvre  - Web: 
100% accessible validated (X)HTML - Blog: 
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] aarch64: wrong constant values for float.h

2020-07-15 Thread Michael Matz

Hello,

On Wed, 15 Jul 2020, Christian JULLIEN wrote:


I think that float.h should be modified accordingly, is it Ok?


Yes, as the aarch64 backend indeed uses the IEEE float128 for long double.


(what are the risc-v values)


Same as on aarch64.


Ciao,
Michael.

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] missing dlfcn.h but defined in tcclib.h, also missing RTLD_LOCAL

2020-07-15 Thread Michael Matz

Hello,

On Tue, 14 Jul 2020, UnknownGamer40464 wrote:


I see. I had assumed it was for unix compatibility but I guess not.

Is it supposed to show up in the win32 tcclib.h file then?


tcclib.h is a small convenience header that exists merely to show how a 
minimal installation on unix-like systems could look like, i.e. it's a 
replacement for a subset of standard headers.  As such it declares a 
couple functions and macros that are useful for simple standard C 
programs.  It might or might not declare more facilities than are actually 
available on the system at hand, and noone bothered to add the #ifdef-ery 
to make it declare only available things.  Similarly it also doesn't 
declare all facilities that are available on the system (for that you have 
to use the standard headers).


I.e. that it declares also dlfcn facilities is not an issue, though it 
might lead to the expectation that those are available on Windows, and 
hence confusion.  The best way to avoid this is actually to simply not use 
that header at all.



Ciao,
Michael.



It seems to be placed there by the win32 batch script,
 but indeed using dlfcn functions cause undefined symbol errors.

Either way, sounds like a minor thing to me now.

Thanks a lot.

On Tue, Jul 14, 2020 at 1:02 AM Christian JULLIEN  wrote:
  Hi,
dlfcn provides declarations for functions dlopen/dlsym/dlclose that
allow to dynamically load a shared lib at runtime on unix systems.
Windows uses a similar but different interface to load DLL (which are
different from .so shared libs).
Hence, you don't need dlfcn.h on Windows.

Systems like mingw/cygnwin add some unix compatibiliy on Windows. This
is not the case with tcc which supports only C standard and most
Windows API on Windows.

C.



  Le : 14 juillet 2020 à 05:27 (GMT +02:00)
  De : "UnknownGamer40464"
  
  À : "tinycc-devel@nongnu.org" 
  Objet : [Tinycc-devel] missing dlfcn.h but defined in
  tcclib.h, also missing RTLD_LOCAL


  Is there any reason dlfcn.h is missing (at least on
  windows) and yet its functions and macros
 are defined in tcclib.h, and that tcclib.h references it in a
comment as if it were a file?

I also noticed RTLD_LOCAL was missing but it seems like
 it should just be 0x000 since, according to oracle man pages,
 local is the default option.

I see this on a windows build of 50abaae, which I'm using, and
in windows mob.

Thanks.



___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel