public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/102993] New: -mcf-protection=full produces segfaulting code when targeting 32-bit x86 (i686)
@ 2021-10-28 23:56 luke-jr+gccbugs at utopios dot org
  2021-10-29  0:09 ` [Bug target/102993] -fcf-protection=full " pinskia at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: luke-jr+gccbugs at utopios dot org @ 2021-10-28 23:56 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102993

            Bug ID: 102993
           Summary: -mcf-protection=full produces segfaulting code when
                    targeting 32-bit x86 (i686)
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
          Assignee: unassigned at gcc dot gnu.org
          Reporter: luke-jr+gccbugs at utopios dot org
  Target Milestone: ---

Generated programs, when throwing(catching?) an exception, jump to address 0
and crash.

Instead, the compiler should either reject the option, ignore it, or produce
working code.

#include <stdexcept>

void b(){
        throw std::runtime_error("hi");
}

int main(){
        try{
                b();
        }catch(...){}
}


(gdb) bt
#0  0x00401657 in ?? ()
#1  0x00401386 in ?? ()
#2  0x7b454882 in call_process_entry () from
/usr/lib/wine/../i386-linux-gnu/wine/kernel32.dll.so
#3  0x7b454cfc in start_process () from
/usr/lib/wine/../i386-linux-gnu/wine/kernel32.dll.so
#4  0x7b45488e in __wine_start_process () from
/usr/lib/wine/../i386-linux-gnu/wine/kernel32.dll.so
#5  0x00000000 in ?? ()

        }catch(...){
  401657:       89 04 24                mov    %eax,(%esp)
  40165a:       e8 49 00 00 00          call   4016a8 <___cxa_begin_catch>
  40165f:       c7 45 b8 ff ff ff ff    movl   $0xffffffff,-0x48(%ebp)
  401666:       e8 35 00 00 00          call   4016a0 <___cxa_end_catch>
  40166b:       eb d6                   jmp    401643 <_main+0x5e>
  40166d:       8d 45 b4                lea    -0x4c(%ebp),%eax
  401670:       89 04 24                mov    %eax,(%esp)
  401673:       e8 68 10 00 00          call   4026e0
<__Unwind_SjLj_Unregister>

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

end of thread, other threads:[~2022-12-27  7:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-28 23:56 [Bug other/102993] New: -mcf-protection=full produces segfaulting code when targeting 32-bit x86 (i686) luke-jr+gccbugs at utopios dot org
2021-10-29  0:09 ` [Bug target/102993] -fcf-protection=full " pinskia at gcc dot gnu.org
2021-10-29  0:33 ` luke-jr+gccbugs at utopios dot org
2021-10-29  6:53 ` rguenth at gcc dot gnu.org
2021-10-29  7:05 ` ebotcazou at gcc dot gnu.org
2021-10-29  8:04 ` rguenth at gcc dot gnu.org
2021-10-29  8:08 ` ebotcazou at gcc dot gnu.org
2021-10-29 17:41 ` luke-jr+gccbugs at utopios dot org
2021-10-30 17:14 ` ebotcazou at gcc dot gnu.org
2022-12-27  7:11 ` nightstrike at gmail dot com

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).