This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/81508] Control reaches end of non-void function - warning not emitted when optimization is turned on


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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2017-07-22
      Known to work|                            |7.1.0
     Ever confirmed|0                           |1
      Known to fail|                            |6.4.1

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
So the bug is that GCC 6 ignores the noreturn attribute when there's a local
variable with a nontrivial destructor that runs after the noreturn function:

struct S {
  ~S() { }
};

int flush_result();

class LogMessageFatal {
 public:
  ~LogMessageFatal() __attribute__ ((noreturn));
};


int Flush() {

  S lol;

  switch (flush_result()) {
  case 0:
      LogMessageFatal();

  case 1:
      return 1;
  }
  LogMessageFatal();
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]