Hi Matthew, > The current no_fsanitize_address effective target check (implemented in > target-supports.exp rather than in asan.exp) has some problems with the > link path. > > Because it is not called from in between asan_init and asan_finish the > link paths of the compiler are not changed to point at the build > directories. > > That means that they point at the install directory that the current > build is configured for. Hence this test passes if the current compiler > has ASAN support *and* if there are ASAN libraries in the directory that > this build is configured to install into. > > That is an unnecessary requirement. On looking through each of the > tests that currently use no_fsanitize_address it seems all are `compile` > tests. Hence we can change the logical test of the effective target > from "can we link an ASAN executable" to "can we compile for ASAN" and > avoid the need to set up link paths correctly for this test. > > N.b. one alternative would be to remove this effective target and try to > move all tests which currently use this into directories which run their > tests between calls to `asan_finish` and `asan_init`. This seems like > it might ensure a clearer division of "asan tests must be run in X > directories" and avoid problems similar to the one here in the future. > I'm suggesting this change as it appears the easiest to make and I > didn't think the above too bad a risk to take -- especially if the name > of the test is clear.
moving the tests would be clearer IMO, otherwise we have two separate mechanisms for the same issue. Especially since we're talking about 7 tests only. The only complication would be the aarch64 test where there's currently no asan subdir. > In doing this I also inverted the meaning of this check. Rather than > the function indicating whether we *do not* support something and > tests using `dg-skip-if` to avoid running a test if this returns true, > this function indicates whether we *do* support something and tests > use `dg-require-effective-target` to run a test if it returns true. > > Testing done by checking that each of the affected testcases changes > from UNSUPPORTED to PASS when run individually without any install > directory available. Please remember to state on which target you've run the tests. > gcc/testsuite/ChangeLog: > > * g++.dg/warn/uninit-pr93100.C: Convert no_fsanitize_address use > to fsanitize_address_compilation. *If* we go this route (and as I said I'd prefer not to; maybe Mike differs), please rename the new keyword to fsanitize_address_compile in line with e.g. "dg-do compile". You also would need to adjust sourcebuild.texi for the change. > diff --git a/gcc/testsuite/lib/target-supports.exp > b/gcc/testsuite/lib/target-supports.exp > index > d3edc7d839ec2d9460501c157c1129176542d870..d9ea048d01212c4d28e68860a38c523cea8f2393 > 100644 > --- a/gcc/testsuite/lib/target-supports.exp > +++ b/gcc/testsuite/lib/target-supports.exp > @@ -13166,16 +13166,16 @@ proc check_effective_target_movdir { } { > } "-mmovdiri -mmovdir64b" ] > } > > -# Return 1 if the target does not support address sanitizer, 0 otherwise > +# Return 1 if the target supports address sanitizer, 0 otherwise Comment needs adjustment, too. Rainer -- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University