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

            Bug ID: 113391
           Summary: Assertion failure when MSP430 operand modifier J is
                    used with a non-constant value
           Product: gcc
           Version: 13.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: seanga2 at gmail dot com
  Target Milestone: ---

The following program

unsigned char src;

int main(void)
{
    unsigned int tmp = 0x1234;
    unsigned int dst = 2;

    src = 1;
    asm(".set off, %J[off]\n\t"
        "add.b off(%[base]), %[dst]\n\t"
        : [dst] "+r" (dst)
        : [off] "i" ((unsigned int)&src - tmp), [base] "r" (tmp), "m" (src));
    return dst != 3;
}

fails to compile with the following error:

during RTL pass: final
add.c: In function 'main':
add.c:14:1: internal compiler error: in msp430_print_operand, at
config/msp430/msp430.cc:4338
   14 | }
      | ^
0x5fb114 ???
        ../sysdeps/x86_64/start.S:115
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

The version of the compiler is

$ msp430-elf-gcc --version
msp430-elf-gcc (GCC) 13.1.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Reply via email to