| От | Tom Lane |
|---|---|
| Тема | Re: [RFC] Fix div/mul crash and more undefined behavior |
| Дата | |
| Msg-id | 4671.1353344487@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Re: [RFC] Fix div/mul crash and more undefined behavior (Xi Wang <xi.wang@gmail.com>) |
| Список | pgsql-hackers |
Xi Wang <xi.wang@gmail.com> writes:
> The reality is that C compilers are not friendly to postcondition
> checking; they consider signed integer overflow as undefined behavior,
> so they do whatever they want to do. Even workaround options like
> -fwrapv are often broken, not to mention that they may not even have
> those options.
I think it's probably past time that we stopped guessing about this
sort of thing and added some regression test cases for it. I'm
planning to add cases like this:
-- check sane handling of INT_MIN overflow cases
SELECT (-2147483648)::int4 * (-1)::int4;
SELECT (-2147483648)::int4 / (-1)::int4;
SELECT (-2147483648)::int4 % (-1)::int4;
regards, tom lane
В списке pgsql-hackers по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера