[llvm-bugs] [Bug 27142] New: clang crashes on code with struct having fields of incomplete types

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Mar 30 14:18:43 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=27142

            Bug ID: 27142
           Summary: clang crashes on code with struct having fields of
                    incomplete types
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: su at cs.ucdavis.edu
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

The current clang trunk (as well 3.5.x and later) crashes when compiling the
following test case on x86_64-linux-gnu in both 32-bit and 64-bit modes. 

This is a regression from 3.4.x.


$ clang++ -v
clang version 3.9.0 (trunk 264841)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-trunk/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9.3
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.3.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$
$ clang++-3.4 small.cpp
small.cpp:3:5: error: field has incomplete type 'S'
  S v;
    ^
small.cpp:1:8: note: definition of 'S' is not complete until the closing '}'
struct S
       ^
1 error generated.
$
$ clang++ small.cpp
small.cpp:3:5: error: field has incomplete type 'S'
  S v;
    ^
small.cpp:1:8: note: definition of 'S' is not complete until the closing '}'
struct S
       ^
clang-3.9: error: unable to execute command: Segmentation fault (core dumped)
clang-3.9: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.9.0 (trunk 264841)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-trunk/bin
clang-3.9: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and
associated run script.
clang-3.9: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-3.9: note: diagnostic msg: /tmp/small-0f5af3.cpp
clang-3.9: note: diagnostic msg: /tmp/small-0f5af3.sh
clang-3.9: note: diagnostic msg:

********************
$


---------------------------------------


struct S
{ 
  S v;
} a;

int
main ()
{ 
  __builtin_memset (&a, 0, sizeof a);
  return 0;
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160330/b43bdd4c/attachment.html>


More information about the llvm-bugs mailing list