Re: Optimize mul_var() for var1ndigits >= 8

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
Cc: Joel Jacobson <joel(at)compiler(dot)org>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Optimize mul_var() for var1ndigits >= 8
Date: 2024-08-24 18:17:20
Message-ID: 2440650.1724523440@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> writes:
> On Wed, 14 Aug 2024 at 07:31, Joel Jacobson <joel(at)compiler(dot)org> wrote:
>> I think this is acceptable, since it produces more correct results.

> Thanks for checking. I did a bit more testing myself and didn't see
> any problems, so I have committed both these patches.

About a dozen buildfarm members are complaining thus (eg [1]):

gcc -std=gnu99 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -O2 -ftree-vectorize -I. -I. -I../../../../src/include -D_GNU_SOURCE -I/usr/include/libxml2 -c -o numeric.o numeric.c
numeric.c: In function \342\200\230mul_var\342\200\231:
numeric.c:9209:9: warning: \342\200\230carry\342\200\231 may be used uninitialized in this function [-Wmaybe-uninitialized]
term = PRODSUM1(var1digits, 0, var2digits, 0) + carry;
^
numeric.c:8972:10: note: \342\200\230carry\342\200\231 was declared here
uint32 carry;
^

I guess these compilers aren't able to convince themselves that the
first switch must initialize "carry".

regards, tom lane

[1] https://buildfarm.postgresql.org/cgi-bin/show_stage_log.pl?nm=arowana&dt=2024-08-24%2004%3A19%3A29&stg=build

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Joel Jacobson 2024-08-25 09:32:38 Re: Optimising numeric division
Previous Message Heikki Linnakangas 2024-08-24 17:17:47 Re: Interrupts vs signals