Re: [RFC] overflow checks optimized away

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: [RFC] overflow checks optimized away
Дата
Msg-id CAM-w4HPQFnmPVqgsZZvqga8ZWuWgVK1KqedAFZsQZ9BDUvP9Pw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [RFC] overflow checks optimized away  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: [RFC] overflow checks optimized away  (Greg Stark <stark@mit.edu>)
Список pgsql-hackers
On Fri, Nov 29, 2013 at 5:21 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
>> c) I want to add regression tests that will ensure that the overflow
>> checks are all working. So far I haven't been able to catch any being
>> optimized away even with -fno-wrapv and -fstrict-overflow.
>
> This does not leave me with a warm feeling about whether this is a useful
> exercise.  Maybe you need to try a different compiler?

Just as an update I did get gcc to do the wrong thing on purpose. The
only overflow check that the regression tests find missing is the one
for int8abs() ie:

*** /home/stark/src/postgresql/postgresql/src/test/regress/expected/int8.out  Wed Jul 17 19:23:02 2013
--- /home/stark/src/postgresql/postgresql/src/test/regress/results/int8.out  Fri Nov 29 14:22:31 2013
***************
*** 674,680 **** select '9223372036854775800'::int8 % '0'::int8; ERROR:  division by zero select
abs('-9223372036854775808'::int8);
! ERROR:  bigint out of range select '9223372036854775800'::int8 + '100'::int4; ERROR:  bigint out of range select
'-9223372036854775800'::int8- '100'::int4;
 
--- 674,684 ---- select '9223372036854775800'::int8 % '0'::int8; ERROR:  division by zero select
abs('-9223372036854775808'::int8);
!          abs
! ----------------------
!  -9223372036854775808
! (1 row)
! select '9223372036854775800'::int8 + '100'::int4; ERROR:  bigint out of range select '-9223372036854775800'::int8 -
'100'::int4;

======================================================================



-- 
greg



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: MultiXact truncation, startup et al.
Следующее
От: Andres Freund
Дата:
Сообщение: Re: MultiXact truncation, startup et al.