public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "octoploid at yandex dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/59083] -fisolate-erroneous-paths produces illegal instruction with enabled -fprofile-generate
Date: Tue, 12 Nov 2013 16:39:00 -0000	[thread overview]
Message-ID: <bug-59083-4-K3R2cvL5Gf@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-59083-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59083

--- Comment #7 from Markus Trippelsdorf <octoploid at yandex dot com> ---
markus@x4 tmp % cat test.c
#include <setjmp.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>

static sigjmp_buf jmpbuf;

static void
sig_handler (int signo)
{
  siglongjmp (jmpbuf, 1);
}

int
main (void)
{
  char *p = NULL;
  volatile int ret = 0;
  struct sigaction sa;

  sa.sa_handler = sig_handler;
  sigemptyset (&sa.sa_mask);
  sa.sa_flags = SA_SIGINFO;

  if (sigaction (SIGSEGV, &sa, 0))
    {
      perror ("installing SIGSEGV handler\n");
      exit (1);
    }

  puts ("Attempting to sprintf to null ptr");
  if (setjmp (jmpbuf))
    {
      puts ("Exiting main...");
      return ret;
    }

  sprintf (p, "This should segv\n");

  return 1;
}

markus@x4 tmp % gcc -O2 test.c && ./a.out
Attempting to sprintf to null ptr
[1]    28519 illegal hardware instruction  ./a.out
markus@x4 tmp % gcc -fno-isolate-erroneous-paths -O2 test.c && ./a.out
Attempting to sprintf to null ptr
Exiting main...
markus@x4 tmp %


  parent reply	other threads:[~2013-11-12 16:39 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-11 22:04 [Bug c++/59083] New: " marxin.liska at gmail dot com
2013-11-11 22:50 ` [Bug c++/59083] " law at redhat dot com
2013-11-12 16:00 ` marxin.liska at gmail dot com
2013-11-12 16:17 ` octoploid at yandex dot com
2013-11-12 16:19 ` law at redhat dot com
2013-11-12 16:26 ` octoploid at yandex dot com
2013-11-12 16:39 ` octoploid at yandex dot com [this message]
2013-11-12 23:10 ` law at redhat dot com
2013-11-13  5:17 ` octoploid at yandex dot com
2013-11-13  5:30 ` law at redhat dot com
2013-11-13  7:34 ` law at redhat dot com
2013-11-13  7:42 ` law at redhat dot com
2013-11-13  7:50 ` octoploid at yandex dot com
2013-11-13  9:08 ` octoploid at yandex dot com
2013-11-13 15:47 ` rguenth at gcc dot gnu.org
2013-11-13 16:50 ` law at redhat dot com
2013-11-13 17:04 ` octoploid at yandex dot com
2013-11-13 17:10 ` law at redhat dot com
2013-11-18 12:03 ` octoploid at yandex dot com
2013-12-18 13:08 ` trippels at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-59083-4-K3R2cvL5Gf@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).