This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to troubleshoot a crash under Cygwin at -O3?


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?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]