================ @@ -866,6 +866,17 @@ void Flang::ConstructJob(Compilation &C, const JobAction &JA, } } + // -fno-strict-overflow implies -fwrapv if it isn't disabled, but + // -fstrict-overflow won't turn off an explicitly enabled -fwrapv. + if (Arg *A = Args.getLastArg(options::OPT_fwrapv, options::OPT_fno_wrapv)) { + if (A->getOption().matches(options::OPT_fwrapv)) + CmdArgs.push_back("-fwrapv"); + } else if (Arg *A = Args.getLastArg(options::OPT_fstrict_overflow, + options::OPT_fno_strict_overflow)) { + if (A->getOption().matches(options::OPT_fno_strict_overflow)) + CmdArgs.push_back("-fwrapv"); + } + ---------------- yus3710-fj wrote:
Thank you for showing me a better way. I created a function `renderIntegerOverflowOptions` to handle common options between clang and flang. However, I'm not sure the name of the function is appropriate because there are other related options handled only by clang (e.g. `-ftrapv`). https://github.com/llvm/llvm-project/pull/110061 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits