diff --git a/lib/spack/spack/solver/concretize.lp b/lib/spack/spack/solver/concretize.lp index 95d74d27edd..01462590309 100644 --- a/lib/spack/spack/solver/concretize.lp +++ b/lib/spack/spack/solver/concretize.lp @@ -1205,7 +1205,7 @@ attr("node_flag_propagate", Package, FlagType, Flag, Source) :- attr("node_flag_possible_prop", Package, FlagType, Flag, Source) :- same_compiler(Parent, Package), - attr("node_flag_possible_prop", Parent, _, _, Source), + attr("node_flag_possible_prop", Parent, FlagType, _, Source), attr("node_flag", Source, FlagType, Flag), flag_type(FlagType). diff --git a/lib/spack/spack/test/concretize.py b/lib/spack/spack/test/concretize.py index 7ebdc1f3ae2..267cef61547 100644 --- a/lib/spack/spack/test/concretize.py +++ b/lib/spack/spack/test/concretize.py @@ -374,6 +374,16 @@ def test_concretize_propagate_compiler_flag_not_passed_to_dependent(self): assert spec.satisfies("^dyninst cflags='-O3'") assert spec.satisfies("^libelf cflags='-g'") + @pytest.mark.only_clingo( + "Optional compiler propagation isn't deprecated for original concretizer" + ) + def test_concretize_propagate_specified_compiler_flag(self): + spec = Spec("callpath cflags=='-g' cxxflags='-O3'") + spec.concretize() + + assert spec.satisfies("^dyninst cflags='-g'") + assert not spec.satisfies("^dyninst cxxflags='-O3'") + def test_mixing_compilers_only_affects_subdag(self): spack.config.set("packages:all:compiler", ["clang", "gcc"]) spec = Spec("dt-diamond%gcc ^dt-diamond-bottom%clang").concretized()