FS#49826 - [gcc] The compiler eliminates verification code in function

Attached to Project: Arch Linux
Opened by Roman Mikhayloff (rimf) - Thursday, 23 June 2016, 22:13 GMT
Last edited by Allan McRae (Allan) - Friday, 09 September 2016, 10:38 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Allan McRae (Allan)
Architecture x86_64
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Codeblocks crash on startup.

Thread 1 "codeblocks" received signal SIGSEGV, Segmentation fault.
0x00007ffff5d200b3 in wxStringBase::operator=(wxStringBase const&) () from /usr/lib/libwx_baseu-2.8.so.0
(gdb) bt
#0 0x00007ffff5d200b3 in wxStringBase::operator=(wxStringBase const&) () from /usr/lib/libwx_baseu-2.8.so.0
#1 0x00007ffff7a6d031 in wxString::operator= (this=0xe277e8) at /usr/include/wx-2.8/wx/string.h:659
#2 wxPGProperty::DoSetName (str=..., this=0xe277d0) at ../../../src/sdk/wxpropgrid/include/wx/propgrid/propgrid.h:3289
#3 wxPGProperty::Init (this=this@entry=0xe277d0, label=..., name=...) at src/propgrid.cpp:690
#4 0x00007ffff7a7b7e5 in wxPGProperty::wxPGProperty (this=0xe277d0, label=..., name=...) at src/propgrid.cpp:707
#5 0x00007ffff7a969f5 in wxStringProperty::wxStringProperty (this=0xe277d0, label=..., name=..., value=...) at src/props.cpp:71
#6 0x0000000000506523 in WatchesProperty::WatchesProperty (readonly=0x0, watch=..., value=..., label=..., this=0xe277d0) at watchesdlg.cpp:148
#7 WatchesDlg::WatchesDlg (this=0xc7f320) at watchesdlg.cpp:402
#8 0x000000000046b0a5 in DebugInterfaceFactory::CreateWatches (this=<optimized out>) at debugger_interface_creator.cpp:180
#9 0x00007ffff76f53fa in DebuggerManager::CreateWindows (this=this@entry=0xc6a730) at debuggermanager.cpp:1007
#10 0x00007ffff76f548d in DebuggerManager::SetInterfaceFactory (this=0xc6a730, factory=<optimized out>) at debuggermanager.cpp:983
#11 0x00000000004ab02d in MainFrame::SetupDebuggerUI (this=this@entry=0x12ca950) at main.cpp:831
#12 0x00000000004bdce9 in MainFrame::CreateIDE (this=this@entry=0x12ca950) at main.cpp:744
#13 0x00000000004c199b in MainFrame::MainFrame (this=0x12ca950, parent=<optimized out>) at main.cpp:602
#14 0x0000000000456940 in CodeBlocksApp::InitFrame (this=this@entry=0x83a9a0) at app.cpp:489
#15 0x000000000045afde in CodeBlocksApp::OnInit (this=0x83a9a0) at app.cpp:697
#16 0x00007ffff5d0114c in wxEntry(int&, wchar_t**) () from /usr/lib/libwx_baseu-2.8.so.0
#17 0x0000000000449582 in main (argc=<optimized out>, argv=<optimized out>) at app.cpp:322

It seems the compiler eliminates verification code in function:

680 void wxPGProperty::Init( const wxString& label, const wxString& name )
681 {
682 if ( &label != ((wxString*)NULL) )
683 m_label = label;
684
685 #ifndef __WXPYTHON__
686 if ( &name != ((wxString*)NULL) )
687 #else
688 if ( (&name != ((wxString*)NULL)) && name != wxT("_LABEL_AS_NAME") )
689 #endif
690 DoSetName( name );
691 else
692 DoSetName( m_label );
693
694 Init();
695 }

Maybe this is gcc error. Please, check it. Thanks.

gcc (GCC) 6.1.1 20160602 (gcc-multilib-6.1.1-2-x86_64.pkg.tar.xz)
Code::Blocks Release 16.01 rev 10692 Jun 11 2016, 23:37:16 - wx2.8.12 (Linux, unicode) - 64 bit (codeblocks-16.01-3-x86_64.pkg.tar.xz)
This task depends upon

Closed by  Allan McRae (Allan)
Friday, 09 September 2016, 10:38 GMT
Reason for closing:  Not a bug
Comment by Allan McRae (Allan) - Friday, 24 June 2016, 07:18 GMT
Did you step though the function to confirm the test is not done?
Comment by Roman Mikhayloff (rimf) - Friday, 24 June 2016, 08:30 GMT
I just ran the "gdb codeblocks", run command, and received a segmentation fault.
Call Stack on your assembly can not be similar to mine (I checked on its own assembly with debugging enabled), but the cause of the crash is the same error.
Comment by Allan McRae (Allan) - Friday, 09 September 2016, 02:18 GMT
Can anyone confirm whether this is fixed in gcc-6.2.1-1?
Comment by Roman Mikhayloff (rimf) - Friday, 09 September 2016, 10:24 GMT
I'am sorry, this is a feature, not a bug. Option -fdelete-null-pointer-chesks is now enabled by default. I added the option -fno-delete-null-pointer-chesks the project and now this code works as it should.

Loading...