public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/112499] [11/12/13/14 Regression] ICE in output_operand: invalid expression as operand with addition of 2 differences of address of labels
Date: Tue, 19 Mar 2024 16:49:58 +0000	[thread overview]
Message-ID: <bug-112499-4-bCxJ3oC1cw@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-112499-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Or consider
typedef unsigned __INTPTR_TYPE__ uintptr_t;
volatile int v;

int
foo (int x)
{
  static uintptr_t a = ((char *)&&l2 - (char *)&&l1) + ((char *)&&l4 - (char
*)&&l3) + ((char *)&&l6 - (char *)&&l5);
  void *b[] = { &&l1, &&l2, &&l3, &&l4, &&l5, &&l6 };
l1:
  ++v;
l2:
  ++v;
l3:
  ++v;
l4:
  ++v;
l5:
  ++v;
l6:
  ++v;
  if (x >= 0 && x <= 5)
    {
      x += 42;
      goto *b[x - 42];
    }
  return a;
}
That is even older.
r0-79351-g7771bb621aad43c7d0e21ccec4922dd3beac9cb6
still used to reject that:
error: initializer element is not computable at load time
r0-79390-g7ffb5e78794b6d8f8094d7c928e6f0e94b62cad6
already accepts but assembler doesn't handle that:
pr112499-2.s:58: Error: invalid operands (*ABS* and .text sections) for `-'
pr112499-2.s:58: Error: invalid operands (*ABS* and .text sections) for `-'
pr112499-2.s:58: Error: invalid operands (.text and .text sections) for `+'
        .quad   .L3-.L6-.L4-.L2+.L7+.L5
Guess we can only accept a subtraction of 2 labels, not addition of 2 labels or
something more complex.

  parent reply	other threads:[~2024-03-19 16:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-13  2:28 [Bug c/112499] New: GCC: 14: internal compiler error: output_operand: invalid expression as operand 141242068 at smail dot nju.edu.cn
2023-11-13  2:47 ` [Bug middle-end/112499] [11/12/13/14 Regression] ICE in output_operand: invalid expression as operand with addition of 2 differences of address of labels pinskia at gcc dot gnu.org
2023-11-13  2:47 ` pinskia at gcc dot gnu.org
2023-11-13 14:25 ` jakub at gcc dot gnu.org
2024-03-07 21:02 ` law at gcc dot gnu.org
2024-03-12 13:22 ` jakub at gcc dot gnu.org
2024-03-19 16:49 ` jakub at gcc dot gnu.org [this message]
2024-04-07  5:32 ` pinskia 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-112499-4-bCxJ3oC1cw@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).