<html>
    <head>
      <base href="http://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Crash on invalid structure initialization"
   href="http://bugs.llvm.org/show_bug.cgi?id=32280">32280</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Crash on invalid structure initialization
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>kparzysz@codeaurora.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>--- cra.i ---

typedef struct {
  union {
    unsigned long long house;
    struct {
      unsigned cat1;
      unsigned cat2;
    };
  };
} struct_0;


typedef struct {
  union {
    struct {
      union {
        unsigned cows;
        struct {
          unsigned char c:1;
        };
      };
    };
  };

  union {
    struct {
      unsigned bird0;
      unsigned bird1;
    };
  };
} struct_1;


typedef struct {
  struct_0 s0;
  struct_1 s1[1];
} struct_2;

struct_2 s = {
  .s0 = {
    .dog = 0x00000000,
  },

  .s1[0] = {
    .cows = 0x00005050,
    .c = 1,
  },
};

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


$ clang -c cra.i

cra.i:40:6: error: field designator 'dog' does not refer to any field in type
'struct_0'
    .dog = 0x00000000,
     ^
warning: initializer overrides prior initialization of this subobject
[-Winitializer-overrides]
#0 0x0000000001c8c544 PrintStackTraceSignalHandler(void*)
(/w/c/org/bin/clang-5.0+0x1c8c544)
#1 0x0000000001c8c7a6 SignalHandler(int) (/w/c/org/bin/clang-5.0+0x1c8c7a6)
#2 0x00007fd7042ee340 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#3 0x000000000376abc8 clang::Stmt::getLocStart() const
(/w/c/org/bin/clang-5.0+0x376abc8)
#4 0x00000000030425e9 (anonymous
namespace)::InitListChecker::CheckDesignatedInitializer(clang::InitializedEntity
const&, clang::InitListExpr*, clang::DesignatedInitExpr*, unsigned int,
clang::QualType&,
clang::DeclContext::specific_decl_iterator<clang::FieldDecl>*, llvm::APSInt*,
unsigned int&, clang::InitListExpr*, unsigned int&, bool, bool)
(/w/c/org/bin/clang-5.0+0x30425e9)
#5 0x0000000003042980 (anonymous
namespace)::InitListChecker::CheckDesignatedInitializer(clang::InitializedEntity
const&, clang::InitListExpr*, clang::DesignatedInitExpr*, unsigned int,
clang::QualType&,
clang::DeclContext::specific_decl_iterator<clang::FieldDecl>*, llvm::APSInt*,
unsigned int&, clang::InitListExpr*, unsigned int&, bool, bool)
(/w/c/org/bin/clang-5.0+0x3042980)
#6 0x0000000003042980 (anonymous
namespace)::InitListChecker::CheckDesignatedInitializer(clang::InitializedEntity
const&, clang::InitListExpr*, clang::DesignatedInitExpr*, unsigned int,
clang::QualType&,
clang::DeclContext::specific_decl_iterator<clang::FieldDecl>*, llvm::APSInt*,
unsigned int&, clang::InitListExpr*, unsigned int&, bool, bool)
(/w/c/org/bin/clang-5.0+0x3042980)
#7 0x0000000003042980 (anonymous
namespace)::InitListChecker::CheckDesignatedInitializer(clang::InitializedEntity
const&, clang::InitListExpr*, clang::DesignatedInitExpr*, unsigned int,
clang::QualType&,
clang::DeclContext::specific_decl_iterator<clang::FieldDecl>*, llvm::APSInt*,
unsigned int&, clang::InitListExpr*, unsigned int&, bool, bool)
(/w/c/org/bin/clang-5.0+0x3042980)
#8 0x000000000303b30b (anonymous
namespace)::InitListChecker::CheckStructUnionTypes(clang::InitializedEntity
const&, clang::InitListExpr*, clang::QualType,
llvm::iterator_range<clang::CXXBaseSpecifier*>,
clang::DeclContext::specific_decl_iterator<clang::FieldDecl>, bool, unsigned
int&, clang::InitListExpr*, unsigned int&, bool)
(/w/c/org/bin/clang-5.0+0x303b30b)
#9 0x00000000030394e6 (anonymous
namespace)::InitListChecker::CheckListElementTypes(clang::InitializedEntity
const&, clang::InitListExpr*, clang::QualType&, bool, unsigned int&,
clang::InitListExpr*, unsigned int&, bool) (/w/c/org/bin/clang-5.0+0x30394e6)
#10 0x0000000003037338 (anonymous
namespace)::InitListChecker::CheckExplicitInitList(clang::InitializedEntity
const&, clang::InitListExpr*, clang::QualType&, clang::InitListExpr*, bool)
(/w/c/org/bin/clang-5.0+0x3037338)
#11 0x000000000303d130 (anonymous
namespace)::InitListChecker::CheckSubElementType(clang::InitializedEntity
const&, clang::InitListExpr*, clang::QualType, unsigned int&,
clang::InitListExpr*, unsigned int&) (/w/c/org/bin/clang-5.0+0x303d130)
#12 0x000000000303f8c4 (anonymous
namespace)::InitListChecker::CheckDesignatedInitializer(clang::InitializedEntity
const&, clang::InitListExpr*, clang::DesignatedInitExpr*, unsigned int,
clang::QualType&,
clang::DeclContext::specific_decl_iterator<clang::FieldDecl>*, llvm::APSInt*,
unsigned int&, clang::InitListExpr*, unsigned int&, bool, bool)
(/w/c/org/bin/clang-5.0+0x303f8c4)
#13 0x00000000030416a0 (anonymous
namespace)::InitListChecker::CheckDesignatedInitializer(clang::InitializedEntity
const&, clang::InitListExpr*, clang::DesignatedInitExpr*, unsigned int,
clang::QualType&,
clang::DeclContext::specific_decl_iterator<clang::FieldDecl>*, llvm::APSInt*,
unsigned int&, clang::InitListExpr*, unsigned int&, bool, bool)
(/w/c/org/bin/clang-5.0+0x30416a0)
#14 0x0000000003042980 (anonymous
namespace)::InitListChecker::CheckDesignatedInitializer(clang::InitializedEntity
const&, clang::InitListExpr*, clang::DesignatedInitExpr*, unsigned int,
clang::QualType&,
clang::DeclContext::specific_decl_iterator<clang::FieldDecl>*, llvm::APSInt*,
unsigned int&, clang::InitListExpr*, unsigned int&, bool, bool)
(/w/c/org/bin/clang-5.0+0x3042980)
#15 0x000000000303b30b (anonymous
namespace)::InitListChecker::CheckStructUnionTypes(clang::InitializedEntity
const&, clang::InitListExpr*, clang::QualType,
llvm::iterator_range<clang::CXXBaseSpecifier*>,
clang::DeclContext::specific_decl_iterator<clang::FieldDecl>, bool, unsigned
int&, clang::InitListExpr*, unsigned int&, bool)
(/w/c/org/bin/clang-5.0+0x303b30b)
#16 0x00000000030394e6 (anonymous
namespace)::InitListChecker::CheckListElementTypes(clang::InitializedEntity
const&, clang::InitListExpr*, clang::QualType&, bool, unsigned int&,
clang::InitListExpr*, unsigned int&, bool) (/w/c/org/bin/clang-5.0+0x30394e6)
#17 0x0000000003037338 (anonymous
namespace)::InitListChecker::CheckExplicitInitList(clang::InitializedEntity
const&, clang::InitListExpr*, clang::QualType&, clang::InitListExpr*, bool)
(/w/c/org/bin/clang-5.0+0x3037338)
#18 0x000000000302e9ee (anonymous
namespace)::InitListChecker::InitListChecker(clang::Sema&,
clang::InitializedEntity const&, clang::InitListExpr*, clang::QualType&, bool,
bool) (/w/c/org/bin/clang-5.0+0x302e9ee)
#19 0x000000000302fe3e diagnoseListInit(clang::Sema&, clang::InitializedEntity
const&, clang::InitListExpr*) (/w/c/org/bin/clang-5.0+0x302fe3e)
#20 0x00000000030298ce clang::InitializationSequence::Diagnose(clang::Sema&,
clang::InitializedEntity const&, clang::InitializationKind const&,
llvm::ArrayRef<clang::Expr*>) (/w/c/org/bin/clang-5.0+0x30298ce)
#21 0x00000000030230cd clang::InitializationSequence::Perform(clang::Sema&,
clang::InitializedEntity const&, clang::InitializationKind const&,
llvm::MutableArrayRef<clang::Expr*>, clang::QualType*)
(/w/c/org/bin/clang-5.0+0x30230cd)
#22 0x0000000002e05ff8 clang::Sema::AddInitializerToDecl(clang::Decl*,
clang::Expr*, bool) (/w/c/org/bin/clang-5.0+0x2e05ff8)
#23 0x0000000002b03d42
clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*)
(/w/c/org/bin/clang-5.0+0x2b03d42)
#24 0x0000000002b01d91 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
unsigned int, clang::SourceLocation*, clang::Parser::ForRangeInit*)
(/w/c/org/bin/clang-5.0+0x2b01d91)
#25 0x0000000002ae909b
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
(/w/c/org/bin/clang-5.0+0x2ae909b)
#26 0x0000000002ae8ac1
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier)
(/w/c/org/bin/clang-5.0+0x2ae8ac1)
#27 0x0000000002ae7aba
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (/w/c/org/bin/clang-5.0+0x2ae7aba)
#28 0x0000000002ae6cc9
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/w/c/org/bin/clang-5.0+0x2ae6cc9)
#29 0x0000000002ae2687 clang::ParseAST(clang::Sema&, bool, bool)
(/w/c/org/bin/clang-5.0+0x2ae2687)
#30 0x0000000002234c29 clang::FrontendAction::Execute()
(/w/c/org/bin/clang-5.0+0x2234c29)
#31 0x00000000021febd1
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/w/c/org/bin/clang-5.0+0x21febd1)
#32 0x00000000022cc531
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/w/c/org/bin/clang-5.0+0x22cc531)
#33 0x00000000008b501c cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/w/c/org/bin/clang-5.0+0x8b501c)
#34 0x00000000008b38d0 main (/w/c/org/bin/clang-5.0+0x8b38d0)
#35 0x00007fd7031d0ec5 __libc_start_main
/build/eglibc-3GlaMS/eglibc-2.19/csu/libc-start.c:321:0
#36 0x00000000008b0b69 _start (/w/c/org/bin/clang-5.0+0x8b0b69)
Stack dump:
0.      Program arguments: /w/c/org/bin/clang-5.0 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
cra.i -mrelocation-model static -mthread-model posix -mdisable-fp-elim
-fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables
-fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb
-coverage-notes-file /w/test/cra.gcno -resource-dir /w/c/org/lib/clang/5.0.0
-fdebug-compilation-dir /w/test -ferror-limit 19 -fmessage-length 224
-fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o cra.o -x
cpp-output cra.i 
1.      cra.i:47:2: current parser token ';'
clang-5.0: error: unable to execute command: Segmentation fault (core dumped)
clang-5.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 5.0.0 (<a href="http://llvm.org/git/clang.git">http://llvm.org/git/clang.git</a>
955221a1890c55693b01bcc79929a4cde39ccc2e) (<a href="http://llvm.org/git/llvm.git">http://llvm.org/git/llvm.git</a>
25754c1409cd59be5cdf6ffc68ea29635703320c)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /w/c/org/bin
clang-5.0: note: diagnostic msg: PLEASE submit a bug report to
<a href="http://llvm.org/bugs/">http://llvm.org/bugs/</a> and include the crash backtrace, preprocessed source, and
associated run script.
clang-5.0: note: diagnostic msg: Error generating preprocessed source(s) - no
preprocessable inputs.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>