bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: checked integer arithmetic


From: Bruno Haible
Subject: Re: checked integer arithmetic
Date: Fri, 16 Dec 2016 01:02:18 +0100
User-agent: KMail/4.8.5 (Linux/3.8.0-44-generic; KDE/4.8.5; x86_64; ; )

> For this purpose, it would be good if GCC had a type, say, __gcc_index_t,
> that -fsanitize=undefined will make produce a diagnostic is a value < 0
> or > PTRDIFF_MAX is assigned.

Actually, this is a special case of a range type. If we could have Ada's range
types [1] in C, with overflow check enabled by -ftrapv or -fsanitize=undefined,
that would be a *great* improvement. Especially as many GNU packages use
C as an application programming language rather than as a system programming
language.

Bruno

[1] https://en.wikibooks.org/wiki/Ada_Programming/Types/range




reply via email to

[Prev in Thread] Current Thread [Next in Thread]