Re: Bad executable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 24/06/2021 13:05, gmail Vladimir Koković via Gcc-help wrote:
> The NetBeans project contains all the elements of the build as well as
> compiler options.
> 
> To be clearer, here is output from the build:
> 

<snip>

No one is going to be able to replicate your entire PC, IDE, build
environment, etc.  This is not paid support - no one is going to spend
the huge effort required here.  You get the compiler for free, and /you/
are expected to do the work required to write and debug your code.
People on this list (and other sources) that offer help for free do so
to aid fellow developers, but they have very limited time and scope for
doing so.  You have to help others help you.  You don't go to a car
enthusiast forum, say "there's something wrong in my car", show them a
photo of it and a complete list of serial numbers of every part in the
vehicle.  That is what you are doing here, and it won't get you anywhere.

Alternatively, you have to pay someone to help - there are many sources
of paid gcc support available (from Red Hat / IBM, Code Sourcery /
Mentor Graphics, and others).


So you have to figure out the important information, and the code that
is causing problems.  If it really does seem to be a gcc bug (these do
exist, but they are far rarer than bugs in programmer's code) then the
compiler version is important.  Compiler options are important.  Your
IDE and your machine details are irrelevant.

You should first try your code with the options that Jonathan suggested.
 You don't appear to have any warning checks enabled at all - expect to
see many warning messages when you have -Wall -Wextra enabled.  There is
a good chance this will lead to you finding the bug in your code that is
causing you trouble.

If you are still having problems, the next step is to get a /minimal/
sample code that demonstrates the problem.  Typically that could be 10
to 30 lines of code, with the only headers included being standard
library headers (so you can have <stdint.h>, but not <stat.h> or any
OS-specific headers, and certainly no project-specific headers).  During
this process, there is again a very good chance that you will spot the
problem yourself.

At this stage, you have code that other people can look at, and it makes
sense to show it to others (such as on this list) with a description of
what you think should happen, and what goes wrong.  Then people can help
and perhaps guess where the problem lies - or say if they think it is a
compiler bug.

A very useful tool here is the <https://godbolt.org> website, which has
an online compiler.  Put your code there, and you can test it with
different compilers and different options.  This is a huge help when
checking the results with different compiler versions.  And if your code
is too big for the web page to be practical, or you can't get it to
compile, then you have not yet got your minimal sample.


Hopefully this will help you find your problem yourself, or to present
it in a way that others will be able to help you.

David




> On 24.6.21. 11:06, Jonathan Wakely wrote:
>> On Thu, 24 Jun 2021 at 07:34, gmail Vladimir Koković via Gcc-help
>> <gcc-help@xxxxxxxxxxx> wrote:
>>>
>>> I'm not sure if this is a GCC bug so I'm looking for help.
>>>
>>> Namely, although everything is regular when it comes to .C programs, the
>>> result is defective executable.
>> Defective how? You haven't even told us what the error is.
>>
>> As it says at https://gcc.gnu.org/bugs/
>>
>> "Before reporting that GCC compiles your code incorrectly, compile it
>> with gcc -Wall -Wextra and see whether this shows anything wrong with
>> your code. Similarly, if compiling with -fno-strict-aliasing -fwrapv
>> -fno-aggressive-loop-optimizations makes a difference, or if compiling
>> with -fsanitize=undefined produces any run-time errors, then your code
>> is probably not correct. "
>>
>> Have you tried those options?
> 




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux