https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84145
Bug ID: 84145 Summary: Wrong CET options processing Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: igor.v.tsimbalist at intel dot com Target Milestone: --- The gcc error message for not passing -mibt/-mshstk with -fcf-protection seems confusing. It looks like it just checks that one of the options is present and doesn’t check that it’s the option that is required by the protection requested. So it's possible to do -fcf-protection=branch -mshstk and not get an error, but not get any protection either. Here is this part: if (!(TARGET_IBT_P (opts->x_ix86_isa_flags2) || TARGET_SHSTK_P (opts->x_ix86_isa_flags))) { if (flag_cf_protection == CF_FULL) { error ("%<-fcf-protection=full%> requires CET support " "on this target. Use -mcet or one of -mibt, " "-mshstk options to enable CET"); } else if (flag_cf_protection == CF_BRANCH) { error ("%<-fcf-protection=branch%> requires CET support " "on this target. Use -mcet or one of -mibt, " "-mshstk options to enable CET"); } else if (flag_cf_protection == CF_RETURN) { error ("%<-fcf-protection=return%> requires CET support " "on this target. Use -mcet or one of -mibt, " "-mshstk options to enable CET"); } flag_cf_protection = CF_NONE; return false; }