This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: How to troubleshoot a crash under Cygwin at -O3?
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: Jeffrey Walton <noloader at gmail dot com>
- Cc: "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Wed, 12 Aug 2015 10:31:27 +0100
- Subject: Re: How to troubleshoot a crash under Cygwin at -O3?
- Authentication-results: sourceware.org; auth=none
- References: <CAH8yC8nEi_eMSznfMMO2tRSW0gJ42EmWuiSf3h0hTzJ+Eest0w at mail dot gmail dot com> <CAH6eHdRREwCStk8r4gYWA4veJKJ7xxX0C3QGUrCzhZBxo-rX+A at mail dot gmail dot com>
On 12 August 2015 at 10:22, Jonathan Wakely wrote:
> On 12 August 2015 at 00:03, Jeffrey Walton wrote:
>>
>> *If* I force -fPIC on the command line and endure 135 or so of these:
>>
>> $ make
>> g++ -DNDEBUG -g -O3 -fPIC -march=native -pipe -c shacal2.cpp
>> shacal2.cpp:1:0: warning: -fPIC ignored for target (all code is
>> position independent)
>> // shacal2.cpp - by Kevin Springle, 2003
>> ^
>>
>> Then the program executes fine. But its a very messy compile, and its
>> probably not going to be worth forcing -fPIC because we will get too
>> much negative feedback.
>
> This doesn't make any sense. If -fPIC is ignored then how does addng
> it make any difference?
>
> Have you compared the object files with and without -fPIC to see if it
> does make any difference? If it does, there shouldn't be a warning
> about ignoring it.
Looking at the code for Cysgin it looks like for 64-bit -fpic is
always used, so if you use -fPIC you get a warning, but -fpic would
not get a warning. Adding -fPIC should not affect codegen, because
with or without it you get -fpic. For 32-bit adding either -fpic or
-fPIC gives a warning, but should not affect codegen.
I tested it with mingw32 (which shares the relevant code with Cygwin)
and see no difference in codegen with or without -fPIC. So are you
absolutely sure that adding -fPIC makes a difference, and there isn't
some other change in options between the two builds?