public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Andrew Pinski <pinskia@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-2373] Fix PR 101453: ICE with optimize and large integer constant Date: Fri, 16 Jul 2021 18:58:22 +0000 (GMT) [thread overview] Message-ID: <20210716185822.C3D5C3857C71@sourceware.org> (raw) https://gcc.gnu.org/g:e06b1c5ac00b1bd0339739d3d9377c90852a83c9 commit r12-2373-ge06b1c5ac00b1bd0339739d3d9377c90852a83c9 Author: Andrew Pinski <apinski@marvell.com> Date: Thu Jul 15 18:07:09 2021 -0700 Fix PR 101453: ICE with optimize and large integer constant The problem is the buffer is too small to hold "-O" and the interger. This fixes the problem by use the correct size instead. Changes since v1: * v2: Use HOST_BITS_PER_LONG and just divide by 3 instead of 3.32. OK? Bootstrapped and tested on x86_64-linux with no regressions. gcc/c-family/ChangeLog: PR c/101453 * c-common.c (parse_optimize_options): Use the correct size for buffer. Diff: --- gcc/c-family/c-common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 681fcc972f4..fe3657b9e74 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -5798,7 +5798,7 @@ parse_optimize_options (tree args, bool attr_p) if (TREE_CODE (value) == INTEGER_CST) { - char buffer[20]; + char buffer[HOST_BITS_PER_LONG / 3 + 4]; sprintf (buffer, "-O%ld", (long) TREE_INT_CST_LOW (value)); vec_safe_push (optimize_args, ggc_strdup (buffer)); }
reply other threads:[~2021-07-16 18:58 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20210716185822.C3D5C3857C71@sourceware.org \ --to=pinskia@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /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: linkBe 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).