<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - type_tag_for_datatype causes clang to crash in some cases."
   href="https://llvm.org/bugs/show_bug.cgi?id=28520">28520</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>type_tag_for_datatype causes clang to crash in some cases.
          </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>All
          </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>Frontend
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>pierregousseau14@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Use of type_tag_for_datatype causes clang to crash in some cases.

clang 3.9 trunk@r275160
Target: x86_64-unknown-linux-gnu

----
static const int test_void
  __attribute__((type_tag_for_datatype
                 (test, void))) = 0;
#define TEST_VOID 0

void test(int datatype, ...)
  __attribute__((argument_with_type_tag(test,2,1)));

int main() {
  test(TEST_VOID);
  return 0;
}
----

clang -c test.c
#0 0x000000000129a165 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
#1 0x00000000012980ce llvm::sys::RunSignalHandlers()
#2 0x0000000001298232 SignalHandler(int)
#3 0x00007fb061f86340 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#4 0x0000000001f4caba
clang::Sema::CheckArgumentWithTypeTag(clang::ArgumentWithTypeTagAttr const*,
clang::Expr const* const*)
...
Stack dump:
0.      Program arguments: clang-3.9 -cc1 -triple x86_64-unknown-linux-gnu
-emit-obj -mrelax-all -disable-free -main-file-name tag.c -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-file lab/tag.c -resource-dir
llvm/install/bin/../lib/clang/3.9.0 -internal-isystem /usr/local/include
-internal-isystem llvm/install/bin/../lib/clang/3.9.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-fdebug-compilation-dir lab -ferror-limit 19 -fmessage-length 168
-fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o tag.o -x c
tag.c
1.      tag.c:10:17: current parser token ')'
2.      tag.c:9:12: parsing function body 'main'
3.      tag.c:9:12: in compound statement ('{}')</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>