incomplete altmacro support in clang
- Dominant language
- No language data
- Stars
- 2.3k
- Forks
- 310
- PR merge metrics
- No merged PRs in 30d
Description
I think the problems with `.if` results from Clang's incomplete `.altmacro` support. [pixman-arm-simd-asm.S uses .altmacro](https://gitlab.freedesktop.org/pixman/pixman/-/blob/aaf59b0338fbd4b9142794254261f8d0a018b60c/pixman/pixman-arm-simd-asm.S#L37). Here's the non-altmacro behavior:
```
$ cat >test.S <:2:9: error: expected absolute expression
.if arg != 42
^
...
```
It can be fixed using `\arg_`:
```
$ cat >test.S <
$ clang -c test.S
```
But `.altmacro` changes a bunch of stuff, and it can also be used instead of escaping the macro argument:
```
$ cat >test.S <
$ clang -c test.S
:2:9: error: expected absolute expression
.if arg != 42
^
```
There are a few open `.altmacro` bugs already, but I don't think this one is open yet:
https://bugs.llvm.org/buglist.cgi?quicksearch=altmacro
_Originally posted by @rprichard in https://github.com/android/ndk/issues/1569#issuecomment-905353082_
Contributor guide
Research direction
Start by reproducing the reported behavior with the test.S examples using clang -c and gcc -c, then inspect the .altmacro handling relevant to macro arguments and .if expressions. Compare the behavior with pixman-arm-simd-asm.S, and consider the issue done when the clang test accepts the equivalent .altmacro case without the expected-expression error.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100