public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Patrick McGehearty <patrick.mcgehearty@oracle.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH v5] Practical Improvement to libgcc Complex Divide
Date: Fri, 11 Dec 2020 00:35:05 +0100	[thread overview]
Message-ID: <20201210233505.GU3788@tucnak> (raw)
In-Reply-To: <f5ba5035-c52f-f7a4-7449-effebb1a173e@oracle.com>

On Thu, Dec 10, 2020 at 10:27:46AM -0600, Patrick McGehearty via Gcc-patches wrote:
> Thank you for your rapid feedback.
> I'll fix the various formatting issues (spaces in the wrong places
> and such as well as revise the Changelog magic) in the next submission.
> It will wait for Joseph's review to also make any changes he suggests.
> I'll also try to train myself to be more sensitive to gcc formatting
> conventions while proofreading.
> 
> I'm reluctant to change or use XALLOCAVEC instead of alloca as that
> is not the current style elsewhere in the routine.

If so, I can fix it incrementally.  But, at least fix up the formatting,
that was the reason I've mentioned XALLOCAVEC, because the alloca call
formatting was off.

> On the strcpy, strncpy, and memcpy question, given short length of
> the string being copied, I don't think it makes much difference.
> The two other copy operations in the file are memcpy.
> memcpy might be slightly better since it is generally more frequently
> seen and more likely that gcc has special case code to inline
> short fixed length memcpy as a few assignments. Even if both strncpy
> and memcpy are inlined, the memcpy code may be simplier as it does
> not need to be concerned with special treatment of nulls.
> I'll change the strncpy to memcpy.

Even if short, strncpy is a badly designed API that in 99% cases just
shouldn't be used.  Either the string is shorter than the passed argument,
then in most cases completely useless zeroes the rest of the buffer
(exception is security sensitive code that needs to overwrite everything
that has been before), or it is the same length and then one should use
strcpy instead, or there is string truncation which doesn't zero terminate,
which is very rarely something one wants to do.

	Jakub


  reply	other threads:[~2020-12-10 23:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-08 22:32 Patrick McGehearty
2020-12-08 23:31 ` Jakub Jelinek
2020-12-10 16:27   ` Patrick McGehearty
2020-12-10 23:35     ` Jakub Jelinek [this message]
2020-12-11 21:41       ` Patrick McGehearty
2020-12-16 21:28     ` Joseph Myers

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=20201210233505.GU3788@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=patrick.mcgehearty@oracle.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).