From: Andrea Corallo <akrl@sdf.org>
To: "Nicolas Bértolo" <nicolasbertolo@gmail.com>
Cc: 41615@debbugs.gnu.org
Subject: bug#41615: [feature/native-comp] Dump prettier C code.
Date: Sun, 31 May 2020 20:00:29 +0000 [thread overview]
Message-ID: <xjftuzvkh7m.fsf@sdf.org> (raw)
In-Reply-To: <CAFnS-Okt=z_-qu4TmO+PfXSBBx4XidYCotRuGEmQuiur3HZ=4Q@mail.gmail.com> ("Nicolas Bértolo"'s message of "Sun, 31 May 2020 16:38:15 -0300")
Nicolas Bértolo <nicolasbertolo@gmail.com> writes:
>> The whole compilation is something like 5x faster here.
> Amazing.I took a closer look at the code that uses casts to bools and
> I think I found a
> bug.
>
> Casting to bool using an enum is equivalent to taking the lowest byte using
> a byte mask. This wrongly casts to "false" integers whose lowest byte is nil.
>
> bool cast_from_unsigned_long_long_to_bool (unsigned long long x)
> {
> return (x & 0xFF);
> }
>
> The correct way to cast to bool is to mimic C semantics:
>
> bool cast_from_unsigned_long_long_to_bool (unsigned long long x)
> {
> if (x != 0)
> return true;
> else
> return false;
> }
>
> Am I right?
You are.
I never fixed it (is present also in the pure union cast mechanism)
because I had not time so far and practically I suspect is not a real
case of problematic code we generate. But is *certanly* good to fix.
BTW If you are into the mood to dig into these... also sign extentions
probably should be handled ;)
Andrea
--
akrl@sdf.org
next prev parent reply other threads:[~2020-05-31 20:00 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-30 15:08 bug#41615: [feature/native-comp] Dump prettier C code Nicolas Bértolo
2020-05-30 22:20 ` Nicolas Bértolo
2020-05-31 10:45 ` Andrea Corallo
2020-05-31 15:42 ` Nicolas Bértolo
2020-05-31 11:37 ` Andrea Corallo
2020-05-31 15:48 ` Andrea Corallo
2020-05-31 15:54 ` Nicolas Bértolo
2020-05-31 16:57 ` Andrea Corallo
2020-05-31 17:26 ` Nicolas Bértolo
2020-05-31 18:11 ` Andrea Corallo
2020-05-31 19:38 ` Nicolas Bértolo
2020-05-31 20:00 ` Andrea Corallo [this message]
2020-05-31 20:18 ` Andrea Corallo
2020-06-01 7:19 ` Andrea Corallo
2020-06-01 12:25 ` Nicolas Bértolo
2020-06-01 20:28 ` Andrea Corallo
2020-06-01 23:11 ` Nicolas Bértolo
2020-06-04 9:52 ` Andrea Corallo
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=xjftuzvkh7m.fsf@sdf.org \
--to=akrl@sdf.org \
--cc=41615@debbugs.gnu.org \
--cc=nicolasbertolo@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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.