[PATCH] D118545: [ARM] Fix 8-bit immediate overflow in the instruction of segmented stack prologue.

Zhiyao Ma via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 7 12:41:18 PST 2022


ZhiyaoMa98 added a comment.

Let me clarify the problem. The test compares the output at the machine assembly level, i.e. ARM (thumb) assembly instruction. However, some syntactically correct ARM (thumb) assembly does not generate binary instruction with the same semantic.

For example,  `sub r5, #40192` is a syntactically correct ARM (thumb) assembly, but `#40192` does not fit into 8-bit immediate field. Surprisingly the assembler accepts the assembly instruction and emits the binary instruction `subs r5, #0`, without reporting an error.

The following command tests at the machine assembly level. It sees `sub r5, #40192` and considers it correct.
`; RUN: llc < %s -mtriple=thumb-linux-androideabi -verify-machineinstrs | FileCheck %s -check-prefix=Thumb-android`

The following command generates binary object. It should triggers an error when it tries to assemble `sub r5, #40192` in thumb1, but does not.
`; RUN: llc < %s -mtriple=thumb-linux-androideabi -filetype=obj`

So my point is the current test code has already included the large stack frame test case, but the bug is not detected and we are unable to detect it in this way.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118545/new/

https://reviews.llvm.org/D118545



More information about the llvm-commits mailing list