public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: Theodore Papadopoulo <Theodore.Papadopoulo@inria.fr>
Cc: "gcc@gcc.gnu.org" <gcc@gcc.gnu.org>
Subject: Re: Enquiry
Date: Sun, 30 Jan 2022 11:17:17 +0000	[thread overview]
Message-ID: <CAH6eHdSs+H-tBL125mxqKHEXF_Fkyb=YzkKFZ4rrDxxwsGGeuA@mail.gmail.com> (raw)
In-Reply-To: <a552f708-1c33-0820-a276-c63a922cbf2d@inria.fr>

Meta-comment: a subject line of "Enquiry" is very vague, and most commonly
used by spammers and phishers. Your enquiry is about undefined behaviour
due to a missing return, which would have been a much better subject.




On Sun, 30 Jan 2022, 09:48 Theodore Papadopoulo, <
Theodore.Papadopoulo@inria.fr> wrote:

> Before creating a bug report, I want to check with the GCC community
> (all the more that checking that the problem has not yet been reported
> is complicated at leat for me).
>
> The following (admitedly buggy) program generates a segmentation
> violation on fedora 35 (this is with g++ 11.2.1 20211203 (Red Hat
> 11.2.1-7) (GCC))
> when compiled with -O3 (other versions replacing unisgned by std::string
> may trigger the exception instead of the segv)
>
> bool assert_sthg(const unsigned s) {
>      if (s==123)
>          throw 1;
> }
>
> int main() {
>      assert_sthg(0);
>      return 0;
> }
>
> When compiling, we indeed get a warning:
>
> test.C:4:1: warning: control reaches end of non-void function
> [-Wreturn-type]
>
> I can well understand that the program being buggy that the optimizer is
> allowed to do anything including the observed segmentation violation.
> Yet the result is quite surprising....
> The question is, in that case, wouldn't it be better to turn the warning
> into an error at -O3 ?
>
>      Thank's for any input.
>
>          Theo.
>
>

  parent reply	other threads:[~2022-01-30 11:17 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-30  9:47 Enquiry Theodore Papadopoulo
2022-01-30 10:41 ` Enquiry Jakub Jelinek
2022-01-30 10:50   ` Enquiry Jonathan Wakely
2022-01-30 10:58     ` Enquiry Jakub Jelinek
2022-01-30 11:11       ` Enquiry Jonathan Wakely
2022-01-31  9:42         ` Enquiry Jakub Jelinek
2022-01-31 10:25         ` Enquiry Andreas Schwab
2022-01-31 10:33           ` Enquiry Jonathan Wakely
2022-01-31 10:16       ` Enquiry Theodore Papadopoulo
2022-01-31 10:23         ` Enquiry Jonathan Wakely
2022-01-30 11:17 ` Jonathan Wakely [this message]
2022-01-31  9:26   ` Enquiry Theodore Papadopoulo
  -- strict thread matches above, loose matches on Subject: below --
2020-09-12 23:44 Enquiry Paul
2009-06-02 13:52 Enquiry Vijay Holimath
     [not found] ` <dfa53ad0906021048t7e1c1fc7pf019d1229f529592@mail.gmail.com>
     [not found]   ` <dfa53ad0906021050p7aa605f2m4a1b6459b7f1f89e@mail.gmail.com>
2009-06-03 10:33     ` Enquiry Vijay
2009-06-02 13:00 Enquiry Vijay Holimath
2006-09-29 13:00 ENQUIRY Dr.Richard Lovward
2000-09-21 20:26 enquiry Adarsh MP
2000-09-22  2:15 ` enquiry Erik Mouw

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='CAH6eHdSs+H-tBL125mxqKHEXF_Fkyb=YzkKFZ4rrDxxwsGGeuA@mail.gmail.com' \
    --to=jwakely.gcc@gmail.com \
    --cc=Theodore.Papadopoulo@inria.fr \
    --cc=gcc@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).