[PATCH] D93395: [clang][cli] Remove -f[no-]trapping-math from -cc1 command line

Jan Svoboda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 21 02:46:03 PST 2020


jansvoboda11 added a comment.

@SjoerdMeijer If you're not comfortable reviewing this, do you know of anyone who might want to take a look?



================
Comment at: clang/lib/Frontend/CompilerInvocation.cpp:3080
   }
   Opts.setFPExceptionMode(FPEB);
 
----------------
SjoerdMeijer wrote:
> jansvoboda11 wrote:
> > The parsing of `OPT_ftrapping_math` and `OPT_fno_trapping_math` is immediately overwritten here.
> Yeah, I did some work in this area some years ago, but that's a few years ago, and then in addition to that, we are talking about option handling in Clang which I always find very confusing... Just saying I can't remember too many details at this point.
> 
> But starting with a first observation, you're saying that things are overwritten here, but they are different options. I.e., the deleted part honours `OPT_ftrapping_math`, and here exception modes are set based on `OPT_ffp_exception_behavior`. So, looks like there is some interaction here... Do we know how this should work?
I see. The thing is, before this patch, we call `Opts.setFPExceptionMode` whenever we see either `OPT_ftrapping_math` or `OPT_fno_trapping_math`.

But then, we **unconditionally** call `Opts.setFPExceptionMode(FPEB)` again here. That **always** overwrites what we previously did for `OPT_f[no_]trapping_math`, making that a dead code.

`Opts.setFPExceptionMode()` doesn't do anything fancy, just assigns the argument to the `Opts.FPExceptionModel` member.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93395/new/

https://reviews.llvm.org/D93395



More information about the cfe-commits mailing list