initializer does not match global variable type.

I have an objective-c file, bar.m, that I try to process in the
following way generating the error shown below. Any help would
be appreciated. I suspect the error is in the first few lines
of output.

thanks,

Todd

cfrontend-g++ -o bar.bc bar.m
llvm2cpp -o bar.cpp bar.bc
g++ -c bar.o bar.cpp
ld -o bar bar.o -l objc -l LLVMCore -l LLVMSupport -l LLVMSystem
./bar

Global variable initializer type does not match global variable type!
[13 x sbyte]* %.str_2
Global variable initializer type does not match global variable type!
[9 x sbyte]* %.str_3
Global variable initializer type does not match global variable type!
[2 x sbyte]* %.str_4
Broken module found, verification continues.
; ModuleID = 'bar.ll'
target endian = little
target pointersize = 32
target triple = "i686-pc-linux-gnu"
deplibs = [ "objc", "c", "crtend" ]
  %struct._objc_module = type { int, int, sbyte*,
%struct._objc_symtab* }
  %struct._objc_selector = type { sbyte*, sbyte* }
  %struct._objc_symtab = type { int, %struct._objc_selector**,
short, short, [2 x sbyte*] }
  %struct.objc_class = type { %struct.objc_class*,
%struct.objc_class*, sbyte*, int, uint, int, %struct.objc_ivar_list*,
%struct.objc_method_list*, %struct.sarray*, %struct.objc_class*,
%struct.objc_class*, %struct.objc_protocol_list*, sbyte* }
  %struct.objc_ivar_list = type opaque
  %struct.objc_method_list = type opaque
  %struct.objc_object = type { %struct.objc_class* }
  %struct.objc_protocol_list = type opaque
  %struct.sarray = type opaque
%llvm.global_ctors = appending global [1 x { int, void ()* }] [ { int,
void ()* } { int 65535, void ()* %_GLOBAL__I_main } ] ; <[1 x
{ int, void ()* }]*> [#uses=0]
%.str_2 = internal constant [13 x sbyte] c"Hello world\0A"
; <[13 x sbyte]*> [#uses=1]
%.str_3 = internal constant [9 x sbyte] c"Fraction" ; <[9 x
sbyte]*> [#uses=1]
%.str_4 = internal constant [2 x sbyte] c"\0A" ; <[2 x sbyte]*>
[#uses=1]
%_OBJC_SELECTOR_TABLE = internal global [6 x %struct._objc_selector]
zeroinitializer ; <[6 x %struct._objc_selector]*> [#uses=5]
%_OBJC_MODULES = internal global %struct._objc_module zeroinitializer
; <%struct._objc_module*> [#uses=1]
%__objc_class_name_Fraction = constant uint 0 ; <uint*>
[#uses=0]

implementation ; Functions:

declare int %printf(sbyte*, ...)

declare %struct.objc_object* %objc_get_class(sbyte*)

int %main(int %argc, sbyte** %argv) {
entry:
  tail call void %__main( )
  %tmp.0 = tail call int (sbyte*, ...)* %printf( sbyte*
getelementptr ([13 x sbyte]* %.str_2, int 0, int 0) ) ; <int>
[#uses=0]
  %tmp.5 = tail call %struct.objc_object* %objc_get_class( sbyte*
getelementptr ([9 x sbyte]* %.str_3, int 0, int 0) ) ;
<%struct.objc_object*> [#uses=2]
  %tmp.3 = tail call %struct.objc_object* (%struct.objc_object*,
%struct._objc_selector*, ...)* (%struct.objc_object*,
%struct._objc_selector*)* %objc_msg_lookup( %struct.objc_object* %tmp.5,
%struct._objc_selector* getelementptr ([6 x %struct._objc_selector]*
%_OBJC_SELECTOR_TABLE, int 0, int 0) ) ; <%struct.objc_object*
(%struct.objc_object*, %struct._objc_selector*, ...)*> [#uses=1]
  %tmp.10 = tail call %struct.objc_object* (%struct.objc_object*,
%struct._objc_selector*, ...)* %tmp.3( %struct.objc_object* %tmp.5,
%struct._objc_selector* getelementptr ([6 x %struct._objc_selector]*
%_OBJC_SELECTOR_TABLE, int 0, int 0) ) ; <%struct.objc_object*>
[#uses=2]
  %tmp.2 = tail call %struct.objc_object* (%struct.objc_object*,
%struct._objc_selector*, ...)* (%struct.objc_object*,
%struct._objc_selector*)* %objc_msg_lookup( %struct.objc_object*
%tmp.10, %struct._objc_selector* getelementptr ([6 x
%struct._objc_selector]* %_OBJC_SELECTOR_TABLE, int 0, int 1) )
; <%struct.objc_object* (%struct.objc_object*, %struct._objc_selector*,
...)*> [#uses=1]
  %tmp.16 = tail call %struct.objc_object* (%struct.objc_object*,
%struct._objc_selector*, ...)* %tmp.2( %struct.objc_object* %tmp.10,
%struct._objc_selector* getelementptr ([6 x %struct._objc_selector]*
%_OBJC_SELECTOR_TABLE, int 0, int 1) ) ; <%struct.objc_object*>
[#uses=6]
  %tmp.20 = tail call %struct.objc_object* (%struct.objc_object*,
%struct._objc_selector*, ...)* (%struct.objc_object*,
%struct._objc_selector*)* %objc_msg_lookup( %struct.objc_object*
%tmp.16, %struct._objc_selector* getelementptr ([6 x
%struct._objc_selector]* %_OBJC_SELECTOR_TABLE, int 0, int 2) )
; <%struct.objc_object* (%struct.objc_object*, %struct._objc_selector*,
...)*> [#uses=1]
  tail call %struct.objc_object* (%struct.objc_object*,
%struct._objc_selector*, ...)* %tmp.20( %struct.objc_object* %tmp.16,
%struct._objc_selector* getelementptr ([6 x %struct._objc_selector]*
%_OBJC_SELECTOR_TABLE, int 0, int 2), int 1 ) ;
<%struct.objc_object*>:0 [#uses=0]
  %tmp.29 = tail call %struct.objc_object* (%struct.objc_object*,
%struct._objc_selector*, ...)* (%struct.objc_object*,
%struct._objc_selector*)* %objc_msg_lookup( %struct.objc_object*
%tmp.16, %struct._objc_selector* getelementptr ([6 x
%struct._objc_selector]* %_OBJC_SELECTOR_TABLE, int 0, int 3) )
; <%struct.objc_object* (%struct.objc_object*, %struct._objc_selector*,
...)*> [#uses=1]
  tail call %struct.objc_object* (%struct.objc_object*,
%struct._objc_selector*, ...)* %tmp.29( %struct.objc_object* %tmp.16,
%struct._objc_selector* getelementptr ([6 x %struct._objc_selector]*
%_OBJC_SELECTOR_TABLE, int 0, int 3), int 3 ) ;
<%struct.objc_object*>:1 [#uses=0]
  %tmp.38 = tail call %struct.objc_object* (%struct.objc_object*,
%struct._objc_selector*, ...)* (%struct.objc_object*,
%struct._objc_selector*)* %objc_msg_lookup( %struct.objc_object*
%tmp.16, %struct._objc_selector* getelementptr ([6 x
%struct._objc_selector]* %_OBJC_SELECTOR_TABLE, int 0, int 4) )
; <%struct.objc_object* (%struct.objc_object*, %struct._objc_selector*,
...)*> [#uses=1]
  tail call %struct.objc_object* (%struct.objc_object*,
%struct._objc_selector*, ...)* %tmp.38( %struct.objc_object* %tmp.16,
%struct._objc_selector* getelementptr ([6 x %struct._objc_selector]*
%_OBJC_SELECTOR_TABLE, int 0, int 4) ) ;
<%struct.objc_object*>:2 [#uses=0]
  %tmp.47 = tail call int (sbyte*, ...)* %printf( sbyte*
getelementptr ([2 x sbyte]* %.str_4, int 0, int 0) ) ; <int>
[#uses=0]
  ret int 0
}

declare void %__main()

declare %struct.objc_object* (%struct.objc_object*,
%struct._objc_selector*, ...)* %objc_msg_lookup(%struct.objc_object*,
%struct._objc_selector*)

internal void %_GLOBAL__I_main() {
entry:
  tail call void %__objc_exec_class( sbyte* cast
(%struct._objc_module* %_OBJC_MODULES to sbyte*) )
  ret void
}

declare void %__objc_exec_class(sbyte*)

I have an objective-c file, bar.m, that I try to process in the
following way generating the error shown below. Any help would
be appreciated. I suspect the error is in the first few lines
of output.

That is really really strange. Can you please file a bugzilla report and indicate what target you have llvm-gcc configured for?

Thanks,

-Chris

cfrontend-g++ -o bar.bc bar.m
llvm2cpp -o bar.cpp bar.bc
g++ -c bar.o bar.cpp
ld -o bar bar.o -l objc -l LLVMCore -l LLVMSupport -l LLVMSystem
./bar

Global variable initializer type does not match global variable type!
[13 x sbyte]* %.str_2
Global variable initializer type does not match global variable type!
[9 x sbyte]* %.str_3
Global variable initializer type does not match global variable type!
[2 x sbyte]* %.str_4
Broken module found, verification continues.
; ModuleID = 'bar.ll'
target endian = little
target pointersize = 32
target triple = "i686-pc-linux-gnu"
deplibs = [ "objc", "c", "crtend" ]
  %struct._objc_module = type { int, int, sbyte*,
%struct._objc_symtab* }
  %struct._objc_selector = type { sbyte*, sbyte* }
  %struct._objc_symtab = type { int, %struct._objc_selector**,
short, short, [2 x sbyte*] }
  %struct.objc_class = type { %struct.objc_class*,
%struct.objc_class*, sbyte*, int, uint, int, %struct.objc_ivar_list*,
%struct.objc_method_list*, %struct.sarray*, %struct.objc_class*,
%struct.objc_class*, %struct.objc_protocol_list*, sbyte* }
  %struct.objc_ivar_list = type opaque
  %struct.objc_method_list = type opaque
  %struct.objc_object = type { %struct.objc_class* }
  %struct.objc_protocol_list = type opaque
  %struct.sarray = type opaque
%llvm.global_ctors = appending global [1 x { int, void ()* }] [ { int,
void ()* } { int 65535, void ()* %_GLOBAL__I_main } ] ; <[1 x
{ int, void ()* }]*> [#uses=0]
%.str_2 = internal constant [13 x sbyte] c"Hello world\0A"
; <[13 x sbyte]*> [#uses=1]
%.str_3 = internal constant [9 x sbyte] c"Fraction" ; <[9 x
sbyte]*> [#uses=1]
%.str_4 = internal constant [2 x sbyte] c"\0A" ; <[2 x sbyte]*>
[#uses=1]
%_OBJC_SELECTOR_TABLE = internal global [6 x %struct._objc_selector]
zeroinitializer ; <[6 x %struct._objc_selector]*> [#uses=5]
%_OBJC_MODULES = internal global %struct._objc_module zeroinitializer
; <%struct._objc_module*> [#uses=1]
%__objc_class_name_Fraction = constant uint 0 ; <uint*>
[#uses=0]

implementation ; Functions:

declare int %printf(sbyte*, ...)

declare %struct.objc_object* %objc_get_class(sbyte*)

int %main(int %argc, sbyte** %argv) {
entry:
  tail call void %__main( )
  %tmp.0 = tail call int (sbyte*, ...)* %printf( sbyte*
getelementptr ([13 x sbyte]* %.str_2, int 0, int 0) ) ; <int>
[#uses=0]
  %tmp.5 = tail call %struct.objc_object* %objc_get_class( sbyte*
getelementptr ([9 x sbyte]* %.str_3, int 0, int 0) ) ;
<%struct.objc_object*> [#uses=2]
  %tmp.3 = tail call %struct.objc_object* (%struct.objc_object*,
%struct._objc_selector*, ...)* (%struct.objc_object*,
%struct._objc_selector*)* %objc_msg_lookup( %struct.objc_object* %tmp.5,
%struct._objc_selector* getelementptr ([6 x %struct._objc_selector]*
%_OBJC_SELECTOR_TABLE, int 0, int 0) ) ; <%struct.objc_object*
(%struct.objc_object*, %struct._objc_selector*, ...)*> [#uses=1]
  %tmp.10 = tail call %struct.objc_object* (%struct.objc_object*,
%struct._objc_selector*, ...)* %tmp.3( %struct.objc_object* %tmp.5,
%struct._objc_selector* getelementptr ([6 x %struct._objc_selector]*
%_OBJC_SELECTOR_TABLE, int 0, int 0) ) ; <%struct.objc_object*>
[#uses=2]
  %tmp.2 = tail call %struct.objc_object* (%struct.objc_object*,
%struct._objc_selector*, ...)* (%struct.objc_object*,
%struct._objc_selector*)* %objc_msg_lookup( %struct.objc_object*
%tmp.10, %struct._objc_selector* getelementptr ([6 x
%struct._objc_selector]* %_OBJC_SELECTOR_TABLE, int 0, int 1) )
; <%struct.objc_object* (%struct.objc_object*, %struct._objc_selector*,
...)*> [#uses=1]
  %tmp.16 = tail call %struct.objc_object* (%struct.objc_object*,
%struct._objc_selector*, ...)* %tmp.2( %struct.objc_object* %tmp.10,
%struct._objc_selector* getelementptr ([6 x %struct._objc_selector]*
%_OBJC_SELECTOR_TABLE, int 0, int 1) ) ; <%struct.objc_object*>
[#uses=6]
  %tmp.20 = tail call %struct.objc_object* (%struct.objc_object*,
%struct._objc_selector*, ...)* (%struct.objc_object*,
%struct._objc_selector*)* %objc_msg_lookup( %struct.objc_object*
%tmp.16, %struct._objc_selector* getelementptr ([6 x
%struct._objc_selector]* %_OBJC_SELECTOR_TABLE, int 0, int 2) )
; <%struct.objc_object* (%struct.objc_object*, %struct._objc_selector*,
...)*> [#uses=1]
  tail call %struct.objc_object* (%struct.objc_object*,
%struct._objc_selector*, ...)* %tmp.20( %struct.objc_object* %tmp.16,
%struct._objc_selector* getelementptr ([6 x %struct._objc_selector]*
%_OBJC_SELECTOR_TABLE, int 0, int 2), int 1 ) ;
<%struct.objc_object*>:0 [#uses=0]
  %tmp.29 = tail call %struct.objc_object* (%struct.objc_object*,
%struct._objc_selector*, ...)* (%struct.objc_object*,
%struct._objc_selector*)* %objc_msg_lookup( %struct.objc_object*
%tmp.16, %struct._objc_selector* getelementptr ([6 x
%struct._objc_selector]* %_OBJC_SELECTOR_TABLE, int 0, int 3) )
; <%struct.objc_object* (%struct.objc_object*, %struct._objc_selector*,
...)*> [#uses=1]
  tail call %struct.objc_object* (%struct.objc_object*,
%struct._objc_selector*, ...)* %tmp.29( %struct.objc_object* %tmp.16,
%struct._objc_selector* getelementptr ([6 x %struct._objc_selector]*
%_OBJC_SELECTOR_TABLE, int 0, int 3), int 3 ) ;
<%struct.objc_object*>:1 [#uses=0]
  %tmp.38 = tail call %struct.objc_object* (%struct.objc_object*,
%struct._objc_selector*, ...)* (%struct.objc_object*,
%struct._objc_selector*)* %objc_msg_lookup( %struct.objc_object*
%tmp.16, %struct._objc_selector* getelementptr ([6 x
%struct._objc_selector]* %_OBJC_SELECTOR_TABLE, int 0, int 4) )
; <%struct.objc_object* (%struct.objc_object*, %struct._objc_selector*,
...)*> [#uses=1]
  tail call %struct.objc_object* (%struct.objc_object*,
%struct._objc_selector*, ...)* %tmp.38( %struct.objc_object* %tmp.16,
%struct._objc_selector* getelementptr ([6 x %struct._objc_selector]*
%_OBJC_SELECTOR_TABLE, int 0, int 4) ) ;
<%struct.objc_object*>:2 [#uses=0]
  %tmp.47 = tail call int (sbyte*, ...)* %printf( sbyte*
getelementptr ([2 x sbyte]* %.str_4, int 0, int 0) ) ; <int>
[#uses=0]
  ret int 0
}

declare void %__main()

declare %struct.objc_object* (%struct.objc_object*,
%struct._objc_selector*, ...)* %objc_msg_lookup(%struct.objc_object*,
%struct._objc_selector*)

internal void %_GLOBAL__I_main() {
entry:
  tail call void %__objc_exec_class( sbyte* cast
(%struct._objc_module* %_OBJC_MODULES to sbyte*) )
  ret void
}

declare void %__objc_exec_class(sbyte*)

_______________________________________________
LLVM Developers mailing list
LLVMdev@cs.uiuc.edu http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

-Chris