From e57435f68baacb2a802703c6720c689a2126714b Mon Sep 17 00:00:00 2001 From: Marijn Haverbeke Date: Fri, 9 Sep 2011 13:43:32 +0200 Subject: [PATCH] Don't put 0-length array in the lltype of an arg-less variant This seems to confuse LLVM in some very specific situations. Closes #883 --- src/comp/middle/trans_common.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/comp/middle/trans_common.rs b/src/comp/middle/trans_common.rs index 6c3aa2f9a4ca..cbb11879fd7a 100644 --- a/src/comp/middle/trans_common.rs +++ b/src/comp/middle/trans_common.rs @@ -696,7 +696,11 @@ fn T_opaque_closure_ptr(cx: &crate_ctxt) -> TypeRef { fn T_tag(tn: &type_names, size: uint) -> TypeRef { let s = "tag_" + uint::to_str(size, 10u); if tn.name_has_type(s) { ret tn.get_type(s); } - let t = T_struct([T_int(), T_array(T_i8(), size)]); + let t = if size == 0u { + T_struct([T_int()]) + } else { + T_struct([T_int(), T_array(T_i8(), size)]) + }; tn.associate(s, t); ret t; }