This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Linking Program with Lib That Uses -fwrapv or '-fno-strict-overflow'
- From: Ian Lance Taylor <iant at google dot com>
- To: noloader at gmail dot com
- Cc: GCC Users List <gcc-help at gcc dot gnu dot org>
- Date: Mon, 25 Jul 2011 17:43:38 -0700
- Subject: Re: Linking Program with Lib That Uses -fwrapv or '-fno-strict-overflow'
- References: <CAH8yC8=ExqwUC=D2SyXeXjg16j8=npGqB1ZApO4uOYLWaX0juQ@mail.gmail.com>
Jeffrey Walton <noloader@gmail.com> writes:
> Is it possible to build a library which specifies -fwrapv or
> '-fno-strict-overflow' but does not penalize the final executable
> (with respect to optimizations) after final linking?
>
> The question arises from a library which detects wrap/carry/overflow
> and might need to specify -fwrapv or '-fno-strict-overflow' to take
> advantage of 2s compliment math used on many modern architectures.
I'm not sure I understand the question. The -fwrapv and
-fno-strict-overflow options only affect the compilation of the code
with which they are used. They do not affect code which is compiled
without those options. They do not affect the linker. So the answer to
your question may be that you should just use the options with the
specific code that needs them. If the answer doesn't make sense, can
you restate the question?
Ian