public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/110263] New: Bogos Warning [-Wreturn-type] for unreachable code
@ 2023-06-15  6:52 gerstner.thomas at siemens dot com
  0 siblings, 0 replies; only message in thread
From: gerstner.thomas at siemens dot com @ 2023-06-15  6:52 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 110263
           Summary: Bogos Warning [-Wreturn-type] for unreachable code
           Product: gcc
           Version: 13.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gerstner.thomas at siemens dot com
  Target Milestone: ---

The following example (see https://gcc.godbolt.org/z/4477zajnj) produces
Warning [-Wreturn-type]:


bool foo();
int instrumentation = 0;

struct S { ~S(); };

int func() {
    S s;  // if commented out there is no warning [-Wreturn-type]
    while(true) {  // "endless loop"
        if (foo()) return 42;
    }
    instrumentation++; // if commented out there is no warning [-Wreturn-type]
}

Our original code is without the line "instrumentation++;", because this line
is an additional instrumentation by a tool (Squish Coco).

We made [-Wreturn-type] an error and therefor our build fails.

If this example is build with "-O2" the warning is gone.

This problem is very similar to
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67693 which seems to be fixed but
it's not identical.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-06-15  6:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-15  6:52 [Bug c++/110263] New: Bogos Warning [-Wreturn-type] for unreachable code gerstner.thomas at siemens 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).