CTSRD-CHERI / clang

DO NOT USE. Use llvm-project instead
Other
9 stars 8 forks source link

Error compiling QtBase #174

Closed arichardson closed 6 years ago

arichardson commented 6 years ago
Call parameter type does not match function signature!
  %call3 = tail call %struct.stack_st_SSL_CIPHER addrspace(200)* @_Z17q_SSL_get_ciphersU3capPK6ssl_st(%struct.ssl_st addrspace(200)* %call2) #15, !dbg !32825
 %struct.stack_st addrspace(200)*  %call4118 = call i32 @_Z8q_sk_numU3capP8stack_st(%struct.stack_st_SSL_CIPHER addrspace(200)* %call3) #15, !dbg !32828
Call parameter type does not match function signature!
  %call3 = tail call %struct.stack_st_SSL_CIPHER addrspace(200)* @_Z17q_SSL_get_ciphersU3capPK6ssl_st(%struct.ssl_st addrspace(200)* %call2) #15, !dbg !32825
 %struct.stack_st addrspace(200)*  %call5 = call i8 addrspace(200)* @_Z10q_sk_valueU3capP8stack_sti(%struct.stack_st_SSL_CIPHER addrspace(200)* %call3, i32 signext %i.0120) #15, !dbg !32836
Call parameter type does not match function signature!
  %call3 = tail call %struct.stack_st_SSL_CIPHER addrspace(200)* @_Z17q_SSL_get_ciphersU3capPK6ssl_st(%struct.ssl_st addrspace(200)* %call2) #15, !dbg !32825
 %struct.stack_st addrspace(200)*  %call4 = call i32 @_Z8q_sk_numU3capP8stack_st(%struct.stack_st_SSL_CIPHER addrspace(200)* %call3) #15, !dbg !32828
fatal error: error in backend: Broken function found, compilation aborted!

Reduced test case:

// RUN: %cheri_purecap_cc1 -emit-obj -target-cpu mips4 -cheri-size 128 -std=c++1z -fdeprecated-macro -fvisibility hidden -fvisibility-inlines-hidden -pthread -fcolor-diagnostics -vectorize-loops -vectorize-slp -isystem /local/scratch/alr48/cheri/output/sdk/sysroot128/usr/include/c++/v1/ -isystem /local/scratch/alr48/cheri/output/sdk/sysroot128/usr/include -o - -O0  %s
void a() {
  for (; ((int (*)(int))a)(0);)
    ;
}

Full reproducer: https://gist.github.com/arichardson/09d4569f157e3274ef5c1ccf808f97b0

arichardson commented 6 years ago

Better test case:

// RUN: %cheri_purecap_cc1 -emit-obj -target-cpu mips4 -cheri-size 128 -Os -std=c++1z -fdeprecated-macro -fvisibility hidden -fvisibility-inlines-hidden -pthread -fcolor-diagnostics -vectorize-loops -vectorize-slp -isystem /local/scratch/alr48/cheri/output/sdk/sysroot128/usr/include/c++/v1/ -isystem /local/scratch/alr48/cheri/output/sdk/sysroot128/usr/include -o -  %s
int a(int);
int *q_SSL_get_ciphers(const struct ssl_st *);
void b() {
  int *c = q_SSL_get_ciphers(0);
  for (; ((int (*)(int *))a)(c);)
    ;
}