You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
环境:x86 ubuntu 20.04
报错如下:
[2/3] Building CXX object CMakeFiles/linux_proc_demo.dir/cron.cpp.o
/home/embedded/CLionProjects/linux_proc_demo/cron.cpp: In member function ‘cronTab::byte cronTab::cron::index(cronTab::field_name)’:
/home/embedded/CLionProjects/linux_proc_demo/cron.cpp:32:18: warning: iteration 5 invokes undefined behavior [-Waggressive-loop-optimizations]
index[i] = index[i-1] + field_size[i-1];
~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/embedded/CLionProjects/linux_proc_demo/cron.cpp:31:23: note: within this loop
for(byte i(1); i<=field_name::year; i++)
如果在Jenkins上会报错,编译不通过
In member function ‘cronTab::byte cronTab::cron::index(cronTab::field_name)’:
error: iteration 5u invokes undefined behavior [-Werror=aggressive-loop-optimizations]
index[i] = index[i-1] + field_size[i-1];
^
note: containing loop
for(byte i(1); i<=field_name::year; i++)
^
In member function ‘cronTab::cron& cronTab::cron::assign(std::__cxx11::string)’:
error: array subscript is above array bounds [-Werror=array-bounds]
}return index[nfield];
Activity