On 2/15/22 10:02, Richard Sandiford wrote:
Dan Li <ashim...@linux.alibaba.com> writes:
Shadow Call Stack can be used to protect the return address of a
Looks good, thanks. However, when I bootstrap it on
aarch64-linux-gnu I get:
.../gcc/ubsan.cc: In function ‘bool
ubsan_expand_null_ifn(gimple_stmt_iterator*)’:
.../gcc/ubsan.cc:835:50: error: enumerated and non-enumerated type in
conditional expression [-Werror=extra]
835 | = (flag_sanitize_recover & ((check_align ? SANITIZE_ALIGNMENT
: 0)
|
~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
.../gcc/ubsan.cc:836:51: error: enumerated and non-enumerated type in
conditional expression [-Werror=extra]
836 | | (check_null ? SANITIZE_NULL :
0)))
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
I think this is because you're taking the last available bit
of the enum :-)
A hacky fix is to add "+ 0" to SANITIZE_ALIGNMENT and SANITIZE_NULL
in the code quoted above (i.e. the code in the error messages).
That seems slightly more robust than a cast to unsigned int (say),
since "+ 0" will work even if the values become 64-bit quantities
in future.
Richard
Hi, Richard,
I have sent out the v6[1]. I re-tested native/cross-compile, and tested
all test cases in both cases (make -k check).
The test results of this patch are consistent with the current mainline
(but in my test environment there are some test cases that fail in both).
The current version seems fine to me, please let me know if I'm missing
something :)
[1]https://gcc.gnu.org/pipermail/gcc-patches/2022-February/590602.html
Thanks,
Dan