This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/86129] New: Expect SIGBUS but program just silently exits
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 13 Jun 2018 15:58:35 +0000
- Subject: [Bug c++/86129] New: Expect SIGBUS but program just silently exits
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86129
Bug ID: 86129
Summary: Expect SIGBUS but program just silently exits
Product: gcc
Version: 8.1.0
Status: RESOLVED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: p.sanders at alpinesoft dot co.uk
Target Milestone: ---
Status: RESOLVED
Resolution: INVALID
Hi guys,
My first post here, hope I do things right.
The following code snippet just exits the program silently rather than
generating SIGBUS as you would expect it to. I don't think what doing that is
appropriate.
clang *does* generate SIGBUS, and although the code below is, strictly
speaking, UB, I don't think gcc should behave as it does, for obvious reasons.
OK, here's the code:
#include <iostream>
int main()
{
char *p = (char *) nullptr;
std::cout << "Watch the " << p << "birdie" << std::endl;
return 0;
}
And here's the output (note: no SIGBUS):
Watch the
Live demo here (where you can also try running it with clang)
https://wandbox.org/permlink/M1S74HqjT1HvLtr0
Sounds like an easy fix. Thanks.
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Probably some nonnull attribute somewhere. Anyway, GIGO.