Re: [Tinycc-devel] A double-to-float conversion bug

2023-07-31 Thread Herman ten Brugge via Tinycc-devel
On 7/31/23 12:43, grischka wrote: On 31.07.2023 13:42, Herman ten Brugge via Tinycc-devel wrote: I agree with your comments above. The size is incorrect. I could change gfunc_sret in x86_64-gen.c and then calculate the size in tccgen.c as you suggested. But I am not sure regsize is set correctl

Re: [Tinycc-devel] A double-to-float conversion bug

2023-07-31 Thread grischka
On 31.07.2023 13:42, Herman ten Brugge via Tinycc-devel wrote: I agree with your comments above. The size is incorrect. I could change gfunc_sret in x86_64-gen.c and then calculate the size in tccgen.c as you suggested. But I am not sure regsize is set correctly all the time. I like this better

Re: [Tinycc-devel] A double-to-float conversion bug

2023-07-31 Thread Herman ten Brugge via Tinycc-devel
On 7/31/23 10:08, grischka wrote: On 31.07.2023 09:32, Herman ten Brugge via Tinycc-devel wrote: On 7/30/23 18:27, Vincent Lefevre wrote: On 2023-07-30 16:07:29 +0600, Viktor M wrote: Hello everyone. So today I stumbled upon this bug when doing math involving conversions between float and doub

Re: [Tinycc-devel] A double-to-float conversion bug

2023-07-31 Thread grischka
On 31.07.2023 09:32, Herman ten Brugge via Tinycc-devel wrote: On 7/30/23 18:27, Vincent Lefevre wrote: On 2023-07-30 16:07:29 +0600, Viktor M wrote: Hello everyone. So today I stumbled upon this bug when doing math involving conversions between float and double. A minimal example: [...] Not

Re: [Tinycc-devel] A double-to-float conversion bug

2023-07-31 Thread Herman ten Brugge via Tinycc-devel
On 7/30/23 18:27, Vincent Lefevre wrote: On 2023-07-30 16:07:29 +0600, Viktor M wrote: Hello everyone. So today I stumbled upon this bug when doing math involving conversions between float and double. A minimal example: [...] Not really minimal. I could simplify it even further: I fixed this

Re: [Tinycc-devel] A double-to-float conversion bug

2023-07-30 Thread Vincent Lefevre
On 2023-07-30 16:07:29 +0600, Viktor M wrote: > Hello everyone. So today I stumbled upon this bug when doing math > involving conversions between float and double. A minimal example: [...] Not really minimal. I could simplify it even further: #include struct V { int x, y, z; }; struct V vec(

Re: [Tinycc-devel] A double-to-float conversion bug

2023-07-30 Thread C.J. Wagenius
Sorry. Ignore that. 30 juli 2023 16:18 av c...@voidptr.se: > Use "%lf" for doubles. > > /cjw > > 30 juli 2023 15:34 av dayllen...@gmail.com: > >> Hello everyone. So today I stumbled upon this bug when doing math >> involving conversions between float and double. A minimal example: >> >> --- >>

Re: [Tinycc-devel] A double-to-float conversion bug

2023-07-30 Thread C.J. Wagenius
Use "%lf" for doubles. /cjw 30 juli 2023 15:34 av dayllen...@gmail.com: > Hello everyone. So today I stumbled upon this bug when doing math > involving conversions between float and double. A minimal example: > > --- > #include > > struct V { > int x, y, z; > }; > > struct V vec(void) > { > r

[Tinycc-devel] A double-to-float conversion bug

2023-07-30 Thread Viktor M
Hello everyone. So today I stumbled upon this bug when doing math involving conversions between float and double. A minimal example: --- #include struct V { int x, y, z; }; struct V vec(void) { return (struct V) { 0, 0, 1 }; } void func(float f, struct V v) { printf("%f %d %d %d\n"