Excerpts from Uros Bizjak's message of November 11, 2026 9:38 am:
> -fcf-protection=check is ignored at compile time, but it sets
> flag_cf_protection to CF_CHECK | CF_SET. The D front end therefore
> defined the GNU_CET version identifier and returned 8 from
> __traits(getTargetInfo, "CET") even though neither IBT nor SHSTK is
> enabled.
>
> Define GNU_CET only when CF_BRANCH or CF_RETURN is set, and return only
> those bits from getTargetInfo ("CET"), as already done for __CET__ in
> the C family front ends.
>
> Assisted-by: Claude Sonnet 5.5
>
> PR target/128373
>
> gcc/ChangeLog:
>
> * config/i386/i386-d.cc (ix86_d_target_versions):
> Define GNU_CET only when CF_BRANCH or CF_RETURN is set.
> (ix86_d_handle_target_cf_protection): Return only
> the CF_BRANCH and CF_RETURN bits.
>
> gcc/testsuite/ChangeLog:
>
> * gdc.dg/target/i386/targetinfo_CET.d: Check for
> the exact value 3 and for GNU_CET.
> * gdc.dg/target/i386/targetinfo_CET_check.d: New test.
>
> Regression tested on x86_64-pc-linux-gnu {,-m32} with make check-d.
>
> OK for mainline?
>
OK.
Thanks Uros!
Iain.