On Sun, 24 Sep 2023, Vineet Gupta wrote: > This fix is great but is there a more general solution to the problem when we > toolchain is built for say just rv64 (and thus only those headers) vs. test > building for say rv32 (and failing to build due to lack of headers) or > vice-versa.
The MIPS port has logic in its target test script for combining test options and excluding ones that are mutually incompatible due to ABI or ISA restrictions. It wasn't written by me and I have only minimally tweaked it (and then many years ago), so I can't remember all the details offhand. See the top comment in gcc/testsuite/gcc.target/mips/mips.exp for further information including usage. I guess it would make sense to pinch that logic for our port, especially given our growing number of machine options. I think it was mentioned at one of the patch review calls (Jeff?). NB the use of this specific <assert.h> header, still in place elsewhere, seems gratuitous to me. We don't need or indeed want to print anything in the test cases (unless verifying something specific to the print facility) and if we want to avoid minor code duplication (i.e. not to have explicit: if (...) __builtin_abort (); replicated across test cases), we can easily implement this via a local header, there's no need to pull in a complex system facility. Also I find the use of this facility questionable in the first place: do we want these test cases to pass even in the case of an issue if run with -DNDEBUG as a target board option (which would cause some tests to be optimised away in their entriety)? Maciej