-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Description
my toolchain was built by command ./configure && make linux on unbuntu.
And when compile bellow code, the result is quite different with/without build optimization (-O1 or higher level)
#include <stdio.h>
#define TEE_ERROR_ITEM_NOT_FOUND (0xFFFF0008U)
unsigned int do_something(unsigned long tmp);
asm(
".globl do_something \n\t"
"do_something: \n\t"
"ret \n\t"
);
int main() {
unsigned int res = TEE_ERROR_ITEM_NOT_FOUND;
unsigned long test = res;
if(test == res)
printf("a. %s %llx %llx\n",__TIMESTAMP__, res, test);
if (test == TEE_ERROR_ITEM_NOT_FOUND)
printf("b. %s %llx %llx\n",__TIMESTAMP__, res, test);
res = do_something(test);
if (res != TEE_ERROR_ITEM_NOT_FOUND)
printf("c. %s %llx %llx\n",__TIMESTAMP__, res, test);
return res;
}it shouldn't print "c. %s %llx...", but when use -O1, it will print this sentence, seems it will ignore sign-extension when enable optimization.
it easy to verify.
look forward for your opinion
Metadata
Metadata
Assignees
Labels
No labels