forked from cil-project/cil
-
Notifications
You must be signed in to change notification settings - Fork 21
Closed
Description
During goblint/bench#10 (after a patch to ignore omp pragmas), I discovered that type-generic mathematics is still mishandled in certain circumstances, namely if a pointer dereference occurs inside the expression.
A reduce example is:
#include<tgmath.h>
typedef struct loc_t
{
long nloc;
} loc_t;
void fun(const loc_t* loc) {
long l;
int n0 =(int)sqrt(l); // works
int n1 =(int)sqrt(loc->nloc); // fails
}
int main() {
loc_t loc;
loc_t* ptr = &loc;
fun(ptr);
}This produces errors for the second invocation of sqrt:
2.c:11: Warning: MEMBEROFPTR in constant
2.c:11: Error: cabs2cil/castTo: illegal cast double -> void
2.c:11: Error: cabs2cil/castTo: illegal cast _Complex double -> void
2.c:11: Warning: MEMBEROFPTR in constant
2.c:11: Error: cabs2cil/castTo: illegal cast float -> void
2.c:11: Error: cabs2cil/castTo: illegal cast _Complex float -> void
2.c:11: Warning: MEMBEROFPTR in constant
2.c:11: Error: cabs2cil/castTo: illegal cast long double -> void
2.c:11: Error: cabs2cil/castTo: illegal cast _Complex long double -> void
Error: There were errors during merging
Fatal error: exception Errormsg.Error
It works fine with GCC though.