Open Quuxplusone opened 3 years ago
Bugzilla Link | PR49254 |
Status | NEW |
Importance | P normal |
Reported by | Zhuo Zhang (zhan3299@purdue.edu) |
Reported on | 2021-02-18 14:51:37 -0800 |
Last modified on | 2021-02-19 07:02:47 -0800 |
Version | trunk |
Hardware | PC Linux |
CC | htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk |
Fixed by commit(s) | |
Attachments | |
Blocks | |
Blocked by | |
See also |
It seems a carefully-crafted C program will crash the trunk (and the newest
commit).
The poc file has a very similar nature to
https://bugs.llvm.org/show_bug.cgi?id=49239.
$ cat poc.c
int main() {
typeof(__builtin_fpclassify(0, 1, 2, 3, __builtin_assume_aligned(({10;}), 4), 10.0)) a = 10;
return a;
}
$ ./clang -x c poc.c
It does have different behaviors on different version
Latest commit b6db47d7e044730dc3c9b35dae6697eee0885dbf (crash): attached below
Trunk (crash): https://godbolt.org/z/sxsE9e
11.0 (subject program returns 0): https://godbolt.org/z/6s4nv3
10.0 (compilation fails): https://godbolt.org/z/TzMK6n
6.0 - 9.0 (subject program return 10): https://godbolt.org/z/qEvs63
$ /data/xxx/git/llvm-project/build_trunk_update/bin/clang --version
clang version 13.0.0 (https://github.com/llvm/llvm-project.git
b6db47d7e044730dc3c9b35dae6697eee0885dbf)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /data/xxx/git/llvm-project/build_trunk_update/bin
$ ./clang -c -o /tmp/a.out -x c poc.c
poc.c:2:70: warning: incompatible integer to pointer conversion passing 'int'
to parameter of type 'const void *' [-Wint-conversion]
typeof(__builtin_fpclassify(0, 1, 2, 3, __builtin_assume_aligned(({10;}), 4), 10.0)) a = 10;
^~~~~~~
poc.c:2:45: warning: incompatible pointer to integer conversion passing 'void
*' to parameter of type 'int' [-Wint-conversion]
typeof(__builtin_fpclassify(0, 1, 2, 3, __builtin_assume_aligned(({10;}), 4), 10.0)) a = 10;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[1] 23006 segmentation fault (core dumped) ./clang -c -o /tmp/a.out
(In reply to Zhuo Zhang from comment #1)
> It seems a carefully-crafted C program will crash the trunk (and the newest
> commit).
>
> The poc file has a very similar nature to
> https://bugs.llvm.org/show_bug.cgi?id=49239.
>
> $ cat poc.c
> int main() {
> typeof(__builtin_fpclassify(0, 1, 2, 3,
> __builtin_assume_aligned(({10;}), 4), 10.0)) a = 10;
> return a;
> }
>
> $ ./clang -x c poc.c
>
> It does have different behaviors on different version
>
> Latest commit b6db47d7e044730dc3c9b35dae6697eee0885dbf (crash): attached
> below
> Trunk (crash): https://godbolt.org/z/sxsE9e
> 11.0 (subject program returns 0): https://godbolt.org/z/6s4nv3
> 10.0 (compilation fails): https://godbolt.org/z/TzMK6n
> 6.0 - 9.0 (subject program return 10): https://godbolt.org/z/qEvs63
>
>
> $ /data/xxx/git/llvm-project/build_trunk_update/bin/clang --version
> clang version 13.0.0 (https://github.com/llvm/llvm-project.git
> b6db47d7e044730dc3c9b35dae6697eee0885dbf)
> Target: x86_64-unknown-linux-gnu
> Thread model: posix
> InstalledDir: /data/xxx/git/llvm-project/build_trunk_update/bin
>
>
> $ ./clang -c -o /tmp/a.out -x c poc.c
> poc.c:2:70: warning: incompatible integer to pointer conversion passing
> 'int' to parameter of type 'const void *' [-Wint-conversion]
> typeof(__builtin_fpclassify(0, 1, 2, 3,
> __builtin_assume_aligned(({10;}), 4), 10.0)) a = 10;
> ^~~~~~~
> poc.c:2:45: warning: incompatible pointer to integer conversion passing
> 'void *' to parameter of type 'int' [-Wint-conversion]
> typeof(__builtin_fpclassify(0, 1, 2, 3,
> __builtin_assume_aligned(({10;}), 4), 10.0)) a = 10;
>
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> [1] 23006 segmentation fault (core dumped) ./clang -c -o /tmp/a.out
Oh, I paste the wrong links...
Trunk (crash): https://godbolt.org/z/Eqfq1s
11.0 (subject program returns 0): https://godbolt.org/z/xKcT7e
10.0 (compilation fails): https://godbolt.org/z/4bfGsT
6.0 - 9.0 (subject program return 10): https://godbolt.org/z/v8vYnK