public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Alex Coplan <acoplan@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/vendors/ARM/heads/morello)] varasm: Don't call assemble_integer on NULLPTR_TYPE cst
Date: Fri, 20 May 2022 12:34:21 +0000 (GMT)	[thread overview]
Message-ID: <20220520123421.AE266382F091@sourceware.org> (raw)

https://gcc.gnu.org/g:b77e97c4392cc7b10dc598245c3e9eedbed6e4c6

commit b77e97c4392cc7b10dc598245c3e9eedbed6e4c6
Author: Alex Coplan <alex.coplan@arm.com>
Date:   Fri Mar 18 13:27:06 2022 +0000

    varasm: Don't call assemble_integer on NULLPTR_TYPE cst
    
    Fixes an ICE seen with gcc/testsuite/g++.dg/cpp0x/nullptr30.C.
    
    gcc/ChangeLog:
    
            * varasm.c (output_constant): Use assemble_pointer for constants
            of NULLPTR_TYPE.

Diff:
---
 gcc/varasm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/varasm.c b/gcc/varasm.c
index 4ec8ca79205..d680f01690d 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -5219,7 +5219,9 @@ output_constant (tree exp, unsigned HOST_WIDE_INT size, unsigned int align,
       cst = expand_expr (exp, NULL_RTX, VOIDmode, EXPAND_INITIALIZER);
       if (reverse)
 	cst = flip_storage_order (TYPE_MODE (TREE_TYPE (exp)), cst);
-      if (!assemble_integer (cst, MIN (size, thissize), align, 0))
+      if (code == NULLPTR_TYPE)
+	assemble_pointer (cst);
+      else if (!assemble_integer (cst, MIN (size, thissize), align, 0))
 	error ("initializer for integer/fixed-point value is too complicated");
       break;


                 reply	other threads:[~2022-05-20 12:34 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=20220520123421.AE266382F091@sourceware.org \
    --to=acoplan@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: 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).