Author Topic: SVN build crashes when trying to editing/adding new compiler flags  (Read 28857 times)

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5239
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: SVN build crashes when trying to editing/adding new compiler flags
« Reply #75 on: June 29, 2016, 10:12:01 am »
@raynebc

See below:

so one could suspect that the nightly would be a bad build, which could be cured by clean all (though when we switched compilers that's what happened), but since the OP has build CB himself and has the same issue, we can rule out that the nightly might be a corrupted build.

It *seems* to be related by using gcc5 (?).


Note that the nightlies switched to gcc 5 at :
Quote
15) all is now build with TDM-GCC 5.1.0, wxWidgets 2.8.12 (11 April 2016)
Therefor it is advised to also redownload the mingwm dll and the wx dll. Since these have also been rebuild with the TDM GCC 5.1.0 compiler (sjlj flavor).

Which is inline with the nightly from that moment having the problem, and the previous nightly (still on gcc 4.9) not having the problem.

So, the crash does not happens on gcc 4.9.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5239
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: SVN build crashes when trying to editing/adding new compiler flags
« Reply #76 on: July 02, 2016, 08:59:41 am »
Guys, I see one crash stack happens in the line (which is in the crash stack) in plugins\compilergcc\compileroptionsdlg.cpp line 3028.
Code: [Select]
        CompilerFlagDlg dlg(nullptr, &copt, categ, categoryName);So, why the first parameter is nullptr?
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5239
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: SVN build crashes when trying to editing/adding new compiler flags
« Reply #77 on: July 02, 2016, 09:39:05 am »
Another guess is that if C::B is build with -O0 option, but wx is build with -O2 option, then some of the data exchanged by C::B and wx are not correct. especially some inline functions or similar things which include in both cpp files from c::b and wx.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5239
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: SVN build crashes when trying to editing/adding new compiler flags
« Reply #78 on: July 02, 2016, 10:19:46 am »
Another guess is that if C::B is build with -O0 option, but wx is build with -O2 option, then some of the data exchanged by C::B and wx are not correct. especially some inline functions or similar things which include in both cpp files from c::b and wx.
I just build C::B with -O2 option, and link with another -O2 wx library, but still same crash here. (TDM gcc 5.1, wx2.8.12 c::b trunk)

EDIT: a -O2 C::B and -O0 WX library works without the crash.
« Last Edit: July 02, 2016, 12:48:20 pm by ollydbg »
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6666
    • My Best Post
Re: SVN build crashes when trying to editing/adding new compiler flags
« Reply #79 on: July 02, 2016, 04:33:42 pm »
Another guess is that if C::B is build with -O0 option, but wx is build with -O2 option, then some of the data exchanged by C::B and wx are not correct. especially some inline functions or similar things which include in both cpp files from c::b and wx.
I just build C::B with -O2 option, and link with another -O2 wx library, but still same crash here. (TDM gcc 5.1, wx2.8.12 c::b trunk)

EDIT: a -O2 C::B and -O0 WX library works without the crash.

Thanks, for confirming my last test of the bug cause.

I think, it is likely an Compiler optimization bug or a wxWidgets library bug instead of Code::Blocks; do you agree?

Tim S.


C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5239
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: SVN build crashes when trying to editing/adding new compiler flags
« Reply #80 on: July 03, 2016, 01:23:35 am »
I think, it is likely an Compiler optimization bug or a wxWidgets library bug instead of Code::Blocks; do you agree?
Yes, I think it is an compiler optimization bug. It happens last year when I try to use wx 3.x under gcc 5.2, and now it also happens on wx 2.8.12 with gcc 5.1. I looked at the last year's posts(Re: Build C::B against wx3.02 with gcc 5.2 under Windows), I see the crash call stack(the latest call of the crash stack) is the same as in this thread.  So, mostly it is an compiler issue I believe.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5239
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: SVN build crashes when trying to editing/adding new compiler flags
« Reply #81 on: July 03, 2016, 03:18:09 am »
News News:
Looks like bugs are located here: #17483 (wxDynamicCast segfault with mingw64 5.3.0 release build) wxWidgets, someone has already found a fix which disable an optimization for the crash function.

Can you guys try and confirm it? Thanks. (I will try it in one or two days)
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5239
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: SVN build crashes when trying to editing/adding new compiler flags
« Reply #82 on: July 03, 2016, 08:35:32 am »
 OK, I can confirm that with the change of adding the

Code: [Select]
__attribute__((optimize("O0")))
decoration to the IsKindOf function in file "wx/object.h", I don't have the crash now.(wx 2.8.12 build with -O2, C::B trunk build with -O2, MinGW-Build GCC 5.3 WinXP)
« Last Edit: July 04, 2016, 09:40:21 am by ollydbg »
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6666
    • My Best Post
Re: SVN build crashes when trying to editing/adding new compiler flags
« Reply #83 on: July 03, 2016, 06:52:41 pm »
OK, I can confirm that with the change of adding the

Code: [Select]
__attribute__((optimize("O0")))
decoration to the IsKindOf function, I don't have the crash now.(wx 2.8.12 build with -O2, C::B trunk build with -O2, MinGW-Build GCC 5.3 WinXP)

I found two different IsKindOf functions in wxWidgets; in "wx/xti.h" and "wx/object.h", which did you change?

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5239
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: SVN build crashes when trying to editing/adding new compiler flags
« Reply #84 on: July 04, 2016, 12:14:11 am »
OK, I can confirm that with the change of adding the

Code: [Select]
__attribute__((optimize("O0")))
decoration to the IsKindOf function, I don't have the crash now.(wx 2.8.12 build with -O2, C::B trunk build with -O2, MinGW-Build GCC 5.3 WinXP)

I found two different IsKindOf functions in wxWidgets; in "wx/xti.h" and "wx/object.h", which did you change?

Tim S.
The later one, you can see wx/object.h in crash call stack I post before.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5239
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: SVN build crashes when trying to editing/adding new compiler flags
« Reply #85 on: July 07, 2016, 03:42:14 am »
Some news about the crash issue, I follow the VZ(wx dev)'s advice to change the function in wx/object.h under wx2.8.12, and  I don't have the crash now, see details here: #17483 (wxDynamicCast segfault with mingw64 5.3.0 release build) wxWidgets
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5193
Re: SVN build crashes when trying to editing/adding new compiler flags
« Reply #86 on: July 08, 2016, 08:41:44 am »
ok I will try this out and build a new wxwidgets dll.


Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5239
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: SVN build crashes when trying to editing/adding new compiler flags
« Reply #87 on: July 14, 2016, 03:57:07 am »
FYI:
The code change I mentioned before to avoid the crash (the gcc compiler optimization error in IsKindOf function) is in wx trunk now.
See this web page: #17483 (wxDynamicCast segfault with mingw64 5.3.0 release build) wxWidgets
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5239
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: SVN build crashes when trying to editing/adding new compiler flags
« Reply #88 on: August 31, 2016, 11:17:03 am »
ok I will try this out and build a new wxwidgets dll.
Ping after two months.  :)
I think we need a fixed wx dll.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5193
Re: SVN build crashes when trying to editing/adding new compiler flags
« Reply #89 on: February 28, 2017, 09:50:46 pm »
Finally getting to it, as far as I understand , rewriting the "IsKindOf" mehotd should be OK :

Like in : http://trac.wxwidgets.org/changeset/aa3acfdd15eff1519a41b48a2babe4cba75660f9/git-wxWidgets

Is that correct ?