From: Sebastian Huber <sebastian.huber@embedded-brains.de>
To: Richard Biener <richard.guenther@gmail.com>,
Alexandre Oliva <oliva@adacore.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Introduce hardbool attribute for C
Date: Fri, 8 Jul 2022 15:39:45 +0200 [thread overview]
Message-ID: <5be9cc5f-7346-0f27-20dc-c51534b7e93f@embedded-brains.de> (raw)
In-Reply-To: <CAFiYyc3NFmmipnVOYxL0=8RWvtkX3ziPnjBzYbuu07bnoy93Bg@mail.gmail.com>
On 08.07.22 08:58, Richard Biener via Gcc-patches wrote:
> On Thu, Jul 7, 2022 at 10:00 PM Alexandre Oliva via Gcc-patches
> <gcc-patches@gcc.gnu.org> wrote:
>>
>> This patch introduces hardened booleans in C. The hardbool attribute,
>> when attached to an integral type, turns it into an enumerate type
>> with boolean semantics, using the named or implied constants as
>> representations for false and true.
>>
>> Expressions of such types decay to _Bool, trapping if the value is
>> neither true nor false, and _Bool can convert implicitly back to them.
>> Other conversions go through _Bool first.
>>
>> Regstrapped on x86_64-linux-gnu. Ok to install?
> Does this follow some other compilers / language? Is such feature used
> in existing code? Why is it useful to allow arbitrary values for true/false?
> Why is the default 0 and ~0 rather than 0 and 1 as for _Bool?
Maybe this helps to catch errors caused by radiation which resulted in a
bit flip in a processor register or other memory. If you use a single
bit for true/false you can't detect such an error without special hardware.
--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax: +49-89-18 94 741 - 08
Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/
next prev parent reply other threads:[~2022-07-08 13:39 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-07 19:59 Alexandre Oliva
2022-07-08 6:58 ` Richard Biener
2022-07-08 13:39 ` Sebastian Huber [this message]
2022-07-08 15:28 ` Alexandre Oliva
2022-07-08 15:28 ` Alexandre Oliva
2022-07-11 9:59 ` Richard Biener
2022-08-09 13:53 ` Alexandre Oliva
2023-06-16 5:35 ` Alexandre Oliva
2023-06-19 18:48 ` Bernhard Reutner-Fischer
2023-06-22 1:08 ` Alexandre Oliva
2023-06-22 21:15 ` Bernhard Reutner-Fischer
2023-06-24 2:57 ` Alexandre Oliva
2023-06-21 15:57 ` Qing Zhao
2023-06-22 2:35 ` Alexandre Oliva
2023-06-23 21:40 ` Qing Zhao
2023-06-24 2:38 ` Alexandre Oliva
2023-06-26 19:05 ` Qing Zhao
2023-06-28 7:26 ` Alexandre Oliva
2023-06-28 15:07 ` Qing Zhao
2023-06-29 10:30 ` Alexandre Oliva
2023-06-29 15:21 ` Qing Zhao
2023-06-24 4:42 ` Alexandre Oliva
2023-10-20 5:31 ` [PATCH v4] " Alexandre Oliva
2023-11-20 12:45 ` Alexandre Oliva
2023-11-20 13:56 ` Richard Biener
2023-11-29 9:30 ` Alexandre Oliva
[not found] ` <20230403012803.29ccf00b@nbbrfq>
[not found] ` <orzg7l8rr4.fsf@lxoliva.fsfla.org>
[not found] ` <6890D6BA-73DC-4F91-9413-228492A7F09B@gmail.com>
[not found] ` <ora5x0x8x9.fsf@lxoliva.fsfla.org>
2023-06-16 6:52 ` [PATCH] " Thomas Koenig
2023-06-16 8:03 ` Alexandre Oliva
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5be9cc5f-7346-0f27-20dc-c51534b7e93f@embedded-brains.de \
--to=sebastian.huber@embedded-brains.de \
--cc=gcc-patches@gcc.gnu.org \
--cc=oliva@adacore.com \
--cc=richard.guenther@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).