public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Qing Zhao <qing.zhao@oracle.com>
Cc: rguenther@suse.de, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Fixing PR107411
Date: Fri, 17 Feb 2023 23:35:22 +0100	[thread overview]
Message-ID: <Y/ABKvWRVJzcELvj@tucnak> (raw)
In-Reply-To: <20230217222603.2485714-1-qing.zhao@oracle.com>

On Fri, Feb 17, 2023 at 10:26:03PM +0000, Qing Zhao via Gcc-patches wrote:
> +	      else if (!DECL_NAME (lhs_var))
> +		{
> +		  char *lhs_var_name_str
> +		    = xasprintf ("D.%u", DECL_UID (lhs_var));

Why xasprintf?  D.%u can be sprintfed into a fixed size automatic buffer,
say 3 + (HOST_BITS_PER_INT + 2) / 3 would be a good upper bound for the size
of the buffer.  Then you don't need to free it...

> +		  if (strcmp (lhs_var_name_str, var_name_str) == 0)
> +		    {
> +		      free (lhs_var_name_str);
> +		      return;
> +		    }
> +		  free (lhs_var_name_str);
> +		}
> +	    }
>  	  gcc_assert (var_name_str && var_def_stmt);
>  	}
>      }
> -- 
> 2.31.1

	Jakub


  reply	other threads:[~2023-02-17 22:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-17 22:26 Qing Zhao
2023-02-17 22:35 ` Jakub Jelinek [this message]
2023-02-20 15:04   ` Qing Zhao
2023-02-20 15:17     ` Jakub Jelinek
2023-02-20 17:45       ` Qing Zhao

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=Y/ABKvWRVJzcELvj@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=qing.zhao@oracle.com \
    --cc=rguenther@suse.de \
    /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).