public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "gjl at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/112830] internal compiler error: in convert_memory_address_addr_space_1, at explow.cc:302
Date: Sun, 03 Dec 2023 12:37:25 +0000	[thread overview]
Message-ID: <bug-112830-4-bG2gmHqIXp@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-112830-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112830

Georg-Johann Lay <gjl at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |avr
           Keywords|                            |addr-space,
                   |                            |ice-on-valid-code

--- Comment #1 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
In explow.cc, we have:

rtx convert_memory_address_addr_space_1 (...)
{
#ifndef POINTERS_EXTEND_UNSIGNED
  gcc_assert (GET_MODE (x) == to_mode || GET_MODE (x) == VOIDmode); // line 302
  return x;
#else /* defined(POINTERS_EXTEND_UNSIGNED) */

so it seems the backend has to define POINTERS_EXTEND_UNSIGNED, which it
currently doesn't.  However, the documentation of PEU reads:

> Macro: POINTERS_EXTEND_UNSIGNED
>   A C expression that determines how pointers should be extended from
>   ptr_mode to either Pmode or word_mode. It is greater than zero if
>   pointers should be zero-extended, zero if they should be sign-extended,
>   and negative if some other sort of conversion is needed. In the last case,
>   the extension is done by the target’s ptr_extend instruction.
>   You need not define this macro if the ptr_mode, Pmode and word_mode are
>   all the same width. 

The avr backend has:

Pmode = word_mode = HImode (16 bits), mode for ADDR_SPACE_GENERIC

PSImode = 24 bits, mode for ADDR_SPACE_MEMX, aka. __memx

So it appear the middle-end wants to "extend" a pointer from 24-bit PSImode to
16-bit Pmode, which makes no sense.  Apart from that, the code does not require
any pointer adjustments.

One guess is that the middle-end tries to expand the memcpy, because insn
cpymemhi only support CONST_INT lengths, and gets somethig wrong about address
spaces.

The backend defines TARGET_ADDR_SPACE_CONVERT, and
TARGET_ADDR_SPACE_ADDRESS_MODE is the same like TARGET_ADDR_SPACE_POINTER_MODE
for all address spaces.

  reply	other threads:[~2023-12-03 12:37 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-03 12:22 [Bug middle-end/112830] New: " gjl at gcc dot gnu.org
2023-12-03 12:37 ` gjl at gcc dot gnu.org [this message]
2023-12-03 22:17 ` [Bug middle-end/112830] " pinskia at gcc dot gnu.org
2023-12-04  7:06 ` rguenth at gcc dot gnu.org
2023-12-04  8:40 ` rguenth at gcc dot gnu.org
2023-12-04  9:07 ` rguenth at gcc dot gnu.org
2023-12-04  9:08 ` rguenth at gcc dot gnu.org
2023-12-04  9:27 ` rguenth at gcc dot gnu.org
2023-12-04 11:56 ` rguenth at gcc dot gnu.org
2023-12-04 19:19 ` gjl at gcc dot gnu.org
2023-12-05  9:48 ` rguenth at gcc dot gnu.org
2023-12-05 10:54 ` rguenth at gcc dot gnu.org
2023-12-05 11:31 ` ebotcazou at gcc dot gnu.org
2023-12-05 13:55 ` cvs-commit at gcc dot gnu.org
2023-12-05 13:56 ` rguenth at gcc dot gnu.org
2023-12-05 20:46 ` gjl at gcc dot gnu.org
2023-12-06  7:33 ` rguenth at gcc dot gnu.org

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=bug-112830-4-bG2gmHqIXp@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).