codecheck: Remove UB of ch8 usertests #140
This commit is contained in:
parent
94d5e66f36
commit
972534f70c
12 changed files with 47 additions and 39 deletions
|
@ -6,6 +6,7 @@ extern crate user_lib;
|
|||
extern crate alloc;
|
||||
|
||||
use alloc::vec::Vec;
|
||||
use core::ptr::addr_of_mut;
|
||||
use core::sync::atomic::{AtomicBool, Ordering};
|
||||
use user_lib::{exit, get_time, thread_create, waittid, yield_};
|
||||
|
||||
|
@ -16,7 +17,7 @@ const THREAD_COUNT_DEFAULT: usize = 16;
|
|||
static mut PER_THREAD: usize = 0;
|
||||
|
||||
unsafe fn critical_section(t: &mut usize) {
|
||||
let a = &mut A as *mut usize;
|
||||
let a = addr_of_mut!(A);
|
||||
let cur = a.read_volatile();
|
||||
for _ in 0..500 {
|
||||
*t = (*t) * (*t) % 10007;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue