CTSRD-CHERI / cheribsd-ports

FreeBSD ports tree adapted for CheriBSD.
https://CheriBSD.org
Other
5 stars 11 forks source link

sysutils/mstflint: infinite loop for an underaligned store #102

Open kwitaszczyk opened 10 months ago

kwitaszczyk commented 10 months ago

Clang from LLVM for Morello compiling sysutils/mstflint ends up in an infinite loop printing a warning for a potentian underaligned store.

Clang command:

clang++ -target aarch64-unknown-freebsd14.0 -march=morello -mabi=purecap -Xclang -morello-vararg=new -Xclang -morello-bounded-memargs=caller-only -DHAVE_CONFIG_H -I. -I../.. -W -Werror -g -MP -MD -fPIC -Wno-missing-field-initializers -Wno-unused-parameter -isystem /usr/local/include -O2 -pipe -march=morello -Xclang -morello-vararg=new -mabi=purecap -D__LP64__=1 -isystem /usr/local/include -fno-strict-aliasing -isystem /usr/local/include -std=c++14 -isystem /usr/local/include -DHAVE_TERMIOS_H -DNO_INBAND -DMST_UL -MT json_reader.lo -MD -MP -MF .deps/json_reader.Tpo -c json_reader.cpp -fPIC -DPIC -o .libs/json_reader.o

Warning printed in the loop:

json_reader.cpp:304:14: note: use __builtin_assume_aligned() or cast to (u)intptr_t* if you know that the pointer is actually aligned to capability size; this will allow the memcpy() or memmove() call to be inlined if the size is constant (otherwise a library call must be used to maintain tag bits). For more information see https://github.com/CTSRD-CHERI/llvm-project/wiki/Unaligned-capability-copies
json_reader.cpp:304:14: warning: found underaligned store of underaligned load of capability type (aligned to 8 bytes instead of 16). Will use memmove() to preserve tags if it is aligned correctly at runtime [-Wcheri-inefficient]
  token.end_ = current_;
             ^

After 37h trying to build sysutils/mstflint, Poudriere created 168 GB of logs.