https://sourceware.org/bugzilla/show_bug.cgi?id=35057

            Bug ID: 35057
           Summary: arm: gas segfaults on a self-referencing symbol
           Product: binutils
           Version: 2.47
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gas
          Assignee: unassigned at sourceware dot org
          Reporter: mumumu0722 at gmail dot com
  Target Milestone: ---

gas crashes with a segmentation fault when a symbol defined in terms of itself
is used as an instruction immediate.

$ cat arm-gas-self-referencing-symbol-immediate.s
        .set    sym, sym
        mov     r0, #sym

$ arm-linux-gnueabihf-as --version
GNU assembler (GNU Binutils) 2.47.50.20261122
$ arm-linux-gnueabihf-as arm-gas-self-referencing-symbol-immediate.s -o t.o
Segmentation fault (core dumped)

".equ sym, sym+1" crashes the same way.

Expected: the error that gas gives when sym is used in data (.word sym)
instead, and that the aarch64, riscv and x86 gas give for an
instruction operand:

  Error: symbol definition loop encountered at `sym'

Godbolt: https://godbolt.org/z/xcsrWrTdh

This issue is found by fuzzing/automated testing

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to