public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Random Crash Observed while running program compiled with latest gcc
@ 2023-02-09 10:56 praveen ab
  2023-02-09 10:59 ` Xi Ruoyao
  2023-02-09 11:01 ` Arsen Arsenović
  0 siblings, 2 replies; 4+ messages in thread
From: praveen ab @ 2023-02-09 10:56 UTC (permalink / raw)
  To: gcc-help

[-- Attachment #1: Type: text/plain, Size: 591 bytes --]

Hi All,

We are upgrading the GCC version for our existing C/C++ project.
Earlier we were using gcc 5.4 and everything was working fine.(The
application works fine even with gcc 7.4)
When trying to build the application using gcc 8.1 and above we are
observing the random crashes mostly segmentation fault.
Any suggestions on how to debug this?

Right now I am trying the following:
Enabling the -Wall flag and trying to fix all the warnings
Using GDB to inspect memory location and variables.

Please Suggest anything else that needs to be checked?


-- 
*Thanks and Regards,*
*Praveen AB*

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Random Crash Observed while running program compiled with latest gcc
  2023-02-09 10:56 Random Crash Observed while running program compiled with latest gcc praveen ab
@ 2023-02-09 10:59 ` Xi Ruoyao
  2023-02-09 11:01 ` Arsen Arsenović
  1 sibling, 0 replies; 4+ messages in thread
From: Xi Ruoyao @ 2023-02-09 10:59 UTC (permalink / raw)
  To: praveen ab, gcc-help

On Thu, 2023-02-09 at 16:26 +0530, praveen ab via Gcc-help wrote:
> Hi All,
> 
> We are upgrading the GCC version for our existing C/C++ project.
> Earlier we were using gcc 5.4 and everything was working fine.(The
> application works fine even with gcc 7.4)
> When trying to build the application using gcc 8.1 and above we are
> observing the random crashes mostly segmentation fault.
> Any suggestions on how to debug this?
> 
> Right now I am trying the following:
> Enabling the -Wall flag and trying to fix all the warnings
> Using GDB to inspect memory location and variables.
> 
> Please Suggest anything else that needs to be checked?

Try -fsanitize=undefined and -fsanitize=address.

-- 
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Random Crash Observed while running program compiled with latest gcc
  2023-02-09 10:56 Random Crash Observed while running program compiled with latest gcc praveen ab
  2023-02-09 10:59 ` Xi Ruoyao
@ 2023-02-09 11:01 ` Arsen Arsenović
  2023-02-09 17:45   ` praveen ab
  1 sibling, 1 reply; 4+ messages in thread
From: Arsen Arsenović @ 2023-02-09 11:01 UTC (permalink / raw)
  To: praveen ab; +Cc: gcc-help

[-- Attachment #1: Type: text/plain, Size: 1112 bytes --]

Hi,

praveen ab via Gcc-help <gcc-help@gcc.gnu.org> writes:

> Hi All,
>
> We are upgrading the GCC version for our existing C/C++ project.
> Earlier we were using gcc 5.4 and everything was working fine.(The
> application works fine even with gcc 7.4)
> When trying to build the application using gcc 8.1 and above we are
> observing the random crashes mostly segmentation fault.
> Any suggestions on how to debug this?
>
> Right now I am trying the following:
> Enabling the -Wall flag and trying to fix all the warnings
> Using GDB to inspect memory location and variables.
>
> Please Suggest anything else that needs to be checked?

The UB sanitizer might also prove useful to detect UB that does not
necessarily result in crashes.  Pass -fsanitize=undefined to enable it.

I can't provide much more specific instructions, but it's quite likely
that there's a good bit of UB in the code you're building, if it broke
in such a regard on compiler updates.

Is there a reason for using GCC 8 as opposed to newer GCC versions?

Best of luck, have a great day.
-- 
Arsen Arsenović

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 381 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Random Crash Observed while running program compiled with latest gcc
  2023-02-09 11:01 ` Arsen Arsenović
@ 2023-02-09 17:45   ` praveen ab
  0 siblings, 0 replies; 4+ messages in thread
From: praveen ab @ 2023-02-09 17:45 UTC (permalink / raw)
  To: Arsen Arsenović; +Cc: gcc-help

[-- Attachment #1: Type: text/plain, Size: 1671 bytes --]

Hi Xi Ruoyao and Arsen Arsenović

Thanks for the suggestion to use -fsanitize=undefined flag, with this flag
I am able to identify and fix multiple runtime errors and further able to
find many more as I am proceeding with running different scenarios.

@Arsen Arsenović: I am using GCC 11.3 (I started observing the random crash
issue due to UBs with gcc > 7.4)




On Thu, Feb 9, 2023 at 4:37 PM Arsen Arsenović <arsen@aarsen.me> wrote:

> Hi,
>
> praveen ab via Gcc-help <gcc-help@gcc.gnu.org> writes:
>
> > Hi All,
> >
> > We are upgrading the GCC version for our existing C/C++ project.
> > Earlier we were using gcc 5.4 and everything was working fine.(The
> > application works fine even with gcc 7.4)
> > When trying to build the application using gcc 8.1 and above we are
> > observing the random crashes mostly segmentation fault.
> > Any suggestions on how to debug this?
> >
> > Right now I am trying the following:
> > Enabling the -Wall flag and trying to fix all the warnings
> > Using GDB to inspect memory location and variables.
> >
> > Please Suggest anything else that needs to be checked?
>
> The UB sanitizer might also prove useful to detect UB that does not
> necessarily result in crashes.  Pass -fsanitize=undefined to enable it.
>
> I can't provide much more specific instructions, but it's quite likely
> that there's a good bit of UB in the code you're building, if it broke
> in such a regard on compiler updates.
>
> Is there a reason for using GCC 8 as opposed to newer GCC versions?
>
> Best of luck, have a great day.
> --
> Arsen Arsenović
>


-- 
*Thanks and Regards,*
*Praveen AB*

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-02-09 17:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-09 10:56 Random Crash Observed while running program compiled with latest gcc praveen ab
2023-02-09 10:59 ` Xi Ruoyao
2023-02-09 11:01 ` Arsen Arsenović
2023-02-09 17:45   ` praveen ab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).