Skip to content

Commit 9730230

Browse files
committed
add -O2 when compiling rt, fix warnings triggered by optimizer
1 parent 21b31a3 commit 9730230

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

Makefile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ endif
1111

1212
CFG_INFO := $(info cfg: building on $(CFG_OSTYPE) $(CFG_CPUTYPE))
1313

14-
CFG_GCC_CFLAGS :=
14+
CFG_GCC_CFLAGS := -O2 -fno-strict-aliasing
1515
CFG_GCC_LINK_FLAGS :=
1616
CFG_BOOT_FLAGS := $(BOOT_FLAGS)
1717
CFG_RUSTC_FLAGS := -nowarn -O

src/rt/rust_crate_reader.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ rust_crate_reader::mem_reader::adv_zstr(size_t sz)
6565
{
6666
sz = 0;
6767
while (ok) {
68-
char c;
68+
char c = 0;
6969
get(c);
7070
++sz;
7171
if (c == '\0')
@@ -124,7 +124,7 @@ rust_crate_reader::abbrev_reader::abbrev_reader
124124
// tell_off());
125125

126126
uintptr_t idx, tag;
127-
uint8_t has_children;
127+
uint8_t has_children = 0;
128128
get_uleb(idx);
129129
get_uleb(tag);
130130
get(has_children);

src/rt/rust_internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ rust_crate_reader
403403
void get_uleb(T &out) {
404404
out = T(0);
405405
for (size_t i = 0; i < sizeof(T) && ok; ++i) {
406-
uint8_t byte;
406+
uint8_t byte = 0;
407407
get(byte);
408408
out <<= 7;
409409
out |= byte & 0x7f;

src/rt/rust_task.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ rust_task::start(uintptr_t exit_task_glue,
175175
*spp-- = (uintptr_t) 0x0; // output
176176
*spp-- = (uintptr_t) 0x0; // retpc
177177

178-
uintptr_t exit_task_frame_base;
178+
uintptr_t exit_task_frame_base = 0;
179179

180180
if (spawnee_abi == ABI_X86_RUSTBOOT_CDECL) {
181181
for (size_t j = 0; j < n_callee_saves; ++j) {
@@ -454,7 +454,7 @@ rust_task::notify_tasks_waiting_to_join() {
454454
while (tasks_waiting_to_join.is_empty() == false) {
455455
log(rust_log::TASK, "notify_tasks_waiting_to_join: %d",
456456
tasks_waiting_to_join.size());
457-
maybe_proxy<rust_task> *waiting_task;
457+
maybe_proxy<rust_task> *waiting_task = 0;
458458
tasks_waiting_to_join.pop(&waiting_task);
459459
if (waiting_task->is_proxy()) {
460460
notify_message::send(notify_message::WAKEUP, "wakeup",

src/rt/util/indexed_list.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ indexed_list<T>::remove(T *value) {
5959
assert (value->list_index >= 0);
6060
assert (value->list_index < (int32_t)list.size());
6161
int32_t removeIndex = value->list_index;
62-
T *last;
62+
T *last = 0;
6363
list.pop(&last);
6464
if (last->list_index == removeIndex) {
6565
last->list_index = -1;

0 commit comments

Comments
 (0)