From: Thomas Koenig <tkoenig@netcologne.de>
To: Alexandre Oliva <oliva@adacore.com>,
Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>,
gcc-patches <gcc-patches@gcc.gnu.org>
Cc: fortran@gcc.gnu.org
Subject: Re: [PATCH] Introduce hardbool attribute for C
Date: Fri, 16 Jun 2023 08:52:24 +0200 [thread overview]
Message-ID: <78806f60-27a0-1432-9bb2-1e2061414e67@netcologne.de> (raw)
In-Reply-To: <ora5x0x8x9.fsf@lxoliva.fsfla.org>
Hi Alexandre,
> On Apr 6, 2023, Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> wrote:
>
>> 29 For C_BOOL, the internal representation of .TRUE._C_BOOL and
>> .FALSE._C_BOOL shall be the same as those of
>> 30 the C values (_Bool)1 and (_Bool)0 respectively.
>
> I'm not changing any of the standard types, FWIW. The proposed
> extension enables alternate boolean types to be introduced, with
> extra checking for hardening.
>
>> I personally like your proposed 0 and ~0, that's probably pretty robust.
>
> That is only a default. Certain applications may benefit from other
> values. 0xa5 and 0x5a seem to make a good combination too.
In gfortran, we depend on the representation of 0/1 for several things
(among them avoiding having separate library versions for logical
kind=1,2,4,8,16 for MASK).
So, such a type would be incompatible with vanilla LOGICAL variables
and with C interop logical variables.
If anybody should pass such a hardbool variable to Fortran, they
will get unpredictable results, and deserve to lose. The opposite
effect of what would be intended :-)
Best regards
Thomas
next prev parent reply other threads:[~2023-06-16 6:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <orlet4lmn8.fsf@lxoliva.fsfla.org>
[not found] ` <or8rnxttff.fsf@lxoliva.fsfla.org>
[not found] ` <20230403012803.29ccf00b@nbbrfq>
[not found] ` <orzg7l8rr4.fsf@lxoliva.fsfla.org>
2023-04-06 11:10 ` Bernhard Reutner-Fischer
2023-06-16 5:39 ` Alexandre Oliva
2023-06-16 6:52 ` Thomas Koenig [this message]
2023-06-16 8:03 ` Alexandre Oliva
[not found] ` <oredmcx940.fsf@lxoliva.fsfla.org>
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
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=78806f60-27a0-1432-9bb2-1e2061414e67@netcologne.de \
--to=tkoenig@netcologne.de \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=oliva@adacore.com \
--cc=rep.dot.nop@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).