Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Clang crashes when using C90 __restrict keyword #38821

Open Quuxplusone opened 5 years ago

Quuxplusone commented 5 years ago
Bugzilla Link PR39849
Status NEW
Importance P normal
Reported by Guille D. Canas (guille@berkeley.edu)
Reported on 2018-11-30 05:18:22 -0800
Last modified on 2018-12-04 10:01:06 -0800
Version trunk
Hardware PC All
CC blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
Fixed by commit(s)
Attachments clangbug12.tar.gz (466558 bytes, application/x-gzip)
Blocks
Blocked by
See also
Created attachment 21181
Source and preprocessed files for the two cases, triggering different crashes.
[Note: Decompresses to current directory]

https://godbolt.org/z/j_WU8P

Minimal code is:
#include <immintrin.h>
struct S  {  __m128 operator + (const __m128 r) const { return r+l; } };
struct A
{
  S s;
  __m128 v;
  void f(A& /*__restrict*/ a) __restrict __attribute__((used)) { v += s+a.v; }
};
int main() { return 0; }

Reporting two different crashes (files t1.cpp, t2.cpp attached).
Commenting in/out the first '__restrict' does not affect the result.
It's the second '__restrict' (the one affecting 'this') that triggers the bug.
Quuxplusone commented 5 years ago

Attached clangbug12.tar.gz (466558 bytes, application/x-gzip): Source and preprocessed files for the two cases, triggering different crashes. [Note: Decompresses to current directory]

Quuxplusone commented 5 years ago
Sorry, minimal code [corrected] is:
https://godbolt.org/z/j_WU8P

#include <immintrin.h>
struct S
{
    __m128 l;
    __m128 operator + (const __m128 r) const { return r+l; }
};
struct A
{
  S s;
  __m128 v;
  void f(A& /*__restrict*/ a) __restrict __attribute__((used)) { v += s+a.v; }
};
int main() { return 0; }