Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Clang :: Sema/offsetof-64.c FAILs on 64-bit Sparc #46679

Open Quuxplusone opened 3 years ago

Quuxplusone commented 3 years ago
Bugzilla Link PR47710
Status NEW
Importance P normal
Reported by Rainer Orth (ro@gcc.gnu.org)
Reported on 2020-10-02 05:25:49 -0700
Last modified on 2020-10-09 04:55:00 -0700
Version trunk
Hardware Sun All
CC llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments o64.tar.bz2 (337 bytes, application/x-bzip)
Blocks
Blocked by
See also
The Clang :: Sema/offsetof-64.c test FAILs on 64-bit Sparc (seen on both
sparcv9-sun-solaris2.11 and sparc64-unknown-linux-gnu):

Assertion failed: (Size == 0 || EltInfo.Width <= (uint64_t)(-1) / Size) &&
"Overflow in array type bit size evaluation", file /vol/llvm/src/llvm-
project/dist/clang/lib/AST/ASTContext.cpp, line 1914

However, the same problem can be seen in a much reduced testcase (attached).

Compile with

$ clang -m64 -O3 -o o64 o64.c o64d.c && ./o64
Assertion failed: Width <= (uint64_t)(-1) / Size, file o64.c, line 7, function
main
Abort (core dumped)

The test works with gcc and clang-9, while clang-10 and 11 show the same error.
Quuxplusone commented 3 years ago

Attached o64.tar.bz2 (337 bytes, application/x-bzip): Reduced test case.

Quuxplusone commented 3 years ago
I found that a libclangAST.a miscompilation causes this:

* In a 1-stage Release build with gcc, the error doesn't occur,
* neither in a 2-stage Debug build but
* only in a 2-stage Release or RelWithDebInfo build

The miscompilation only affects libclangAST.a, but more than a single object
file
therein which makes identification more difficult.