[LLVMbugs] [Bug 13151] New: generated struct initalization has wrong type

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jun 19 12:50:15 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=13151

             Bug #: 13151
           Summary: generated struct initalization has wrong type
           Product: clang
           Version: 3.1
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: martin at se.inf.tu-dresden.de
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Following code for structure initialization compiled by clang has wrong IR,
generating additional uninitialized fields. Interestingly, changing the field
order leads to correctly generated code.

# include <stdbool.h>
struct hash_tuning
  {
     float growth_factor; 
     bool is_n_buckets; 
   };

typedef struct hash_tuning Hash_tuning;

#define DEFAULT_GROWTH_FACTOR 1.414

Hash_tuning default_tuning =
  {
    DEFAULT_GROWTH_FACTOR,
    false
  };


The resulting IR is:

; ModuleID = 'hash_clang_new'
target datalayout =
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@default_tuning = global { float, i8, [3 x i8] } { float 0x3FF69FBE80000000, i8
0, [3 x i8] undef }, align 4

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list