Issue |
120825
|
Summary |
[JumpThreadingPass] Local variable not init lead to miscompilation
|
Labels |
miscompilation
|
Assignees |
|
Reporter |
hstk30-hw
|
https://godbolt.org/z/b7W6Mbnqr
```
#include "stdio.h"
#include "stdint.h"
typedef struct {
uint8_t key_word[48];
uint32_t value;
} ini_st;
uint32_t ext_call(char *section, ini_st *section_cfg, uint32_t section_cfg_num);
uint32_t callee(uint32_t *cfg)
{
ini_st arr[] = {
{"foo", 0xFFFFFFFF},
};
uint32_t cfg_num = sizeof(arr) / sizeof(ini_st);
uint32_t ret = ext_call("bar", arr, cfg_num);
if (ret != (0)) {
return ret;
}
if (arr[0].value == 0xFFFFFFFF) {
return (1);
}
*cfg = arr[0].value;
return (0);
}
unsigned int caller(void)
{
uint32_t cfg;
if (callee(&cfg) == (0)) {
printf("%d, %d\n", cfg, __LINE__);
}
printf("%d, %d\n", cfg, __LINE__);
return 1;
}
```
I don't think this code is Erroneous, even the variable `cfg` is not init.
But JumpThreadingPass seem miscompile it.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs